Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit '3a646b7ff9b07a59663e6e03d63e6ce0d6bf6d0a':
  无JIRA任务 fix
  REPORT-8114 数据集字典 设计器无响应
  REPORT-8105 修改绝对画布块缩放逻辑 报错
  REPORT-7261 右侧事件编辑面板隐藏问题
  无任务,做短信事件插件发现的设计器bug
  REPORT-6973 模板短信事件 插件设计器接口
  REPORT-6949 条件属性的超级链接重命名后会自动生成超级链接
  REPORT-6868 设计器数据列单元格切换频繁弹出sql参数对话框
  REPORT-5856 插件管理新分类 平台插件分类过滤失效
  REPORT-6096 TAB页中组件在复制粘贴后会位移
  无任务,决策报表编辑报表块报错
  无任务,slider和quickeditor的内存问题
master
Hzzz 7 years ago
parent
commit
13ebc32441
  1. 14
      designer-base/src/com/fr/design/actions/core/ActionFactory.java
  2. 78
      designer-base/src/com/fr/design/data/datapane/ChoosePane.java
  3. 11
      designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java
  4. 34
      designer-base/src/com/fr/design/editor/editor/TextEditor.java
  5. 17
      designer-base/src/com/fr/design/extra/LoginDialog.java
  6. 51
      designer-base/src/com/fr/design/extra/WebViewDlgHelper.java
  7. 2
      designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  8. 13
      designer-base/src/com/fr/design/file/MutilTempalteTabPane.java
  9. 46
      designer-base/src/com/fr/design/gui/controlpane/UIControlPane.java
  10. 36
      designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java
  11. 15
      designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java
  12. 32
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  13. 14
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  14. 140
      designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  15. 44
      designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java
  16. 45
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  17. 62
      designer-base/src/com/fr/design/mainframe/JFormSliderPane.java
  18. 69
      designer-base/src/com/fr/design/mainframe/JSliderPane.java
  19. 9
      designer-base/src/com/fr/design/selection/QuickEditor.java
  20. 2
      designer-chart/src/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  21. 5
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  22. 3
      designer-form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  23. 34
      designer-form/src/com/fr/design/mainframe/FormSelectionUtils.java
  24. 18
      designer-form/src/com/fr/design/mainframe/WidgetToolBarPane.java
  25. 55
      designer-realize/src/com/fr/design/dscolumn/DSColumnBasicPane.java
  26. 130
      designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java
  27. 7
      designer-realize/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java
  28. 173
      designer-realize/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  29. 7
      designer-realize/src/com/fr/design/mainframe/ElementCasePane.java
  30. 36
      designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  31. 3
      designer-realize/src/com/fr/design/mainframe/ReportComponentComposite.java
  32. 5
      designer-realize/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java
  33. 90
      designer-realize/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  34. 5
      designer-realize/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  35. 32
      designer-realize/src/com/fr/design/module/DesignerModule.java
  36. 28
      designer-realize/src/com/fr/grid/selection/CellSelection.java
  37. 15
      designer-realize/src/com/fr/grid/selection/FloatSelection.java
  38. 12
      designer-realize/src/com/fr/quickeditor/FloatQuickEditor.java
  39. 283
      designer-realize/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  40. 7
      designer-realize/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  41. 2
      designer-realize/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  42. 6
      designer-realize/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  43. 8
      designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  44. 64
      designer-realize/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  45. 2
      designer-realize/src/com/fr/start/Designer.java

14
designer-base/src/com/fr/design/actions/core/ActionFactory.java

@ -55,6 +55,20 @@ public class ActionFactory {
private ActionFactory() { private ActionFactory() {
} }
/**
* 元素编辑器释放模板对象
*/
public static void editorRelease() {
for (Map.Entry<Class, QuickEditor> entry : cellEditor.entrySet()) {
entry.getValue().release();
}
for (Map.Entry<Class, QuickEditor> entry : floatEditor.entrySet()) {
entry.getValue().release();
}
}
/** /**
* 注册无需每次实例化的单元格元素编辑器 * 注册无需每次实例化的单元格元素编辑器
* *

78
designer-base/src/com/fr/design/data/datapane/ChoosePane.java

@ -37,7 +37,11 @@ import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -48,7 +52,9 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -85,6 +91,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private PopupMenuListener popupMenuListener = new PopupMenuListener() { private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
new Thread() { new Thread() {
@Override @Override
@ -94,26 +101,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}.start(); }.start();
} }
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
} }
@Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
}; };
private PopupMenuListener listener = new PopupMenuListener() { private PopupMenuListener listener = new PopupMenuListener() {
@Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
} }
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
executePopulateWorker(); executePopulateWorker();
} }
}; };
private FocusAdapter focusAdapter = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (schemaBox.getSelectedIndex() == -1) {
schemaBox.updateUI();
schemaBox.showPopup();
}
}
};
public ChoosePane() { public ChoosePane() {
this(null); this(null);
} }
@ -146,6 +168,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private void initBoxListener() { private void initBoxListener() {
addDSBoxListener(); addDSBoxListener();
schemaBox.addItemListener(new ItemListener() { schemaBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) { public void itemStateChanged(ItemEvent evt) {
tableNameComboBox.setSelectedItem(""); tableNameComboBox.setSelectedItem("");
} }
@ -176,16 +199,9 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
protected void addFocusListener() { protected void addFocusListener() {
schemaBox.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
if (schemaBox.getSelectedIndex() == -1) {
schemaBox.updateUI();
schemaBox.showPopup();
}
}
});
} }
@SuppressWarnings("unchecked")
protected void initDsNameComboBox() { protected void initDsNameComboBox() {
dsNameComboBox.setRefreshingModel(true); dsNameComboBox.setRefreshingModel(true);
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
@ -233,12 +249,18 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() { populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() {
protected com.fr.data.impl.Connection doInBackground() throws Exception { @SuppressWarnings("unchecked")
@Override
protected com.fr.data.impl.Connection doInBackground() {
schemaBox.setRefreshingModel(true);
schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "..."); schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "...");
schemaBox.setSelectedItem(null); schemaBox.setSelectedItem(null);
schemaBox.setRefreshingModel(false);
return getConnection(); return getConnection();
} }
@SuppressWarnings("unchecked")
@Override
public void done() { public void done() {
try { try {
com.fr.data.impl.Connection selectedDatabase = get(); com.fr.data.impl.Connection selectedDatabase = get();
@ -267,6 +289,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
schemaBox.removePopupMenuListener(listener); schemaBox.removePopupMenuListener(listener);
schemaBox.setPopupVisible(true); schemaBox.setPopupVisible(true);
schemaBox.addPopupMenuListener(listener); schemaBox.addPopupMenuListener(listener);
schemaBox.removeFocusListener(focusAdapter);
schemaBox.addFocusListener(focusAdapter);
} }
}; };
populateWorker.execute(); populateWorker.execute();
@ -303,6 +327,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 刷新没多大用而且要刷新也不是这儿刷新 * 刷新没多大用而且要刷新也不是这儿刷新
*/ */
@Override
public void refresh() { public void refresh() {
DBUtils.refreshDatabase(); DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
@ -312,6 +337,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() { TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof DefaultMutableTreeNode) { if (value instanceof DefaultMutableTreeNode) {
@ -328,6 +354,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}; };
public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() { public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof TreePath) { if (value instanceof TreePath) {
@ -345,6 +372,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 添加项目监听事件 * 添加项目监听事件
*
* @param aListener 事件监听器 * @param aListener 事件监听器
*/ */
public void addItemListener(ItemListener aListener) { public void addItemListener(ItemListener aListener) {
@ -353,6 +381,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 删除项目监听事件 * 删除项目监听事件
*
* @param aListener 事件监听器 * @param aListener 事件监听器
*/ */
public void removeItemListener(ItemListener aListener) { public void removeItemListener(ItemListener aListener) {
@ -398,9 +427,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
} }
((DefaultTreeModel) tree.getModel()).reload(); ((DefaultTreeModel) tree.getModel()).reload();
/** // daniel 展开所有tree
* daniel 展开所有tree
*/
TreeNode root = (TreeNode) tree.getModel().getRoot(); TreeNode root = (TreeNode) tree.getModel().getRoot();
TreePath parent = new TreePath(root); TreePath parent = new TreePath(root);
TreeNode node = (TreeNode) parent.getLastPathComponent(); TreeNode node = (TreeNode) parent.getLastPathComponent();
@ -416,6 +443,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 创建选中的数据集数据 * 创建选中的数据集数据
*
* @return 数据集数据 * @return 数据集数据
*/ */
public TableData createSelectTableData() { public TableData createSelectTableData() {
@ -428,8 +456,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
try { try {
connect = FRContext.getCurrentEnv().testConnection(database); connect = FRContext.getCurrentEnv().testConnection(database);
} catch (Exception e1) { } catch (Exception ignored) {
connect = false;
} }
if (!connect) { if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
@ -442,9 +469,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
TableData tableData = null; TableData tableData = null;
if (FRContext.getCurrentEnv() instanceof LocalEnv) { if (FRContext.getCurrentEnv() instanceof LocalEnv) {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(),
DialectFactory.getDialectByName(paras.getDatabaseName()))); DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = tableDataLocal;
} else { } else {
try { try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
@ -485,6 +511,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 得到当前的ColumnName[] * 得到当前的ColumnName[]
*
* @return 返回当前的ColumnName[] * @return 返回当前的ColumnName[]
*/ */
public String[] currentColumnNames() { public String[] currentColumnNames() {
@ -493,21 +520,19 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DataBaseItems paras = this.updateBean(); DataBaseItems paras = this.updateBean();
String selectedDSName = paras.getDatabaseName(); String selectedDSName = paras.getDatabaseName();
if (StringUtils.isBlank(selectedDSName)) { if (StringUtils.isBlank(selectedDSName)) {
return colNames = new String[0]; // peter:选中了当前的零长度的节点,直接返回. // peter:选中了当前的零长度的节点,直接返回.
return new String[0];
} }
String selectedTableObject = paras.getTableName(); String selectedTableObject = paras.getTableName();
if (StringUtils.isEmpty(selectedTableObject)) { if (StringUtils.isEmpty(selectedTableObject)) {
return colNames = new String[0]; return new String[0];
} }
java.sql.Connection conn = null;
try { try {
// daniel:增加参数 // daniel:增加参数
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
} catch (Exception e2) { } catch (Exception e2) {
FRContext.getLogger().error(e2.getMessage(), e2); FRContext.getLogger().error(e2.getMessage(), e2);
} finally {
DBUtils.closeConnection(conn);
} }
if (colNames == null) { if (colNames == null) {
@ -518,6 +543,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 预览key value对应的数据 * 预览key value对应的数据
*
* @param key * @param key
* @param value * @param value
*/ */
@ -528,6 +554,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 默认预览 * 默认预览
*/ */
@Override
public void preview() { public void preview() {
preview(-1, -1); preview(-1, -1);
} }
@ -542,8 +569,10 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 注册listener,相应数据集改变 * 注册listener,相应数据集改变
*/ */
@Override
public void registerDSChangeListener() { public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
initDsNameComboBox(); initDsNameComboBox();
} }
@ -578,6 +607,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
this.refreshingModel = refreshingModel; this.refreshingModel = refreshingModel;
} }
@Override
public void setSelectedItem(Object ob) { public void setSelectedItem(Object ob) {
this.getModel().setSelectedItem(ob); this.getModel().setSelectedItem(ob);
if (ob != null && StringUtils.isEmpty(ob.toString())) { if (ob != null && StringUtils.isEmpty(ob.toString())) {
@ -591,11 +621,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private class ComboBoxEditor extends UIComboBoxEditor { private class ComboBoxEditor extends UIComboBoxEditor {
private Object item; private Object item;
@Override
public void setItem(Object item) { public void setItem(Object item) {
this.item = item; this.item = item;
textField.setText((item == null) ? "" : item.toString()); textField.setText((item == null) ? "" : item.toString());
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }

11
designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java

@ -4,12 +4,12 @@ import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* the editor to edit ColumnRow * the editor to edit ColumnRow
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:01:37 * @since 2012-3-29下午6:01:37
*/ */
public class ColumnRowEditor extends Editor<ColumnRow> { public class ColumnRowEditor extends Editor<ColumnRow> {
@ -63,6 +63,7 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
this.crPane.requestFocus(); this.crPane.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "cell"; return "cell";
} }
@ -71,4 +72,10 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof ColumnRow; return object instanceof ColumnRow;
} }
@Override
public void clearData() {
super.clearData();
this.setValue(null);
}
} }

34
designer-base/src/com/fr/design/editor/editor/TextEditor.java

@ -3,26 +3,31 @@
*/ */
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/** /**
* CellEditor used to edit String object. * CellEditor used to edit String object.
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:00:43 * @since 2012-3-29下午6:00:43
*/ */
public class TextEditor extends Editor<String> { public class TextEditor extends Editor<String> {
private UITextField textField; // text field. /**
// the old value of text field. * text field.
*/
private UITextField textField;
/**
* the old value of text field.
*/
private String oldValue = StringUtils.EMPTY; private String oldValue = StringUtils.EMPTY;
/** /**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY; value = StringUtils.EMPTY;
} }
oldValue = value.toString(); oldValue = value;
this.textField.setText(oldValue); this.textField.setText(oldValue);
} }
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/** /**
* 被选中时文本输入框请求焦点 * 被选中时文本输入框请求焦点
*/ */
@Override
public void selected() { public void selected() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "type_string"; return "type_string";
} }
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @param object 需要判断的object * @param object 需要判断的object
* @return 是字符类型则返回true * @return 是字符类型则返回true
*/ */
@Override
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof String; return object instanceof String;
} }
@Override
public void clearData() {
super.clearData();
this.textField.setText(StringUtils.EMPTY);
this.oldValue = StringUtils.EMPTY;
}
} }

17
designer-base/src/com/fr/design/extra/LoginDialog.java

@ -4,8 +4,12 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
/** /**
* Created by vito on 2017/5/5. * Created by vito on 2017/5/5.
@ -15,6 +19,15 @@ public class LoginDialog extends UIDialog {
public LoginDialog(Frame frame, Component pane) { public LoginDialog(Frame frame, Component pane) {
super(frame); super(frame);
init(pane);
}
public LoginDialog(Dialog dialog, Component pane) {
super(dialog);
init(pane);
}
private void init(Component pane) {
if (StableUtils.getMajorJavaVersion() == 8) { if (StableUtils.getMajorJavaVersion() == 8) {
setUndecorated(true); setUndecorated(true);
} }

51
designer-base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -22,6 +22,9 @@ import javax.swing.JOptionPane;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -133,18 +136,22 @@ public class WebViewDlgHelper {
if (StableUtils.getMajorJavaVersion() == VERSION_8) { if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts")); File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( confirmDownLoadShopJS();
null, } else {
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), showLoginDlg(DesignerContext.getDesignerFrame());
Inter.getLocText("FR-Designer-Plugin_Warning"), updateShopScripts(SHOP_SCRIPTS);
JOptionPane.OK_CANCEL_OPTION, }
JOptionPane.INFORMATION_MESSAGE }
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
} }
public static void createLoginDialog(Window parent) {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();
} else { } else {
showLoginDlg(); showLoginDlg(parent);
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
} }
} }
@ -164,6 +171,20 @@ public class WebViewDlgHelper {
} }
} }
private static void confirmDownLoadShopJS() {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
}
private static void showPluginDlg(String mainJsPath) { private static void showPluginDlg(String mainJsPath) {
try { try {
Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane"); Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane");
@ -179,13 +200,17 @@ public class WebViewDlgHelper {
} }
} }
private static void showLoginDlg() { private static void showLoginDlg(Window window) {
try { try {
Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane"); Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane");
Constructor constructor = clazz.getConstructor(String.class); Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(installHome); Component webPane = (Component) constructor.newInstance(installHome);
UIDialog qqdlg;
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane); if (window instanceof Dialog) {
qqdlg = new LoginDialog((Dialog) window, webPane);
} else {
qqdlg = new LoginDialog((Frame) window, webPane);
}
LoginWebBridge.getHelper().setDialogHandle(qqdlg); LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true); qqdlg.setVisible(true);
} catch (Throwable ignored) { } catch (Throwable ignored) {

2
designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -23,7 +23,7 @@ public class GetPluginFromStoreExecutor implements Executor {
private String scope; private String scope;
public GetPluginFromStoreExecutor(JSONObject info) { public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("category"); this.category = info.optString("categories");
this.fee = info.optString("fee"); this.fee = info.optString("fee");
this.seller = info.optString("seller"); this.seller = info.optString("seller");
this.scope = info.optString("scope"); this.scope = info.optString("scope");

13
designer-base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -711,23 +711,12 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) {
specifiedTemplate.saveTemplate(); specifiedTemplate.saveTemplate();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."}));
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
} else if (returnVal == JOptionPane.NO_OPTION) {
//不保存
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
} }
//若是点击取消关闭,则什么都不做 }
} else {
//若是已经保存过了,则关闭即可
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename); activeTemplate(filename);
} }
}
/** /**
* 关闭模板 * 关闭模板
* *

46
designer-base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -17,10 +17,34 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -336,6 +360,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
initListener(); initListener();
} }
@Override
public void setTitle(String title) { public void setTitle(String title) {
popupToolPane.setTitle(title); popupToolPane.setTitle(title);
} }
@ -353,6 +378,17 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return; return;
} }
} }
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage());
this.requestFocus();
return;
}
saveSettings(); saveSettings();
setVisible(false); setVisible(false);
} }
@ -361,7 +397,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
addWindowFocusListener(new WindowAdapter() { addWindowFocusListener(new WindowAdapter() {
@Override @Override
public void windowLostFocus(WindowEvent e) { public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
hideDialog(); hideDialog();
} }
}); });
@ -389,6 +424,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
repaint(); repaint();
} }
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null; mouseDownCompCoords = null;
@ -396,6 +432,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(originColor); contentPane.setBackground(originColor);
} }
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
mouseDownCompCoords = e.getPoint(); mouseDownCompCoords = e.getPoint();
@ -409,6 +446,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND);
repaint(); repaint();
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) { if (mouseDownCompCoords != null) {

36
designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java

@ -1,34 +1,37 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.icombobox.filter.Filter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.ExtendedComboBox; import com.fr.design.gui.icombobox.ExtendedComboBox;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.gui.icombobox.filter.Filter;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: Richer * User: Richer
@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel {
// 睡5秒 // 睡5秒
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }

15
designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java

@ -1,16 +1,15 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -19,8 +18,8 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Time: 下午4:54 * Time: 下午4:54
*/ */
public class SwingComponentsDemo extends JFrame { public class SwingComponentsDemo extends JFrame {
public SwingComponentsDemo() { private SwingComponentsDemo() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
init(); init();
JPanel contentPane = (JPanel) getContentPane(); JPanel contentPane = (JPanel) getContentPane();
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
JFrame f = new SwingComponentsDemo(); JFrame f = new SwingComponentsDemo();
f.setSize(500, 500); f.setSize(500, 500);
f.setVisible(true); f.setVisible(true);
GUICoreUtils.centerWindow(f); GUICoreUtils.centerWindow(f);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
} }
}); });
} }

32
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -44,15 +44,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators()); refreshNameableCreator(createNameableCreators());
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG); return context.contain(HyperlinkProvider.XML_TAG);
} }
}); });
@ -63,6 +60,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
@Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new ListMap<>(); Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
@ -82,6 +80,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回标题字符串. * @return 返回标题字符串.
*/ */
@Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Hyperlink"); return Inter.getLocText("FR-Designer_Hyperlink");
} }
@ -91,11 +90,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Add_Hyperlink"); return Inter.getLocText("FR-Designer_Add_Hyperlink");
} }
public void populate(NameJavaScriptGroup nameHyperlink_array) { public void populate(NameJavaScriptGroup hyperlinkArray) {
java.util.List<NameObject> list = new ArrayList<NameObject>(); java.util.List<NameObject> list = new ArrayList<>();
if (nameHyperlink_array != null) { if (hyperlinkArray != null) {
for (int i = 0; i < nameHyperlink_array.size(); i++) { for (int i = 0; i < hyperlinkArray.size(); i++) {
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript())); list.add(new NameObject(hyperlinkArray.getNameHyperlink(i).getName(), hyperlinkArray.getNameHyperlink(i).getJavaScript()));
} }
} }
@ -113,20 +112,29 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*/ */
public NameJavaScriptGroup updateJSGroup() { public NameJavaScriptGroup updateJSGroup() {
Nameable[] res = this.update(); Nameable[] res = this.update();
NameJavaScript[] res_array = new NameJavaScript[res.length]; NameJavaScript[] resArray = new NameJavaScript[res.length];
for (int i = 0; i < res.length; i++) { for (int i = 0; i < res.length; i++) {
NameObject no = (NameObject) res[i]; NameObject no = (NameObject) res[i];
res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject()); resArray[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject());
} }
return new NameJavaScriptGroup(res_array); return new NameJavaScriptGroup(resArray);
} }
@Override @Override
public void saveSettings() { public void saveSettings() {
if (isPopulating) { if (isPopulating || !needAutoSave()) {
return; return;
} }
hyperlinkGroupPaneActionProvider.saveSettings(this); hyperlinkGroupPaneActionProvider.saveSettings(this);
} }
/**
* 是否需要自动保存到超级链接属性中
*
* @return 是否需要自动保存
*/
public boolean needAutoSave() {
return true;
}
} }

14
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java

@ -3,9 +3,23 @@ package com.fr.design.gui.frpane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
/** /**
* @author plough
* Created by plough on 2017/7/26. * Created by plough on 2017/7/26.
*/ */
public interface HyperlinkGroupPaneActionProvider { public interface HyperlinkGroupPaneActionProvider {
/**
* 刷新面板展示
*
* @param hyperlinkGroupPane 超链面板
* @param elementCasePane 模板
*/
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane); void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
/**
* 保存到文件
*
* @param hyperlinkGroupPane 超联面板
*/
void saveSettings(HyperlinkGroupPane hyperlinkGroupPane); void saveSettings(HyperlinkGroupPane hyperlinkGroupPane);
} }

140
designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java

@ -3,108 +3,115 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.Dimension; import com.fr.general.FRLogger;
import java.util.ArrayList; import com.fr.general.Inter;
import java.util.List;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboPopup; import java.awt.Dimension;
import java.util.concurrent.ExecutionException;
import com.fr.general.Inter;
/** /**
* @author richer * @author richer
* @version 2018年2月6日14点43分 by @yaoh.wu
* @since 6.5.5 创建于2011-6-15 延迟加载的下拉框 * @since 6.5.5 创建于2011-6-15 延迟加载的下拉框
*/ */
public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener { public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener {
protected boolean loaded = false;
private List<EventListener> ls = new ArrayList<EventListener>();
private Object initialSelected = null;
private static final int NUM = 80; private static final int NUM = 80;
private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."};
public static final Object PENDING = new Object() { /**
* 是否加载完成
*/
protected boolean loaded = false;
/**
* 初始化选项
*/
private Object initialSelected = null;
@Override
public String toString() {
return Inter.getLocText("Loading") + "...";
}
};
public LazyComboBox() { protected LazyComboBox() {
super(); super();
this.setEditor(new FilterComboBoxEditor()); this.setEditor(new FilterComboBoxEditor());
addPopupMenuListener(this); addPopupMenuListener(this);
// updateUI();
} }
public void setLoaded(boolean loaded) { public void setLoaded(boolean loaded) {
this.loaded = loaded; this.loaded = loaded;
} }
/**
* 加载下拉框中的选项
*
* @return 下拉框中的选项
*/
public abstract Object[] load(); public abstract Object[] load();
@Override
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
initialSelected = anObject; initialSelected = anObject;
if (loaded) { if (loaded) {
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} else { } else {
this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject}));
setModel(new DefaultComboBoxModel(new Object[] { anObject }));
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} }
} }
/**
* 通过调用该方法在点击下拉框按钮之前就加载好数据
*/
public void loadInstant() {
if (loaded) {
return;
}
setModel(new DefaultComboBoxModel(load()));
loaded = true;
}
@Override @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (loaded) { if (loaded) {
return; return;
} }
DefaultComboBoxModel loadingModel = new DefaultComboBoxModel(new String[]{"", Inter.getLocText("Loading") + "..."}); DefaultComboBoxModel<String> loadingModel = new DefaultComboBoxModel<>(PENDING_CONTENT);
LazyComboBox.this.setModel(loadingModel); this.setModel(loadingModel);
new SwingWorker<Void, Void>() { new SwingWorker<Object[], Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Object[] doInBackground() {
final Object selectedObj = getSelectedItem(); return load();
loadList();
return null;
} }
@Override @Override
public void done() { public void done() {
LazyComboBox.this.updateUI(); try {
LazyComboBox.this.fireEvent(); LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) {
FRLogger.getLogger().debug(exception.getMessage());
}
LazyComboBox.this.showPopup(); LazyComboBox.this.showPopup();
} }
}.execute(); }.execute();
}
/**
* 加载下拉列表
*/
public void loadList() {
DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(load());
model.setSelectedItem(initialSelected);
this.setModel(model);
this.selectedItemReminder = initialSelected;
loaded = true;
} }
/** /**
* 计算加载下拉列表 * 加载下拉列表
*
* @param contents 下拉列表内容
*/ */
public void loadList() { private void loadList(Object[] contents) {
DefaultComboBoxModel model = new DefaultComboBoxModel(load()); DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(contents);
model.setSelectedItem(initialSelected); model.setSelectedItem(initialSelected);
LazyComboBox.this.setModel(model); this.setModel(model);
LazyComboBox.this.selectedItemReminder = initialSelected ; this.selectedItemReminder = initialSelected;
loaded = true; loaded = true;
} }
@ -118,19 +125,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
} }
public void addClickListener(EventListener l) {
if (ls == null) {
ls = new ArrayList<LazyComboBox.EventListener>();
}
ls.add(l);
}
public void fireEvent() {
for (int i = 0, n = ls.size(); i < n; i++) {
ls.get(i).fireEvent();
}
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -138,26 +132,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
return dim; return dim;
} }
private static class LazyPopMenu extends BasicComboPopup {
public LazyPopMenu(final JComboBox combo) {
super(combo);
LazyComboBox comboc = (LazyComboBox) combo;
comboc.addClickListener(new EventListener() {
@Override
public void fireEvent() {
LazyPopMenu.this.show();
combo.showPopup();
}
});
}
}
private interface EventListener {
void fireEvent();
}
class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener { class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private Object item; private Object item;
private volatile boolean filtering = false; private volatile boolean filtering = false;
@ -168,12 +142,12 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
textField.getDocument().addDocumentListener(this); textField.getDocument().addDocumentListener(this);
} }
@Override
public void setItem(Object item) { public void setItem(Object item) {
if (filtering) { if (filtering) {
return; return;
} }
this.item = item; this.item = item;
this.setting = true; this.setting = true;
textField.setSetting(true); textField.setSetting(true);
String newText = (item == null) ? "" : item.toString(); String newText = (item == null) ? "" : item.toString();
@ -182,23 +156,27 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
this.setting = false; this.setting = false;
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }
@Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
protected void handleChange() { void handleChange() {
if (setting) { if (setting) {
return; return;
} }

44
designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java

@ -4,12 +4,13 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.ListCellRenderer;
import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
public void setRenderer(ListCellRenderer aRenderer) { public void setRenderer(ListCellRenderer aRenderer) {
if (aRenderer instanceof UIComboBoxRenderer) { if (aRenderer instanceof UIComboBoxRenderer) {
super.setRenderer(aRenderer); super.setRenderer(aRenderer);
} else {
//throw new IllegalArgumentException("Must be UIComboBoxRenderer");
} }
} }
@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return null; return null;
} }
@Override
public void setGlobalName(String name) { public void setGlobalName(String name) {
comboBoxName = name; comboBoxName = name;
} }
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素 //加5的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
} }
/** /**
@ -147,15 +148,16 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
/** /**
* *
*/ */
@Override
public void updateUI() { public void updateUI() {
setUI(getUIComboBoxUI()); setUI(getUIComboBoxUI());
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener = listener;
} }
@ -169,46 +171,28 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
} }
/** /**
* @return * @return 是否响应变更事件
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }
/** /**
* * @return 是否响应名称事件
* @return
*/ */
@Override
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
} }
/**
* @param args
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIComboBox bb = new UIComboBox(new String[]{"", "jerry", "kunsnat", "richer"});
bb.setEditable(true);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
} }

45
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -12,12 +12,17 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.*; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
@ -51,13 +56,39 @@ import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.event.*; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -736,6 +767,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
@ -752,6 +785,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板 * @param jt 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }

62
designer-base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -14,13 +14,33 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -100,12 +119,8 @@ public class JFormSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
public static final JFormSliderPane getInstance() { public static JFormSliderPane getInstance() {
// if (THIS == null) { return new JFormSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel {
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
} }
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -176,7 +192,7 @@ public class JFormSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR); // selfAdaptButton.setBackground(BACK_COLOR);
@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()} new Component[]{customButton, createSpinnerPanel()}
@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -277,7 +293,7 @@ public class JFormSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); showValue = (int) showValSpinner.getValue();

69
designer-base/src/com/fr/design/mainframe/JSliderPane.java

@ -15,13 +15,34 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -59,7 +80,6 @@ public class JSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -70,12 +90,14 @@ public class JSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
private UIRadioButton customButton; private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 /**
* 拖动条处理和button直接输入不一样
*/
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
private PopupPane dialog; private PopupPane dialog;
private int upButtonX; private int upButtonX;
@ -99,7 +121,7 @@ public class JSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -109,12 +131,8 @@ public class JSliderPane extends JPanel {
} }
public static final JSliderPane getInstance() { public static JSliderPane getInstance() {
// if (THIS == null) { return new JSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
@ -178,7 +196,7 @@ public class JSliderPane extends JPanel {
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -187,7 +205,7 @@ public class JSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -205,7 +223,7 @@ public class JSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -228,7 +246,7 @@ public class JSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
selfAdaptButton.setBackground(BACK_COLOR); selfAdaptButton.setBackground(BACK_COLOR);
@ -238,7 +256,7 @@ public class JSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null}, new Component[]{selfAdaptButton, null},
@ -259,14 +277,14 @@ public class JSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -289,7 +307,7 @@ public class JSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -309,7 +327,7 @@ public class JSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -325,7 +343,7 @@ public class JSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -353,7 +371,7 @@ public class JSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); showValue = (int) showValSpinner.getValue();
@ -390,7 +408,7 @@ public class JSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) { } else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else { } else {
times = (int) (SIX * value - TWO_HUNDRED); times = SIX * value - TWO_HUNDRED;
} }
} }
@ -448,11 +466,9 @@ class JSliderPaneUI extends BasicSliderUI {
super(b); super(b);
} }
/** */
/** /**
* 绘制指示物 * 绘制指示物
*/ */
public void paintThumb(Graphics g) { public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect; Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -460,7 +476,6 @@ class JSliderPaneUI extends BasicSliderUI {
g2d.dispose(); g2d.dispose();
} }
/** */
/** /**
* 绘制刻度轨迹 * 绘制刻度轨迹
*/ */

9
designer-base/src/com/fr/design/selection/QuickEditor.java

@ -2,7 +2,7 @@ package com.fr.design.selection;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import javax.swing.*; import javax.swing.JComponent;
/** /**
* 快速编辑区域 * 快速编辑区域
@ -39,11 +39,15 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
tc.fireTargetModified(); tc.fireTargetModified();
} }
/**
* 刷新面板
*/
protected abstract void refresh(); protected abstract void refresh();
/** /**
* for 关闭时候释放 * 关闭模板时释放模板对象
* 所有持有tc的对象也必须置空或者丢弃对于tc的引用
*/ */
public void release() { public void release() {
tc = null; tc = null;
@ -53,7 +57,6 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
@Override @Override
protected void refresh() { protected void refresh() {
} }
}; };

2
designer-chart/src/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -145,7 +145,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
if (result) { if (result) {
//安装文件 //安装文件
IOUtils.unZipFilesGBK(temp, FRContext.getCurrentEnv().getPath() + siteInfo.localDir); IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), siteInfo.localDir));
} }
} else { } else {
result = false; result = false;

5
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -292,6 +292,11 @@ public class XWAbsoluteLayout extends XLayoutContainer {
this.setLayout(new FRAbsoluteLayout()); this.setLayout(new FRAbsoluteLayout());
} }
@Override
protected void initStyle() {
// do nothing
}
/** /**
* 是否支持标题样式 * 是否支持标题样式
* *

3
designer-form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -1,9 +1,9 @@
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -29,6 +29,7 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
* *
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
@Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = super.createNameableCreators(); NameableCreator[] creators = super.createNameableCreators();
for (int i = 0; i < creators.length; i++) { for (int i = 0; i < creators.length; i++) {

34
designer-form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
@ -107,6 +108,7 @@ public class FormSelectionUtils {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Large_To_Paste")); designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Large_To_Paste"));
return; return;
} }
resetTabSub2RealSize(copiedCreator);
boolean addSuccess = adapter.addBean(copiedCreator, point.x, point.y); boolean addSuccess = adapter.addBean(copiedCreator, point.x, point.y);
if (addSuccess) { if (addSuccess) {
designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator); designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator);
@ -121,6 +123,34 @@ public class FormSelectionUtils {
} }
/**
* REPORT-6096 复制得到的是显示的大小如果因屏幕分辨率问题存在缩放的话显示大小和实际大小会有区别粘贴后tab内部调整大小时会再次缩放导致问题
* 因此在粘贴之前将tab内部的组件调整成实际的大小
*
* @param copiedCreator 复制的组件
*/
private static void resetTabSub2RealSize(XCreator copiedCreator) {
ArrayList<?> childrenList = copiedCreator.getTargetChildrenList();
if (!childrenList.isEmpty()) {
for (Object aChildrenList : childrenList) {
XWTabFitLayout tabLayout = (XWTabFitLayout) aChildrenList;
double percent = tabLayout.getContainerPercent();
Component[] components = tabLayout.getComponents();
for (Component component : components) {
Rectangle show = component.getBounds();
component.setBounds(new Rectangle((int) (show.x * percent), (int) (show.y * percent), (int) (show.width * percent), (int) (show.height * percent)));
}
}
}
Component[] components = copiedCreator.getComponents();
for (Component component : components) {
try {
resetTabSub2RealSize((XCreator) component);
} catch (ClassCastException ignored) {
}
}
}
/** /**
* 相对布局粘贴 * 相对布局粘贴
*/ */
@ -178,9 +208,9 @@ public class FormSelectionUtils {
*/ */
private static Point getPasteLocation(AbstractLayoutAdapter layoutAdapter, XCreator copiedCreator, int x, int y) { private static Point getPasteLocation(AbstractLayoutAdapter layoutAdapter, XCreator copiedCreator, int x, int y) {
//当宽度为奇数时 设置偏移 //当宽度为奇数时 设置偏移
int xoffset = (copiedCreator.getWidth() & 1) == 1 ? 1 : 0; int xoffset = copiedCreator.getWidth() & 1;
//当高度为奇数时 设置偏移 //当高度为奇数时 设置偏移
int yoffset = (copiedCreator.getHeight() & 1) == 1 ? 1 : 0; int yoffset = copiedCreator.getHeight() & 1;
if (!layoutAdapter.accept(copiedCreator, x, y)) { if (!layoutAdapter.accept(copiedCreator, x, y)) {
XLayoutContainer container = layoutAdapter.getContainer(); XLayoutContainer container = layoutAdapter.getContainer();

18
designer-form/src/com/fr/design/mainframe/WidgetToolBarPane.java

@ -10,8 +10,20 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.JComponent;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Stroke;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
@ -47,7 +59,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide
} }
public void refreshToolbar() { public void refreshToolbar() {
reset(); singleton.reset();
} }
public static void refresh() { public static void refresh() {

55
designer-realize/src/com/fr/design/dscolumn/DSColumnBasicPane.java

@ -14,8 +14,9 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -27,6 +28,29 @@ public class DSColumnBasicPane extends BasicPane {
private ExpandDirectionPane expandDirectionPane; private ExpandDirectionPane expandDirectionPane;
private CellElement cellElement; private CellElement cellElement;
private ActionListener summaryDirectionActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(true);
}
}
};
private ActionListener othergroupDirectionActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(false);
}
}
};
private ActionListener sdcupdateActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
selectDataColumnPane.update(cellElement);
}
};
public DSColumnBasicPane() { public DSColumnBasicPane() {
this(DSColumnPane.SETTING_ALL); this(DSColumnPane.SETTING_ALL);
} }
@ -78,7 +102,7 @@ public class DSColumnBasicPane extends BasicPane {
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
this.resultSetGroupPane.addListeners(summary_direction_ActionListener, otherGroup_direction_ActionListener, sdcUpdate_ActionListener); this.resultSetGroupPane.addListeners(summaryDirectionActionlistener, othergroupDirectionActionlistener, sdcupdateActionlistener);
} }
@Override @Override
@ -93,7 +117,7 @@ public class DSColumnBasicPane extends BasicPane {
this.cellElement = cellElement; this.cellElement = cellElement;
selectDataColumnPane.populate(source, cellElement); selectDataColumnPane.populate(source, cellElement, null);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (conditionParentPane != null) { if (conditionParentPane != null) {
@ -134,29 +158,6 @@ public class DSColumnBasicPane extends BasicPane {
resultSetGroupPane.update(); resultSetGroupPane.update();
} }
ActionListener summary_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(true);
}
}
};
ActionListener otherGroup_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(false);
}
}
};
ActionListener sdcUpdate_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
selectDataColumnPane.update(cellElement);
}
};
public void putElementcase(ElementCasePane t) { public void putElementcase(ElementCasePane t) {
if (conditionParentPane != null) { if (conditionParentPane != null) {
conditionParentPane.putElementcase(t); conditionParentPane.putElementcase(t);

130
designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java

@ -1,26 +1,30 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
* @author null
* @version 2018年2月9日13点47分
* @since 8.0
*/
public class DSColumnPane extends BasicPane { public class DSColumnPane extends BasicPane {
private TableDataSource tplEC; private TableDataSource tplEC;
@ -29,13 +33,52 @@ public class DSColumnPane extends BasicPane {
private DSColumnConditionsPane conditionPane = null; private DSColumnConditionsPane conditionPane = null;
private DSColumnAdvancedPane advancedPane = null; private DSColumnAdvancedPane advancedPane = null;
private TemplateCellElement cellElement; private TemplateCellElement cellElement;
protected Component lastSelectedComponent; private Component lastSelectedComponent;
public static final int SETTING_ALL = 2; public static final int SETTING_ALL = 2;
public static final int SETTING_DSRELATED = 1; public static final int SETTING_DSRELATED = 1;
private ChangeListener appliedWizardTabChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
try {
if (lastSelectedComponent == null) {
lastSelectedComponent = basicPane;
}
// selectTabComponent是正要切换到的那个Pane
Component selectTabComponent = tabbedPane.getSelectedComponent();
// denny: 如果切换Tab时上一个Pane是basicPane, 则刷新一下其他Pane,
// 因为选择的数据列可能改变, 导致后面过滤和使用公式用到的数据项改变
if (lastSelectedComponent == basicPane) {
basicPane.update(cellElement);
// denny_GUI: 刷新其他面板
refreshOtherTabs();
}
// 切换标签的时候就,确认是否有没有添加到列表中的条件
lastSelectedComponent = selectTabComponent;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
};
/**
* cellElement 改变时刷新一下
* 比如上边切换Tab时basicPane Update了一下可能会改变Field cellElement的值
*/
private PropertyChangeListener myPropertyChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
refreshOtherTabs();
}
};
public DSColumnPane() { public DSColumnPane() {
this.initComponents(SETTING_ALL); this(SETTING_ALL);
} }
public DSColumnPane(int setting) { public DSColumnPane(int setting) {
@ -71,8 +114,12 @@ public class DSColumnPane extends BasicPane {
return Inter.getLocText("ExpandD-Data_Column"); return Inter.getLocText("ExpandD-Data_Column");
} }
/* /**
* populate * 更新面板信息
*
* @param tds 数据源
* @param cellElement 单元格
* @throws Exception e
*/ */
public void populate(TableDataSource tds, TemplateCellElement cellElement) throws Exception { public void populate(TableDataSource tds, TemplateCellElement cellElement) throws Exception {
this.tplEC = tds; this.tplEC = tds;
@ -85,15 +132,18 @@ public class DSColumnPane extends BasicPane {
// _denny: 这边需要克隆一下,因为在设置时,可能改变字段cellElement,但改变真实值是不被期望的 // _denny: 这边需要克隆一下,因为在设置时,可能改变字段cellElement,但改变真实值是不被期望的
try { try {
this.cellElement = (TemplateCellElement) cellElement.clone(); this.cellElement = (TemplateCellElement) cellElement.clone();
} catch (CloneNotSupportedException ce) { } catch (CloneNotSupportedException ignored) {
} }
//REPORT-7744 9.0里面过滤条件和高级设置可以通过其他地方设置,populate的时候需要更新所有面板的信息,防止设置丢失
this.basicPane.populate(tds, this.cellElement); this.basicPane.populate(tds, this.cellElement);
this.conditionPane.populate(tds, this.cellElement); this.conditionPane.populate(tds, this.cellElement);
this.advancedPane.populate(this.cellElement); this.advancedPane.populate(this.cellElement);
} }
/* /**
* update * update 保存
*
* @return 单元格信息
*/ */
public CellElement update() { public CellElement update() {
this.basicPane.update(cellElement); this.basicPane.update(cellElement);
@ -101,49 +151,19 @@ public class DSColumnPane extends BasicPane {
this.advancedPane.update(cellElement); this.advancedPane.update(cellElement);
return cellElement; return cellElement;
} }
public ChangeListener appliedWizardTabChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) { /**
try { * denny:当数据tab中的数据发生变化的时候刷新后面的tab
if (lastSelectedComponent == null) { */
lastSelectedComponent = basicPane; private void refreshOtherTabs() {
} // deny:当JTabPane中加入一个Pane时,后面的Pane可能还没有初始化
//selectTabComponent是正要切换到的那个Pane
Component selectTabComponent = tabbedPane.getSelectedComponent();
// _denny: 如果切换Tab时上一个Pane是basicPane, 则刷新一下其他Pane,
// 因为选择的数据列可能改变, 导致后面过滤和使用公式用到的数据项改变
if (lastSelectedComponent == basicPane) {
basicPane.update(cellElement);
// denny_GUI: 刷新其他面板
refrushOtherTabs();
}
// 切换标签的时候就,确认是否有没有添加到列表中的条件
lastSelectedComponent = selectTabComponent;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
};
// cellElement 改变时,刷新一下
// 比如:上边切换Tab时,basicPane Update了一下,可能会改变Field cellElement的值
PropertyChangeListener myPropertyChangeListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
refrushOtherTabs();
}
};
//_denny:当数据tab中的数据发生变化的时候刷新后面的tab
public void refrushOtherTabs() {
// ——deny:当JTabPane中加入一个Pane时,后面的Pane可能还没有初始化
if (conditionPane == null || advancedPane == null) { if (conditionPane == null || advancedPane == null) {
return; return;
} }
this.conditionPane.populate(tplEC, cellElement); this.conditionPane.populate(tplEC, cellElement);
this.advancedPane.populate(cellElement); this.advancedPane.populate(cellElement);
} }
public void putElementcase(ElementCasePane t) { public void putElementcase(ElementCasePane t) {
basicPane.putElementcase(t); basicPane.putElementcase(t);
} }

7
designer-realize/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java

@ -6,7 +6,7 @@ import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
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.Iterator; import java.util.Iterator;
@ -17,6 +17,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
super(false); super(false);
} }
@Override
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(new WorkBook()); tableNameComboBox = new TableDataComboBox(new WorkBook());
tableNameComboBox.addItemListener(new ItemListener() { tableNameComboBox.addItemListener(new ItemListener() {
@ -32,14 +33,14 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
tableNameComboBox.refresh(source); tableNameComboBox.refresh(source);
tableNameComboBox.setEditable(false); tableNameComboBox.setEditable(false);
tableNameComboBox.setEnabled(false); tableNameComboBox.setEnabled(false);
super.populate(source, cell); super.populate(source, cell, null);
try { try {
Iterator it = source.getTableDataNameIterator(); Iterator it = source.getTableDataNameIterator();
String name = (String) it.next(); String name = (String) it.next();
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name);
tableNameComboBox.setSelectedItem(wrapper); tableNameComboBox.setSelectedItem(wrapper);
tableNameComboBox.getModel().setSelectedItem(wrapper); tableNameComboBox.getModel().setSelectedItem(wrapper);
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
} }

173
designer-realize/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -26,14 +26,18 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -45,27 +49,83 @@ import java.util.regex.Pattern;
* @since 8.0 * @since 8.0
*/ */
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
/**
* 参数编辑器面板
*/
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
/**
* 参数
*/
private Parameter[] ps; private Parameter[] ps;
/**
* 数据集下拉框
*/
TableDataComboBox tableNameComboBox; TableDataComboBox tableNameComboBox;
/**
* 动态参数注入按钮
*/
private UIButton paramButton;
/**
* 数据列下拉框
*/
LazyComboBox columnNameComboBox; LazyComboBox columnNameComboBox;
/**
* 数据集下拉框和数据列下拉框监听器
*/
private ItemListener itemListener; private ItemListener itemListener;
private UIButton paramButton;
public SelectedDataColumnPane() { /**
this(true, false, null, null); * 当前编辑的模板面板用于触发保存操作
*/
private ElementCasePane casePane;
/**
* 保存当前选中的 CE
*/
private CellElement cellElement;
private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]");
/**
* 数据集下拉框变动后修改数据列下拉框加载状态的监听器
*/
private ItemListener isNeedReloadListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
columnNameComboBox.setLoaded(false);
}
}
};
/**
* 创建横向布局附带显示动态参数注入按钮的数据集数据列选择面板
*/
SelectedDataColumnPane() {
this(true, false);
} }
public SelectedDataColumnPane(boolean showParameterButton) { /**
this(showParameterButton, false, null, null); * 创建横向布局的数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
*/
SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false);
} }
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) { /**
* 创建数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
* @param verticalLayout 是否是垂直布局
*/
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout) {
if (verticalLayout) { if (verticalLayout) {
initComponentVerticalLayout(casePane, cellElement); initComponentVerticalLayout();
} else { } else {
initComponent(showParameterButton); initComponent(showParameterButton);
} }
@ -79,7 +139,7 @@ public class SelectedDataColumnPane extends BasicPane {
public void initComponent(boolean showParameterButton) { public void initComponent(boolean showParameterButton) {
initTableNameComboBox(); initTableNameComboBox();
if (showParameterButton) { if (showParameterButton) {
initWithParameterButton(); initParameterButton();
} }
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@ -119,9 +179,9 @@ public class SelectedDataColumnPane extends BasicPane {
/** /**
* 初始化竖直布局的组件 * 初始化竖直布局的组件
*/ */
public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) { private void initComponentVerticalLayout() {
initTableNameComboBox(); initTableNameComboBox();
initWithParameterButton(casePane, cellElement); initVerticalParameterButton();
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@Override @Override
public Object[] load() { public Object[] load() {
@ -149,13 +209,22 @@ public class SelectedDataColumnPane extends BasicPane {
} }
public void populate(TableDataSource source, TemplateCellElement cellElement) { /**
* 更新面板数据
*
* @param source 数据源
* @param cellElement 单元格
* @param casePane 当前编辑的模板面板
*/
public void populate(TableDataSource source, TemplateCellElement cellElement, ElementCasePane casePane) {
tableNameComboBox.refresh(source);
this.casePane = casePane;
if (cellElement == null) { if (cellElement == null) {
return; return;
} }
if (itemListener != null) { this.cellElement = cellElement;
removeListener(itemListener); removeListener();
}
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
@ -166,9 +235,14 @@ public class SelectedDataColumnPane extends BasicPane {
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
ps = dsColumn.getParameters(); ps = dsColumn.getParameters();
addListener(itemListener); addListener();
} }
/**
* 保存数据到单元格对象中
*
* @param cellElement 单元格
*/
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
return; return;
@ -177,7 +251,7 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) { if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
return; return;
} }
DSColumn dsColumn = null; DSColumn dsColumn;
if (value == null || !(value instanceof DSColumn)) { if (value == null || !(value instanceof DSColumn)) {
dsColumn = new DSColumn(); dsColumn = new DSColumn();
cellElement.setValue(dsColumn); cellElement.setValue(dsColumn);
@ -185,18 +259,27 @@ public class SelectedDataColumnPane extends BasicPane {
dsColumn = (DSColumn) cellElement.getValue(); dsColumn = (DSColumn) cellElement.getValue();
SimpleDSColumn simpleDSColumn = updateColumnPane(); SimpleDSColumn simpleDSColumn = updateColumnPane();
dsColumn.setDSName(simpleDSColumn.getDsName()); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName());
dsColumn.setColumn(simpleDSColumn.getColumn()); dsColumn.setColumn(simpleDSColumn.getColumn());
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
} }
/**
* 释放模板对象
*/
public void release() {
this.cellElement = null;
this.casePane = null;
this.tableNameComboBox.setModel(new DefaultComboBoxModel());
}
/** /**
* 更新面板 * 更新面板
* *
* @return 更新后的值 * @return 更新后的值
*/ */
public SimpleDSColumn updateColumnPane() { private SimpleDSColumn updateColumnPane() {
SimpleDSColumn dsColumn = new SimpleDSColumn(); SimpleDSColumn dsColumn = new SimpleDSColumn();
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem(); TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
if (tableDataWrappe == null) { if (tableDataWrappe == null) {
@ -206,9 +289,8 @@ public class SelectedDataColumnPane extends BasicPane {
TableDataColumn column; TableDataColumn column;
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); String columnExp = (String) this.columnNameComboBox.getSelectedItem();
if (isColumnName(columnExp)) { if (isColumnName(columnExp)) {
String number = columnExp.substring(1); String number = Objects.requireNonNull(columnExp).substring(1);
Pattern pattern = Pattern.compile("[^\\d]"); if (COLUMN_NAME_PATTERN.matcher(number).find()) {
if (pattern.matcher(number).find()) {
column = TableDataColumn.createColumn(columnExp); column = TableDataColumn.createColumn(columnExp);
} else { } else {
int serialNumber = Integer.parseInt(columnExp.substring(1)); int serialNumber = Integer.parseInt(columnExp.substring(1));
@ -221,36 +303,31 @@ public class SelectedDataColumnPane extends BasicPane {
return dsColumn; return dsColumn;
} }
public void setListener(ItemListener i) {
this.itemListener = i;
}
/** /**
* 添加监听事件 * 添加监听事件
*
* @param i 监听事件
*/ */
public void addListener(ItemListener i) { private void addListener() {
itemListener = i; tableNameComboBox.addItemListener(this.itemListener);
tableNameComboBox.addItemListener(i); columnNameComboBox.addItemListener(this.itemListener);
columnNameComboBox.addItemListener(i); tableNameComboBox.addItemListener(this.isNeedReloadListener);
} }
/** /**
* 移除监听事件 * 移除监听事件
*
* @param i 监听事件
*/ */
public void removeListener(ItemListener i) { private void removeListener() {
tableNameComboBox.removeItemListener(i); tableNameComboBox.removeItemListener(this.itemListener);
columnNameComboBox.removeItemListener(i); columnNameComboBox.removeItemListener(this.itemListener);
tableNameComboBox.removeItemListener(this.isNeedReloadListener);
} }
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false);
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); tableNameComboBox.setPreferredSize(new Dimension(100, 20));
} }
@ -260,8 +337,8 @@ public class SelectedDataColumnPane extends BasicPane {
} }
private void initWithParameterButton() { private void initParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -279,18 +356,18 @@ public class SelectedDataColumnPane extends BasicPane {
}); });
} }
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) { private void initVerticalParameterButton() {
final SelectedDataColumnPane that = this; editorPane = new UITableEditorPane<>(new ParameterTableModel());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection")); paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
List<ParameterProvider> parameterList = editorPane.update(); List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]); ps = parameterList.toArray(new Parameter[parameterList.size()]);
that.update(cellElement); update(SelectedDataColumnPane.this.cellElement);
casePane.fireTargetModified(); casePane.fireTargetModified();
} }
}); });
@ -310,6 +387,6 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() != null) { if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();
} }
return new ArrayList<String>(); return new ArrayList<>();
} }
} }

7
designer-realize/src/com/fr/design/mainframe/ElementCasePane.java

@ -524,6 +524,13 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* 因为这边判断selection是一个selection所以不会触发fireSelectionChanged * 因为这边判断selection是一个selection所以不会触发fireSelectionChanged
*/ */
public void setSelection(Selection selection) { public void setSelection(Selection selection) {
try {
//旧选中内容编辑器释放模板对象
this.getCurrentEditor().release();
} catch (UnsupportedOperationException e) {
FRContext.getLogger().info("Nothing to release");
}
if (!ComparatorUtils.equals(this.selection, selection) || if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection; this.selection = selection;

36
designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -1,38 +1,42 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*; import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction; import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.report.worksheet.WorkSheet; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块. * 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -81,11 +85,11 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor()); QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
// 模板初始化完成后,才能初始化超级链接面板
if (editingTemplate != null && !editingTemplate.isUpMode()) { if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = getSelection(); Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板 // 获取超级链接面板并刷新显示
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) { if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout()); JPanel floatPane = new JPanel(new BorderLayout());

3
designer-realize/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -127,10 +127,9 @@ public class ReportComponentComposite extends JComponent {
templateStateList.add(null); templateStateList.add(null);
} }
centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement());
if (jSliderContainer != null){ jSliderContainer=JSliderPane.getInstance();
jSliderContainer.reset(); jSliderContainer.reset();
} }
}
if (centerCardPane.editingComponet.elementCasePane == null) { if (centerCardPane.editingComponet.elementCasePane == null) {
centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener); centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);

5
designer-realize/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java

@ -24,4 +24,9 @@ public class ReportHyperlinkGroupPaneNoPop extends ReportHyperlinkGroupPane{
protected boolean isNewStyle() { protected boolean isNewStyle() {
return false; return false;
} }
@Override
public boolean needAutoSave() {
return false;
}
} }

90
designer-realize/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -11,7 +11,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
@ -32,27 +31,42 @@ import java.util.Date;
*/ */
public class UserInfoPane extends BasicPane { public class UserInfoPane extends BasicPane {
//默认未登录颜色 /**
* 默认未登录颜色
*/
private static final Color UN_LOGIN_BACKGROUND = UIConstants.TEMPLATE_TAB_PANE_BACKGROUND; private static final Color UN_LOGIN_BACKGROUND = UIConstants.TEMPLATE_TAB_PANE_BACKGROUND;
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242); private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static final int WIDTH = 104; private static final int WIDTH = 104;
private static final int HEIGHT = 24; private static final int HEIGHT = 24;
//登录成功 /**
* 登录成功
*/
private static final String LOGININ = "0"; private static final String LOGININ = "0";
// 登录框弹出间隔时间 /**
* 登录框弹出间隔时间
*/
private static final int LOGIN_DIFF_DAY = 7; private static final int LOGIN_DIFF_DAY = 7;
// 等待国际化等相关初始化工作完成之后再弹出登录框 /**
* 等待国际化等相关初始化工作完成之后再弹出登录框
*/
private static final int WAIT_TIME = 10000; private static final int WAIT_TIME = 10000;
private UserInfoLabel userInfoLabel; private UserInfoLabel userInfoLabel;
private static UserInfoPane instance = new UserInfoPane();
public static UserInfoPane getInstance() {
return instance;
}
/** /**
* 构造函数 * 构造函数
*/ */
public UserInfoPane() { private UserInfoPane() {
this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -73,6 +87,34 @@ public class UserInfoPane extends BasicPane {
this.userInfoLabel = userInfoLabel; this.userInfoLabel = userInfoLabel;
} }
/**
* 标志未登录状态, 面板设置为灰色
*/
public void markUnSignIn() {
this.userInfoLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
this.userInfoLabel.setOpaque(true);
this.userInfoLabel.setBackground(UN_LOGIN_BACKGROUND);
this.userInfoLabel.resetUserName();
}
/**
* 标志登陆状态, 面包设置为蓝色
*
* @param userName 用户名
*/
public void markSignIn(String userName) {
this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true);
this.userInfoLabel.setBackground(LOGIN_BACKGROUND);
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
private void addEnvChangedListener() { private void addEnvChangedListener() {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override @Override
@ -90,11 +132,15 @@ public class UserInfoPane extends BasicPane {
} }
// 计算xml保存的上次弹框时间和当前时间的时间差 /**
* 计算xml保存的上次弹框时间和当前时间的时间差
*
* @return 时间差
*/
private int getDiffFromLastLogin() { private int getDiffFromLastLogin() {
String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime(); String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date lastBBSDate = null; Date lastBBSDate;
try { try {
if (lastBBSTime != null) { if (lastBBSTime != null) {
synchronized (this) { synchronized (this) {
@ -108,7 +154,7 @@ public class UserInfoPane extends BasicPane {
return dayNew - dayOld; return dayNew - dayOld;
} }
} catch (ParseException e) { } catch (ParseException e) {
FRLogger.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
return 1; return 1;
} }
@ -153,31 +199,5 @@ public class UserInfoPane extends BasicPane {
showBBSThread.start(); showBBSThread.start();
} }
/**
* 标志未登录状态, 面板设置为灰色
*/
public void markUnSignIn() {
this.userInfoLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
this.userInfoLabel.setOpaque(true);
this.userInfoLabel.setBackground(UN_LOGIN_BACKGROUND);
this.userInfoLabel.resetUserName();
}
/**
* 标志登陆状态, 面包设置为蓝色
*
* @param userName 用户名
*/
public void markSignIn(String userName) {
this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true);
this.userInfoLabel.setBackground(LOGIN_BACKGROUND);
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
} }

5
designer-realize/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java

@ -120,4 +120,9 @@ public abstract class AbstractDSCellEditorPane extends JPanel {
scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP); scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP);
scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground())); scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground()));
} }
/**
* 释放tc
*/
protected abstract void release();
} }

32
designer-realize/src/com/fr/design/module/DesignerModule.java

@ -150,23 +150,23 @@ public class DesignerModule extends DesignModule {
*/ */
private void registerCellEditor() { private void registerCellEditor() {
ActionFactory.registerCellEditorClass(String.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditorClass(Number.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class); ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditorClass(SubReport.class, CellSubReportEditor.class); ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditorClass(RichText.class, CellRichTextEditor.class); ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditorClass(DSColumn.class, CellDSColumnEditor.class); ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class); ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class); ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class); ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor()); ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class); ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {
try { try {
ActionFactory.registerCellEditorClass(provider.targetObjectClass(), provider.quickEditor()); ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e); FRLogger.getLogger().error(e.getMessage(), e);
} }
@ -185,12 +185,12 @@ public class DesignerModule extends DesignModule {
*/ */
private void registerFloatEditor() { private void registerFloatEditor() {
ActionFactory.registerFloatEditorClass(String.class, FloatStringQuickEditor.class); ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class); ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class); ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class); ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor()); ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class); ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
} }

28
designer-realize/src/com/fr/grid/selection/CellSelection.java

@ -49,8 +49,9 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -114,6 +115,7 @@ public class CellSelection extends Selection {
/** /**
* 增加选中的区域 * 增加选中的区域
*
* @param cellRectangle 区域 * @param cellRectangle 区域
*/ */
public void addCellRectangle(Rectangle cellRectangle) { public void addCellRectangle(Rectangle cellRectangle) {
@ -164,6 +166,7 @@ public class CellSelection extends Selection {
/** /**
* 清除区域块 * 清除区域块
*
* @param i 区域块 * @param i 区域块
*/ */
public void clearCellRectangles(int i) { public void clearCellRectangles(int i) {
@ -172,6 +175,7 @@ public class CellSelection extends Selection {
/** /**
* 包含单元格 * 包含单元格
*
* @param column * @param column
* @param row * @param row
* @return 若不包含返回-1 * @return 若不包含返回-1
@ -205,6 +209,7 @@ public class CellSelection extends Selection {
/** /**
* 转换成矩形 * 转换成矩形
*
* @return 矩形 * @return 矩形
*/ */
public Rectangle toRectangle() { public Rectangle toRectangle() {
@ -213,6 +218,7 @@ public class CellSelection extends Selection {
/** /**
* 是否选择一个单元格 * 是否选择一个单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回rue * @return 是则返回rue
*/ */
@ -239,6 +245,7 @@ public class CellSelection extends Selection {
/** /**
* 作为可传输的 * 作为可传输的
*
* @param transferable 传输介质 * @param transferable 传输介质
* @param ePane 区域 * @param ePane 区域
*/ */
@ -264,6 +271,7 @@ public class CellSelection extends Selection {
/** /**
* 黏贴单元格 * 黏贴单元格
*
* @param ceClip 单元格 * @param ceClip 单元格
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
@ -281,6 +289,7 @@ public class CellSelection extends Selection {
/** /**
* 黏贴字符串 * 黏贴字符串
*
* @param str 字符串 * @param str 字符串
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
@ -329,6 +338,7 @@ public class CellSelection extends Selection {
/** /**
* 黏贴其他 * 黏贴其他
*
* @param ob 要黏贴的东西 * @param ob 要黏贴的东西
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
@ -352,6 +362,7 @@ public class CellSelection extends Selection {
/** /**
* 是否能合并单元格 * 是否能合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回true * @return 是则返回true
*/ */
@ -363,6 +374,7 @@ public class CellSelection extends Selection {
/** /**
* 合并单元格 * 合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -371,7 +383,7 @@ public class CellSelection extends Selection {
TemplateElementCase ec = ePane.getEditingElementCase(); TemplateElementCase ec = ePane.getEditingElementCase();
Iterator cells = ec.intersect(column, row, columnSpan, rowSpan); Iterator cells = ec.intersect(column, row, columnSpan, rowSpan);
if (cells.hasNext() && cells.hasNext()) { // alex:有两个以上的格子在这个区域内 if (cells.hasNext()) { // alex:有两个以上的格子在这个区域内
int returnValue = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ePane), Inter.getLocText("Des-Merger_Cell"), Inter.getLocText("Utils-Merge_Cell"), int returnValue = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ePane), Inter.getLocText("Des-Merger_Cell"), Inter.getLocText("Utils-Merge_Cell"),
JOptionPane.OK_CANCEL_OPTION); JOptionPane.OK_CANCEL_OPTION);
if (returnValue != JOptionPane.OK_OPTION) { if (returnValue != JOptionPane.OK_OPTION) {
@ -386,6 +398,7 @@ public class CellSelection extends Selection {
/** /**
* 是否撤销合并单元格 * 是否撤销合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回true * @return 是则返回true
*/ */
@ -407,6 +420,7 @@ public class CellSelection extends Selection {
/** /**
* 撤销合并单元格 * 撤销合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -443,6 +457,7 @@ public class CellSelection extends Selection {
/** /**
* 创建弹出菜单 * 创建弹出菜单
*
* @param ePane 区域 * @param ePane 区域
* @return 菜单 * @return 菜单
*/ */
@ -497,6 +512,7 @@ public class CellSelection extends Selection {
/** /**
* 清除 * 清除
*
* @param type 要清除的类型 * @param type 要清除的类型
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
@ -581,6 +597,7 @@ public class CellSelection extends Selection {
/** /**
* 向左移动 * 向左移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveLeft(ElementCasePane ePane) { public void moveLeft(ElementCasePane ePane) {
@ -592,6 +609,7 @@ public class CellSelection extends Selection {
/** /**
* 向右移动 * 向右移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveRight(ElementCasePane ePane) { public void moveRight(ElementCasePane ePane) {
@ -600,6 +618,7 @@ public class CellSelection extends Selection {
/** /**
* 向上移动 * 向上移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveUp(ElementCasePane ePane) { public void moveUp(ElementCasePane ePane) {
@ -611,6 +630,7 @@ public class CellSelection extends Selection {
/** /**
* 向下移动 * 向下移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveDown(ElementCasePane ePane) { public void moveDown(ElementCasePane ePane) {
@ -626,6 +646,7 @@ public class CellSelection extends Selection {
/** /**
* 触发删除动作 * 触发删除动作
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -657,6 +678,7 @@ public class CellSelection extends Selection {
/** /**
* 包含行列 * 包含行列
*
* @param cr 行列 * @param cr 行列
* @return 包含返回true * @return 包含返回true
*/ */

15
designer-realize/src/com/fr/grid/selection/FloatSelection.java

@ -5,7 +5,12 @@ import com.fr.base.FRContext;
import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.cell.FloatStyleAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.*; import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.DeleteAction;
import com.fr.design.actions.edit.EditFloatElementNameAction;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.actions.edit.order.BringFloatElementForwardAction; import com.fr.design.actions.edit.order.BringFloatElementForwardAction;
import com.fr.design.actions.edit.order.BringFloatElementToFrontAction; import com.fr.design.actions.edit.order.BringFloatElementToFrontAction;
import com.fr.design.actions.edit.order.SendFloatElementBackwardAction; import com.fr.design.actions.edit.order.SendFloatElementBackwardAction;
@ -28,10 +33,12 @@ import com.fr.stable.ColumnRow;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
import javax.swing.*; import javax.swing.JPopupMenu;
import java.awt.*; import java.awt.Toolkit;
/** /**
* the float selection * the float selection
*
* @editor zhou * @editor zhou
* 2012-3-22下午2:09:20 * 2012-3-22下午2:09:20
*/ */
@ -216,6 +223,7 @@ public class FloatSelection extends Selection {
public boolean isSelectedOneCell(ElementCasePane ePane) { public boolean isSelectedOneCell(ElementCasePane ePane) {
return false; return false;
} }
//TODO:august 这儿不比较FloatElement会不会有问题啊 //TODO:august 这儿不比较FloatElement会不会有问题啊
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -240,7 +248,6 @@ public class FloatSelection extends Selection {
} }
public void populateWidgetPropertyPane(ElementCasePane ePane) { public void populateWidgetPropertyPane(ElementCasePane ePane) {
return;
} }
} }

12
designer-realize/src/com/fr/quickeditor/FloatQuickEditor.java

@ -1,12 +1,11 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.QuickEditor;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.design.selection.QuickEditor;
/** /**
*
* @author zhou * @author zhou
* @since 2012-7-23下午5:17:23 * @since 2012-7-23下午5:17:23
*/ */
@ -20,5 +19,14 @@ public abstract class FloatQuickEditor extends QuickEditor<ElementCasePane> {
refreshDetails(); refreshDetails();
} }
/**
* 刷新详细信息
*/
protected abstract void refreshDetails(); protected abstract void refreshDetails();
@Override
public void release() {
super.release();
floatElement = null;
}
} }

283
designer-realize/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -35,6 +35,7 @@ import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -74,9 +75,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true); private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true);
private JPanel dsColumnRegion;
private JPanel centerPane;
/** /**
* 基本和高级设置 * 基本和高级设置
*/ */
@ -117,10 +115,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
public JComponent createCenterBody() { public JComponent createCenterBody() {
this.createPanes(); this.createPanes();
this.createSwitchTab(); this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout()); JPanel dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(cardContainer, BorderLayout.CENTER); dsColumnRegion.add(cardContainer, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout()); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.add(dsColumnRegion, BorderLayout.CENTER); centerPane.add(dsColumnRegion, BorderLayout.CENTER);
return centerPane; return centerPane;
} }
@ -141,17 +139,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
/**
* 关闭时候释放
*/
@Override
public void release() {
super.release();
dsColumnRegion = null;
centerPane = null;
}
/** /**
* 初始化基本和高级设置切换tab * 初始化基本和高级设置切换tab
*/ */
@ -187,6 +174,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
paneList.add(cellDSColumnAdvancedPane); paneList.add(cellDSColumnAdvancedPane);
} }
@Override
public void release() {
super.release();
cellDSColumnBasicPane.release();
cellDSColumnAdvancedPane.release();
}
/** /**
* 单元格元素 数据列 高级设置内容面板 * 单元格元素 数据列 高级设置内容面板
@ -252,9 +245,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}; };
DSColumnBasicEditorPane() { DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true, tc, cellElement); dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane(); groupPane = new ResultSetGroupDockingPane();
dataPane.addListener(dataListener); dataPane.setListener(dataListener);
groupPane.setListener(groupListener); groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F}; double[] rowSize = {P}, columnSize = {P, F};
@ -297,13 +290,19 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
dataPane.populate(null, cellElement); dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement); groupPane.populate(cellElement);
if (tc != null) { if (tc != null) {
condition.setEditingComponent(tc); condition.setEditingComponent(tc);
} }
} }
@Override
protected void release() {
condition.setEditingComponent(null);
dataPane.release();
}
/** /**
* 创建有内容的面板显示信息 * 创建有内容的面板显示信息
@ -330,6 +329,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane { class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane {
/*pane begin*/
/** /**
* 排列顺序 * 排列顺序
*/ */
@ -353,7 +353,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
/** /**
* 补充空白数据 * 补充空白数据
*/ */
private UICheckBox useMultiplyNumCheckBox; private UICheckBox useMultiNumCheckBox;
/** /**
* 补充空白数据数目输入框 * 补充空白数据数目输入框
*/ */
@ -362,6 +362,75 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 补充空白数据数目面板 可隐藏 * 补充空白数据数目面板 可隐藏
*/ */
private JPanel multiPane; private JPanel multiPane;
/*pane end*/
/*listeners begin*/
private UIObserverListener sortPaneFormulaChangeListener = new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener sortTypeBtnGroupChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener filterPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener customValuePaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ChangeListener veCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ActionListener useMultiNumCheckBoxChangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private ChangeListener multiNumSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() { public DSColumnAdvancedEditorPane() {
@ -397,6 +466,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
disableListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
filterPane.populate(cellElement); filterPane.populate(cellElement);
@ -406,6 +476,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
// extendable // extendable
//noinspection Duplicates
switch (cellExpandAttr.getExtendable()) { switch (cellExpandAttr.getExtendable()) {
case CellExpandAttr.Both_EXTENDABLE: case CellExpandAttr.Both_EXTENDABLE:
heCheckBox.setSelected(true); heCheckBox.setSelected(true);
@ -425,13 +496,21 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
if (cellExpandAttr.getMultipleNumber() == -1) { if (cellExpandAttr.getMultipleNumber() == -1) {
useMultiplyNumCheckBox.setSelected(false); useMultiNumCheckBox.setSelected(false);
// 默认值
multiNumSpinner.setValue(1);
} else { } else {
useMultiplyNumCheckBox.setSelected(true); useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
enableListener();
}
} }
@Override
protected void release() {
} }
/** /**
@ -443,6 +522,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
//noinspection Duplicates
if (heCheckBox.isSelected()) { if (heCheckBox.isSelected()) {
if (veCheckBox.isSelected()) { if (veCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
@ -463,12 +543,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
private void updateMultipleConfig() { private void updateMultipleConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (this.useMultiplyNumCheckBox.isSelected()) { if (this.useMultiNumCheckBox.isSelected()) {
cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue()); cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue());
} else { } else {
cellExpandAttr.setMultipleNumber(-1); cellExpandAttr.setMultipleNumber(-1);
} }
} }
/** /**
@ -479,68 +558,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序 //结果集排序
sortPane = new ResultSetSortConfigPane(); sortPane = new ResultSetSortConfigPane();
sortPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
}, new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
}
);
//结果筛选 //结果筛选
filterPane = new ResultSetFilterConfigPane(); filterPane = new ResultSetFilterConfigPane();
filterPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示 //自定义值显示
valuePane = new CustomValuePane(); valuePane = new CustomValuePane();
valuePane.addListener(new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
});
//可扩展性 //可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"))); extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
heCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
veCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
//补充空白数据 //补充空白数据
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data")); JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
useMultiNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout()); JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST); checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane); multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1); multiNumSpinner = new UISpinner(1, 10000, 1, 1);
//数据倍数 //数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple")); UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
@ -551,25 +591,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
); );
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane); multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
@Override enableListener();
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
multiNumSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
double[] rowSize = {P, P, P, P, P, P}; double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F}; double[] columnSize = {F};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
@ -580,9 +606,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
} }
public void enableListener() {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener);
}
public void disableListener() {
sortPane.removeListener(sortTypeBtnGroupChangeListener);
filterPane.removeListener();
valuePane.removeListener();
heCheckBox.removeChangeListener(heCheckBoxChangeListener);
veCheckBox.removeChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener);
}
private void checkButtonEnabled() { private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) { if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true); multiNumSpinner.setEnabled(true);
multiPane.setVisible(true); multiPane.setVisible(true);
} else { } else {
@ -659,7 +705,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
this.formulaField.populateElement(cellElement); this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder(); int sort = dSColumn.getOrder();
@ -676,6 +722,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
String sortFormula = dSColumn.getSortFormula(); String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) { if (sortFormula != null && sortFormula.length() >= 1) {
this.formulaField.populate(sortFormula); this.formulaField.populate(sortFormula);
} else {
this.formulaField.populate(DEFAULT_VALUE);
} }
} }
} }
@ -689,8 +737,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText()); dSColumn.setSortFormula(this.formulaField.getFormulaText());
} }
@ -707,6 +755,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
formulaField.addListener(formulaChangeListener); formulaField.addListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener); sortTypePane.addChangeListener(changeListener);
} }
/**
* 去除事件监听器
*
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void removeListener(ChangeListener changeListener) {
formulaField.removeListener();
sortTypePane.removeChangeListener(changeListener);
}
} }
/** /**
@ -852,13 +910,18 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.removeActionListener(actionListener); rsComboBox.removeActionListener(actionListener);
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
SelectCount selectCount = dSColumn.getSelectCount(); SelectCount selectCount = dSColumn.getSelectCount();
this.topFormulaPane.populateElement(cellElement); this.topFormulaPane.populateElement(cellElement);
this.bottomFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement);
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
// 重置默认值
this.topFormulaPane.populate(DEFAULT_VALUE);
this.bottomFormulaPane.populate(DEFAULT_VALUE);
this.serialTextField.setText(StringUtils.EMPTY);
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
@ -927,6 +990,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} }
} else { } else {
this.rsComboBox.setSelectedIndex(0);
//未定义 //未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name()); setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
@ -944,8 +1008,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
int selectedFilterIndex = this.rsComboBox.getSelectedIndex(); int selectedFilterIndex = this.rsComboBox.getSelectedIndex();
if (selectedFilterIndex == 0) { if (selectedFilterIndex == 0) {
dSColumn.setSelectCount(null); dSColumn.setSelectCount(null);
@ -953,6 +1017,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex); selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
//noinspection Duplicates
if (selectedFilterIndex == TOP.getValue()) { if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == BOTTOM.getValue()) { } else if (selectedFilterIndex == BOTTOM.getValue()) {
@ -976,6 +1041,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.registerChangeListener(formulaListener); rsComboBox.registerChangeListener(formulaListener);
serialTextField.registerChangeListener(formulaListener); serialTextField.registerChangeListener(formulaListener);
} }
/**
* 去除事件监听器
*/
public void removeListener() {
topFormulaPane.removeListener();
bottomFormulaPane.removeListener();
rsComboBox.removeChangeListener();
serialTextField.registerChangeListener(null);
}
} }
/** /**
@ -1029,6 +1104,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.formulaTextField.registerChangeListener(listener); this.formulaTextField.registerChangeListener(listener);
} }
/**
* 取消事件监听器
*/
public void removeListener() {
this.formulaTextField.registerChangeListener(null);
}
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -1042,7 +1124,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName());
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true)); formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true));
@ -1086,12 +1168,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
//formula //formula
String valueFormula = dSColumn.getResult(); String valueFormula = dSColumn.getResult();
if (valueFormula != null) { if (valueFormula != null) {
formulaField.populate(valueFormula); formulaField.populate(valueFormula);
} else {
formulaField.populate(DEFAULT_VALUE);
} }
formulaField.populateElement(cellElement); formulaField.populateElement(cellElement);
@ -1102,7 +1186,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResult(this.formulaField.getFormulaText()); dSColumn.setResult(this.formulaField.getFormulaText());
} }
@ -1117,6 +1201,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void addListener(UIObserverListener formulaListener) { public void addListener(UIObserverListener formulaListener) {
this.formulaField.addListener(formulaListener); this.formulaField.addListener(formulaListener);
} }
/**
* 移除事件监听器
*/
public void removeListener() {
this.formulaField.removeListener();
}
} }
} }

7
designer-realize/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -13,7 +12,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* 单元格元素富文本编辑器 * 单元格元素富文本编辑器
@ -58,4 +56,9 @@ public class CellRichTextEditor extends CellQuickEditor {
return true; return true;
} }
@Override
public void release() {
super.release();
richTextButton.setAction(null);
}
} }

2
designer-realize/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.grid.GridKeyListener; import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -18,7 +17,6 @@ import javax.swing.JPanel;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;

6
designer-realize/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -56,4 +56,10 @@ public class CellSubReportEditor extends CellQuickEditor {
public boolean isScrollAll() { public boolean isScrollAll() {
return true; return true;
} }
@Override
public void release() {
super.release();
subReportButton.setAction(null);
}
} }

8
designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -14,8 +14,10 @@ import com.fr.general.Inter;
import com.fr.quickeditor.FloatQuickEditor; import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -73,8 +75,6 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
// TODO Auto-generated method stub
} }
} }

64
designer-realize/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -12,10 +12,16 @@ import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -27,6 +33,25 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
private boolean reserveInResult = false; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; private boolean reserveOnWriteOrAnaly = true;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
};
public FloatStringQuickEditor() { public FloatStringQuickEditor() {
super(); super();
stringTextField = new JTextArea(); stringTextField = new JTextArea();
@ -34,6 +59,12 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
formulaButton = new UIButton(); formulaButton = new UIButton();
formulaButton.setPreferredSize(new Dimension(25, 23)); formulaButton.setPreferredSize(new Dimension(25, 23));
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
formulaButton.addActionListener(getFormulaActionListener); formulaButton.addActionListener(getFormulaActionListener);
JPanel pane = new JPanel(new BorderLayout(5, 0)); JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER); pane.add(stringTextField, BorderLayout.CENTER);
@ -55,16 +86,10 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.setBackground(Color.WHITE); stringTextField.setBackground(Color.WHITE);
} }
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
String str = null; String str;
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null) { if (value == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
@ -89,26 +114,8 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.getDocument().addDocumentListener(documentListener); stringTextField.getDocument().addDocumentListener(documentListener);
} }
DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
}; private void changeReportPaneCell(String tmpText) {
protected void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText); BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
@ -125,5 +132,4 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextField.requestFocus();
} }
} }

2
designer-realize/src/com/fr/start/Designer.java

@ -369,7 +369,7 @@ public class Designer extends BaseDesigner {
@Override @Override
public Component createBBSLoginPane() { public Component createBBSLoginPane() {
if (userInfoPane == null) { if (userInfoPane == null) {
userInfoPane = new UserInfoPane(); userInfoPane = UserInfoPane.getInstance();
} }
return userInfoPane; return userInfoPane;
} }

Loading…
Cancel
Save