コード例 #1
0
  private void init() {
    JPanel quickSearchPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

    final TreeModel treeModel = explorer.getTreeModel();
    final QuickTreeFilterField field =
        new QuickTreeFilterField(treeModel) {
          protected FilterableTreeModel createDisplayTreeModel(TreeModel treeModel) {
            return new FilterableTreeModel(treeModel) {
              @Override
              protected void configureListModelWrapper(ListModelWrapper wrapper, Object node) {

                if (node instanceof DefaultMutableTreeNode) {
                  // ImageFileExplorer.LazyNode inode = (ImageFileExplorer.LazyNode) node;
                  DefaultMutableTreeNode inode = (DefaultMutableTreeNode) node;
                  boolean expanded = explorer.getJTree().isExpanded(new TreePath(inode.getPath()));
                  if (inode.isLeaf() || expanded) {
                    super.configureListModelWrapper(wrapper, node);
                  }
                }
              }
            };
          }
        };

    field.setSearchingDelay(200);
    quickSearchPanel.add(field);

    JPanel treePanel = new JPanel(new BorderLayout(2, 2));

    field.setTree(explorer.getJTree());
    SearchableUtils.installSearchable(field.getTree());

    JTree tree = field.getTree();
    tree.setModel(field.getDisplayTreeModel());
    DataTipManager.get().register(tree);

    treePanel.add(explorer.getComponent());

    mainPanel.add(treePanel);
    mainPanel.add(quickSearchPanel, BorderLayout.BEFORE_FIRST_LINE);

    EventBus.subscribeStrongly(
        DataSourceStatusEvent.class,
        new EventSubscriber<DataSourceStatusEvent>() {
          @Override
          public void onEvent(DataSourceStatusEvent event) {
            explorer.getJTree().repaint();
          }
        });

    mainPanel.putClientProperty(IActionProvider.KEY, this);
  }
コード例 #2
0
  private void initializeLayout() {
    if (!(vsr instanceof JDialog)) {
      UserInfo ui = pst.getApplicationUser();
      String userName = ui.getUsername();
      viewLayout = new MainFormLayout(getTitle(), "system1".equals(userName) ? " " : userName);

      JPanel formPanel = (JPanel) AttributeAccessor.get(vsr, "pnlMain");
      formPanel.putClientProperty("pnlMain", true);

      /*
                  JPanel footerPanel = (JPanel) AttributeAccessor.get(vsr, "footerPanel");
                  Component[]  components=footerPanel.getComponents();
                  for(int i=0;i<components.length;i++){
                      if(components[i] instanceof JLabel){
                          ((JLabel)components[i]).setBackground(new Color(-13395480));
                          ((JLabel)components[i]).setOpaque(true);
                          ((JLabel)components[i]).setForeground(new Color(-1));
                      }
                  }
      */

      viewLayout.contentPanel.add(formPanel, BorderLayout.CENTER);

      AbstractAction aa =
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              if (logger.isDebugEnabled()) logger.debug("Closing view for " + pst);
              pst.closeView();
            }
          };

      if (pst instanceof FindPresenter || pst.isShowCloseButton()) {
        logger.info("Close button added to view");
        //                ((HeaderPanel) viewLayout.headerPanel).createCloseButton(aa);
      }
      addUserInfo();
    }
  }
コード例 #3
0
 public ParentComponentInfo setBindingPath(JPanel jpanel, String... paths) {
   ParentComponentInfo parentComponentInfo = new ParentComponentInfo(paths);
   jpanel.putClientProperty(BindingBuilder.BINDING_PATHS, parentComponentInfo);
   return parentComponentInfo;
 }