Search in sources :

Example 11 with Property

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++;
                }
            }
        }
    }
}
Also used : Property(com.intellij.designer.model.Property)

Example 12 with Property

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));
}
Also used : Property(com.intellij.designer.model.Property)

Example 13 with Property

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;
}
Also used : Property(com.intellij.designer.model.Property)

Example 14 with Property

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();
}
Also used : Property(com.intellij.designer.model.Property)

Example 15 with Property

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);
    }
}
Also used : Property(com.intellij.designer.model.Property)

Aggregations

Property (com.intellij.designer.model.Property)15 PropertiesContainer (com.intellij.designer.model.PropertiesContainer)2 PropertyEditor (com.intellij.designer.propertyTable.PropertyEditor)2 DocumentationComponent (com.intellij.codeInsight.documentation.DocumentationComponent)1 DocumentationManager (com.intellij.codeInsight.documentation.DocumentationManager)1 LineMarginBorder (com.intellij.designer.designSurface.feedbacks.LineMarginBorder)1 RadComponent (com.intellij.designer.model.RadComponent)1 InplaceContext (com.intellij.designer.propertyTable.InplaceContext)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Project (com.intellij.openapi.project.Project)1 JBPopup (com.intellij.openapi.ui.popup.JBPopup)1 ActionCallback (com.intellij.openapi.util.ActionCallback)1 PsiElement (com.intellij.psi.PsiElement)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)1