Пример #1
0
  public Panel getAccordionNav() {
    Panel accordion = new Panel();
    accordion.setTitle("Accordion");
    accordion.setLayout(new AccordionLayout(true));

    Store store = getStore();

    Record[] records = store.getRecords();
    for (int i = 0; i < records.length; i++) {
      Record record = records[i];

      String id = record.getAsString("id");
      final String category = record.getAsString("category");
      String title = record.getAsString("title");
      final String iconCls = record.getAsString("iconCls");

      String thumbnail = record.getAsString("thumbnail");
      String qtip = record.getAsString("qtip");

      final ShowcasePanel panel = (ShowcasePanel) record.getAsObject("screen");

      if (category == null) {
        Panel categoryPanel = new Panel();
        categoryPanel.setAutoScroll(true);
        categoryPanel.setLayout(new FitLayout());
        categoryPanel.setId(id + "-acc");
        categoryPanel.setTitle(title);
        categoryPanel.setIconCls(iconCls);
        accordion.add(categoryPanel);
      } else {
        Panel categoryPanel = (Panel) accordion.findByID(category + "-acc");
        TreePanel treePanel = (TreePanel) categoryPanel.findByID(category + "-acc-tree");
        TreeNode root = null;
        if (treePanel == null) {
          treePanel = new TreePanel();
          treePanel.setAutoScroll(true);
          treePanel.setId(category + "-acc-tree");
          treePanel.setRootVisible(false);
          root = new TreeNode();
          treePanel.setRootNode(root);
          categoryPanel.add(treePanel);
        } else {
          root = treePanel.getRootNode();
        }

        TreeNode node = new TreeNode();
        node.setText(title);
        node.setId(id);
        if (iconCls != null) node.setIconCls(iconCls);
        if (qtip != null) node.setTooltip(qtip);
        root.appendChild(node);

        addNodeClickListener(node, panel, iconCls);
      }
    }

    return accordion;
  }
Пример #2
0
 public void showScreen(Panel panel, String title, String iconCls, String screenName) {
   String panelID = panel.getId();
   if (appTabPanel.hasItem(panelID)) {
     appTabPanel.scrollToTab(panel, true);
     appTabPanel.activate(panelID);
   } else {
     if (!panel.isRendered()) {
       panel.setTitle(title);
       if (iconCls == null) {
         iconCls = "plugins-nav-icon";
       }
       panel.setIconCls(iconCls);
     }
     appTabPanel.add(panel);
     appTabPanel.activate(panel.getId());
   }
   History.newItem(screenName);
 }