Browse Source
* 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
61 changed files with 3822 additions and 2552 deletions
@ -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) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
@ -1,57 +1,57 @@ |
|||||||
package com.fr.design.mainframe.cell; |
package com.fr.design.mainframe.cell; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
|
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.design.selection.QuickEditor; |
import com.fr.design.selection.QuickEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* QuickEditorRegion |
* QuickEditorRegion |
||||||
* |
* |
||||||
* @editor zhou |
* @author zhou, yaoh.wu |
||||||
* @since 2012-3-23下午3:21:36 |
* @version 2017年7月25日 |
||||||
|
* @since 8.0 |
||||||
*/ |
*/ |
||||||
|
|
||||||
public class QuickEditorRegion extends JPanel { |
public class QuickEditorRegion extends JPanel { |
||||||
|
|
||||||
public static QuickEditorRegion getInstance() { |
|
||||||
return singleton; |
private static QuickEditorRegion singleton = new QuickEditorRegion(); |
||||||
} |
private static JPanel EMPTY; |
||||||
|
|
||||||
public static JPanel getEmptyEditor() { |
private QuickEditorRegion() { |
||||||
if(EMPTY == null) { |
this.setLayout(new BorderLayout()); |
||||||
EMPTY = new JPanel(new BorderLayout()); |
} |
||||||
UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"})+"!"); |
|
||||||
content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0)); |
public static QuickEditorRegion getInstance() { |
||||||
EMPTY.add(content, BorderLayout.CENTER); |
return singleton; |
||||||
} |
} |
||||||
return EMPTY; |
|
||||||
} |
public static JPanel getEmptyEditor() { |
||||||
|
if (EMPTY == null) { |
||||||
private static QuickEditorRegion singleton = new QuickEditorRegion(); |
EMPTY = new JPanel(new BorderLayout()); |
||||||
private static JPanel EMPTY; |
UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"}) + "!"); |
||||||
|
content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0)); |
||||||
public QuickEditorRegion() { |
EMPTY.add(content, BorderLayout.CENTER); |
||||||
this.setLayout(new BorderLayout()); |
} |
||||||
} |
return EMPTY; |
||||||
|
} |
||||||
/** |
|
||||||
* 传值 |
/** |
||||||
* |
* 更新面板显示数据 |
||||||
* @param ePane |
* |
||||||
*/ |
* @param currentEditor 当前正在编辑的单元格编辑器或者默认的单元格编辑器 |
||||||
public void populate(final QuickEditor quickEditor) { |
*/ |
||||||
this.removeAll(); |
public void populate(final QuickEditor currentEditor) { |
||||||
if(quickEditor.getComponentCount() == 0) { |
this.removeAll(); |
||||||
this.add(getEmptyEditor(), BorderLayout.CENTER); |
if (currentEditor.getComponentCount() == 0) { |
||||||
} else { |
this.add(getEmptyEditor(), BorderLayout.CENTER); |
||||||
this.add(quickEditor, BorderLayout.CENTER); |
} else { |
||||||
} |
this.add(currentEditor, BorderLayout.CENTER); |
||||||
validate(); |
} |
||||||
repaint(); |
validate(); |
||||||
} |
repaint(); |
||||||
|
} |
||||||
} |
} |
@ -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); |
||||||
|
intPartSpinner.addChangeListener(listener2); |
||||||
|
deciPartSpinner.addChangeListener(listener2); |
||||||
|
textField.setText("123456.78"); |
||||||
|
} |
||||||
|
|
||||||
textField.getDocument().addDocumentListener(listener); |
@Override |
||||||
intPartSpinner.addChangeListener(listener2); |
|
||||||
deciPartSpinner.addChangeListener(listener2); |
|
||||||
textField.setText("123456.78"); |
|
||||||
} |
|
||||||
|
|
||||||
@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(); |
Dimension size = this.getSize(); |
||||||
try { |
try { |
||||||
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); |
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); |
||||||
currencyLineImpl.draw((Graphics2D)g, (int)(size.getWidth()), (int)(size.getHeight())); |
currencyLineImpl.draw((Graphics2D) g, (int) (size.getWidth()), (int) (size.getHeight())); |
||||||
} catch (BarcodeException e) { |
} catch (BarcodeException e) { |
||||||
Color oldColor = g.getColor(); |
Color oldColor = g.getColor(); |
||||||
g.setColor(Color.red); |
g.setColor(Color.red); |
||||||
g.drawString(e.getMessage(), (int)(size.getWidth() / POSITION), (int)(size.getHeight() / POSITION)); |
g.drawString(e.getMessage(), (int) (size.getWidth() / POSITION), (int) (size.getHeight() / POSITION)); |
||||||
g.setColor(oldColor); |
g.setColor(oldColor); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
protected static JPanel groupPane(JComponent comp) { |
protected static JPanel groupPane(JComponent comp) { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setBorder(null); |
jp.setBorder(null); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
jp.add(comp); |
jp.add(comp); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@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); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,61 +1,63 @@ |
|||||||
package com.fr.quickeditor.cellquick; |
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; |
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; |
||||||
|
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
|
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.CellQuickEditor; |
import com.fr.quickeditor.CellQuickEditor; |
||||||
import com.fr.report.cell.painter.BiasTextPainter; |
import com.fr.report.cell.painter.BiasTextPainter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
/** |
||||||
|
* 单元格元素斜线编辑器 |
||||||
|
* TODO 9.0 大体没有改动 |
||||||
|
*/ |
||||||
public class CellBiasTextPainterEditor extends CellQuickEditor { |
public class CellBiasTextPainterEditor extends CellQuickEditor { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public JComponent createCenterBody() { |
public JComponent createCenterBody() { |
||||||
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); |
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); |
||||||
editbutton.addActionListener(new ActionListener() { |
editbutton.addActionListener(new ActionListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void actionPerformed(ActionEvent e) { |
public void actionPerformed(ActionEvent e) { |
||||||
showEditingDialog(); |
showEditingDialog(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||||
editbutton.setMargin(null); |
editbutton.setMargin(null); |
||||||
editbutton.setOpaque(false); |
editbutton.setOpaque(false); |
||||||
return editbutton; |
return editbutton; |
||||||
} |
} |
||||||
|
|
||||||
private void showEditingDialog() { |
private void showEditingDialog() { |
||||||
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter)cellElement.getValue(); |
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue(); |
||||||
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane(); |
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane(); |
||||||
biasTextPainterPane.populate(oldbiasTextPainter); |
biasTextPainterPane.populate(oldbiasTextPainter); |
||||||
biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
BiasTextPainter newbiasTextPainter = biasTextPainterPane.update(); |
BiasTextPainter newbiasTextPainter = biasTextPainterPane.update(); |
||||||
if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) { |
if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) { |
||||||
cellElement.setValue(newbiasTextPainter); |
cellElement.setValue(newbiasTextPainter); |
||||||
fireTargetModified(); |
fireTargetModified(); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
}).setVisible(true); |
}).setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void refreshDetails() { |
protected void refreshDetails() { |
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,75 +1,77 @@ |
|||||||
package com.fr.quickeditor.cellquick; |
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
|
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.design.report.SelectImagePane; |
import com.fr.design.report.SelectImagePane; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
|
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.CellQuickEditor; |
import com.fr.quickeditor.CellQuickEditor; |
||||||
import com.fr.report.cell.cellattr.CellImage; |
import com.fr.report.cell.cellattr.CellImage; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
/** |
||||||
|
* 单元格元素图片编辑器 |
||||||
|
* TODO 9.0大体上没有改动 |
||||||
|
*/ |
||||||
public class CellImageQuickEditor extends CellQuickEditor { |
public class CellImageQuickEditor extends CellQuickEditor { |
||||||
private static CellImageQuickEditor THIS; |
private static CellImageQuickEditor THIS; |
||||||
|
|
||||||
public static final CellImageQuickEditor getInstance() { |
public static final CellImageQuickEditor getInstance() { |
||||||
if(THIS == null) { |
if (THIS == null) { |
||||||
THIS = new CellImageQuickEditor(); |
THIS = new CellImageQuickEditor(); |
||||||
} |
} |
||||||
return THIS; |
return THIS; |
||||||
} |
} |
||||||
|
|
||||||
private CellImageQuickEditor() { |
private CellImageQuickEditor() { |
||||||
super(); |
super(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public JComponent createCenterBody() { |
public JComponent createCenterBody() { |
||||||
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); |
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); |
||||||
editbutton.addActionListener(new ActionListener() { |
editbutton.addActionListener(new ActionListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void actionPerformed(ActionEvent e) { |
public void actionPerformed(ActionEvent e) { |
||||||
showEditingDialog(); |
showEditingDialog(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||||
editbutton.setMargin(null); |
editbutton.setMargin(null); |
||||||
editbutton.setOpaque(false); |
editbutton.setOpaque(false); |
||||||
return editbutton; |
return editbutton; |
||||||
} |
} |
||||||
|
|
||||||
private void showEditingDialog() { |
private void showEditingDialog() { |
||||||
final SelectImagePane imageEditorPane = new SelectImagePane(); |
final SelectImagePane imageEditorPane = new SelectImagePane(); |
||||||
imageEditorPane.populate(cellElement); |
imageEditorPane.populate(cellElement); |
||||||
final Object oldValue = cellElement.getValue(); |
final Object oldValue = cellElement.getValue(); |
||||||
final Style oldStyle = cellElement.getStyle(); |
final Style oldStyle = cellElement.getStyle(); |
||||||
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
CellImage cellImage = imageEditorPane.update(); |
CellImage cellImage = imageEditorPane.update(); |
||||||
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { |
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { |
||||||
cellElement.setValue(cellImage.getImage()); |
cellElement.setValue(cellImage.getImage()); |
||||||
cellElement.setStyle(cellImage.getStyle()); |
cellElement.setStyle(cellImage.getStyle()); |
||||||
fireTargetModified(); |
fireTargetModified(); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
}).setVisible(true); |
}).setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void refreshDetails() { |
protected void refreshDetails() { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,50 +1,50 @@ |
|||||||
package com.fr.quickeditor.cellquick; |
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
|
|
||||||
import com.fr.design.actions.insert.cell.RichTextCellAction; |
import com.fr.design.actions.insert.cell.RichTextCellAction; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.CellQuickEditor; |
import com.fr.quickeditor.CellQuickEditor; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 单元格元素富文本编辑器 |
||||||
|
* TODO 9.0 大体上没有改动 |
||||||
|
*/ |
||||||
public class CellRichTextEditor extends CellQuickEditor { |
public class CellRichTextEditor extends CellQuickEditor { |
||||||
private UIButton subReportButton; |
private UIButton subReportButton; |
||||||
private static CellRichTextEditor THIS; |
private static CellRichTextEditor THIS; |
||||||
|
|
||||||
public static final CellRichTextEditor getInstance() { |
public static final CellRichTextEditor getInstance() { |
||||||
if(THIS == null) { |
if (THIS == null) { |
||||||
THIS = new CellRichTextEditor(); |
THIS = new CellRichTextEditor(); |
||||||
} |
} |
||||||
return THIS; |
return THIS; |
||||||
} |
} |
||||||
|
|
||||||
private CellRichTextEditor() { |
private CellRichTextEditor() { |
||||||
super(); |
super(); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建界面上中间的部分 |
* 创建界面上中间的部分 |
||||||
* |
* |
||||||
* @return 界面元素 |
* @return 界面元素 |
||||||
* |
* @date 2014-12-7-下午9:41:52 |
||||||
* |
*/ |
||||||
* @date 2014-12-7-下午9:41:52 |
public JComponent createCenterBody() { |
||||||
* |
subReportButton = new UIButton(); |
||||||
*/ |
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||||
public JComponent createCenterBody() { |
subReportButton.setMargin(null); |
||||||
subReportButton = new UIButton(); |
subReportButton.setOpaque(false); |
||||||
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
return subReportButton; |
||||||
subReportButton.setMargin(null); |
} |
||||||
subReportButton.setOpaque(false); |
|
||||||
return subReportButton; |
@Override |
||||||
} |
protected void refreshDetails() { |
||||||
|
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); |
||||||
@Override |
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); |
||||||
protected void refreshDetails() { |
subReportButton.setAction(subReportCellAction); |
||||||
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); |
} |
||||||
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); |
|
||||||
subReportButton.setAction(subReportCellAction); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -1,42 +1,45 @@ |
|||||||
package com.fr.quickeditor.cellquick; |
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
|
|
||||||
import com.fr.design.actions.insert.cell.SubReportCellAction; |
import com.fr.design.actions.insert.cell.SubReportCellAction; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.CellQuickEditor; |
import com.fr.quickeditor.CellQuickEditor; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 单元格元素子报表编辑器 |
||||||
|
* TODO 9.0大体上没有改动 |
||||||
|
*/ |
||||||
public class CellSubReportEditor extends CellQuickEditor { |
public class CellSubReportEditor extends CellQuickEditor { |
||||||
private UIButton subReportButton; |
private UIButton subReportButton; |
||||||
private static CellSubReportEditor THIS; |
private static CellSubReportEditor THIS; |
||||||
|
|
||||||
public static final CellSubReportEditor getInstance() { |
public static final CellSubReportEditor getInstance() { |
||||||
if(THIS == null) { |
if (THIS == null) { |
||||||
THIS = new CellSubReportEditor(); |
THIS = new CellSubReportEditor(); |
||||||
} |
} |
||||||
return THIS; |
return THIS; |
||||||
} |
} |
||||||
|
|
||||||
private CellSubReportEditor() { |
private CellSubReportEditor() { |
||||||
super(); |
super(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
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() { |
||||||
SubReportCellAction subReportCellAction = new SubReportCellAction(tc); |
SubReportCellAction subReportCellAction = new SubReportCellAction(tc); |
||||||
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); |
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); |
||||||
subReportButton.setAction(subReportCellAction); |
subReportButton.setAction(subReportCellAction); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
@ -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(); |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue