From d1358b466943f530f0353f23d034e48c59d7296e Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 7 Aug 2018 09:42:40 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10419=20=E9=83=A8=E5=88=86=E5=87=86?= =?UTF-8?q?=E5=A4=87=E5=B7=A5=E4=BD=9C=EF=BC=8C=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRGridLayoutAdapter.java | 48 ---- .../FRHorizontalSplitLayoutAdapter.java | 26 -- .../layout/FRVerticalSplitLayoutAdapter.java | 52 ---- .../design/designer/creator/FormCardPane.java | 244 ------------------ .../creator/XAbstractSplitLayout.java | 49 ---- .../designer/creator/XCreatorUtils.java | 14 - .../design/designer/creator/XDataTable.java | 94 ------- .../design/designer/creator/XListEditor.java | 89 ------- .../design/designer/creator/XTableEditor.java | 62 ----- .../design/designer/creator/XTableTree.java | 57 ---- .../design/designer/creator/XWGridLayout.java | 82 ------ .../creator/XWHorizontalSplitLayout.java | 40 --- .../creator/XWVerticalSplitLayout.java | 40 --- .../FRGridLayoutPropertiesGroupModel.java | 117 --------- 14 files changed, 1014 deletions(-) delete mode 100644 designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRGridLayoutAdapter.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRHorizontalSplitLayoutAdapter.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRVerticalSplitLayoutAdapter.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/FormCardPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XAbstractSplitLayout.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XDataTable.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XListEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XTableEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XTableTree.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XWGridLayout.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XWHorizontalSplitLayout.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XWVerticalSplitLayout.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/FRGridLayoutPropertiesGroupModel.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRGridLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRGridLayoutAdapter.java deleted file mode 100644 index 3bb4efe53a..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRGridLayoutAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.fr.design.designer.beans.adapters.layout; - - -import java.awt.Point; - -import com.fr.design.beans.GroupModel; -import com.fr.design.designer.beans.HoverPainter; -import com.fr.design.designer.beans.painters.FRGridLayoutPainter; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.properties.FRGridLayoutPropertiesGroupModel; -import com.fr.design.form.layout.FRGridLayout; -import com.fr.design.utils.gui.LayoutUtils; - -public class FRGridLayoutAdapter extends AbstractLayoutAdapter { - - public FRGridLayoutAdapter(XLayoutContainer container) { - super(container); - } - - @Override - public boolean accept(XCreator creator, int x, int y) { - return true; - } - - @Override - protected void addComp(XCreator creator, int x, int y) { - container.add(creator, getLayoutGrid(creator, x, y)); - LayoutUtils.layoutRootContainer(container); - } - - @Override - public HoverPainter getPainter() { - return new FRGridLayoutPainter(container); - } - - @Override - public GroupModel getLayoutProperties() { - return new FRGridLayoutPropertiesGroupModel(container); - } - - private Point getLayoutGrid(XCreator creator, int x, int y) { - FRGridLayout layout = (FRGridLayout)container.getLayout(); - int w = container.getWidth() / layout.getColumns(); - int h = container.getHeight() / layout.getRows(); - return new Point(x / w, y / h); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRHorizontalSplitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRHorizontalSplitLayoutAdapter.java deleted file mode 100644 index 36b67d7f75..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRHorizontalSplitLayoutAdapter.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.designer.beans.adapters.layout; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWHorizontalSplitLayout; -import com.fr.design.form.layout.FRSplitLayout; -import com.fr.form.ui.container.WHorizontalSplitLayout; - -public class FRHorizontalSplitLayoutAdapter extends FRVerticalSplitLayoutAdapter { - - public FRHorizontalSplitLayoutAdapter(XLayoutContainer container) { - super(container); - } - - @Override - protected String getPlacement(XCreator creator, int x, int y) { - int width = container.getWidth(); - WHorizontalSplitLayout wLayout = ((XWHorizontalSplitLayout) container).toData(); - int asideSize = (int) (width * wLayout.getRatio()); - if (x > asideSize) { - return FRSplitLayout.CENTER; - } else { - return FRSplitLayout.ASIDE; - } - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRVerticalSplitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRVerticalSplitLayoutAdapter.java deleted file mode 100644 index aaeb8b01c1..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRVerticalSplitLayoutAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fr.design.designer.beans.adapters.layout; - -import java.awt.Component; - -import com.fr.design.beans.GroupModel; -import com.fr.design.designer.creator.XAbstractSplitLayout; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWVerticalSplitLayout; -import com.fr.design.designer.properties.HorizontalSplitProperties; -import com.fr.design.form.layout.FRSplitLayout; -import com.fr.form.ui.container.WVerticalSplitLayout; -import com.fr.design.utils.gui.LayoutUtils; - -public class FRVerticalSplitLayoutAdapter extends AbstractLayoutAdapter { - - public FRVerticalSplitLayoutAdapter(XLayoutContainer container) { - super(container); - } - - @Override - public boolean accept(XCreator creator, int x, int y) { - String place = getPlacement(creator, x, y); - FRSplitLayout layout = (FRSplitLayout) container.getLayout(); - Component comp = layout.getLayoutComponent(place); - return comp == null; - } - - @Override - protected void addComp(XCreator creator, int x, int y) { - String placement = getPlacement(creator, x, y); - container.add(creator, placement); - LayoutUtils.layoutRootContainer(container); - } - - @Override - public GroupModel getLayoutProperties() { - XAbstractSplitLayout xbl = (XAbstractSplitLayout) container; - return new HorizontalSplitProperties(xbl.toData()); - } - - protected String getPlacement(XCreator creator, int x, int y) { - int height = container.getHeight(); - WVerticalSplitLayout wLayout = ((XWVerticalSplitLayout) container).toData(); - int asideSize = (int) (height * wLayout.getRatio()); - if (y > asideSize) { - return FRSplitLayout.CENTER; - } else { - return FRSplitLayout.ASIDE; - } - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/FormCardPane.java b/designer-form/src/main/java/com/fr/design/designer/creator/FormCardPane.java deleted file mode 100644 index ce621beec0..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/FormCardPane.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Insets; -import java.awt.LayoutManager; -import java.awt.event.ContainerListener; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.Icon; -import javax.swing.JComponent; -import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - -public class FormCardPane extends JComponent implements SwingConstants { - - private boolean showTab; - private int tabPlace; - private JPanel tabPane; - private JPanel cardPane; - private CardLayout layout; - private java.util.List tabComponent = new java.util.ArrayList(); - private int showIndex; - - public FormCardPane(boolean showTab, int tabPlace) { - this.showTab = showTab; - this.tabPlace = tabPlace; - initTabComponent(); - initCardComponent(); - setLayout(new FormCardLayout()); - this.add(tabPane); - this.add(cardPane); - } - - public FormCardPane(ContainerListener containerListener) { - this(true, TOP); - cardPane.addContainerListener(containerListener); - } - - private void initTabComponent() { - tabPane = new JPanel(); - tabPane.setOpaque(true); - tabPane.setBorder(BorderFactory.createLineBorder(Color.pink)); - tabPane.setBackground(Color.WHITE); - } - - private void initCardComponent() { - cardPane = new JPanel(); - cardPane.setBorder(BorderFactory.createLineBorder(Color.orange)); - layout = new CardLayout(); - cardPane.setLayout(layout); - } - - public void setSelectedIndex(int showIndex) { - this.setSelectedComponent(this.getComponentAt(showIndex)); - } - - public int getTabCount() { - return cardPane.getComponentCount(); - } - - @Override - public void add(Component comp, Object constraints) { - this.add(comp, constraints, -1); - } - - @Override - public void removeAll() { - cardPane.removeAll(); - tabComponent.clear(); - } - - private void reSetTabComponent() { - if (tabPlace == TOP || tabPlace == BOTTOM) { - int totalWidth = 0; - for (Component comp : tabComponent) { - totalWidth += comp.getWidth(); - } - showTabComponent(totalWidth > tabPane.getWidth()); - - } else if (tabPlace == LEFT || tabPlace == RIGHT) { - int totalHeight = 0; - for (Component comp : tabComponent) { - totalHeight += comp.getHeight(); - } - showTabComponent(totalHeight > tabPane.getHeight()); - } - } - - private void showTabComponent(boolean showButton) { - tabPane.removeAll(); - if (this.showIndex < 0 || this.showIndex >= tabComponent.size()) { - this.showIndex = 0; - } - if (tabPlace == TOP || tabPlace == BOTTOM) { - tabPane.setLayout(new FlowLayout(FlowLayout.LEFT)); - - } else if (tabPlace == LEFT || tabPlace == RIGHT) { - tabPane.setLayout(new BoxLayout(tabPane, BoxLayout.Y_AXIS)); - } else { - return; - } - - for (Component comp : tabComponent) { - tabPane.add(comp); - } - tabPane.repaint(); - } - - @Override - public void add(Component comp, Object constraints, int index) { - if (!(comp instanceof XCreator)) { - return; - } - JComponent tabComp = new JPanel(); - if (constraints instanceof String) { - tabComp = new UILabel((String) constraints); - - } else if (constraints instanceof Icon) { - tabComp = new UILabel((Icon) constraints); - } else { - return; - } - tabComp.setOpaque(true); - tabComp.setBorder(BorderFactory.createLineBorder(Color.red)); - cardPane.add(comp, ((((XCreator) comp).toData())).getWidgetName(), index); - if (index == -1) { - tabComponent.add(tabComp); - } else { - tabComponent.add(index, tabComp); - } - - reSetTabComponent(); - } - - public void setTabPlacement(int tabPlace) { - this.tabPlace = tabPlace; - } - - public Component getComponentAt(int i) { - return cardPane.getComponent(i); - } - - public void setSelectedComponent(Component child) { - if (child instanceof XCreator) { - int order = cardPane.getComponentZOrder(child); - if (order == -1 || order == showIndex) { - return; - } - tabComponent.get(showIndex).setBackground(null); - this.showIndex = order; - tabComponent.get(showIndex).setBackground(Color.orange); - layout.show(cardPane, ((((XCreator) child).toData())).getWidgetName()); - } - } - - class FormCardLayout implements LayoutManager { - - @Override - public void addLayoutComponent(String name, Component comp) { - // TODO Auto-generated method stub - - } - - @Override - public void layoutContainer(Container parent) { - Insets inset = parent.getInsets(); - int parentWidth = parent.getWidth() - inset.left - inset.right; - int parentHeight = parent.getHeight() - inset.top - inset.bottom; - if (showTab) { - if (tabPlace == TOP || tabPlace == BOTTOM) { - int height = getTabPaneHeight(); - tabPane.setSize(parentWidth, height); - cardPane.setSize(parentWidth, parentHeight - height); - if (tabPlace == TOP) { - tabPane.setLocation(inset.left, inset.top); - cardPane.setLocation(inset.left, inset.top + height); - } else { - cardPane.setLocation(inset.left, inset.top); - tabPane.setLocation(inset.left, inset.top + parentHeight - height); - } - } else if (tabPlace == LEFT || tabPlace == RIGHT) { - int width = getTabPaneWidth(); - tabPane.setSize(width, parentHeight); - cardPane.setSize(parentWidth - width, parentHeight); - if (tabPlace == LEFT) { - tabPane.setLocation(inset.left, inset.top); - cardPane.setLocation(inset.left + width, inset.top); - } else { - cardPane.setLocation(inset.left, inset.top); - tabPane.setLocation(inset.left + parentWidth - width, inset.top); - } - } - - } else { - tabPane.setVisible(false); - cardPane.setSize(parent.getWidth(), parent.getHeight()); - cardPane.setLocation(0, 0); - } - } - - @Override - public Dimension minimumLayoutSize(Container parent) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Dimension preferredLayoutSize(Container parent) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void removeLayoutComponent(Component comp) { - // TODO Auto-generated method stub - - } - - } - - public int getTabPaneHeight() { - return 22; - } - - public int getTabPaneWidth() { - return 40; - } - - public void addCreatorListener(ContainerListener containerListener) { - - } - - public void setShowTab(boolean showTab) { - this.showTab = showTab; - } - -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XAbstractSplitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XAbstractSplitLayout.java deleted file mode 100644 index f460c9415d..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XAbstractSplitLayout.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.awt.event.ContainerEvent; - -import com.fr.design.form.layout.FRSplitLayout; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WSplitLayout; - -public abstract class XAbstractSplitLayout extends XLayoutContainer { - - public XAbstractSplitLayout(WSplitLayout widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public WSplitLayout toData() { - return (WSplitLayout) data; - } - - @Override - public void convert() { - isRefreshing = true; - WSplitLayout wb = this.toData(); - this.removeAll(); - String[] arrs = { WSplitLayout.CENTER, WSplitLayout.ASIDE }; - for (int i = 0; i < arrs.length; i++) { - Widget wgt = wb.getLayoutWidget(arrs[i]); - if (wgt != null) { - XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(wgt, calculatePreferredSize(wgt)); - this.add(comp, arrs[i]); - } - } - isRefreshing = false; - } - - @Override - public void componentAdded(ContainerEvent e) { - if (isRefreshing) { - return; - } - XWidgetCreator creator = (XWidgetCreator) e.getChild(); - FRSplitLayout b = (FRSplitLayout) getLayout(); - Object constraints = b.getConstraints(creator); - WSplitLayout wb = this.toData(); - Widget w = creator.toData(); - wb.addWidget(w, constraints); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index dc7e487739..748c377836 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -23,7 +23,6 @@ import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBoxGroup; import com.fr.form.ui.ComboBox; import com.fr.form.ui.ComboCheckBox; -import com.fr.form.ui.DataTable; import com.fr.form.ui.DateEditor; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.ElementCaseEditor; @@ -32,15 +31,12 @@ import com.fr.form.ui.FileEditor; import com.fr.form.ui.FreeButton; import com.fr.form.ui.IframeEditor; import com.fr.form.ui.Label; -import com.fr.form.ui.ListEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; -import com.fr.form.ui.Table; -import com.fr.form.ui.TableTree; import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; import com.fr.form.ui.TreeComboBoxEditor; @@ -51,14 +47,11 @@ import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; -import com.fr.form.ui.container.WGridLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; -import com.fr.form.ui.container.WHorizontalSplitLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WVerticalBoxLayout; -import com.fr.form.ui.container.WVerticalSplitLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; @@ -128,9 +121,6 @@ public class XCreatorUtils { xLayoutMap.put(WBorderLayout.class, XWBorderLayout.class); xLayoutMap.put(WCardLayout.class, XWCardLayout.class); xLayoutMap.put(WVerticalBoxLayout.class, XWVerticalBoxLayout.class); - xLayoutMap.put(WHorizontalSplitLayout.class, XWHorizontalSplitLayout.class); - xLayoutMap.put(WVerticalSplitLayout.class, XWVerticalSplitLayout.class); - xLayoutMap.put(WGridLayout.class, XWGridLayout.class); xLayoutMap.put(WFitLayout.class, XWFitLayout.class); xLayoutMap.put(WScaleLayout.class, XWScaleLayout.class); @@ -153,13 +143,10 @@ public class XCreatorUtils { objectMap.put(ComboCheckBox.class, XComboCheckBox.class); objectMap.put(DateEditor.class, XDateEditor.class); objectMap.put(FileEditor.class, XFileUploader.class); - objectMap.put(Table.class, XTableEditor.class); objectMap.put(IframeEditor.class, XIframeEditor.class); objectMap.put(FormSubmitButton.class, XButton.class); objectMap.put(Button.class, XButton.class); objectMap.put(Label.class, XLabel.class); - objectMap.put(ListEditor.class, XListEditor.class); - objectMap.put(TableTree.class, XTableTree.class); objectMap.put(MultiFileEditor.class, XMultiFileUploader.class); objectMap.put(Password.class, XPassword.class); objectMap.put(Radio.class, XRadio.class); @@ -167,7 +154,6 @@ public class XCreatorUtils { objectMap.put(TreeEditor.class, XTreeEditor.class); objectMap.put(TreeComboBoxEditor.class, XTreeComboBoxEditor.class); objectMap.put(EditorHolder.class, XEditorHolder.class); - objectMap.put(DataTable.class, XDataTable.class); objectMap.put(ElementCaseEditor.class, XElementCase.class); objectMap.put(NameWidget.class, XNameWidget.class); objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XDataTable.java b/designer-form/src/main/java/com/fr/design/designer/creator/XDataTable.java deleted file mode 100644 index 9e6b022ba5..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XDataTable.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.awt.Graphics; -import java.beans.IntrospectionException; - -import javax.swing.JComponent; - -import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.design.mainframe.widget.editors.DataTableConfigPane; -import com.fr.design.mainframe.widget.editors.WidgetValueEditor; -import com.fr.design.designer.beans.events.DesignerEditor; -import com.fr.form.data.DataTableConfig; -import com.fr.form.ui.DataTable; -import com.fr.form.ui.WidgetValue; - -import com.fr.stable.ArrayUtils; -import com.fr.design.utils.gui.LayoutUtils; - -public class XDataTable extends XWidgetCreator{ - - private DesignerEditor designerEditor; - - public XDataTable(DataTable widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - protected String getIconName() { - return "text_field_16.png"; - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), - new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Widget_Value")).setEditorClass(WidgetValueEditor.class) - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - if (((DataTable) toData()).getWidgetValue() != null - && ((DataTable) toData()).getWidgetValue().getValue() instanceof DataTableConfig) { - designerEditor.getEditorTarget().populate( - (DataTableConfig) ((DataTable) toData()).getWidgetValue().getValue()); - } - } - }) }); - } - - @Override - public void paint(Graphics g) { - super.paint(g); - designerEditor.paintEditor(g, this.getSize()); - } - - @Override - protected void initXCreatorProperties() { - super.initXCreatorProperties(); - designerEditor.getEditorTarget().setSize(this.getSize()); - LayoutUtils.layoutContainer(designerEditor.getEditorTarget()); - if (((DataTable) toData()).getWidgetValue() != null - && ((DataTable) toData()).getWidgetValue().getValue() instanceof DataTableConfig) { - designerEditor.getEditorTarget().populate( - (DataTableConfig) ((DataTable) toData()).getWidgetValue().getValue()); - } - } - - @Override - public Dimension initEditorSize() { - return new Dimension(250, 100); - } - - @Override - public DesignerEditor getDesignerEditor() { - return designerEditor; - } - - @Override - protected JComponent initEditor() { - if (designerEditor == null) { - final DataTableConfigPane configPane = new DataTableConfigPane(); - designerEditor = new DesignerEditor(configPane); - configPane.addpropertyChangeListener(designerEditor); - designerEditor.addStopEditingListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - ((DataTable) toData()).setWidgetValue(new WidgetValue(configPane.update())); - } - }); - } - return null; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XListEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XListEditor.java deleted file mode 100644 index 5492292249..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XListEditor.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.beans.IntrospectionException; - -import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JList; - -import com.fr.design.mainframe.widget.editors.DictionaryEditor; -import com.fr.design.mainframe.widget.editors.WidgetValueEditor; -import com.fr.design.mainframe.widget.renderer.DictionaryRenderer; -import com.fr.form.ui.ListEditor; -import com.fr.design.form.util.XCreatorConstants; - -import com.fr.stable.ArrayUtils; - -/** - * @author richer - * @since 6.5.3 - */ -public class XListEditor extends XFieldEditor { - - public XListEditor(ListEditor widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), - new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Widget_Value")).setEditorClass( - WidgetValueEditor.class), - new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("DS-Dictionary")).setEditorClass(DictionaryEditor.class) - .setRendererClass(DictionaryRenderer.class), - new CRPropertyDescriptor("needHead", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("List-Need_Head")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced") }); - } - - @Override - protected void initXCreatorProperties() { - super.initXCreatorProperties(); - JList jList = (JList)editor; - ListEditor l = (ListEditor)data; - jList.setSelectedIndex(0); - jList.setSelectionBackground(l.getSelectionBackground()); - jList.setSelectionForeground(l.getSelectionForeground()); - } - - @Override - protected JComponent initEditor() { - if (editor == null) { - DefaultListModel model = new DefaultListModel(); - model.addElement("Item 1"); - model.addElement("item 2"); - model.addElement("item 3"); - model.addElement("item 4"); - editor = new JList(model); - editor.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); - } - return editor; - } - - @Override - public Dimension initEditorSize() { - return new Dimension(120, 80); - } - - /** - * 该组件是否可以拖入参数面板 - * 这里控制 列表预定义控件在工具栏不显示 - * @return 是则返回true - */ - public boolean canEnterIntoParaPane(){ - return false; - } - - @Override - protected String getIconName() { - return "list_16.png"; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTableEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTableEditor.java deleted file mode 100644 index 3b5f765b70..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTableEditor.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.beans.IntrospectionException; - -import javax.swing.JComponent; -import javax.swing.JTable; -import javax.swing.table.DefaultTableModel; - -import com.fr.form.ui.Table; - -/** - * @author richer - * @since 6.5.3 - */ -public class XTableEditor extends XWidgetCreator { - - public XTableEditor(Table widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return new CRPropertyDescriptor[0]; - // TODO ALEX_SEP -// return (CRPropertyDescriptor[]) ArrayUtils.addAll( -// super.supportedDescriptor(), -// new CRPropertyDescriptor[]{ -// new CRPropertyDescriptor("indexWidgets", this.data.getClass()) -// .setEditorClass(GridEditor.class) -// .setRendererClass(GridWidgetRenderer.class), -// new CRPropertyDescriptor("dataURL", this.data.getClass()), -// new CRPropertyDescriptor("databinding", this.data.getClass()) -// .setI18NName(com.fr.design.i18n.Toolkit.i18nText("DataBinding")) -// .setEditorClass(DataBindingEditor.class) -// .setRendererClass(DataBindingCellRenderer.class) -// .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") -// }); - } - - @Override - protected JComponent initEditor() { - if (editor == null) { - DefaultTableModel tm = new DefaultTableModel(4, 2); - editor = new JTable(tm); - } - return editor; - } - - @Override - public Dimension initEditorSize() { - return MIDDLE_PREFERRED_SIZE; - } - - @Override - protected String getIconName() { - return "table_16.png"; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTableTree.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTableTree.java deleted file mode 100644 index da906dc977..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTableTree.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.beans.IntrospectionException; - -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JList; - -import com.fr.design.mainframe.widget.editors.DictionaryEditor; -import com.fr.design.mainframe.widget.renderer.DictionaryRenderer; -import com.fr.form.ui.TableTree; - -import com.fr.stable.ArrayUtils; - -public class XTableTree extends XWidgetCreator { - - public XTableTree(TableTree widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll( - super.supportedDescriptor(), - new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("dictionary", this.data.getClass()) - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("DS-Dictionary")) - .setEditorClass(DictionaryEditor.class) - .setRendererClass(DictionaryRenderer.class), - new CRPropertyDescriptor("dataUrl", this.data.getClass()), - }); - } - @Override - protected JComponent initEditor() { - if (editor == null) { - DefaultListModel model = new DefaultListModel(); - model.addElement("Item 1"); - model.addElement("item 2"); - model.addElement("item 3"); - model.addElement("item 4"); - editor = new JList(model); - } - return editor; - } - - @Override - public Dimension initEditorSize() { - return new Dimension(120, 80); - } - - @Override - protected String getIconName() { - return "list_16.png"; - } - -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWGridLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWGridLayout.java deleted file mode 100644 index c2ad516491..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWGridLayout.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.designer.creator; - -import java.awt.Dimension; -import java.awt.Point; -import java.awt.event.ContainerEvent; -import java.util.Iterator; - -import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRGridLayoutAdapter; -import com.fr.design.form.layout.FRGridLayout; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WGridLayout; - -/** - * @author richer - * @since 6.5.3 - */ -public class XWGridLayout extends XLayoutContainer { - - public XWGridLayout(WGridLayout widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - protected String getIconName() { - return "layout_grid.png"; - } - - @Override - public String createDefaultName() { - return "grid"; - } - - @Override - public WGridLayout toData() { - return (WGridLayout) data; - } - - @Override - protected void initLayoutManager() { - this.setLayout(new FRGridLayout(toData().getRows(), toData().getColumns(), toData().getHgap(), toData().getVgap())); - } - - @Override - public void convert() { - isRefreshing = true; - WGridLayout layout = this.toData(); - this.removeAll(); - Iterator it = layout.iterator(); - while(it.hasNext()) { - Point p = (Point)it.next(); - Widget wgt = layout.getWidget(p); - if (wgt != null) { - XWidgetCreator comp = (XWidgetCreator)XCreatorUtils.createXCreator(wgt, calculatePreferredSize(wgt)); - this.add(comp, p); - } - } - this.repaint(); - isRefreshing = false; - } - - @Override - public void componentAdded(ContainerEvent e) { - if (isRefreshing) { - return; - } - XWidgetCreator creator = (XWidgetCreator) e.getChild(); - FRGridLayout g = (FRGridLayout) getLayout(); - Point p = g.getPoint(creator); - WGridLayout wg = this.toData(); - Widget w = creator.toData(); - wg.addWidget(w, p); - } - - @Override - public LayoutAdapter getLayoutAdapter() { - return new FRGridLayoutAdapter(this); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWHorizontalSplitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWHorizontalSplitLayout.java deleted file mode 100644 index c8f8963f6b..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWHorizontalSplitLayout.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.Dimension; - -import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRHorizontalSplitLayoutAdapter; -import com.fr.design.form.layout.FRHorizontalSplitLayout; -import com.fr.form.ui.container.WHorizontalSplitLayout; - -public class XWHorizontalSplitLayout extends XAbstractSplitLayout { - - public XWHorizontalSplitLayout(WHorizontalSplitLayout widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public WHorizontalSplitLayout toData() { - return (WHorizontalSplitLayout)data; - } - - @Override - protected void initLayoutManager() { - this.setLayout(new FRHorizontalSplitLayout(toData().getRatio(), toData().getHgap(), toData().getVgap())); - } - - @Override - protected String getIconName() { - return "split_pane_16.png"; - } - - @Override - public String createDefaultName() { - return "hsplit"; - } - - @Override - public LayoutAdapter getLayoutAdapter() { - return new FRHorizontalSplitLayoutAdapter(this); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWVerticalSplitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWVerticalSplitLayout.java deleted file mode 100644 index 3816112e1a..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWVerticalSplitLayout.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fr.design.designer.creator; - -import java.awt.Dimension; - -import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRVerticalSplitLayoutAdapter; -import com.fr.design.form.layout.FRVerticalSplitLayout; -import com.fr.form.ui.container.WVerticalSplitLayout; - -public class XWVerticalSplitLayout extends XAbstractSplitLayout { - - public XWVerticalSplitLayout(WVerticalSplitLayout widget, Dimension initSize) { - super(widget, initSize); - } - - @Override - public WVerticalSplitLayout toData() { - return (WVerticalSplitLayout) data; - } - - @Override - protected void initLayoutManager() { - this.setLayout(new FRVerticalSplitLayout(toData().getRatio(), toData().getHgap(), toData().getVgap())); - } - - @Override - protected String getIconName() { - return "separator_16.png"; - } - - @Override - public String createDefaultName() { - return "vsplit"; - } - - @Override - public LayoutAdapter getLayoutAdapter() { - return new FRVerticalSplitLayoutAdapter(this); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/FRGridLayoutPropertiesGroupModel.java b/designer-form/src/main/java/com/fr/design/designer/properties/FRGridLayoutPropertiesGroupModel.java deleted file mode 100644 index c96596302c..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/properties/FRGridLayoutPropertiesGroupModel.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.fr.design.designer.properties; - - -import java.awt.Container; - -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; - - -import com.fr.design.beans.GroupModel; -import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; -import com.fr.design.mainframe.widget.editors.PropertyCellEditor; -import com.fr.design.designer.creator.XWGridLayout; -import com.fr.form.ui.container.WGridLayout; - -/** - * 格子布局的属性组 - * @author richer - * @since 6.5.3 - */ -public class FRGridLayoutPropertiesGroupModel implements GroupModel { - - private DefaultTableCellRenderer renderer; - private PropertyCellEditor editor; - private WGridLayout layout; - - public FRGridLayoutPropertiesGroupModel(Container container) { - this.layout = ((XWGridLayout)container).toData(); - renderer = new DefaultTableCellRenderer(); - editor = new PropertyCellEditor(new IntegerPropertyEditor()); - } - - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("GridLayout"); - } - - @Override - public int getRowCount() { - return 4; - } - - @Override - public TableCellRenderer getRenderer(int row) { - return renderer; - } - - @Override - public TableCellEditor getEditor(int row) { - return editor; - } - - @Override - public Object getValue(int row, int column) { - if (column == 0) { - switch (row) { - case 0: - return com.fr.design.i18n.Toolkit.i18nText("Hgap"); - case 1: - return com.fr.design.i18n.Toolkit.i18nText("Vgap"); - case 2: - return com.fr.design.i18n.Toolkit.i18nText("Edit-Row_Count"); - case 3: - return com.fr.design.i18n.Toolkit.i18nText("Edit-Column_Count"); - default: - return null; - } - } else { - switch (row) { - case 0: - return layout.getHgap(); - case 1: - return layout.getVgap(); - case 2: - return layout.getRows(); - case 3: - return layout.getColumns(); - default: - return null; - } - } - } - - @Override - public boolean setValue(Object value, int row, int column) { - if (column == 0) { - return false; - } else { - int v = 0; - if (value != null) { - v = ((Number) value).intValue(); - } - switch (row) { - case 0: - layout.setHgap(v); - return true; - case 1: - layout.setVgap(v); - return true; - case 2: - layout.setRows(v); - return true; - case 3: - layout.setColumns(v); - return true; - default: - return false; - } - } - } - - @Override - public boolean isEditable(int row) { - return true; - } -} \ No newline at end of file