use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method sortPropertiesAndCreateGroups.
private void sortPropertiesAndCreateGroups(List<Property> rootProperties) {
if (!mySorted && !myShowGroups)
return;
Collections.sort(rootProperties, (o1, o2) -> {
if (o1.getParent() != null || o2.getParent() != null) {
if (o1.getParent() == o2)
return -1;
if (o2.getParent() == o1)
return 1;
return 0;
}
if (myShowGroups) {
int result = getGroupComparator().compare(o1.getGroup(), o2.getGroup());
if (result != 0)
return result;
}
return mySorted ? getPropertyComparator().compare(o1, o2) : 0;
});
if (myShowGroups) {
for (int i = 0; i < rootProperties.size() - 1; i++) {
Property prev = i == 0 ? null : rootProperties.get(i - 1);
Property each = rootProperties.get(i);
String eachGroup = each.getGroup();
String prevGroup = prev == null ? null : prev.getGroup();
if (prevGroup != null || eachGroup != null) {
if (!StringUtil.equalsIgnoreCase(eachGroup, prevGroup)) {
rootProperties.add(i, new GroupProperty(each.getGroup()));
i++;
}
}
}
}
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method expand.
private void expand(int rowIndex) {
int selectedRow = getSelectedRow();
Property property = myProperties.get(rowIndex);
String path = property.getPath();
if (myExpandedProperties.contains(path)) {
return;
}
myExpandedProperties.add(path);
List<Property> properties = getFilterChildren(property);
myProperties.addAll(rowIndex + 1, properties);
myModel.fireTableDataChanged();
if (selectedRow != -1) {
if (selectedRow > rowIndex) {
selectedRow += properties.size();
}
getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
}
Rectangle rectStart = getCellRect(selectedRow, 0, true);
Rectangle rectEnd = getCellRect(selectedRow + properties.size(), 0, true);
scrollRectToVisible(new Rectangle(rectStart.x, rectStart.y, rectEnd.x + rectEnd.width - rectStart.x, rectEnd.y + rectEnd.height - rectStart.y));
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method findProperty.
public static int findProperty(List<Property> properties, Property property) {
String name = property.getName();
int size = properties.size();
for (int i = 0; i < size; i++) {
Property nextProperty = properties.get(i);
if (Comparing.equal(nextProperty.getGroup(), property.getGroup()) && name.equals(nextProperty.getName())) {
return i;
}
}
return -1;
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method setValueAt.
//////////////////////////////////////////////////////////////////////////////////////////
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void setValueAt(Object aValue, int row, int column) {
Property property = myProperties.get(row);
super.setValueAt(aValue, row, column);
if (property.needRefreshPropertyList()) {
update();
}
repaint();
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class RestoreDefault method setEnabled.
private static void setEnabled(RadPropertyTable table, Presentation presentation) {
try {
Property property = table.getSelectionProperty();
presentation.setEnabled(property != null && !table.isEditing() && !table.isDefault(property));
} catch (Exception e) {
presentation.setEnabled(false);
}
}
Aggregations