/** * Returns the CompoundHighlighter assigned to the table, null if none. * PENDING: open up for subclasses again?. * * @return the CompoundHighlighter assigned to the table. */ protected CompoundHighlighter getCompoundHighlighter() { if (compoundHighlighter == null) { compoundHighlighter = new CompoundHighlighter(); compoundHighlighter.addChangeListener(getHighlighterChangeListener()); } return compoundHighlighter; }
/** * Appends a highlighter to the pipeline. * * @param highlighter highlighter to add * @throws NullPointerException if highlighter is null. */ public void addHighlighter(Highlighter highlighter) { addHighlighter(highlighter, false); }
/** * Sets the given * <code>Highlighter</code>s. * * @param inList zero or more not-null Highlighters to manage by this * CompoundHighlighter. * @throws NullPointerException if array is null or array contains null values. */ public void setHighlighters(Highlighter... inList) { Contract.asNotNull(inList, "Highlighter must not be null"); if (highlighters.isEmpty() && (inList.length == 0)) return; removeAllHighlightersSilently(); for (Highlighter highlighter : inList) { addHighlighterSilently(highlighter, false); } fireStateChanged(); }
/** * Adds a highlighter to the pipeline. * * PENDING: Duplicate inserts? * * @param highlighter highlighter to add * @param prepend prepend the highlighter if true; false will append * @throws NullPointerException if highlighter is null. */ public void addHighlighter(Highlighter highlighter, boolean prepend) { addHighlighterSilently(highlighter, prepend); fireStateChanged(); }
private void addHighlighterSilently(Highlighter highlighter, boolean prepend) { Contract.asNotNull(highlighter, "Highlighter must not be null"); if (prepend) { highlighters.add(0, highlighter); } else { highlighters.add(highlighters.size(), highlighter); } updateUI(highlighter); highlighter.addChangeListener(getHighlighterChangeListener()); }
/** * @return */ private Highlighter getHighlighter() { if (highlighter == null) { highlighter = new CompoundHighlighter(); installHighlighters(); } return highlighter; }
/** * Removes a highlighter from the pipeline. * * * @param hl highlighter to remove */ public void removeHighlighter(Highlighter hl) { boolean success = highlighters.remove(hl); if (success) { // PENDING: duplicates? hl.removeChangeListener(getHighlighterChangeListener()); fireStateChanged(); } // should log if this didn't succeed. Maybe }
/** * Returns the <code>Highlighter</code>s used by this table. * Maybe empty, but guarantees to be never null. * * @return the Highlighters used by this table, guaranteed to never null. * @see #setHighlighters(Highlighter[]) */ public Highlighter[] getHighlighters() { return getCompoundHighlighter().getHighlighters(); } /**
/** * {@inheritDoc} <p> * * Overridden to apply the highlighters, if any, after calling the delegate. * The decorators are not applied if the row is invalid. */ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component comp = delegateRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if ((compoundHighlighter != null) && (index >= 0) && (index < getElementCount())) { comp = compoundHighlighter.highlight(comp, getComponentAdapter(index)); } return comp; }
/** * Removes all contained highlighters without firing an event. * Deregisters the listener from all. */ private void removeAllHighlightersSilently() { for (Highlighter highlighter : highlighters) { highlighter.removeChangeListener(getHighlighterChangeListener()); } highlighters.clear(); }
@Override public void stateChanged(ChangeEvent e) { fireStateChanged(); }
/** * Returns the <code>ChangeListner</code> to contained * <code>Highlighter</code>s. The listener is lazily created. * * @return the listener for contained highlighters, guaranteed * to be not null. */ protected ChangeListener getHighlighterChangeListener() { if (highlighterChangeListener == null) { highlighterChangeListener = createHighlighterChangeListener(); } return highlighterChangeListener; }
private void addHighlighterSilently(Highlighter highlighter, boolean prepend) { Contract.asNotNull(highlighter, "Highlighter must not be null"); if (prepend) { highlighters.add(0, highlighter); } else { highlighters.add(highlighters.size(), highlighter); } updateUI(highlighter); highlighter.addChangeListener(getHighlighterChangeListener()); }
/** * Adds a highlighter to the pipeline. * * PENDING: Duplicate inserts? * * @param highlighter highlighter to add * @param prepend prepend the highlighter if true; false will append * @throws NullPointerException if highlighter is null. */ public void addHighlighter(Highlighter highlighter, boolean prepend) { addHighlighterSilently(highlighter, prepend); fireStateChanged(); }
/** * @return */ private Highlighter getHighlighter() { if (highlighter == null) { highlighter = new CompoundHighlighter(); installHighlighters(); } return highlighter; }
/** * Removes a highlighter from the pipeline. * * * @param hl highlighter to remove */ public void removeHighlighter(Highlighter hl) { boolean success = highlighters.remove(hl); if (success) { // PENDING: duplicates? hl.removeChangeListener(getHighlighterChangeListener()); fireStateChanged(); } // should log if this didn't succeed. Maybe }
/** * Returns the <code>Highlighter</code>s used by this table. * Maybe empty, but guarantees to be never null. * * @return the Highlighters used by this table, guaranteed to never null. * @see #setHighlighters(Highlighter[]) */ public Highlighter[] getHighlighters() { return getCompoundHighlighter().getHighlighters(); } /**
/** * {@inheritDoc} <p> * * Overridden to apply the highlighters, if any, after calling the delegate. * The decorators are not applied if the row is invalid. */ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component comp = delegateRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if ((compoundHighlighter != null) && (index >= 0) && (index < getElementCount())) { comp = compoundHighlighter.highlight(comp, getComponentAdapter(index)); } return comp; }
/** * Removes all contained highlighters without firing an event. * Deregisters the listener from all. */ private void removeAllHighlightersSilently() { for (Highlighter highlighter : highlighters) { highlighter.removeChangeListener(getHighlighterChangeListener()); } highlighters.clear(); }
@Override public void stateChanged(ChangeEvent e) { fireStateChanged(); }