Search in sources :

Example 1 with PTableModel

use of com.android.tools.idea.uibuilder.property.ptable.PTableModel in project android by JetBrains.

the class NlTableCellEditor method removeDesignProperty.

public static void removeDesignProperty(@NotNull JTable table, int row) {
    NlPropertyItem designProperty = getPropertyAt(table, row);
    assert designProperty != null && TOOLS_URI.equals(designProperty.getNamespace());
    int previousRow = getPreviousPropertyRow(designProperty, table, row);
    PTableModel model = (PTableModel) table.getModel();
    designProperty.setValue(null);
    designProperty.delete();
    model.collapse(row);
    model.deleteRow(row);
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(() -> table.editCellAt(previousRow, 1));
}
Also used : PTableModel(com.android.tools.idea.uibuilder.property.ptable.PTableModel) NlPropertyItem(com.android.tools.idea.uibuilder.property.NlPropertyItem)

Example 2 with PTableModel

use of com.android.tools.idea.uibuilder.property.ptable.PTableModel in project android by JetBrains.

the class NlTableCellEditor method addDesignProperty.

public static void addDesignProperty(@NotNull JTable table, int row) {
    NlPropertyItem property = getPropertyAt(table, row);
    assert property != null && !TOOLS_URI.equals(property.getNamespace());
    assert getDesignProperty(table, row) == null;
    PTableModel model = (PTableModel) table.getModel();
    int nextRow = getNextPropertyRow(property, row);
    model.insertRow(nextRow, property.getDesignTimeProperty());
    if (property.isExpanded()) {
        model.expand(nextRow);
    }
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(() -> table.editCellAt(row + 1, 1));
}
Also used : PTableModel(com.android.tools.idea.uibuilder.property.ptable.PTableModel) NlPropertyItem(com.android.tools.idea.uibuilder.property.NlPropertyItem)

Aggregations

NlPropertyItem (com.android.tools.idea.uibuilder.property.NlPropertyItem)2 PTableModel (com.android.tools.idea.uibuilder.property.ptable.PTableModel)2