Refine search
@Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { return adapter.isSelected(); }
/** * @inheritDoc * Implemented to return true if the adapter's component is enabled and * the row of its rollover property equals the adapter's row, returns * false otherwise. * * @see org.jdesktop.swingx.rollover.RolloverProducer */ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { if (!adapter.getComponent().isEnabled()) return false; Point p = (Point) adapter.getComponent().getClientProperty( RolloverProducer.ROLLOVER_KEY); return p != null && p.y == adapter.row; }
/** * Returns the common class of all data in the current column.<p> * * This implementation delegates to getColumnClass(int) with the current * column converted to model coordinates. * * @return the common class of all data in the current column. * @see #getColumnClass(int) */ public Class<?> getColumnClass() { return getColumnClass(convertColumnIndexToModel(column)); }
/** * {@inheritDoc} * * This implementation returns true if the adapter's column * is contained in this predicates list. * */ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { int modelIndex = adapter.viewToModel(adapter.column); Object identifier = adapter.getColumnIdentifierAt(modelIndex); return identifier != null ? columnList.contains(identifier) : false; }
/** * Returns the filtered value of the cell identified by the row * in view coordinate and the column in model coordinates. * * Note: the asymmetry of the coordinates is intentional - clients like * Highlighters are interested in view values but might need to access * non-visible columns for testing. While it is possible to access * row coordinates different from the current (that is this.row) it is not * safe to do so for row > this.row because the adapter doesn't allow to * query the count of visible rows. * * @param row the row of the cell in view coordinates * @param column the column of the cell in model coordinates. * @return the filtered value of the cell identified by the row * in view coordinate and the column in model coordinates */ public Object getFilteredValueAt(int row, int column) { return getValueAt(convertRowIndexToModel(row), column); }
@Override protected void applyBackground(Component renderer, ComponentAdapter adapter) { if (!adapter.isSelected()) { Object colorMemory = ((JComponent) renderer).getClientProperty("rendererColorMemory.background"); if (colorMemory instanceof ColorMemory) { renderer.setBackground(((ColorMemory) colorMemory).color); } else { ((JComponent) renderer).putClientProperty("rendererColorMemory.background", new ColorMemory(renderer.getBackground())); } } }
@Override protected void applyForeground(Component renderer, ComponentAdapter adapter) { if (!adapter.isSelected()) { Object colorMemory = ((JComponent) renderer).getClientProperty("rendererColorMemory.foreground"); if (colorMemory instanceof ColorMemory) { renderer.setForeground(((ColorMemory) colorMemory).color); } else { ((JComponent) renderer).putClientProperty("rendererColorMemory.foreground", new ColorMemory(renderer.getForeground())); } } }
@Override protected Component doHighlight(Component component, ComponentAdapter adapter) { if (foreground) { component.setForeground(color); } else { component.setBackground(color); if (adapter.isSelected()) { component.setForeground(PaintUtils.computeForeground(color)); } } return component; } }
@Override protected void applyBackground(Component renderer, ComponentAdapter adapter ) { if (adapter.getValue() == null) { super.applyBackground(renderer, adapter); } else { if (adapter.getColumnClass().equals(Boolean.class)) { final boolean value = ((boolean) adapter.getValue()); if (adapter.isSelected()) { if (value) { renderer.setBackground(COLOR_PRESENCE_SELECTED); } else { renderer.setBackground(COLOR_ABSENCE_SELECTED); } } else { if (value) { renderer.setBackground(COLOR_PRESENCE); } else { renderer.setBackground(COLOR_ABSENCE); } } } else { super.applyBackground(renderer, adapter); } } } }
/** * Applies a suitable foreground for the renderer component within the * specified adapter. <p> * * This implementation applies its foreground or selectedfForeground color * (depending on the adapter's selected state) if != null. * Otherwise it does nothing. * * @param renderer the cell renderer component that is to be decorated * @param adapter the ComponentAdapter for this decorate operation */ protected void applyForeground(Component renderer, ComponentAdapter adapter) { Color color = adapter.isSelected() ? getSelectedForeground() : getForeground(); renderer.setForeground(blend(renderer.getForeground(), color)); }
@Override protected Component doHighlight(Component component, ComponentAdapter adapter) { ((JComponent) component).setToolTipText(getToolTip((AddOnWrapper) adapter.getValue(column))); return component; }
/** * {@inheritDoc} * * This implementation returns true if the adapter's column * is contained in this predicates list. * */ @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { int modelIndex = adapter.convertColumnIndexToModel(adapter.column); Object identifier = adapter.getColumnIdentifierAt(modelIndex); return identifier != null ? columnList.contains(identifier) : false; }
/** * Returns the String representation of the filtered value of the cell identified by the row * in view coordinate and the column in model coordinates.<p> * * Note: the asymetry of the coordinates is intentional - clients like * Highlighters are interested in view values but might need to access * non-visible columns for testing. While it is possible to access * row coordinates different from the current (that is this.row) it is not * safe to do so for row > this.row because the adapter doesn't allow to * query the count of visible rows.<p> * * This implementation messages the StringValue.TO_STRING with the filteredValue, * subclasses should re-implement and use the API appropriate for the target component type.<p> * * PENDING JW: what about null cell values? StringValue has a contract to return a * empty string then, would that be okay here as well? * * @param row the row of the cell in view coordinates * @param column the column of the cell in model coordinates. * @return the String representation of the filtered value of the cell identified by the row * in view coordinate and the column in model coordinates */ public String getFilteredStringAt(int row, int column) { return getStringAt(convertRowIndexToModel(row), column); }
/** * Returns logical identifier of the column at * columnIndex in model coordinates. * * Note: it's up to the implementation to decide for which * columns it returns an identifier - most will do so for the * subset with isTestable = true.<p> * * This implementation returns DEFAULT_COLUMN_IDENTIFIER. * * PENDING JW: This method replaces the old getColumnIdentifier(int) * which returned a String which is overly restrictive. * The only way to gently replace this method was * to add this with a different name - which makes this name suboptimal. * Probably should rename again once the old has died out ;-) * * @param columnIndex in model coordinates, must be valid. * @return the identifier of the column at columnIndex or null if it has none. * @throws ArrayIndexOutOfBoundsException if columnIndex < 0 or columnIndex >= getColumnCount(). * * * @see #getColumnIndex(Object) */ public Object getColumnIdentifierAt(int columnIndex) { if ((columnIndex < 0) || (columnIndex >= getColumnCount())) { throw new ArrayIndexOutOfBoundsException("invalid column index: " + columnIndex); } return DEFAULT_COLUMN_IDENTIFIER; }
/** * {@inheritDoc} <p> * * Implemented to return truw if the given adapter hasFocus, false otherwise. */ @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { return adapter.hasFocus(); } };
@Override public JXMonthView getComponent() { return (JXMonthView) super.getComponent(); }
/** * A quick pre-check. * @param adapter * * @return */ private boolean isHighlightCandidate(ComponentAdapter adapter) { return (pattern != null) && ((highlightColumn < 0) || (highlightColumn == adapter.convertColumnIndexToModel(adapter.column))); }
/** * Returns the column's display name (= headerValue) of the column * at columnIndex in model coordinates. * * Used f.i. in SearchPanel to fill the field with the * column name.<p> * * Note: it's up to the implementation to decide for which * columns it returns a name - most will do so for the * subset with isTestable = true. * * This implementation delegates to getColumnIdentifierAt and returns it's * toString or null. * * @param columnIndex in model coordinates * @return column name or null if not found */ public String getColumnName(int columnIndex) { Object identifier = getColumnIdentifierAt(columnIndex); return identifier != null ? identifier.toString() : null; }
/** * {@inheritDoc} * * This implementation returns true if the adapter's depth is contained * in this predicates list. * */ @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { int depth = adapter.getDepth(); return depthList.contains(depth); }