Browse Source

更多的控件

remotes/1611766341912730171/master
richie 5 years ago
parent
commit
51707f4645
  1. 20
      src/main/java/com/fanruan/api/design/DesignKit.java
  2. 8
      src/main/java/com/fanruan/api/design/ui/action/UpdateAction.java
  3. 18
      src/main/java/com/fanruan/api/design/ui/component/UISpinner.java
  4. 35
      src/main/java/com/fanruan/api/design/ui/component/UITable.java
  5. 15
      src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java
  6. 5
      src/main/java/com/fanruan/api/design/ui/component/table/UITableEditorPane.java
  7. 39
      src/main/java/com/fanruan/api/design/ui/component/table/model/ParameterTableModel.java
  8. 9
      src/main/java/com/fanruan/api/design/ui/component/table/model/UITableModelAdapter.java
  9. 117
      src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java
  10. 31
      src/main/java/com/fanruan/api/design/util/I18nDesignKit.java

20
src/main/java/com/fanruan/api/design/DesignKit.java

@ -2,6 +2,7 @@ package com.fanruan.api.design;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.i18n.Toolkit;
public class DesignKit { public class DesignKit {
/** /**
@ -11,4 +12,23 @@ public class DesignKit {
public static void previewTableData(TableData tableData){ public static void previewTableData(TableData tableData){
PreviewTablePane.previewTableData(tableData, -1, -1); PreviewTablePane.previewTableData(tableData, -1, -1);
} }
/**
* 文本国际化
* @param key 国际化键
* @return 国际化后的值
*/
public static String i18nText(String key) {
return Toolkit.i18nText(key);
}
/**
* 带参数的文本国际化
* @param key 国际化键
* @param args 参数
* @return 国际化后的值
*/
public static String i18nText(String key, Object... args) {
return Toolkit.i18nText(key, args);
}
} }

8
src/main/java/com/fanruan/api/design/ui/action/UpdateAction.java

@ -1,8 +1,8 @@
package com.fanruan.api.design.ui.action; package com.fanruan.api.design.ui.action;
import java.awt.event.ActionEvent; /**
* 用于各种菜单动作实现的抽象类
*/
public abstract class UpdateAction extends com.fr.design.actions.UpdateAction {
public class UpdateAction extends com.fr.design.actions.UpdateAction{
@Override
public void actionPerformed(ActionEvent evt) {}
} }

18
src/main/java/com/fanruan/api/design/ui/component/UISpinner.java

@ -0,0 +1,18 @@
package com.fanruan.api.design.ui.component;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-28
* 数字滚动控件
*/
public class UISpinner extends com.fr.design.gui.ispinner.UISpinner {
public UISpinner(double minValue, double maxValue, double delta) {
super(minValue, maxValue, delta);
}
public UISpinner(double minValue, double maxValue, double delta, double defaultValue) {
super(minValue, maxValue, delta, defaultValue);
}
}

35
src/main/java/com/fanruan/api/design/ui/component/UITable.java

@ -0,0 +1,35 @@
package com.fanruan.api.design.ui.component;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-28
* 表格控件
*/
public class UITable extends com.fr.design.gui.itable.UITable {
public UITable() {
super();
}
public UITable(int columnSize) {
super(columnSize);
}
/**
* @param values 一个列表里面装有字符串数组每个数组代表一行内容
*/
public UITable(@NotNull List<Object[]> values) {
super(values);
}
public UITable(int columnSize, boolean needAWTEventListener) {
super(columnSize, needAWTEventListener);
}
}

15
src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java

@ -8,13 +8,28 @@ package com.fanruan.api.design.ui.component.code;
*/ */
public interface SyntaxConstants { public interface SyntaxConstants {
/**
* 普通文本编辑器
*/
String SYNTAX_STYLE_NONE = "text/plain"; String SYNTAX_STYLE_NONE = "text/plain";
/**
* java编辑器
*/
String SYNTAX_STYLE_JAVA = "text/java"; String SYNTAX_STYLE_JAVA = "text/java";
/**
* javascript编辑器
*/
String SYNTAX_STYLE_JAVASCRIPT = "text/javascript"; String SYNTAX_STYLE_JAVASCRIPT = "text/javascript";
/**
* sql编辑器
*/
String SYNTAX_STYLE_SQL = "text/sql"; String SYNTAX_STYLE_SQL = "text/sql";
/**
* 公式编辑器
*/
String SYNTAX_STYLE_FORMULA = "text/formula"; String SYNTAX_STYLE_FORMULA = "text/formula";
} }

5
src/main/java/com/fanruan/api/design/ui/component/table/UITableEditorPane.java

@ -7,13 +7,14 @@ import com.fanruan.api.design.ui.component.table.model.UITableModelAdapter;
* @author richie * @author richie
* @version 10.0 * @version 10.0
* Created by richie on 2019-08-28 * Created by richie on 2019-08-28
* 可增改的表格控件
*/ */
public class UITableEditorPane<T> extends com.fr.design.gui.itableeditorpane.UITableEditorPane<T> { public class UITableEditorPane<T> extends com.fr.design.gui.itableeditorpane.UITableEditorPane<T> {
public UITableEditorPane(UITableModelAdapter<T> adapter) { public UITableEditorPane(UITableModelAdapter<T> adapter) {
super(adapter); super(adapter);
} }
public UITableEditorPane(UITableModelAdapter<T> adapter, String leftLabelName) { public UITableEditorPane(UITableModelAdapter<T> adapter, String leftLabelName) {
super(adapter, leftLabelName); super(adapter, leftLabelName);
} }

39
src/main/java/com/fanruan/api/design/ui/component/table/model/ParameterTableModel.java

@ -2,12 +2,12 @@ package com.fanruan.api.design.ui.component.table.model;
import com.fanruan.api.cal.ParameterKit; import com.fanruan.api.cal.ParameterKit;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.ui.component.UILabel; import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UITextField; import com.fanruan.api.design.ui.component.UITextField;
import com.fanruan.api.design.ui.component.table.action.UITableEditAction; import com.fanruan.api.design.ui.component.table.action.UITableEditAction;
import com.fanruan.api.design.ui.editor.ValueEditorPane; import com.fanruan.api.design.ui.editor.ValueEditorPane;
import com.fanruan.api.design.ui.editor.ValueEditors; import com.fanruan.api.design.ui.editor.ValueEditors;
import com.fanruan.api.design.util.I18nDesignKit;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fanruan.api.util.IOKit; import com.fanruan.api.util.IOKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
@ -24,7 +24,7 @@ import java.awt.event.ActionEvent;
import java.util.Collections; import java.util.Collections;
/** /**
* 表格模型 * 编辑参数的表格模型通常来说就是两列参数名和参数值
*/ */
public class ParameterTableModel extends UITableModelAdapter<ParameterProvider> { public class ParameterTableModel extends UITableModelAdapter<ParameterProvider> {
@ -40,7 +40,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
} }
public ParameterTableModel(int paraUseType) { public ParameterTableModel(int paraUseType) {
super(new String[]{I18nDesignKit.i18nText("Fine-Design_Basic_Parameter"), I18nDesignKit.i18nText("Fine-Design_Basic_Value")}); super(new String[]{DesignKit.i18nText("Fine-Design_Basic_Parameter"), DesignKit.i18nText("Fine-Design_Basic_Value")});
this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class}); this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class});
this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(paraUseType)); this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(paraUseType));
this.setDefaultEditor(ParameterEditor.class, new ParameterEditor()); this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
@ -48,7 +48,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
} }
public ParameterTableModel(int paraUseType, Component component) { public ParameterTableModel(int paraUseType, Component component) {
super(new String[]{I18nDesignKit.i18nText("Fine-Design_Basic_Parameter"), I18nDesignKit.i18nText("Fine-Design_Basic_Value")}); super(new String[]{DesignKit.i18nText("Fine-Design_Basic_Parameter"), DesignKit.i18nText("Fine-Design_Basic_Value")});
this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class}); this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class});
this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(paraUseType)); this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(paraUseType));
this.setDefaultEditor(ParameterEditor.class, new ParameterEditor()); this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
@ -57,7 +57,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
} }
public ParameterTableModel(ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane, Component component) { public ParameterTableModel(ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane, Component component) {
super(new String[]{I18nDesignKit.i18nText("Fine-Design_Basic_Parameter"), I18nDesignKit.i18nText("Fine-Design_Basic_Value")}); super(new String[]{DesignKit.i18nText("Fine-Design_Basic_Parameter"), DesignKit.i18nText("Fine-Design_Basic_Value")});
this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class}); this.setColumnClass(new Class[]{ParameterEditor.class, ParameterValueEditor.class});
this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(valueEditorPane)); this.setDefaultEditor(ParameterValueEditor.class, new ParameterValueEditor(valueEditorPane));
this.setDefaultEditor(ParameterEditor.class, new ParameterEditor()); this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
@ -101,21 +101,10 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
return new UITableEditAction[]{new AddParameterAction(), new DeleteAction(), new MoveUpAction(), new MoveDownAction()}; return new UITableEditAction[]{new AddParameterAction(), new DeleteAction(), new MoveUpAction(), new MoveDownAction()};
} }
protected class AddParameterAction extends AddTableRowAction {
/**
* 生成上移下移按钮
*
* @return UItableEdit数组.
*/
public UITableEditAction[] createDBTableAction() {
return new UITableEditAction[]{new MoveUpAction(), new MoveDownAction()};
}
private class AddParameterAction extends AddTableRowAction {
public AddParameterAction() { public AddParameterAction() {
super();
} }
@Override @Override
@ -137,12 +126,12 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
private Component component = null; private Component component = null;
public DeleteAction() { public DeleteAction() {
this.setName(I18nDesignKit.i18nText("Fine-Design_Report_Delete")); this.setName(DesignKit.i18nText("Fine-Design_Report_Delete"));
this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/remove.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/remove.png"));
} }
public DeleteAction(Component component) { public DeleteAction(Component component) {
this.setName(I18nDesignKit.i18nText("Fine-Design_Report_Delete")); this.setName(DesignKit.i18nText("Fine-Design_Report_Delete"));
this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/remove.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/remove.png"));
this.component = component; this.component = component;
} }
@ -151,7 +140,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int[] selectedRow = table.getSelectedRows(); int[] selectedRow = table.getSelectedRows();
if (isMultiSelected()) { if (isMultiSelected()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), I18nDesignKit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), DesignKit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text"));
return; return;
} }
if (table.getCellEditor() != null) { if (table.getCellEditor() != null) {
@ -169,7 +158,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
component = DesignerContext.getDesignerFrame(); component = DesignerContext.getDesignerFrame();
} }
int val = JOptionPane.showConfirmDialog(component, int val = JOptionPane.showConfirmDialog(component,
I18nDesignKit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", I18nDesignKit.i18nText("Fine-Design_Basic_Remove"), DesignKit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", DesignKit.i18nText("Fine-Design_Basic_Remove"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val != JOptionPane.OK_OPTION) { if (val != JOptionPane.OK_OPTION) {
return; return;
@ -200,7 +189,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
protected class MoveUpAction extends UITableEditAction { protected class MoveUpAction extends UITableEditAction {
public MoveUpAction() { public MoveUpAction() {
this.setName(I18nDesignKit.i18nText("Fine-Design_Basic_Utils_Move_Up")); this.setName(DesignKit.i18nText("Fine-Design_Basic_Utils_Move_Up"));
this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/up.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/up.png"));
} }
@ -224,7 +213,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
protected class MoveDownAction extends UITableEditAction { protected class MoveDownAction extends UITableEditAction {
public MoveDownAction() { public MoveDownAction() {
this.setName(I18nDesignKit.i18nText("Fine-Design_Basic_Utils_Move_Down")); this.setName(DesignKit.i18nText("Fine-Design_Basic_Utils_Move_Down"));
this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/down.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/down.png"));
} }
@ -337,7 +326,7 @@ public class ParameterTableModel extends UITableModelAdapter<ParameterProvider>
} }
public ParameterValueRenderer(ValueEditorPane valueEditorPane) { public ParameterValueRenderer(ValueEditorPane valueEditorPane) {
disableLabel = new UILabel(I18nDesignKit.i18nText("Fine-Design_Basic_Set_Paramete_Name")); disableLabel = new UILabel(DesignKit.i18nText("Fine-Design_Basic_Set_Paramete_Name"));
disableLabel.setForeground(Color.pink); disableLabel.setForeground(Color.pink);
disableLabel.setHorizontalAlignment(SwingConstants.CENTER); disableLabel.setHorizontalAlignment(SwingConstants.CENTER);

9
src/main/java/com/fanruan/api/design/ui/component/table/model/UITableModelAdapter.java

@ -1,7 +1,7 @@
package com.fanruan.api.design.ui.component.table.model; package com.fanruan.api.design.ui.component.table.model;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.ui.component.table.action.UITableEditAction; import com.fanruan.api.design.ui.component.table.action.UITableEditAction;
import com.fanruan.api.design.util.I18nDesignKit;
import com.fanruan.api.util.IOKit; import com.fanruan.api.util.IOKit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -12,6 +12,7 @@ import java.awt.event.ActionEvent;
* @author richie * @author richie
* @version 10.0 * @version 10.0
* Created by richie on 2019-08-28 * Created by richie on 2019-08-28
*
*/ */
public abstract class UITableModelAdapter<T> extends com.fr.design.gui.itableeditorpane.UITableModelAdapter<T> { public abstract class UITableModelAdapter<T> extends com.fr.design.gui.itableeditorpane.UITableModelAdapter<T> {
@ -25,7 +26,7 @@ public abstract class UITableModelAdapter<T> extends com.fr.design.gui.itableedi
protected abstract class AddTableRowAction extends UITableEditAction { protected abstract class AddTableRowAction extends UITableEditAction {
public AddTableRowAction() { public AddTableRowAction() {
this.setName(I18nDesignKit.i18nText("Fine-Design_Report_Insert")); this.setName(DesignKit.i18nText("Fine-Design_Report_Insert"));
this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/add.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/base/images/cell/control/add.png"));
} }
@ -42,7 +43,7 @@ public abstract class UITableModelAdapter<T> extends com.fr.design.gui.itableedi
protected abstract class EditAction extends UITableEditAction { protected abstract class EditAction extends UITableEditAction {
public EditAction() { public EditAction() {
this.setName(I18nDesignKit.i18nText("Fine-Design_Report_Edit")); this.setName(DesignKit.i18nText("Fine-Design_Report_Edit"));
this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/edit.png")); this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/edit.png"));
} }
@ -50,7 +51,7 @@ public abstract class UITableModelAdapter<T> extends com.fr.design.gui.itableedi
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final int selectedRow = table.getSelectedRow(); final int selectedRow = table.getSelectedRow();
if (selectedRow > table.getRowCount() - 1 || selectedRow < 0) { if (selectedRow > table.getRowCount() - 1 || selectedRow < 0) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), I18nDesignKit.i18nText("Fine-Design_Basic_No-Alternatives")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), DesignKit.i18nText("Fine-Design_Basic_No-Alternatives"));
return; return;
} }
stopCellEditing(); stopCellEditing();

117
src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java

@ -1,7 +1,7 @@
package com.fanruan.api.design.ui.editor; package com.fanruan.api.design.ui.editor;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.ui.component.table.model.ParameterTableModel; import com.fanruan.api.design.ui.component.table.model.ParameterTableModel;
import com.fanruan.api.design.util.I18nDesignKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.design.editor.editor.BooleanEditor; import com.fr.design.editor.editor.BooleanEditor;
@ -22,7 +22,6 @@ import com.fr.design.editor.editor.TextEditor;
import com.fr.design.editor.editor.WidgetNameEditor; import com.fr.design.editor.editor.WidgetNameEditor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -85,18 +84,18 @@ public class ValueEditors {
* @return 返回公式编辑器面板 * @return 返回公式编辑器面板
*/ */
public static ValueEditorPane createFormulaValueEditorPane() { public static ValueEditorPane createFormulaValueEditorPane() {
return createValueEditorPane(new Editor[]{new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"))}, return createValueEditorPane(new Editor[]{new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"))},
StringKit.EMPTY, StringKit.EMPTY); StringKit.EMPTY, StringKit.EMPTY);
} }
/** /**
* 创建基本的值编辑器面板 * 创建基本的值编辑器面板
* *
* @param editor_center_width 指定值编辑器的主体宽度 * @param editorCenterWidth 指定值编辑器的主体宽度
* @return 返回值编辑器面板 * @return 返回值编辑器面板
*/ */
public static ValueEditorPane createBasicValueEditorPane(int editor_center_width) { public static ValueEditorPane createBasicValueEditorPane(int editorCenterWidth) {
return createValueEditorPane(basicEditors(), StringKit.EMPTY, StringKit.EMPTY, editor_center_width); return createValueEditorPane(basicEditors(), StringKit.EMPTY, StringKit.EMPTY, editorCenterWidth);
} }
/** /**
@ -108,24 +107,6 @@ public class ValueEditors {
return createValueEditorPane(formEditors(), StringKit.EMPTY, StringKit.EMPTY); return createValueEditorPane(formEditors(), StringKit.EMPTY, StringKit.EMPTY);
} }
/**
* StoreProced用的EditorPane
*
* @return 值编辑器面板
*/
public static ValueEditorPane createStoreProcedValueEditorPane() {
return createValueEditorPane(StoreProcedureEditors(), StringKit.EMPTY, StringKit.EMPTY);
}
/**
* 扩展的ValueEditorPane
*
* @return 值编辑器面板
*/
public static ValueEditorPane createExtendedValueEditorPane() {
return createValueEditorPane(extendedEditors(), StringKit.EMPTY, StringKit.EMPTY);
}
/** /**
* URL使用的ValueEditorPane * URL使用的ValueEditorPane
* *
@ -166,24 +147,6 @@ public class ValueEditors {
return createValueEditorPane(basicEditorsWithoutFormula(), StringKit.EMPTY, StringKit.EMPTY); return createValueEditorPane(basicEditorsWithoutFormula(), StringKit.EMPTY, StringKit.EMPTY);
} }
/**
* 创建NoCRNoColumn
*
* @return 值编辑器
*/
public static ValueEditorPane createNoCRNoColumnValueEditorPane() {
return createValueEditorPane(noCRnoColumnEditors(), StringKit.EMPTY, StringKit.EMPTY);
}
/**
* 创建数值编辑器
*
* @return 值编辑器
*/
public static ValueEditorPane createNumberValueEditorPane() {
return createValueEditorPane(numberEditors(), StringKit.EMPTY, StringKit.EMPTY);
}
/** /**
* 创建日期编辑器 * 创建日期编辑器
* *
@ -203,7 +166,7 @@ public class ValueEditors {
return createValueEditorPaneWithUseType(paraUseType, null); return createValueEditorPaneWithUseType(paraUseType, null);
} }
public static ValueEditorPane createValueEditorPaneWithUseType(int paraUseType, HashMap hyperLinkEditorMap) { public static ValueEditorPane createValueEditorPaneWithUseType(int paraUseType, Map<String, BaseFormula> hyperLinkEditorMap) {
if (paraUseType == ParameterTableModel.NO_CHART_USE) { if (paraUseType == ParameterTableModel.NO_CHART_USE) {
return createBasicValueEditorPane(); return createBasicValueEditorPane();
} else if (paraUseType == ParameterTableModel.FORM_NORMAL_USE) { } else if (paraUseType == ParameterTableModel.FORM_NORMAL_USE) {
@ -219,7 +182,7 @@ public class ValueEditors {
* @param hyperLinkEditorMap 超链下拉参数类型 * @param hyperLinkEditorMap 超链下拉参数类型
* @return 值编辑器 * @return 值编辑器
*/ */
public static ValueEditorPane createChartHotValueEditorPane(HashMap hyperLinkEditorMap) { public static ValueEditorPane createChartHotValueEditorPane(Map<String, BaseFormula> hyperLinkEditorMap) {
return createValueEditorPane(chartHotEditors(hyperLinkEditorMap), StringKit.EMPTY, StringKit.EMPTY); return createValueEditorPane(chartHotEditors(hyperLinkEditorMap), StringKit.EMPTY, StringKit.EMPTY);
} }
@ -229,12 +192,12 @@ public class ValueEditors {
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor<?>[] basicEditors() { public static Editor<?>[] basicEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new SpinnerIntegerEditor(), new SpinnerIntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor formulaEditor
}; };
@ -246,15 +209,15 @@ public class ValueEditors {
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor<?>[] formEditors() { public static Editor<?>[] formEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new WidgetNameEditor(I18nDesignKit.i18nText("Fine-Design_Report_Widget")) new WidgetNameEditor(DesignKit.i18nText("Fine-Design_Report_Widget"))
}; };
} }
@ -264,16 +227,16 @@ public class ValueEditors {
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor<?>[] extendedEditors() { public static Editor<?>[] extendedEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new ParameterEditor(), new ParameterEditor(),
new ColumnRowEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell")) new ColumnRowEditor(DesignKit.i18nText("Fine-Design_Basic_Cell"))
}; };
} }
@ -283,17 +246,17 @@ public class ValueEditors {
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor<?>[] extendedCellGroupEditors() { public static Editor<?>[] extendedCellGroupEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new ParameterEditor(), new ParameterEditor(),
new ColumnRowEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell")), new ColumnRowEditor(DesignKit.i18nText("Fine-Design_Basic_Cell")),
new ColumnRowGroupEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell_Group")) new ColumnRowGroupEditor(DesignKit.i18nText("Fine-Design_Basic_Cell_Group"))
}; };
} }
@ -304,8 +267,8 @@ public class ValueEditors {
*/ */
public static Editor<?>[] cellGroupEditor() { public static Editor<?>[] cellGroupEditor() {
return new Editor[]{ return new Editor[]{
new ColumnRowEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell")), new ColumnRowEditor(DesignKit.i18nText("Fine-Design_Basic_Cell")),
new ColumnRowGroupEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell_Group")) new ColumnRowGroupEditor(DesignKit.i18nText("Fine-Design_Basic_Cell_Group"))
}; };
} }
@ -318,7 +281,7 @@ public class ValueEditors {
*/ */
public static Editor<?>[] URLEditors(String popupName, String textEditorValue) { public static Editor<?>[] URLEditors(String popupName, String textEditorValue) {
return new Editor[]{ return new Editor[]{
new NoneEditor(textEditorValue, StringKit.isEmpty(popupName) ? I18nDesignKit.i18nText("Fine-Design_Basic_None") : popupName), new NoneEditor(textEditorValue, StringKit.isEmpty(popupName) ? DesignKit.i18nText("Fine-Design_Basic_None") : popupName),
new TextEditor() new TextEditor()
}; };
} }
@ -332,9 +295,9 @@ public class ValueEditors {
*/ */
public static Editor<?>[] dateEditors(String popupName, String textEditorValue) { public static Editor<?>[] dateEditors(String popupName, String textEditorValue) {
return new Editor[]{ return new Editor[]{
new NoneEditor(textEditorValue, StringKit.isEmpty(popupName) ? I18nDesignKit.i18nText("Fine-Design_Basic_None") : popupName), new NoneEditor(textEditorValue, StringKit.isEmpty(popupName) ? DesignKit.i18nText("Fine-Design_Basic_None") : popupName),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")) new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"))
}; };
} }
@ -344,16 +307,16 @@ public class ValueEditors {
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor<?>[] allEditors() { public static Editor<?>[] allEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new ParameterEditor(), new ParameterEditor(),
new ColumnRowEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Cell")), new ColumnRowEditor(DesignKit.i18nText("Fine-Design_Basic_Cell")),
new ColumnSelectedEditor(), new ColumnSelectedEditor(),
}; };
} }
@ -368,7 +331,7 @@ public class ValueEditors {
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
}; };
} }
@ -379,12 +342,12 @@ public class ValueEditors {
* @return 编辑器 * @return 编辑器
*/ */
public static Editor<?>[] noCRnoColumnEditors() { public static Editor<?>[] noCRnoColumnEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new ParameterEditor(), new ParameterEditor(),
@ -397,7 +360,7 @@ public class ValueEditors {
* @return 编辑器 * @return 编辑器
*/ */
public static Editor<?>[] numberEditors() { public static Editor<?>[] numberEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
@ -412,9 +375,9 @@ public class ValueEditors {
* @return 编辑器 * @return 编辑器
*/ */
public static Editor<?>[] dateEditors() { public static Editor<?>[] dateEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
return new Editor[]{ return new Editor[]{
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
formulaEditor, formulaEditor,
new ParameterEditor(), new ParameterEditor(),
}; };
@ -426,14 +389,14 @@ public class ValueEditors {
* @return 存储过程的编辑器 * @return 存储过程的编辑器
*/ */
public static Editor<?>[] StoreProcedureEditors() { public static Editor<?>[] StoreProcedureEditors() {
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
return new Editor[]{ return new Editor[]{
new CursorEditor(), new CursorEditor(),
new TextEditor(), new TextEditor(),
new IntegerEditor(), new IntegerEditor(),
new DoubleEditor(), new DoubleEditor(),
new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date")), new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor formulaEditor
}; };
@ -444,16 +407,16 @@ public class ValueEditors {
* *
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor[] chartHotEditors(HashMap hyperLinkEditorMap) { public static Editor[] chartHotEditors(Map<String, BaseFormula> hyperLinkEditorMap) {
List<Editor> list = createEditors4Chart(hyperLinkEditorMap); List<Editor> list = createEditors4Chart(hyperLinkEditorMap);
list.add(new TextEditor()); list.add(new TextEditor());
list.add(new IntegerEditor()); list.add(new IntegerEditor());
list.add(new DoubleEditor()); list.add(new DoubleEditor());
list.add(new DateEditor(true, I18nDesignKit.i18nText("Fine-Design_Basic_Date"))); list.add(new DateEditor(true, DesignKit.i18nText("Fine-Design_Basic_Date")));
list.add(new BooleanEditor()); list.add(new BooleanEditor());
FormulaEditor formulaEditor = new FormulaEditor(I18nDesignKit.i18nText("Fine-Design_Basic_Parameter_Formula")); FormulaEditor formulaEditor = new FormulaEditor(DesignKit.i18nText("Fine-Design_Basic_Parameter_Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
list.add(formulaEditor); list.add(formulaEditor);
@ -465,7 +428,7 @@ public class ValueEditors {
* *
* @return 值编辑器 * @return 值编辑器
*/ */
private static List<Editor> createEditors4Chart(HashMap hyperLinkEditorMap) { private static List<Editor> createEditors4Chart(Map<String, BaseFormula> hyperLinkEditorMap) {
List<Editor> lists = new ArrayList<>(); List<Editor> lists = new ArrayList<>();
if (hyperLinkEditorMap == null) { if (hyperLinkEditorMap == null) {
return lists; return lists;

31
src/main/java/com/fanruan/api/design/util/I18nDesignKit.java

@ -1,31 +0,0 @@
package com.fanruan.api.design.util;
import com.fr.design.i18n.Toolkit;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-28
* 设计器国际化工具类设计器相关类的国际化都需要调用这个类才行
*/
public class I18nDesignKit {
/**
* 文本国际化
* @param key 国际化键
* @return 国际化后的值
*/
public static String i18nText(String key) {
return Toolkit.i18nText(key);
}
/**
* 带参数的文本国际化
* @param key 国际化键
* @param args 参数
* @return 国际化后的值
*/
public static String i18nText(String key, Object... args) {
return Toolkit.i18nText(key, args);
}
}
Loading…
Cancel
Save