예제 #1
0
  /** @param section */
  private void createToolbar(SectionStackSection section) {

    this.refreshFolderButton = UIFactory.createImgButton(ActionRegistry.REFRESH_FOLDER);
    this.newFolderButton = UIFactory.createImgButton(ActionRegistry.NEW_FOLDER);
    this.deleteFolderButton = UIFactory.createImgButton(ActionRegistry.DELETE_FOLDER);
    this.emptyFolderButton = UIFactory.createImgButton(ActionRegistry.EMPTY_FOLDER);

    section.setControls(
        this.refreshFolderButton,
        this.newFolderButton,
        this.deleteFolderButton,
        this.emptyFolderButton);
  }
예제 #2
0
  private void createContextMenu() {

    Menu contextMenu = new Menu();

    MenuItem createItem = UIFactory.createMenuItem(ActionRegistry.NEW_FOLDER);
    createItem.setEnableIfCondition(
        new MenuItemIfFunction() {

          public boolean execute(Canvas target, Menu menu, MenuItem item) {

            IGWTFolder folder = GWTUtil.getGwtFolder((TreeNode) tree.getSelectedRecord());
            return folder.isCreateSubfolderSupported();
          }
        });

    MenuItem deleteItem = UIFactory.createMenuItem(ActionRegistry.DELETE_FOLDER);
    deleteItem.setEnableIfCondition(
        new MenuItemIfFunction() {

          public boolean execute(Canvas target, Menu menu, MenuItem item) {

            IGWTFolder folder = GWTUtil.getGwtFolder((TreeNode) tree.getSelectedRecord());
            return folder.isDeleteSupported();
          }
        });

    MenuItem emptyItem = UIFactory.createMenuItem(ActionRegistry.EMPTY_FOLDER);
    emptyItem.setEnableIfCondition(
        new MenuItemIfFunction() {

          public boolean execute(Canvas target, Menu menu, MenuItem item) {

            IGWTFolder folder = GWTUtil.getGwtFolder((TreeNode) tree.getSelectedRecord());
            return folder.isEmptySupported();
          }
        });

    contextMenu.setItems(createItem, deleteItem, emptyItem);

    this.tree.setContextMenu(contextMenu);
  }