Browse Source

REPORT-4850 [9.0插件]控件类型的插件,控件属性面板没有适配新版设计器

master
kerry 7 years ago
parent
commit
a2d18be9a2
  1. 2
      designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java
  2. 16
      designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java
  3. 33
      designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java
  4. 27
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

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

@ -108,7 +108,7 @@ public class CompositeComponentAdapter implements ComponentAdapter {
ArrayList<PropertyGroupPane> groups = new ArrayList<PropertyGroupPane>(); ArrayList<PropertyGroupPane> groups = new ArrayList<PropertyGroupPane>();
for (String groupName : groupNames) { for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName); ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(groupProperties.toArray(new CRPropertyDescriptor[0]), xCreator, groupName); PropertyGroupPane propertyGroupPane = new PropertyGroupPane(groupProperties.toArray(new CRPropertyDescriptor[0]), xCreator, groupName, designer);
groups.add(propertyGroupPane); groups.add(propertyGroupPane);
} }
return groups; return groups;

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

@ -2,10 +2,12 @@ package com.fr.design.designer.creator;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xtable.TableUtils; import com.fr.design.gui.xtable.TableUtils;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor; import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor;
import com.fr.design.mainframe.widget.editors.StringEditor; import com.fr.design.mainframe.widget.editors.StringEditor;
@ -27,10 +29,12 @@ public class CRPropertyDescriptorPane {
private XCreator xCreator; private XCreator xCreator;
private PropertyEditor propertyEditor; private PropertyEditor propertyEditor;
private boolean isPopulate = true; private boolean isPopulate = true;
private FormDesigner designer;
public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) { public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator, FormDesigner designer) {
this.crPropertyDescriptor = crPropertyDescriptor; this.crPropertyDescriptor = crPropertyDescriptor;
this.xCreator = xCreator; this.xCreator = xCreator;
this.designer = designer;
} }
public Component[] createTableLayoutComponent() { public Component[] createTableLayoutComponent() {
@ -49,7 +53,7 @@ public class CRPropertyDescriptorPane {
} }
private Component initEditorComponent(CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) { private Component initEditorComponent(final CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) {
Component component = null; Component component = null;
try { try {
// 如果已有的编辑器就生成对应的component // 如果已有的编辑器就生成对应的component
@ -87,6 +91,14 @@ public class CRPropertyDescriptorPane {
if (extendEditor.refreshInTime()) { if (extendEditor.refreshInTime()) {
WidgetPropertyPane.getInstance().refreshDockingView(); WidgetPropertyPane.getInstance().refreshDockingView();
} }
if (designer == null) {
return;
}
if ("widgetName".equals(crPropertyDescriptor.getName())) {
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
} else {
designer.fireTargetModified();
}
} }
}); });

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

@ -1,19 +1,16 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.FRContext;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FreeButton; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by kerry on 2017/9/7. * Created by kerry on 2017/9/7.
@ -23,6 +20,7 @@ public class PropertyGroupPane extends BasicPane {
private CRPropertyDescriptorPane[] crPropertyDescriptorPanes; private CRPropertyDescriptorPane[] crPropertyDescriptorPanes;
private XCreator xCreator; private XCreator xCreator;
private String groupName; private String groupName;
private FormDesigner designer;
public String getGroupName() { public String getGroupName() {
return groupName; return groupName;
@ -36,22 +34,25 @@ public class PropertyGroupPane extends BasicPane {
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) { public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) {
this.crPropertyDescriptors = crPropertyDescriptors; this.crPropertyDescriptors = crPropertyDescriptors;
this.xCreator = xCreator; this.xCreator = xCreator;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent(); initComponent();
} }
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator, String groupName) { public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator, String groupName, FormDesigner designer) {
this(crPropertyDescriptors, xCreator); this.designer = designer;
this.groupName = groupName; this.groupName = groupName;
this.crPropertyDescriptors = crPropertyDescriptors;
this.xCreator = xCreator;
initComponent();
} }
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
int count = crPropertyDescriptors.length; int count = crPropertyDescriptors.length;
crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count]; crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count];
Component[][] components = new Component[count][]; Component[][] components = new Component[count][];
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator); crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator, designer);
components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent(); components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent();
} }
@ -71,21 +72,5 @@ public class PropertyGroupPane extends BasicPane {
return "PropertyGroupPane"; return "PropertyGroupPane";
} }
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());
}
}
} }

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

@ -133,7 +133,18 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
jPanel.add(attriCardPane, BorderLayout.CENTER); jPanel.add(attriCardPane, BorderLayout.CENTER);
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
if(FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData())){ final boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData());
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
if(!isExtraWidget){
updateCreator();
}
updateWidgetBound();
}
};
if(isExtraWidget){
return; return;
} }
@ -143,13 +154,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
jPanel.add(uiExpandablePane, BorderLayout.NORTH); jPanel.add(uiExpandablePane, BorderLayout.NORTH);
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
updateCreator();
}
};
} }
private void initDefinePane() { private void initDefinePane() {
@ -212,12 +216,14 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return; return;
} }
fireValueChanged();
}
public void updateWidgetBound (){
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) { if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) {
widgetBoundPane.update(); widgetBoundPane.update();
} }
designer.refreshDesignerUI();
fireValueChanged();
} }
@ -233,7 +239,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
XCreator creator = getXCreatorDedicated(); XCreator creator = getXCreatorDedicated();
creator.firePropertyChange(); creator.firePropertyChange();
designer.fireTargetModified(); designer.fireTargetModified();
designer.refreshDesignerUI();
} }
public String getIconPath() { public String getIconPath() {

Loading…
Cancel
Save