Browse Source

Merge pull request #1010 in BA/design from ~MOMEAK/design9.0:9.0 to 9.0

* commit 'ac1d886db71072a214cb3632590617c3619f871b': (21 commits)
  REPORT-2897 9.0设计器修改  单元格属性面板
  REPORT-3163 合作开发9.0设计器=>超级链接=>优化保存设置的时机,可正常撤销、重做;修复bug;完成
  REPORT-3348 数据列集选择组件布局修改,一些代码结构
  REPORT-3163 合作开发9.0设计器=>超级链接=>编辑后触发保存
  REPORT-3163 合作开发9.0设计器=>超级链接=>聚合报表部分
  REPORT-3163 合作开发9.0设计器=>超级链接=>重构代码,处理表单报表块的超级链接面板
  REPORT-3348 单元格元素数据列基本设置OK
  REPORT-3348 数据列基本设置添加过滤条件设置,多个文件换行符和todo
  REPORT-3348 单元格元素数据列基本设置动态加载
  REPORT-3348,踩坑,数据列展现方案确定
  REPORT-3163 合作开发9.0设计器=>调整外框架宽度
  REPORT-3163 合作开发9.0设计器=>超级链接=》国际化
  无JIRA任务,国际化加载问题
  REPORT-2897 9.0设计器修改 单元格属性-样式=》自定义样式=》单元格、对齐
  REPORT-3163 合作开发9.0设计器=>超级链接=》实时保存编辑状态
  REPORT-3163 合作开发9.0设计器=>超级链接=》调整弹窗,确保子页面正常显示
  REPORT-3163 合作开发9.0设计器=>新列表面板=》修复自定义列表项控制台报错的bug
  REPORT-3163 合作开发9.0设计器=>新列表面板=》动态调整弹出框位置
  REPORT-3163 合作开发9.0设计器=>新列表面板=》修复二次弹窗的bug
  REPORT-3163 合作开发9.0设计器=>新列表面板=》让子类重写标签内容
  ...
master
superman 7 years ago
parent
commit
c68b27bec4
  1. 3
      designer/src/com/fr/design/actions/edit/HyperlinkAction.java
  2. 3
      designer/src/com/fr/design/condition/HyperlinkPane.java
  3. 38
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java
  4. 84
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  5. 497
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  6. 7
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  7. 94
      designer/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  8. 10
      designer/src/com/fr/design/mainframe/JWorkBook.java
  9. 5
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  10. 41
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  11. 30
      designer/src/com/fr/design/mainframe/cell/CellEditorPane.java
  12. 47
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  13. 112
      designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
  14. 15
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  15. 327
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  16. 287
      designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  17. 9
      designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  18. 19
      designer/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  19. 84
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  20. 91
      designer/src/com/fr/design/present/BarCodePane.java
  21. 357
      designer/src/com/fr/design/present/CurrencyLinePane.java
  22. 10
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  23. 250
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  24. 122
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  25. 310
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  26. 150
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  27. 98
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  28. 304
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  29. 85
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  30. 72
      designer_base/src/com/fr/design/data/datapane/VerticalChoosePane.java
  31. 418
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  32. 86
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  33. 71
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  34. 8
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  35. 25
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  36. 11
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  37. 22
      designer_base/src/com/fr/design/gui/ibutton/FiveButtonLayout.java
  38. 2
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java
  39. 5
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  40. 5
      designer_base/src/com/fr/design/gui/ilist/UIList.java
  41. 686
      designer_base/src/com/fr/design/gui/style/AlignmentPane.java
  42. 386
      designer_base/src/com/fr/design/gui/style/BorderPane.java
  43. 47
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  44. 55
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  45. 41
      designer_base/src/com/fr/design/locale/designer.properties
  46. 41
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  47. 82
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  48. 80
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  49. 41
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  50. 82
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  51. 41
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  52. 2
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  53. 5
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  54. 13
      designer_base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java
  55. 147
      designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java
  56. 86
      designer_base/src/com/fr/design/present/dict/DictionaryPane.java
  57. 194
      designer_base/src/com/fr/design/present/dict/FormulaDictPane.java
  58. 97
      designer_base/src/com/fr/design/present/dict/TableDataDictPane.java
  59. 9
      designer_base/src/com/fr/start/BaseDesigner.java
  60. 10
      designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  61. 15
      designer_form/src/com/fr/design/mainframe/JForm.java

3
designer/src/com/fr/design/actions/edit/HyperlinkAction.java

@ -15,6 +15,7 @@ import com.fr.design.actions.utils.ReportActionUtils.IterAction;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -55,7 +56,7 @@ public class HyperlinkAction extends ElementCaseAction {
final TemplateElementCase report = reportPane.getEditingElementCase(); final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
final HyperlinkGroupPane pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(); final HyperlinkGroupPane pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks); pane.populate(nameHyperlinks);
final Selection sel = reportPane.getSelection(); final Selection sel = reportPane.getSelection();

3
designer/src/com/fr/design/condition/HyperlinkPane.java

@ -8,6 +8,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.*; import com.fr.js.*;
import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction;
@ -36,7 +37,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
hyperlinkButton.addActionListener(new ActionListener() { hyperlinkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
NameJavaScriptGroup nameHyperlinks = jsGroup; NameJavaScriptGroup nameHyperlinks = jsGroup;
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(); pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks); pane.populate(nameHyperlinks);
dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane)); dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane));
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {

38
designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java

@ -0,0 +1,38 @@
package com.fr.design.dscolumn;
import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.report.cell.TemplateCellElement;
/**
* 单元格元素 数据列 基本设置内容面板
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public class DSColumnAdvancedEditorPane extends CellEditorPane {
@Override
public String getIconPath() {
return "Advanced";
}
@Override
public String title4PopupWindow() {
return "Advanced";
}
@Override
public void update() {
}
@Override
public void populate(TemplateCellElement cellElement) {
}
}

84
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -0,0 +1,84 @@
package com.fr.design.dscolumn;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.report.cell.TemplateCellElement;
import javax.swing.*;
import java.awt.*;
/**
* 单元格元素 数据列 高级设置内容面板
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public class DSColumnBasicEditorPane extends CellEditorPane {
//数据集和数据列
private SelectedDataColumnPane dataPane;
//数据分组设置
private ResultSetGroupDockingPane groupPane;
//当前编辑的单元格
private TemplateCellElement cellElement;
//条件过滤按钮面板
private JPanel conditionPane;
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) {
this.setLayout(new BorderLayout());
this.cellElement = cellElement;
this.dataPane = dataPane;
this.groupPane = groupPane;
this.conditionPane = conditionPane;
this.add(this.createContentPane(), BorderLayout.CENTER);
}
@Override
public String getIconPath() {
return "Basic";
}
@Override
public String title4PopupWindow() {
return "Basic";
}
@Override
public void update() {
dataPane.update(this.cellElement);
groupPane.update();
}
@Override
public void populate(TemplateCellElement cellElement) {
this.cellElement = cellElement;
dataPane.populate(null, cellElement);
groupPane.populate(cellElement);
}
/**
* 创建有内容的面板显示信息
*
* @return content JPanel
*/
private JPanel createContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
//数据集列选择
new Component[]{this.dataPane},
//数据分组设置
new Component[]{this.groupPane},
//条件过滤
new Component[]{this.conditionPane}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
}

497
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -1,247 +1,252 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.data.DesignTableDataManager; import com.fr.data.SimpleDSColumn;
import com.fr.data.SimpleDSColumn; import com.fr.data.TableDataSource;
import com.fr.data.TableDataSource; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.dialog.BasicDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.layout.TableLayout; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.layout.TableLayout;
import com.fr.design.dialog.BasicPane; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn; 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.*;
import java.awt.*; import java.awt.*;
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.regex.Pattern; import java.util.regex.Pattern;
public class SelectedDataColumnPane extends BasicPane { /**
protected UITableEditorPane<ParameterProvider> editorPane; * 数据集列动态参数设置组件
protected Parameter[] ps; *
* @author yaoh.wu
protected TableDataComboBox tableNameComboBox; * @version 2017年7月26日
protected LazyComboBox columnNameComboBox; * 9.0设计器更新修改动态参数注入按钮部分,使其显示动态参数按钮时能在右侧边栏正常显示
private ItemListener itemListener; * @since 8.0
*/
private UIButton paramButton; public class SelectedDataColumnPane extends BasicPane {
private UITableEditorPane<ParameterProvider> editorPane;
public SelectedDataColumnPane() { private Parameter[] ps;
this(true);
} TableDataComboBox tableNameComboBox;
LazyComboBox columnNameComboBox;
public SelectedDataColumnPane(boolean showParameterButton) { private ItemListener itemListener;
initComponent(showParameterButton);
} private UIButton paramButton;
/** public SelectedDataColumnPane() {
* 初始化组件 this(true);
* }
* @param showParameterButton 是否显示参数按钮
* SelectedDataColumnPane(boolean showParameterButton) {
*/ initComponent(showParameterButton);
public void initComponent(boolean showParameterButton) { }
initTableNameComboBox();
if (showParameterButton) { /**
initWithParameterButton(); * 初始化组件
} *
columnNameComboBox = new LazyComboBox() { * @param showParameterButton 是否显示参数按钮
*/
@Override public void initComponent(boolean showParameterButton) {
public Object[] load() { initTableNameComboBox();
List<String> l = calculateColumnNameList(); if (showParameterButton) {
return l.toArray(new String[l.size()]); initWithParameterButton();
} }
columnNameComboBox = new LazyComboBox() {
}; @Override
columnNameComboBox.setEditable(true); public Object[] load() {
double p = TableLayout.PREFERRED; List<String> l = calculateColumnNameList();
UILabel label1 = new UILabel(Inter.getLocText("TableData") + ":"); return l.toArray(new String[l.size()]);
UILabel label2 = new UILabel(Inter.getLocText("DataColumn") + ":"); }
if (showParameterButton) { };
label1.setPreferredSize(new Dimension(200, 25)); columnNameComboBox.setEditable(true);
label2.setPreferredSize(new Dimension(200, 25)); double f = TableLayout.FILL;
} double p = TableLayout.PREFERRED;
if (showParameterButton) { UILabel label1 = new UILabel(Inter.getLocText("TableData"));
Component[][] comps = {{label1, null, label2}, {tableNameComboBox, paramButton, columnNameComboBox}}; UILabel label3 = new UILabel(Inter.getLocText("DataColumn"));
this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p})); if (showParameterButton) {
} else { //todo 国际化
double f = TableLayout.FILL; UILabel label2 = new UILabel("param");
double[] columnSize = {p, f}; Component[][] components = {
double[] rowSize = {p, p}; {label1, tableNameComboBox},
Component[][] components = new Component[][]{ {label2, paramButton},
new Component[]{label1, tableNameComboBox}, {label3, columnNameComboBox}
new Component[]{label2, columnNameComboBox} };
}; this.setLayout(new BorderLayout());
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}));
this.setLayout(new BorderLayout()); } else {
this.add(jPanel, BorderLayout.CENTER); double[] columnSize = {p, f};
} double[] rowSize = {p, p};
} Component[][] components = new Component[][]{
new Component[]{label1, tableNameComboBox},
protected void initTableNameComboBox() { new Component[]{label3, columnNameComboBox}
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); };
tableNameComboBox.addItemListener(new ItemListener() { JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@Override this.setLayout(new BorderLayout());
public void itemStateChanged(ItemEvent e) { this.add(jPanel, BorderLayout.CENTER);
columnNameComboBox.setLoaded(false); }
// columnNameComboBox.loadList(); }
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); public void populate(TableDataSource source, TemplateCellElement cellElement) {
} if (cellElement == null) {
return;
private void initWithParameterButton() { }
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); if (itemListener != null) {
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); removeListener(itemListener);
paramButton.addActionListener(new ActionListener() { }
public void actionPerformed(ActionEvent e) { Object value = cellElement.getValue();
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { if (!(value instanceof DSColumn)) {
@Override return;
public void doOk() { }
List<ParameterProvider> parameterList = editorPane.update(); DSColumn dsColumn = (DSColumn) value;
ps = parameterList.toArray(new Parameter[parameterList.size()]); String dsName = dsColumn.getDSName();
} tableNameComboBox.setSelectedTableDataByName(dsName);
}); columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
ps = dsColumn.getParameters();
editorPane.populate(ps == null ? new Parameter[0] : ps);
paramDialog.setVisible(true); addListener(itemListener);
} }
});
} public void update(CellElement cellElement) {
if (cellElement == null) {
@Override return;
protected String title4PopupWindow() { }
return "DSColumn"; Object value = cellElement.getValue();
} if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
return;
public void populate(TableDataSource source, TemplateCellElement cellElement) { }
if (cellElement == null) { DSColumn dsColumn = null;
return; if (value == null || !(value instanceof DSColumn)) {
} dsColumn = new DSColumn();
cellElement.setValue(dsColumn);
if (itemListener != null) { }
removeListener(itemListener); dsColumn = (DSColumn) cellElement.getValue();
}
SimpleDSColumn simpleDSColumn = updateColumnPane();
Object value = cellElement.getValue(); dsColumn.setDSName(simpleDSColumn.getDsName());
if (!(value instanceof DSColumn)) { dsColumn.setColumn(simpleDSColumn.getColumn());
return;
} dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
}
DSColumn dsColumn = (DSColumn) value;
String dsName = dsColumn.getDSName(); /**
tableNameComboBox.setSelectedTableDataByName(dsName); * 更新面板
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); *
ps = dsColumn.getParameters(); * @return 更新后的值
*/
addListener(itemListener); public SimpleDSColumn updateColumnPane() {
} SimpleDSColumn dsColumn = new SimpleDSColumn();
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
public void update(CellElement cellElement) { if (tableDataWrappe == null) {
if (cellElement == null) { return null;
return; }
} dsColumn.setDsName(tableDataWrappe.getTableDataName());
Object value = cellElement.getValue(); TableDataColumn column;
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) { String columnExp = (String) this.columnNameComboBox.getSelectedItem();
return; if (isColumnName(columnExp)) {
} String number = columnExp.substring(1);
DSColumn dsColumn = null; Pattern pattern = Pattern.compile("[^\\d]");
if (value == null || !(value instanceof DSColumn)) { if (pattern.matcher(number).find()) {
dsColumn = new DSColumn(); column = TableDataColumn.createColumn(columnExp);
cellElement.setValue(dsColumn); } else {
} int serialNumber = Integer.parseInt(columnExp.substring(1));
dsColumn = (DSColumn) cellElement.getValue(); column = TableDataColumn.createColumn(serialNumber);
}
SimpleDSColumn simpleDSColumn = updateColumnPane(); } else {
dsColumn.setDSName(simpleDSColumn.getDsName()); column = TableDataColumn.createColumn(columnExp);
dsColumn.setColumn(simpleDSColumn.getColumn()); }
dsColumn.setColumn(column);
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); return dsColumn;
} }
/** /**
* 更新面板 * 添加监听事件
* *
* @return 更新后的值 * @param i 监听事件
* */
*/ public void addListener(ItemListener i) {
public SimpleDSColumn updateColumnPane() { itemListener = i;
SimpleDSColumn dsColumn = new SimpleDSColumn(); tableNameComboBox.addItemListener(i);
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem(); columnNameComboBox.addItemListener(i);
if (tableDataWrappe == null) { }
return null;
} /**
dsColumn.setDsName(tableDataWrappe.getTableDataName()); * 移除监听事件
TableDataColumn column; *
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); * @param i 监听事件
if (isColumnName(columnExp)) { */
String number = columnExp.substring(1); public void removeListener(ItemListener i) {
Pattern pattern = Pattern.compile("[^\\d]"); tableNameComboBox.removeItemListener(i);
if (pattern.matcher(number).find()) { columnNameComboBox.removeItemListener(i);
column = TableDataColumn.createColumn(columnExp); }
} else {
int serialNumber = Integer.parseInt(columnExp.substring(1));
column = TableDataColumn.createColumn(serialNumber); protected void initTableNameComboBox() {
} tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
} else { tableNameComboBox.addItemListener(new ItemListener() {
column = TableDataColumn.createColumn(columnExp); @Override
} public void itemStateChanged(ItemEvent e) {
dsColumn.setColumn(column); columnNameComboBox.setLoaded(false);
return dsColumn; }
} });
tableNameComboBox.setPreferredSize(new Dimension(100, 20));
private boolean isColumnName(String columnExp) { }
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
@Override
} protected String title4PopupWindow() {
return "DSColumn";
/** }
* 添加监听事件
*
* @param i 监听事件 private void initWithParameterButton() {
* editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
*/ paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
public void addListener(ItemListener i) { paramButton.addActionListener(new ActionListener() {
itemListener = i; public void actionPerformed(ActionEvent e) {
tableNameComboBox.addItemListener(i); BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
columnNameComboBox.addItemListener(i); @Override
} public void doOk() {
List<ParameterProvider> parameterList = editorPane.update();
/** ps = parameterList.toArray(new Parameter[parameterList.size()]);
* 移除监听事件 }
* });
* @param i 监听事件
* editorPane.populate(ps == null ? new Parameter[0] : ps);
*/ paramDialog.setVisible(true);
public void removeListener(ItemListener i) { }
tableNameComboBox.removeItemListener(i); });
columnNameComboBox.removeItemListener(i); }
}
private List<String> calculateColumnNameList() { private boolean isColumnName(String columnExp) {
if (this.tableNameComboBox.getSelectedItem() != null) { return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); }
}
return new ArrayList<String>();
} private List<String> calculateColumnNameList() {
if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();
}
return new ArrayList<String>();
}
} }

7
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -59,7 +60,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) { if (editingTemplate != null && !editingTemplate.isUpMode()) {
// 模板初始化完成后,才能初始化超级链接面板 // 模板初始化完成后,才能初始化超级链接面板
ReportHyperlinkGroupPane.getInstance().populate(ElementCasePaneDelegate.this); // HyperlinkGroupPane hyperlinkGroupPane = ReportHyperlinkGroupPane.getInstance(HyperlinkGroupPaneActionImpl.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) { if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); // EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
@ -69,7 +72,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
} }
EastRegionContainerPane.getInstance().replaceHyperlinkPane(ReportHyperlinkGroupPane.getInstance()); EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().removeParameterPane();
} }
} }

94
designer/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java

@ -0,0 +1,94 @@
package com.fr.design.mainframe;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import java.awt.*;
/**
* Created by plough on 2017/7/26.
*/
public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionProvider {
private static HyperlinkGroupPaneActionProvider instance;
private HyperlinkGroupPaneActionImpl() {
}
public static HyperlinkGroupPaneActionProvider getInstance() {
if (instance == null) {
instance = new HyperlinkGroupPaneActionImpl();
}
return instance;
}
@Override
public void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane) {
ElementCasePane reportPane = (ElementCasePane)elementCasePane;
final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
hyperlinkGroupPane.populate(nameHyperlinks);
}
private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) {
NameJavaScriptGroup nameHyperlinks = null;
final Selection sel = reportPane.getSelection();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup();
} else {
CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow());
if (editCellElement != null) {
nameHyperlinks = editCellElement.getNameHyperlinkGroup();
}
}
return nameHyperlinks;
}
@Override
public void saveSettings(HyperlinkGroupPane hyperlinkGroupPane) {
// plough: 需要判断设计器是否初始化完成,不能用 HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()
JTemplate jt = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (jt == null) {
return;
}
ElementCasePane reportPane = (ElementCasePane)jt.getCurrentElementCasePane();
final TemplateElementCase report = reportPane.getEditingElementCase();
final Selection sel = reportPane.getSelection();
final NameJavaScriptGroup updateNameHyperlinks = hyperlinkGroupPane.updateJSGroup();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks);
} else {
ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
Style elementStyle = editCellElement.getStyle();
FRFont frFont = elementStyle.getFRFont();
if (updateNameHyperlinks.size() > 0) {
frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else {
frFont = frFont.applyForeground(Color.black);
frFont = frFont.applyUnderline(Constants.LINE_NONE);
}
editCellElement.setStyle(elementStyle.deriveFRFont(frFont));
editCellElement.setNameHyperlinkGroup(updateNameHyperlinks);
}
});
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
}

10
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -22,6 +22,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
@ -113,6 +114,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane()); EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
} }
@Override
public TargetComponent getCurrentElementCasePane() {
return getEditingElementCasePane();
}
@Override @Override
protected UIModeControlContainer createCenterPane() { protected UIModeControlContainer createCenterPane() {
parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null; parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null;
@ -825,8 +831,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
@Override @Override
public HyperlinkGroupPane getHyperLinkPane() { public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return ReportHyperlinkGroupPane.getInstance(); return ReportHyperlinkGroupPane.getInstance(hyperlinkGroupPaneActionProvider);
} }
public void setAuthorityMode(boolean isUpMode) { public void setAuthorityMode(boolean isUpMode) {

5
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -64,8 +64,6 @@ public class ReportComponentComposite extends JComponent {
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() { KeyListener showValSpinnerKeyListener = new KeyListener() {
@ -155,6 +153,9 @@ public class ReportComponentComposite extends JComponent {
} }
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus(); grid.requestFocus();
} }

41
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -1,6 +1,11 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
@ -8,6 +13,9 @@ import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import java.awt.*;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -15,36 +23,23 @@ import com.fr.report.elementcase.TemplateElementCase;
public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
private static ReportHyperlinkGroupPane singleton; private static ReportHyperlinkGroupPane singleton;
private ReportHyperlinkGroupPane() { private ReportHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(); super(hyperlinkGroupPaneActionProvider);
} }
public synchronized static ReportHyperlinkGroupPane getInstance() { public synchronized static ReportHyperlinkGroupPane getInstance(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
if (singleton == null) { if (singleton == null) {
singleton = new ReportHyperlinkGroupPane(); singleton = new ReportHyperlinkGroupPane(hyperlinkGroupPaneActionProvider);
} }
singleton.refreshPane();
return singleton; return singleton;
} }
public void populate(ElementCasePane reportPane) { private void refreshPane() {
final TemplateElementCase report = reportPane.getEditingElementCase(); ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); if (reportPane == null) {
populate(nameHyperlinks); return;
}
private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) {
NameJavaScriptGroup nameHyperlinks = null;
final Selection sel = reportPane.getSelection();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup();
} else {
CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow());
if (editCellElement != null) {
nameHyperlinks = editCellElement.getNameHyperlinkGroup();
}
} }
populate(reportPane);
return nameHyperlinks;
} }
} }

30
designer/src/com/fr/design/mainframe/cell/CellEditorPane.java

@ -0,0 +1,30 @@
package com.fr.design.mainframe.cell;
import com.fr.design.dialog.BasicPane;
import com.fr.report.cell.TemplateCellElement;
/**
* 右侧单元格元素面板抽象类
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public abstract class CellEditorPane extends BasicPane {
public abstract String getIconPath();
public abstract String title4PopupWindow();
/**
* 从面板拿数据保存
*/
public abstract void update();
/**
* 更新面板数据
*
* @param cellElement 单元格
*/
public abstract void populate(TemplateCellElement cellElement);
}

47
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -1,31 +1,28 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import java.awt.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.CellAttributeProvider; import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.dialog.BasicPane; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
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 com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.design.utils.DesignUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作 * the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作
@ -51,16 +48,6 @@ public class CellElementEditPane extends BasicPane {
private CellAttributeProvider cellAttributeProvider = null; private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
public CellElementEditPane() { public CellElementEditPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -87,19 +74,11 @@ public class CellElementEditPane extends BasicPane {
}; };
tabsHeaderIconPane.setNeedLeftRightOutLine(false); tabsHeaderIconPane.setNeedLeftRightOutLine(false);
titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes"));
titlename.setFont(new Font("Dialog", 1, 14));
titlename.setForeground(new Color(30,190,245));
title = new JPanel();
title.setLayout(new BorderLayout());
title.add(titlename, BorderLayout.NORTH);
downTitle = new JPanel(); downTitle = new JPanel();
downTitle.setLayout(new BorderLayout()); downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(title, BorderLayout.NORTH);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);
} }
@ -154,8 +133,8 @@ public class CellElementEditPane extends BasicPane {
@Override @Override
public void attributeChange() { public void attributeChange() {
boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) || boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) ||
ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell")); ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
boolean isChooseExpandPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction")); boolean isChooseExpandPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
if (isChooseExpandPane || isChooseFatherPane) { if (isChooseExpandPane || isChooseFatherPane) {
ePane.setSupportDefaultParentCalculate(true); ePane.setSupportDefaultParentCalculate(true);
} }
@ -170,7 +149,7 @@ public class CellElementEditPane extends BasicPane {
ePane.fireTargetModified(); ePane.fireTargetModified();
} }
} else { } else {
DesignUtils.errorMessage(Inter.getLocText(new String[]{"Not_use_a_cell_attribute_table_editing", "M_Insert-Float"}) + "!"); DesignUtils.errorMessage(Inter.getLocText(new String[]{"FR-Designer_Not_use_a_cell_attribute_table_editing", "FR-Designer_Float_Element"}) + "!");
} }
ePane.setSupportDefaultParentCalculate(false); ePane.setSupportDefaultParentCalculate(false);
} }
@ -191,7 +170,7 @@ public class CellElementEditPane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("CellElement-Property_Table"); return Inter.getLocText("FR-Designer_CellElement_Property_Table");
} }
@Override @Override
@ -207,7 +186,7 @@ public class CellElementEditPane extends BasicPane {
paneList.add(new CellOtherSetPane()); paneList.add(new CellOtherSetPane());
cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING); cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING);
if (cellAttributeProvider != null){ if (cellAttributeProvider != null) {
paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane()); paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane());
} }
} }

112
designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java

@ -1,57 +1,57 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import java.awt.BorderLayout; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.selection.QuickEditor;
import javax.swing.BorderFactory; import com.fr.general.Inter;
import javax.swing.JPanel;
import javax.swing.*;
import com.fr.design.gui.ilable.UILabel; import java.awt.*;
import com.fr.general.Inter;
import com.fr.design.selection.QuickEditor; /**
* QuickEditorRegion
/** *
* QuickEditorRegion * @author zhou, yaoh.wu
* * @version 2017年7月25日
* @editor zhou * @since 8.0
* @since 2012-3-23下午3:21:36 */
*/
public class QuickEditorRegion extends JPanel {
public class QuickEditorRegion extends JPanel {
public static QuickEditorRegion getInstance() { private static QuickEditorRegion singleton = new QuickEditorRegion();
return singleton; private static JPanel EMPTY;
}
private QuickEditorRegion() {
public static JPanel getEmptyEditor() { this.setLayout(new BorderLayout());
if(EMPTY == null) { }
EMPTY = new JPanel(new BorderLayout());
UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"})+"!"); public static QuickEditorRegion getInstance() {
content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0)); return singleton;
EMPTY.add(content, BorderLayout.CENTER); }
}
return EMPTY; public static JPanel getEmptyEditor() {
} if (EMPTY == null) {
EMPTY = new JPanel(new BorderLayout());
private static QuickEditorRegion singleton = new QuickEditorRegion(); UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"}) + "!");
private static JPanel EMPTY; content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0));
EMPTY.add(content, BorderLayout.CENTER);
public QuickEditorRegion() { }
this.setLayout(new BorderLayout()); return EMPTY;
} }
/** /**
* 传值 * 更新面板显示数据
* *
* @param ePane * @param currentEditor 当前正在编辑的单元格编辑器或者默认的单元格编辑器
*/ */
public void populate(final QuickEditor quickEditor) { public void populate(final QuickEditor currentEditor) {
this.removeAll(); this.removeAll();
if(quickEditor.getComponentCount() == 0) { if (currentEditor.getComponentCount() == 0) {
this.add(getEmptyEditor(), BorderLayout.CENTER); this.add(getEmptyEditor(), BorderLayout.CENTER);
} else { } else {
this.add(quickEditor, BorderLayout.CENTER); this.add(currentEditor, BorderLayout.CENTER);
} }
validate(); validate();
repaint(); repaint();
} }
} }

15
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -89,21 +89,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
layoutPane.add(basicPane,BorderLayout.NORTH); layoutPane.add(basicPane,BorderLayout.NORTH);
layoutPane.add(seniorPane,BorderLayout.CENTER); layoutPane.add(seniorPane,BorderLayout.CENTER);
return layoutPane; return layoutPane;
// double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
// Component[][] components = new Component[][]{
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
// new Component[]{new JSeparator(), null},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
// new Component[]{null, verticalExpandableCheckBox},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
// };
// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
// double[] columnSize = {p, f};
// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
} }
private JPanel basicPane(){ private JPanel basicPane(){

327
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,29 +1,18 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import java.awt.*; import com.fr.design.constants.LayoutConstants;
import java.awt.event.ItemEvent; import com.fr.design.editor.ValueEditorPane;
import java.awt.event.ItemListener; import com.fr.design.editor.ValueEditorPaneFactory;
import java.util.Locale;
import com.fr.base.FRContext;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.foldablepane.UIExpandablePane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
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.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -33,11 +22,21 @@ import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.CellPageAttr; import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* @author zhou * @author zhou
* @since 2012-5-11下午5:24:31 * @since 2012-5-11下午5:24:31
*/ */
public class CellOtherSetPane extends AbstractCellAttrPane { public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_WDITH = 290;
private static final int HEAD_HEIGTH = 20;
// normal // normal
private UIButtonGroup autoshrik; private UIButtonGroup autoshrik;
@ -59,7 +58,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UICheckBox canBreakOnPaginateCheckBox; private UICheckBox canBreakOnPaginateCheckBox;
private UICheckBox repeatCheckBox; private UICheckBox repeatCheckBox;
private UICheckBox autoHeightCheckBox;
private UICheckBox autoWidthCheckBox;
// 插入行策略 // 插入行策略
private UIButtonGroup insertRowPolicy; private UIButtonGroup insertRowPolicy;
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
@ -69,146 +69,169 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
/** /**
* 初始化 * 初始化
* @return 面板 *
* @return 面板
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
final JPanel fileNamePane = createNormal(); JPanel downPane = new JPanel(new BorderLayout());
createOthers(); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH);
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 10));
contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH);
contentPane.add(downPane, BorderLayout.CENTER);
initAllNames();
return contentPane;
}
private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{autoHeightCheckBox},
new Component[]{null},
new Component[]{autoWidthCheckBox},
new Component[]{null},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel seniorPane() {
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{Inter.getLocText("FR-Designer_CellWrite_InsertRow_NULL"), Inter.getLocText("FR-Designer-Estate_Default_Text"),
Inter.getLocText("FR-Designer_CellWrite_InsertRow_COPY")});
defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
defaultValuePane.add(valueEditor, BorderLayout.CENTER);
defaultValuePane.setVisible(false);
insertRowPolicy.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
}
});
JPanel fileNamePane = createNormal();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize1 = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p};
double[] columnSize1 = {p, f}; double[] columnSize = {p, f};
UILabel autoAdjustLabel = new UILabel(Inter.getLocText("FR-Designer_Auto_Adjust_Size") + ":", SwingConstants.RIGHT); int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
autoAdjustLabel.setVerticalAlignment(UILabel.TOP); Component[][] components = new Component[][]{
Component[][] components1 = new Component[][]{ new Component[]{null, null},
new Component[]{autoAdjustLabel, autoshrik}, new Component[]{previewCellContent, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Preview") + ":", SwingConstants.RIGHT), previewCellContent}, new Component[]{printAndExportContent, null},
new Component[]{new UILabel(Inter.getLocText("CellWrite-Print_Export") + ":", SwingConstants.RIGHT), printAndExportContent}, new Component[]{printAndExportBackground, null},
new Component[]{null, printAndExportBackground}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContent},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content") + ":", SwingConstants.RIGHT), showContent},
new Component[]{null, fileNamePane}, new Component[]{null, fileNamePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
}; new Component[]{null, null},
JPanel northContentPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] rowSize2 = {p, p, p, p, p, p};
double[] columnSize2 = {p, f};
Component[][] components2 = new Component[][]{
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Pagination")), null},
new Component[]{pageBeforeRowCheckBox, pageAfterRowCheckBox},
new Component[]{pageBeforeColumnCheckBox, pageAfterColumnCheckBox},
new Component[]{canBreakOnPaginateCheckBox, null},
new Component[]{repeatCheckBox, null}
}; };
JPanel centerContentPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2); JPanel seniorCenterPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
double[] rowSize3 = {p, p, p, p}; double[] rowSize1 = {p, p};
double[] columnSize3 = {f}; double[] columnSize1 = {p, f};
Component[][] components3 = new Component[][]{ int[][] rowCount1 = {{1, 1}, {1, 1}};
new Component[]{new JSeparator(JSeparator.HORIZONTAL)}, Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("CellWrite-InsertRow_Policy"), SwingConstants.LEFT)}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{insertRowPolicy}, new Component[]{null, defaultValuePane},
new Component[]{defaultValuePane}
}; };
southContentPane = TableLayoutHelper.createTableLayoutPane(components3, rowSize3, columnSize3); southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
JPanel contentsmallPane = new JPanel(new BorderLayout(0, 10)); JPanel seniorPane = new JPanel(new BorderLayout());
contentsmallPane.add(northContentPane, BorderLayout.NORTH); seniorPane.add(seniorCenterPane, BorderLayout.NORTH);
contentsmallPane.add(centerContentPane, BorderLayout.CENTER); seniorPane.add(southContentPane, BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 10)); return seniorPane;
contentPane.add(contentsmallPane, BorderLayout.NORTH);
contentPane.add(southContentPane, BorderLayout.CENTER);
initAllNames();
return contentPane;
} }
private JPanel pagePane() {
// 分页
pageBeforeRowCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"));
private JPanel createNormal() { pageAfterRowCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"));
String[] AjustRowTypes = new String[]{ pageBeforeColumnCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"));
Inter.getLocText("FR-Designer_No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("FR-Designer_DEFAULT")}; pageAfterColumnCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"));
autoshrik = new UIButtonGroup(AjustRowTypes);
if (FRContext.getLocale().equals(Locale.US)) {
// 英文显示不全,故每行一个按钮
autoshrik.setFourLine();
autoshrik.setLayout(new GridLayout(4, 1, 1, 1));
} else {
autoshrik.setTwoLine();
autoshrik.setLayout(new GridLayout(2, 2, 1, 1));
}
previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content")); canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content")); repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
printAndExportBackground = new UICheckBox(Inter.getLocText("CellWrite-Print_Background"));
showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"), double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{pageBeforeRowCheckBox},
new Component[]{pageAfterRowCheckBox},
new Component[]{null},
new Component[]{pageBeforeColumnCheckBox},
new Component[]{pageAfterColumnCheckBox},
new Component[]{null},
new Component[]{canBreakOnPaginateCheckBox},
new Component[]{repeatCheckBox},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel createNormal() {
previewCellContent = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"));
printAndExportContent = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Print_Content"));
printAndExportBackground = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Print_Background"));
showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_CellWrite_Show_As_Image"), Inter.getLocText("FR-Designer_CellWrite_Show_As_HTML"),
Inter.getLocText("FR-Designer_Show_As_Download")}); Inter.getLocText("FR-Designer_Show_As_Download")});
final CardLayout fileNameLayout = new CardLayout(); final CardLayout fileNameLayout = new CardLayout();
final JPanel fileNamePane = new JPanel(fileNameLayout); final JPanel fileNamePane = new JPanel(fileNameLayout);
JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0)); JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0));
fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST); fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST);
fileNameTextField = new UITextField(); fileNameTextField = new UITextField();
tooltipTextField = new UITextField(); tooltipTextField = new UITextField();
tooltipTextField.getUI(); tooltipTextField.getUI();
fileNamePane.add(new JPanel(), "none"); fileNamePane.add(new JPanel(), "none");
fileNamePane.add(fileNameCCPane, "content"); fileNamePane.add(fileNameCCPane, "content");
fileNamePane.setPreferredSize(new Dimension(0, 0));
fileNameCCPane.add(fileNameTextField, BorderLayout.CENTER); fileNameCCPane.add(fileNameTextField, BorderLayout.CENTER);
showContent.addItemListener(new ItemListener() { showContent.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
fileNameLayout.show(fileNamePane, showContent.getSelectedIndex() == 3 ? "content" : "none"); if (showContent.getSelectedIndex() == 3) {
fileNamePane.setPreferredSize(new Dimension(100, 20));
fileNameLayout.show(fileNamePane, "content");
} else {
fileNameLayout.show(fileNamePane, "none");
fileNamePane.setPreferredSize(new Dimension(0, 0));
}
} }
}); });
tooltipTextField = new UITextField(); tooltipTextField = new UITextField();
tooltipTextField.getUI(); tooltipTextField.getUI();
return fileNamePane; return fileNamePane;
} }
private void createOthers() {
// 分页
pageBeforeRowCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_Before_Row"));
pageAfterRowCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_After_Row"));
pageBeforeColumnCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_Before_Column"));
pageAfterColumnCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_After_Column"));
canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("CellPage-Can_Break_On_Paginate"));
repeatCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Repeat_Content_When_Paging"));
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{Inter.getLocText("CellWrite-InsertRow_NULL"), Inter.getLocText("CellWrite-InsertRow_DEFAULT"),
Inter.getLocText("CellWrite-InsertRow_COPY")});
defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
defaultValuePane.add(valueEditor, BorderLayout.CENTER);
defaultValuePane.setVisible(false);
insertRowPolicy.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
}
});
}
private void initAllNames() { private void initAllNames() {
autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size")); // autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size"));
autoHeightCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview")); previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview"));
printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content")); printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content"));
printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background")); printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background"));
showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip")); tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip"));
pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Row")); pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"));
pageAfterRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Row")); pageAfterRowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"));
pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Column")); pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"));
pageAfterColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Column")); pageAfterColumnCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"));
canBreakOnPaginateCheckBox.setGlobalName(Inter.getLocText("CellPage-Can_Break_On_Paginate")); canBreakOnPaginateCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
repeatCheckBox.setGlobalName(Inter.getLocText("CellWrite-Repeat_Content_When_Paging")); repeatCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
insertRowPolicy.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); insertRowPolicy.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"));
valueEditor.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); valueEditor.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"));
} }
@ -224,14 +247,34 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
if (cellGUIAttr == null) { if (cellGUIAttr == null) {
cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR;
} }
autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode()); // autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode());
switch (cellGUIAttr.getAdjustMode()) {
case 0:
autoHeightCheckBox.setSelected(false);
autoWidthCheckBox.setSelected(false);
break;
case 1:
autoHeightCheckBox.setSelected(true);
autoWidthCheckBox.setSelected(false);
break;
case 2:
autoHeightCheckBox.setSelected(false);
autoWidthCheckBox.setSelected(true);
break;
case 3:
autoHeightCheckBox.setSelected(true);
autoWidthCheckBox.setSelected(true);
break;
default:
break;
}
previewCellContent.setSelected(cellGUIAttr.isPreviewContent()); previewCellContent.setSelected(cellGUIAttr.isPreviewContent());
printAndExportContent.setSelected(cellGUIAttr.isPrintContent()); printAndExportContent.setSelected(cellGUIAttr.isPrintContent());
printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground()); printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground());
if (cellGUIAttr.isShowAsImage()) { if (cellGUIAttr.isShowAsImage()) {
showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_Image")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_CellWrite_Show_As_Image"));
} else if (cellGUIAttr.isShowAsHTML()) { } else if (cellGUIAttr.isShowAsHTML()) {
showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_HTML")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_CellWrite_Show_As_HTML"));
} else if (cellGUIAttr.isShowAsDownload()) { } else if (cellGUIAttr.isShowAsDownload()) {
showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download"));
fileNameTextField.setText(cellGUIAttr.getFileName()); fileNameTextField.setText(cellGUIAttr.getFileName());
@ -265,7 +308,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1); defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
southContentPane.setVisible(true); southContentPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 插入行策略 if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略
southContentPane.setVisible(false); southContentPane.setVisible(false);
} }
} }
@ -281,19 +324,36 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr = new CellGUIAttr(); cellGUIAttr = new CellGUIAttr();
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) { // if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) {
cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex()); // cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex());
// }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Height")) || ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"))) {
int flag;
if (autoHeightCheckBox.isSelected()) {
if (autoWidthCheckBox.isSelected()) {
flag = 3;
} else {
flag = 1;
}
} else if (autoWidthCheckBox.isSelected()) {
flag = 2;
} else {
flag = 0;
}
cellGUIAttr.setAdjustMode(flag);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) {
cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); cellGUIAttr.setPreviewContent(previewCellContent.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Preview_Cell_Content"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"))) {
cellGUIAttr.setPrintContent(printAndExportContent.isSelected()); cellGUIAttr.setPrintContent(printAndExportContent.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Print_Background"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Print_Background"))) {
cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected()); cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected());
} }
@ -334,28 +394,28 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellPageAttr = new CellPageAttr(); cellPageAttr = new CellPageAttr();
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_Before_Row"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"))) {
cellPageAttr.setPageBeforeRow(this.pageBeforeRowCheckBox.isSelected()); cellPageAttr.setPageBeforeRow(this.pageBeforeRowCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_After_Row"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"))) {
cellPageAttr.setPageAfterRow(this.pageAfterRowCheckBox.isSelected()); cellPageAttr.setPageAfterRow(this.pageAfterRowCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_Before_Column"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"))) {
cellPageAttr.setPageBeforeColumn(this.pageBeforeColumnCheckBox.isSelected()); cellPageAttr.setPageBeforeColumn(this.pageBeforeColumnCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_After_Column"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"))) {
cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected()); cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellPage-Can_Break_On_Paginate"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Can_Break_On_Paginate"))) {
cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected()); cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Repeat_Content_When_Paging"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Repeat_Content_When_Paging"))) {
cellPageAttr.setRepeat(this.repeatCheckBox.isSelected()); cellPageAttr.setRepeat(this.repeatCheckBox.isSelected());
} }
cellElement.setCellPageAttr(cellPageAttr); cellElement.setCellPageAttr(cellPageAttr);
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-InsertRow_Policy"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"))) {
// 插入 // 插入
CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr(); CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr();
@ -373,7 +433,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
/** /**
*存储 * 存储
*/ */
public void updateBeans() { public void updateBeans() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
@ -398,10 +458,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
/** /**
* 返回界面的标题 * 返回界面的标题
* @return 标题 *
* @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Datasource-Other_Attributes"); return Inter.getLocText("FR-Designer_Datasource_Other_Attributes");
} }
} }

287
designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -1,29 +1,25 @@
package com.fr.design.mainframe.cell.settingpane.style; package com.fr.design.mainframe.cell.settingpane.style;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeListener;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.gui.ibutton.FiveButtonLayout;
import com.fr.design.gui.style.AbstractBasicStylePane;
import com.fr.design.gui.style.AlignmentPane;
import com.fr.design.gui.style.BackgroundPane;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.style.BorderUtils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane; import com.fr.design.dialog.MultiTabPane;
import com.fr.general.Inter; import com.fr.design.gui.ibutton.FiveButtonLayout;
import com.fr.design.gui.style.*;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* 复杂的原型图导致复杂的画法非我所愿也 * 复杂的原型图导致复杂的画法非我所愿也
@ -32,130 +28,143 @@ import com.fr.stable.Constants;
* @since 2012-5-24上午10:36:10 * @since 2012-5-24上午10:36:10
*/ */
public class CustomStylePane extends MultiTabPane<Style> { public class CustomStylePane extends MultiTabPane<Style> {
private static final int LENGTH_FOUR = 4; private static final int LENGTH_FOUR = 4;
private static final int THREE_INDEX = 3; private static final int THREE_INDEX = 3;
private String[] NameArray; private static final int TWO_INDEX = 2;
private ElementCasePane reportPane; private static final int ONE_INDEX = 1;
private BackgroundPane backgroundPane = null; private String[] NameArray;
private ElementCasePane reportPane;
private BackgroundPane backgroundPane = null;
public CustomStylePane() {
super();
tabPane.setOneLineTab(false); public CustomStylePane() {
tabPane.setLayout(new FiveButtonLayout()); super();
} tabPane.setOneLineTab(true);
tabPane.setLayout(new FiveButtonLayout(1));
/** }
* @return
*/ public static void main(String[] args) {
public String title4PopupWindow() { JFrame jf = new JFrame("test");
return Inter.getLocText(new String[]{"Custom", "Style"}); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
/** content.add(new CustomStylePane(), BorderLayout.CENTER);
* for ScrollBar GUICoreUtils.centerWindow(jf);
* jf.setSize(290, 400);
* @param l jf.setVisible(true);
*/ }
public void addTabChangeListener(ChangeListener l) {
if (tabPane != null) { /**
tabPane.addChangeListener(l); * @return
} */
if (backgroundPane != null) { public String title4PopupWindow() {
backgroundPane.addChangeListener(l); return Inter.getLocText(new String[]{"Custom", "Style"});
} }
}
/**
/** * for ScrollBar
* *
*/ * @param l
public void reset() { */
populateBean(null); public void addTabChangeListener(ChangeListener l) {
} if (tabPane != null) {
tabPane.addChangeListener(l);
@Override }
/** if (backgroundPane != null) {
* backgroundPane.addChangeListener(l);
*/ }
public void populateBean(Style ob) { }
for (int i = 0; i < paneList.size(); i++) {
((AbstractBasicStylePane) paneList.get(i)).populateBean(ob); /**
} *
} */
public void reset() {
@Override populateBean(null);
/** }
*
*/ @Override
public Style updateBean() { /**
return updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); *
} */
public void populateBean(Style ob) {
/** for (int i = 0; i < paneList.size(); i++) {
* @param style ((AbstractBasicStylePane) paneList.get(i)).populateBean(ob);
* @return }
*/ }
public Style updateStyle(Style style) {
return ((AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex())).update(style);//只更新当前选中面板的样式 @Override
} /**
*
*/
public boolean isBorderPaneSelected() { public Style updateBean() {
return tabPane.getSelectedIndex() == THREE_INDEX ; return updateStyle(ReportActionUtils.getCurrentStyle(reportPane));
} }
/** /**
* @param ePane * @param style
*/ * @return
public void dealWithBorder(ElementCasePane ePane) { */
this.reportPane = ePane; public Style updateStyle(Style style) {
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); return ((AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex())).update(style);//只更新当前选中面板的样式
}
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
if (fourObjectArray.length == LENGTH_FOUR) {
((BorderPane) paneList.get(THREE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(), public boolean isBorderPaneSelected() {
(Color) fourObjectArray[THREE_INDEX]); return tabPane.getSelectedIndex() == TWO_INDEX;
} else { }
((BorderPane) paneList.get(THREE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE,
(Color) fourObjectArray[THREE_INDEX]); /**
} * @param ePane
} */
public void dealWithBorder(ElementCasePane ePane) {
} this.reportPane = ePane;
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane);
/**
* if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
*/ if (fourObjectArray.length == LENGTH_FOUR) {
public void updateBorder() { ((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(),
BorderUtils.update(reportPane, ((BorderPane) paneList.get(THREE_INDEX)).update()); (Color) fourObjectArray[THREE_INDEX]);
} } else {
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE,
/** (Color) fourObjectArray[THREE_INDEX]);
* @param ob }
* @return }
*/
public boolean accept(Object ob) { }
return ob instanceof Style && !(ob instanceof NameStyle);
} /**
*
@Override */
protected List<BasicPane> initPaneList() { public void updateBorder() {
paneList = new ArrayList<BasicPane>(); BorderUtils.update(reportPane, ((BorderPane) paneList.get(TWO_INDEX)).update());
paneList.add(new FormatPane()); }
paneList.add(new AlignmentPane());
paneList.add(new FRFontPane()); /**
paneList.add(new BorderPane()); * @param ob
paneList.add(backgroundPane = new BackgroundPane()); * @return
return paneList; */
} public boolean accept(Object ob) {
return ob instanceof Style && !(ob instanceof NameStyle);
@Override }
/**
* @Override
*/ protected List<BasicPane> initPaneList() {
public void updateBean(Style ob) { paneList = new ArrayList<BasicPane>();
paneList.add(new FormatPane());
} paneList.add(new BorderPane());
paneList.add(new AlignmentPane());
// paneList.add(new FRFontPane());
// paneList.add(backgroundPane = new BackgroundPane());
return paneList;
}
@Override
/**
*
*/
public void updateBean(Style ob) {
}
} }

9
designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -22,10 +22,7 @@ import com.fr.design.designer.TargetComponent;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityEditPane; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
@ -225,6 +222,10 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return elementCasePane.getEastDownPane(); return elementCasePane.getEastDownPane();
} }
public JPanel getHyperlinkPane() {
return DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
}
public S getSelection() { public S getSelection() {
return (S) elementCasePane.getSelection(); return (S) elementCasePane.getSelection();

19
designer/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -11,14 +11,17 @@ import com.fr.design.actions.form.FormECColumnsAction;
import com.fr.design.actions.form.FormECFrozenAction; import com.fr.design.actions.form.FormECFrozenAction;
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.mainframe.CellElementPropertyPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.*;
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.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.js.NameJavaScriptGroup;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
@ -34,6 +37,12 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor()); QuickEditorRegion.getInstance().populate(getCurrentEditor());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate().
getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(FormElementCasePaneDelegate.this);
// populateHyperLinkGroupPane();
} }
}); });
this.addTargetModifiedListener(new TargetModifiedListener() { this.addTargetModifiedListener(new TargetModifiedListener() {
@ -44,6 +53,12 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
}); });
} }
// private void populateHyperLinkGroupPane() {
// final TemplateElementCase report = this.getEditingElementCase();
// NameJavaScriptGroup nameHyperlinks = ReportHyperlinkGroupPane.getNameJSGroup(this, report);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getHyperLinkPane().populate(nameHyperlinks);
// }
@Override @Override
protected boolean supportRepeatedHeaderFooter() { protected boolean supportRepeatedHeaderFooter() {
return true; return true;

84
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -5,10 +5,12 @@ import com.fr.base.ScreenResolution;
import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.bar.DynamicScrollBar;
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.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
@ -26,12 +28,12 @@ import java.awt.event.*;
/** /**
* 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab * 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
*/ */
public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider{ public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider {
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
public FormElementCaseDesigner elementCaseDesigner; public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm; private BaseJForm jForm;
private FormTabPane sheetNameTab; private FormTabPane sheetNameTab;
@ -48,8 +50,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
((JForm)this.jForm).getFormDesign().getArea().addMouseWheelListener(showValSpinnerMouseWheelListener);
((JForm)this.jForm).getFormDesign().getArea().addKeyListener(showValSpinnerKeyListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this); elementCaseDesigner.addTargetModifiedListener(this);
@ -60,22 +60,24 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if( e.isControlDown()){ if (e.isControlDown()) {
isCtrl = true ; isCtrl = true;
} }
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
isCtrl = false ; isCtrl = false;
} }
}; };
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){ if (isCtrl) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
@ -87,10 +89,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); double value = (int) ((UIBasicSpinner) e.getSource()).getValue();
value = value > MAX ? MAX : value; value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value; value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND);
setScale(resolution); setScale(resolution);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); // HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }
@ -99,18 +101,17 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
ItemListener selfAdaptButtonItemListener = new ItemListener() { ItemListener selfAdaptButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){ if (jSliderContainer.getSelfAdaptButton().isSelected()) {
int resolution = selfAdaptUpdate(); int resolution = selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution()); jSliderContainer.getShowVal().setValue(resolution * HUND / ScreenResolution.getScreenResolution());
} }
} }
}; };
private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>(); private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>();
private void setScale(int resolution){ private void setScale(int resolution) {
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); ElementCasePane elementCasePane = elementCaseDesigner.getEditingElementCasePane();
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
elementCasePane.setResolution(resolution); elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution); elementCasePane.getGrid().setResolution(resolution);
@ -122,20 +123,16 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI(); elementCasePane.getGrid().updateUI();
//更新Column和Row //更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution); ((DynamicScrollBar) elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution); ((DynamicScrollBar) elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution); elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI(); elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution); elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI(); elementCasePane.getGridRow().updateUI();
} }
private int selfAdaptUpdate(){ private int selfAdaptUpdate() {
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); ElementCasePane elementCasePane = elementCaseDesigner.getEditingElementCasePane();
if (jForm.resolution == 0){
jForm.resolution = ScreenResolution.getScreenResolution();
}
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane(); ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0]; int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length; double columnLength = reportPane.getSelection().getSelectedColumns().length;
@ -143,10 +140,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
int row = reportPane.getSelection().getSelectedRows()[0]; int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length; double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent(); double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){ if (columnLength == 0 || rowLength == 0) {
return jForm.resolution; return ScreenResolution.getScreenResolution();
} }
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength); double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);
if (reportPane.isHorizontalScrollBarVisible()) { if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row); reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column); reportPane.getHorizontalScrollBar().setValue(column);
@ -155,23 +152,26 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
} }
/** /**
* 添加目标改变的监听 * 添加目标改变的监听
* @param targetModifiedListener 目标改变事件 *
* @param targetModifiedListener 目标改变事件
*/ */
public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) { public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
targetModifiedList.add(targetModifiedListener); targetModifiedList.add(targetModifiedListener);
} }
/** /**
* 目标改变 * 目标改变
* @param e 事件 *
* @param e 事件
*/ */
public void targetModified(TargetModifiedEvent e) { public void targetModified(TargetModifiedEvent e) {
for (TargetModifiedListener l : targetModifiedList) { for (TargetModifiedListener l : targetModifiedList) {
l.targetModified(e); l.targetModified(e);
} }
} }
public void setEditingElementCase(FormElementCase formElementCase){
public void setEditingElementCase(FormElementCase formElementCase) {
elementCaseDesigner.setTarget(formElementCase); elementCaseDesigner.setTarget(formElementCase);
fireTargetModified(); fireTargetModified();
} }
@ -183,8 +183,8 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
jSliderContainer = JSliderPane.getInstance(); jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer); JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
southPane.add(hbarContainer,BorderLayout.NORTH); southPane.add(hbarContainer, BorderLayout.NORTH);
southPane.add(splitpane,BorderLayout.CENTER); southPane.add(splitpane, BorderLayout.CENTER);
splitpane.setBorder(null); splitpane.setBorder(null);
splitpane.setDividerSize(3); splitpane.setDividerSize(3);
splitpane.setResizeWeight(1); splitpane.setResizeWeight(1);
@ -195,7 +195,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
* 停止编辑 * 停止编辑
*/ */
public void stopEditing() { public void stopEditing() {
elementCaseDesigner.stopEditing(); elementCaseDesigner.stopEditing();
} }
public void setComposite() { public void setComposite() {
@ -203,12 +203,12 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.validate(); this.validate();
this.repaint(40); this.repaint(40);
} }
public void setSelectedWidget(FormElementCaseProvider fc) { public void setSelectedWidget(FormElementCaseProvider fc) {
if (fc != null){ if (fc != null) {
elementCaseDesigner.setTarget(fc); elementCaseDesigner.setTarget(fc);
} }
} }
/** /**
* 模板更新 * 模板更新

91
designer/src/com/fr/design/present/BarCodePane.java

@ -1,57 +1,47 @@
package com.fr.design.present; package com.fr.design.present;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
import javax.swing.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
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.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.BarcodeAttr; import com.fr.report.cell.cellattr.BarcodeAttr;
import com.fr.report.cell.cellattr.BarcodePresent; import com.fr.report.cell.cellattr.BarcodePresent;
import com.fr.report.cell.painter.barcode.BarcodeImpl; import com.fr.report.cell.painter.barcode.BarcodeImpl;
import com.fr.report.cell.painter.barcode.core.BarCodeUtils; import com.fr.report.cell.painter.barcode.core.BarCodeUtils;
import com.fr.stable.pinyin.ChineseHelper; import com.fr.stable.pinyin.ChineseHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author zhou * @author zhou
* @since 2012-6-4下午6:49:59 * @since 2012-6-4下午6:49:59
*/ */
public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> { public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private final int num16 = 16; private final int NUM16 = 16;
private BarCodePreviewPane barCodePreviewPane; private BarCodePreviewPane barCodePreviewPane;
private UIComboBox typeComboBox; private UIComboBox typeComboBox;
private UIBasicSpinner barWidthSpinner; private UIBasicSpinner barWidthSpinner;
@ -69,13 +59,23 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
addlistener(); addlistener();
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new BarCodePane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
private void initComponents() { private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane(); barCodePreviewPane = new BarCodePreviewPane();
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1)); this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0));
this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1));
this.barWidthSpinner.setPreferredSize(new Dimension(45, 20)); this.barWidthSpinner.setPreferredSize(new Dimension(60, 20));
this.barHeightSpinner.setPreferredSize(new Dimension(45, 20)); this.barHeightSpinner.setPreferredSize(new Dimension(60, 20));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR);
borderPane.setBorder(titledBorder); borderPane.setBorder(titledBorder);
@ -95,7 +95,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
barCodePreviewPane.setPreferredSize(new Dimension(0, 145)); barCodePreviewPane.setPreferredSize(new Dimension(0, 125));
final JPanel centerPane = new JPanel(new CardLayout()); final JPanel centerPane = new JPanel(new CardLayout());
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -109,7 +109,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
typeComboBox.addItemListener(new ItemListener() { typeComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); CardLayout cardLayout = (CardLayout) centerPane.getLayout();
cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == num16 ? "special" : "normal"); cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal");
setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex()));
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
@ -142,25 +142,22 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
} }
private JPanel getNormalPane() { private JPanel getNormalPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize1 = {p, f, f};
JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barWidthContainer.add(barWidthSpinner); barWidthContainer.add(barWidthSpinner);
JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barHeightContainer.add(barHeightSpinner); barHeightContainer.add(barHeightSpinner);
UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
Component[][] components_normal = new Component[][]{ Component[][] components_normal = new Component[][]{
new Component[]{uiLabel, barWidthContainer}, new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer},
new Component[]{new UILabel(Inter.getLocText("Height") + ":", UILabel.RIGHT), barHeightContainer}, new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)},
new Component[]{new UILabel(Inter.getLocText("Text") + ":", UILabel.RIGHT), drawingTextCheckBox} new Component[]{drawingTextCheckBox, null, null}
}; };
double[] columnSize1 = {p, p};
JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1);
return normalPane; return normalPane;
@ -247,7 +244,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private void repaintPreviewBarCode() { private void repaintPreviewBarCode() {
try { try {
// carl:不支持中文转条形码 // carl:不支持中文转条形码
if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != num16) { if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) {
throw new Exception("Illegal Character."); throw new Exception("Illegal Character.");
} }
this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText()));
@ -281,13 +278,13 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
@Override @Override
public BarcodePresent updateBean() { public BarcodePresent updateBean() {
BarcodeAttr barcodeAttr = new BarcodeAttr(); BarcodeAttr barcodeAttr = new BarcodeAttr();
if ((typeComboBox.getSelectedIndex() == num16 )) { if ((typeComboBox.getSelectedIndex() == NUM16)) {
barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex());
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex());
barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue());
} }
barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); barcodeAttr.setType(this.typeComboBox.getSelectedIndex());
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue()); barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10);
barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue());
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected());
return new BarcodePresent(barcodeAttr); return new BarcodePresent(barcodeAttr);

357
designer/src/com/fr/design/present/CurrencyLinePane.java

@ -1,238 +1,231 @@
package com.fr.design.present; package com.fr.design.present;
import java.awt.*;
import javax.swing.JComponent;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
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.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.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.CurrencyLineAttr; import com.fr.report.cell.cellattr.CurrencyLineAttr;
import com.fr.report.cell.cellattr.CurrencyLinePresent; import com.fr.report.cell.cellattr.CurrencyLinePresent;
import com.fr.report.cell.painter.barcode.BarcodeException; import com.fr.report.cell.painter.barcode.BarcodeException;
import com.fr.report.core.CurrencyLineImpl; import com.fr.report.core.CurrencyLineImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.gui.ispinner.UIBasicSpinner; import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
/** /**
*
* @author zhou * @author zhou
* @since 2012-6-4下午7:34:52 * @since 2012-6-4下午7:34:52
*/ */
public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> { public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> {
private static final int VS_NUM = 4; private static final int VS_NUM = 4;
private static final int VG_NUM = 6; private static final int VG_NUM = 6;
private UIBasicSpinner intPartSpinner; private UIBasicSpinner intPartSpinner;
private UIBasicSpinner deciPartSpinner; private UIBasicSpinner deciPartSpinner;
private UITextField textField; private UITextField textField;
private CurrencyLinePreviewPane CurrencyLinePreviewPane; private CurrencyLinePreviewPane CurrencyLinePreviewPane;
private int intPart = 9; private int intPart = 9;
private int deciPart = 3; private int deciPart = 3;
private static final int POSITION = 8; private static final int POSITION = 8;
ChangeListener listener2 = new ChangeListener() { ChangeListener listener2 = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
}; };
DocumentListener listener = new DocumentListener() { DocumentListener listener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
}; };
public CurrencyLinePane() { public CurrencyLinePane() {
this.initComponents(); this.initComponents();
} }
protected void initComponents() { protected void initComponents() {
// 整数位选择 // 整数位选择
intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1));
intPartSpinner.setPreferredSize(new Dimension(45, 20)); intPartSpinner.setPreferredSize(new Dimension(135, 20));
// 小数位选择 // 小数位选择
deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1));
deciPartSpinner.setPreferredSize(new Dimension(45, 20)); deciPartSpinner.setPreferredSize(new Dimension(135, 20));
// 预览区域 // 预览区域
textField = new UITextField(10); textField = new UITextField(10);
CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); CurrencyLinePreviewPane = new CurrencyLinePreviewPane();
CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR);
borderPane.setBorder(titledBorder); borderPane.setBorder(titledBorder);
borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER);
textField.requestFocus(); textField.requestFocus();
double vs = VS_NUM; double vs = VS_NUM;
double vg = VG_NUM; double vg = VG_NUM;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = {p, f};
double[] rowSize = { p, p,p,p }; double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Data") + ":", UILabel.RIGHT),textField}, new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField},
new Component[]{borderPane,null}, new Component[]{borderPane, null},
new Component[]{new UILabel(Inter.getLocText("IntPart") + ":", UILabel.RIGHT), groupPane(intPartSpinner)}, new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)},
new Component[]{new UILabel(Inter.getLocText("DeciPart") + ":", UILabel.RIGHT), groupPane(deciPartSpinner)} new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)}
} ; };
JPanel linePane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(linePane,BorderLayout.CENTER); this.add(linePane, BorderLayout.CENTER);
textField.getDocument().addDocumentListener(listener);
textField.getDocument().addDocumentListener(listener); intPartSpinner.addChangeListener(listener2);
intPartSpinner.addChangeListener(listener2); deciPartSpinner.addChangeListener(listener2);
deciPartSpinner.addChangeListener(listener2); textField.setText("123456.78");
textField.setText("123456.78"); }
}
@Override @Override
/** /**
* 窗口名 * 窗口名
* @return 同上 * @return 同上
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Currency_Line"); return Inter.getLocText("Currency_Line");
} }
/** /**
* *
*/ */
public CurrencyLineAttr update() { public CurrencyLineAttr update() {
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); CurrencyLineAttr currencylineAttr = new CurrencyLineAttr();
currencylineAttr.setintPart(((Integer)this.intPartSpinner.getValue()).intValue()); currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue());
currencylineAttr.setdeciPart(((Integer)this.deciPartSpinner.getValue()).intValue()); currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue());
return currencylineAttr; return currencylineAttr;
} }
/** /**
* *
*/ */
public void setintPart(int intpart) { public void setintPart(int intpart) {
this.intPart = intpart; this.intPart = intpart;
} }
/** /**
* *
*/ */
public void setdeciPart(int decipart) { public void setdeciPart(int decipart) {
this.deciPart = decipart; this.deciPart = decipart;
} }
private class CurrencyLinePreviewPane extends JPanel { private class CurrencyLinePreviewPane extends JPanel {
private String text; private String text;
CurrencyLineAttr currencyLineAttr; CurrencyLineAttr currencyLineAttr;
public CurrencyLinePreviewPane() { public CurrencyLinePreviewPane() {
// setBackground(Color.white); // setBackground(Color.white);
} }
public void setObject(String text, CurrencyLineAttr currencyLineAttr) { public void setObject(String text, CurrencyLineAttr currencyLineAttr) {
this.text = text; this.text = text;
this.currencyLineAttr = currencyLineAttr; this.currencyLineAttr = currencyLineAttr;
GUICoreUtils.repaint(this); GUICoreUtils.repaint(this);
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (text == null){ if (text == null) {
return; return;
}
Dimension size = this.getSize();
try {
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr);
currencyLineImpl.draw((Graphics2D) g, (int) (size.getWidth()), (int) (size.getHeight()));
} catch (BarcodeException e) {
Color oldColor = g.getColor();
g.setColor(Color.red);
g.drawString(e.getMessage(), (int) (size.getWidth() / POSITION), (int) (size.getHeight() / POSITION));
g.setColor(oldColor);
} }
Dimension size = this.getSize(); }
try {
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); }
currencyLineImpl.draw((Graphics2D)g, (int)(size.getWidth()), (int)(size.getHeight()));
} catch (BarcodeException e) { protected static JPanel groupPane(JComponent comp) {
Color oldColor = g.getColor(); JPanel jp = new JPanel();
g.setColor(Color.red); jp.setBorder(null);
g.drawString(e.getMessage(), (int)(size.getWidth() / POSITION), (int)(size.getHeight() / POSITION)); jp.setLayout(new FlowLayout(FlowLayout.LEFT));
g.setColor(oldColor); jp.add(comp);
} return jp;
} }
} @Override
protected static JPanel groupPane(JComponent comp) {
JPanel jp = new JPanel();
jp.setBorder(null);
jp.setLayout(new FlowLayout(FlowLayout.LEFT));
jp.add(comp);
return jp;
}
@Override
/** /**
* 是否为该类型 * 是否为该类型
* @param ob 对象 * @param ob 对象
* @return 同上 * @return 同上
* *
*/ */
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof CurrencyLinePresent; return ob instanceof CurrencyLinePresent;
} }
/** /**
* 重置 * 重置
*/ */
public void reset() { public void reset() {
this.intPartSpinner.setValue(9); this.intPartSpinner.setValue(9);
this.deciPartSpinner.setValue(3); this.deciPartSpinner.setValue(3);
} }
@Override @Override
public void populateBean(CurrencyLinePresent ob) { public void populateBean(CurrencyLinePresent ob) {
CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr();
if (currencyLine == null) { if (currencyLine == null) {
currencyLine = new CurrencyLineAttr(); currencyLine = new CurrencyLineAttr();
} }
this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); this.intPartSpinner.setValue(new Integer(currencyLine.getintPart()));
this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart()));
} }
@Override @Override
public CurrencyLinePresent updateBean() { public CurrencyLinePresent updateBean() {
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); CurrencyLineAttr currencylineAttr = new CurrencyLineAttr();
currencylineAttr.setintPart(((Integer)this.intPartSpinner.getValue()).intValue()); currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue());
currencylineAttr.setdeciPart(((Integer)this.deciPartSpinner.getValue()).intValue()); currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue());
return new CurrencyLinePresent(currencylineAttr); return new CurrencyLinePresent(currencylineAttr);
} }
} }

10
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -11,10 +11,8 @@ import com.fr.design.constants.UIConstants;
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.file.HistoryTemplateListPane;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.poly.PolyConstants; import com.fr.poly.PolyConstants;
@ -148,5 +146,9 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor()); QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent); CellElementPropertyPane.getInstance().populate(editComponent);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate()
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(editComponent);
} }
} }

250
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -1,123 +1,129 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.utils.DeprecatedActionManager;
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.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
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.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
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 com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
* * @author zhou
* @author zhou * @since 2012-7-23下午5:16:53
* @since 2012-7-23下午5:16:53 */
*/ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected UITextField columnRowTextField;
protected UITextField columnRowTextField; private UIButton cellElementEditButton;
protected UIButton cellElementEditButton; protected TemplateCellElement cellElement;
protected TemplateCellElement cellElement;
public CellQuickEditor() {
public CellQuickEditor() { double p = TableLayout.PREFERRED;
double p = TableLayout.PREFERRED; double f = TableLayout.FILL;
double f = TableLayout.FILL; double[] columnSize = {p, f};
double[] columnSize = { p, f }; double[] rowSize = {p, p, p};
double[] rowSize = { p,p,p}; Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()},
Component[][] components = new Component[][]{ new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()},
new Component[]{new UILabel(" "+Inter.getLocText("Cell")),columnRowTextField = initColumnRowTextField()}, new Component[]{createCenterBody(), null}
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content")+" "),cellElementEditButton = initCellElementEditButton()}, };
new Component[]{createCenterBody(),null} JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}; this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); this.add(panel, BorderLayout.CENTER);
this.setLayout(new BorderLayout()); }
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.add(panel,BorderLayout.CENTER); /**
* 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
*
} * @return UIButton
*/
protected UIButton initCellElementEditButton() { private UIButton initCellElementEditButton() {
final UIButton cellElementEditButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); final UIButton cellElementEditButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
cellElementEditButton.addMouseListener(new MouseAdapter() { cellElementEditButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6); GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6);
} }
}); });
return cellElementEditButton; return cellElementEditButton;
} }
protected UITextField initColumnRowTextField() { /**
final UITextField columnRowTextField = new UITextField(4); * 初始化单元格域存储当前选择的单元格例A3,B4等
// barry:输入位置定位单元格 *
columnRowTextField.addActionListener(new ActionListener() { * @return 单元格信息文本域
*/
@Override private UITextField initColumnRowTextField() {
public void actionPerformed(ActionEvent e) { final UITextField columnRowTextField = new UITextField(4);
ColumnRow columnRowEdit = ColumnRow.valueOf(columnRowTextField.getText());
// barry:输入位置定位单元格
// barry:检查输入是否正确 columnRowTextField.addActionListener(new ActionListener() {
if (!ColumnRow.validate(columnRowEdit)) { @Override
public void actionPerformed(ActionEvent e) {
Object[] options = { Inter.getLocText("OK") }; ColumnRow columnRowEdit = ColumnRow.valueOf(columnRowTextField.getText());
JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Please_Input_Letters+Numbers(A1,AA1,A11....)"), Inter.getLocText("Warning"), // barry:检查输入是否正确
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); if (!ColumnRow.validate(columnRowEdit)) {
Object[] options = {Inter.getLocText("OK")};
// 重新选中当前的selection,把columnRowTextField JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Please_Input_Letters+Numbers(A1,AA1,A11....)"), Inter.getLocText("Warning"),
tc.setSelection(tc.getSelection()); JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
return; // 重新选中当前的selection,把columnRowTextField
} tc.setSelection(tc.getSelection());
return;
JScrollBar verticalBar = tc.getVerticalScrollBar(), horizontalBar = tc.getHorizontalScrollBar(); }
int m = columnRowEdit.getColumn(), n = columnRowEdit.getRow(); JScrollBar verticalBar = tc.getVerticalScrollBar(), horizontalBar = tc.getHorizontalScrollBar();
int m = columnRowEdit.getColumn(), n = columnRowEdit.getRow();
verticalBar.setMaximum(n); verticalBar.setMaximum(n);
verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20); verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20);
horizontalBar.setMaximum(m); horizontalBar.setMaximum(m);
horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12); horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12);
tc.setSelection(new CellSelection(m, n, 1, 1));
tc.setSelection(new CellSelection(m, n, 1, 1)); tc.requestFocus();
tc.requestFocus(); }
} });
}); return columnRowTextField;
return columnRowTextField; }
}
public abstract JComponent createCenterBody(); /**
* 初始化详细信息面板
@Override *
protected void refresh() { * @return JComponent 待显示的详细信息面板
CellSelection cs = (CellSelection)tc.getSelection(); */
ColumnRow columnRow = ColumnRow.valueOf(cs.getColumn(), cs.getRow()); public abstract JComponent createCenterBody();
columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs.getColumn(), cs.getRow()); /**
refreshDetails(); * 刷新
} */
@Override
protected abstract void refreshDetails(); protected void refresh() {
CellSelection cs = (CellSelection) tc.getSelection();
ColumnRow columnRow = ColumnRow.valueOf(cs.getColumn(), cs.getRow());
columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs.getColumn(), cs.getRow());
refreshDetails();
}
/**
* 刷新详细信息
*/
protected abstract void refreshDetails();
} }

122
designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,61 +1,63 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import java.awt.event.ActionEvent; import com.fr.base.BaseUtils;
import java.awt.event.ActionListener; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter;
import javax.swing.BorderFactory; import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.base.BaseUtils; import com.fr.general.Inter;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.quickeditor.CellQuickEditor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.DialogActionAdapter; import javax.swing.*;
import com.fr.general.ComparatorUtils; import java.awt.event.ActionEvent;
import com.fr.general.Inter; import java.awt.event.ActionListener;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter; /**
* 单元格元素斜线编辑器
public class CellBiasTextPainterEditor extends CellQuickEditor { * TODO 9.0 大体没有改动
*/
@Override public class CellBiasTextPainterEditor extends CellQuickEditor {
public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); @Override
editbutton.addActionListener(new ActionListener() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
@Override editbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showEditingDialog(); @Override
} public void actionPerformed(ActionEvent e) {
}); showEditingDialog();
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); }
editbutton.setMargin(null); });
editbutton.setOpaque(false); editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
return editbutton; editbutton.setMargin(null);
} editbutton.setOpaque(false);
return editbutton;
private void showEditingDialog() { }
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter)cellElement.getValue();
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane(); private void showEditingDialog() {
biasTextPainterPane.populate(oldbiasTextPainter); final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue();
biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane();
biasTextPainterPane.populate(oldbiasTextPainter);
@Override biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
public void doOk() {
BiasTextPainter newbiasTextPainter = biasTextPainterPane.update(); @Override
if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) { public void doOk() {
cellElement.setValue(newbiasTextPainter); BiasTextPainter newbiasTextPainter = biasTextPainterPane.update();
fireTargetModified(); if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) {
} cellElement.setValue(newbiasTextPainter);
} fireTargetModified();
}
}).setVisible(true); }
}
}).setVisible(true);
@Override }
protected void refreshDetails() {
// TODO Auto-generated method stub @Override
protected void refreshDetails() {
} // TODO Auto-generated method stub
}
} }

310
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1,111 +1,201 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.columnrow.DSColumnAdvancedAction; import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.actions.columnrow.DSColumnBasicAction; import com.fr.design.dscolumn.DSColumnAdvancedEditorPane;
import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.dscolumn.DSColumnBasicEditorPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.dscolumn.ResultSetGroupDockingPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.layout.TableLayout; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayout;
import com.fr.quickeditor.CellQuickEditor; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.cell.CellEditorPane;
import javax.swing.*; import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.*; import com.fr.quickeditor.CellQuickEditor;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import javax.swing.*;
import java.awt.*;
public class CellDSColumnEditor extends CellQuickEditor { import java.awt.event.ItemEvent;
private JPanel dsColumnRegion; import java.awt.event.ItemListener;
private JPanel centerPane; import java.util.ArrayList;
private SelectedDataColumnPane dataPane;
private ResultSetGroupDockingPane groupPane; /**
private ItemListener groupListener = new ItemListener() { * 单元格元素 数据列编辑器
*
@Override * @author yaoh.wu
public void itemStateChanged(ItemEvent e) { * @version 2017年7月24日
if (e == null) { * @since 9.0
//分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存 */
groupPane.update(); public class CellDSColumnEditor extends CellQuickEditor {
fireTargetModified();
return; private JPanel dsColumnRegion;
} private JPanel centerPane;
if (e.getStateChange() == ItemEvent.DESELECTED) { //数据集列选择组件
if (!isEditing) { private SelectedDataColumnPane dataPane;
return; //数据分组设置组件
} private ResultSetGroupDockingPane groupPane;
groupPane.update(); //过滤条件面板
fireTargetModified(); private JPanel conditionPane;
} // 基本和高级设置
} private ArrayList<CellEditorPane> paneList;
}; // 基本和高级设置 卡片布局
private CardLayout card;
private ItemListener dataListener = new ItemListener() { // 基本和高级设置 容器面板
private JPanel center;
@Override // 卡片布局TAB切换按钮
public void itemStateChanged(ItemEvent e) { private UIHeadGroup tabsHeaderIconPane;
if (e.getStateChange() == ItemEvent.SELECTED) { // 分组设置监听器
if (!isEditing) { private ItemListener groupListener = new ItemListener() {
return; @Override
} public void itemStateChanged(ItemEvent e) {
dataPane.update(cellElement); if (e == null) {
fireTargetModified(); //分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存
} groupPane.update();
} fireTargetModified();
}; return;
}
private CellDSColumnEditor() { if (e.getStateChange() == ItemEvent.DESELECTED) {
super(); if (!isEditing) {
} return;
}
@Override groupPane.update();
public JComponent createCenterBody() { fireTargetModified();
double p = TableLayout.PREFERRED; }
double f = TableLayout.FILL; }
double[] columnSize = {p, f}; };
double[] rowSize = {p, p, p, p}; //数据集列设置监听器
Component[][] components = new Component[][]{}; private ItemListener dataListener = new ItemListener() {
dsColumnRegion = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @Override
centerPane = new JPanel(new BorderLayout(0, 0)); public void itemStateChanged(ItemEvent e) {
centerPane.add(dsColumnRegion, BorderLayout.CENTER); if (e.getStateChange() == ItemEvent.SELECTED) {
return centerPane; if (!isEditing) {
} return;
}
// august:这里面的东西都全部重新动态生成,不然容易出错 dataPane.update(cellElement);
@Override fireTargetModified();
protected void refreshDetails() { }
JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); }
pane.add(new UIButton(new DSColumnConditionAction(tc)), BorderLayout.WEST); };
pane.add(new UIButton(new DSColumnAdvancedAction(tc)), BorderLayout.CENTER);
double p = TableLayout.PREFERRED; private CellDSColumnEditor() {
double f = TableLayout.FILL; super();
double[] columnSize = {p, f}; }
double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ /**
new Component[]{new UIButton(new DSColumnBasicAction(tc)), null}, * Test Main
new Component[]{pane, null}, *
new Component[]{dataPane = new SelectedDataColumnPane(false), null}, * @param args 参数
new Component[]{groupPane = new ResultSetGroupDockingPane(tc), null} */
}; public static void main(String[] args) {
centerPane.removeAll(); JFrame jf = new JFrame("test");
dsColumnRegion = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
centerPane.add(dsColumnRegion, BorderLayout.CENTER); JPanel content = (JPanel) jf.getContentPane();
dataPane.addListener(dataListener); content.setLayout(new BorderLayout());
groupPane.addListener(groupListener); content.add(new CellDSColumnEditor(), BorderLayout.CENTER);
dataPane.populate(null, cellElement); GUICoreUtils.centerWindow(jf);
groupPane.populate(cellElement); jf.setSize(220, 400);
this.validate(); jf.setVisible(true);
} }
/**
/** * 创建面板占位
* for 关闭时候释放 *
*/ * @return JComponent 详细信息面板
public void release () { */
super.release(); @Override
dsColumnRegion = null; public JComponent createCenterBody() {
centerPane = null; this.createPanes();
} this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(center, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout());
centerPane.add(dsColumnRegion, BorderLayout.CENTER);
return centerPane;
}
/**
* 内容全部重新动态生成不然容易出错
* 刷新详细信息面板
*/
@Override
protected void refreshDetails() {
this.createPanes();
this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(center, BorderLayout.CENTER);
//必须removeAll之后再添加;重新再实例化一个centerJPanel,因为对象变了会显示不出来
centerPane.removeAll();
centerPane.add(dsColumnRegion, BorderLayout.CENTER);
for (CellEditorPane cellEditorPane : paneList) {
cellEditorPane.populate(cellElement);
}
this.validate();
}
/**
* 关闭时候释放
*/
public void release() {
super.release();
dsColumnRegion = null;
centerPane = null;
}
/**
* 初始化基本和高级设置切换tab
*/
private void createSwitchTab() {
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
center = new JPanel(card);
center.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
for (int i = 0; i < paneList.size(); i++) {
CellEditorPane pane = paneList.get(i);
iconArray[i] = pane.getIconPath();
center.add(pane, pane.title4PopupWindow());
}
tabsHeaderIconPane = new UIHeadGroup(iconArray) {
@Override
public void tabChanged(int index) {
card.show(center, paneList.get(index).title4PopupWindow());
paneList.get(index).populate(cellElement);
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
}
/**
* 刷新数据列基本和高级设置面板
*/
private void createPanes() {
paneList = new ArrayList<>();
/*基本设置面板*/
this.dataPane = new SelectedDataColumnPane();
this.groupPane = new ResultSetGroupDockingPane(tc);
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
double[] rowSize = {p}, columnSize = {p, f};
UILabel uiLabel = new UILabel("filter");
UIButton uiButton = new UIButton();
if (tc != null) {
//第一次初始化时tc为空,引发NullPointerException
uiButton = new UIButton(new DSColumnConditionAction(tc));
}
Component[][] components = new Component[][]{
new Component[]{uiLabel, uiButton}
};
this.conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
dataPane.addListener(dataListener);
groupPane.addListener(groupListener);
paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane));
/*高级设置面板*/
paneList.add(new DSColumnAdvancedEditorPane());
}
} }

150
designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -1,75 +1,77 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import java.awt.event.ActionEvent; import com.fr.base.BaseUtils;
import java.awt.event.ActionListener; import com.fr.base.Style;
import com.fr.design.dialog.DialogActionAdapter;
import javax.swing.BorderFactory; import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane;
import com.fr.base.BaseUtils; import com.fr.general.ComparatorUtils;
import com.fr.base.Style; import com.fr.general.Inter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.quickeditor.CellQuickEditor;
import com.fr.design.mainframe.DesignerContext; import com.fr.report.cell.cellattr.CellImage;
import com.fr.design.report.SelectImagePane;
import com.fr.design.dialog.DialogActionAdapter; import javax.swing.*;
import com.fr.general.ComparatorUtils; import java.awt.event.ActionEvent;
import com.fr.general.Inter; import java.awt.event.ActionListener;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage; /**
* 单元格元素图片编辑器
public class CellImageQuickEditor extends CellQuickEditor { * TODO 9.0大体上没有改动
private static CellImageQuickEditor THIS; */
public class CellImageQuickEditor extends CellQuickEditor {
public static final CellImageQuickEditor getInstance() { private static CellImageQuickEditor THIS;
if(THIS == null) {
THIS = new CellImageQuickEditor(); public static final CellImageQuickEditor getInstance() {
} if (THIS == null) {
return THIS; THIS = new CellImageQuickEditor();
} }
return THIS;
private CellImageQuickEditor() { }
super();
} private CellImageQuickEditor() {
super();
@Override }
public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); @Override
editbutton.addActionListener(new ActionListener() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
@Override editbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showEditingDialog(); @Override
} public void actionPerformed(ActionEvent e) {
}); showEditingDialog();
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); }
editbutton.setMargin(null); });
editbutton.setOpaque(false); editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
return editbutton; editbutton.setMargin(null);
} editbutton.setOpaque(false);
return editbutton;
private void showEditingDialog() { }
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement); private void showEditingDialog() {
final Object oldValue = cellElement.getValue(); final SelectImagePane imageEditorPane = new SelectImagePane();
final Style oldStyle = cellElement.getStyle(); imageEditorPane.populate(cellElement);
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { final Object oldValue = cellElement.getValue();
final Style oldStyle = cellElement.getStyle();
@Override imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
public void doOk() {
CellImage cellImage = imageEditorPane.update(); @Override
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { public void doOk() {
cellElement.setValue(cellImage.getImage()); CellImage cellImage = imageEditorPane.update();
cellElement.setStyle(cellImage.getStyle()); if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
fireTargetModified(); cellElement.setValue(cellImage.getImage());
} cellElement.setStyle(cellImage.getStyle());
} fireTargetModified();
}
}).setVisible(true); }
}
}).setVisible(true);
@Override }
protected void refreshDetails() {
@Override
} protected void refreshDetails() {
}
} }

98
designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -1,50 +1,50 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import javax.swing.BorderFactory; import com.fr.design.actions.insert.cell.RichTextCellAction;
import javax.swing.JComponent; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.quickeditor.CellQuickEditor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import javax.swing.*;
import com.fr.quickeditor.CellQuickEditor;
/**
public class CellRichTextEditor extends CellQuickEditor { * 单元格元素富文本编辑器
private UIButton subReportButton; * TODO 9.0 大体上没有改动
private static CellRichTextEditor THIS; */
public class CellRichTextEditor extends CellQuickEditor {
public static final CellRichTextEditor getInstance() { private UIButton subReportButton;
if(THIS == null) { private static CellRichTextEditor THIS;
THIS = new CellRichTextEditor();
} public static final CellRichTextEditor getInstance() {
return THIS; if (THIS == null) {
} THIS = new CellRichTextEditor();
}
private CellRichTextEditor() { return THIS;
super(); }
}
private CellRichTextEditor() {
/** super();
* 创建界面上中间的部分 }
*
* @return 界面元素 /**
* * 创建界面上中间的部分
* *
* @date 2014-12-7-下午9:41:52 * @return 界面元素
* * @date 2014-12-7-下午9:41:52
*/ */
public JComponent createCenterBody() { public JComponent createCenterBody() {
subReportButton = new UIButton(); subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null); subReportButton.setMargin(null);
subReportButton.setOpaque(false); subReportButton.setOpaque(false);
return subReportButton; return subReportButton;
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor"));
subReportButton.setAction(subReportCellAction); subReportButton.setAction(subReportCellAction);
} }
} }

304
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -1,151 +1,155 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import java.awt.event.KeyAdapter; import com.fr.base.Formula;
import java.awt.event.KeyEvent; import com.fr.base.Style;
import com.fr.base.TextFormat;
import javax.swing.JComponent; import com.fr.design.gui.itextfield.UITextField;
import javax.swing.event.DocumentEvent; import com.fr.grid.selection.CellSelection;
import javax.swing.event.DocumentListener; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.base.Formula; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.base.Style; import com.fr.stable.ColumnRow;
import com.fr.base.TextFormat; import com.fr.stable.StringUtils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.grid.selection.CellSelection; import javax.swing.*;
import com.fr.quickeditor.CellQuickEditor; import javax.swing.event.DocumentEvent;
import com.fr.report.ReportHelper; import javax.swing.event.DocumentListener;
import com.fr.report.cell.DefaultTemplateCellElement; import java.awt.event.KeyAdapter;
import com.fr.stable.ColumnRow; import java.awt.event.KeyEvent;
import com.fr.stable.StringUtils;
/**
public class CellStringQuickEditor extends CellQuickEditor { *
*/
public class CellStringQuickEditor extends CellQuickEditor {
private static CellStringQuickEditor THIS; //instance
private static CellStringQuickEditor THIS;
private UITextField stringTextField; //文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private boolean isEditing = false; private UITextField stringTextField;
//编辑状态
public static final CellStringQuickEditor getInstance() { private boolean isEditing = false;
if (THIS == null) {
THIS = new CellStringQuickEditor(); public static CellStringQuickEditor getInstance() {
} if (THIS == null) {
return THIS; THIS = new CellStringQuickEditor();
} }
return THIS;
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置 }
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false;
private CellStringQuickEditor() { private boolean reserveOnWriteOrAnaly = true;
super();
} private DocumentListener documentListener = new DocumentListener() {
@Override
@Override public void insertUpdate(DocumentEvent e) {
/** changeReportPaneCell(stringTextField.getText().trim());
* }
*/
public JComponent createCenterBody() { @Override
stringTextField = new UITextField(); public void removeUpdate(DocumentEvent e) {
stringTextField.addKeyListener(new KeyAdapter() { changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void keyReleased(KeyEvent e) { @Override
if (tc != null) { public void changedUpdate(DocumentEvent e) {
tc.getGrid().dispatchEvent(e); changeReportPaneCell(stringTextField.getText().trim());
} }
}
};
});
private CellStringQuickEditor() {
return stringTextField; super();
} }
DocumentListener documentListener = new DocumentListener() { /**
* 详细信息面板
@Override * todo 文本框可自适应大小公式编辑也是在这边如果是公式那么要加一个公式编辑器的触发按钮
public void insertUpdate(DocumentEvent e) { */
changeReportPaneCell(stringTextField.getText().trim()); @Override
} public JComponent createCenterBody() {
stringTextField = new UITextField();
@Override stringTextField.addKeyListener(new KeyAdapter() {
public void removeUpdate(DocumentEvent e) { @Override
changeReportPaneCell(stringTextField.getText().trim()); public void keyReleased(KeyEvent e) {
} if (tc != null) {
tc.getGrid().dispatchEvent(e);
@Override }
public void changedUpdate(DocumentEvent e) { }
changeReportPaneCell(stringTextField.getText().trim()); });
} return stringTextField;
}
};
protected void changeReportPaneCell(String tmpText) { private void changeReportPaneCell(String tmpText) {
isEditing = true; isEditing = true;
//refresh一下,如果单元格内有新添加的控件,此时并不知道 //refresh一下,如果单元格内有新添加的控件,此时并不知道
CellSelection cs1 = (CellSelection) tc.getSelection(); CellSelection cs1 = (CellSelection) tc.getSelection();
ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow()); ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow());
columnRowTextField.setText(columnRow.toString()); columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow()); cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow());
if (cellElement == null) { if (cellElement == null) {
CellSelection cs = (CellSelection) tc.getSelection(); CellSelection cs = (CellSelection) tc.getSelection();
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tc.getEditingElementCase().addCellElement(cellElement, false); tc.getEditingElementCase().addCellElement(cellElement, false);
} }
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText); Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula); cellElement.setValue(textFormula);
} else { } else {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (cellElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
cellElement.setValue(tmpText); cellElement.setValue(tmpText);
} else { } else {
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
} }
} }
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextField.requestFocus();
isEditing = false; isEditing = false;
} }
@Override /**
protected void refreshDetails() { * 刷新详细内容
String str = null; */
if (cellElement == null) { @Override
str = StringUtils.EMPTY; protected void refreshDetails() {
} else { String str;
Object value = cellElement.getValue(); if (cellElement == null) {
if (value == null) { str = StringUtils.EMPTY;
str = StringUtils.EMPTY; } else {
} else if (value instanceof Formula) { Object value = cellElement.getValue();
Formula formula = (Formula) value; if (value == null) {
str = formula.getContent(); str = StringUtils.EMPTY;
reserveInResult = formula.isReserveInResult(); } else if (value instanceof Formula) {
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); Formula formula = (Formula) value;
} else { str = formula.getContent();
str = value.toString(); reserveInResult = formula.isReserveInResult();
} reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} } else {
showText(str); str = value.toString();
stringTextField.setEditable(tc.isSelectedOneCell()); }
} }
showText(str);
/** stringTextField.setEditable(tc.isSelectedOneCell());
* }
* @param str
*/ /**
public void showText(String str) { * 显示文本
// 本编辑框在输入过程中引发的后续事件如果还调用了本框的setText方法不能执行 *
if (isEditing) { * @param str 文本
return; */
} public void showText(String str) {
stringTextField.getDocument().removeDocumentListener(documentListener); // 正在编辑时不处理
stringTextField.setText(str); if (isEditing) {
stringTextField.getDocument().addDocumentListener(documentListener); return;
} }
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
}
} }

85
designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,42 +1,45 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import javax.swing.BorderFactory; import com.fr.design.actions.insert.cell.SubReportCellAction;
import javax.swing.JComponent; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.quickeditor.CellQuickEditor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import javax.swing.*;
import com.fr.quickeditor.CellQuickEditor;
/**
public class CellSubReportEditor extends CellQuickEditor { * 单元格元素子报表编辑器
private UIButton subReportButton; * TODO 9.0大体上没有改动
private static CellSubReportEditor THIS; */
public class CellSubReportEditor extends CellQuickEditor {
public static final CellSubReportEditor getInstance() { private UIButton subReportButton;
if(THIS == null) { private static CellSubReportEditor THIS;
THIS = new CellSubReportEditor();
} public static final CellSubReportEditor getInstance() {
return THIS; if (THIS == null) {
} THIS = new CellSubReportEditor();
}
private CellSubReportEditor() { return THIS;
super(); }
}
private CellSubReportEditor() {
@Override super();
public JComponent createCenterBody() { }
subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); @Override
subReportButton.setMargin(null); public JComponent createCenterBody() {
subReportButton.setOpaque(false); subReportButton = new UIButton();
return subReportButton; subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
} subReportButton.setMargin(null);
subReportButton.setOpaque(false);
@Override return subReportButton;
protected void refreshDetails() { }
SubReportCellAction subReportCellAction = new SubReportCellAction(tc);
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); @Override
subReportButton.setAction(subReportCellAction); protected void refreshDetails() {
} SubReportCellAction subReportCellAction = new SubReportCellAction(tc);
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"}));
subReportButton.setAction(subReportCellAction);
}
} }

72
designer_base/src/com/fr/design/data/datapane/VerticalChoosePane.java

@ -1,69 +1,67 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import java.awt.*;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
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.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class VerticalChoosePane extends ChoosePane implements DesignerBean{ public class VerticalChoosePane extends ChoosePane implements DesignerBean {
public VerticalChoosePane(Previewable previewable) { public VerticalChoosePane(Previewable previewable) {
this(previewable, -1); this(previewable, -1);
} }
public VerticalChoosePane(Previewable previewable, int labelSize) { public VerticalChoosePane(Previewable previewable, int labelSize) {
super(previewable, labelSize); super(previewable, labelSize);
DesignerContext.setDesignerBean("databasename", this); DesignerContext.setDesignerBean("databasename", this);
} }
@Override @Override
protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = {p, f};
double[] rowSize = { p, p, p }; double[] rowSize = {p, p, p};
JPanel rs = new JPanel(new BorderLayout(0, 0)); JPanel rs = new JPanel(new BorderLayout(0, 0));
rs.add(tableNameComboBox, BorderLayout.CENTER); rs.add(tableNameComboBox, BorderLayout.CENTER);
rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST);
UILabel l1 = new UILabel(Inter.getLocText("Database") + ":", UILabel.RIGHT); UILabel l1 = new UILabel(Inter.getLocText("FR-Designer_Database"), UILabel.LEFT);
UILabel l2 = new UILabel(Inter.getLocText("Model") + ":", UILabel.RIGHT); UILabel l2 = new UILabel(Inter.getLocText("FR-Designer_Model"), UILabel.LEFT);
UILabel l3 = new UILabel(Inter.getLocText(new String[]{"Database", "Table"}) + ":", UILabel.RIGHT); UILabel l3 = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Database", "FR-Designer_Table"}), UILabel.LEFT);
if (labelSize > 0) { if (labelSize > 0) {
Dimension pSize = new Dimension(labelSize, 20); Dimension pSize = new Dimension(labelSize, 20);
l1.setPreferredSize(pSize); l1.setPreferredSize(pSize);
l2.setPreferredSize(pSize); l2.setPreferredSize(pSize);
l3.setPreferredSize(pSize); l3.setPreferredSize(pSize);
} }
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{l1, dsNameComboBox}, new Component[]{l1, dsNameComboBox},
new Component[]{l2, schemaBox}, new Component[]{l2, schemaBox},
new Component[]{l3, rs} new Component[]{l3, rs}
}; };
JPanel content = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel content = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(content,BorderLayout.CENTER); this.add(content, BorderLayout.CENTER);
} }
@Override @Override
public void refreshBeanElement() { public void refreshBeanElement() {
initDsNameComboBox(); initDsNameComboBox();
} }
} }

418
designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -0,0 +1,418 @@
package com.fr.design.editor;
import com.fr.base.Formula;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.*;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by MoMeak on 2017/7/26.
*/
public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, GlobalNameObserver {
private static final int CENTERPANE_WIDTH = 200;
private Editor[] cards;
private Editor currentEditor;
private UIButton arrowButton;
private JPopupMenu menu;
private JPanel centerPane;
private CardLayout cardLayout;
private Object value;
private UIButtonGroup upButton;
private GlobalNameListener globalNameListener = null;
private UIObserverListener uiObserverListener = null;
public DoubleDeckValueEditorPane(Editor[] cards) {
this(cards, null, null);
}
public DoubleDeckValueEditorPane(Editor[] cards, String popupName, String textEditorValue) {
initComponents(cards, popupName, textEditorValue, CENTERPANE_WIDTH);
}
public DoubleDeckValueEditorPane(Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) {
initComponents(cards, popupName, textEditorValue, centerPaneWidth);
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula"))}), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
private void initComponents(final Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) {
this.setLayout(new BorderLayout(0, 4));
this.cards = cards;
final String[] nameArray = new String[cards.length];
for (int i = 0; i < cards.length; i++) {
nameArray[i] = cards[i].getName();
}
upButton = new UIButtonGroup(nameArray);
upButton.setAllToolTips(nameArray);
this.add(upButton, BorderLayout.NORTH);
centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
setCurrentEditor(0);
centerPane.setPreferredSize(new Dimension(centerPaneWidth, centerPane.getPreferredSize().height));
menu = createPopMenu();
upButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (globalNameListener != null) {
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy"));
}
Object oldValue = currentEditor.getValue();
setCurrentEditor(upButton.getSelectedIndex());
currentEditor.selected();
value = currentEditor.getValue();
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value);
}
});
this.add(centerPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Values-Editor");
}
public Editor getCurrentEditor() {
return currentEditor;
}
public int getCurrentEditorIndex() {
for (int i = 0; i < cards.length; i++) {
if (cards[i].getClass() == currentEditor.getClass()) {
return i;
}
}
return 0;
}
public void setCurrentEditor(int i) {
currentEditor = this.cards[i];
centerPane.removeAll();
centerPane.add(currentEditor);
centerPane.validate();
centerPane.repaint();
}
public void setCurrentEditor(Class editorClass) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].getClass() == editorClass) {
setCurrentEditor(i);
break;
}
}
}
private JPopupMenu createPopMenu() {
JPopupMenu scate = new JPopupMenu();
if (this.cards == null) {
return scate;
}
for (int i = 0; i < this.cards.length; i++) {
UIMenuItem item = new UIMenuItem(cards[i].getName());
final int j = i;
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (globalNameListener != null) {
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy"));
}
Object oldValue = currentEditor.getValue();
setCurrentEditor(j);
currentEditor.selected();
value = currentEditor.getValue();
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value);
}
});
scate.add(item);
if (i < cards.length - 1) {
scate.addSeparator();
}
}
return scate;
}
public void populate(Object object) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].accept(object)) {
setCardValue(i, object);
break;
}
}
}
public void populate(Object object, String name) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].accept(object) && ComparatorUtils.equals(cards[i].getName(), name)) {
setCardValue(i, object);
break;
}
}
}
private void setCardValue(int i, Object object) {
setCurrentEditor(i);
cards[i].setValue(object);
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
// 一定是最后的Editor哦.
for (int j = 0; j < cards.length; j++) {
if (i == j) {
upButton.setSelectedIndex(i);
continue;
}
this.cards[j].setValue(null);
}
}
public Object update() {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
// if (ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
// columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
// }
return columnIndex;
}
public Object update(String makeAdiff) {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
}
if (currentEditor instanceof ColumnNameEditor) {
columnName = ((ColumnNameEditor) currentEditor).getColumnName();
}
return new Object[]{columnIndex, columnName};
}
public Object update(boolean isXMLA) {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
}
if (isXMLA) {
columnName = ((XMLANameEditor) currentEditor).getColumnName();
}
return new Object[]{columnIndex, columnName};
}
public void setEditors(Editor[] editors, Object obj) {
this.cards = editors;
this.populate(obj);
}
/**
* 检查是否有效
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
if (!(currentEditor instanceof TextEditor)) {
return;
}
int i;
boolean containFormulaType = false;
for (i = 0; i < cards.length; i++) {
if (ComparatorUtils.equals(cards[i].getName(), Inter.getLocText("FR-Engine_Parameter-Formula"))) {
containFormulaType = true;
break;
}
}
if (!containFormulaType) {
return;
}
final int j = i;
if (!(currentEditor instanceof TextEditor)) {
return;
}
String string = (String) currentEditor.getValue();
if (isFormula(string)) {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Edit_String_To_Formula")
+ "?", Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j);
Formula formula = new Formula(string);
currentEditor.setValue(formula);
}
} else {
setCurrentEditor(j);
Formula formula = new Formula(string);
currentEditor.setValue(formula);
}
}
}
}
private boolean isFormula(String string) {
return StringUtils.isNotBlank(string) && (string.length() > 0 && string.charAt(0) == '=');
}
@Override
public void setEnabled(boolean enabled) {
arrowButton.setEnabled(enabled);
for (Editor card : cards) {
card.setEnabled(enabled);
}
}
/**
* 重置组件
*/
public void resetComponets() {
for (Editor card : cards) {
card.reset();
}
}
/**
* 清除组件数据
*/
public void clearComponentsData() {
for (Editor card : cards) {
card.clearData();
}
}
public Editor[] getCards() {
return this.cards;
}
public JPopupMenu getMenu() {
return this.menu;
}
/**
* 注册全局名字监听事件
*
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 是否对名字listener监听器做出响应
*
* @return 如果要做出响应则返回true
*/
public boolean shouldResponseNameListener() {
return false;
}
public void setGlobalName(String name) {
for (Editor card : cards) {
setComponentGlobalName(card, name);
}
}
private void setComponentGlobalName(Container card, String name) {
for (int i = 0, len = card.getComponentCount(); i < len; i++) {
Component component = card.getComponent(i);
if (component instanceof GlobalNameObserver) {
((GlobalNameObserver) component).setGlobalName(name);
} else {
setComponentGlobalName((Container) component, name);
}
}
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
for (Editor card : cards) {
doLoop(card, listener);
}
}
private void doLoop(Container card, UIObserverListener listener) {
for (int i = 0, len = card.getComponentCount(); i < len; i++) {
Component component = card.getComponent(i);
if (component instanceof UIObserver) {
((UIObserver) component).registerChangeListener(listener);
} else {
doLoop((Container) component, listener);
}
}
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
}

86
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -6,16 +6,15 @@ import com.fr.design.gui.itoolbar.UIToolbar;
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.EastRegionContainerPane; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -29,7 +28,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
private ToolBarDef toolbarDef; private ToolBarDef toolbarDef;
private UIToolbar toolBar; private UIToolbar toolBar;
protected PopupEditPane popupEditPane; protected PopupEditDialog popupEditDialog;
// peter:这是整体的一个cardLayout Pane // peter:这是整体的一个cardLayout Pane
protected CardLayout cardLayout; protected CardLayout cardLayout;
@ -90,6 +89,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
this.cardPane = cardPane; this.cardPane = cardPane;
} }
public abstract void saveSettings();
protected void initComponentPane() { protected void initComponentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creators = this.createNameableCreators(); this.creators = this.createNameableCreators();
@ -103,7 +104,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
UILabel selectLabel = new UILabel(); UILabel selectLabel = new UILabel();
cardPane.add(selectLabel, "SELECT"); cardPane.add(selectLabel, "SELECT");
cardPane.add(controlUpdatePane, "EDIT"); cardPane.add(controlUpdatePane, "EDIT");
popupEditPane = new PopupEditPane(cardPane); popupEditDialog = new PopupEditDialog(cardPane);
// SplitPane // SplitPane
// JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); // JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
// mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); // mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
@ -155,7 +156,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
double[] columnSize = { p, f }; double[] columnSize = { p, f };
double[] rowSize = { p}; double[] rowSize = { p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel("add hyperlink "), topToolBar}, new Component[]{new UILabel(getAddItemText()), topToolBar},
}; };
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
@ -164,6 +165,13 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return leftPane; return leftPane;
} }
/**
* 子类重写此方法可以改变标签内容
*/
protected String getAddItemText() {
return "add item ";
}
/** /**
* 初始化左边面板 * 初始化左边面板
*/ */
@ -178,7 +186,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
protected ShortCut4JControlPane[] createShortcuts() { protected ShortCut4JControlPane[] createShortcuts() {
return new ShortCut4JControlPane[]{ return new ShortCut4JControlPane[]{
// addItemShortCut(),
copyItemShortCut(), copyItemShortCut(),
moveUpItemShortCut(), moveUpItemShortCut(),
moveDownItemShortCut(), moveDownItemShortCut(),
@ -243,44 +250,41 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
// 点击"编辑"按钮,弹出面板 // 点击"编辑"按钮,弹出面板
protected class PopupEditPane extends JPopupMenu { protected class PopupEditDialog extends JDialog {
private JComponent contentPane; private JComponent editPane;
private static final int WIDTH = 460; private static final int WIDTH = 470;
private static final int HEIGHT = 500; private static final int HEIGHT = 550;
// private PopupToolPane popupToolPane;
// private int fixedHeight; PopupEditDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame());
PopupEditPane(JComponent pane) { setUndecorated(true);
contentPane = pane; this.editPane = pane;
this.setLayout(new BorderLayout()); this.getContentPane().add(editPane, BorderLayout.CENTER);
this.add(contentPane, BorderLayout.CENTER); setSize(WIDTH, HEIGHT);
this.setOpaque(false); // pack();
contentPane.setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.setVisible(false);
// fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; initListener();
// updateSize();
}
// private void updateSize() {
// int newHeight = fixedHeight + contentPane.getPreferredSize().height;
// this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
// }
public JComponent getContentPane() {
return contentPane;
} }
public void replaceContentPane(JComponent pane) { private void hideDialog() {
// remove(pane); // 检查是否有子弹窗,如果有,则不隐藏
this.remove(this.contentPane); for (Window window : getOwnedWindows()) {
this.add(this.contentPane = pane); if (window.isVisible()) {
// updateSize(); return;
refreshContainer(); }
}
saveSettings();
setVisible(false);
} }
private void refreshContainer() { private void initListener() {
validate(); addWindowFocusListener(new WindowAdapter() {
repaint(); @Override
revalidate(); public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
hideDialog();
}
});
} }
} }
} }

71
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -15,6 +15,7 @@ import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
@ -26,10 +27,10 @@ import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import sun.swing.DefaultLookup;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
@ -37,6 +38,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
@ -54,6 +57,7 @@ public abstract class UIListControlPane extends UIControlPane {
protected int editingIndex; protected int editingIndex;
protected String selectedName; protected String selectedName;
private boolean isNameRepeated = false; private boolean isNameRepeated = false;
protected boolean isPopulating = false;
public UIListControlPane() { public UIListControlPane() {
this.initComponentPane(); this.initComponentPane();
@ -96,6 +100,22 @@ public abstract class UIListControlPane extends UIControlPane {
} }
} }
}); });
nameableList.getModel().addListDataListener(new ListDataListener() {
@Override
public void intervalAdded(ListDataEvent e) {
saveSettings();
}
@Override
public void intervalRemoved(ListDataEvent e) {
saveSettings();
}
@Override
public void contentsChanged(ListDataEvent e) {
saveSettings();
}
});
} }
public UINameEdList createJNameList() { public UINameEdList createJNameList() {
@ -176,9 +196,11 @@ public abstract class UIListControlPane extends UIControlPane {
@Override @Override
public void populate(Nameable[] nameableArray) { public void populate(Nameable[] nameableArray) {
isPopulating = true; // 加一个标识位,避免切换单元格时,触发 saveSettings
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
listModel.removeAllElements(); listModel.removeAllElements();
if (ArrayUtils.isEmpty(nameableArray)) { if (ArrayUtils.isEmpty(nameableArray)) {
isPopulating = false;
return; return;
} }
@ -190,6 +212,8 @@ public abstract class UIListControlPane extends UIControlPane {
this.nameableList.setSelectedIndex(0); this.nameableList.setSelectedIndex(0);
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
isPopulating = false;
} }
/** /**
@ -358,12 +382,45 @@ public abstract class UIListControlPane extends UIControlPane {
} }
} }
private void popupEditPane() { private void popupEditDialog(Point mousePos) {
if (editingIndex < 0) { Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex);
if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) {
return; return;
} }
GUICoreUtils.showPopupMenu(popupEditPane, this, popupEditDialog.setLocation(getPopupDialogLocation());
- popupEditPane.getPreferredSize().width, editingIndex * EDIT_RANGE); popupEditDialog.setVisible(true);
}
private Point getPopupDialogLocation() {
Point resultPos = new Point(0, 0);
Point listPos = nameableList.getLocationOnScreen();
resultPos.x = listPos.x - popupEditDialog.getWidth();
resultPos.y = listPos.y + (editingIndex - 1) * EDIT_RANGE;
// 当对象在屏幕上的位置比较靠下时,往下移动弹窗至与属性面板平齐
Window frame = DesignerContext.getDesignerFrame();
// 不能太低
int maxY = frame.getLocationOnScreen().y + frame.getHeight() - popupEditDialog.getHeight();
if (resultPos.y > maxY) {
resultPos.y = maxY;
}
// 也不能太高
int minY = frame.getLocationOnScreen().y + EDIT_RANGE;
if (resultPos.y < minY) {
resultPos.y = minY;
}
// 当在左侧显示不下时,在右侧弹出弹窗
if (resultPos.x < 0) {
resultPos.x = listPos.x + nameableList.getParent().getWidth();
}
// 如果右侧显示不下,可以向左移动
int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE;
if (resultPos.x > maxX) {
resultPos.x = maxX;
}
return resultPos;
} }
/** /**
@ -669,7 +726,7 @@ public abstract class UIListControlPane extends UIControlPane {
nameableList.editItemAt(nameableList.getSelectedIndex()); nameableList.editItemAt(nameableList.getSelectedIndex());
} else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) {
editingIndex = nameableList.getSelectedIndex(); editingIndex = nameableList.getSelectedIndex();
popupEditPane(); popupEditDialog(evt.getPoint());
} }
// peter:处理右键的弹出菜单 // peter:处理右键的弹出菜单

8
designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -54,7 +54,7 @@ public class UINameableListCellRenderer extends
// editButton.addActionListener(new ActionListener() { // editButton.addActionListener(new ActionListener() {
// @Override // @Override
// public void actionPerformed(ActionEvent e) { // public void actionPerformed(ActionEvent e) {
// popupEditPane(); // popupEditDialog();
// } // }
// }); // });
label = new UILabel(); label = new UILabel();
@ -143,18 +143,12 @@ public class UINameableListCellRenderer extends
Nameable wrappee = ((ListModelElement) value).wrapper; Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName()); this.setText(((ListModelElement) value).wrapper.getName());
boolean iconSet = false;
for (NameableCreator creator : listControlPane.creators()) { for (NameableCreator creator : listControlPane.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
// this.setIcon(creator.menuIcon());
this.setToolTipText(creator.createTooltip()); this.setToolTipText(creator.createTooltip());
iconSet = true;
break; break;
} }
} }
// if (!iconSet) {
// this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
// }
} }
return this; return this;

25
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -1,10 +1,12 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
@ -25,6 +27,12 @@ import java.util.Set;
* @version 创建时间2013-6-25 上午11:17:57 * @version 创建时间2013-6-25 上午11:17:57
*/ */
public abstract class HyperlinkGroupPane extends UIListControlPane { public abstract class HyperlinkGroupPane extends UIListControlPane {
protected HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider;
public HyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super();
this.hyperlinkGroupPaneActionProvider = hyperlinkGroupPaneActionProvider;
}
/** /**
* 生成添加按钮的NameableCreator * 生成添加按钮的NameableCreator
* *
@ -53,6 +61,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Hyperlink"); return Inter.getLocText("FR-Designer_Hyperlink");
} }
@Override
protected String getAddItemText() {
return Inter.getLocText("FR-Designer_Add_Hyperlink");
}
public void populate(NameJavaScriptGroup nameHyperlink_array) { public void populate(NameJavaScriptGroup nameHyperlink_array) {
java.util.List<NameObject> list = new ArrayList<NameObject>(); java.util.List<NameObject> list = new ArrayList<NameObject>();
if (nameHyperlink_array != null) { if (nameHyperlink_array != null) {
@ -64,6 +77,10 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
this.populate(list.toArray(new NameObject[list.size()])); this.populate(list.toArray(new NameObject[list.size()]));
} }
public void populate(TargetComponent elementCasePane) {
hyperlinkGroupPaneActionProvider.populate(this, elementCasePane);
}
/** /**
* updateJs的Group * updateJs的Group
* *
@ -79,4 +96,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return new NameJavaScriptGroup(res_array); return new NameJavaScriptGroup(res_array);
} }
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
hyperlinkGroupPaneActionProvider.saveSettings(this);
}
} }

11
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java

@ -0,0 +1,11 @@
package com.fr.design.gui.frpane;
import com.fr.design.designer.TargetComponent;
/**
* Created by plough on 2017/7/26.
*/
public interface HyperlinkGroupPaneActionProvider {
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
void saveSettings(HyperlinkGroupPane hyperlinkGroupPane);
}

22
designer_base/src/com/fr/design/gui/ibutton/FiveButtonLayout.java

@ -12,20 +12,26 @@ import java.awt.*;
public class FiveButtonLayout extends GridLayout { public class FiveButtonLayout extends GridLayout {
private static final double SECOND_ROW = 1.25; private static final double SECOND_ROW = 1.25;
public FiveButtonLayout () { public FiveButtonLayout(int rows) {
super(2, 3, 1, 1); super(rows, 3, 1, 1);
} }
/** /**
* 容器布局 * 容器布局
*
* @param parent 容器 * @param parent 容器
*/ */
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
synchronized(parent.getTreeLock()) { synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets(); Insets insets = parent.getInsets();
int ncomponents = parent.getComponentCount(); int ncomponents = parent.getComponentCount();
int nrows = 2; int nrows = 2;
int ncols = 3; int ncols = 3;
if (ncomponents == 3) {
nrows = 1;
ncols = 3;
}
if (ncomponents == 0) { if (ncomponents == 0) {
return; return;
} }
@ -36,14 +42,14 @@ public class FiveButtonLayout extends GridLayout {
} }
int w = parent.getWidth() - (insets.left + insets.right); int w = parent.getWidth() - (insets.left + insets.right);
int h = parent.getHeight() - (insets.top + insets.bottom); int h = parent.getHeight() - (insets.top + insets.bottom);
w = (w - (ncols - 1) ) / ncols; w = (w - (ncols - 1)) / ncols;
h = (h - (nrows - 1) ) / nrows; h = (h - (nrows - 1)) / nrows;
for (int i = 0, x = insets.left, y = insets.top; i < ncols; i ++, x += w + 1) { for (int i = 0, x = insets.left, y = insets.top; i < ncols; i++, x += w + 1) {
parent.getComponent(i).setBounds(x, y, w, h); parent.getComponent(i).setBounds(x, y, w, h);
} }
int line2w = (int) (SECOND_ROW * w); int line2w = (int) (SECOND_ROW * w);
int secondRowCount = ncomponents-ncols; int secondRowCount = ncomponents - ncols;
int startx= (parent.getWidth()-line2w*secondRowCount-secondRowCount-1)/2; int startx = (parent.getWidth() - line2w * secondRowCount - secondRowCount - 1) / 2;
for (int i = ncols, x = startx, y = insets.top + h + 1; i < ncomponents; i++, x += line2w + 1) { for (int i = ncols, x = startx, y = insets.top + h + 1; i < ncomponents; i++, x += line2w + 1) {
parent.getComponent(i).setBounds(x, y, line2w, h); parent.getComponent(i).setBounds(x, y, line2w, h);
} }

2
designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

@ -39,7 +39,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
if (number < BUTTON_NUMBER || isOneLineTab) { if (number < BUTTON_NUMBER || isOneLineTab) {
return super.getGridLayout(number); return super.getGridLayout(number);
} else if (number == BUTTON_NUMBER || number == SEVEN_NUMBER) { } else if (number == BUTTON_NUMBER || number == SEVEN_NUMBER) {
return new FiveButtonLayout(); return new FiveButtonLayout(2);
} else { } else {
return new GridLayout(2, 3, 1, 1); return new GridLayout(2, 3, 1, 1);
} }

5
designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -132,7 +132,10 @@ public class UIEastResizableContainer extends JPanel {
* @param containerWidth * @param containerWidth
*/ */
public void setLastContainerWidth(int containerWidth) { public void setLastContainerWidth(int containerWidth) {
this.containerWidth = containerWidth; if (containerWidth == leftPaneWidth) {
this.containerWidth = containerWidth;
}
// 忽略其他情况
} }
private LayoutManager containerLayout = new LayoutManager() { private LayoutManager containerLayout = new LayoutManager() {

5
designer_base/src/com/fr/design/gui/ilist/UIList.java

@ -1,6 +1,7 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.design.gui.controlpane.UINameableListCellRenderer;
import com.fr.design.gui.itooltip.UIToolTip; import com.fr.design.gui.itooltip.UIToolTip;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -43,6 +44,10 @@ public class UIList extends JList {
Object value = getModel().getElementAt(index); Object value = getModel().getElementAt(index);
ListCellRenderer renderer = getCellRenderer(); ListCellRenderer renderer = getCellRenderer();
Component rendererComp = renderer.getListCellRendererComponent(this, value, index, true, false); Component rendererComp = renderer.getListCellRendererComponent(this, value, index, true, false);
// UINameableListCellRenderer 继承自JPanel,无法强转为JLabel,直接返回即可
if (rendererComp instanceof UINameableListCellRenderer) {
return null;
}
if (rendererComp.getPreferredSize().width > getVisibleRect().width) { if (rendererComp.getPreferredSize().width > getVisibleRect().width) {
String tips = (rendererComp instanceof JComponent) ? ((JComponent) rendererComp).getToolTipText() : null; String tips = (rendererComp instanceof JComponent) ? ((JComponent) rendererComp).getToolTipText() : null;
if (tips == null) { if (tips == null) {

686
designer_base/src/com/fr/design/gui/style/AlignmentPane.java

@ -7,8 +7,10 @@ package com.fr.design.gui.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.IndentationUnitProcessor; import com.fr.design.fun.IndentationUnitProcessor;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
@ -36,354 +38,378 @@ import java.util.Arrays;
* Pane to edit cell alignment. * Pane to edit cell alignment.
*/ */
public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver { public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final int ANGEL = 90; private static final int ANGEL = 90;
private static final Dimension SPINNER_DIMENSION = new Dimension(60, 20);
private static final String[] TEXT = {Inter.getLocText("FR-Designer_StyleAlignment_Wrap_Text"), Inter.getLocText("FR-Designer_StyleAlignment_Single_Line"),
Inter.getLocText("FR-Designer_StyleAlignment_Single_Line(Adjust_Font)"), Inter.getLocText("FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)")};
private static final String[] TEXT = {Inter.getLocText("StyleAlignment-Wrap_Text"), Inter.getLocText("StyleAlignment-Single_Line"), private static final String[] LAYOUT = {Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled"),
Inter.getLocText("StyleAlignment-Single_Line(Adjust_Font)"), Inter.getLocText("StyleAlignment-Multi_Line(Adjust_Font)")}; Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust")};
private static final String[] LAYOUT = {Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled"), private JPanel hPaneContainer;
Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust")}; private JPanel vPaneContainer;
private JPanel rotationBarCC;
private JPanel basicPane;
private JPanel seniorPane;
private JPanel hPaneContainer; private UIComboBox textComboBox;
private JPanel vPaneContainer; private UIComboBox textRotationComboBox;
private JPanel rotationBarCC; private UIComboBox imageLayoutComboBox;
private UIComboBox textComboBox; private UIButtonGroup<Integer> hAlignmentPane;// 左对齐 水平居中 右对齐 水平分散
private UIComboBox textRotationComboBox; private UIButtonGroup<Integer> vAlignmentPane;// 居上 垂直居中 居下
private UIComboBox imageLayoutComboBox;
private UIButtonGroup<Integer> hAlignmentPane;// 左对齐 水平居中 右对齐 水平分散 private UINumberDragPane rotationPane;
private UIButtonGroup<Integer> vAlignmentPane;// 居上 垂直居中 居下
private UINumberDragPane rotationPane; private UISpinner leftIndentSpinner;
private UISpinner rightIndentSpinner;
private UISpinner leftIndentSpinner; private UISpinner spaceBeforeSpinner;
private UISpinner rightIndentSpinner; private UISpinner spaceAfterSpinner;
private UISpinner lineSpaceSpinner;
private GlobalNameListener globalNameListener = null;
private IndentationUnitProcessor indentationUnitProcessor = null;
private UISpinner spaceBeforeSpinner; public AlignmentPane() {
private UISpinner spaceAfterSpinner; this.initComponents();
private UISpinner lineSpaceSpinner; }
private GlobalNameListener globalNameListener = null;
private IndentationUnitProcessor indentationUnitProcessor = null;
public AlignmentPane() {
this.initComponents();
}
protected void initComponents() { protected void initComponents() {
textComboBox = new UIComboBox(TEXT); textComboBox = new UIComboBox(TEXT);
imageLayoutComboBox = new UIComboBox(LAYOUT); imageLayoutComboBox = new UIComboBox(LAYOUT);
initTextRotationCombox(); initTextRotationCombox();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png")};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Left"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Right"), hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Left"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Right"),
Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Distributed"),Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_DEFAULT")}); Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Distributed"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_DEFAULT")});
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
Icon[] vAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), Icon[] vAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment); vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Top"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Bottom")}); vAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Top"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Bottom")});
initOtherComponent(); initOtherComponent();
initAllNames(); initAllNames();
indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING); indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING);
if (null == indentationUnitProcessor){ if (null == indentationUnitProcessor) {
indentationUnitProcessor = new DefaultIndentationUnitProcessor(); indentationUnitProcessor = new DefaultIndentationUnitProcessor();
} }
} }
private void initOtherComponent() { private void initOtherComponent() {
hPaneContainer.add(hAlignmentPane); hPaneContainer.add(hAlignmentPane);
vPaneContainer.add(vAlignmentPane); vPaneContainer.add(vAlignmentPane);
rotationPane = new UINumberDragPane(-ANGEL, ANGEL); rotationPane = new UINumberDragPane(-ANGEL, ANGEL);
leftIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); leftIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
rightIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); rightIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
spaceBeforeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); spaceBeforeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
spaceAfterSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); spaceAfterSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
lineSpaceSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); lineSpaceSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
rotationBarCC = new JPanel(new CardLayout()); rotationBarCC = new JPanel(new CardLayout());
rotationBarCC.add(rotationPane, "show"); rotationBarCC.add(rotationPane, "show");
rotationBarCC.add(new JPanel(), "hide"); rotationBarCC.add(new JPanel(), "hide");
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createPane(), BorderLayout.CENTER); this.add(createPane(), BorderLayout.CENTER);
textRotationComboBox.addItemListener(new ItemListener() { textRotationComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
CardLayout cc = (CardLayout) rotationBarCC.getLayout(); CardLayout cc = (CardLayout) rotationBarCC.getLayout();
cc.show(rotationBarCC, textRotationComboBox.getSelectedIndex() == 0 ? "show" : "hide"); cc.show(rotationBarCC, textRotationComboBox.getSelectedIndex() == 0 ? "show" : "hide");
} }
}); });
} }
private void initTextRotationCombox(){ private void initTextRotationCombox() {
ArrayList<String> selectOption = new ArrayList<String>(); ArrayList<String> selectOption = new ArrayList<String>();
selectOption.add(Inter.getLocText("FR-Designer_Custom-Angle")); selectOption.add(Inter.getLocText("FR-Designer_Custom-Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption())); selectOption.addAll(Arrays.asList(processor.getComboxOption()));
textRotationComboBox = new UIComboBox(selectOption.toArray(new String[selectOption.size()])); textRotationComboBox = new UIComboBox(selectOption.toArray(new String[selectOption.size()]));
} }
private void initAllNames() { private void initAllNames() {
hAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal")); hAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal"));
vAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical")); vAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical"));
imageLayoutComboBox.setGlobalName(Inter.getLocText("Image-Image_Layout")); imageLayoutComboBox.setGlobalName(Inter.getLocText("FR-Designer_Image_Layout"));
textComboBox.setGlobalName(Inter.getLocText("StyleAlignment-Text_Style")); textComboBox.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Style"));
textRotationComboBox.setGlobalName(Inter.getLocText("StyleAlignment-Text_Rotation")); textRotationComboBox.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation"));
rotationPane.setGlobalName(Inter.getLocText("StyleAlignment-Text_Rotation")); rotationPane.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation"));
leftIndentSpinner.setGlobalName(Inter.getLocText("Style-Left_Indent")); leftIndentSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Left_Indent"));
rightIndentSpinner.setGlobalName(Inter.getLocText("Style-Right_Indent")); rightIndentSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Right_Indent"));
spaceBeforeSpinner.setGlobalName(Inter.getLocText("Style-Spacing_Before")); spaceBeforeSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Spacing_Before"));
spaceAfterSpinner.setGlobalName(Inter.getLocText("Style-Spacing_After")); spaceAfterSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Spacing_After"));
lineSpaceSpinner.setGlobalName(Inter.getLocText("Style-Line_Spacing")); lineSpaceSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Line_Spacing"));
} }
private JPanel createPane() {
private JPanel createPane() { JPanel jp1 = new JPanel(new BorderLayout());
JPanel jp1 = new JPanel(new BorderLayout(0, 10)); basicPane = new JPanel();
JPanel jp2 = new JPanel(new BorderLayout(0, 10)); seniorPane = new JPanel();
double p = TableLayout.PREFERRED; basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 20, basicPane());
double f = TableLayout.FILL; seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 20, seniorPane());
double[] columnSize1 = {p, f};
double[] rowSize1 = {p, p, p, p, p, p, p, p, p, p, p, p, p, p}; jp1.add(basicPane, BorderLayout.NORTH);
Component[][] components1 = new Component[][]{ jp1.add(seniorPane, BorderLayout.CENTER);
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Style")), null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal") + ":", UILabel.RIGHT), hPaneContainer}, return jp1;
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical") + ":", UILabel.RIGHT), vPaneContainer}, }
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null},
new Component[]{new UILabel(Inter.getLocText("Image-Image_Layout")), null}, private JPanel basicPane() {
new Component[]{imageLayoutComboBox, null}, double f = TableLayout.FILL;
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, double p = TableLayout.PREFERRED;
new Component[]{new UILabel(Inter.getLocText("StyleAlignment-Text_Style")), null}, Component[][] components = new Component[][]{
new Component[]{textComboBox, null}, new Component[]{null, null},
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal") + " ", SwingConstants.LEFT), hPaneContainer},
new Component[]{new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), null}, new Component[]{null, null},
new Component[]{textRotationComboBox, null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer},
new Component[]{rotationBarCC, null}, new Component[]{null, null}
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, };
}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p, f};
double[] columnSize2 = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
double[] rowSize2 = {p, p, p, p}; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
Component[][] components2 = new Component[][]{ }
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Style_Indentation")), null},
new Component[]{new UILabel(Inter.getLocText("Style-Left_Indent") + ":", SwingConstants.RIGHT), creatSpinnerPane(leftIndentSpinner)}, private JPanel seniorPane() {
new Component[]{new UILabel(Inter.getLocText("Style-Right_Indent") + ":", SwingConstants.RIGHT), creatSpinnerPane(rightIndentSpinner)}, JPanel senPane = new JPanel(new BorderLayout());
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, double f = TableLayout.FILL;
}; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
double[] columnSize3 = {p, f}; new Component[]{null, null},
double[] rowSize3 = {p, p, p, p}; new Component[]{new UILabel((Inter.getLocText("FR-Designer_Image_Layout")) + " ", SwingConstants.LEFT), imageLayoutComboBox},
Component[][] components3 = new Component[][]{ new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Style_Spacing")), null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_StyleAlignment_Text_Style") + " ", SwingConstants.LEFT), textComboBox},
new Component[]{new UILabel(Inter.getLocText("Style-Spacing_Before") + ":", SwingConstants.RIGHT), creatSpinnerPane(spaceBeforeSpinner)}, new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("Style-Spacing_After") + ":", SwingConstants.RIGHT), creatSpinnerPane(spaceAfterSpinner)}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation") + " ", SwingConstants.LEFT), textRotationComboBox},
new Component[]{new UILabel(Inter.getLocText("Style-Line_Spacing") + ":", SwingConstants.RIGHT), creatSpinnerPane(lineSpaceSpinner)}, new Component[]{null, rotationBarCC},
}; new Component[]{null, null},
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1); };
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2); double[] rowSize = {p, p, p, p, p, p, p, p};
JPanel southPane = TableLayoutHelper.createTableLayoutPane(components3, rowSize3, columnSize3); double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
jp2.add(centerPane, BorderLayout.NORTH); JPanel tempPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
jp2.add(southPane, BorderLayout.CENTER); senPane.add(tempPane, BorderLayout.NORTH);
jp1.add(northPane, BorderLayout.NORTH); senPane.add(seniorDownPane(), BorderLayout.CENTER);
jp1.add(jp2, BorderLayout.CENTER); return senPane;
return jp1;
} }
private JPanel creatSpinnerPane(Component comp) { private JPanel seniorDownPane() {
JPanel jp = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); double f = TableLayout.FILL;
jp.add(comp); double p = TableLayout.PREFERRED;
return jp; leftIndentSpinner.setPreferredSize(SPINNER_DIMENSION);
} rightIndentSpinner.setPreferredSize(SPINNER_DIMENSION);
spaceBeforeSpinner.setPreferredSize(SPINNER_DIMENSION);
/** spaceAfterSpinner.setPreferredSize(SPINNER_DIMENSION);
* 标题 lineSpaceSpinner.setPreferredSize(SPINNER_DIMENSION);
* @return 标题 Component[][] components = new Component[][]{
*/ new Component[]{null, null, null},
public String title4PopupWindow() { new Component[]{new UILabel((Inter.getLocText("FR-Designer-StyleAlignment_Style_Indentation")) + " ", SwingConstants.LEFT), creatSpinnerPane(leftIndentSpinner), creatSpinnerPane(rightIndentSpinner)},
return Inter.getLocText("FR-Designer-StyleAlignment_Style_Alignment"); new Component[]{null, new UILabel((Inter.getLocText("FR-Designer_Left")), SwingConstants.CENTER), new UILabel((Inter.getLocText("FR-Designer_Right")), SwingConstants.CENTER)},
} new Component[]{new UILabel((Inter.getLocText("FR-Designer-StyleAlignment_Style_PartSpacing")) + " ", SwingConstants.LEFT), creatSpinnerPane(spaceBeforeSpinner), creatSpinnerPane(spaceAfterSpinner)},
new Component[]{null, new UILabel((Inter.getLocText("FR-Designer_Front")), SwingConstants.CENTER), new UILabel((Inter.getLocText("FR-Designer_Behind")), SwingConstants.CENTER)},
/** new Component[]{new UILabel((Inter.getLocText("FR-Designer_Style_Line_Spacing")) + " ", SwingConstants.LEFT), creatSpinnerPane(lineSpaceSpinner), null},
* Populate cellstyle border. };
* double[] rowSize = {p, p, p, p, p, p};
* @param style the new style. double[] columnSize = {p, f, f};
*/ return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
public void populateBean(Style style) { }
hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style));
vAlignmentPane.setSelectedItem(style.getVerticalAlignment()); private JPanel creatSpinnerPane(Component comp) {
JPanel jp = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE) { jp.add(comp);
this.textComboBox.setSelectedIndex(1); return jp;
} else if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINEADJUSTFONT) { }
this.textComboBox.setSelectedIndex(2);
} else if (style.getTextStyle() == Style.TEXTSTYLE_MULTILINEADJUSTFONT) { /**
this.textComboBox.setSelectedIndex(3); * 标题
} else { *
this.textComboBox.setSelectedIndex(0); * @return 标题
} */
if (style.getVerticalText() == Style.VERTICALTEXT) { public String title4PopupWindow() {
textRotationComboBox.setSelectedIndex(style.getTextDirection() == Style.LEFT_TO_RIGHT ? 1 : 2); return Inter.getLocText("FR-Designer-StyleAlignment_Style_Alignment");
} else { }
textRotationComboBox.setSelectedIndex(0);
rotationPane.populateBean((double) style.getRotation()); /**
} * Populate cellstyle border.
if (style.getImageLayout() == Constants.IMAGE_TILED) {
imageLayoutComboBox.setSelectedIndex(1);
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) {
imageLayoutComboBox.setSelectedIndex(2);
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) {
imageLayoutComboBox.setSelectedIndex(3);
} else {
imageLayoutComboBox.setSelectedIndex(0);
}
int leftPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingLeft());
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight());
// alex:indent
this.leftIndentSpinner.setValue(new Integer(leftPadding));
this.rightIndentSpinner.setValue(new Integer(rightPadding));
this.spaceBeforeSpinner.setValue(style.getSpacingBefore());
this.spaceAfterSpinner.setValue(style.getSpacingAfter());
this.lineSpaceSpinner.setValue(style.getLineSpacing());
}
/**
* Update cellstyle border
*
* @param style the new style.
*/
public Style update(Style style) {
// peter:需要判断传递进来的值是否为null.
if (style == null) {
return style;
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal"))) {
Integer h = this.hAlignmentPane.getSelectedItem();
style = style.deriveHorizontalAlignment(h == null ? -1 : h);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical"))) {
Integer vAlign = this.vAlignmentPane.getSelectedItem();
if (vAlign != null) {
style = style.deriveVerticalAlignment(vAlign);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("StyleAlignment-Text_Style"))) {
if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[0])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT);
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[1])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE);
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[2])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINEADJUSTFONT);
} else {
style = style.deriveTextStyle(Style.TEXTSTYLE_MULTILINEADJUSTFONT);
}
}
style = updateImageLayout(style);
style = updateTextRotation(style);
style = updateOther(style);
return style;
}
private Style updateImageLayout(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Image-Image_Layout"))) {
if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[1])) {
style = style.deriveImageLayout(Constants.IMAGE_TILED);
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[2])) {
style = style.deriveImageLayout(Constants.IMAGE_EXTEND);
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[3])) {
style = style.deriveImageLayout(Constants.IMAGE_ADJUST);
} else {
style = style.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
return style;
}
private Style updateTextRotation(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("StyleAlignment-Text_Rotation"))) {
if (this.textRotationComboBox.getSelectedIndex() != 0) {
style = style.deriveVerticalText(Style.VERTICALTEXT);
style = style.deriveRotation(0);
style = style.deriveTextDirection(this.textRotationComboBox.getSelectedIndex() == 1 ? Style.LEFT_TO_RIGHT : Style.RIGHT_TO_LEFT);
} else {
style = style.deriveVerticalText(Style.HORIZONTALTEXT);
style = style.deriveRotation(rotationPane.updateBean().intValue());
}
}
return style;
}
private Style updateOther(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Left_Indent"))) {
style = style.derivePaddingLeft(indentationUnitProcessor.paddingUnitGainFromSpinner((int)(this.leftIndentSpinner.getValue())));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Right_Indent"))) {
style = style.derivePaddingRight(indentationUnitProcessor.paddingUnitGainFromSpinner((int)(this.rightIndentSpinner.getValue())));
}
//间距
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Spacing_Before"))) {
style = style.deriveSpacingBefore((int) (this.spaceBeforeSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Spacing_After"))) {
style = style.deriveSpacingAfter((int) (this.spaceAfterSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Line_Spacing"))) {
style = style.deriveLineSpacing((int) (this.lineSpaceSpinner.getValue()));
}
return style;
}
/**
* 注册监听事件
* *
* @param listener 观察者监听事件 * @param style the new style.
*/ */
public void registerNameListener(GlobalNameListener listener) { public void populateBean(Style style) {
globalNameListener = listener; hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style));
} vAlignmentPane.setSelectedItem(style.getVerticalAlignment());
/** if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE) {
* 是否响应监听 this.textComboBox.setSelectedIndex(1);
* } else if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINEADJUSTFONT) {
* @return this.textComboBox.setSelectedIndex(2);
*/ } else if (style.getTextStyle() == Style.TEXTSTYLE_MULTILINEADJUSTFONT) {
public boolean shouldResponseNameListener() { this.textComboBox.setSelectedIndex(3);
return false; } else {
} this.textComboBox.setSelectedIndex(0);
}
/** if (style.getVerticalText() == Style.VERTICALTEXT) {
* textRotationComboBox.setSelectedIndex(style.getTextDirection() == Style.LEFT_TO_RIGHT ? 1 : 2);
* @param name } else {
*/ textRotationComboBox.setSelectedIndex(0);
public void setGlobalName(String name) { rotationPane.populateBean((double) style.getRotation());
} }
if (style.getImageLayout() == Constants.IMAGE_TILED) {
imageLayoutComboBox.setSelectedIndex(1);
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) {
imageLayoutComboBox.setSelectedIndex(2);
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) {
imageLayoutComboBox.setSelectedIndex(3);
} else {
imageLayoutComboBox.setSelectedIndex(0);
}
int leftPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingLeft());
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight());
// alex:indent
this.leftIndentSpinner.setValue(new Integer(leftPadding));
this.rightIndentSpinner.setValue(new Integer(rightPadding));
this.spaceBeforeSpinner.setValue(style.getSpacingBefore());
this.spaceAfterSpinner.setValue(style.getSpacingAfter());
this.lineSpaceSpinner.setValue(style.getLineSpacing());
}
/**
* Update cellstyle border
*
* @param style the new style.
*/
public Style update(Style style) {
// peter:需要判断传递进来的值是否为null.
if (style == null) {
return style;
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal"))) {
Integer h = this.hAlignmentPane.getSelectedItem();
style = style.deriveHorizontalAlignment(h == null ? -1 : h);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical"))) {
Integer vAlign = this.vAlignmentPane.getSelectedItem();
if (vAlign != null) {
style = style.deriveVerticalAlignment(vAlign);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_StyleAlignment_Text_Style"))) {
if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[0])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT);
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[1])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE);
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[2])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINEADJUSTFONT);
} else {
style = style.deriveTextStyle(Style.TEXTSTYLE_MULTILINEADJUSTFONT);
}
}
style = updateImageLayout(style);
style = updateTextRotation(style);
style = updateOther(style);
return style;
}
private Style updateImageLayout(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Image_Layout"))) {
if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[1])) {
style = style.deriveImageLayout(Constants.IMAGE_TILED);
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[2])) {
style = style.deriveImageLayout(Constants.IMAGE_EXTEND);
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[3])) {
style = style.deriveImageLayout(Constants.IMAGE_ADJUST);
} else {
style = style.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
return style;
}
private Style updateTextRotation(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation"))) {
if (this.textRotationComboBox.getSelectedIndex() != 0) {
style = style.deriveVerticalText(Style.VERTICALTEXT);
style = style.deriveRotation(0);
style = style.deriveTextDirection(this.textRotationComboBox.getSelectedIndex() == 1 ? Style.LEFT_TO_RIGHT : Style.RIGHT_TO_LEFT);
} else {
style = style.deriveVerticalText(Style.HORIZONTALTEXT);
style = style.deriveRotation(rotationPane.updateBean().intValue());
}
}
return style;
}
private Style updateOther(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Left_Indent"))) {
style = style.derivePaddingLeft(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.leftIndentSpinner.getValue())));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Right_Indent"))) {
style = style.derivePaddingRight(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.rightIndentSpinner.getValue())));
}
//间距
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Spacing_Before"))) {
style = style.deriveSpacingBefore((int) (this.spaceBeforeSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Spacing_After"))) {
style = style.deriveSpacingAfter((int) (this.spaceAfterSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Line_Spacing"))) {
style = style.deriveLineSpacing((int) (this.lineSpaceSpinner.getValue()));
}
return style;
}
/**
* 注册监听事件
*
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 是否响应监听
*
* @return
*/
public boolean shouldResponseNameListener() {
return false;
}
/**
* @param name
*/
public void setGlobalName(String name) {
}
} }

386
designer_base/src/com/fr/design/gui/style/BorderPane.java

@ -4,218 +4,214 @@ package com.fr.design.gui.style;
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/ */
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
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.design.style.color.NewColorSelectBox;
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 com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.design.style.color.NewColorSelectBox;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/** /**
* @author zhou * @author zhou
* @since 2012-5-28下午6:22:04 * @since 2012-5-28下午6:22:04
*/ */
public class BorderPane extends AbstractBasicStylePane { public class BorderPane extends AbstractBasicStylePane {
private boolean insideMode = false; private boolean insideMode = false;
private UIToggleButton topToggleButton; private UIToggleButton topToggleButton;
private UIToggleButton horizontalToggleButton; private UIToggleButton horizontalToggleButton;
private UIToggleButton bottomToggleButton; private UIToggleButton bottomToggleButton;
private UIToggleButton leftToggleButton; private UIToggleButton leftToggleButton;
private UIToggleButton verticalToggleButton; private UIToggleButton verticalToggleButton;
private UIToggleButton rightToggleButton; private UIToggleButton rightToggleButton;
private UIToggleButton innerToggleButton; private UIToggleButton innerToggleButton;
private UIToggleButton outerToggleButton; private UIToggleButton outerToggleButton;
private LineComboBox currentLineCombo; private LineComboBox currentLineCombo;
private NewColorSelectBox currentLineColorPane; private NewColorSelectBox currentLineColorPane;
private JPanel panel; private JPanel panel;
private JPanel borderPanel; private JPanel borderPanel;
private JPanel backgroundPanel; private JPanel backgroundPanel;
private BackgroundPane backgroundPane; private BackgroundPane backgroundPane;
public BorderPane() { public BorderPane() {
this.initComponents(); this.initComponents();
} }
public static void main(String[] args){ public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane(); JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout()); content.setLayout(new BorderLayout());
content.add(new BorderPane(), BorderLayout.CENTER); content.add(new BorderPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400); jf.setSize(290, 400);
jf.setVisible(true); jf.setVisible(true);
} }
protected void initComponents() {
initButtonsWithIcon(); protected void initComponents() {
this.setLayout(new BorderLayout(0, 6)); initButtonsWithIcon();
JPanel externalPane = new JPanel(new GridLayout(0, 4)); this.setLayout(new BorderLayout(0, 6));
externalPane.add(topToggleButton); JPanel externalPane = new JPanel(new GridLayout(0, 4));
externalPane.add(leftToggleButton); externalPane.add(topToggleButton);
externalPane.add(bottomToggleButton); externalPane.add(leftToggleButton);
externalPane.add(rightToggleButton); externalPane.add(bottomToggleButton);
JPanel insidePane = new JPanel(new GridLayout(0, 2)); externalPane.add(rightToggleButton);
insidePane.add(horizontalToggleButton); JPanel insidePane = new JPanel(new GridLayout(0, 2));
insidePane.add(verticalToggleButton); insidePane.add(horizontalToggleButton);
double f = TableLayout.FILL; insidePane.add(verticalToggleButton);
double p = TableLayout.PREFERRED; double f = TableLayout.FILL;
Component[][] components = new Component[][]{ double p = TableLayout.PREFERRED;
new Component[]{null,null}, Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo}, new Component[]{null, null},
new Component[]{null,null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, new Component[]{null, null},
new Component[]{null,null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))}, new Component[]{null, null},
new Component[]{null,externalPane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))},
new Component[]{null,null}, new Component[]{null, externalPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, new Component[]{null, null},
new Component[]{null,insidePane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{null,null} new Component[]{null, insidePane},
}; new Component[]{null, null}
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; };
double[] columnSize = {p,f}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; double[] columnSize = {p, f};
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
borderPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Border"),280,20,panel); panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(borderPanel,BorderLayout.NORTH); borderPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Border"), 280, 20, panel);
this.add(borderPanel, BorderLayout.NORTH);
backgroundPane = new BackgroundPane();
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane); backgroundPane = new BackgroundPane();
this.add(backgroundPanel,BorderLayout.CENTER); backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"), 280, 20, backgroundPane);
this.add(backgroundPanel, BorderLayout.CENTER);
outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
innerToggleButton.addChangeListener(innerToggleButtonChangeListener); outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
} innerToggleButton.addChangeListener(innerToggleButtonChangeListener);
}
ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
@Override ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) { @Override
boolean value = outerToggleButton.isSelected(); public void stateChanged(ChangeEvent e) {
topToggleButton.setSelected(value); boolean value = outerToggleButton.isSelected();
bottomToggleButton.setSelected(value); topToggleButton.setSelected(value);
leftToggleButton.setSelected(value); bottomToggleButton.setSelected(value);
rightToggleButton.setSelected(value); leftToggleButton.setSelected(value);
} rightToggleButton.setSelected(value);
}; }
};
ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
@Override ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) { @Override
boolean value = innerToggleButton.isSelected(); public void stateChanged(ChangeEvent e) {
horizontalToggleButton.setSelected(value); boolean value = innerToggleButton.isSelected();
verticalToggleButton.setSelected(value); horizontalToggleButton.setSelected(value);
} verticalToggleButton.setSelected(value);
}; }
};
private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png")); private void initButtonsWithIcon() {
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png")); topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
bottomToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png")); leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));
rightToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png")); bottomToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"));
horizontalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png")); rightToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"));
verticalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png")); horizontalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"));
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); verticalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"));
this.currentLineColorPane = new NewColorSelectBox(100); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
} this.currentLineColorPane = new NewColorSelectBox(100);
}
@Override
public String title4PopupWindow() { @Override
return Inter.getLocText("FR-Designer_Border"); public String title4PopupWindow() {
} return Inter.getLocText("FR-Designer_Cell");
}
@Override
public void populateBean(Style style) { @Override
if (style == null) { public void populateBean(Style style) {
style = Style.DEFAULT_STYLE; if (style == null) {
} style = Style.DEFAULT_STYLE;
}
CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopStyle(style.getBorderTop()); CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopColor(style.getBorderTopColor()); cellBorderStyle.setTopStyle(style.getBorderTop());
cellBorderStyle.setLeftStyle(style.getBorderLeft()); cellBorderStyle.setTopColor(style.getBorderTopColor());
cellBorderStyle.setLeftColor(style.getBorderLeftColor()); cellBorderStyle.setLeftStyle(style.getBorderLeft());
cellBorderStyle.setBottomStyle(style.getBorderBottom()); cellBorderStyle.setLeftColor(style.getBorderLeftColor());
cellBorderStyle.setBottomColor(style.getBorderBottomColor()); cellBorderStyle.setBottomStyle(style.getBorderBottom());
cellBorderStyle.setRightStyle(style.getBorderRight()); cellBorderStyle.setBottomColor(style.getBorderBottomColor());
cellBorderStyle.setRightColor(style.getBorderRightColor()); cellBorderStyle.setRightStyle(style.getBorderRight());
this.backgroundPane.populateBean(style.getBackground()); cellBorderStyle.setRightColor(style.getBorderRightColor());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor()); this.backgroundPane.populateBean(style.getBackground());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor());
}
}
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
this.insideMode = insideMode; public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
this.insideMode = insideMode;
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor());
this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE);
this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE); this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE);
this.leftToggleButton.setSelected(cellBorderStyle.getLeftStyle() != Constants.LINE_NONE); this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE);
this.rightToggleButton.setSelected(cellBorderStyle.getRightStyle() != Constants.LINE_NONE); this.leftToggleButton.setSelected(cellBorderStyle.getLeftStyle() != Constants.LINE_NONE);
this.rightToggleButton.setSelected(cellBorderStyle.getRightStyle() != Constants.LINE_NONE);
this.horizontalToggleButton.setSelected(cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE);
this.verticalToggleButton.setSelected(cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE); this.horizontalToggleButton.setSelected(cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE);
this.verticalToggleButton.setSelected(cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE);
this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE);
this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE); this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE);
this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE);
this.innerToggleButton.setEnabled(this.insideMode); this.innerToggleButton.setEnabled(this.insideMode);
this.horizontalToggleButton.setEnabled(this.insideMode); this.horizontalToggleButton.setEnabled(this.insideMode);
this.verticalToggleButton.setEnabled(this.insideMode); this.verticalToggleButton.setEnabled(this.insideMode);
} }
public Style update(Style style) { public Style update(Style style) {
style = style.deriveBackground(backgroundPane.update()); style = style.deriveBackground(backgroundPane.update());
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = Style.DEFAULT_STYLE;
} }
CellBorderStyle cellBorderStyle = this.update(); CellBorderStyle cellBorderStyle = this.update();
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
return style; return style;
} }
public CellBorderStyle update() { public CellBorderStyle update() {
int lineStyle = currentLineCombo.getSelectedLineStyle(); int lineStyle = currentLineCombo.getSelectedLineStyle();
Color lineColor = currentLineColorPane.getSelectObject(); Color lineColor = currentLineColorPane.getSelectObject();
CellBorderStyle cellBorderStyle = new CellBorderStyle(); CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopColor(lineColor); cellBorderStyle.setTopColor(lineColor);
cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setBottomColor(lineColor); cellBorderStyle.setBottomColor(lineColor);
cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setLeftColor(lineColor); cellBorderStyle.setLeftColor(lineColor);
cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setRightColor(lineColor); cellBorderStyle.setRightColor(lineColor);
cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setVerticalColor(lineColor); cellBorderStyle.setVerticalColor(lineColor);
cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setHorizontalColor(lineColor); cellBorderStyle.setHorizontalColor(lineColor);
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
return cellBorderStyle; return cellBorderStyle;
} }
} }

47
designer_base/src/com/fr/design/gui/style/FRFontPane.java

@ -4,35 +4,34 @@ package com.fr.design.gui.style;
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/ */
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.constants.UIConstants;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DefaultValues; import com.fr.general.DefaultValues;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
/** /**
* Pane to edit Font. * Pane to edit Font.
@ -68,7 +67,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
this.initComponents(); this.initComponents();
} }
public static void main(String[] args){ public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane(); JPanel content = (JPanel) jf.getContentPane();
@ -209,7 +208,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return style.deriveFRFont(frFont); return style.deriveFRFont(frFont);
} }
public static Vector<Integer> getFontSizes(){ public static Vector<Integer> getFontSizes() {
Vector<Integer> FONT_SIZES = new Vector<Integer>(); Vector<Integer> FONT_SIZES = new Vector<Integer>();
for (int i = 1; i < MAX_FONT_SIZE; i++) { for (int i = 1; i < MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i); FONT_SIZES.add(i);
@ -240,20 +239,16 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png")); subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png"));
subPane.setPreferredSize(BUTTON_SIZE); subPane.setPreferredSize(BUTTON_SIZE);
isSuperOrSubPane = new TwoButtonPane(superPane, subPane); isSuperOrSubPane = new TwoButtonPane(superPane, subPane);
// Component[] components_font = new Component[]{
// colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
// };
Component[] components_font = new Component[]{ Component[] components_font = new Component[]{
colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox
}; };
buttonPane = new JPanel(new BorderLayout()); buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
// buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
linePane = new JPanel(new CardLayout()); linePane = new JPanel(new CardLayout());
initAllNames(); initAllNames();
setToolTips(); setToolTips();
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(fontNameComboBox, BorderLayout.NORTH); // this.add(fontNameComboBox, BorderLayout.NORTH);
this.add(createPane(), BorderLayout.CENTER); this.add(createPane(), BorderLayout.CENTER);
DefaultValues defaultValues = FRContext.getDefaultValues(); DefaultValues defaultValues = FRContext.getDefaultValues();
populateBean(defaultValues.getFRFont()); populateBean(defaultValues.getFRFont());
@ -328,15 +323,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
} }
private JPanel createPane() { private JPanel createPane() {
double p = TableLayout.PREFERRED; JPanel createPane = new JPanel(new BorderLayout(3, 5));
double f = TableLayout.FILL; createPane.add(fontNameComboBox, BorderLayout.NORTH);
double[] columnSize = {f, f}; createPane.add(createLeftPane(), BorderLayout.CENTER);
double[] rowSize = {p,p}; createPane.add(createRightPane(), BorderLayout.EAST);
Component[][] components = new Component[][]{ return createPane;
new Component[]{null, null},
new Component[]{createLeftPane(), createRightPane()},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
/** /**

55
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -15,7 +15,6 @@ 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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -24,7 +23,8 @@ import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.Format; import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -34,7 +34,7 @@ import java.text.SimpleDateFormat;
* @author zhou * @author zhou
* @since 2012-5-24上午10:57:00 * @since 2012-5-24上午10:57:00
*/ */
public class FormatPane extends AbstractBasicStylePane{ public class FormatPane extends AbstractBasicStylePane {
private static final long serialVersionUID = 724330854437726751L; private static final long serialVersionUID = 724330854437726751L;
private static final int LABLE_X = 4; private static final int LABLE_X = 4;
@ -61,6 +61,7 @@ public class FormatPane extends AbstractBasicStylePane{
private boolean isRightFormate; private boolean isRightFormate;
private boolean isDate = false; private boolean isDate = false;
private boolean isFormat = false; private boolean isFormat = false;
/** /**
* Constructor. * Constructor.
*/ */
@ -68,17 +69,6 @@ public class FormatPane extends AbstractBasicStylePane{
this.initComponents(TYPES); this.initComponents(TYPES);
} }
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FormatPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
protected void initComponents(Integer[] types) { protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
iniSampleLable(); iniSampleLable();
@ -95,7 +85,7 @@ public class FormatPane extends AbstractBasicStylePane{
contentPane.add(sampleLabel, BorderLayout.NORTH); contentPane.add(sampleLabel, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout()); centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide"); centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0) ); centerPane.setPreferredSize(new Dimension(0, 0));
centerPane.add(contentPane, "show"); centerPane.add(contentPane, "show");
formatFontPane = new JPanel(new BorderLayout()); formatFontPane = new JPanel(new BorderLayout());
formatFontPane.add(centerPane, BorderLayout.NORTH); formatFontPane.add(centerPane, BorderLayout.NORTH);
@ -110,20 +100,20 @@ public class FormatPane extends AbstractBasicStylePane{
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format")+" ", SwingConstants.LEFT), typeComboBox }, new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox},
new Component[]{null,centerPane}, new Component[]{null, centerPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane},
new Component[]{null,null} new Component[]{null, null}
}; };
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 3}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
protected UIComboBoxRenderer createComBoxRender(){ protected UIComboBoxRenderer createComBoxRender() {
return new UIComboBoxRenderer() { return new UIComboBoxRenderer() {
@Override @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) {
@ -174,10 +164,11 @@ public class FormatPane extends AbstractBasicStylePane{
/** /**
* 弹出框标题 * 弹出框标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Base_Format"); return Inter.getLocText("FR-Designer_Text");
} }
/** /**
@ -223,8 +214,8 @@ public class FormatPane extends AbstractBasicStylePane{
* 判断是否是数组有模式 * 判断是否是数组有模式
* *
* @param stringArray 字符串数组 * @param stringArray 字符串数组
* @param pattern 格式 * @param pattern 格式
* @return 是否是数组有模式 * @return 是否是数组有模式
*/ */
public static int isArrayContainPattern(String[] stringArray, String pattern) { public static int isArrayContainPattern(String[] stringArray, String pattern) {
for (int i = 0; i < stringArray.length; i++) { for (int i = 0; i < stringArray.length; i++) {
@ -301,20 +292,20 @@ public class FormatPane extends AbstractBasicStylePane{
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){ if (e.getStateChange() == ItemEvent.SELECTED) {
int contents = getFormatContents(); int contents = getFormatContents();
String[] items = FormatField.getInstance().getFormatArray(contents); String[] items = FormatField.getInstance().getFormatArray(contents);
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) { if (isTextOrNull()) {
centerPane.setPreferredSize(new Dimension(0, 0) ); centerPane.setPreferredSize(new Dimension(0, 0));
cardLayout.show(centerPane, "hide"); cardLayout.show(centerPane, "hide");
} else { } else {
textField.removeAllItems(); textField.removeAllItems();
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]); textField.addItem(items[i]);
} }
centerPane.setPreferredSize(new Dimension(270, 70) ); centerPane.setPreferredSize(new Dimension(270, 70));
cardLayout.show(centerPane, "show"); cardLayout.show(centerPane, "show");
} }
isFormat = true; isFormat = true;
@ -326,7 +317,7 @@ public class FormatPane extends AbstractBasicStylePane{
ItemListener textFieldItemListener = new ItemListener() { ItemListener textFieldItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){ if (e.getStateChange() == ItemEvent.SELECTED) {
isFormat = true; isFormat = true;
refreshPreviewLabel(); refreshPreviewLabel();
} }
@ -348,7 +339,7 @@ public class FormatPane extends AbstractBasicStylePane{
* update * update
*/ */
public Style update(Style style) { public Style update(Style style) {
if (isFormat){ if (isFormat) {
isFormat = false; isFormat = false;
return style.deriveFormat(this.update()); return style.deriveFormat(this.update());
} else { } else {

41
designer_base/src/com/fr/design/locale/designer.properties

@ -2051,3 +2051,44 @@ FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure FR-Designer_Read_failure=Read_failure
FR-Designer_Add_Hyperlink=Add Hyperlink
FR-Designer-StyleAlignment_Style_PartSpacing=PartSpacing
FR-Designer_Image_Layout=Image_Layout
FR-Designer_StyleAlignment_Text_Style=Text_Style
FR-Designer_StyleAlignment_Text_Rotation=Text_Rotation
FR-Designer_Style_Left_Indent=Left_Indent
FR-Designer_Style_Right_Indent=Right_Indent
FR-Designer_Style_Spacing_Before=Spacing_Before
FR-Designer_Style_Spacing_After=Spacing_After
FR-Designer_Style_Line_Spacing=Line_Spacing
FR-Designer_Left=Left
FR-Designer_Right=Right
FR-Designer_Front=Front
FR-Designer_Behind=Behind
FR-Designer_StyleAlignment_Wrap_Text=Wrap_Text
FR-Designer_StyleAlignment_Single_Line=Single_Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font)
FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height
FR-Designer_Auto_Adjust_Wdith=Auto_Adjust_Wdith
FR-Designer_Type_Set=Type_Set
FR-Designer_Dic_Data_Query=Data_Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL
FR-Designer_Datasource_From_Database=Datasource_From_Database
FR-Designer_CellWrite_InsertRow_NULL=InsertRow_NULL
FR-Designer_CellWrite_InsertRow_COPY=InsertRow_COPY
FR-Designer_CellWrite_InsertRow_Policy=InsertRow_Policy
FR-Designer_CellWrite_Page_Before_Row=Page_Before_Row
FR-Designer_CellWrite_Page_After_Row=Page_After_Row
FR-Designer_CellWrite_Page_Before_Column=Page_Before_Column
FR-Designer_CellWrite_Page_After_Column=Page_After_Column
FR-Designer_CellPage_Can_Break_On_Paginate=Can_Break_On_Paginate
FR-Designer_CellPage_Repeat_Content_When_Paging=Repeat_Content_When_Paging
FR-Designer_CellWrite_Preview_Cell_Content=Preview_Cell_Content
FR-Designer_CellWrite_Print_Content=CellWrite_Print_Content
FR-Designer_CellWrite_Print_Background=CellWrite_Print_Background
FR-Designer_CellWrite_Show_As_Image=CellWrite_Show_As_Image
FR-Designer_CellWrite_Show_As_HTML=CellWrite_Show_As_HTML
FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table

41
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2052,3 +2052,44 @@ FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure FR-Designer_Read_failure=Read_failure
FR-Designer_Add_Hyperlink=Add Hyperlink
FR-Designer-StyleAlignment_Style_PartSpacing=PartSpacing
FR-Designer_Image_Layout=Image_Layout
FR-Designer_StyleAlignment_Text_Style=Text_Style
FR-Designer_StyleAlignment_Text_Rotation=Text_Rotation
FR-Designer_Style_Left_Indent=Left_Indent
FR-Designer_Style_Right_Indent=Right_Indent
FR-Designer_Style_Spacing_Before=Spacing_Before
FR-Designer_Style_Spacing_After=Spacing_After
FR-Designer_Style_Line_Spacing=Line_Spacing
FR-Designer_Left=Left
FR-Designer_Right=Right
FR-Designer_Front=Front
FR-Designer_Behind=Behind
FR-Designer_StyleAlignment_Wrap_Text=Wrap_Text
FR-Designer_StyleAlignment_Single_Line=Single_Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font)
FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height
FR-Designer_Auto_Adjust_Wdith=Auto_Adjust_Wdith
FR-Designer_Type_Set=Type_Set
FR-Designer_Dic_Data_Query=Data_Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL
FR-Designer_Datasource_From_Database=Datasource_From_Database
FR-Designer_CellWrite_InsertRow_NULL=InsertRow_NULL
FR-Designer_CellWrite_InsertRow_COPY=InsertRow_COPY
FR-Designer_CellWrite_InsertRow_Policy=InsertRow_Policy
FR-Designer_CellWrite_Page_Before_Row=Page_Before_Row
FR-Designer_CellWrite_Page_After_Row=Page_After_Row
FR-Designer_CellWrite_Page_Before_Column=Page_Before_Column
FR-Designer_CellWrite_Page_After_Column=Page_After_Column
FR-Designer_CellPage_Can_Break_On_Paginate=Can_Break_On_Paginate
FR-Designer_CellPage_Repeat_Content_When_Paging=Repeat_Content_When_Paging
FR-Designer_CellWrite_Preview_Cell_Content=Preview_Cell_Content
FR-Designer_CellWrite_Print_Content=CellWrite_Print_Content
FR-Designer_CellWrite_Print_Background=CellWrite_Print_Background
FR-Designer_CellWrite_Show_As_Image=CellWrite_Show_As_Image
FR-Designer_CellWrite_Show_As_HTML=CellWrite_Show_As_HTML
FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table

82
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2014,24 +2014,64 @@ FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available= FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272 FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272
FR-Designer_Scale_EnlargeOrReduce= FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\ FR-Designer_Scale_selfAdaptButton=
FR-Designer_Scale_customButton=\ FR-Designer_Scale_customButton=
FR-Designer_FRFont_Subscript=\ FR-Designer_FRFont_Subscript=
FR-Designer_FRFont_Superscript=\ FR-Designer_FRFont_Superscript=
FR-Designer_FRFont_Shadow=\ FR-Designer_FRFont_Shadow=
FR-Designer_FRFont_Strikethrough=\ FR-Designer_FRFont_Strikethrough=
FR-Designer_FRFont_Underline=\ FR-Designer_FRFont_Underline=
FR-Designer_FRFont_bold=\ FR-Designer_FRFont_bold=
FR-Designer_FRFont_italic=\ FR-Designer_FRFont_italic=
FR-Designer_FRFont_Foreground=\ FR-Designer_FRFont_Foreground=
FR-Designer_FRFont_Style=\ FR-Designer_FRFont_Style=
FR-Designer_FRFont_plain=\ FR-Designer_FRFont_plain=
FR-Designer_FRFont_bolditalic=\ FR-Designer_FRFont_bolditalic=
FR-Designer_outBorder=\ FR-Designer_outBorder=
FR-Designer_inBorder=\ FR-Designer_inBorder=
FR-Designer_ExpandD_Up_Father_Cell=\ FR-Designer_ExpandD_Up_Father_Cell=
FR-Designer_ExpandD_Expand_Direction=\ FR-Designer_ExpandD_Expand_Direction=
FR-Designer_Expand=\ FR-Designer_Expand=
FR-Designer_ExpendSort=\ FR-Designer_ExpendSort=
FR-Designer_ExpandD_Expandable=\ FR-Designer_ExpandD_Expandable=
FR-Designer_Read_failure=\ FR-Designer_Read_failure=
FR-Designer_Add_Hyperlink=\u30EA\u30F3\u30AF\u3092\u8FFD\u52A0
FR-Designer_Image_Layout=
FR-Designer_StyleAlignment_Text_Style=
FR-Designer_StyleAlignment_Text_Rotation=
FR-Designer_Style_Left_Indent=
FR-Designer_Style_Right_Indent=
FR-Designer_Style_Spacing_Before=
FR-Designer_Style_Spacing_After=
FR-Designer_Style_Line_Spacing=
FR-Designer_Left=
FR-Designer_Right=
FR-Designer_Front=
FR-Designer_Behind=
FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

80
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2013,23 +2013,63 @@ FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available= FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
FR-Designer_Scale_EnlargeOrReduce= FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\ FR-Designer_Add_Hyperlink=\uB9C1\uD06C\uCD94\uAC00
FR-Designer_FRFont_Subscript=\ FR-Designer_Scale_selfAdaptButton=
FR-Designer_FRFont_Superscript=\ FR-Designer_FRFont_Subscript=
FR-Designer_FRFont_Shadow=\ FR-Designer_FRFont_Superscript=
FR-Designer_FRFont_Strikethrough=\ FR-Designer_FRFont_Shadow=
FR-Designer_FRFont_Underline=\ FR-Designer_FRFont_Strikethrough=
FR-Designer_FRFont_bold=\ FR-Designer_FRFont_Underline=
FR-Designer_FRFont_italic=\ FR-Designer_FRFont_bold=
FR-Designer_FRFont_Foreground=\ FR-Designer_FRFont_italic=
FR-Designer_FRFont_Style=\ FR-Designer_FRFont_Foreground=
FR-Designer_FRFont_plain=\ FR-Designer_FRFont_Style=
FR-Designer_FRFont_bolditalic=\ FR-Designer_FRFont_plain=
FR-Designer_outBorder=\ FR-Designer_FRFont_bolditalic=
FR-Designer_inBorder=\ FR-Designer_outBorder=
FR-Designer_ExpandD_Up_Father_Cell=\ FR-Designer_inBorder=
FR-Designer_ExpandD_Expand_Direction=\ FR-Designer_ExpandD_Up_Father_Cell=
FR-Designer_Expand=\ FR-Designer_ExpandD_Expand_Direction=
FR-Designer_ExpendSort=\ FR-Designer_Expand=
FR-Designer_ExpandD_Expandable=\ FR-Designer_ExpendSort=
FR-Designer_Read_failure=\ FR-Designer_ExpandD_Expandable=
FR-Designer_Read_failure=
FR-Designer_Image_Layout=
FR-Designer_StyleAlignment_Text_Style=
FR-Designer_StyleAlignment_Text_Rotation=
FR-Designer_Style_Left_Indent=
FR-Designer_Style_Right_Indent=
FR-Designer_Style_Spacing_Before=
FR-Designer_Style_Spacing_After=
FR-Designer_Style_Line_Spacing=
FR-Designer_Left=
FR-Designer_Right=
FR-Designer_Front=
FR-Designer_Behind=
FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

41
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2051,3 +2051,44 @@ FR-Designer_Expand=\u6269\u5C55
FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F
FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027 FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027
FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F
FR-Designer_Add_Hyperlink=\u6DFB\u52A0\u94FE\u63A5
FR-Designer-StyleAlignment_Style_PartSpacing=\u6BB5\u95F4\u8DDD
FR-Designer_Image_Layout=\u56FE\u7247\u5E03\u5C40
FR-Designer_StyleAlignment_Text_Style=\u6587\u672C\u63A7\u5236
FR-Designer_StyleAlignment_Text_Rotation=\u6587\u672C\u65B9\u5411
FR-Designer_Style_Left_Indent=\u5DE6\u7F29\u8FDB
FR-Designer_Style_Right_Indent=\u53F3\u7F29\u8FDB
FR-Designer_Style_Spacing_Before=\u6BB5\u524D
FR-Designer_Style_Spacing_After=\u6BB5\u540E
FR-Designer_Style_Line_Spacing=\u884C\u95F4\u8DDD
FR-Designer_Left=\u5DE6
FR-Designer_Right=\u53F3
FR-Designer_Front=\u524D
FR-Designer_Behind=\u540E
FR-Designer_StyleAlignment_Wrap_Text=\u81EA\u52A8\u6362\u884C
FR-Designer_StyleAlignment_Single_Line=\u5355\u884C\u663E\u793A
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u5355\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_Auto_Adjust_Height=\u81EA\u52A8\u8C03\u6574\u884C\u9AD8
FR-Designer_Auto_Adjust_Wdith=\u81EA\u52A8\u8C03\u6574\u5217\u5BBD
FR-Designer_Type_Set=\u7C7B\u578B\u8BBE\u7F6E
FR-Designer_Dic_Data_Query=\u6570\u636E\u67E5\u8BE2
FR-Designer_Dictionary_Dynamic_SQL=\u52A8\u6001SQL
FR-Designer_Datasource_From_Database=\u6570\u636E\u5E93\u8868
FR-Designer_CellWrite_InsertRow_NULL=\u7A7A\u503C
FR-Designer_CellWrite_InsertRow_COPY=\u539F\u503C
FR-Designer_CellWrite_InsertRow_Policy=\u63D2\u5165\u884C\u7B56\u7565
FR-Designer_CellWrite_Page_Before_Row=\u884C\u524D\u5206\u9875
FR-Designer_CellWrite_Page_After_Row=\u884C\u540E\u5206\u9875
FR-Designer_CellWrite_Page_Before_Column=\u5217\u524D\u5206\u9875
FR-Designer_CellWrite_Page_After_Column=\u5217\u540E\u5206\u9875
FR-Designer_CellPage_Can_Break_On_Paginate=\u5206\u9875\u65F6\u53EF\u4EE5\u65AD\u5F00
FR-Designer_CellPage_Repeat_Content_When_Paging=\u5206\u9875\u65AD\u5F00\u65F6\u503C\u91CD\u590D\u663E\u793A
FR-Designer_CellWrite_Preview_Cell_Content=\u9884\u89C8\u5355\u5143\u683C\u5185\u5BB9
FR-Designer_CellWrite_Print_Content=\u6253\u5370/\u5BFC\u51FA\u5355\u5143\u683C\u5185\u5BB9
FR-Designer_CellWrite_Print_Background=\u6253\u5370/\u5BFC\u51FA\u5355\u5143\u683C\u80CC\u666F
FR-Designer_CellWrite_Show_As_Image=\u7528\u56FE\u7247\u663E\u793A\u5185\u5BB9
FR-Designer_CellWrite_Show_As_HTML=\u7528HTML\u663E\u793A\u5185\u5BB9
FR-Designer_Datasource_Other_Attributes=\u5176\u4ED6\u5C5E\u6027
FR-Designer_Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91
FR-Designer_CellElement_Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868

82
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2031,24 +2031,64 @@ FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB
FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01 FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_selfAdaptButton=\ FR-Designer_Add_Hyperlink=\u65B0\u589E\u9023\u63A5
FR-Designer_Scale_customButton=\ FR-Designer_Scale_selfAdaptButton=
FR-Designer_FRFont_Subscript=\ FR-Designer_Scale_customButton=
FR-Designer_FRFont_Superscript=\ FR-Designer_FRFont_Subscript=
FR-Designer_FRFont_Shadow=\ FR-Designer_FRFont_Superscript=
FR-Designer_FRFont_Strikethrough=\ FR-Designer_FRFont_Shadow=
FR-Designer_FRFont_Underline=\ FR-Designer_FRFont_Strikethrough=
FR-Designer_FRFont_bold=\ FR-Designer_FRFont_Underline=
FR-Designer_FRFont_italic=\ FR-Designer_FRFont_bold=
FR-Designer_FRFont_Foreground=\ FR-Designer_FRFont_italic=
FR-Designer_FRFont_Style=\ FR-Designer_FRFont_Foreground=
FR-Designer_FRFont_plain=\ FR-Designer_FRFont_Style=
FR-Designer_FRFont_bolditalic=\ FR-Designer_FRFont_plain=
FR-Designer_outBorder=\ FR-Designer_FRFont_bolditalic=
FR-Designer_inBorder=\ FR-Designer_outBorder=
FR-Designer_ExpandD_Up_Father_Cell=\ FR-Designer_inBorder=
FR-Designer_ExpandD_Expand_Direction=\ FR-Designer_ExpandD_Up_Father_Cell=
FR-Designer_Expand=\ FR-Designer_ExpandD_Expand_Direction=
FR-Designer_ExpendSort=\ FR-Designer_Expand=
FR-Designer_ExpandD_Expandable=\ FR-Designer_ExpendSort=
FR-Designer_Read_failure=\ FR-Designer_ExpandD_Expandable=
FR-Designer_Read_failure=
FR-Designer_Image_Layout=
FR-Designer_StyleAlignment_Text_Style=
FR-Designer_StyleAlignment_Text_Rotation=
FR-Designer_Style_Left_Indent=
FR-Designer_Style_Right_Indent=
FR-Designer_Style_Spacing_Before=
FR-Designer_Style_Spacing_After=
FR-Designer_Style_Line_Spacing=
FR-Designer_Left=
FR-Designer_Right=
FR-Designer_Front=
FR-Designer_Behind=
FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

41
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -27,7 +27,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private CardLayout propertyCard; private CardLayout propertyCard;
private JPanel leftPane; private JPanel leftPane;
private JPanel rightPane; private JPanel rightPane;
private static final int CONTAINER_WIDTH = 260; private FixedPopupPane currentPopupPane;
private static final int CONTAINER_WIDTH = 290;
private static final int TAB_WIDTH = 40; private static final int TAB_WIDTH = 40;
private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH;
private static final int POPUP_TOOLPANE_HEIGHT = 25; private static final int POPUP_TOOLPANE_HEIGHT = 25;
@ -381,6 +382,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
return 0; return 0;
} }
private void hideCurrentPopupPane() {
if (currentPopupPane != null && currentPopupPane.isVisible()) {
currentPopupPane.setVisible(false);
}
}
class PropertyItem { class PropertyItem {
@ -473,7 +480,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyPanel.remove(this.contentPane); propertyPanel.remove(this.contentPane);
propertyPanel.add(this.contentPane = pane); propertyPanel.add(this.contentPane = pane);
if (popupDialog != null && isPoppedOut) { if (popupDialog != null && isPoppedOut) {
popupDialog.replaceContentPane(contentPane); popupDialog.replaceContentPane(this);
} }
if (popupPane != null && !isRightPaneVisible()) { if (popupPane != null && !isRightPaneVisible()) {
popupPane.replaceContentPane(contentPane); popupPane.replaceContentPane(contentPane);
@ -488,6 +495,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void onResize() { public void onResize() {
if (isRightPaneVisible()) { if (isRightPaneVisible()) {
hideCurrentPopupPane();
replaceContentPane(contentPane); replaceContentPane(contentPane);
} else if(popupPane != null) { } else if(popupPane != null) {
popupPane.replaceContentPane(contentPane); popupPane.replaceContentPane(contentPane);
@ -540,7 +548,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (popupPane == null) { if (popupPane == null) {
popupPane = new FixedPopupPane(this); popupPane = new FixedPopupPane(this);
} }
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); if (popupPane.isVisible()) {
popupPane.setVisible(false);
} else {
hideCurrentPopupPane();
currentPopupPane = popupPane;
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
}
} }
// 弹出对话框 // 弹出对话框
@ -553,7 +567,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (popupDialog == null) { if (popupDialog == null) {
popupDialog = new PopupDialog(this); popupDialog = new PopupDialog(this);
} else { } else {
popupDialog.replaceContentPane(contentPane); popupDialog.replaceContentPane(this);
popupDialog.adjustLocation();
popupDialog.setVisible(true); popupDialog.setVisible(true);
} }
// initContentPane(); // initContentPane();
@ -588,6 +603,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
updateSize(); updateSize();
} }
public void menuSelectionChanged(boolean isIncluded) {
}
private void updateSize() { private void updateSize() {
int newHeight = fixedHeight + contentPane.getPreferredSize().height; int newHeight = fixedHeight + contentPane.getPreferredSize().height;
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
@ -795,10 +813,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Point mouseDownCompCoords; private Point mouseDownCompCoords;
private int minHeight; // 对话框最小高度 private int minHeight; // 对话框最小高度
private JComponent contentPane; private JComponent contentPane;
private PropertyItem propertyItem;
public PopupDialog(PropertyItem propertyItem) { public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
container = getContentPane(); container = getContentPane();
setUndecorated(true); setUndecorated(true);
this.propertyItem = propertyItem;
PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON); PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON);
popupToolPane.setParentDialog(this); popupToolPane.setParentDialog(this);
contentPane = propertyItem.getContentPane(); contentPane = propertyItem.getContentPane();
@ -807,13 +827,20 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
minHeight = container.getPreferredSize().height; minHeight = container.getPreferredSize().height;
setSize(CONTENT_WIDTH, minHeight); setSize(CONTENT_WIDTH, minHeight);
// validate(); // validate();
Point btnCoords = propertyItem.getButton().getLocationOnScreen(); adjustLocation();
this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y);
initListener(); initListener();
this.setVisible(true); this.setVisible(true);
} }
public void replaceContentPane(JComponent contentPane) {
public void adjustLocation() {
Point btnCoords = propertyItem.getButton().getLocationOnScreen();
this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y);
}
public void replaceContentPane(PropertyItem propertyItem) {
this.propertyItem = propertyItem;
JComponent contentPane = propertyItem.getContentPane();
container.remove(this.contentPane); container.remove(this.contentPane);
container.add(this.contentPane = contentPane); container.add(this.contentPane = contentPane);
// pack(); // pack();

2
designer_base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -41,7 +41,7 @@ public class JFormSliderPane extends JPanel {
private static final int THREE_HUNDRED = 300; private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 150; private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 240; private static final int DIALOG_HEIGHT = 220;
private static final int SHOWVALBUTTON_WIDTH = 70; private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTON_HEIGHTH = 25; private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100; public int showValue = 100;

5
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -20,6 +20,7 @@ import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
@ -111,6 +112,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
// 刷新右侧属性面板 // 刷新右侧属性面板
public abstract void refreshEastPropertiesPane(); public abstract void refreshEastPropertiesPane();
public abstract TargetComponent getCurrentElementCasePane();
// 为收集模版信息作准备 // 为收集模版信息作准备
private void initForCollect() { private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性 template.initTemplateID(); // 为新模板设置 templateID 属性
@ -882,7 +885,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 返回当前支持的超链界面pane * 返回当前支持的超链界面pane
* @return 超链连接界面 * @return 超链连接界面
*/ */
public abstract HyperlinkGroupPane getHyperLinkPane(); public abstract HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider);
/** /**
* 是否是图表 * 是否是图表

13
designer_base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java

@ -5,6 +5,7 @@ import java.awt.image.BufferedImage;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.design.designer.TargetComponent;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
@ -61,6 +62,18 @@ public interface FormECDesignerProvider {
*/ */
public JComponent getEastUpPane(); public JComponent getEastUpPane();
/**
* 超级链接面板
* @return 属性面板
*/
public JComponent getHyperlinkPane();
/**
* 超级链接面板
* @return 属性面板
*/
public TargetComponent getEditingElementCasePane();
/** /**
* 获取当前ElementCase的缩略图 * 获取当前ElementCase的缩略图
* @param elementCaseContainerSize 缩略图的大小 * @param elementCaseContainerSize 缩略图的大小

147
designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java

@ -1,48 +1,45 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.ItemSelectable;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.ChoosePane; import com.fr.design.data.datapane.ChoosePane;
import com.fr.design.data.datapane.DataBaseItems; import com.fr.design.data.datapane.DataBaseItems;
import com.fr.design.data.datapane.VerticalChoosePane; import com.fr.design.data.datapane.VerticalChoosePane;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.data.impl.DatabaseDictionary; import com.fr.design.editor.DoubleDeckValueEditorPane;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
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.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
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.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> implements Previewable, UIObserver { public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> implements Previewable, UIObserver {
/** /**
* richer:数据字典和数据链面板 * richer:数据字典和数据链面板
*/ */
protected com.fr.data.impl.Connection database; protected com.fr.data.impl.Connection database;
protected ValueEditorPane keyColumnPane; protected DoubleDeckValueEditorPane keyColumnPane;
protected ValueEditorPane valueDictPane; protected DoubleDeckValueEditorPane valueDictPane;
protected ChoosePane chooseTable; protected ChoosePane chooseTable;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
@ -61,10 +58,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
private void initBasicComponet() { private void initBasicComponet() {
keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); // keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Engine_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); // valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
} }
private void initComponet() { private void initComponet() {
@ -72,13 +71,15 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p, p, p};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Actual_Value") + ":"), keyColumnPane}, new Component[]{null, null},
new Component[]{new UILabel(" " + Inter.getLocText("Display_Value") + ":"), valueDictPane} new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane}
}; };
JPanel dbDictPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel dbDictPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
this.add(chooseTable, BorderLayout.NORTH); this.add(chooseTable, BorderLayout.NORTH);
this.add(dbDictPanel, BorderLayout.CENTER); this.add(dbDictPanel, BorderLayout.CENTER);
@ -114,7 +115,7 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
* *
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Datasource-From_Database"); return Inter.getLocText("FR-Designer_Datasource_From_Database");
} }
public void populateBean(DatabaseDictionary dbDict) { public void populateBean(DatabaseDictionary dbDict) {
@ -135,30 +136,30 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName())); this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName()));
if(this.database == null){ if (this.database == null) {
return; return;
} }
// richer:这个也要+1才行 // richer:这个也要+1才行
if(StringUtils.isNotEmpty(dbDict.getKeyColumnName())){ if (StringUtils.isNotEmpty(dbDict.getKeyColumnName())) {
this.keyColumnPane.populate(dbDict.getKeyColumnName()); this.keyColumnPane.populate(dbDict.getKeyColumnName());
}else{ } else {
this.keyColumnPane.populate(dbDict.getKeyColumnIndex() + 1); this.keyColumnPane.populate(dbDict.getKeyColumnIndex() + 1);
} }
if(StringUtils.isNotEmpty(dbDict.getValueColumnName())){ if (StringUtils.isNotEmpty(dbDict.getValueColumnName())) {
this.valueDictPane.populate(dbDict.getValueColumnName()); this.valueDictPane.populate(dbDict.getValueColumnName());
}else{ } else {
Object value = null; Object value = null;
if (dbDict.getFormula() != null) { if (dbDict.getFormula() != null) {
value = dbDict.getFormula(); value = dbDict.getFormula();
} else { } else {
// alex:因为显示到界面上的index是以1为始的 // alex:因为显示到界面上的index是以1为始的
value = dbDict.getValueColumnIndex() + 1; value = dbDict.getValueColumnIndex() + 1;
} }
this.valueDictPane.populate(value); this.valueDictPane.populate(value);
} }
} }
public DatabaseDictionary updateBean() { public DatabaseDictionary updateBean() {
@ -177,27 +178,27 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
dbDict.setSchema(para.getSchemaName()); dbDict.setSchema(para.getSchemaName());
dbDict.setTableName(para.getTableName()); dbDict.setTableName(para.getTableName());
// alex:因为显示到界面上的index是以1为始的,所以要减1 // alex:因为显示到界面上的index是以1为始的,所以要减1
if (this.keyColumnPane.update() != null && (Integer) this.keyColumnPane.update() - 1 >= 0) { if (this.keyColumnPane.update() != null && (Integer) this.keyColumnPane.update() - 1 >= 0) {
int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1; int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1;
String keyColumnName = StringUtils.EMPTY; String keyColumnName = StringUtils.EMPTY;
if (this.keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) { if (this.keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) {
keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName(); keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName();
keyColumnIndex = -1; keyColumnIndex = -1;
} }
dbDict.setKeyColumnIndex(keyColumnIndex); dbDict.setKeyColumnIndex(keyColumnIndex);
dbDict.setKeyColumnName(keyColumnName); dbDict.setKeyColumnName(keyColumnName);
} }
Object value = this.valueDictPane.update(); Object value = this.valueDictPane.update();
if (value instanceof Integer) { if (value instanceof Integer) {
int valueColumnIndex = (Integer) this.valueDictPane.update() - 1; int valueColumnIndex = (Integer) this.valueDictPane.update() - 1;
String valueColumnName = StringUtils.EMPTY; String valueColumnName = StringUtils.EMPTY;
if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) { if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) {
valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName(); valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName();
valueColumnIndex = -1; valueColumnIndex = -1;
} }
dbDict.setValueColumnIndex(valueColumnIndex); dbDict.setValueColumnIndex(valueColumnIndex);
dbDict.setValueColumnName(valueColumnName); dbDict.setValueColumnName(valueColumnName);
} else { } else {
dbDict.setFormula(((Formula) value)); dbDict.setFormula(((Formula) value));
} }
@ -217,7 +218,7 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
String columnNameValue = columnNames.length > 0 ? columnNames[0] : StringUtils.EMPTY; String columnNameValue = columnNames.length > 0 ? columnNames[0] : StringUtils.EMPTY;
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNameValue); keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNameValue);
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Engine_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
formulaEditor.addChangeListener(new ChangeListener() { formulaEditor.addChangeListener(new ChangeListener() {

86
designer_base/src/com/fr/design/present/dict/DictionaryPane.java

@ -1,42 +1,50 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
import com.fr.data.impl.DynamicSQLDict; import com.fr.data.impl.DynamicSQLDict;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author zhou * @author zhou
* @since 2012-5-31下午12:20:41 * @since 2012-5-31下午12:20:41
*/ */
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI { public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI {
private TableDataDictPane tableDataDictPane; private TableDataDictPane tableDataDictPane;
@Override @Override
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(0,4)); this.setLayout(new BorderLayout(0, 4));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); // JPanel northPane = new JPanel(new BorderLayout(4, 0));
northPane.add(new UILabel(Inter.getLocText("Type_Set")+":", UILabel.RIGHT),BorderLayout.WEST); // northPane.add(new UILabel(Inter.getLocText("Type_Set"), UILabel.LEFT),BorderLayout.WEST);
northPane.add(jcb,BorderLayout.CENTER); // northPane.add(jcb,BorderLayout.CENTER);
this.add(northPane,BorderLayout.NORTH); double p = TableLayout.PREFERRED;
this.add(cardPane,BorderLayout.CENTER); double f = TableLayout.FILL;
} double[] columnSize = {p, f};
double[] rowSize = {p};
@Override Component[][] components = new Component[][]{
protected String title4PopupWindow() { new Component[]{new UILabel(Inter.getLocText("FR-Designer_Type_Set"), UILabel.LEFT), jcb},
return Inter.getLocText("DS-Dictionary"); };
} JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_DS-Dictionary");
}
@Override @Override
public JComponent toSwingComponent() { public JComponent toSwingComponent() {
@ -44,7 +52,7 @@ public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCr
} }
@Override @Override
public void populateBean(Dictionary ob) { public void populateBean(Dictionary ob) {
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i); FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(ob)) { if (pane.accept(ob)) {
@ -54,19 +62,19 @@ public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCr
pane.reset(); pane.reset();
} }
} }
if(ob instanceof DynamicSQLDict){ if (ob instanceof DynamicSQLDict) {
jcb.setSelectedIndex(1); jcb.setSelectedIndex(1);
tableDataDictPane.populateBean((DynamicSQLDict)ob); tableDataDictPane.populateBean((DynamicSQLDict) ob);
} }
} }
@Override @Override
protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() { protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() {
List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>(); List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>();
paneList.add( new DatabaseDictPane()); paneList.add(new DatabaseDictPane());
paneList.add(tableDataDictPane = new TableDataDictPane()); paneList.add(tableDataDictPane = new TableDataDictPane());
paneList.add( new CustomDictPane()); paneList.add(new CustomDictPane());
paneList.add( new FormulaDictPane()); paneList.add(new FormulaDictPane());
return paneList; return paneList;
} }
} }

194
designer_base/src/com/fr/design/present/dict/FormulaDictPane.java

@ -1,107 +1,123 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.*; import com.fr.base.BaseUtils;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.event.DocumentListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDictionary;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.editor.FormulaEditor;
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.design.editor.editor.FormulaEditor; import com.fr.design.utils.gui.GUICoreUtils;
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.event.DocumentListener;
import java.awt.*;
public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
private FormulaEditor keyFormulaEditor;
private FormulaEditor valueFormulaEditor;
public FormulaDictPane() { private static final int EDITOR_COLUMN = 15;
initComponents(); private FormulaEditor keyFormulaEditor;
} private FormulaEditor valueFormulaEditor;
public FormulaDictPane() {
initComponents();
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FormulaDictPane(), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(250, 400);
jf.setVisible(true);
}
private void initComponents() {
keyFormulaEditor = new FormulaEditor();
keyFormulaEditor.setColumns(EDITOR_COLUMN);
JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT));
keyFormulaEditor.setPreferredSize(new Dimension(148, 20));
Icon icon = BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png");
keyFormulaContainer.add(new JLabel(icon));
keyFormulaContainer.add(keyFormulaEditor);
valueFormulaEditor = new FormulaEditor();
valueFormulaEditor.setColumns(EDITOR_COLUMN);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p};
UILabel tag = new UILabel(Inter.getLocText("Formula_Dictionary_Display_Examples_Html"));
JPanel t = new JPanel(new BorderLayout());
t.add(tag, BorderLayout.NORTH);
Formula vf = new Formula("$$$");
valueFormulaEditor = new FormulaEditor("", vf);
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT));
valueFormulaEditor.setPreferredSize(new Dimension(148, 20));
valueFormulaContainer.add(new JLabel(icon));
valueFormulaContainer.add(valueFormulaEditor);
private void initComponents() {
keyFormulaEditor = new FormulaEditor();
keyFormulaEditor.setColumns(15);
valueFormulaEditor = new FormulaEditor();
valueFormulaEditor.setColumns(15);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { f };
double[] rowSize = { p,p,p,p,p };
// ActionLabel tips = new ActionLabel("(对应实际值范围内的每个值)") {
// @Override
// public JToolTip createToolTip() {
// MultiLineToolTip tip = new MultiLineToolTip();
// tip.setComponent(this);
// tip.setOpaque(false);
// return tip;
// }
// };
// tips.setToolTipText(Inter.getLocText("Formula_Dictionary_Display_Examples"));
// JPanel cc = new JPanel(new BorderLayout());
// cc.add(tips, BorderLayout.WEST);
UILabel tag = new UILabel(Inter.getLocText("Formula_Dictionary_Display_Examples_Html"));
JPanel t = new JPanel(new BorderLayout());
t.add(tag, BorderLayout.WEST);
Formula vf = new Formula("$$$");
valueFormulaEditor = new FormulaEditor("",vf);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Actual_Value") + ":")}, new Component[]{null, null},
new Component[]{keyFormulaEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value"), UILabel.LEFT), keyFormulaContainer},
new Component[]{new UILabel(Inter.getLocText("Display_Value") + ":")}, new Component[]{null, null},
new Component[]{valueFormulaEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value"), UILabel.LEFT), valueFormulaContainer},
new Component[]{t} new Component[]{null, null},
new Component[]{t, null}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
public void addChangeListener(DocumentListener l) { public void addChangeListener(DocumentListener l) {
keyFormulaEditor.addDocumentListener(l); keyFormulaEditor.addDocumentListener(l);
valueFormulaEditor.addDocumentListener(l); valueFormulaEditor.addDocumentListener(l);
} }
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Formula"); return Inter.getLocText("FR-Designer_Formula");
} }
@Override @Override
public void populateBean(FormulaDictionary dict) { public void populateBean(FormulaDictionary dict) {
keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula())); keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula()));
valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula())); valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula()));
} }
@Override @Override
public FormulaDictionary updateBean() { public FormulaDictionary updateBean() {
FormulaDictionary dict = new FormulaDictionary(); FormulaDictionary dict = new FormulaDictionary();
if (keyFormulaEditor.getValue() != null) { if (keyFormulaEditor.getValue() != null) {
dict.setProduceFormula(keyFormulaEditor.getValue().getContent()); dict.setProduceFormula(keyFormulaEditor.getValue().getContent());
} }
if (valueFormulaEditor.getValue() != null) { if (valueFormulaEditor.getValue() != null) {
dict.setExcuteFormula(valueFormulaEditor.getValue().getContent()); dict.setExcuteFormula(valueFormulaEditor.getValue().getContent());
} }
return dict; return dict;
} }
@Override @Override
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof FormulaDictionary; return ob instanceof FormulaDictionary;
} }
@Override @Override
public void reset() { public void reset() {
keyFormulaEditor.reset(); keyFormulaEditor.reset();
valueFormulaEditor.reset(); valueFormulaEditor.reset();
} }
} }

97
designer_base/src/com/fr/design/present/dict/TableDataDictPane.java

@ -1,48 +1,46 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.data.impl.DynamicSQLDict; import com.fr.data.impl.DynamicSQLDict;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
import com.fr.design.DesignModelAdapter;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.DesignModelAdapter; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.editor.DoubleDeckValueEditorPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.ColumnIndexEditor; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
/** /**
* 数据字典的数据查询面板 * 数据字典的数据查询面板
@ -56,8 +54,8 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
private static final long serialVersionUID = -5469742115988153206L; private static final long serialVersionUID = -5469742115988153206L;
private static final int SELECTED_NO_TABLEDATA = -2; private static final int SELECTED_NO_TABLEDATA = -2;
public TableDataComboBox tableDataNameComboBox; public TableDataComboBox tableDataNameComboBox;
private ValueEditorPane keyColumnPane; private DoubleDeckValueEditorPane keyColumnPane;
private ValueEditorPane valueDictPane; private DoubleDeckValueEditorPane valueDictPane;
private ItemListener itemListener; private ItemListener itemListener;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
@ -67,6 +65,17 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
iniListener(); iniListener();
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new TableDataDictPane(), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
private void initBasicComponets() { private void initBasicComponets() {
tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableDataNameComboBox.addItemListener(new ItemListener() { tableDataNameComboBox.addItemListener(new ItemListener() {
@ -76,10 +85,12 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
} }
} }
}); });
keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); // keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); // valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
} }
private void initComponents() { private void initComponents() {
@ -87,20 +98,20 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p, p, p};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}};
JPanel firstLine = new JPanel(new BorderLayout(4, 0)); JPanel firstLine = new JPanel(new BorderLayout(4, 0));
firstLine.add(tableDataNameComboBox, BorderLayout.CENTER); firstLine.add(tableDataNameComboBox, BorderLayout.CENTER);
firstLine.add(new PreviewLabel(this), BorderLayout.EAST); firstLine.add(new PreviewLabel(this), BorderLayout.EAST);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_DS_TableData") + ":", UILabel.RIGHT), firstLine}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS_TableData") + " ", UILabel.LEFT), firstLine},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + ":", UILabel.RIGHT), keyColumnPane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + ":", UILabel.RIGHT), valueDictPane} new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
@ -133,10 +144,11 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 该面板标题 * 该面板标题
*
* @return 返回是窗口显示的标题 * @return 返回是窗口显示的标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Dic-Data_Query"); return Inter.getLocText("FR-Designer_Dic_Data_Query");
} }
private void tdChange(final ItemEvent e) { private void tdChange(final ItemEvent e) {
@ -239,14 +251,14 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource(); TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource();
if (dataSource != null) { if (dataSource != null) {
for (int i = BEGIN; i < END; i++) { for (int i = BEGIN; i < END; i++) {
TableData td = dataSource.getTableData(Inter.getLocText("Dictionary-Dynamic_SQL") + i); TableData td = dataSource.getTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i);
if (td == null) { if (td == null) {
name = Inter.getLocText("Dictionary-Dynamic_SQL") + i; name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i;
dataSource.putTableData(Inter.getLocText("Dictionary-Dynamic_SQL") + i, db); dataSource.putTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i, db);
break; break;
} else { } else {
if (ComparatorUtils.equals(td, db)) { if (ComparatorUtils.equals(td, db)) {
name = Inter.getLocText("Dictionary-Dynamic_SQL") + i; name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i;
break; break;
} else { } else {
continue; continue;
@ -319,6 +331,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 判断ob是否是TableDataDictionary类型 * 判断ob是否是TableDataDictionary类型
*
* @param ob 用于判断的Object * @param ob 用于判断的Object
* @return 如果是TableDataDictionary类型则返回true * @return 如果是TableDataDictionary类型则返回true
*/ */
@ -338,7 +351,8 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
*给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -347,6 +361,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 是否应该相应listener事件 * 是否应该相应listener事件
*
* @return 要是响应listener事件则返回true * @return 要是响应listener事件则返回true
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {

9
designer_base/src/com/fr/start/BaseDesigner.java

@ -17,15 +17,13 @@ import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane; import com.fr.design.mainframe.TemplatePane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.module.DesignModule;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.env.SignIn; import com.fr.env.SignIn;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.*;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginCollector;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.stable.*; import com.fr.stable.*;
@ -68,6 +66,9 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
//下面这两句的位置不能随便调换,因为会影响语言切换的问题 //下面这两句的位置不能随便调换,因为会影响语言切换的问题
initLanguage(); initLanguage();
// 在 initLanguage 之后加载设计器国际化文件,确保是正确的语言环境
Inter.loadLocaleFile(GeneralContext.getLocale(), DesignModule.LOCALE_FILE_PATH);
SplashWindow splashWindow = new SplashWindow(createSplashPane()); SplashWindow splashWindow = new SplashWindow(createSplashPane());
if (args != null) { if (args != null) {
for (String arg : args) { for (String arg : args) {

10
designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -4,6 +4,7 @@ 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.form.javascript.FormEmailPane;
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;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
@ -11,13 +12,13 @@ import com.fr.js.EmailJavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane{ public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
private static FormHyperlinkGroupPane singleton; private static FormHyperlinkGroupPane singleton;
private FormHyperlinkGroupPane() { private FormHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(); super(hyperlinkGroupPaneActionProvider);
} }
public synchronized static FormHyperlinkGroupPane getInstance() { public synchronized static FormHyperlinkGroupPane getInstance(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
if (singleton == null) { if (singleton == null) {
singleton = new FormHyperlinkGroupPane(); singleton = new FormHyperlinkGroupPane(hyperlinkGroupPaneActionProvider);
} }
return singleton; return singleton;
} }
@ -38,5 +39,4 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
} }
return creators; return creators;
} }
} }

15
designer_form/src/com/fr/design/mainframe/JForm.java

@ -6,6 +6,7 @@ import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction; import com.fr.design.designer.beans.actions.CutAction;
import com.fr.design.designer.beans.actions.FormDeleteAction; import com.fr.design.designer.beans.actions.FormDeleteAction;
@ -17,6 +18,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
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.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.xpane.FormHyperlinkGroupPane; import com.fr.design.gui.xpane.FormHyperlinkGroupPane;
@ -92,6 +94,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
} }
@Override
public TargetComponent getCurrentElementCasePane() {
if (elementCaseDesign == null) {
return null;
}
return elementCaseDesign.getEditingElementCasePane();
}
public int getMenuState() { public int getMenuState() {
return DesignState.JFORM; return DesignState.JFORM;
@ -137,8 +147,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
* *
* @return 超链连接界面 * @return 超链连接界面
*/ */
public HyperlinkGroupPane getHyperLinkPane() { public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return FormHyperlinkGroupPane.getInstance(); return FormHyperlinkGroupPane.getInstance(hyperlinkGroupPaneActionProvider);
} }
//表单返回 FORM_TAB or ELEMENTCASE_TAB //表单返回 FORM_TAB or ELEMENTCASE_TAB
@ -653,6 +663,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane()); EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane()); EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
return; return;
} }
} }

Loading…
Cancel
Save