@NotNull public Property[] getChildren(final RadComponent component) { if (!(component instanceof RadContainer)) return Property.EMPTY_ARRAY; BorderType borderType = ((RadContainer)component).getBorderType(); if (borderType.equals(BorderType.EMPTY)) { return new Property[]{new MyTypeProperty(), new MySizeProperty(this), new MyTitleProperty(), new MyTitleIntEnumProperty(this, "title justification", true), new MyTitleIntEnumProperty(this, "title position", false), new MyTitleFontProperty(this), new MyBorderColorProperty(this, true)}; } else if (borderType.equals(BorderType.LINE)) { return new Property[]{new MyTypeProperty(), new MyBorderColorProperty(this, false), new MyTitleProperty(), new MyTitleIntEnumProperty(this, "title justification", true), new MyTitleIntEnumProperty(this, "title position", false), new MyTitleFontProperty(this), new MyBorderColorProperty(this, true)}; } return myChildren; }
public GridLayoutColumnProperties() { myWantGrowCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for(RadComponent c: myContainer.getComponents()) { if (c.getConstraints().getCell(myRow) == mySelectedIndex) { Property<RadComponent, Integer> property = myRow ? VSizePolicyProperty.getInstance(c.getProject()) : HSizePolicyProperty.getInstance(c.getProject()); if (myWantGrowCheckBox.isSelected()) { property.setValueEx(c, property.getValue(c).intValue() | GridConstraints.SIZEPOLICY_WANT_GROW); break; } else { if ((property.getValue(c).intValue() & GridConstraints.SIZEPOLICY_WANT_GROW) != 0) { property.setValueEx(c, property.getValue(c).intValue() & ~GridConstraints.SIZEPOLICY_WANT_GROW); break; } } } } for(ChangeListener listener: myListeners) { listener.stateChanged(new ChangeEvent(this)); } } }); }
public static void doResetValue(final List<RadComponent> selection, final Property property, final GuiEditor editor) { try { if (!editor.ensureEditable()) return; final PropertyInspector propertyInspector = UIDesignerToolWindowManager.getInstance(editor.getProject()).getPropertyInspector(); if (propertyInspector.isEditing()) { propertyInspector.stopEditing(); } //noinspection unchecked for(RadComponent component: selection) { //noinspection unchecked if (property.isModified(component)) { //noinspection unchecked property.resetValue(component); component.getDelegee().invalidate(); } } editor.refreshAndSave(false); propertyInspector.repaint(); } catch (Exception e1) { LOG.error(e1); } }
@Override protected void update(final GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) { PropertyInspectorTable inspector = e.getData(PropertyInspectorTable.DATA_KEY); if(inspector != null) { final Property selectedProperty = inspector.getSelectedProperty(); //noinspection unchecked e.getPresentation().setEnabled(selectedProperty != null && selection.size() > 0 && inspector.isModifiedForSelection(selectedProperty)); } else { e.getPresentation().setEnabled(false); } }
private void updateUI(final Property property) { final PropertyRenderer renderer = property.getRenderer(); renderer.updateUI(); final PropertyEditor editor = property.getEditor(); if (editor != null) { editor.updateUI(); } final Property[] children = property.getChildren(null); for (int i = children.length - 1; i >= 0; i--) { updateUI(children[i]); } }
public AbstractInsetsProperty(Property parent, @NonNls final String name){ super(parent, name); myChildren=new Property[]{ new IntFieldProperty(this, "top", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "left", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "bottom", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "right", 0, new Insets(0, 0, 0, 0)), }; myRenderer=new InsetsPropertyRenderer(); }
public IntFieldProperty(@NotNull final Property parent, @NonNls final String fieldName, final int lowBoundary, final Object templateValue) { super(parent, fieldName); myParent = parent; myFieldName = fieldName; myTemplateValue = templateValue; myRenderer = new LabelPropertyRenderer<Integer>(); myEditor = new IntEditor(lowBoundary); }
public AbstractDimensionProperty(@NonNls final String name){ super(null, name); myChildren=new Property[]{ new IntFieldProperty(this, "width", -1, JBUI.emptySize()), new IntFieldProperty(this, "height", -1, JBUI.emptySize()), }; myRenderer = new DimensionRenderer(); myEditor = new IntRegexEditor<Dimension>(Dimension.class, myRenderer, new int[] { -1, -1 }); }
public IntroRectangleProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient){ super(name, readMethod, writeMethod, storeAsClient); myRenderer=new RectangleRenderer(); myChildren=new Property[]{ new IntFieldProperty(this, "x", Integer.MIN_VALUE, new Rectangle(0, 0, 0, 0)), new IntFieldProperty(this, "y", Integer.MIN_VALUE, new Rectangle(0, 0, 0, 0)), new IntFieldProperty(this, "width", 0, new Rectangle(0, 0, 0, 0)), new IntFieldProperty(this, "height", 0, new Rectangle(0, 0, 0, 0)), }; myEditor = new IntRegexEditor<Rectangle>(Rectangle.class, myRenderer, new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE, 0, 0 }); }
public IntroDimensionProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient){ super(name, readMethod, writeMethod, storeAsClient); myChildren = new Property[]{ new IntFieldProperty(this, "width", -1, JBUI.emptySize()), new IntFieldProperty(this, "height", -1, JBUI.emptySize()), }; myRenderer = new DimensionRenderer(); myEditor = new IntRegexEditor<Dimension>(Dimension.class, myRenderer, new int[] { -1, -1 }); }
public IntroInsetsProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient){ super(name, readMethod, writeMethod, storeAsClient); myChildren=new Property[]{ new IntFieldProperty(this, "top", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "left", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "bottom", 0, new Insets(0, 0, 0, 0)), new IntFieldProperty(this, "right", 0, new Insets(0, 0, 0, 0)), }; myRenderer=new InsetsPropertyRenderer(); myEditor = new InsetsEditor(myRenderer); }
public SizePolicyProperty(@NonNls final String name){ super(null, name); myChildren=new Property[]{ new MyBooleanProperty("Can Shrink", GridConstraints.SIZEPOLICY_CAN_SHRINK), new MyBooleanProperty("Can Grow", GridConstraints.SIZEPOLICY_CAN_GROW), new MyBooleanProperty("Want Grow", GridConstraints.SIZEPOLICY_WANT_GROW) }; myRenderer=new SizePolicyRenderer(); }
public void actionPerformed(final AnActionEvent e) { final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor); final RadComponent component = selection.get(0); final Property defaultInplaceProperty = component.getDefaultInplaceProperty(); myEditor.getInplaceEditingLayer().startInplaceEditing(component, defaultInplaceProperty, component.getDefaultInplaceEditorBounds(), new InplaceContext(true)); }
/** * Starts editing of "inplace" property for the component at the * specified point <code>(x, y)</code>. * * @param x x coordinate in the editor coordinate system * @param y y coordinate in the editor coordinate system */ public void startInplaceEditing(final int x, final int y){ final RadComponent inplaceComponent = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), x, y); if(inplaceComponent == null){ // nothing to edit return; } // Try to find property with inplace editor final Point p = SwingUtilities.convertPoint(this, x, y, inplaceComponent.getDelegee()); final Property inplaceProperty = inplaceComponent.getInplaceProperty(p.x, p.y); if (inplaceProperty != null) { final Rectangle bounds = inplaceComponent.getInplaceEditorBounds(inplaceProperty, p.x, p.y); startInplaceEditing(inplaceComponent, inplaceProperty, bounds, new InplaceContext(true)); } }
@Override public Property[] getComponentProperties(final Project project, final RadComponent component) { return new Property[] { HorzAlignProperty.getInstance(project), VertAlignProperty.getInstance(project), new ComponentInsetsProperty() }; }
@Override public Property[] getComponentProperties(final Project project, final RadComponent component) { return new Property[]{ new HorzAlignProperty(), new VertAlignProperty(), new ComponentInsetsProperty(), new WeightProperty(true), new WeightProperty(false), new IPadProperty(true), new IPadProperty(false) }; }
private void writeClientProperties(final XmlWriter writer) { if (myModule == null) { return; } boolean haveClientProperties = false; try { ClientPropertiesProperty cpp = ClientPropertiesProperty.getInstance(getProject()); for (Property prop : cpp.getChildren(this)) { ClientPropertyProperty clientProp = (ClientPropertyProperty)prop; final Object value = getDelegee().getClientProperty(clientProp.getName()); if (value != null) { if (!haveClientProperties) { writer.startElement(UIFormXmlConstants.ELEMENT_CLIENT_PROPERTIES); haveClientProperties = true; } writer.startElement(clientProp.getName()); writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_CLASS, value.getClass().getName()); writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, value.toString()); writer.endElement(); } } } finally { if (haveClientProperties) { writer.endElement(); } } }
@Override public Property[] getContainerProperties(final Project project) { return new Property[]{ HGapProperty.getInstance(project), VGapProperty.getInstance(project), DefaultCardProperty.INSTANCE }; }
public Property getInplaceProperty(final int x, final int y) { // 1. We have to check whether user clicked inside border (if any) or not. // In this case we have return inplace editor for border text final Insets insets = getDelegee().getInsets(); // border insets if ( x < insets.left || x > getWidth() - insets.right || y < 0 || y > insets.top ) { return super.getInplaceProperty(x, y); } // 2. Now we are sure that user clicked inside title area return new MyBorderTitleProperty(); }
private Rectangle getBorderInPlaceEditorBounds(final Property property) { final MyBorderTitleProperty _property = (MyBorderTitleProperty)property; final Insets insets = getDelegee().getInsets(); return new Rectangle( insets.left, 0, getWidth() - insets.left - insets.right, _property.getPreferredSize().height ); }
@Override public Property[] getContainerProperties(final Project project) { return new Property[] { MarginProperty.getInstance(project), HGapProperty.getInstance(project), VGapProperty.getInstance(project), SameSizeHorizontallyProperty.getInstance(project), SameSizeVerticallyProperty.getInstance(project) }; }
@Override public Property[] getComponentProperties(final Project project, final RadComponent component) { return new Property[] { HSizePolicyProperty.getInstance(project), VSizePolicyProperty.getInstance(project), HorzAlignProperty.getInstance(project), VertAlignProperty.getInstance(project), IndentProperty.getInstance(project), UseParentLayoutProperty.getInstance(project), MinimumSizeProperty.getInstance(project), PreferredSizeProperty.getInstance(project), MaximumSizeProperty.getInstance(project) }; }
private void updateUI(final Property property){ final PropertyRenderer renderer = property.getRenderer(); renderer.updateUI(); final PropertyEditor editor = property.getEditor(); if(editor != null){ editor.updateUI(); } final Property[] children = property.getChildren(null); for (int i = children.length - 1; i >= 0; i--) { updateUI(children[i]); } }
public AbstractDimensionProperty(@NonNls final String name){ super(null, name); myChildren=new Property[]{ new IntFieldProperty(this, "width", -1, new Dimension(0, 0)), new IntFieldProperty(this, "height", -1, new Dimension(0, 0)), }; myRenderer = new DimensionRenderer(); myEditor = new IntRegexEditor<Dimension>(Dimension.class, myRenderer, new int[] { -1, -1 }); }
public IntroDimensionProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient){ super(name, readMethod, writeMethod, storeAsClient); myChildren = new Property[]{ new IntFieldProperty(this, "width", -1, new Dimension(0, 0)), new IntFieldProperty(this, "height", -1, new Dimension(0, 0)), }; myRenderer = new DimensionRenderer(); myEditor = new IntRegexEditor<Dimension>(Dimension.class, myRenderer, new int[] { -1, -1 }); }
protected void update(final GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) { PropertyInspectorTable inspector = PropertyInspectorTable.DATA_KEY.getData(e.getDataContext()); if (inspector != null) { final Property selectedProperty = inspector.getSelectedProperty(); //noinspection unchecked e.getPresentation().setEnabled(selectedProperty != null && selection.size() > 0 && inspector.isModifiedForSelection(selectedProperty)); } else { e.getPresentation().setEnabled(false); } }