Package org.jdesktop.swingx.renderer

Examples of org.jdesktop.swingx.renderer.DefaultTreeRenderer


    _regexSelectionTable.setModel(new DefaultTableModel(TABLE_HEADERS, 0));

    final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Loading categories ...");
    rootNode.add(new DefaultMutableTreeNode("Downloading from RegexSwap"));

    _treeRendererDelegate = new DefaultTreeRenderer();

    _categoryTree = new JXTree(rootNode);
    _categoryTree.setOpaque(false);
    _categoryTree.setCellRenderer(new TreeCellRenderer() {
View Full Code Here


    }
    _windowContext = windowContext;
    _analysisJobBuilder = analysisJobBuilder;
    _injectorBuilder = injectorBuilder;
    _dataContextProvider = datastore.getDataContextProvider();
    _rendererDelegate = new DefaultTreeRenderer();
    setCellRenderer(this);
    setOpaque(false);
    addTreeWillExpandListener(this);
  }
View Full Code Here

  @Override
  public JComponent render(SimilarityResult result) {
    final DCPanel panel = new DCPanel();
    panel.setLayout(new BorderLayout());

    final DefaultTreeRenderer rendererDelegate = new DefaultTreeRenderer();

    final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Similarity groups");

    final List<SimilarityGroup> similarityGroups = result.getSimilarityGroups();
    for (SimilarityGroup sg : similarityGroups) {
      rootNode.add(new DefaultMutableTreeNode(sg));
    }

    final DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);

    final JXTree tree = new JXTree();
    tree.setCellRenderer(new TreeCellRenderer() {
      @Override
      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
          boolean leaf, int row, boolean hasFocus) {
        if (value instanceof DefaultMutableTreeNode) {
          final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
          if (userObject instanceof SimilarityGroup) {
            final SimilarityGroup similarityGroup = (SimilarityGroup) userObject;
            final String[] values = similarityGroup.getValues();

            final StringBuilder sb = new StringBuilder();
            sb.append(values.length);
            sb.append(": [");
            for (int i = 0; i < values.length; i++) {
              if (i != 0) {
                sb.append(',');
              }
              sb.append('\"');
              sb.append(values[i]);
              sb.append('\"');
              if (sb.length() > 17) {
                sb.delete(17, sb.length());
                sb.append(",...");
                break;
              }
            }
            sb.append(']');

            value = sb.toString();
          }
        }
        return rendererDelegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
      }
    });
    tree.setModel(treeModel);

    final DCPanel centerPanel = new DCPanel(WidgetUtils.BG_COLOR_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT);
View Full Code Here

        };
        // <snip> JXTreeTable rendering
        // IconValue provides node icon (same as in XTreeDemo)
        IconValue iv = new LazyLoadingIconValue(XTreeDemo.class, keyValue, "fallback.png");
        // create and set a tree renderer using the custom Icon-/StringValue
        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(iv, sv));
        // string representation for use of Dimension/Point class
        StringValue locSize = new StringValue() {
           
            @Override
            public String getString(Object value) {
View Full Code Here

        };
        // <snip> JXTree rendering
        // IconValue provides node icon
        IconValue iv = new LazyLoadingIconValue(getClass(), keyValue, "fallback.png");
        // create and set a tree renderer using the custom Icon-/StringValue
        tree.setCellRenderer(new DefaultTreeRenderer(iv, sv));
        // </snip>
        tree.setRowHeight(-1);
       
        // <snip> JXTree rollover
        // enable and register a highlighter
View Full Code Here

        linkTree.expandAll();
        // enable rollover
        linkTree.setRolloverEnabled(true);
        // set a renderer delegating to wrapper around a HyperlinkProvider
        // configured with a raw HyperlinkAction
        linkTree.setCellRenderer(new DefaultTreeRenderer(new WrappingProvider(
                new HyperlinkProvider(new HyperlinkAction()))));
        // </snip>
        DemoUtils.setSnippet("Tree with hyperlink renderer", linkTree);
       
    }
View Full Code Here

        table = new JXTable();
        contents.add(table, "table");
       
        tree = new JXTree();
        tree.setName("tree");
        tree.setCellRenderer(new DefaultTreeRenderer(new StringValue() {
            public String getString(Object value) {
                if (value instanceof Component) {
                    return value.getClass().getSimpleName() + " (" + ((Component) value).getName() + ")";
                }
                   
                return StringValues.TO_STRING.getString(value);
            }
        }));
        contents.add(tree, tree.getName());
       
        treeTable = new JXTreeTable();
        treeTable.setName("treeTable");
        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(new StringValue() {
            public String getString(Object value) {
                if (value instanceof Component) {
                    return value.getClass().getSimpleName() + " (" + ((Component) value).getName() + ")";
                }
               
View Full Code Here

    // install SwingX renderers configured with the appropriate String converter
    private void installRenderers() {
        StringValue sv = stringValues.get("name");
        table.setDefaultRenderer(Contributor.class, new DefaultTableRenderer(sv));
        list.setCellRenderer(new DefaultListRenderer(sv));
        tree.setCellRenderer(new DefaultTreeRenderer(sv));
        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
       
        for (int i = 1; i < keys.length; i++) {
            installColumnRenderers(i, new DefaultTableRenderer(stringValues.get(keys[i])));
        }
        // </snip>
View Full Code Here

    private void installRenderers() {
        initStringRepresentation();
        StringValue sv = stringValues.get("name");
        table.setDefaultRenderer(Contributor.class, new DefaultTableRenderer(sv));
        list.setCellRenderer(new DefaultListRenderer(sv));
        tree.setCellRenderer(new DefaultTreeRenderer(sv));
        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
       
        for (int i = 1; i < keys.length; i++) {
            installColumnRenderers(i, new DefaultTableRenderer(stringValues.get(keys[i])));
        }
        // <snip> Unrelated, just for fun: Hyperlink
View Full Code Here

                basePainterControlPanel, areaPainterControlPanel);
   }

    @SuppressWarnings("unchecked")
    private void bindSelection(Object... components) {
        painterDemos.setCellRenderer(new DefaultTreeRenderer(
                DisplayValues.DISPLAY_INFO_DESCRIPTION));
        Converter<?, ?> painterConverter = new DisplayInfoConverter<Painter>();
        BindingGroup group = new BindingGroup();
        for (int i = 0; i < components.length; i++) {
            BeanProperty p = BeanProperty.create(
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.renderer.DefaultTreeRenderer

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.