private final LayoutContainer createAccountChoice() {
   LayoutContainer panel = new LayoutContainer();
   panel.setLayout(new FillLayout());
   panel.add(createAccountPanel());
   panel.setHeight(30);
   return panel;
 }
  private LayoutContainer createContentContainer() {
    LayoutContainer contentContainer = new LayoutContainer();
    contentContainer.setBorders(false);
    contentContainer.setSize(340, 170);
    HBoxLayout tabbarContainerLayout = new HBoxLayout();
    tabbarContainerLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
    contentContainer.setLayout(tabbarContainerLayout);

    LayoutContainer contentItemsContainer = new LayoutContainer();
    contentItemsContainer.setBorders(true);
    contentItemsContainer.setWidth(230);
    contentItemsContainer.setHeight(160);
    contentItemsContainer.setLayout(new FitLayout());
    contentItemsContainer.setStyleAttribute("backgroundColor", "white");
    // overflow-auto style is for IE hack.
    contentItemsContainer.addStyleName("overflow-auto");

    TreeStore<BeanModel> deviceContentTreeStore = new TreeStore<BeanModel>();
    deviceContentTree = TreePanelBuilder.buildDeviceContentTree(deviceContentTreeStore);
    contentItemsContainer.add(deviceContentTree);

    LayoutContainer buttonsContainer = new LayoutContainer();
    buttonsContainer.setSize(110, 160);
    buttonsContainer.setBorders(false);
    buttonsContainer.setLayout(new RowLayout(Orientation.VERTICAL));

    Button addCommandBtn = new Button("Add command");
    addCommandBtn.addSelectionListener(new AddCommandListener());

    Button addSensorBtn = new Button("Add sensor");
    addSensorBtn.addSelectionListener(new AddSensorListener());

    Button addSwitchBtn = new Button("Add switch");
    addSwitchBtn.addSelectionListener(new AddSwitchListener());

    Button addSliderBtn = new Button("Add slider");
    addSliderBtn.addSelectionListener(new AddSliderListener());

    Button deleteBtn = new Button("Delete");
    deleteBtn.addSelectionListener(new DeleteContentListener());

    buttonsContainer.add(addCommandBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSensorBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSwitchBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSliderBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(deleteBtn, new RowData(110, -1, new Margins(5)));

    contentContainer.add(contentItemsContainer);
    contentContainer.add(buttonsContainer);
    return contentContainer;
  }
Exemple #3
0
  private void createDesignPanel() {

    // create main panel
    mainContainer = new LayoutContainer();
    final BorderLayout layout = new BorderLayout();
    mainContainer.setLayout(layout);
    mainContainer.setAutoWidth(true);
    mainContainer.setHeight(HEIGHT);
    mainContainer.addStyleName("design-main-panel");

    // north zone
    final BorderLayoutData upperLayoutData = new BorderLayoutData(LayoutRegion.NORTH);
    NorthPanel upperPanel = PmsFactory.getInstance().getNorthPanel();
    upperPanel.init(page, pageLayoutDto);
    upperLayoutData.setSize(UPPER_PANEL_HEIGHT);

    // west zone
    final BorderLayoutData leftLayoutData = new BorderLayoutData(LayoutRegion.WEST, 220, 150, 320);
    palettesPanel = PmsFactory.getInstance().getPalettesPanel();
    palettesPanel.init(pageLayoutDto);
    leftLayoutData.setSplit(true);
    leftLayoutData.setCollapsible(true);
    leftLayoutData.setSize(LEFT_PANEL_WIDTH);
    leftLayoutData.setMargins(new Margins(PANEL_MARGIN));

    // east zone
    final BorderLayoutData rightLayoutData = new BorderLayoutData(LayoutRegion.EAST);
    ComponentsTreePanel rightPanel = PmsFactory.getInstance().getRightPanel();
    rightPanel.init(page);
    rightLayoutData.setSplit(true);
    rightLayoutData.setCollapsible(true);
    // rightLayoutData.setSize(RIGHT_PANEL_WIDTH);
    rightLayoutData.setMargins(new Margins(PANEL_MARGIN));

    // design zone
    final BorderLayoutData centerLayoutData = new BorderLayoutData(LayoutRegion.CENTER);
    designPanel = new DesignPanel(pageLayoutDto);
    centerLayoutData.setMargins(new Margins(PANEL_MARGIN, 0, PANEL_MARGIN, 0));

    mainContainer.add(upperPanel, upperLayoutData);
    mainContainer.add(palettesPanel, leftLayoutData);
    mainContainer.add(designPanel, centerLayoutData);
    mainContainer.add(rightPanel, rightLayoutData);
    add(mainContainer);
  }
 private final LayoutContainer createTreePanel() {
   LayoutContainer panel = new LayoutContainer();
   panel.setLayout(new RowLayout());
   panel.add(new LabelField(constants.views() + ":"));
   LayoutContainer treePanel = new LayoutContainer();
   selectionTree = new ViewSelectionTree(importViews, false);
   Tree viewTree = selectionTree.getTree();
   viewTree.setCheckable(true);
   //		treePanel.setSize(210, 200);
   treePanel.setWidth("100%");
   treePanel.setHeight(200);
   treePanel.setBorders(true);
   treePanel.setScrollMode(Scroll.AUTOY);
   treePanel.setStyleAttribute("backgroundColor", "white");
   treePanel.add(viewTree);
   panel.add(treePanel);
   return panel;
 }
  public LayoutContainer getRightSide() {
    BorderLayout layout = new BorderLayout();

    LayoutContainer container = new LayoutContainer();
    container.setLayout(layout);

    container.add(getButtonBar(), new BorderLayoutData(LayoutRegion.SOUTH, .1F));

    selected = new DataList();
    selected.setContextMenu(getListMenu());

    LayoutContainer right = new LayoutContainer();
    right.setLayout(new FillLayout());
    right.add(selected);

    container.add(selected, new BorderLayoutData(LayoutRegion.CENTER, .8F));
    container.setHeight(PANEL_HEIGHT - 20);
    return container;
  }
                       // interno
  // quando viene cambiata la data viene resettato anche questo
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);
    layoutContainer.setWidth(w - 225);
    layoutContainer.setHeight(h - 54);

    txtfldUsername.setVisible(false);

    selectLayout();

    LayoutContainer bodyContainer = new LayoutContainer();
    bodyContainer.setLayout(new FlowLayout());
    bodyContainer.setBorders(false);

    bodyContainer.add(new CreateFormIntervalliOre());
    bodyContainer.add(txtfldUsername);

    layoutContainer.add(bodyContainer, new FitData(5, 5, 5, 8));
    add(layoutContainer);
  }
  @Override
  public void addComponent() {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(10);
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading("Share Project to Users");
    fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    this.projectNameLabel = new Label();
    this.projectNameLabel.setStyleAttribute("font-size", "13");
    this.ownerLabel = new Label();
    this.ownerLabel.setStyleAttribute("font-size", "13");
    this.organizationLabel = new Label();
    this.organizationLabel.setStyleAttribute("font-size", "13");
    fieldSet.add(this.projectNameLabel, new MarginData(10));
    fieldSet.add(ownerLabel, new MarginData(10));
    fieldSet.add(organizationLabel, new MarginData(10));
    verticalPanel.add(fieldSet);
    //
    LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout());
    labelListContainer.setHeight(20);
    labelListContainer.setStyleAttribute("background-color", "white");
    labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    Label organizationUserLabel = new Label("Organization Users:");
    organizationUserLabel.setStyleAttribute("font-size", "13");
    organizationUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST));
    Label projectSharedUserLabel = new Label("Project Shared Users:");
    projectSharedUserLabel.setStyleAttribute("font-size", "13");
    projectSharedUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST));
    verticalPanel.add(labelListContainer);
    //
    final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>();
    lists.setMode(Mode.INSERT);
    lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75);
    lists.setStyleAttribute("margin-left", "11px");
    lists.setHideLabel(Boolean.TRUE);

    ListField<GPSimpleUser> from = lists.getFromList();
    from.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.fromStore = new ListStore<GPSimpleUser>();
    from.setStore(this.fromStore);
    ListField<GPSimpleUser> to = lists.getToList();
    to.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.toStore = new ListStore<GPSimpleUser>();
    to.setStore(this.toStore);
    Button cancelButton =
        new Button(
            "GoTo Search Project",
            BasicWidgetResources.ICONS.gear(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                ShareProjectPanel.this.reset();
                projectManagementWidget.showSearchProjectPanel();
              }
            });
    super.addButton(cancelButton);
    saveButton =
        new Button(
            "Save",
            BasicWidgetResources.ICONS.save(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                toStore.commitChanges();
                List<Long> accountIDsProject =
                    Lists.newArrayListWithCapacity(toStore.getModels().size());
                IGPAccountDetail accountDetail =
                    Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
                boolean test = false;
                for (GPSimpleUser user : toStore.getModels()) {
                  if (user.getId().equals(accountDetail.getId())) {
                    test = true;
                  }
                  accountIDsProject.add(user.getId());
                }
                final boolean isShared = test;
                ShareProjectPanel.this.reset();
                LayerRemote.Util.getInstance()
                    .shareProjectToUsers(
                        project.getId(),
                        accountIDsProject,
                        new AsyncCallback<Boolean>() {
                          @Override
                          public void onFailure(Throwable caught) {
                            System.out.println("Error on saving user to share project");
                          }

                          @Override
                          public void onSuccess(Boolean result) {
                            //                                System.out.println("Project is Shared:
                            // " + isShared);
                            if (project.isDefaultProject()) {
                              GPClientProject projInSession =
                                  Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name());
                              if (isShared) {
                                projInSession.setShared(Boolean.TRUE);
                              } else {
                                projInSession.setShared(Boolean.FALSE);
                              }
                            }
                            project.setShared(Boolean.TRUE);
                            loadData(project);
                          }
                        });
              }
            });
    super.addButton(saveButton);
    super.add(verticalPanel);
    super.add(lists, new FormData("98%"));
    LayoutContainer filterContainer = new LayoutContainer(new BorderLayout());
    this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users");
    filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST));
    this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List");
    filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST));
    filterContainer.setStyleAttribute("margin", "11px");
    super.add(filterContainer);
  }