Browse Source

代码质量

master
kerry 7 years ago
parent
commit
7b44b4629b
  1. 50
      designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java
  2. 39
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  3. 21
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  4. 21
      designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java
  5. 8
      designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java

50
designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java

@ -0,0 +1,50 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by kerry on 2017/9/30.
*/
public class BasicSetVisiblePropertyPane extends FormBasicPropertyPane {
private UICheckBox visibleCheckBox;
public BasicSetVisiblePropertyPane() {
initComponent();
}
protected void initComponent() {
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UICheckBox otherOtherConfig = createOtherConfig();
if(otherOtherConfig != null){
pane2.add(otherOtherConfig);
}
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
pane2.add(visibleCheckBox);
this.add(pane2, BorderLayout.CENTER);
}
public UICheckBox createOtherConfig(){
return null;
}
public void populate(Widget widget) {
super.populate(widget);
visibleCheckBox.setSelected(widget.isVisible());
}
public void update(Widget widget) {
super.update(widget);
widget.setVisible(visibleCheckBox.isSelected());
}
}

39
designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java

@ -1,42 +1,24 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by ibm on 2017/7/26.
*/
public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane {
private UICheckBox enableCheckBox;
private UICheckBox visibleCheckBox;
private XCreator xCreator;
public FormBasicWidgetPropertyPane (XCreator xCreator){
this.xCreator = xCreator;
initOtherPane();
public FormBasicWidgetPropertyPane() {
super();
}
protected void initOtherPane() {
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
if(xCreator.supportSetEnable()){
public UICheckBox createOtherConfig() {
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true);
enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
pane2.add(enableCheckBox);
}
if(xCreator.supportSetVisible()){
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
pane2.add(visibleCheckBox);
}
this.add(pane2, BorderLayout.CENTER);
return enableCheckBox;
}
@Override
@ -46,22 +28,13 @@ public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
public void populate(Widget widget) {
super.populate(widget);
if(xCreator.supportSetEnable()){
enableCheckBox.setSelected(widget.isEnabled());
}
if(xCreator.supportSetVisible()){
visibleCheckBox.setSelected(widget.isVisible());
}
}
public void update(Widget widget) {
super.update(widget);
if(xCreator.supportSetEnable()){
widget.setEnabled(enableCheckBox.isSelected());
}
if(xCreator.supportSetVisible()){
widget.setVisible(visibleCheckBox.isSelected());
}
}
}

21
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -109,6 +109,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
XCreator innerCreator = getXCreatorDedicated();
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
BasicScrollPane basicScrollPane = new BasicScrollPane() {
@Override
@ -127,21 +129,20 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
}
};
this.add(basicScrollPane, BorderLayout.CENTER);
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(attriCardPane, BorderLayout.CENTER);
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
XCreator innerCreator = getXCreatorDedicated();
if(FormWidgetDefinePaneFactoryBase.isWidget(innerCreator.toData())){
return;
}
widgetPropertyPane = new FormBasicWidgetPropertyPane(innerCreator);
widgetPropertyPane = WidgetBasicPropertyPaneFactory.createBasicPropertyPane(innerCreator);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 20, widgetPropertyPane);
jPanel.add(uiExpandablePane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jPanel.add(attriCardPane, BorderLayout.CENTER);
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
@ -194,7 +195,9 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
innerWidget = crBoundsWidget.getWidget();
}
currentEditorDefinePane.populateBean(innerWidget);
if(widgetPropertyPane != null){
widgetPropertyPane.populate(innerWidget);
}
reinitAllListeners();
this.addAttributeChangeListener(listener);
}
@ -203,7 +206,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateCreator() {
currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean();
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name")) && widgetPropertyPane != null) {
widgetPropertyPane.update(widget);
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);

21
designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java

@ -0,0 +1,21 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.designer.creator.XCreator;
/**
* Created by kerry on 2017/9/30.
*/
public class WidgetBasicPropertyPaneFactory {
public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator){
if(xCreator.supportSetVisible() && xCreator.supportSetEnable()){
return new FormBasicWidgetPropertyPane();
}
if(xCreator.supportSetVisible()){
return new BasicSetVisiblePropertyPane();
}else{
return new FormBasicPropertyPane();
}
}
}

8
designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java

@ -8,7 +8,6 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.JPanel;
@ -31,13 +30,6 @@ public class WidgetDefinePane extends AbstractDataModify<Widget> {
public void initComponent(XCreator source, FormDesigner designer) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, source);
groupPanes = adapter.getXCreatorPropertyPane();
//todo 留着做兼容,以后删掉
for (int i = 0; i < groupPanes.size(); i++) {
if (ComparatorUtils.equals(groupPanes.get(i).getGroupName(), "Form-Basic_Properties")) {
groupPanes.remove(i);
}
}
this.add(createCenterPane(START_INDEX), BorderLayout.CENTER);
}

Loading…
Cancel
Save