Package com.extjs.gxt.ui.client.widget.toolbar

Examples of com.extjs.gxt.ui.client.widget.toolbar.TextToolItem


    };
   
    reportsTree = createTree(treeLoader);

    ToolBar toolbar = new ToolBar();
    TextToolItem addStaticFolder = new TextToolItem("", "icon-create-folder");
    addStaticFolder.setToolTip("Create a new static folder");
    addStaticFolder.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
        final TreeItem item = reportsTree.getSelectedItem();
        if (item == null) {
          return;
        }
        final XObject parent = ((TreeNode) item.getModel()).getXObject();
        RequestNameDialog rnd = new RequestNameDialog(
            "Create new static folder",
            "Name",
            new ResultListener<String>(){
              public void requestCancelled() {               
              }

              public void requestFinished(String result) {
                WPaloServiceProvider.getInstance().
                  createStaticFolder(result, parent, user, new Callback<XStaticReportFolder>(){
                    public void onSuccess(XStaticReportFolder folder) {
                      if (folder == null) {
                        return;
                      }
                      treeLoader.loadChildren((TreeNode) item.getModel());
                    }});
              }
            });
        rnd.show();
      }
    });
    toolbar.add(addStaticFolder);
    TextToolItem addDynamicFolder = new TextToolItem("", "icon-create-dynamic-folder");
    addDynamicFolder.setToolTip("Create a new dynamic folder");
    addDynamicFolder.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
        final TreeItem item = reportsTree.getSelectedItem();
        if (item == null) {
          return;
        }
        final XObject parent = ((TreeNode) item.getModel()).getXObject();
        RequestNameDialog rnd = new RequestNameDialog(
            "Create new dynamic folder",
            "Name",
            new ResultListener<String>(){
              public void requestCancelled() {               
              }

              public void requestFinished(String result) {
                WPaloServiceProvider.getInstance().
                  createDynamicFolder(result, parent, user, new Callback<XDynamicReportFolder>(){
                    public void onSuccess(XDynamicReportFolder folder) {
                      if (folder == null) {
                        return;
                      }
                      treeLoader.loadChildren((TreeNode) item.getModel());
                    }});
              }
            });
        rnd.show();
      }
    });
    toolbar.add(addDynamicFolder);
   
    TextToolItem addSheet = new TextToolItem("", "icon-create-sheet");
    toolbar.add(addSheet);
    addSheet.setToolTip("Create new Workbook");
   
    TextToolItem addView = new TextToolItem("", "icon-create-view");
    toolbar.add(addView);
    addSheet.setToolTip("Create new View");

    toolbar.add(new SeparatorToolItem());
    deleteItem = new TextToolItem("", "icon-delete");
    deleteItem.setToolTip("Delete Element");
    deleteItem.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
        if (quickViewEnabled) {
          return;
View Full Code Here


 

  private final ToolBar createButtonBar() {
    ToolBar toolbar = new ToolBar();
   
    TextToolItem assignView = new TextToolItem("Assign to Folder");
    toolbar.add(assignView);
    assignView.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
        final TreeItem ti = ReportStructureEditor.view.getTree().getSelectedItem();
        if (ti == null) {
          return;
        }
View Full Code Here

 

  private final ToolBar createButtonBar() {
    ToolBar toolbar = new ToolBar();
   
    TextToolItem assignView = new TextToolItem("Add to Folder", "icon-assign-to-folder");
    toolbar.add(assignView);
    assignView.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
        final TreeItem ti = ReportStructureEditor.view.getTree().getSelectedItem();
        if (ti == null) {
          return;
        }
        XObject remObj = ((TreeNode) ti.getModel()).getXObject();
        if (!(remObj instanceof XReportFolder)) {
          return;
        }
               
        List <TreeItem> items = reportsTree.getSelectedItems();
        if (items == null || items.size() == 0) {
          return;
        }
       
        List <XObject> objs = new ArrayList <XObject> ();
        for (TreeItem it: items) {
          XObject obj = ((TreeNode) it.getModel()).getXObject();
          if (obj == null) {
            continue;
          }
          if (!(obj instanceof XTemplate) &&
            !(obj instanceof XWorkbook) &&
            !(obj instanceof XView)) {
            continue;
          }
          objs.add(obj);
        }
       
        XReportFolder xrf = (XReportFolder) remObj;
        WPaloServiceProvider.getInstance().addReceivers(xrf, objs.toArray(new XObject[0]), user, new Callback<XReport []>(){
          public void onSuccess(XReport [] reports) {
            if (reports != null && reports.length > 0) {
              ReportStructureEditor.view.getTreeLoader().loadChildren((TreeNode) ti.getModel());
              for (XReport rep: reports) {
                vTab.saveReport(rep);
              }
            }           
          }
        });
      }
    });
   
    TextToolItem addSheet = new TextToolItem("", "icon-add");
    toolbar.add(addSheet);
    addSheet.setToolTip("Create new Workbook");
    addSheet.addSelectionListener(new CreateNewSheet(reportsTree));
   
//    TextToolItem addSheet = new TextToolItem("", "icon-add");
//    toolbar.add(addSheet);
//    TextToolItem addView = new TextToolItem("", "icon-create-view");
//    toolbar.add(addView);
View Full Code Here

 
  private final void initMaxWidths() {
    WPaloPropertyServiceProvider.getInstance().getStringProperty("tableColumnsMaxWidth", new AsyncCallback<String>() {       
      private final void determineWidth(String r) {
        tableColumnsMaxWidth = r;
        TextToolItem measure = new TextToolItem(r);
        editorPanel.add(measure);
        int size = measure.getOffsetWidth();
        if (size > 0) {
          Content.MAX_COLUMN_WIDTH = size;
        }
        editorPanel.remove(measure);
       
      }
     
      public void onFailure(Throwable arg0) {         
        determineWidth("-999.999.999.999.999.999,90");
      }

      public void onSuccess(String result) {
        if (result == null || result.isEmpty()) {
          determineWidth("-999.999.999.999.999.999,90");
        } else {
          determineWidth(result);
        }
      }
    });

    WPaloPropertyServiceProvider.getInstance().getStringProperty("tableRowsHeaderMaxWidth", new AsyncCallback<String>() {       
      private final void determineWidth(String r) {
        tableRowsHeaderMaxWidth = r;
        TextToolItem measure = new TextToolItem(r);
        editorPanel.add(measure);
        int size = measure.getOffsetWidth();
        if (size > 0) {
          Content.MAX_ROWS_COL_WIDTH = size;
        }
        editorPanel.remove(measure);
      }
View Full Code Here

    });

   
    if (((Workbench)Registry.get(Workbench.ID)).isPaloSuite()) {
      if (!displayFlags.isHideConnectionPicker()) {
        TextToolItem txtItem = new TextToolItem();
        txtItem.setId(CONNECTION_PICKER_BTN);
        txtItem.setIconStyle("icon-import-view");
        txtItem.setToolTip(constants.changeCube());
        txtItem.addListener(Events.Select, this);
        toolbar.add(txtItem);
        toolbar.add(new SeparatorToolItem());
      }
    }
    print.setId(PRINT_BTN);
    print.setIconStyle("icon-print");
    print.addListener(Events.Select, this);
    print.setToolTip(constants.printView());
    if (!displayFlags.isHidePrint()) {
      toolbar.add(print);
      toolbar.add(new SeparatorToolItem());
    }
   
    hideEmptyCells = new ToggleToolItem();
    hideEmptyCells.setId(HIDE_EMPTY_BTN);
    hideEmptyCells.setIconStyle("ten-icons-hideEmpty");
    hideEmptyCells.addListener(Events.Select, this);
    hideEmptyCells.setToolTip(constants.hideEmpty());
    toolbar.add(hideEmptyCells);
   
    reverseColumns = new ToggleToolItem();
    reverseColumns.setId(REVERSE_COLS_BTN);
    reverseColumns.setIconStyle("ten-icons-reverseCols");
    reverseColumns.setToolTip(constants.reverseColumns());
    reverseColumns.addListener(Events.Select, this);
    toolbar.add(reverseColumns);
    // ~
    reverseRows = new ToggleToolItem();
    reverseRows.setId(REVERSE_ROWS_BTN);
    reverseRows.setIconStyle("ten-icons-reverseRows");
    reverseRows.addListener(Events.Select, this);
    reverseRows.setToolTip(constants.reverseRows());
    toolbar.add(reverseRows);   
   
    showRules = new ToggleToolItem();
    showRules.setId(SHOW_RULES_BTN);
    showRules.setIconStyle("ten-icons-viewRules");
    showRules.setToolTip(constants.markRules());
    showRules.addListener(Events.Select, this);
    toolbar.add(showRules);
   
    toolbar.add(new SeparatorToolItem());
    TextToolItem txtItem = new TextToolItem();
    txtItem.setId(REFRESH_BTN);
    txtItem.setIconStyle("icon-refresh-on");
    txtItem.setToolTip(constants.refresh());
    txtItem.addListener(Events.Select, this);
    toolbar.add(txtItem);
       
    showInfoButton = new TextToolItem();
    showInfoButton.setId(SHOW_INFO_BTN);
    showInfoButton.setIconStyle("icon-info");
    showInfoButton.setToolTip(constants.about());
    showInfoButton.addListener(Events.Select, this);
    if (!hideInfo) {
View Full Code Here

        public void loaderLoad(LoadEvent le) {
          ((Workbench)Registry.get(Workbench.ID)).hideWaitCursor();
        }     
    });
    final ToolBar toolbar = new ToolBar();
    TextToolItem addFolder = new TextToolItem("", "icon-create-folder");
    addFolder.setToolTip(constants.createNewViewFolder());
    addFolder.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        createNewFolder();
      }
    });
    toolbar.add(addFolder);

    toolbar.add(new SeparatorToolItem());

    TextToolItem createViews = new TextToolItem("", "icon-create-view");
    createViews.setToolTip(constants.createNewViews());
    createViews
        .addSelectionListener(new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            TreeNode node = getSelectedNode();
            createViews(node);
          }
        });
    toolbar.add(createViews);
    TextToolItem importViews = new TextToolItem("", "icon-import-view");
    importViews.setToolTip(constants.importViews());
    importViews
        .addSelectionListener(new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            TreeNode node = getSelectedNode();
            importViews(node);
          }
        });
    toolbar.add(importViews);

    toolbar.add(new SeparatorToolItem());

    renameItem = new TextToolItem("", "icon-rename");
    renameItem.setToolTip(constants.renameSelectedItem());
    renameItem.setEnabled(true);
    renameItem.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        handleAction(RENAME);
      }
    });
    toolbar.add(renameItem);
   
    deleteItem = new TextToolItem("", "icon-delete-off");
    deleteItem.setToolTip(constants.deleteSelectedItem());
    deleteItem.setEnabled(false);
    deleteItem
        .addSelectionListener(new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            handleAction(DELETE);
          }
        });
    toolbar.add(deleteItem);
 
    navigator.setTopComponent(toolbar);
    navigator.add(viewsTree);
    Workbench wb = (Workbench) Registry.get(Workbench.ID);
    wb.addToViewPanel(navigator);
    ComponentHelper.doAttach(viewsTree);
    navigator.addListener(Events.OnKeyUp, new Listener<BaseEvent>() {
      public void handleEvent(BaseEvent be) {
        viewsTree.fireEvent(Events.OnKeyUp, be);
      }      
    });
   
    toolbar.add(new SeparatorToolItem());
       
//    SplitToolItem about = new SplitToolItem("");
//    about.setIconStyle("icon-about");
   
    TextToolItem about = new TextToolItem("", "icon-about");
    about.setToolTip(constants.extras());
//    about.addSelectionListener(new SelectionListener<ComponentEvent>() {
//      public void componentSelected(ComponentEvent ce) {
//        WPaloPropertyServiceProvider.getInstance().getBuildNumber(new AsyncCallback<String>() {
//          public void onFailure(Throwable arg0) {
//            displayAboutDialog("<Unknown>");
//          }
//
//          public void onSuccess(String result) {
//            displayAboutDialog(result);
//          }
//        });
//      }
//    });
   
    Menu menu = new Menu();
    editViewProperties = new MenuItem(constants.editViewProperties());
    editViewProperties.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        XUser user = ((Workbench)Registry.get(Workbench.ID)).getUser();
        final String sessionId = user.getSessionId();
        XView targetView = null;
        XObject xObj = null;
        TreeItem item = null;
        TreeNode node = null;
        if (treeBinder != null && treeBinder.getTree() != null) {
          TreeItem selection = treeBinder.getTree().getSelectedItem();
          if (selection != null) {
            item = selection;
            node = (TreeNode) selection.getModel();
            xObj = browserModel.getWrappedXObject(node);
            if (xObj instanceof XFolderElement) {
              XObject source = ((XFolderElement) xObj).getSourceObject();
              if (source != null && source instanceof XView) {
                targetView = (XView) source;
              }
            }
          }
        }
        if (targetView != null) {
          final XView viewToModify = targetView;
          final XObject xObject = xObj;
          final TreeItem selectedItem = item;
          final TreeNode nodeOfView = node;
//          int permission = user.getId().equals(targetView.getOwnerId()) ? 2 : 16;
          int permission = user.isAdmin() ? 0 : (user.getId().equals(targetView.getOwnerId()) ? 16 : 22);
          WPaloCubeViewServiceProvider.getInstance().checkPermission(sessionId, permission, new Callback <Boolean>(){
            public void onSuccess(Boolean result) {
              if (result) {
                final EditViewPropertiesDialog dlg =
                  new EditViewPropertiesDialog(viewToModify);
                dlg.addButtonListener(EditViewPropertiesDialog.BUTTON_OK,
                    new Listener<BaseEvent>() {
                      public void handleEvent(BaseEvent be) {
                        boolean pub = dlg.isPublic();
                        boolean edi = dlg.isEditable();
                        String ownerId = dlg.getOwner();
                        String accId = dlg.getAccountId();
                        String dbId = dlg.getDatabaseId();
                        String cubeId = dlg.getCubeId();
                        WPaloCubeViewServiceProvider.getInstance().setVisibility(
                            sessionId, (XFolderElement) xObject, pub, edi, ownerId, accId, dbId, cubeId, new Callback <XView>(){
                              public void onSuccess(XView view) {                                                             
                                XFolderElement xObj = (XFolderElement) browserModel.getWrappedXObject(nodeOfView);
                                xObj.setSourceObject(view);                               
                                selectedItem.setIconStyle(getIconStyle(view));
                                treeBinder.getStore().update(nodeOfView);
                              }});
                      }
                    });
                dlg.show();
              } else {
                MessageBox.alert(constants.notEnoughRights(), constants.notEnoughRightsToModifyVisibility(), null);
              }
            }
          });
        }
      }
    });
    menu.add(editViewProperties);
   
    createDirectLink = new MenuItem(constants.createDirectLink());
    createDirectLink.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        if (treeBinder != null && treeBinder.getTree() != null) {
          TreeItem selection = treeBinder.getTree().getSelectedItem();
          if (selection != null) {
            TreeNode node = (TreeNode) selection.getModel();
            final XObject xObj = browserModel.getWrappedXObject(node);
            if (xObj instanceof XFolderElement) {
              final XObject source = ((XFolderElement) xObj).getSourceObject();
              if (source != null && source instanceof XView) {
                final CreateDirectLinkDialog cdl = new CreateDirectLinkDialog((XView) source);
                cdl.show();
              }
            }
          }
        }
      }
    });
    menu.add(createDirectLink);
   
    MenuItem abi = new MenuItem(constants.about());
    abi.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        WPaloPropertyServiceProvider.getInstance().getBuildNumber(new AsyncCallback<String>() {
          public void onFailure(Throwable arg0) {
            displayAboutDialog("<" + constants.unknown() + ">", null);
          }

          public void onSuccess(final String result) {
            WPaloPropertyServiceProvider.getInstance().getCurrentBuildNumber(new AsyncCallback<String []>(){
              public void onFailure(Throwable arg0) {
                displayAboutDialog(result, null);
              }

              public void onSuccess(String [] buildInformation) {
                displayAboutDialog(result, buildInformation);
              }
            });           
          }
        });
      }
    });
    menu.add(abi);   
   
//    MenuItem tti = new MenuItem("Test Tree");
//    tti.addSelectionListener(new SelectionListener<ComponentEvent>() {
//      public void componentSelected(ComponentEvent ce) {
//        final TestFastTreeDialog tftd = new TestFastTreeDialog();
//        tftd.show();
//      }
//    });
//    menu.add(tti);
   
    about.setMenu(menu);
       
    toolbar.add(about);
    return toolbar;
  }
View Full Code Here

    return tree;
  }
 
  private final void fill(ToolBar toolbar) {
    //add new connection
    addCon = new TextToolItem("", "icon-connection-add");
    addCon.setToolTip(constants.addConnection());
    addCon.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public final void componentSelected(ComponentEvent ce) {
      }
      public final void handleEvent(ComponentEvent be) {
        Dispatcher.get().dispatch(WPaloEvent.ADD_CONNECTION_ITEM);
      }
    });
    toolbar.add(addCon);
    //add new account
    addAcc = new TextToolItem("", "icon-account-add");
    addAcc.setToolTip(constants.addAccount());
    addAcc.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public final void componentSelected(ComponentEvent ce) {
      }
      public final void handleEvent(ComponentEvent be) {         
        Dispatcher.get().dispatch(WPaloEvent.ADD_ACCOUNT_ITEM);
      }
    });
    toolbar.add(addAcc);
   
    toolbar.add(new SeparatorToolItem());
    del = new TextToolItem("", "icon-delete");
    del.setToolTip(constants.delete());
    del.setEnabled(false);
    del.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public final void componentSelected(ComponentEvent ce) {
      }
View Full Code Here

      }
    };
    final Tree reportsTree = createTree(treeLoader);
   
    ToolBar toolbar = new ToolBar();
    TextToolItem addFolder = new TextToolItem("", "icon-create-folder");
    addFolder.setToolTip(WPalo.i18n.reportNavigatorView_addFolderToolTip());
//        "Create new Folder");
    toolbar.add(addFolder);
   
    TextToolItem addSheet = new TextToolItem("", "icon-create-sheet");
    toolbar.add(addSheet);
    addSheet.setToolTip(WPalo.i18n.reportNavigatorView_addWorkbookTemplateToolTip());
//        "Create new Workbook Template");
    addSheet.addSelectionListener(new CreateNewSheet(reportsTree));
    TextToolItem addView = new TextToolItem("", "icon-create-view");
    addView.setToolTip(WPalo.i18n.reportNavigatorView_addAdhocViewTemplateToolTip());
//        "Create new AdHoc View Template");
    toolbar.add(addView);

    toolbar.add(new SeparatorToolItem());
    TextToolItem delItems = new TextToolItem("", "icon-delete");
    delItems.setToolTip(WPalo.i18n.reportNavigatorView_deleteItemsToolTip());
//        "Delete items");
    toolbar.add(delItems);
    delItems.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
      }
    });
    navigator.setTopComponent(toolbar);
   
View Full Code Here

//    content.setHeading("Properties");
    content.setButtonAlign(HorizontalAlignment.RIGHT);

    //da toolbar
    ToolBar toolbar = new ToolBar();
    TextToolItem save = new TextToolItem("Save", "icon-save");
    toolbar.add(save);
    toolbar.add(new SeparatorToolItem());
    content.setTopComponent(toolbar);

    tabFolder = new TabPanel();
View Full Code Here

    addGroup = createToolItem(constants.addGroup(), "icon-group-add", WPaloEvent.ADD_GROUP_ITEM);
    toolbar.add(addGroup);
    addRole = createToolItem(constants.addRole(), "icon-role2-add", WPaloEvent.ADD_ROLE_ITEM);
    toolbar.add(addRole);
    toolbar.add(new SeparatorToolItem());
    del = new TextToolItem("", "icon-delete");
    del.setToolTip(constants.delete());
    del.setEnabled(false);
    del.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public final void componentSelected(ComponentEvent ce) {
      }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.widget.toolbar.TextToolItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.