Search in sources :

Example 1 with ParentThemesListModel

use of com.android.tools.idea.editors.theme.ParentThemesListModel in project android by JetBrains.

the class ParentRendererEditor method getRendererComponent.

@Override
public Component getRendererComponent(JTable table, ConfiguredThemeEditorStyle value, boolean isSelected, boolean hasFocus, int row, int column) {
    final TableModel model = table.getModel();
    final ConfiguredThemeEditorStyle parent = value.getParent();
    Font font = table.getFont();
    Font scaledFont = ThemeEditorUtils.scaleFontForAttribute(font);
    myParentComboBox.setFont(scaledFont);
    myLabel.setFont(scaledFont);
    myParentComboBox.setEnabled(model.isCellEditable(row, column));
    if (parent == null) {
        myParentComboBox.setModel(NO_PARENT_MODEL);
        myItem = null;
    } else {
        ImmutableList<String> defaultThemeNames = ThemeEditorUtils.getDefaultThemeNames(myContext.getThemeResolver());
        myParentComboBox.setModel(new ParentThemesListModel(defaultThemeNames, parent.getQualifiedName()));
        myItem = value;
    }
    updateVariantsCombo();
    return myPanel;
}
Also used : ParentThemesListModel(com.android.tools.idea.editors.theme.ParentThemesListModel) TableModel(javax.swing.table.TableModel) ConfiguredThemeEditorStyle(com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)

Example 2 with ParentThemesListModel

use of com.android.tools.idea.editors.theme.ParentThemesListModel in project android by JetBrains.

the class ParentRendererEditor method getEditorComponent.

@Override
public Component getEditorComponent(JTable table, ConfiguredThemeEditorStyle value, boolean isSelected, int row, int column) {
    Font font = table.getFont();
    Font scaledFont = ThemeEditorUtils.scaleFontForAttribute(font);
    myParentComboBox.setFont(scaledFont);
    myLabel.setFont(scaledFont);
    ConfiguredThemeEditorStyle parent = value.getParent();
    ImmutableList<String> defaultThemeNames = ThemeEditorUtils.getDefaultThemeNames(myContext.getThemeResolver());
    myParentComboBox.setModel(new ParentThemesListModel(defaultThemeNames, parent.getQualifiedName()));
    myResultValue = parent.getQualifiedName();
    myItem = value;
    updateVariantsCombo();
    return myPanel;
}
Also used : ParentThemesListModel(com.android.tools.idea.editors.theme.ParentThemesListModel) ConfiguredThemeEditorStyle(com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)

Aggregations

ParentThemesListModel (com.android.tools.idea.editors.theme.ParentThemesListModel)2 ConfiguredThemeEditorStyle (com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)2 TableModel (javax.swing.table.TableModel)1