use of com.android.tools.idea.uibuilder.property.NlPropertyItem 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));
}
use of com.android.tools.idea.uibuilder.property.NlPropertyItem in project android by JetBrains.
the class NlTableCellEditor method getRuntimeProperty.
@Nullable
public static NlProperty getRuntimeProperty(@NotNull JTable table, int row) {
NlPropertyItem currentProperty = getPropertyAt(table, row);
NlPropertyItem previousProperty = getPropertyAt(table, getPreviousPropertyRow(currentProperty, table, row));
if (currentProperty != null && previousProperty != null && previousProperty.getName().equals(currentProperty.getName()) && TOOLS_URI.equals(currentProperty.getNamespace()) && !TOOLS_URI.equals(previousProperty.getNamespace())) {
return previousProperty;
}
return null;
}
use of com.android.tools.idea.uibuilder.property.NlPropertyItem 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));
}
use of com.android.tools.idea.uibuilder.property.NlPropertyItem in project android by JetBrains.
the class IdAnalyzerTest method testButton1And2.
public void testButton1And2() {
ModelBuilder modelBuilder = createRelativeLayout();
NlModel model = modelBuilder.build();
NlComponent button1 = findById(model, "button1");
NlComponent button2 = findById(model, "button2");
NlProperty accessibility = new NlPropertyItem(ImmutableList.of(button1, button2), ANDROID_URI, new AttributeDefinition(ATTR_ACCESSIBILITY_TRAVERSAL_BEFORE));
IdAnalyzer analyzer = new IdAnalyzer(accessibility);
List<String> ids = analyzer.findIds();
assertEquals(ImmutableList.of("button3", "button4", "button5", "group1", "radio_button1", "radio_button2", "radio_button3", "text_view1"), ids);
}
use of com.android.tools.idea.uibuilder.property.NlPropertyItem in project android by JetBrains.
the class IdAnalyzerTest method testRadioGroup.
public void testRadioGroup() {
ModelBuilder modelBuilder = createRelativeLayout();
NlModel model = modelBuilder.build();
NlComponent group = findById(model, "group1");
NlProperty property = new NlPropertyItem(ImmutableList.of(group), ANDROID_URI, new AttributeDefinition(ATTR_CHECKED_BUTTON));
IdAnalyzer analyzer = new IdAnalyzer(property);
List<String> ids = analyzer.findIds();
assertEquals(ImmutableList.of("radio_button1", "radio_button2", "radio_button3"), ids);
}
Aggregations