Browse Source

代码可读性改进

master
Lee 9 years ago
parent
commit
d5e6b3fcdf
  1. 62
      designer_form/src/com/fr/design/designer/creator/XElementCase.java

62
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -23,6 +23,8 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
@ -61,13 +63,20 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor); return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor);
} }
protected CRPropertyDescriptor createNonListenerProperties(int i) throws IntrospectionException { protected List<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = { CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("widgetName", this.data.getClass()) new CRPropertyDescriptor("widgetName", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Widget_Name")), .setI18NName(Inter.getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").
setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
initStyle();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Layout_Padding")) .setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Layout_Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
@ -76,47 +85,32 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class) new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict")) .setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("heightPercent", this.data.getClass()).setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightpercent"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
return propertyTableEditor[i];
}
protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { List<CRPropertyDescriptor> defaultList = new ArrayList<>();
return new CRPropertyDescriptor[] {
createNonListenerProperties(0),
createNonListenerProperties(1).
setPropertyChangeListener(new PropertyChangeAdapter() {
@Override for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) {
public void propertyChange() { defaultList.add(propertyDescriptor);
initStyle();
} }
}), return defaultList;
createNonListenerProperties(2),
createNonListenerProperties(3),
createNonListenerProperties(4),
createNonListenerProperties(5)
};
} }
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException {
return new CRPropertyDescriptor[] { CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.data.getClass())
createNonListenerProperties(0), .setEditorClass(DoubleEditor.class)
createNonListenerProperties(1). .setI18NName(Inter.getLocText("Form-EC_heightpercent"))
setPropertyChangeListener(new PropertyChangeAdapter() { .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
@Override ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
public void propertyChange() { defaultList.add(heightLimitProperty);
initStyle();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
} }
}),
createNonListenerProperties(2), protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
createNonListenerProperties(3), ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
createNonListenerProperties(4) return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
};
} }

Loading…
Cancel
Save