From fe3acd873657ebc11099fcc72236fe4d2401a8ea Mon Sep 17 00:00:00 2001 From: Lee Date: Wed, 15 Jun 2016 21:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=B0=E5=8C=96=E5=B7=B2=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=EF=BD=9E=E6=95=88=E6=9E=9C=E8=BF=98=E4=B8=8D=E9=94=99=E5=93=88?= =?UTF-8?q?=EF=BD=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/mobile/BooleanRender.java | 39 +++++++++++++++++++ .../mobile/ElementCasePropertyTable.java | 12 ++++++ 2 files changed, 51 insertions(+) create mode 100644 designer_form/src/com/fr/design/designer/properties/mobile/BooleanRender.java diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/BooleanRender.java b/designer_form/src/com/fr/design/designer/properties/mobile/BooleanRender.java new file mode 100644 index 0000000000..04536f29c9 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/mobile/BooleanRender.java @@ -0,0 +1,39 @@ +package com.fr.design.designer.properties.mobile; + +import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; +import javax.swing.plaf.UIResource; +import javax.swing.table.TableCellRenderer; +import java.awt.*; + +public class BooleanRender extends JCheckBox implements TableCellRenderer, UIResource { + private static final Border noFocusBorder = new EmptyBorder(1, 0, 0, 0); + + public BooleanRender() { + super(); + setHorizontalAlignment(JLabel.LEFT); + setBorderPainted(true); + } + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + if (isSelected) { + setForeground(table.getSelectionForeground()); + super.setBackground(table.getSelectionBackground()); + } + else { + setForeground(table.getForeground()); + setBackground(table.getBackground()); + } + setSelected((value != null && ((Boolean)value).booleanValue())); + + if (hasFocus) { + setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); + } else { + setBorder(noFocusBorder); + } + + return this; + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 85c70f810c..cf8a7fc376 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -27,6 +27,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ private XCreator xCreator; private FormDesigner designer; + private boolean cascade = false; public ElementCasePropertyTable(XCreator xCreator) { this.xCreator = xCreator; @@ -35,9 +36,11 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { if (((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 && !((ElementCaseEditor ) xCreator.toData()).isHeightRestrict()) { ((ElementCaseEditor ) xCreator.toData()).setHeightRestrict(true); + cascade = true; return revealHeightLimit(); } CRPropertyDescriptor[] crp = ((ElementCaseEditor) xCreator.toData()).isHeightRestrict() ? revealHeightLimit() : getDefault(); + cascade = ((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 ? true : false; return crp; } @@ -53,6 +56,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class) .setI18NName(Inter.getLocText("Form-EC_heightrestrict")) + .setRendererClass(BooleanRender.class) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) }; List defaultList = new ArrayList<>(); @@ -103,6 +107,14 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } + @Override + public boolean isCellEditable(int row, int column) { + if (cascade && row ==3 ) { + return false; + } + return super.isCellEditable(row, column); + } + public void populate(FormDesigner designer) { this.designer = designer; initPropertyGroups(this.designer.getTarget());