Browse Source

灰化已实现~效果还不错哈~

master
Lee 9 years ago
parent
commit
fe3acd8736
  1. 39
      designer_form/src/com/fr/design/designer/properties/mobile/BooleanRender.java
  2. 12
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

39
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;
}
}

12
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<CRPropertyDescriptor> 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());

Loading…
Cancel
Save