Browse Source

控件管理/报表填报属性/超级链接/服务器参数

newui
renekton 6 months ago
parent
commit
1fb3b9084a
  1. 2
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  2. 3
      designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java
  3. 6
      designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java
  4. 20
      designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java
  5. 1
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  6. 3
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java
  7. 21
      designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java
  8. 7
      designer-base/src/main/resources/com/fine/theme/icon/function_manage.svg
  9. 3
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  10. 52
      designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java
  11. 65
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java
  12. 33
      designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java
  13. 60
      designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java
  14. 40
      designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java
  15. 182
      designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java

2
designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java

@ -395,7 +395,7 @@ public class FineUIUtils {
UILabel label = new UILabel(title); UILabel label = new UILabel(title);
wrapBoldLabelWithUnderline(label); wrapBoldLabelWithUnderline(label);
return column(LayoutConstants.VERTICAL_GAP, return column(LayoutConstants.VERTICAL_GAP,
cell(label), cell(component) cell(label), cell(component).weight(1.0)
).getComponent(); ).getComponent();
} }

3
designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java

@ -1,5 +1,6 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane;
@ -101,7 +102,7 @@ public class FunctionManagerPane extends BasicPane {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
NameableCreator funcDef = new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function"), NameableCreator funcDef = new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function"),
IconUtils.readIcon("com/fr/design/images/server/global_param.svg"), new LazyIcon("function_manage"),
FunctionDef.class, FunctionDef.class,
FunctionContentPane.class); FunctionContentPane.class);
return new NameableCreator[]{funcDef}; return new NameableCreator[]{funcDef};

6
designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java

@ -4,6 +4,8 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.Icon;
public abstract class NameableSelfCreator extends AbstractNameableCreator { public abstract class NameableSelfCreator extends AbstractNameableCreator {
@ -15,6 +17,10 @@ public abstract class NameableSelfCreator extends AbstractNameableCreator {
super(menuName, iconPath, clazz, updatePane); super(menuName, iconPath, clazz, updatePane);
} }
public NameableSelfCreator(String menuName, Icon icon, Class clazz, Class<? extends BasicBeanPane> updatePane) {
super(menuName, icon, clazz, updatePane);
}
@Override @Override
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { public void saveUpdatedBean(ListModelElement wrapper, Object bean) {
wrapper.wrapper = (Nameable)bean; wrapper.wrapper = (Nameable)bean;

20
designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java

@ -1,5 +1,8 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
@ -19,6 +22,8 @@ import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell;
public class ObjectProperiesPane extends BasicBeanPane<ListMap> { public class ObjectProperiesPane extends BasicBeanPane<ListMap> {
private UIButton addButton; private UIButton addButton;
@ -27,11 +32,13 @@ public class ObjectProperiesPane extends BasicBeanPane<ListMap> {
public ObjectProperiesPane() { public ObjectProperiesPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel buttonPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel buttonPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add") + " " +com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")); this.addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add") + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property"),
new LazyIcon("add"));
buttonPane.add(this.addButton, BorderLayout.WEST); buttonPane.add(this.addButton, BorderLayout.WEST);
this.add(buttonPane, BorderLayout.NORTH); buttonPane.setPreferredSize(new Dimension(0, 24));
//this.add(buttonPane, BorderLayout.NORTH);
this.addButton.addActionListener(new ActionListener() { this.addButton.addActionListener(new ActionListener() {
@Override @Override
@ -52,8 +59,13 @@ public class ObjectProperiesPane extends BasicBeanPane<ListMap> {
selectedItemScrollPane.setViewportView(northPane); selectedItemScrollPane.setViewportView(northPane);
selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JPanel centerPane = new JPanel(new BorderLayout()); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.setBorder(new FineRoundBorder());
centerPane.add(selectedItemScrollPane); centerPane.add(selectedItemScrollPane);
this.add(centerPane, BorderLayout.CENTER); //this.add(centerPane, BorderLayout.CENTER);
this.add(column(4,
cell(buttonPane).weight(92),
cell(centerPane).weight(465)
).getComponent());
} }
@Override @Override

1
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -291,7 +291,6 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display"));
showParameterInterface.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
content.add(row(10, content.add(row(10,
cell(postComboBox).weight(0.75), cell(postComboBox).weight(0.75),
cell(showParameterInterface).weight(0.25) cell(showParameterInterface).weight(0.25)

3
designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java

@ -1,5 +1,6 @@
package com.fr.design.parameter; package com.fr.design.parameter;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
@ -59,7 +60,7 @@ public class ParameterArrayPane extends JListControlPane {
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{ return new NameableCreator[]{
new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"),
"com/fr/design/images/server/global_param.svg", new LazyIcon("param"),
Parameter.class, Parameter.class,
ParameterPane.class) { ParameterPane.class) {
public Parameter createNameable(UnrepeatedNameHelper helper) { public Parameter createNameable(UnrepeatedNameHelper helper) {

21
designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java

@ -27,6 +27,7 @@ import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
/** /**
* Author : Shockway * Author : Shockway
@ -93,19 +94,23 @@ public abstract class CustomJobPane extends BasicBeanPane {
}); });
reportletNamePane.setLayout(new BorderLayout()); reportletNamePane.setLayout(new BorderLayout());
reportletNamePane.add(row(10, reportletNamePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
cell(classNameTextField).weight(0.8), reportletNamePane.setPreferredSize(new Dimension(0, FineUIScale.scale(24)));
cell(browserButton).weight(0.1), reportletNamePane.add(row(4,
cell(editButton).weight(0.1) cell(classNameTextField).weight(222),
cell(browserButton).weight(48),
cell(editButton).weight(48),
flex(139)
).getComponent()); ).getComponent());
objectProperiesPane = new ObjectProperiesPane(); objectProperiesPane = new ObjectProperiesPane();
JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dsPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
dsPane.add(area); dsPane.add(area);
this.add(column( this.add(column(20,
cell(FineUIUtils.wrapComponentWithTitle(reportletNamePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Name"))), cell(FineUIUtils.wrapComponentWithTitle(reportletNamePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Name"))).weight(55),
cell(FineUIUtils.wrapComponentWithTitle(objectProperiesPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property"))).weight(1.0), cell(FineUIUtils.wrapComponentWithTitle(objectProperiesPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property"))).weight(227),
cell(FineUIUtils.wrapComponentWithTitle(dsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Job_Description"))) cell(FineUIUtils.wrapComponentWithTitle(dsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Job_Description"))).weight(71)
).getComponent()); ).getComponent());
checkAddButtonEnable(); checkAddButtonEnable();
} }

7
designer-base/src/main/resources/com/fine/theme/icon/function_manage.svg

@ -0,0 +1,7 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 6V3C3 2.44772 3.44772 2 4 2C4.55228 2 5 2.44772 5 3L5 6H26V3C26 2.44772 26.4477 2 27 2C27.5523 2 28 2.44772 28 3V6C28 7.10457 27.1046 8 26 8H5C3.89543 8 3 7.10457 3 6Z" fill="#0A1C38" fill-opacity="0.9"/>
<path d="M7 16C7 15.4477 7.44772 15 8 15H17.8728C16.894 15.506 16.0199 16.1864 15.2917 17H8C7.44772 17 7 16.5523 7 16Z" fill="#0A1C38" fill-opacity="0.9"/>
<path d="M26 12V14.9355C26.7281 15.2974 27.4003 15.7549 28 16.2917V12C28 10.8954 27.1046 10 26 10H5C3.89543 10 3 10.8954 3 12V29C3 29.5523 3.44772 30 4 30C4.55228 30 5 29.5523 5 29V12H26Z" fill="#0A1C38" fill-opacity="0.9"/>
<path d="M13.0549 22C13.1316 21.3065 13.287 20.6368 13.5121 20H8C7.44772 20 7 20.4477 7 21C7 21.5523 7.44772 22 8 22H13.0549Z" fill="#0A1C38" fill-opacity="0.9"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.1584 18.0944C29.6895 20.6255 29.9662 24.5487 27.973 27.3342L29.6637 29.0249C30.0943 29.4555 30.0943 30.1536 29.6637 30.5842C29.2331 31.0147 28.535 31.0147 28.1045 30.5842L26.4263 28.906C23.6357 30.9721 19.6535 30.7175 17.0944 28.1584C14.2808 25.3448 14.2529 20.8111 17.032 18.032C19.8111 15.2529 24.3448 15.2808 27.1584 18.0944ZM25.8066 26.8066C27.7882 24.8249 27.7932 21.5576 25.7442 19.5086C23.6952 17.4596 20.4278 17.4645 18.4462 19.4462C16.4645 21.4278 16.4596 24.6952 18.5086 26.7442C20.5576 28.7932 23.8249 28.7882 25.8066 26.8066Z" fill="#0A1C38" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

3
designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json

@ -299,6 +299,7 @@
"text_field": "widget/text_field.svg", "text_field": "widget/text_field.svg",
"widget_tree": "widget/tree.svg", "widget_tree": "widget/tree.svg",
"user_widget": "widget/user_widget.svg", "user_widget": "widget/user_widget.svg",
"advanced_editor": "param/advanced_editor.svg" "advanced_editor": "param/advanced_editor.svg",
"function_manage": "function_manage.svg"
} }
} }

52
designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java

@ -18,15 +18,13 @@ import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class WriteShortCutsPane extends JPanel{ public class WriteShortCutsPane extends JPanel{
private static final int V_GAP = 20; private static final int V_GAP = 20;
@ -54,7 +52,7 @@ public class WriteShortCutsPane extends JPanel{
JPanel contentPane = new JPanel(new BorderLayout()); JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
contentPane.add(column( contentPane.add(column(20,
cell(FineUIUtils.wrapComponentWithTitle(getFeatureNamePane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Shortcut_Set"))), cell(FineUIUtils.wrapComponentWithTitle(getFeatureNamePane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Shortcut_Set"))),
cell(FineUIUtils.wrapComponentWithTitle(getHintsPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))) cell(FineUIUtils.wrapComponentWithTitle(getHintsPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")))
).getComponent()); ).getComponent());
@ -64,26 +62,22 @@ public class WriteShortCutsPane extends JPanel{
private JPanel getFeatureNamePane(){ private JPanel getFeatureNamePane(){
JPanel featureNamePane = new JPanel(new BorderLayout()); JPanel featureNamePane = new JPanel(new BorderLayout());
featureNamePane.setBorder(BorderFactory.createEmptyBorder(16, 0, 0, 0));
UILabel name = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Feature_Name"), SwingConstants.CENTER); UILabel name = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Feature_Name"), SwingConstants.RIGHT);
UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER); UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER);
UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER); UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER);
UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.CENTER); UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.RIGHT);
UIComponentUtils.setLineWrap(shortName, MAX_LABEL_WIDTH); UIComponentUtils.setLineWrap(shortName, MAX_LABEL_WIDTH);
nextColHK = new UILabel(nextColString, SwingConstants.CENTER); nextColHK = new UILabel(nextColString, SwingConstants.CENTER);
JPanel switchBtnPane = getSwitchBtnPane(); JPanel switchBtnPane = getSwitchBtnPane();
nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER); nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER);
JPanel centerPane = new JPanel(new GridLayout(2, 4, 0, 0)); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
centerPane.add(name); centerPane.add(column(24,
centerPane.add(nextCol); row(10, cell(name).weight(0.13), cell(nextCol).weight(0.15), cell(new JPanel()).weight(0.12), cell(nextRow).weight(0.15), flex(0.45)),
centerPane.add(new JPanel()); row(10, cell(shortName).weight(0.13), cell(nextColHK).weight(0.15), cell(switchBtnPane).weight(0.12), cell(nextRowHK).weight(0.15), flex(0.45))
centerPane.add(nextRow); ).getComponent());
centerPane.add(shortName);
centerPane.add(nextColHK);
centerPane.add(switchBtnPane);
centerPane.add(nextRowHK);
featureNamePane.add(centerPane, BorderLayout.CENTER); featureNamePane.add(centerPane, BorderLayout.CENTER);
@ -105,23 +99,21 @@ public class WriteShortCutsPane extends JPanel{
private JPanel getHintsPane(){ private JPanel getHintsPane(){
JPanel hintsPane = new JPanel(new BorderLayout()); JPanel hintsPane = new JPanel(new BorderLayout());
hintsPane.setBorder(BorderFactory.createEmptyBorder(16, 0, 0, 0));
UILabel systemDefault = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_System_Default"), SwingConstants.CENTER); UILabel systemDefault = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_System_Default"), SwingConstants.RIGHT);
UILabel preColText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Column"), SwingConstants.CENTER); UILabel preColText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Column"), SwingConstants.CENTER);
UILabel preRowText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Row"), SwingConstants.CENTER); UILabel preRowText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Row"), SwingConstants.CENTER);
preCol = new UILabel("Shift+" + nextColString, SwingConstants.CENTER); preCol = new UILabel("Shift+" + nextColString, SwingConstants.LEFT);
preRow = new UILabel("Shift+" + nextRowString, SwingConstants.CENTER); preRow = new UILabel("Shift+" + nextRowString, SwingConstants.LEFT);
JPanel centerPane = new JPanel(new GridLayout(2, 3, 0, V_GAP)); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 100)); centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
centerPane.add(systemDefault); centerPane.add(column(24,
centerPane.add(preColText); row(10, cell(systemDefault).weight(0.13), cell(preColText).weight(0.24), cell(preCol).weight(0.14), flex(0.64)),
centerPane.add(preCol); row(10, cell(new JPanel()).weight(0.13), cell(preRowText).weight(0.24), cell(preRow).weight(0.14), flex(0.64))
).getComponent());
centerPane.add(new JPanel());
centerPane.add(preRowText);
centerPane.add(preRow);
hintsPane.add(centerPane, BorderLayout.CENTER); hintsPane.add(centerPane, BorderLayout.CENTER);

65
designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java

@ -1,15 +1,12 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.constants.UIConstants;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.FineTabbedPane;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.mobile.WidgetMobilePane;
@ -17,15 +14,12 @@ import com.fr.design.widget.ui.BasicWidgetPropertySettingPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.util.ArrayList; import java.util.ArrayList;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
/* /*
* carl :单独弄出来 * carl :单独弄出来
*/ */
@ -36,7 +30,9 @@ public class CellWidgetCardPane extends BasicPane {
private WidgetMobilePane currentWidgetMobilePane; private WidgetMobilePane currentWidgetMobilePane;
//属性配置切换面板 //属性配置切换面板
private ArrayList<JPanel> paneList; private ArrayList<JPanel> paneList;
private FineTabbedPane tabsPane; private JPanel center;
private UIHeadGroup tabsHeaderIconPane;
private CardLayout tabbedPane;
private BasicWidgetPropertySettingPane widgetPropertyPane; private BasicWidgetPropertySettingPane widgetPropertyPane;
//通用属性容器 //通用属性容器
@ -64,25 +60,29 @@ public class CellWidgetCardPane extends BasicPane {
this.removeAll(); this.removeAll();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new CardLayout();
final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; center = new JPanel(tabbedPane);
this.add(center, BorderLayout.CENTER);
// 属性 // 属性
attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
BasicScrollPane basicScrollPane = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return attriTabPane;
}
};
widgetPropertyPane = new BasicWidgetPropertySettingPane(); widgetPropertyPane = new BasicWidgetPropertySettingPane();
UIExpandablePane basicPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane);
attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
attriTabPane.add(uiExpandablePane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
attriTabPane.add(attriCardPane, BorderLayout.CENTER);
attriCardLayout = (CardLayout) attriCardPane.getLayout(); attriCardLayout = (CardLayout) attriCardPane.getLayout();
attriTabPane.add(column(
cell(basicPane),
fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())),
cell(attriCardPane)
).getComponent()
);
// 事件 // 事件
eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eventTabPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
eventPane = initWidgetEventPane(pane); eventPane = initWidgetEventPane(pane);
eventTabPane.add(eventPane, BorderLayout.CENTER); eventTabPane.add(eventPane, BorderLayout.CENTER);
@ -91,25 +91,28 @@ public class CellWidgetCardPane extends BasicPane {
mobileCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); mobileCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
mobileTabPane.add(mobileCardPane, BorderLayout.CENTER); mobileTabPane.add(mobileCardPane, BorderLayout.CENTER);
mobileCardLayout = (CardLayout) mobileCardPane.getLayout(); mobileCardLayout = (CardLayout) mobileCardPane.getLayout();
tabsPane = FineTabbedPane.builder()
.addTab(tabTitles[0], new UIScrollPane(attriTabPane))
.addTab(tabTitles[1], eventTabPane)
.addTab(tabTitles[2], mobileTabPane)
.build();
JPanel wrapperPane = new JPanel(new BorderLayout());
wrapperPane.add(tabsPane, BorderLayout.CENTER);
wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10));
wrapperPane.setOpaque(false);
this.add(wrapperPane, BorderLayout.CENTER);
center.add(basicScrollPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"));
center.add(eventTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"));
center.add(mobileTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal"));
initPaneList(); initPaneList();
final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")};
tabsHeaderIconPane = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
tabbedPane.show(center, tabTitles[index]);
}
};
tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY));
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
} }
private void initPaneList() { private void initPaneList() {
paneList = new ArrayList<JPanel>(); paneList = new ArrayList<JPanel>();
paneList.add(attriTabPane); paneList.add(attriTabPane);
paneList.add(eventTabPane); paneList.add(eventPane);
paneList.add(mobileTabPane); paneList.add(mobileTabPane);
} }
@ -148,7 +151,7 @@ public class CellWidgetCardPane extends BasicPane {
currentWidgetMobilePane = mobilePane; currentWidgetMobilePane = mobilePane;
//tabsHeaderIconPane.setSelectedIndex(0); tabsHeaderIconPane.setSelectedIndex(0);
} }
public Widget update() { public Widget update() {

33
designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java

@ -15,11 +15,6 @@ import com.fr.form.ui.WidgetValue;
import java.awt.*; import java.awt.*;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class ValueWidgetPane extends WidgetPane { public class ValueWidgetPane extends WidgetPane {
private JPanel widgetValuePane; private JPanel widgetValuePane;
private WidgetValueEditor widgetValueEditor; private WidgetValueEditor widgetValueEditor;
@ -32,24 +27,18 @@ public class ValueWidgetPane extends WidgetPane {
public JPanel initNorthPane(){ public JPanel initNorthPane(){
JPanel northPane = super.initNorthPane(); JPanel northPane = super.initNorthPane();
label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")); label = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")+ ":");
label.setVisible(false); label.setVisible(false);
widgetValuePane = new JPanel(new BorderLayout()); widgetValuePane = new JPanel();
widgetValuePane.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = new JPanel(new BorderLayout()); double p = TableLayout.PREFERRED;
centerPane.setOpaque(false); double f = TableLayout.FILL;
widgetValuePane.setOpaque(false); double[] columnSize = {p, p, f};
centerPane.add(row( double[] rowSize = {p};
cell(label).weight(68), Component[][] components = new Component[][]{
cell(widgetValuePane).weight(372)).getComponent() new Component[]{northPane, label,widgetValuePane},
); };
JPanel jPanel = new JPanel(); JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
jPanel.setBackground(Color.WHITE);
jPanel.setLayout(new BorderLayout());
jPanel.add(column(10, true,
cell(northPane),
cell(centerPane)
).getComponent());
return jPanel; return jPanel;
} }

60
designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java

@ -1,6 +1,5 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.WidgetDesignHandler; import com.fr.design.fun.WidgetDesignHandler;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -10,36 +9,27 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellWidgetPropertyPane; import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.widget.btn.ButtonConstants; import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.form.ui.NameWidget; import com.fr.form.ui.*;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetConfig;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.DefaultComboBoxModel; import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import java.awt.Component; import java.awt.*;
import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.Vector; import java.util.Vector;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT;
import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT;
/** /**
* CellEditorDef Pane. * CellEditorDef Pane.
*/ */
@ -48,7 +38,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
private EditorTypeComboBox editorTypeComboBox; private EditorTypeComboBox editorTypeComboBox;
private CellWidgetCardPane cellEditorCardPane; private CellWidgetCardPane cellEditorCardPane;
private boolean shouldFireSelectedEvent = true; private boolean shouldFireSelectedEvent = true;
private JComponent northPane; private JPanel northPane;
public WidgetPane() { public WidgetPane() {
this(null); this(null);
@ -68,32 +58,36 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
protected void initComponents(ElementCasePane pane) { protected void initComponents(ElementCasePane pane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
editorTypeComboBox = new EditorTypeComboBox(pane != null); editorTypeComboBox = new EditorTypeComboBox(pane != null);
editorTypeComboBox.setPreferredSize(new Dimension(155, 30));
editorTypeComboBox.setMaximumRowCount(16); editorTypeComboBox.setMaximumRowCount(16);
northPane = initNorthPane(); northPane = initNorthPane();
northPane.setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15));
this.add(northPane, BorderLayout.NORTH);
editorTypeComboBox.addItemListener(this); editorTypeComboBox.addItemListener(this);
cellEditorCardPane = initWidgetCardPane(pane); cellEditorCardPane = initWidgetCardPane(pane);
this.add(cellEditorCardPane, BorderLayout.CENTER);
this.addAttributeChangeListener(listener); this.addAttributeChangeListener(listener);
this.add(column(
10,
cell(northPane).weight(0.17),
cell(cellEditorCardPane).weight(0.83)
).getComponent()
);
} }
public JPanel initNorthPane() { public JPanel initNorthPane() {
UILabel emptyLabel = new UILabel();
return column( emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget"))).weight(68), double p = TableLayout.PREFERRED;
cell(editorTypeComboBox).weight(372) double f = TableLayout.FILL;
) double[] columnSize = {p, p, f};
).getComponent(); double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget")), emptyLabel, editorTypeComboBox},
};
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
return jPanel;
} }
protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) {

40
designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java

@ -1,20 +1,21 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.designer.IntervalConstants;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
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.dialog.BasicPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import java.awt.BorderLayout; import com.fr.design.utils.gui.GUICoreUtils;
import static com.fine.swing.ui.layout.Layouts.cell; import javax.swing.BorderFactory;
import static com.fine.swing.ui.layout.Layouts.column; import javax.swing.JPanel;
import static com.fine.swing.ui.layout.Layouts.row; import java.awt.BorderLayout;
import java.awt.Component;
public class BasicWidgetPropertySettingPane extends BasicPane { public class BasicWidgetPropertySettingPane extends BasicPane {
@ -25,18 +26,27 @@ public class BasicWidgetPropertySettingPane extends BasicPane {
public BasicWidgetPropertySettingPane() { public BasicWidgetPropertySettingPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(new ScaledEmptyBorder(0, 0, 10, 0));
enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true);
enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true);
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox = new ParameterTreeComboBox();
widgetNameComboBox.refreshTree(); widgetNameComboBox.refreshTree();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox},
new Component[]{enableCheckBox, null},
new Component[]{visibleCheckBox, null},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
this.add(pane, BorderLayout.CENTER);
this.add(row(LayoutConstants.HORIZONTAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name"))).weight(0.2),
cell(widgetNameComboBox).weight(0.6),
cell(enableCheckBox).weight(0.1),
cell(visibleCheckBox).weight(0.1)
).getComponent());
} }
@Override @Override

182
designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java

@ -1,14 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fine.theme.light.ui.FineRoundBorder; import com.fr.base.FRContext;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.design.constants.LayoutConstants; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.DateValuePane;
import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.component.UIComboBoxNoArrow;
import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager;
@ -17,30 +22,28 @@ import com.fr.form.ui.DateEditor;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.JPanel; import javax.swing.*;
import javax.swing.SwingConstants; import javax.swing.border.TitledBorder;
import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent;
import javax.swing.plaf.BorderUIResource; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Set;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT;
import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIButtonGroup returnTypeButtonGroup; private UIButtonGroup returnTypeComboBox;
private DateValuePane startDv; private DateValuePane startDv;
private DateValuePane endDv; private DateValuePane endDv;
private UIComboBox currentFormatComboBox; private UIComboBox currentFormatComboBox;
private UILabel currentSampleLabel; private UILabel currentSamplelabel;
private UIButtonGroup formatButtonGroup; private UIButtonGroup fomatHeadGroup;
private static final int SAMPLE_LABEL_PADDING = 4;
public DateEditorDefinePane() { public DateEditorDefinePane() {
} }
@ -52,22 +55,33 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
@Override @Override
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
returnTypeButtonGroup = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")});
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")});
JPanel formatHead = createFormatHead(); JPanel formatHead = createFormatHead();
startDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); startDv = new DateValuePane();
endDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); endDv = new DateValuePane();
UILabel returnTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")); double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
return column(LayoutConstants.VERTICAL_GAP, UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format"));
cell(formatHead), formatLabel.setVerticalAlignment(SwingConstants.TOP);
cell(startDv), UILabel startDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date"));
cell(endDv), startDateLabel.setVerticalAlignment(SwingConstants.TOP);
cell(waterMarkDictPane), UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date"));
row( endDateLabel.setVerticalAlignment(SwingConstants.TOP);
cell(returnTypeLabel).weight(LEFT_WEIGHT), cell(returnTypeButtonGroup).weight(1.4), flex(1.6) Component[][] components = new Component[][]{
) new Component[]{formatLabel, formatHead},
).getComponent(); new Component[]{startDateLabel, startDv},
new Component[]{endDateLabel, endDv},
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox }
};
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
return panel;
} }
@Override @Override
@ -76,20 +90,20 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
} }
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewPane.setPreferredSize(formatComboBox.getPreferredSize());
previewPane.setBorder(new BorderUIResource.CompoundBorderUIResource(
new FineRoundBorder(),
new EmptyBorder(0, 8, 0, 0)
));
previewPane.add(sampleLabel, BorderLayout.WEST);
return column(LayoutConstants.VERTICAL_GAP, true,
cell(formatComboBox),
cell(previewPane).weight(1.0)
).getComponent(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR);
previewPane.setBorder(titledBorder);
JPanel sampleLabelWrapper = new JPanel(new BorderLayout());
sampleLabelWrapper.setBorder(BorderFactory.createEmptyBorder(0, SAMPLE_LABEL_PADDING, SAMPLE_LABEL_PADDING, SAMPLE_LABEL_PADDING));
sampleLabelWrapper.add(sampleLabel, BorderLayout.CENTER);
previewPane.add(sampleLabelWrapper, BorderLayout.CENTER);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER);
return jPanel;
} }
private UILabel createSamplePane(){ private UILabel createSamplePane(){
@ -101,51 +115,58 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
} }
}; };
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(this.getFont()); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
sampleLabel.setForeground(FlatUIUtils.getUIColor("Label.tipColor", Color.GRAY));
return sampleLabel; return sampleLabel;
} }
private JPanel createFormatHead(){ private JPanel createFormatHead(){
UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format"));
String[] dateArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.DATE); String[] dateArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.DATE);
String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME); String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME);
final UIComboBox dateFormatComboBox = new UIComboBoxNoArrow(dateArray); final UIComboBox dateFormatComboBox = new UIComboBoxNoArrow(dateArray);
final UIComboBox timeFormatComboBox = new UIComboBoxNoArrow(timeArray); final UIComboBox timeFormatComboBox = new UIComboBoxNoArrow(timeArray);
dateFormatComboBox.addActionListener(e -> refreshPreviewLabel()); dateFormatComboBox.addActionListener(new ActionListener(){
timeFormatComboBox.addActionListener(e -> refreshPreviewLabel()); public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
timeFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
final UILabel dateSampleLabel = createSamplePane(); final UILabel dateSampleLabel = createSamplePane();
final UILabel timeSampleLabel = createSamplePane(); final UILabel timeSampleLabel = createSamplePane();
JPanel fomatHeadPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final CardLayout cardLayout = new CardLayout(); final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout); final JPanel customPane = new JPanel(cardLayout);
JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel); JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel);
JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel); JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel);
customPane.add(dateFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date")); customPane.add(dateFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"));
customPane.add(timeFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")); customPane.add(timeFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time"));
final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")};
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}; fomatHeadGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")});
formatButtonGroup = new UIButtonGroup<>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), fomatHeadGroup.addChangeListener(new ChangeListener() {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}); @Override
formatButtonGroup.addChangeListener(e -> { public void stateChanged(ChangeEvent e) {
int newSelectedIndex = formatButtonGroup.getSelectedIndex(); int newSelectedIndex = fomatHeadGroup.getSelectedIndex();
cardLayout.show(customPane, tabTitles[newSelectedIndex]); cardLayout.show(customPane, tabTitles[newSelectedIndex]);
if(newSelectedIndex == 0){ if(newSelectedIndex == 0){
currentFormatComboBox = dateFormatComboBox; currentFormatComboBox = dateFormatComboBox;
currentSampleLabel = dateSampleLabel; currentSamplelabel = dateSampleLabel;
}else{ }else{
currentFormatComboBox = timeFormatComboBox; currentFormatComboBox = timeFormatComboBox;
currentSampleLabel = timeSampleLabel; currentSamplelabel = timeSampleLabel;
}
refreshPreviewLabel();
} }
refreshPreviewLabel();
}); });
return column(LayoutConstants.VERTICAL_GAP, fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH);
row( fomatHeadPane.add(customPane, BorderLayout.CENTER);
cell(formatLabel).weight(LEFT_WEIGHT), cell(formatButtonGroup).weight(1.4), flex(1.6) return fomatHeadPane;
),
row(flex(LEFT_WEIGHT), cell(customPane).weight(RIGHT_WEIGHT))
).getComponent();
} }
private void refreshPreviewLabel() { private void refreshPreviewLabel() {
String text = (String) currentFormatComboBox.getSelectedItem(); String text = (String) currentFormatComboBox.getSelectedItem();
if (text != null && text.length() > 0) { if (text != null && text.length() > 0) {
@ -153,15 +174,14 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text);
String sample = simpleDateFormat.format(new Date()); String sample = simpleDateFormat.format(new Date());
DateFormatCheckResult result = DateFormatCheckManager.check(sample, text); DateFormatCheckResult result = DateFormatCheckManager.check(sample, text);
currentSampleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample") + ":" + result.getSample()); currentSamplelabel.setText(result.getSample());
currentSampleLabel.setForeground(result.getColor()); currentSamplelabel.setForeground(result.getColor());
} catch (Exception exp) { } catch (Exception exp) {
currentSampleLabel.removeAll(); currentSamplelabel.setForeground(Color.red);
currentSampleLabel.setForeground(Color.red); currentSamplelabel.setText(exp.getMessage());
currentSampleLabel.setText(exp.getMessage());
} }
} else { } else {
currentSampleLabel.setText(new Date().toString()); currentSamplelabel.setText(new Date().toString());
} }
} }
@ -181,11 +201,11 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
@Override @Override
protected void populateSubDirectWriteEditorBean(DateEditor e) { protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText(); String formatText = e.getFormatText();
formatButtonGroup.setSelectedIndex(getDateType(e)); fomatHeadGroup.setSelectedIndex(getDateType(e));
formatButtonGroup.populateBean(); fomatHeadGroup.populateBean();
currentFormatComboBox.setSelectedItem(formatText); currentFormatComboBox.setSelectedItem(formatText);
returnTypeButtonGroup.setSelectedIndex(e.isReturnDate() ? 0 : 1); returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 0 : 1);
startDv.populate(e.getStartDate()); startDv.populate(e.getStartDate());
endDv.populate(e.getEndDate()); endDv.populate(e.getEndDate());
} }
@ -194,7 +214,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected DateEditor updateSubDirectWriteEditorBean() { protected DateEditor updateSubDirectWriteEditorBean() {
DateEditor ob = new DateEditor(); DateEditor ob = new DateEditor();
ob.setFormatText(this.getSimpleDateFormat().toPattern()); ob.setFormatText(this.getSimpleDateFormat().toPattern());
ob.setReturnDate(returnTypeButtonGroup.getSelectedIndex() == 0); ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 0);
ob.setStartDate(startDv.update()); ob.setStartDate(startDv.update());
ob.setEndDate(endDv.update()); ob.setEndDate(endDv.update());

Loading…
Cancel
Save