Example #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;
  }
  private ComboBox getConta() {
    FieldDef[] fdConta =
        new FieldDef[] {
          new IntegerFieldDef("finContaId"),
          new IntegerFieldDef("empEmpresa.empEmpresaId"),
          new StringFieldDef("empEmpresa.empEntidade.empEntidadeNome1"),
          new IntegerFieldDef("finBanco.finBancoId"),
          new StringFieldDef("finBanco.finBancoDescricao"),
          new StringFieldDef("finContaNome")
        };
    FiltroObjeto fo =
        new FiltroObjeto(
            "empEmpresa", ECompara.IGUAL, new EmpEmpresa(Ponte.getLogin().getEmpresaId()));
    CoreProxy<FinConta> proxy = new CoreProxy<FinConta>(new FinConta(), fo);
    final Store storeConta = new Store(proxy, new ArrayReader(new RecordDef(fdConta)), true);
    storeConta.addStoreListener(
        new StoreListenerAdapter() {
          public void onLoad(Store store, Record[] records) {
            mostrar();
            getTopToolbar().addSeparator();
            getTopToolbar().addButton(btnArquivo);
          }

          public void onLoadException(Throwable error) {
            MessageBox.confirm(
                OpenSigCore.i18n.txtEmbalagem(),
                OpenSigCore.i18n.msgRecarregar(),
                new ConfirmCallback() {
                  public void execute(String btnID) {
                    if (btnID.equalsIgnoreCase("yes")) {
                      storeConta.load();
                    }
                  }
                });
          }
        });

    cmbConta = new ComboBox(OpenSigCore.i18n.txtConta(), "finConta.finContaId", 200);
    cmbConta.setAllowBlank(false);
    cmbConta.setStore(storeConta);
    cmbConta.setListWidth(200);
    cmbConta.setTriggerAction(ComboBox.ALL);
    cmbConta.setMode(ComboBox.LOCAL);
    cmbConta.setDisplayField("finContaNome");
    cmbConta.setValueField("finContaId");
    cmbConta.setForceSelection(true);
    cmbConta.setEditable(false);

    return cmbConta;
  }
Example #3
0
 public void showScreen(String historyToken) {
   if (historyToken == null || historyToken.equals("")) {
     appTabPanel.activate(0);
   } else {
     Record record = store.getById(historyToken);
     if (record != null) {
       ShowcasePanel panel = (ShowcasePanel) record.getAsObject("screen");
       String title = record.getAsString("title");
       String iconCls = record.getAsString("iconCls");
       showScreen(panel, title, iconCls, historyToken);
     }
   }
 }
Example #4
0
  public static Store getStore() {
    if (store == null) {
      MemoryProxy proxy = new MemoryProxy(getData());

      RecordDef recordDef =
          new RecordDef(
              new FieldDef[] {
                new StringFieldDef("id"),
                new StringFieldDef("category"),
                new StringFieldDef("title"),
                new StringFieldDef("iconCls"),
                new StringFieldDef("thumbnail"),
                new StringFieldDef("qtip"),
                new ObjectFieldDef("screen")
              });

      ArrayReader reader = new ArrayReader(0, recordDef);
      store = new Store(proxy, reader);
      store.load();
    }
    return store;
  }
Example #5
0
  public TreePanel getTreeNav() {
    treePanel = new TreePanel();
    treePanel.setTitle("Tree View");
    treePanel.setId("nav-tree");
    treePanel.setWidth(180);
    treePanel.setCollapsible(true);
    treePanel.setAnimate(true);
    treePanel.setEnableDD(false);
    treePanel.setAutoScroll(true);
    treePanel.setContainerScroll(true);
    treePanel.setRootVisible(false);
    treePanel.setBorder(false);
    treePanel.setTopToolbar(getFilterToolbar());

    TreeNode root = new TreeNode("Showcase Explorer");
    treePanel.setRootNode(root);

    CreditsPanel creditsPanel = new CreditsPanel();

    TreeNode creditsNode = new TreeNode("Credits");
    creditsNode.setIconCls("credits-icon");
    creditsNode.setId("credits");
    root.appendChild(creditsNode);
    addNodeClickListener(creditsNode, creditsPanel, "credits-icon");

    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");

      TreeNode node = new TreeNode(title);
      node.setId(id);
      if (iconCls != null) node.setIconCls(iconCls);
      if (qtip != null) node.setTooltip(qtip);
      if (category == null || category.equals("")) {
        root.appendChild(node);
      } else {
        Node categoryNode =
            root.findChildBy(
                new NodeTraversalCallback() {
                  public boolean execute(Node node) {
                    return node.getId().equals(category);
                  }
                });

        if (categoryNode != null) {
          categoryNode.appendChild(node);
        }
      }
      addNodeClickListener(node, panel, iconCls);
    }
    treeFilter = new TreeFilter(treePanel);
    treePanel.expandAll();
    return treePanel;
  }