Example #1
0
 private static Application<Gadget> toGadget(UIGadget uiGadget) {
   Application<Gadget> app = Application.createGadgetApplication(uiGadget.getStorageId());
   app.setState(uiGadget.getState());
   app.setProperties(uiGadget.getProperties());
   app.setStorageName(uiGadget.getStorageName());
   return app;
 }
Example #2
0
  private static <S> Application<S> toPortletModel(UIPortlet<S, ?> uiPortlet) {
    Application<S> model;
    PortletState<S> state = uiPortlet.getState();
    ApplicationType<S> type = state.getApplicationType();
    if (type == ApplicationType.PORTLET) {
      model = (Application<S>) Application.createPortletApplication(uiPortlet.getStorageId());
    } else if (type == ApplicationType.GADGET) {
      model = (Application<S>) Application.createGadgetApplication(uiPortlet.getStorageId());
    } else if (type == ApplicationType.WSRP_PORTLET) {
      model = (Application<S>) Application.createWSRPApplication(uiPortlet.getStorageId());
    } else {
      throw new AssertionError();
    }

    //
    model.setStorageName(uiPortlet.getStorageName());
    model.setState(state.getApplicationState());
    model.setTitle(uiPortlet.getTitle());
    model.setWidth(uiPortlet.getWidth());
    model.setHeight(uiPortlet.getHeight());
    model.setDescription(uiPortlet.getDescription());
    model.setShowInfoBar(uiPortlet.getShowInfoBar());
    model.setShowApplicationState(uiPortlet.getShowWindowState());
    model.setShowApplicationMode(uiPortlet.getShowPortletMode());
    model.setDescription(uiPortlet.getDescription());
    model.setIcon(uiPortlet.getIcon());
    model.setProperties(uiPortlet.getProperties());
    model.setTheme(uiPortlet.getTheme());
    model.setAccessPermissions(uiPortlet.getAccessPermissions());
    model.setModifiable(uiPortlet.isModifiable());
    return model;
  }