Package org.jdesktop.swingx.decorator

Examples of org.jdesktop.swingx.decorator.HighlightPredicate


    /**
     *
     */
    private void installHighlighters() {
        HighlightPredicate boldPredicate = new HighlightPredicate() {

            public boolean isHighlighted(Component renderer,
                    ComponentAdapter adapter) {
                if (!(adapter instanceof CalendarAdapter))
                    return false;
                CalendarAdapter ca = (CalendarAdapter) adapter;
                return CalendarState.DAY_OF_WEEK == ca.getCalendarState() ||
                    CalendarState.TITLE == ca.getCalendarState();
            }
           
        };
        Highlighter font = new AbstractHighlighter(boldPredicate) {

            @Override
            protected Component doHighlight(Component component,
                    ComponentAdapter adapter) {
                component.setFont(getDerivedFont(component.getFont()));
                return component;
            }
           
        };
        highlighter.addHighlighter(font);
       
        HighlightPredicate unselectable = new HighlightPredicate() {

            public boolean isHighlighted(Component renderer,
                    ComponentAdapter adapter) {
                if (!(adapter instanceof CalendarAdapter))
                    return false;
View Full Code Here


                pathList.add(0, component);
                component = component.getParent();
            }
            final TreePath treePath = new TreePath(pathList.toArray());
            treeTable.scrollPathToVisible(treePath);
            HighlightPredicate predicate = new HighlightPredicate() {
               
                @Override
                public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
                    return adapter.row == treeTable.getRowForPath(treePath);
                }
View Full Code Here

        // Icon and tool tip decorators for nominees
        IconHighlighter nominee = new IconHighlighter(nomineeIcon);
        ToolTipHighlighter nomineeToolTip = new ToolTipHighlighter();
        nomineeToolTip.addStringValue(new ListStringValue(true, "Nominee", "Nominees: "), "nomineesColumn");
        // the predicate to decide which to use
        HighlightPredicate winnerPredicate = new HighlightPredicate() {
           
            public boolean isHighlighted(Component renderer,
                    ComponentAdapter adapter) {
                int modelColumn = adapter.getColumnIndex("winnerColumn");
                return ((Boolean) adapter.getValue(modelColumn)).booleanValue();
View Full Code Here

     * called after pattern changed.
     *
     * @param pattern
     */
    protected void updatePattern(Pattern pattern) {
        HighlightPredicate predicate = new SearchPredicate(pattern, -1, -1);
        matchHighlighter.setHighlightPredicate(predicate);
        tablePatternFilter = RowFilters.regexFilter(pattern);
        listPatternFilter = RowFilters.regexFilter(pattern);
    }
View Full Code Here

    _leftRenderer=new TableCellRendererWrapper(true,_model,super.getDefaultLeftRenderer(Object.class));
    _rightRenderer=new TableCellRendererWrapper(false,_model,super.getDefaultRightRenderer(Object.class));
    super.setDefaultLeftRenderer(Object.class, _leftRenderer);
    super.setDefaultRightRenderer(Object.class, _rightRenderer);*/
   
    HighlightPredicate paintIconExpanded=new HighlightPredicate() {
      public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        if (adapter.column==0) {
          CNodeIndex cnode=_model.getCNodeIndex(adapter.row, 0);
          if (cnode.nodeRow==-1) {
            return _model.getNodeExpanded(cnode.nodeIndex);
          } else {
            return false;
          }
        } else {
          return false;
        }
      }
    };
    HighlightPredicate paintIconClosed=new HighlightPredicate() {
      public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        if (adapter.column==0) {
          CNodeIndex cnode=_model.getCNodeIndex(adapter.row, 0);
          if (cnode.nodeRow==-1) {
            return !_model.getNodeExpanded(cnode.nodeIndex);
          } else {
            return false;
          }
        } else {
          return false;
        }
      }
    };
    HighlightPredicate splitRow=new HighlightPredicate() {
      public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        CNodeIndex cnode=_model.getCNodeIndex(adapter.row, adapter.column);
        if (cnode.nodeRow==-1) {
          return true;
        } else {
          return false;
        }
      }
    };
    HighlightPredicate top=new HighlightPredicate() {
      public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        return (adapter.row==0);
      }
    };
    HighlightPredicate left=new HighlightPredicate() {
      public boolean isHighlighted(Component rederer, ComponentAdapter adapter) {
        return (adapter.column==0);
      }
    };
   
View Full Code Here

        projetoDAO.addObserver(this);
//        numberCF2 = new NumberColumnFormat();

        view.setState(new Fechado(view));

        HighlightPredicate predicate = new PatternPredicate("^-", 1);
        ColorHighlighter highlighter = new ColorHighlighter(predicate, null, Color.RED, Color.GRAY, null);
        view.getGrid().setHighlighters(highlighter);
    }
View Full Code Here

    final NumberCellRenderer numberRenderer = new NumberCellRenderer();
    getColumnModel().getColumn(TimesheetTableModel.Columns.NO.ordinal()).setCellRenderer(numberRenderer);
    getColumnModel().getColumn(TimesheetTableModel.Columns.DURATION.ordinal()).setCellRenderer(numberRenderer);
   
    getColumnModel().getColumn(TimesheetTableModel.Columns.RATE.ordinal()).setCellRenderer(new RateCellRenderer());
    HighlightPredicate ratePredicate = new HighlightPredicate() {
      @Override
      public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        if (convertColumnIndexToModel(adapter.column) != TimesheetTableModel.Columns.RATE.ordinal()) {
          return false;
        }
View Full Code Here


    private static class DownloadIndicatorHighlighter extends AbstractHighlighter {

        public DownloadIndicatorHighlighter() {
            super(new HighlightPredicate() {

                @Override
                public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
                    return adapter.getValue() instanceof ProgressMessage;
                }
View Full Code Here

        Color minorBackground = new Color(255, 235, 205);
        Color criticalColor = new Color(245, 205, 205);
        Color indeterminateColor = new Color(235, 235, 205);
        eventTable = new JXTreeTable(dataModel);
        eventTable.setRootVisible(false);
        ColorHighlighter normalHighlighter = new ColorHighlighter(new HighlightPredicate() {
            @Override
            public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
                if(!componentAdapter.isLeaf())
                    return false;
                Object value = componentAdapter.getValue(0);
                return value != null && eventColorManager.isNormal((String) value);
            }
        });
        normalHighlighter.setBackground(normalBackground);

        ColorHighlighter indeterminateHighlighter = new ColorHighlighter(new HighlightPredicate() {
            @Override
            public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
                if(!componentAdapter.isLeaf())
                    return false;
                Object value = componentAdapter.getValue(0);
                return value != null && eventColorManager.isIndeterminate((String) value);
            }
        });
        indeterminateHighlighter.setBackground(indeterminateColor);

        ColorHighlighter minorHighlighter = new ColorHighlighter(new HighlightPredicate() {
            @Override
            public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
                Object value = componentAdapter.getValue(0);
                return value != null && eventColorManager.isMinor((String) value);
            }
        });
        minorHighlighter.setBackground(minorBackground);

        ColorHighlighter warningHighlighter = new ColorHighlighter(new HighlightPredicate() {
            @Override
            public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
                Object value = componentAdapter.getValue(0);
                return value != null && eventColorManager.isWarning((String)value);
            }
        });

        warningHighlighter.setBackground(warningBackground);

        ColorHighlighter criticalHighlighter = new ColorHighlighter(new HighlightPredicate() {
            @Override
            public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
                Object value = componentAdapter.getValue(0);
                return value != null && eventColorManager.isCritical((String) value);
            }
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.decorator.HighlightPredicate

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.