public CreateFolderViewportAction(final TreePanel treePanel) {
   super("CreateViewport", AbstractImagePrototype.create(BasicWidgetResources.ICONS.viewport()));
   this.treePanel = treePanel;
   this.executor =
       new Listener() {
         @Override
         public void handleEvent(BaseEvent be) {
           execute(selectedElement.getChildren(), selectedElement.getLabel());
           treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, this);
         }
       };
   this.message =
       new Listener<MessageBoxEvent>() {
         @Override
         public void handleEvent(MessageBoxEvent be) {
           if (be.getButtonClicked().getItemId().equalsIgnoreCase(Dialog.YES)) {
             treePanel.addListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
             treePanel.setExpanded(selectedElement, true);
             System.out.println("Selected element: " + selectedElement);
           } else {
             treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
           }
         }
       };
 }
 public EditWFSAction(TreePanel<GPBeanTreeModel> treePanel) {
   super(
       WFSTWidgetConstants.INSTANCE.EditWFSAction_titleText(),
       AbstractImagePrototype.create(BasicWidgetResources.ICONS.vector()));
   this.treePanel = treePanel;
   this.bus = FeatureInjector.MainInjector.getInstance().getEventBus();
   this.layerTypeHandlerManager =
       FeatureInjector.MainInjector.getInstance().getLayerTypeHandlerManager();
 }
 @Override
 public void finalizeInitOperations() {
   super.finalizeInitOperations();
   super.selectButton.setText("Modify User");
   super.search.setFieldLabel("Find User");
   this.userPropertiesWidget = new UserPropertiesWidget(super.store);
   super.addButton(
       1,
       new Button(
           "Add User",
           BasicWidgetResources.ICONS.logged_user(),
           new SelectionListener<ButtonEvent>() {
             @Override
             public void componentSelected(ButtonEvent ce) {
               showUserPropertiesWidget(true);
             }
           }));
 }
  public static Menu getFolderContextMenu() {
    if (folderContextMenu == null) {
      folderContextMenu = new Menu();
      folderContextMenu.add(pasteMenuItem);

      MenuItem folderRename = new MenuItem();
      folderRename.setText("Rename Folder");
      folderRename.setIcon(LayerResources.ICONS.editFolder());
      folderRename.addSelectionListener(new ShowFolderRenameAction(treePanel));
      folderContextMenu.add(folderRename);

      MenuItem createViewportFolderMenu = new MenuItem();
      createViewportFolderMenu.setText("Create Viewport");
      createViewportFolderMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportFolderMenu.addSelectionListener(new CreateFolderViewportAction(treePanel));
      folderContextMenu.add(createViewportFolderMenu);
    }
    return folderContextMenu;
  }
  private Button createDeleteButton() {
    Button button =
        new Button(
            "",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                FeatureInjector injector = FeatureInjector.MainInjector.getInstance();
                GPEventBus bus = injector.getEventBus();
                bus.fireEvent(
                    new DeleteAttributeConditionEvent(FeatureAttributeConditionField.this));
              }
            });
    button.setToolTip("Delete Condition");
    button.setIcon(BasicWidgetResources.ICONS.delete());
    button.setAutoWidth(true);

    return button;
  }
 @Override
 public void finalizeInitOperations() {
   super.finalizeInitOperations();
   super.selectButton.setText(
       LayerModuleConstants.INSTANCE.GPProjectSearchPanel_selectButtonText());
   super.search.setFieldLabel(
       LayerModuleConstants.INSTANCE.GPProjectSearchPanel_searchlabelText());
   GPProjectAction action = new GPProjectAction(GPTrustedLevel.HIGH, this);
   GPSecureButton addProjectButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.addText(),
           AbstractImagePrototype.create(LayerResources.ICONS.projectAdd()),
           action);
   super.addButton(1, addProjectButton);
   addProjectButton.disable();
   this.editButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.editText(),
           AbstractImagePrototype.create(BasicWidgetResources.ICONS.edit()),
           action);
   this.editButton.disable();
   super.addButton(2, this.editButton);
   this.deleteButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.deleteText(),
           AbstractImagePrototype.create(LayerResources.ICONS.projectDelete()),
           new DeleteProjectAction(GPTrustedLevel.FULL, this));
   this.deleteButton.disable();
   super.addButton(3, this.deleteButton);
   ShareProjectAction shareProjectAction = new ShareProjectAction(GPTrustedLevel.HIGH, this);
   this.shareButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.shareText(),
           AbstractImagePrototype.create(LayerResources.ICONS.arrowRefresh()),
           shareProjectAction);
   this.shareButton.disable();
   super.addButton(4, this.shareButton);
 }
  @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);
  }
 public DeleteElementTreeAction(TreePanel theTree) {
   super(theTree, BasicWidgetResources.ICONS.delete(), "Delete Selected Elements");
   this.deleteManager = new DeleteRequestManager(theTree);
 }
 public UserOptionsMenuAction() {
   super(
       UserModuleConstants.INSTANCE.UserOptionsMenuAction_titleText(),
       AbstractImagePrototype.create(BasicWidgetResources.ICONS.gear()));
 }
 public NotificationCenterAction(NotificationPopupPanel notificationPopupPanel) {
   super(BasicWidgetResources.ICONS.info(), "Notification Center");
   this.notificationPopupPanel = notificationPopupPanel;
 }
  public static Menu getLayerContextMenu() {
    if (layerContextMenu == null) {
      layerContextMenu = new Menu();
      // add zoom to max extent
      MenuItem zoomToMaxExtend = new MenuItem();
      zoomToMaxExtend.setText("Zoom to layer extend");
      zoomToMaxExtend.setIcon(LayerResources.ICONS.zoomToMaxExtend());
      zoomToMaxExtend.addSelectionListener(new ZoomToLayerExtentAction(treePanel));
      layerContextMenu.add(zoomToMaxExtend);

      MenuItem exportMenuItem = new MenuItem();
      exportMenuItem.setText("Export");
      exportMenuItem.setSubMenu(new GPExportMenu(treePanel));
      layerContextMenu.add(exportMenuItem);

      MenuItem cqlFilterMenuItem = new MenuItem();
      cqlFilterMenuItem.setText("CQL Filter");
      cqlFilterMenuItem.setSubMenu(new GPCQLFilterMenu(treePanel));
      layerContextMenu.add(cqlFilterMenuItem);

      MenuItem timeFilterMenuItem = new MenuItem();
      timeFilterMenuItem.setText("TIME Filter");
      timeFilterMenuItem.setSubMenu(new GPTimeFilterMenu(treePanel));
      layerContextMenu.add(timeFilterMenuItem);

      MenuItem layerProperties = new MenuItem();
      layerProperties.setText("Layer Properties");
      layerProperties.setIcon(LayerResources.ICONS.layerProperties());
      layerProperties.addSelectionListener(new ShowLayerPropertiesAction(treePanel));

      MenuItem copyMenuItem = new MenuItem("Copy Layer");
      copyMenuItem.setIcon(LayerResources.ICONS.copy());
      copyMenuItem.addSelectionListener(new CopyLayerAction(treePanel, pasteAction, pasteMenuItem));

      layerContextMenu.add(copyMenuItem);

      MenuItem createViewportLayerMenu = new MenuItem();
      createViewportLayerMenu.setText("Create Viewport");
      createViewportLayerMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportLayerMenu.addSelectionListener(new CreateLayerViewportAction(treePanel));
      layerContextMenu.add(createViewportLayerMenu);

      // TODO ADD EditWFS dynamically
      EditWFSAction editFeatureAction = new EditWFSAction(treePanel);
      MenuItem editFeature = new MenuItem();
      editFeature.setText(editFeatureAction.getTitle());
      editFeature.setIcon(editFeatureAction.getImage());
      editFeature.addSelectionListener(editFeatureAction);
      layerContextMenu.add(editFeature);

      refreshTimeComboBox =
          new ComboBox() {
            @Override
            protected void onSelect(ModelData model, int index) {
              super.onSelect(model, index);
              refreshTimeComboBox.clearSelections();
              layerContextMenu.hide();
            }
          };
      refreshTimeComboBox.setEmptyText("Refresh Time");
      ListStore<LayerRefreshTimeValue> store = new ListStore<LayerRefreshTimeValue>();
      store.add(LayerRefreshTimeValue.getLayerRefreshTimeList());
      refreshTimeComboBox.setStore(store);
      refreshTimeComboBox.setEditable(Boolean.FALSE);
      refreshTimeComboBox.setForceSelection(Boolean.TRUE);
      refreshTimeComboBox.setTypeAhead(Boolean.FALSE);
      refreshTimeComboBox.setUseQueryCache(Boolean.FALSE);
      refreshTimeComboBox.setDisplayField(LayerRefreshTimeValue.REFRESH_TIME_KEY);
      //        refreshMenuItem.setIcon(LayerResources.ICONS.layerRefresh());
      refreshTimeComboBox.addSelectionChangedListener(new RefreshLayerAction(treePanel));
      layerContextMenu.add(refreshTimeComboBox);

      layerContextMenu.add(layerProperties);
    }
    return layerContextMenu;
  }