Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6652121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:05:48+00:00 2026-05-26T01:05:48+00:00

I have a Liferay Vaadin portlet with two modes : Edit and View mode.

  • 0

I have a Liferay Vaadin portlet with two modes : Edit and View mode. The first thing I see in the portlet is the viewContent with a Label : “Not Configured , if the portlet is not configured. Now if I configure the portlet in the Editmode I see the stuff I have made in the configuration, It works so far but now if I log out or restart the Browser (exit and start again) I see the not configured viewContent with the Label (“Not Configured”)

Code :

Window window; // Main Window
VerticalLayout viewContent; // View Mode Content 
VerticalLayout editContent; // Edit Mode Content(Configs)
Label viewText;
Button b;
Panel panel;
Embedded PictureA;

public void init() {
    window = new Window("");
    setMainWindow(window);
    viewContent = new VerticalLayout(); 
    editContent = new VerticalLayout();
    PictureA = new Embedded("", new ExternalResource(PictureAURL));
    PictureA.setType(Embedded.TYPE_IMAGE);

    panel = new Panel();
    panel.setStyleName(Reindeer.PANEL_LIGHT);

    // viewContent
    viewText = new Label("Not Configured" , Label.CONTENT_XHTML);
    viewContent.addComponent(viewText);
    window.setContent(viewContent);

    // EditContent
    b = new Button("PictureA");
    b.addListener(this):
    editContent.addComponent(b);
}

public void buttonClick(ClickEvent event) {
    if (event.getSource == b) {
        viewContent.revomeComponent(viewText);
        panel.addComponent(PictureA);
        viewContent.addComponent(panel);
    }
}

@Override
public void handleRenderRequest(RenderRequest request,
        RenderResponse response, Window window) {

}

@Override
public void handleActionRequest(ActionRequest request,
        ActionResponse response, Window window) {

}

@Override
public void handleEventRequest(EventRequest request,
        EventResponse response, Window window) {

}

@Override
public void handleResourceRequest(ResourceRequest request,
        ResourceResponse response, Window window) {

    // Switch the view according to the portlet mode 
    if (request.getPortletMode() == PortletMode.EDIT) 
        window.setContent(editContent); 
    else if (request.getPortletMode() == PortletMode.VIEW) 
        window.setContent(viewContent);         
}

Situation: if I click on the Button “PictureA” the label “Not Configured” is being deleted and the panel with the embedded picture is being added to the viewContent.

The only problem is that its not being saved :/ Any ideas? Maybe I forgot something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:05:49+00:00Added an answer on May 26, 2026 at 1:05 am

    Yes, you are not saving the configuration anywhere. When the session ends (closing the browser) and reopened your application init is executed again and original “not configured” state is restored.

    You can store it into portlet preferences for example. In the handleResourceRequest method you must grab the handle to PortletPreferences:

    this.prefs = request.getPreferences();
    

    To save the state in in the button click handler do:

    this.prefs.setValues("myapp.configured", new String[] {"true"});
    this.prefs.store();
    

    Also you want to restore the state already in the handleResourceRequest method. Do something like:

    boolean configured = Boolean.parseBoolean(this.prefs.getValues("myapp.configured", new String[] { "false" })[0]);
    
    if (configured && PictureA.getParent() == null) {
        // PictureA is not visible, but it should be.
        viewContent.removeComponent(viewText);
        panel.addComponent(PictureA);
        viewContent.addComponent(panel);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im following Liferay in Action book instructions to write edit mode for a portlet.
I have tried two things: Specified the first portlet as a Required Deployment Context
I have my portlet damaging page, so dragging controls are not available. How can
I am newbie in liferay portal. I have developed one portlet in liferay for
I have a JSP, say view.jsp , that's using the basic Liferay search container
Im new with liferay have a problem with portlet deployment using the plugins sdk,
How can I make my portlet non instanceable accross the liferay instance. I have
I have an Vaadin portlet wich supports Multilanguage that means if an user selects
I have an IFrame portlet in a liferay page. I want some quick fix
We have something called nested portlets in liferay. I want to add this portlet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.