Browse Source

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

* commit 'daea83652112f1829d4791fa2e74a1ae9fcd61f2':
  删除无效代码
  REPORT-4850 [9.0插件]控件类型的插件,控件属性面板没有适配新版设计器
master
superman 7 years ago
parent
commit
5cc730e65c
  1. 38
      designer_base/src/com/fr/design/designer/creator/CRPropertyDescriptor.java
  2. 11
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  3. 7
      designer_form/src/com/fr/design/designer/beans/ComponentAdapter.java
  4. 45
      designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java
  5. 84
      designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java
  6. 54
      designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java
  7. 2
      designer_form/src/com/fr/design/designer/creator/XWidgetCreator.java
  8. 6
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  9. 10
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  10. 12
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  11. 72
      designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java

38
designer_base/src/com/fr/design/designer/creator/CRPropertyDescriptor.java

@ -15,14 +15,15 @@ import java.beans.PropertyDescriptor;
*/
public final class CRPropertyDescriptor extends PropertyDescriptor {
public static final String RENDERER = "renderer";
private PropertyChangeAdapter l;
private boolean isSubProperty = false;
private PropertyChangeAdapter l;
public CRPropertyDescriptor(String name, Class<?> beanClass) throws IntrospectionException {
super(name, beanClass);
}
public CRPropertyDescriptor(String name, Class<?> beanClass, String readMethod, String writeMethod) throws IntrospectionException{
public CRPropertyDescriptor(String name, Class<?> beanClass, String readMethod, String writeMethod) throws IntrospectionException {
super(name, beanClass, readMethod, writeMethod);
}
@ -33,17 +34,17 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
}
return this;
}
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public void firePropertyChanged() {
if (l != null) {
l.propertyChange();
}
}
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public void firePropertyChanged() {
if (l != null) {
l.propertyChange();
}
}
public CRPropertyDescriptor setEditorClass(Class<?> clazz) {
this.setPropertyEditorClass(clazz);
@ -59,4 +60,13 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
this.setDisplayName(displayName);
return this;
}
public CRPropertyDescriptor setSubLevel(boolean isSubProperty) {
this.isSubProperty = isSubProperty;
return this;
}
public boolean isSubLevel() {
return isSubProperty;
}
}

11
designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -12,6 +12,7 @@ import java.util.ArrayList;
import javax.swing.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.event.ChangeEvent;
@ -63,7 +64,15 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
}
protected ITextComponent createTextField() {
return new TextField();
return new TextField() {
public void registerChangeListener(UIObserverListener listener) {
return;
}
public boolean shouldResponseChangeListener() {
return false;
}
};
}
private void initComponents() {

7
designer_form/src/com/fr/design/designer/beans/ComponentAdapter.java

@ -9,6 +9,7 @@ import javax.swing.JPopupMenu;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.creator.PropertyGroupPane;
/**
* 组件适配器接口
@ -40,6 +41,12 @@ public interface ComponentAdapter {
*/
ArrayList<GroupModel> getXCreatorPropertyModel();
/**
* 为当前组件创建描述各属性pane, 分组返回
* @return ArrayList<PropertyGroupPane>
*/
ArrayList<PropertyGroupPane> getXCreatorPropertyPane();
/**
* 提供双击设计器的编辑器
* @param bean 鼠标双击的被设计组件

45
designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java

@ -7,6 +7,7 @@ import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.actions.ChangeNameAction;
import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.PropertyGroupPane;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.form.util.XCreatorConstants;
@ -90,6 +91,30 @@ public class CompositeComponentAdapter implements ComponentAdapter {
private ArrayList<PropertyGroupModel> createPropertyGroupModels(CRPropertyDescriptor[] properties) {
HashMap<String, ArrayList<CRPropertyDescriptor>> maps = new HashMap<String, ArrayList<CRPropertyDescriptor>>();
ArrayList<String> groupNames = getGroupNames(properties, maps);
ArrayList<PropertyGroupModel> groups = new ArrayList<PropertyGroupModel>();
for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
PropertyGroupModel groupModel = new PropertyGroupModel(groupName, xCreator, groupProperties
.toArray(new CRPropertyDescriptor[0]), designer);
groups.add(groupModel);
}
return groups;
}
private ArrayList<PropertyGroupPane> createPropertyGroupPanes(CRPropertyDescriptor[] properties) {
HashMap<String, ArrayList<CRPropertyDescriptor>> maps = new HashMap<String, ArrayList<CRPropertyDescriptor>>();
ArrayList<String> groupNames = getGroupNames(properties, maps);
ArrayList<PropertyGroupPane> groups = new ArrayList<PropertyGroupPane>();
for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(groupProperties.toArray(new CRPropertyDescriptor[0]), xCreator, groupName);
groups.add(propertyGroupPane);
}
return groups;
}
private ArrayList<String> getGroupNames(CRPropertyDescriptor[] properties, HashMap<String, ArrayList<CRPropertyDescriptor>> maps ){
ArrayList<String> groupNames = new ArrayList<String>();
for (CRPropertyDescriptor property : properties) {
String groupName = (String) property.getValue(XCreatorConstants.PROPERTY_CATEGORY);
@ -108,14 +133,7 @@ public class CompositeComponentAdapter implements ComponentAdapter {
groupProperties.add(property);
}
adjustGroupNamesPosition(groupNames);
ArrayList<PropertyGroupModel> groups = new ArrayList<PropertyGroupModel>();
for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
PropertyGroupModel groupModel = new PropertyGroupModel(groupName, xCreator, groupProperties
.toArray(new CRPropertyDescriptor[0]), designer);
groups.add(groupModel);
}
return groups;
return groupNames;
}
public void adjustGroupNamesPosition(ArrayList<String> groupNames){
@ -138,6 +156,17 @@ public class CompositeComponentAdapter implements ComponentAdapter {
return groupModels;
}
@Override
public ArrayList<PropertyGroupPane> getXCreatorPropertyPane() {
ArrayList<PropertyGroupPane> groupModels = new ArrayList<PropertyGroupPane>();
CRPropertyDescriptor[] properties;
properties = getCalculateCreatorProperties();
ArrayList<PropertyGroupPane> groups = createPropertyGroupPanes(properties);
// Collections.sort(groups);
groupModels.addAll(groups);
return groupModels;
}
/**
* 自适应布局中放置文本框等用的scaleLayout和报表块图表块支持的标题控件用的titleLayout时
* 控件树处只显示父容器但是控件属性还是为自身的

84
designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java

@ -1,13 +1,19 @@
package com.fr.design.designer.creator;
import com.fr.base.FRContext;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xtable.TableUtils;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor;
import com.fr.design.mainframe.widget.editors.StringEditor;
import com.fr.form.ui.Widget;
import java.awt.*;
import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
@ -20,6 +26,7 @@ public class CRPropertyDescriptorPane {
private CRPropertyDescriptor crPropertyDescriptor;
private XCreator xCreator;
private PropertyEditor propertyEditor;
private boolean isPopulate = true;
public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) {
this.crPropertyDescriptor = crPropertyDescriptor;
@ -27,7 +34,19 @@ public class CRPropertyDescriptorPane {
}
public Component[] createTableLayoutComponent() {
return new Component[]{new UILabel(crPropertyDescriptor.getDisplayName()), initEditorComponent(crPropertyDescriptor, xCreator)};
Component component = initEditorComponent(crPropertyDescriptor, xCreator);
if (component instanceof UICheckBox) {
((UICheckBox) component).setText(crPropertyDescriptor.getDisplayName());
return new Component[]{component, null};
}
if (crPropertyDescriptor.isSubLevel()) {
JPanel subPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(crPropertyDescriptor.getDisplayName()), component}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
subPanel.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
return new Component[]{subPanel, null};
}
return new Component[]{new UILabel(crPropertyDescriptor.getDisplayName()), component};
}
private Component initEditorComponent(CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) {
@ -35,22 +54,40 @@ public class CRPropertyDescriptorPane {
try {
// 如果已有的编辑器就生成对应的component
Class<?> editorClass = crPropertyDescriptor.getPropertyEditorClass();
ExtendedPropertyEditor editor = null;
if (editorClass != null) {
propertyEditor = initExtendEditor(crPropertyDescriptor, xCreator);
component = propertyEditor.getCustomEditor();
editor = (ExtendedPropertyEditor) crPropertyDescriptor.createPropertyEditor(xCreator.toData());
if (editor == null) {
Class propType = crPropertyDescriptor.getPropertyType();
editor = TableUtils.getPropertyEditorClass(propType).newInstance();
}
} else {
Class propType = crPropertyDescriptor.getPropertyType();
Class<? extends PropertyEditor> defaultEditorClass = TableUtils.getPropertyEditorClass(propType);
Class<? extends ExtendedPropertyEditor> defaultEditorClass = TableUtils.getPropertyEditorClass(propType);
if (defaultEditorClass == null) {
defaultEditorClass = StringEditor.class;
}
propertyEditor = defaultEditorClass.newInstance();
component = propertyEditor.getCustomEditor();
editor = defaultEditorClass.newInstance();
}
propertyEditor.addPropertyChangeListener(new PropertyChangeListener() {
propertyEditor = editor;
component = propertyEditor.getCustomEditor();
final ExtendedPropertyEditor extendEditor = editor;
extendEditor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (isPopulate) {
return;
}
if (ComparatorUtils.equals(extendEditor.getValue(), getValue(xCreator.toData()))) {
return;
}
update(xCreator.toData());
if (extendEditor.refreshInTime()) {
WidgetPropertyPane.getInstance().refreshDockingView();
}
}
});
} catch (Exception e) {
@ -58,32 +95,37 @@ public class CRPropertyDescriptorPane {
}
return component;
}
private PropertyEditor initExtendEditor(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) throws Exception {
ExtendedPropertyEditor editor = (ExtendedPropertyEditor) crPropertyDescriptor.createPropertyEditor(xCreator.toData());
if (editor == null) {
Class propType = crPropertyDescriptor.getPropertyType();
editor = TableUtils.getPropertyEditorClass(propType).newInstance();
public void populate(Widget widget) {
try {
isPopulate = true;
Object value = getValue(widget);
propertyEditor.setValue(value);
isPopulate = false;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return editor;
}
public void populate(Widget widget) {
public Object getValue(Widget widget) {
try {
Method m = crPropertyDescriptor.getReadMethod();
Object value = m.invoke(widget);
propertyEditor.setValue(value);
return value;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return null;
}
}
public void update(Widget widget) {
try {
Object value = propertyEditor.getValue();
Method m = crPropertyDescriptor.getWriteMethod();
m.invoke(widget, propertyEditor.getValue());
m.invoke(widget, value);
crPropertyDescriptor.firePropertyChanged();
} catch (Exception e) {
}

54
designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java

@ -8,8 +8,12 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Widget;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* Created by kerry on 2017/9/7.
@ -18,6 +22,16 @@ public class PropertyGroupPane extends BasicPane {
private CRPropertyDescriptor[] crPropertyDescriptors;
private CRPropertyDescriptorPane[] crPropertyDescriptorPanes;
private XCreator xCreator;
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) {
this.crPropertyDescriptors = crPropertyDescriptors;
@ -26,6 +40,12 @@ public class PropertyGroupPane extends BasicPane {
initComponent();
}
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator, String groupName) {
this(crPropertyDescriptors, xCreator);
this.groupName = groupName;
}
public void initComponent() {
int count = crPropertyDescriptors.length;
crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count];
@ -40,8 +60,8 @@ public class PropertyGroupPane extends BasicPane {
this.add(panel, BorderLayout.CENTER);
}
public void populate(Widget widget){
for(int i = 0; i< crPropertyDescriptorPanes.length; i++){
public void populate(Widget widget) {
for (int i = 0; i < crPropertyDescriptorPanes.length; i++) {
crPropertyDescriptorPanes[i].populate(widget);
}
}
@ -52,19 +72,19 @@ public class PropertyGroupPane extends BasicPane {
}
public static void main(String[] args) {
try{
XCreator xCreator = new XButton(new FreeButton(),new Dimension(100, 100));
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(xCreator.supportedDescriptor(), xCreator);
JFrame jf = new JFrame("jFrame");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(propertyGroupPane, BorderLayout.CENTER);
jf.setSize(439, 400);
jf.setVisible(true);
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
try {
XCreator xCreator = new XButton(new FreeButton(), new Dimension(100, 100));
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(xCreator.supportedDescriptor(), xCreator);
JFrame jf = new JFrame("jFrame");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(propertyGroupPane, BorderLayout.CENTER);
jf.setSize(439, 400);
jf.setVisible(true);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}

2
designer_form/src/com/fr/design/designer/creator/XWidgetCreator.java

@ -57,7 +57,7 @@ public abstract class XWidgetCreator extends XCreator {
}),
new CRPropertyDescriptor("labelName", this.data.getClass(), "getLabelName", "setLabelName")
.setI18NName(Inter.getLocText("FR-Designer_Label_Name"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced")
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
}

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

@ -156,7 +156,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private void initDefinePane() {
currentEditorDefinePane = null;
XCreator creator = getXCreatorDedicated();
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() {
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() {
@Override
public void did(DataCreatorUI ui, String cardName) {
//todo
@ -170,7 +170,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
currentEditorDefinePane = definePane;
}
private XCreator getXCreatorDedicated(){
private XCreator getXCreatorDedicated() {
boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class);
return dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator;
}
@ -205,7 +205,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.update(widget);
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);

10
designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -3,6 +3,8 @@ package com.fr.design.widget;
import com.fr.base.FRContext;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.ui.designer.WidgetDefinePane;
import com.fr.design.parameter.RootDesignDefinePane;
import com.fr.design.widget.ui.designer.*;
import com.fr.design.widget.ui.designer.layout.*;
@ -11,7 +13,6 @@ import com.fr.form.ui.*;
import com.fr.form.ui.container.*;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
@ -66,8 +67,6 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(WCardLayout.class, new Appearance(WCardLayoutDefinePane.class, "wCardLayout"));
defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label"));
defineMap.put(WTabFitLayout.class, new Appearance(WTabFitLayoutDefinePane.class, "wTabFitLayout"));
//todo 添加扩展控件接口
// defineMap.putAll(getOtherWidgetOptionMap());
}
@ -76,10 +75,11 @@ public class FormWidgetDefinePaneFactoryBase {
}
public static RN createWidgetDefinePane(XCreator creator, Widget widget, Operator operator) {
public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) {
Appearance dn = defineMap.get(widget.getClass());
if(dn == null){
dn = new Appearance(DefaultWidgetDefinePane.class, "default");
WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer);
return new RN(widgetDefinePane, widgetDefinePane.title4PopupWindow());
}
DataModify<Widget> definePane = null;
try {

12
designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java

@ -3,6 +3,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.DataModify;
import javax.swing.JComponent;
@ -13,18 +14,29 @@ import javax.swing.JComponent;
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected XCreator creator;
protected FormDesigner designer;
protected String globalName;
public AbstractDataModify(XCreator xCreator){
this.creator = xCreator;
}
public AbstractDataModify(XCreator xCreator, FormDesigner designer){
this.creator = xCreator;
this.designer = designer;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
@Override
public String title4PopupWindow() {
return creator.createDefaultName();
}
@Override
public JComponent toSwingComponent() {
return this;

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

@ -0,0 +1,72 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.creator.PropertyGroupPane;
import com.fr.design.designer.creator.XCreator;
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;
import java.awt.BorderLayout;
import java.util.ArrayList;
/**
* Created by kerry on 2017/9/27.
*/
public class WidgetDefinePane extends AbstractDataModify<Widget> {
private ArrayList<PropertyGroupPane> groupPanes;
private static final int START_INDEX = 1;
public WidgetDefinePane(XCreator source, FormDesigner designer) {
super(source, designer);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent(source, designer);
}
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);
}
private JPanel createCenterPane(int index) {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
if (index != groupPanes.size()) {
jPanel.add(createExpandPane(groupPanes.get(index - 1)), BorderLayout.NORTH);
jPanel.add(createCenterPane(index + 1), BorderLayout.CENTER);
} else {
jPanel.add(createExpandPane(groupPanes.get(index - 1)), BorderLayout.CENTER);
}
return jPanel;
}
public JPanel createExpandPane(PropertyGroupPane propertyGroupPane) {
JPanel jPanel = new UIExpandablePane(Inter.getLocText(propertyGroupPane.getGroupName()), 280, 24, propertyGroupPane);
return jPanel;
}
public void populateBean(Widget ob) {
for (int i = 0; i < groupPanes.size(); i++) {
groupPanes.get(i).populate(ob);
}
}
public Widget updateBean() {
return creator.toData();
}
}
Loading…
Cancel
Save