Browse Source

Merge pull request #1314 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit 'fa3e1eedca1ca99c8f5469f9f4e65160e3998080':
  漏提
  代码质量
  REPORT-4947 表单组件隐藏功能j没有了,前台的可见check框消失
master
superman 7 years ago
parent
commit
85eda8549c
  1. 4
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 12
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  3. 7
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  4. 16
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  5. 4
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  6. 50
      designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java
  7. 27
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  8. 23
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  9. 21
      designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java
  10. 8
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  11. 8
      designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java

4
designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -145,10 +145,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight());
}
public boolean supportSetVisibleOrEnable(){
return false;
}
/**
* data属性改变触发其他操作
*

12
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -625,10 +625,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
/**
* 是否支持设置可见和可用
* 是否支持设置可见
* return boolean
*/
public boolean supportSetVisibleOrEnable(){
public boolean supportSetVisible(){
return true;
}
/**
* 是否支持设置可用
* return boolean
*/
public boolean supportSetEnable(){
return true;
}

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

@ -327,4 +327,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
initStyle();
}
/**
* 是否支持设置可用
* return boolean
*/
public boolean supportSetEnable(){
return false;
}
}

16
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -536,4 +536,20 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
initStyle();
}
/**
* 是否支持设置可见
* return boolean
*/
public boolean supportSetVisible(){
return false;
}
/**
* 是否支持设置可用
* return boolean
*/
public boolean supportSetEnable(){
return false;
}
}

4
designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java

@ -158,10 +158,6 @@ public class XWScaleLayout extends DedicateLayoutContainer {
}
public boolean supportSetVisibleOrEnable(){
return true;
}
/**
* data属性改变触发其他操作
*

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());
}
}

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

@ -1,34 +1,24 @@
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.*;
import java.awt.*;
import javax.swing.BorderFactory;
/**
* Created by ibm on 2017/7/26.
*/
public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane {
private UICheckBox enableCheckBox;
private UICheckBox visibleCheckBox;
public FormBasicWidgetPropertyPane (){
initOtherPane();
public FormBasicWidgetPropertyPane() {
super();
}
protected void initOtherPane() {
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
public UICheckBox createOtherConfig() {
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true);
enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
pane2.add(enableCheckBox);
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
pane2.add(visibleCheckBox);
this.add(pane2, BorderLayout.CENTER);
enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return enableCheckBox;
}
@Override
@ -39,13 +29,12 @@ public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
public void populate(Widget widget) {
super.populate(widget);
enableCheckBox.setSelected(widget.isEnabled());
visibleCheckBox.setSelected(widget.isVisible());
}
public void update(Widget widget) {
super.update(widget);
widget.setEnabled(enableCheckBox.isSelected());
widget.setVisible(visibleCheckBox.isSelected());
}
}

23
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,23 +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));
if (xCreator.supportSetVisibleOrEnable()) {
widgetPropertyPane = new FormBasicWidgetPropertyPane();
} else {
widgetPropertyPane = new FormBasicPropertyPane();
if(FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData())){
return;
}
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() {
@ -196,7 +195,9 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
innerWidget = crBoundsWidget.getWidget();
}
currentEditorDefinePane.populateBean(innerWidget);
if(widgetPropertyPane != null){
widgetPropertyPane.populate(innerWidget);
}
reinitAllListeners();
this.addAttributeChangeListener(listener);
}
@ -205,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/FormWidgetDefinePaneFactoryBase.java

@ -76,11 +76,11 @@ public class FormWidgetDefinePaneFactoryBase {
}
public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) {
Appearance dn = defineMap.get(widget.getClass());
if(dn == null){
if(isExtraXWidget(widget)){
WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer);
return new RN(widgetDefinePane, widgetDefinePane.title4PopupWindow());
}
Appearance dn = defineMap.get(widget.getClass());
DataModify<Widget> definePane = null;
try {
Constructor con = dn.getDefineClass().getConstructor(XCreator.class);
@ -92,6 +92,10 @@ public class FormWidgetDefinePaneFactoryBase {
return new RN(definePane, dn.getDisplayName());
}
public static boolean isExtraXWidget(Widget widget){
return defineMap.get(widget.getClass()) == null;
}
public static class RN {
private DataModify<Widget> definePane;
private String cardName;

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