public static synchronized JContextTree getContextTree() {
    if (tree == null) {
      final JContextTree tree = new JContextTree();

      // search available popup menu items
      Lookup lk = Lookups.forPath("/Puzzle/ContextTree/Actions");
      for (TreePopupItem item : lk.lookupAll(TreePopupItem.class)) {
        tree.controls().add(item);
      }

      final List<PropertyPane> configPanes = new ArrayList<PropertyPane>();

      JPropertyTree propertyTree = new JPropertyTree();

      DefaultMutableTreeNode root = new DefaultMutableTreeNode();

      // search available property panels
      lk = Lookups.forPath("/Puzzle/ContextTree/PropertyPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        root.add(new DefaultMutableTreeNode(p));
      }

      // search filter panels
      DefaultMutableTreeNode filterNodes =
          new DefaultMutableTreeNode(CoreResource.getString("filter"));
      lk = Lookups.forPath("/Puzzle/ContextTree/FilterPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        filterNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(filterNodes);

      // search style panels
      DefaultMutableTreeNode styleNodes =
          new DefaultMutableTreeNode(CoreResource.getString("symbology"));
      lk = Lookups.forPath("/Puzzle/ContextTree/StylePanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        styleNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(styleNodes);

      if (!tree.controls().isEmpty()) {
        tree.controls().add(new SeparatorItem());
      }

      LayerPropertyItem property = new LayerPropertyItem(root);
      tree.controls().add(property);

      tree.revalidate();
      tree.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      ContextTreeTopComponent.tree = tree;
    }
    return tree;
  }
示例#2
0
  private void initTree(final JContextTree tree) {

    LayerFeatureItem item = new LayerFeatureItem();
    item.actions().add(new ClearSelectionAction());
    item.actions().add(new DeleteSelectionAction());

    tree.controls().add(item);
    tree.controls().add(new NewGroupItem());
    tree.controls().add(new ZoomToLayerItem());
    tree.controls().add(new SeparatorItem());
    tree.controls().add(new SessionCommitItem());
    tree.controls().add(new SessionRollbackItem());
    tree.controls().add(new SeparatorItem());
    tree.controls().add(new DeleteItem());
    tree.controls().add(new SeparatorItem());

    LayerPropertyItem property = new LayerPropertyItem();
    List<PropertyPane> lstproperty = new ArrayList<PropertyPane>();
    lstproperty.add(new LayerGeneralPanel());
    lstproperty.add(new JLayerCRSPane());
    lstproperty.add(new JLayerDataStructurePanel());

    LayerFilterPropertyPanel filters = new LayerFilterPropertyPanel();
    filters.addPropertyPanel(MessageBundle.format("filter"), new JCQLPropertyPanel());
    lstproperty.add(filters);

    LayerStylePropertyPanel styles = new LayerStylePropertyPanel();
    styles.addPropertyPanel(MessageBundle.format("analyze"), new JSimpleStylePanel());
    styles.addPropertyPanel(
        MessageBundle.format("analyze_vector"), new JClassificationSingleStylePanel());
    styles.addPropertyPanel(
        MessageBundle.format("analyze_vector"), new JClassificationIntervalStylePanel());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JColorMapPane());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JCellSymbolizerPane());
    styles.addPropertyPanel(MessageBundle.format("analyze_raster"), new JIsolineSymbolizerPane());
    styles.addPropertyPanel(MessageBundle.format("sld"), new JAdvancedStylePanel());
    styles.addPropertyPanel(MessageBundle.format("sld"), new JSLDImportExportPanel());
    lstproperty.add(styles);

    property.setPropertyPanels(lstproperty);

    tree.controls().add(property);
    tree.controls().add(new ContextPropertyItem());

    tree.revalidate();
  }