use of spantable.CellSpanModel in project android by JetBrains.
the class ThemeEditorTable method updateRowHeights.
public void updateRowHeights() {
TableModel rawModel = getModel();
if (!(rawModel instanceof CellSpanModel)) {
return;
}
CellSpanModel myModel = (CellSpanModel) rawModel;
int defaultRowHeight = myClassHeights.get(Object.class);
setRowHeight(defaultRowHeight);
for (int row = 0; row < myModel.getRowCount(); row++) {
// Find the maximum row height
int maxRowHeight = -1;
for (int col = 0; col < myModel.getColumnCount(); col += myModel.getColumnSpan(row, col)) {
Class<?> cellClass = myModel.getCellClass(row, col);
Integer rowHeight = myClassHeights.get(cellClass);
if (rowHeight != null) {
maxRowHeight = Math.max(maxRowHeight, rowHeight);
}
}
if (maxRowHeight == -1) {
// Leave the default size
continue;
}
int viewRow = convertRowIndexToView(row);
if (viewRow != -1) {
setRowHeight(viewRow, maxRowHeight);
}
}
}
use of spantable.CellSpanModel in project android by JetBrains.
the class DelegatingCellEditor method getTableCellEditorComponent.
@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
final Object stringValue;
final CellSpanModel model = (CellSpanModel) table.getModel();
boolean boldFont = false;
if (value instanceof EditedStyleItem) {
final EditedStyleItem item = (EditedStyleItem) value;
stringValue = ThemeEditorUtils.extractRealValue(item, model.getCellClass(row, column));
ConfiguredThemeEditorStyle selectedStyle = ((AttributesTableModel) table.getModel()).getSelectedStyle();
// Displays in bold attributes that are overriding their inherited value
boldFont = selectedStyle.hasItem(item);
} else {
// Not an EditedStyleItem for theme name and theme parent.
stringValue = value;
}
final Component returnedComponent = myDelegate.getTableCellEditorComponent(table, myConvertValueToString ? stringValue : value, isSelected, row, column);
returnedComponent.setFont(boldFont ? returnedComponent.getFont().deriveFont(Font.BOLD) : returnedComponent.getFont().deriveFont(Font.PLAIN));
return returnedComponent;
}
Aggregations