Search in sources :

Example 6 with Property

use of com.intellij.designer.model.Property in project intellij-community by JetBrains.

the class PropertyTable method collapse.

private void collapse(int rowIndex) {
    int selectedRow = getSelectedRow();
    Property property = myProperties.get(rowIndex);
    int size = collapse(property, rowIndex + 1);
    LOG.assertTrue(size > 0);
    myModel.fireTableDataChanged();
    if (selectedRow != -1) {
        if (selectedRow > rowIndex) {
            selectedRow -= size;
        }
        getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
    }
}
Also used : Property(com.intellij.designer.model.Property)

Example 7 with Property

use of com.intellij.designer.model.Property in project intellij-community by JetBrains.

the class PropertyTable method restoreDefaultValue.

public void restoreDefaultValue() {
    final Property property = getSelectionProperty();
    if (property != null) {
        if (isEditing()) {
            cellEditor.stopCellEditing();
        }
        doRestoreDefault(() -> {
            for (PropertiesContainer component : myContainers) {
                if (!property.isDefaultRecursively(component)) {
                    property.setDefaultValue(component);
                }
            }
        });
        repaint();
    }
}
Also used : PropertiesContainer(com.intellij.designer.model.PropertiesContainer) Property(com.intellij.designer.model.Property)

Example 8 with Property

use of com.intellij.designer.model.Property in project intellij-community by JetBrains.

the class PropertyTable method update.

private void update(@NotNull List<? extends PropertiesContainer> containers, @Nullable Property initialSelection, boolean finishEditing) {
    if (finishEditing) {
        finishEditing();
    }
    if (mySkipUpdate) {
        return;
    }
    mySkipUpdate = true;
    try {
        if (finishEditing && isEditing()) {
            cellEditor.stopCellEditing();
        }
        Property selection = initialSelection != null ? initialSelection : getSelectionProperty();
        myContainers = new ArrayList<>(containers);
        fillProperties();
        myModel.fireTableDataChanged();
        restoreSelection(selection);
    } finally {
        mySkipUpdate = false;
    }
}
Also used : Property(com.intellij.designer.model.Property)

Example 9 with Property

use of com.intellij.designer.model.Property in project intellij-community by JetBrains.

the class PropertyTable method findFullPathProperty.

private static int findFullPathProperty(List<Property> properties, Property property) {
    Property parent = property.getParent();
    if (parent == null) {
        return findProperty(properties, property);
    }
    String name = getFullPathName(property);
    int size = properties.size();
    for (int i = 0; i < size; i++) {
        if (name.equals(getFullPathName(properties.get(i)))) {
            return i;
        }
    }
    return -1;
}
Also used : Property(com.intellij.designer.model.Property)

Example 10 with Property

use of com.intellij.designer.model.Property in project intellij-community by JetBrains.

the class PropertyTable method fillProperties.

private void fillProperties() {
    myProperties = new ArrayList<>();
    int size = myContainers.size();
    if (size > 0) {
        List<Property> rootProperties = new ArrayList<>();
        for (Property each : (Iterable<? extends Property>) getProperties(myContainers.get(0))) {
            addIfNeeded(getCurrentComponent(), each, rootProperties);
        }
        sortPropertiesAndCreateGroups(rootProperties);
        for (Property property : rootProperties) {
            myProperties.add(property);
            addExpandedChildren(getCurrentComponent(), property, myProperties);
        }
        if (size > 1) {
            for (Iterator<Property> I = myProperties.iterator(); I.hasNext(); ) {
                if (!I.next().availableFor(myContainers)) {
                    I.remove();
                }
            }
            for (int i = 1; i < size; i++) {
                List<Property> otherProperties = new ArrayList<>();
                fillProperties(myContainers.get(i), otherProperties);
                for (Iterator<Property> I = myProperties.iterator(); I.hasNext(); ) {
                    Property addedProperty = I.next();
                    int index = findFullPathProperty(otherProperties, addedProperty);
                    if (index == -1) {
                        I.remove();
                        continue;
                    }
                    Property testProperty = otherProperties.get(index);
                    if (!addedProperty.getClass().equals(testProperty.getClass())) {
                        I.remove();
                        continue;
                    }
                    List<Property> addedChildren = getChildren(addedProperty);
                    List<Property> testChildren = getChildren(testProperty);
                    int addedChildrenSize = addedChildren.size();
                    if (addedChildrenSize != testChildren.size()) {
                        I.remove();
                        continue;
                    }
                    for (int j = 0; j < addedChildrenSize; j++) {
                        if (!addedChildren.get(j).getName().equals(testChildren.get(j).getName())) {
                            I.remove();
                            break;
                        }
                    }
                }
            }
        }
    }
}
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