forked from fanruan/design
Browse Source
* commit '72c8a02c11a486138be98e0a9fcfc956bc6d5305': (36 commits) merge 代码修改 REPORT-3293 9.0设计器控件设置重画 REPORT-3163 合作开发9.0设计器=>聚合报表=》代码规范 REPORT-3163 合作开发9.0设计器=>聚合报表=》点击报表块内的单元格时,替换控件设置tab页 REPORT-3163 合作开发9.0设计器=>聚合报表=》去掉无用import REPORT-3163 合作开发9.0设计器=>聚合报表=》国际化;边距调整 REPORT-3163 合作开发9.0设计器=>聚合报表=》控件名称面板 REPORT-3163 合作开发9.0设计器=>聚合报表=》坐标尺寸 tree background 代码上传 解决冲突 解决冲突 REPORT-3293 9.0设计器控件设置重画 REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐 fix REPORT-2897 9.0设计器修改 视觉微调 REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐 REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐 REPORT-3410 ...master
125 changed files with 9413 additions and 3944 deletions
@ -1,191 +1,208 @@ |
|||||||
package com.fr.design.expand; |
package com.fr.design.expand; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.constants.LayoutConstants; |
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.gui.columnrow.ColumnRowPane; |
import com.fr.design.gui.columnrow.ColumnRowPane; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.general.Inter; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.selection.SelectionEvent; |
||||||
import com.fr.grid.selection.CellSelection; |
import com.fr.design.selection.SelectionListener; |
||||||
import com.fr.grid.selection.Selection; |
import com.fr.general.Inter; |
||||||
import com.fr.report.cell.cellattr.CellExpandAttr; |
import com.fr.grid.selection.CellSelection; |
||||||
import com.fr.design.selection.SelectionEvent; |
import com.fr.grid.selection.Selection; |
||||||
import com.fr.design.selection.SelectionListener; |
import com.fr.report.cell.cellattr.CellExpandAttr; |
||||||
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.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
import java.beans.PropertyChangeEvent; |
|
||||||
import java.beans.PropertyChangeListener; |
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { |
||||||
|
|
||||||
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { |
public UIComboBox comboBox; |
||||||
|
private ColumnRowPane customParentColumnRowPane; |
||||||
private UIComboBox comboBox; |
private ElementCasePane ePane; |
||||||
private ColumnRowPane customParentColumnRowPane; |
private SelectionListener gridSelectionChangeListener; |
||||||
private ElementCasePane ePane; |
private CellSelection oldSelection; |
||||||
private SelectionListener gridSelectionChangeListener; |
private String expandFatherName = ""; |
||||||
private CellSelection oldSelection; |
private GlobalNameListener globalNameListener = null; |
||||||
private String expandFatherName = ""; |
private boolean isAlreadyAddListener = false; |
||||||
private GlobalNameListener globalNameListener = null; |
public JPanel customPane; |
||||||
private boolean isAlreadyAddListener = false; |
private CardLayout cardLayout; |
||||||
private final JPanel customPane; |
|
||||||
|
public ExpandFatherPane() { |
||||||
public ExpandFatherPane() { |
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); |
||||||
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); |
comboBox = new UIComboBox(new String[]{ |
||||||
comboBox = new UIComboBox(new String[]{ |
Inter.getLocText("FR-Designer_None"), |
||||||
Inter.getLocText("FR-Designer_None"), |
Inter.getLocText("FR-Designer_DEFAULT"), |
||||||
Inter.getLocText("FR-Designer_DEFAULT"), |
Inter.getLocText("FR-Designer_Custom")}); |
||||||
Inter.getLocText("FR-Designer_Custom")}); |
cardLayout = new CardLayout(); |
||||||
final CardLayout cardLayout = new CardLayout(); |
customPane = new JPanel(cardLayout); |
||||||
customPane = new JPanel(cardLayout); |
customParentColumnRowPane = new ColumnRowPane() { |
||||||
customParentColumnRowPane = new ColumnRowPane() { |
|
||||||
|
@Override |
||||||
@Override |
public Dimension getPreferredSize() { |
||||||
public Dimension getPreferredSize() { |
return new Dimension(super.getPreferredSize().width, 20); |
||||||
return new Dimension(super.getPreferredSize().width, 20); |
} |
||||||
} |
|
||||||
|
public void setGlobalName() { |
||||||
public void setGlobalName() { |
if (shouldResponseNameListener()) { |
||||||
if (shouldResponseNameListener()) { |
globalNameListener.setGlobalName(expandFatherName); |
||||||
globalNameListener.setGlobalName(expandFatherName); |
} |
||||||
} |
} |
||||||
} |
}; |
||||||
}; |
|
||||||
|
UIButton imageButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/select.png")); |
||||||
UIButton imageButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/select.png")); |
imageButton.setPreferredSize(new Dimension(24, 20)); |
||||||
imageButton.setPreferredSize(new Dimension(24, 20)); |
JPanel cc = new JPanel(new BorderLayout(LayoutConstants.HGAP_SMALL, 0)); |
||||||
JPanel cc = new JPanel(new BorderLayout(LayoutConstants.HGAP_SMALL, 0)); |
cc.add(customParentColumnRowPane, BorderLayout.CENTER); |
||||||
cc.add(customParentColumnRowPane, BorderLayout.CENTER); |
cc.add(imageButton, BorderLayout.EAST); |
||||||
cc.add(imageButton, BorderLayout.EAST); |
customPane.add(cc, "content"); |
||||||
customPane.add(cc, "content"); |
customPane.add(new JPanel(), "none"); |
||||||
customPane.add(new JPanel(), "none"); |
customPane.setPreferredSize(new Dimension(0, 0)); |
||||||
customPane.setPreferredSize(new Dimension(0, 0) ); |
this.add(comboBox, BorderLayout.NORTH); |
||||||
this.add(comboBox, BorderLayout.NORTH); |
this.add(customPane, BorderLayout.CENTER); |
||||||
this.add(customPane, BorderLayout.CENTER); |
|
||||||
|
comboBox.addItemListener(new ItemListener() { |
||||||
comboBox.addItemListener(new ItemListener() { |
|
||||||
|
@Override |
||||||
@Override |
public void itemStateChanged(ItemEvent e) { |
||||||
public void itemStateChanged(ItemEvent e) { |
if (comboBox.getSelectedIndex() == 2) { |
||||||
if(comboBox.getSelectedIndex() == 2){ |
customPane.setPreferredSize(new Dimension(100, 20)); |
||||||
customPane.setPreferredSize(new Dimension(100, 20) ); |
cardLayout.show(customPane, "content"); |
||||||
cardLayout.show(customPane,"content"); |
} else { |
||||||
}else { |
cardLayout.show(customPane, "none"); |
||||||
cardLayout.show(customPane,"none"); |
customPane.setPreferredSize(new Dimension(0, 0)); |
||||||
customPane.setPreferredSize(new Dimension(0, 0) ); |
} |
||||||
} |
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
|
||||||
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
|
if (globalNameListener != null && shouldResponseNameListener()) { |
||||||
if (globalNameListener != null && shouldResponseNameListener()) { |
globalNameListener.setGlobalName(expandFatherName); |
||||||
globalNameListener.setGlobalName(expandFatherName); |
} |
||||||
} |
} |
||||||
} |
}); |
||||||
}); |
imageButton.addActionListener(imageActionListener); |
||||||
imageButton.addActionListener(new ActionListener() { |
comboBox.setSelectedIndex(1); |
||||||
|
} |
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
ItemListener comboBoxItemListener = new ItemListener() { |
||||||
|
@Override |
||||||
if (ePane == null || isAlreadyAddListener) { |
public void itemStateChanged(ItemEvent e) { |
||||||
return; |
if (comboBox.getSelectedIndex() == 2) { |
||||||
} |
customPane.setPreferredSize(new Dimension(100, 20)); |
||||||
oldSelection = (CellSelection) ePane.getSelection(); |
cardLayout.show(customPane, "content"); |
||||||
ePane.getGrid().setNotShowingTableSelectPane(false); |
} else { |
||||||
ePane.setEditable(false); |
cardLayout.show(customPane, "none"); |
||||||
ePane.repaint(10); |
customPane.setPreferredSize(new Dimension(0, 0)); |
||||||
|
} |
||||||
gridSelectionChangeListener = new SelectionListener() { |
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
|
||||||
|
if (globalNameListener != null && shouldResponseNameListener()) { |
||||||
@Override |
globalNameListener.setGlobalName(expandFatherName); |
||||||
public void selectionChanged(SelectionEvent e) { |
} |
||||||
Selection selection = ePane.getSelection(); |
} |
||||||
if (selection instanceof CellSelection) { |
}; |
||||||
CellSelection cellselection = (CellSelection) selection; |
|
||||||
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); |
ActionListener imageActionListener = new ActionListener() { |
||||||
ePane.setOldSelecton(oldSelection); |
@Override |
||||||
customParentColumnRowPane.setColumnRow(cr); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
if (ePane == null || isAlreadyAddListener) { |
||||||
ePane.removeSelectionChangeListener(gridSelectionChangeListener); |
return; |
||||||
isAlreadyAddListener = false; |
} |
||||||
ePane.getGrid().setNotShowingTableSelectPane(true); |
oldSelection = (CellSelection) ePane.getSelection(); |
||||||
ePane.setEditable(true); |
ePane.getGrid().setNotShowingTableSelectPane(false); |
||||||
ePane.repaint(); |
ePane.setEditable(false); |
||||||
} |
ePane.repaint(10); |
||||||
}; |
|
||||||
ePane.addSelectionChangeListener(gridSelectionChangeListener); |
gridSelectionChangeListener = new SelectionListener() { |
||||||
isAlreadyAddListener = true; |
|
||||||
} |
@Override |
||||||
}); |
public void selectionChanged(SelectionEvent e) { |
||||||
comboBox.setSelectedIndex(1); |
Selection selection = ePane.getSelection(); |
||||||
} |
if (selection instanceof CellSelection) { |
||||||
|
CellSelection cellselection = (CellSelection) selection; |
||||||
/** |
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); |
||||||
* @param listener 观察者监听事件 |
ePane.setOldSelecton(oldSelection); |
||||||
*/ |
customParentColumnRowPane.setColumnRow(cr); |
||||||
public void registerNameListener(GlobalNameListener listener) { |
} |
||||||
globalNameListener = listener; |
ePane.removeSelectionChangeListener(gridSelectionChangeListener); |
||||||
} |
isAlreadyAddListener = false; |
||||||
|
ePane.getGrid().setNotShowingTableSelectPane(true); |
||||||
/** |
ePane.setEditable(true); |
||||||
* @return |
ePane.repaint(); |
||||||
*/ |
} |
||||||
public boolean shouldResponseNameListener() { |
}; |
||||||
return true; |
ePane.addSelectionChangeListener(gridSelectionChangeListener); |
||||||
} |
isAlreadyAddListener = true; |
||||||
|
} |
||||||
protected abstract ColumnRow getColumnRow(CellExpandAttr cellExpandAttr); |
}; |
||||||
|
|
||||||
protected abstract boolean isParentDefault(CellExpandAttr cellExpandAttr); |
|
||||||
|
/** |
||||||
public void populate(CellExpandAttr cellExpandAttr) { |
* @param listener 观察者监听事件 |
||||||
ColumnRow columnRow = getColumnRow(cellExpandAttr); |
*/ |
||||||
if (isParentDefault(cellExpandAttr)) { |
public void registerNameListener(GlobalNameListener listener) { |
||||||
comboBox.setSelectedIndex(1); |
globalNameListener = listener; |
||||||
this.customParentColumnRowPane.populate(ColumnRow.valueOf(0, 0)); |
} |
||||||
} else if (ColumnRow.validate(columnRow)) { |
|
||||||
comboBox.setSelectedIndex(2); |
/** |
||||||
this.customParentColumnRowPane.populate(columnRow); |
* @return |
||||||
} else { |
*/ |
||||||
comboBox.setSelectedIndex(0); |
public boolean shouldResponseNameListener() { |
||||||
this.customParentColumnRowPane.populate(ColumnRow.valueOf(0, 0)); |
return true; |
||||||
} |
} |
||||||
} |
|
||||||
|
protected abstract ColumnRow getColumnRow(CellExpandAttr cellExpandAttr); |
||||||
|
|
||||||
public void setGlobalName(String name) { |
protected abstract boolean isParentDefault(CellExpandAttr cellExpandAttr); |
||||||
expandFatherName = name; |
|
||||||
this.comboBox.setGlobalName(name); |
public void populate(CellExpandAttr cellExpandAttr) { |
||||||
} |
ColumnRow columnRow = getColumnRow(cellExpandAttr); |
||||||
|
if (isParentDefault(cellExpandAttr)) { |
||||||
protected abstract void setValue(CellExpandAttr cellExpandAttr, boolean isDefault, ColumnRow columnRow); |
comboBox.setSelectedIndex(1); |
||||||
|
this.customParentColumnRowPane.populate(ColumnRow.valueOf(0, 0)); |
||||||
public void update(CellExpandAttr cellExpandAttr) { |
} else if (ColumnRow.validate(columnRow)) { |
||||||
if (cellExpandAttr == null) { |
comboBox.setSelectedIndex(2); |
||||||
cellExpandAttr = new CellExpandAttr(); |
this.customParentColumnRowPane.populate(columnRow); |
||||||
} |
} else { |
||||||
int i = comboBox.getSelectedIndex(); |
comboBox.setSelectedIndex(0); |
||||||
switch (i) { |
this.customParentColumnRowPane.populate(ColumnRow.valueOf(0, 0)); |
||||||
case 1: |
} |
||||||
setValue(cellExpandAttr, true, null); |
} |
||||||
break; |
|
||||||
case 2: |
|
||||||
setValue(cellExpandAttr, false, this.customParentColumnRowPane.update()); |
public void setGlobalName(String name) { |
||||||
break; |
expandFatherName = name; |
||||||
default: |
this.comboBox.setGlobalName(name); |
||||||
setValue(cellExpandAttr, false, null); |
} |
||||||
break; |
|
||||||
} |
protected abstract void setValue(CellExpandAttr cellExpandAttr, boolean isDefault, ColumnRow columnRow); |
||||||
} |
|
||||||
|
public void update(CellExpandAttr cellExpandAttr) { |
||||||
public void setElementCasePane(ElementCasePane ePane) { |
if (cellExpandAttr == null) { |
||||||
this.ePane = ePane; |
cellExpandAttr = new CellExpandAttr(); |
||||||
} |
} |
||||||
|
int i = comboBox.getSelectedIndex(); |
||||||
|
switch (i) { |
||||||
|
case 1: |
||||||
|
setValue(cellExpandAttr, true, null); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
setValue(cellExpandAttr, false, this.customParentColumnRowPane.update()); |
||||||
|
break; |
||||||
|
default: |
||||||
|
setValue(cellExpandAttr, false, null); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setElementCasePane(ElementCasePane ePane) { |
||||||
|
this.ePane = ePane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
} |
} |
@ -1,194 +1,207 @@ |
|||||||
package com.fr.design.mainframe.cell; |
package com.fr.design.mainframe.cell; |
||||||
|
|
||||||
import com.fr.design.ExtraDesignClassManager; |
import com.fr.design.ExtraDesignClassManager; |
||||||
import com.fr.design.dialog.BasicPane; |
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.ElementCasePane; |
||||||
import com.fr.design.mainframe.cell.settingpane.*; |
import com.fr.design.mainframe.cell.settingpane.*; |
||||||
import com.fr.design.utils.DesignUtils; |
import com.fr.design.utils.DesignUtils; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.grid.selection.CellSelection; |
import com.fr.general.Inter; |
||||||
import com.fr.grid.selection.Selection; |
import com.fr.grid.selection.CellSelection; |
||||||
import com.fr.report.cell.CellElement; |
import com.fr.grid.selection.Selection; |
||||||
import com.fr.report.cell.DefaultTemplateCellElement; |
import com.fr.report.cell.CellElement; |
||||||
import com.fr.report.cell.TemplateCellElement; |
import com.fr.report.cell.DefaultTemplateCellElement; |
||||||
import com.fr.report.elementcase.TemplateElementCase; |
import com.fr.report.cell.TemplateCellElement; |
||||||
|
import com.fr.report.elementcase.TemplateElementCase; |
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
import javax.swing.*; |
||||||
import java.util.ArrayList; |
import java.awt.*; |
||||||
import java.util.List; |
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
/** |
|
||||||
* the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作 |
/** |
||||||
* |
* the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作 |
||||||
* @author zhou |
* |
||||||
* @since 2012-5-8下午12:18:53 |
* @author zhou |
||||||
*/ |
* @since 2012-5-8下午12:18:53 |
||||||
public class CellElementEditPane extends BasicPane { |
*/ |
||||||
private static int TIME_GAP = 80; |
public class CellElementEditPane extends BasicPane { |
||||||
private List<AbstractCellAttrPane> paneList; |
private static int TIME_GAP = 80; |
||||||
private TemplateCellElement cellelement; |
private List<AbstractCellAttrPane> paneList; |
||||||
private ElementCasePane ePane; |
private TemplateCellElement cellelement; |
||||||
private UIHeadGroup tabsHeaderIconPane; |
private ElementCasePane ePane; |
||||||
|
private UIHeadGroup tabsHeaderIconPane; |
||||||
private boolean isEditing; |
|
||||||
private int PaneListIndex; |
private boolean isEditing; |
||||||
private CardLayout card; |
private int PaneListIndex; |
||||||
private JPanel center; |
private CardLayout card; |
||||||
private JPanel downTitle; |
private JPanel center; |
||||||
private JPanel title; |
private JPanel downTitle; |
||||||
private UILabel titlename; |
private JPanel title; |
||||||
private TitleChangeListener titleChangeListener = null; |
private UILabel titlename; |
||||||
|
private TitleChangeListener titleChangeListener = null; |
||||||
private CellAttributeProvider cellAttributeProvider = null; |
|
||||||
|
private CellAttributeProvider cellAttributeProvider = null; |
||||||
|
|
||||||
public CellElementEditPane() { |
|
||||||
setLayout(new BorderLayout()); |
public static void main(String[] args){ |
||||||
initPaneList(); |
JFrame jf = new JFrame("test"); |
||||||
String[] iconArray = new String[paneList.size()]; |
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||||
card = new CardLayout(); |
JPanel content = (JPanel) jf.getContentPane(); |
||||||
center = new JPanel(card); |
content.setLayout(new BorderLayout()); |
||||||
for (int i = 0; i < paneList.size(); i++) { |
content.add(new CellElementEditPane(), BorderLayout.CENTER); |
||||||
AbstractCellAttrPane pane = paneList.get(i); |
GUICoreUtils.centerWindow(jf); |
||||||
iconArray[i] = pane.getIconPath(); |
jf.setSize(290, 400); |
||||||
center.add(pane, pane.title4PopupWindow()); |
jf.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
tabsHeaderIconPane = new UIHeadGroup(iconArray) { |
public CellElementEditPane() { |
||||||
@Override |
setLayout(new BorderLayout()); |
||||||
public void tabChanged(int index) { |
initPaneList(); |
||||||
card.show(center, paneList.get(index).title4PopupWindow()); |
String[] iconArray = new String[paneList.size()]; |
||||||
paneList.get(index).populateBean(cellelement, ePane);// 设置面板变了,也要populate
|
card = new CardLayout(); |
||||||
paneList.get(index).addAttributeChangeListener(listener); |
center = new JPanel(card); |
||||||
if (titleChangeListener != null) { |
for (int i = 0; i < paneList.size(); i++) { |
||||||
titleChangeListener.fireTitleChange(getSelectedTabName()); |
AbstractCellAttrPane pane = paneList.get(i); |
||||||
} |
iconArray[i] = pane.getIconPath(); |
||||||
} |
center.add(pane, pane.title4PopupWindow()); |
||||||
}; |
} |
||||||
tabsHeaderIconPane.setNeedLeftRightOutLine(false); |
|
||||||
|
tabsHeaderIconPane = new UIHeadGroup(iconArray) { |
||||||
downTitle = new JPanel(); |
@Override |
||||||
downTitle.setLayout(new BorderLayout()); |
public void tabChanged(int index) { |
||||||
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); |
card.show(center, paneList.get(index).title4PopupWindow()); |
||||||
downTitle.add(center, BorderLayout.CENTER); |
paneList.get(index).populateBean(cellelement, ePane);// 设置面板变了,也要populate
|
||||||
|
paneList.get(index).addAttributeChangeListener(listener); |
||||||
this.add(downTitle, BorderLayout.CENTER); |
if (titleChangeListener != null) { |
||||||
|
titleChangeListener.fireTitleChange(getSelectedTabName()); |
||||||
} |
} |
||||||
|
} |
||||||
|
}; |
||||||
public void setSelectedIndex(String... id) { |
tabsHeaderIconPane.setNeedLeftRightOutLine(false); |
||||||
String firstid = id[0]; |
|
||||||
for (int i = 0; i < paneList.size(); i++) { |
downTitle = new JPanel(); |
||||||
if (ComparatorUtils.equals(firstid, paneList.get(i).title4PopupWindow())) { |
downTitle.setLayout(new BorderLayout()); |
||||||
tabsHeaderIconPane.setSelectedIndex(i); |
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); |
||||||
if (id.length == 2) { |
center.setBorder(BorderFactory.createEmptyBorder(0, -10, 0, -10)); |
||||||
paneList.get(i).setSelectedByIds(1, id); |
downTitle.add(center, BorderLayout.CENTER); |
||||||
} |
|
||||||
break; |
this.add(downTitle, BorderLayout.CENTER); |
||||||
} |
|
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
public void populate(ElementCasePane elementCasePane) { |
public void setSelectedIndex(String... id) { |
||||||
if (isEditing) { |
String firstid = id[0]; |
||||||
isEditing = false; |
for (int i = 0; i < paneList.size(); i++) { |
||||||
return; |
if (ComparatorUtils.equals(firstid, paneList.get(i).title4PopupWindow())) { |
||||||
} |
tabsHeaderIconPane.setSelectedIndex(i); |
||||||
if (elementCasePane == null) { |
if (id.length == 2) { |
||||||
return; |
paneList.get(i).setSelectedByIds(1, id); |
||||||
} |
} |
||||||
this.ePane = elementCasePane; |
break; |
||||||
Selection selection = ePane.getSelection(); |
} |
||||||
final TemplateElementCase elementCase = ePane.getEditingElementCase(); |
} |
||||||
if (elementCase != null && selection instanceof CellSelection) { |
} |
||||||
CellSelection cs = (CellSelection) selection; |
|
||||||
// isSelectedOneCell()方法放在外面这儿一起算,因为它是比较耗时间的
|
public void populate(ElementCasePane elementCasePane) { |
||||||
// 如果直接只传递elementCasePane,那么每个AbstratCellAttrPane都要算一次,很浪费时间
|
if (isEditing) { |
||||||
|
isEditing = false; |
||||||
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow()); |
return; |
||||||
if (cellElement == null) { |
} |
||||||
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
if (elementCasePane == null) { |
||||||
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
|
return; |
||||||
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) { |
} |
||||||
elementCase.addCellElement((TemplateCellElement) cellElement); |
this.ePane = elementCasePane; |
||||||
} |
Selection selection = ePane.getSelection(); |
||||||
} |
final TemplateElementCase elementCase = ePane.getEditingElementCase(); |
||||||
|
if (elementCase != null && selection instanceof CellSelection) { |
||||||
cellelement = (TemplateCellElement) cellElement; |
CellSelection cs = (CellSelection) selection; |
||||||
// 这儿只对当前选中的面板populate
|
// isSelectedOneCell()方法放在外面这儿一起算,因为它是比较耗时间的
|
||||||
paneList.get(tabsHeaderIconPane.getSelectedIndex()).populateBean(cellelement, ePane); |
// 如果直接只传递elementCasePane,那么每个AbstratCellAttrPane都要算一次,很浪费时间
|
||||||
paneList.get(tabsHeaderIconPane.getSelectedIndex()).addAttributeChangeListener(listener); |
|
||||||
} |
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow()); |
||||||
} |
if (cellElement == null) { |
||||||
|
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||||
AttributeChangeListener listener = new AttributeChangeListener() { |
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
|
||||||
@Override |
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) { |
||||||
public void attributeChange() { |
elementCase.addCellElement((TemplateCellElement) cellElement); |
||||||
boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) || |
} |
||||||
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("FR-Designer_ExpandD_Expand_Direction")); |
|
||||||
if (isChooseExpandPane || isChooseFatherPane) { |
cellelement = (TemplateCellElement) cellElement; |
||||||
ePane.setSupportDefaultParentCalculate(true); |
// 这儿只对当前选中的面板populate
|
||||||
} |
paneList.get(tabsHeaderIconPane.getSelectedIndex()).populateBean(cellelement, ePane); |
||||||
|
paneList.get(tabsHeaderIconPane.getSelectedIndex()).addAttributeChangeListener(listener); |
||||||
if (ePane.getSelection() instanceof CellSelection) { |
} |
||||||
isEditing = true; |
} |
||||||
if (ePane.isSelectedOneCell()) { |
|
||||||
paneList.get(tabsHeaderIconPane.getSelectedIndex()).updateBean(); |
AttributeChangeListener listener = new AttributeChangeListener() { |
||||||
ePane.fireTargetModified(); |
@Override |
||||||
} else { |
public void attributeChange() { |
||||||
paneList.get(tabsHeaderIconPane.getSelectedIndex()).updateBeans(); |
boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) || |
||||||
ePane.fireTargetModified(); |
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("FR-Designer_ExpandD_Expand_Direction")); |
||||||
} else { |
if (isChooseExpandPane || isChooseFatherPane) { |
||||||
DesignUtils.errorMessage(Inter.getLocText(new String[]{"FR-Designer_Not_use_a_cell_attribute_table_editing", "FR-Designer_Float_Element"}) + "!"); |
ePane.setSupportDefaultParentCalculate(true); |
||||||
} |
} |
||||||
ePane.setSupportDefaultParentCalculate(false); |
|
||||||
} |
if (ePane.getSelection() instanceof CellSelection) { |
||||||
}; |
isEditing = true; |
||||||
|
if (ePane.isSelectedOneCell()) { |
||||||
public String getSelectedTabName() { |
paneList.get(tabsHeaderIconPane.getSelectedIndex()).updateBean(); |
||||||
return paneList.get(tabsHeaderIconPane.getSelectedIndex()).title4PopupWindow(); |
ePane.fireTargetModified(); |
||||||
} |
} else { |
||||||
|
paneList.get(tabsHeaderIconPane.getSelectedIndex()).updateBeans(); |
||||||
/** |
ePane.fireTargetModified(); |
||||||
* 添加TitleChangeListener |
} |
||||||
* |
} else { |
||||||
* @param titleChangeListener titleChangeListener 监听 |
DesignUtils.errorMessage(Inter.getLocText(new String[]{"FR-Designer_Not_use_a_cell_attribute_table_editing", "FR-Designer_Float_Element"}) + "!"); |
||||||
*/ |
} |
||||||
public void addTitleChangeListner(TitleChangeListener titleChangeListener) { |
ePane.setSupportDefaultParentCalculate(false); |
||||||
this.titleChangeListener = titleChangeListener; |
} |
||||||
} |
}; |
||||||
|
|
||||||
@Override |
public String getSelectedTabName() { |
||||||
protected String title4PopupWindow() { |
return paneList.get(tabsHeaderIconPane.getSelectedIndex()).title4PopupWindow(); |
||||||
return Inter.getLocText("FR-Designer_CellElement_Property_Table"); |
} |
||||||
} |
|
||||||
|
/** |
||||||
@Override |
* 添加TitleChangeListener |
||||||
public Dimension getPreferredSize() { |
* |
||||||
return new Dimension(240, 340); |
* @param titleChangeListener titleChangeListener 监听 |
||||||
} |
*/ |
||||||
|
public void addTitleChangeListner(TitleChangeListener titleChangeListener) { |
||||||
private void initPaneList() { |
this.titleChangeListener = titleChangeListener; |
||||||
paneList = new ArrayList<AbstractCellAttrPane>(); |
} |
||||||
paneList.add(new CellExpandAttrPane()); |
|
||||||
paneList.add(new CellStylePane()); |
@Override |
||||||
paneList.add(new CellPresentPane()); |
protected String title4PopupWindow() { |
||||||
paneList.add(new CellOtherSetPane()); |
return Inter.getLocText("FR-Designer_CellElement_Property_Table"); |
||||||
|
} |
||||||
cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING); |
|
||||||
if (cellAttributeProvider != null) { |
@Override |
||||||
paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane()); |
public Dimension getPreferredSize() { |
||||||
} |
return new Dimension(240, 340); |
||||||
} |
} |
||||||
|
|
||||||
|
private void initPaneList() { |
||||||
|
paneList = new ArrayList<AbstractCellAttrPane>(); |
||||||
|
paneList.add(new CellExpandAttrPane()); |
||||||
|
paneList.add(new CellStylePane()); |
||||||
|
paneList.add(new CellPresentPane()); |
||||||
|
paneList.add(new CellOtherSetPane()); |
||||||
|
|
||||||
|
cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING); |
||||||
|
if (cellAttributeProvider != null) { |
||||||
|
paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,242 +1,253 @@ |
|||||||
package com.fr.design.mainframe.cell.settingpane; |
package com.fr.design.mainframe.cell.settingpane; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.expand.ExpandLeftFatherPane; |
import com.fr.design.expand.ExpandLeftFatherPane; |
||||||
import com.fr.design.expand.ExpandUpFatherPane; |
import com.fr.design.expand.ExpandUpFatherPane; |
||||||
import com.fr.design.expand.SortExpandAttrPane; |
import com.fr.design.expand.SortExpandAttrPane; |
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
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.design.foldablepane.UIExpandablePane; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
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.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.cell.cellattr.CellExpandAttr; |
import com.fr.report.cell.cellattr.CellExpandAttr; |
||||||
import com.fr.report.elementcase.TemplateElementCase; |
import com.fr.report.elementcase.TemplateElementCase; |
||||||
import com.fr.stable.Constants; |
import com.fr.stable.Constants; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* 单元格扩展属性面板,是属性表面板的一个种类 |
* 单元格扩展属性面板,是属性表面板的一个种类 |
||||||
*/ |
*/ |
||||||
public class CellExpandAttrPane extends AbstractCellAttrPane { |
public class CellExpandAttrPane extends AbstractCellAttrPane { |
||||||
private UIButtonGroup<Byte> expandDirectionButton; |
private static final int SENIOR_HORIZONTAL_GAP = 12; |
||||||
private ExpandLeftFatherPane leftFatherPane; |
private static final int BASIC_HORIZONTAL_GAP = 20; |
||||||
private ExpandUpFatherPane rightFatherPane; |
private UIButtonGroup<Byte> expandDirectionButton; |
||||||
private UICheckBox horizontalExpandableCheckBox; |
private ExpandLeftFatherPane leftFatherPane; |
||||||
private UICheckBox verticalExpandableCheckBox; |
private ExpandUpFatherPane rightFatherPane; |
||||||
private SortExpandAttrPane sortAfterExpand; |
private UICheckBox horizontalExpandableCheckBox; |
||||||
private JPanel layoutPane; |
private UICheckBox verticalExpandableCheckBox; |
||||||
private JPanel basicPane; |
private SortExpandAttrPane sortAfterExpand; |
||||||
private JPanel seniorPane; |
private JPanel layoutPane; |
||||||
|
private JPanel basicPane; |
||||||
/** |
private JPanel seniorPane; |
||||||
* |
|
||||||
* @return |
/** |
||||||
*/ |
* @return |
||||||
public JPanel createContentPane() { |
*/ |
||||||
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")}; |
public JPanel createContentPane() { |
||||||
Icon[] iconArray = { |
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")}; |
||||||
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), |
Icon[] iconArray = { |
||||||
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), |
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), |
||||||
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png") |
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), |
||||||
}; |
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png") |
||||||
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; |
}; |
||||||
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); |
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; |
||||||
expandDirectionButton.setAllToolTips(nameArray); |
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); |
||||||
leftFatherPane = new ExpandLeftFatherPane(); |
expandDirectionButton.setAllToolTips(nameArray); |
||||||
rightFatherPane = new ExpandUpFatherPane(); |
leftFatherPane = new ExpandLeftFatherPane(); |
||||||
horizontalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")); |
rightFatherPane = new ExpandUpFatherPane(); |
||||||
verticalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")); |
horizontalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")); |
||||||
sortAfterExpand = new SortExpandAttrPane(); |
verticalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")); |
||||||
initAllNames(); |
sortAfterExpand = new SortExpandAttrPane(); |
||||||
return layoutPane(); |
initAllNames(); |
||||||
} |
return layoutPane(); |
||||||
|
} |
||||||
|
|
||||||
public static void main(String[] args){ |
|
||||||
// JFrame jf = new JFrame("test");
|
public static void main(String[] args) { |
||||||
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
JFrame jf = new JFrame("test"); |
||||||
// JPanel content = (JPanel) jf.getContentPane();
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||||
// content.setLayout(new BorderLayout());
|
JPanel content = (JPanel) jf.getContentPane(); |
||||||
// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
|
content.setLayout(new BorderLayout()); |
||||||
// GUICoreUtils.centerWindow(jf);
|
content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); |
||||||
// jf.setSize(290, 400);
|
GUICoreUtils.centerWindow(jf); |
||||||
// jf.setVisible(true);
|
jf.setSize(290, 400); |
||||||
} |
jf.setVisible(true); |
||||||
|
} |
||||||
private void initAllNames() { |
|
||||||
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); |
private void initAllNames() { |
||||||
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); |
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); |
||||||
rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell")); |
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); |
||||||
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); |
rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell")); |
||||||
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); |
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); |
||||||
} |
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); |
||||||
|
} |
||||||
private JPanel layoutPane() { |
|
||||||
layoutPane = new JPanel(new BorderLayout()); |
private JPanel layoutPane() { |
||||||
basicPane = new JPanel(); |
layoutPane = new JPanel(new BorderLayout()); |
||||||
seniorPane = new JPanel(); |
basicPane = new JPanel(); |
||||||
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,24,basicPane()); |
seniorPane = new JPanel(); |
||||||
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,24,seniorPane()); |
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 24, basicPane()); |
||||||
layoutPane.add(basicPane,BorderLayout.NORTH); |
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 24, seniorPane()); |
||||||
layoutPane.add(seniorPane,BorderLayout.CENTER); |
layoutPane.add(basicPane, BorderLayout.NORTH); |
||||||
return layoutPane; |
layoutPane.add(seniorPane, BorderLayout.CENTER); |
||||||
} |
return layoutPane; |
||||||
|
} |
||||||
private JPanel basicPane(){ |
|
||||||
double f = TableLayout.FILL; |
private JPanel basicPane() { |
||||||
double p = TableLayout.PREFERRED; |
double f = TableLayout.FILL; |
||||||
Component[][] components = new Component[][]{ |
double p = TableLayout.PREFERRED; |
||||||
new Component[]{null,null}, |
UILabel direction = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"), SwingConstants.LEFT); |
||||||
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, |
// JPanel directionPane = new JPanel(new BorderLayout());
|
||||||
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane}, |
// directionPane.add(direction, BorderLayout.NORTH);
|
||||||
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, |
UILabel left = new UILabel(Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT); |
||||||
}; |
JPanel leftPane = new JPanel(new BorderLayout()); |
||||||
double[] rowSize = {p, p, p, p, p, p}; |
leftPane.add(left, BorderLayout.NORTH); |
||||||
double[] columnSize = {p, f}; |
UILabel up = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT); |
||||||
int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}}; |
JPanel upPane = new JPanel(new BorderLayout()); |
||||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
upPane.add(up, BorderLayout.NORTH); |
||||||
} |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
private JPanel seniorPane() { |
new Component[]{direction, expandDirectionButton}, |
||||||
double f = TableLayout.FILL; |
new Component[]{leftPane, leftFatherPane}, |
||||||
double p = TableLayout.PREFERRED; |
new Component[]{upPane, rightFatherPane}, |
||||||
Component[][] components = new Component[][]{ |
}; |
||||||
new Component[]{null,null}, |
double[] rowSize = {p, p, p, p, p}; |
||||||
new Component[]{horizontalExpandableCheckBox, null}, |
double[] columnSize = {p, f}; |
||||||
new Component[]{verticalExpandableCheckBox, null}, |
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||||
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand}, |
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, BASIC_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE); |
||||||
}; |
} |
||||||
double[] rowSize = {p, p, p, p, p, p, p, p}; |
|
||||||
double[] columnSize = {p, f}; |
private JPanel seniorPane() { |
||||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}}; |
double f = TableLayout.FILL; |
||||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
double p = TableLayout.PREFERRED; |
||||||
} |
UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT); |
||||||
|
JPanel expendSortPane = new JPanel(new BorderLayout()); |
||||||
|
expendSortPane.add(expendSort, BorderLayout.NORTH); |
||||||
|
Component[][] components = new Component[][]{ |
||||||
@Override |
new Component[]{null, null}, |
||||||
protected void populateBean() { |
new Component[]{horizontalExpandableCheckBox, null}, |
||||||
this.leftFatherPane.setElementCasePane(elementCasePane); |
new Component[]{verticalExpandableCheckBox, null}, |
||||||
this.rightFatherPane.setElementCasePane(elementCasePane); |
new Component[]{expendSortPane, sortAfterExpand}, |
||||||
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); |
}; |
||||||
if (cellExpandAttr == null) { |
double[] rowSize = {p, p, p, p, p, p, p, p}; |
||||||
cellExpandAttr = new CellExpandAttr(); |
double[] columnSize = {p, f}; |
||||||
cellElement.setCellExpandAttr(cellExpandAttr); |
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}}; |
||||||
} |
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, SENIOR_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE); |
||||||
expandDirectionButton.setSelectedItem(cellExpandAttr.getDirection()); |
} |
||||||
this.leftFatherPane.populate(cellExpandAttr); |
|
||||||
this.rightFatherPane.populate(cellExpandAttr); |
|
||||||
switch (cellExpandAttr.getExtendable()) { |
@Override |
||||||
case CellExpandAttr.Both_EXTENDABLE: |
protected void populateBean() { |
||||||
horizontalExpandableCheckBox.setSelected(true); |
this.leftFatherPane.setElementCasePane(elementCasePane); |
||||||
verticalExpandableCheckBox.setSelected(true); |
this.rightFatherPane.setElementCasePane(elementCasePane); |
||||||
break; |
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); |
||||||
case CellExpandAttr.Vertical_EXTENDABLE: |
if (cellExpandAttr == null) { |
||||||
horizontalExpandableCheckBox.setSelected(false); |
cellExpandAttr = new CellExpandAttr(); |
||||||
verticalExpandableCheckBox.setSelected(true); |
cellElement.setCellExpandAttr(cellExpandAttr); |
||||||
break; |
} |
||||||
case CellExpandAttr.Horizontal_EXTENDABLE: |
expandDirectionButton.setSelectedItem(cellExpandAttr.getDirection()); |
||||||
horizontalExpandableCheckBox.setSelected(true); |
this.leftFatherPane.populate(cellExpandAttr); |
||||||
verticalExpandableCheckBox.setSelected(false); |
this.rightFatherPane.populate(cellExpandAttr); |
||||||
break; |
switch (cellExpandAttr.getExtendable()) { |
||||||
default: { |
case CellExpandAttr.Both_EXTENDABLE: |
||||||
horizontalExpandableCheckBox.setSelected(false); |
horizontalExpandableCheckBox.setSelected(true); |
||||||
verticalExpandableCheckBox.setSelected(false); |
verticalExpandableCheckBox.setSelected(true); |
||||||
} |
break; |
||||||
} |
case CellExpandAttr.Vertical_EXTENDABLE: |
||||||
|
horizontalExpandableCheckBox.setSelected(false); |
||||||
sortAfterExpand.populate(cellExpandAttr); |
verticalExpandableCheckBox.setSelected(true); |
||||||
} |
break; |
||||||
|
case CellExpandAttr.Horizontal_EXTENDABLE: |
||||||
|
horizontalExpandableCheckBox.setSelected(true); |
||||||
@Override |
verticalExpandableCheckBox.setSelected(false); |
||||||
public String getIconPath() { |
break; |
||||||
// return "com/fr/design/images/expand/cellAttr.gif";
|
default: { |
||||||
return Inter.getLocText("FR-Designer_Expand"); |
horizontalExpandableCheckBox.setSelected(false); |
||||||
} |
verticalExpandableCheckBox.setSelected(false); |
||||||
|
} |
||||||
|
} |
||||||
@Override |
|
||||||
public void updateBean(TemplateCellElement cellElement) { |
sortAfterExpand.populate(cellExpandAttr); |
||||||
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); |
} |
||||||
if (cellExpandAttr == null) { |
|
||||||
cellExpandAttr = new CellExpandAttr(); |
|
||||||
cellElement.setCellExpandAttr(cellExpandAttr); |
@Override |
||||||
} |
public String getIconPath() { |
||||||
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) { |
// return "com/fr/design/images/expand/cellAttr.gif";
|
||||||
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem()); |
return Inter.getLocText("FR-Designer_Expand"); |
||||||
} |
} |
||||||
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) { |
|
||||||
this.leftFatherPane.update(cellExpandAttr); |
|
||||||
} |
@Override |
||||||
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) { |
public void updateBean(TemplateCellElement cellElement) { |
||||||
this.rightFatherPane.update(cellExpandAttr); |
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); |
||||||
} |
if (cellExpandAttr == null) { |
||||||
|
cellExpandAttr = new CellExpandAttr(); |
||||||
|
cellElement.setCellExpandAttr(cellExpandAttr); |
||||||
// extendable
|
} |
||||||
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) { |
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) { |
||||||
if (horizontalExpandableCheckBox.isSelected()) { |
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem()); |
||||||
if (verticalExpandableCheckBox.isSelected()) { |
} |
||||||
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); |
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) { |
||||||
} else { |
this.leftFatherPane.update(cellExpandAttr); |
||||||
cellExpandAttr.setExtendable(CellExpandAttr.Horizontal_EXTENDABLE); |
} |
||||||
} |
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) { |
||||||
} else { |
this.rightFatherPane.update(cellExpandAttr); |
||||||
if (verticalExpandableCheckBox.isSelected()) { |
} |
||||||
cellExpandAttr.setExtendable(CellExpandAttr.Vertical_EXTENDABLE); |
|
||||||
} else { |
|
||||||
cellExpandAttr.setExtendable(CellExpandAttr.None_EXTENDABLE); |
// extendable
|
||||||
} |
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) { |
||||||
} |
if (horizontalExpandableCheckBox.isSelected()) { |
||||||
} |
if (verticalExpandableCheckBox.isSelected()) { |
||||||
|
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); |
||||||
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Sort_After_Expand"))) { |
} else { |
||||||
sortAfterExpand.update(cellExpandAttr); |
cellExpandAttr.setExtendable(CellExpandAttr.Horizontal_EXTENDABLE); |
||||||
} |
} |
||||||
|
} else { |
||||||
} |
if (verticalExpandableCheckBox.isSelected()) { |
||||||
|
cellExpandAttr.setExtendable(CellExpandAttr.Vertical_EXTENDABLE); |
||||||
/** |
} else { |
||||||
* |
cellExpandAttr.setExtendable(CellExpandAttr.None_EXTENDABLE); |
||||||
*/ |
} |
||||||
public void updateBeans() { |
} |
||||||
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
} |
||||||
int cellRectangleCount = cs.getCellRectangleCount(); |
|
||||||
for (int rect = 0; rect < cellRectangleCount; rect++) { |
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Sort_After_Expand"))) { |
||||||
Rectangle cellRectangle = cs.getCellRectangle(rect); |
sortAfterExpand.update(cellExpandAttr); |
||||||
// 需要先行后列地增加新元素。
|
} |
||||||
for (int j = 0; j < cellRectangle.height; j++) { |
|
||||||
for (int i = 0; i < cellRectangle.width; i++) { |
} |
||||||
int column = i + cellRectangle.x; |
|
||||||
int row = j + cellRectangle.y; |
/** |
||||||
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
* |
||||||
if (cellElement == null) { |
*/ |
||||||
cellElement = new DefaultTemplateCellElement(column, row); |
public void updateBeans() { |
||||||
elementCase.addCellElement(cellElement); |
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
||||||
} |
int cellRectangleCount = cs.getCellRectangleCount(); |
||||||
updateBean(cellElement); |
for (int rect = 0; rect < cellRectangleCount; rect++) { |
||||||
} |
Rectangle cellRectangle = cs.getCellRectangle(rect); |
||||||
} |
// 需要先行后列地增加新元素。
|
||||||
} |
for (int j = 0; j < cellRectangle.height; j++) { |
||||||
} |
for (int i = 0; i < cellRectangle.width; i++) { |
||||||
|
int column = i + cellRectangle.x; |
||||||
/** |
int row = j + cellRectangle.y; |
||||||
* |
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
||||||
* @return |
if (cellElement == null) { |
||||||
*/ |
cellElement = new DefaultTemplateCellElement(column, row); |
||||||
public String title4PopupWindow() { |
elementCase.addCellElement(cellElement); |
||||||
return Inter.getLocText("ExpandD-Expand_Attribute"); |
} |
||||||
} |
updateBean(cellElement); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("ExpandD-Expand_Attribute"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
} |
} |
@ -1,130 +1,130 @@ |
|||||||
package com.fr.design.mainframe.cell.settingpane; |
package com.fr.design.mainframe.cell.settingpane; |
||||||
|
|
||||||
import java.awt.*; |
import com.fr.base.Style; |
||||||
|
import com.fr.design.mainframe.cell.settingpane.style.StylePane; |
||||||
import javax.swing.*; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import javax.swing.event.ChangeEvent; |
import com.fr.general.Inter; |
||||||
import javax.swing.event.ChangeListener; |
import com.fr.report.cell.DefaultTemplateCellElement; |
||||||
|
import com.fr.report.cell.TemplateCellElement; |
||||||
import com.fr.base.Style; |
import com.fr.report.elementcase.TemplateElementCase; |
||||||
import com.fr.design.mainframe.cell.settingpane.style.StylePane; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import javax.swing.*; |
||||||
import com.fr.general.Inter; |
import javax.swing.event.ChangeEvent; |
||||||
import com.fr.report.cell.DefaultTemplateCellElement; |
import javax.swing.event.ChangeListener; |
||||||
import com.fr.report.cell.TemplateCellElement; |
import java.awt.*; |
||||||
import com.fr.report.elementcase.TemplateElementCase; |
|
||||||
|
/** |
||||||
/** |
* @author zhou |
||||||
* @author zhou |
* @since 2012-5-11下午3:59:39 |
||||||
* @since 2012-5-11下午3:59:39 |
*/ |
||||||
*/ |
public class CellStylePane extends AbstractCellAttrPane { |
||||||
public class CellStylePane extends AbstractCellAttrPane { |
private StylePane stylePane; |
||||||
private StylePane stylePane; |
|
||||||
|
@Override |
||||||
@Override |
public JPanel createContentPane() { |
||||||
public JPanel createContentPane() { |
JPanel content = new JPanel(new BorderLayout()); |
||||||
JPanel content = new JPanel(new BorderLayout()); |
stylePane = new StylePane(); |
||||||
stylePane = new StylePane(); |
content.add(stylePane, BorderLayout.CENTER); |
||||||
content.add(stylePane, BorderLayout.CENTER); |
stylePane.addPredefinedChangeListener(new ChangeListener() { |
||||||
stylePane.addPredefinedChangeListener(new ChangeListener() { |
public void stateChanged(ChangeEvent e) { |
||||||
public void stateChanged(ChangeEvent e) { |
attributeChanged(); |
||||||
attributeChanged(); |
} |
||||||
} |
}); |
||||||
}); |
stylePane.addCustomTabChangeListener(new ChangeListener() { |
||||||
stylePane.addCustomTabChangeListener(new ChangeListener() { |
|
||||||
|
@Override |
||||||
@Override |
public void stateChanged(ChangeEvent e) { |
||||||
public void stateChanged(ChangeEvent e) { |
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
|
||||||
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
|
} |
||||||
} |
}); |
||||||
}); |
// content.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
|
||||||
return content; |
return content; |
||||||
} |
} |
||||||
|
|
||||||
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 CellStylePane().createContentPane(), BorderLayout.CENTER);
|
content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); |
||||||
// GUICoreUtils.centerWindow(jf);
|
GUICoreUtils.centerWindow(jf); |
||||||
// jf.setSize(290, 400);
|
jf.setSize(290, 400); |
||||||
// jf.setVisible(true);
|
jf.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String getIconPath() { |
public String getIconPath() { |
||||||
// return "com/fr/design/images/m_format/cell.png";
|
// return "com/fr/design/images/m_format/cell.png";
|
||||||
return Inter.getLocText("FR-Designer_Style"); |
return Inter.getLocText("FR-Designer_Style"); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
@Override |
@Override |
||||||
public void updateBean(TemplateCellElement cellElement) { |
public void updateBean(TemplateCellElement cellElement) { |
||||||
cellElement.setStyle(stylePane.updateBean()); |
cellElement.setStyle(stylePane.updateBean()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void updateBeans() { |
public void updateBeans() { |
||||||
if (stylePane.getSelectedIndex() == 1) { |
if (stylePane.getSelectedIndex() == 1) { |
||||||
Style s = stylePane.updateBean(); |
Style s = stylePane.updateBean(); |
||||||
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
||||||
int cellRectangleCount = cs.getCellRectangleCount(); |
int cellRectangleCount = cs.getCellRectangleCount(); |
||||||
for (int rect = 0; rect < cellRectangleCount; rect++) { |
for (int rect = 0; rect < cellRectangleCount; rect++) { |
||||||
Rectangle cellRectangle = cs.getCellRectangle(rect); |
Rectangle cellRectangle = cs.getCellRectangle(rect); |
||||||
for (int j = 0; j < cellRectangle.height; j++) { |
for (int j = 0; j < cellRectangle.height; j++) { |
||||||
for (int i = 0; i < cellRectangle.width; i++) { |
for (int i = 0; i < cellRectangle.width; i++) { |
||||||
int column = i + cellRectangle.x; |
int column = i + cellRectangle.x; |
||||||
int row = j + cellRectangle.y; |
int row = j + cellRectangle.y; |
||||||
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
||||||
if (cellElement == null) { |
if (cellElement == null) { |
||||||
cellElement = new DefaultTemplateCellElement(column, row); |
cellElement = new DefaultTemplateCellElement(column, row); |
||||||
elementCase.addCellElement(cellElement); |
elementCase.addCellElement(cellElement); |
||||||
} |
} |
||||||
cellElement.setStyle(s); |
cellElement.setStyle(s); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} else { |
} else { |
||||||
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); |
||||||
int cellRectangleCount = cs.getCellRectangleCount(); |
int cellRectangleCount = cs.getCellRectangleCount(); |
||||||
for (int rect = 0; rect < cellRectangleCount; rect++) { |
for (int rect = 0; rect < cellRectangleCount; rect++) { |
||||||
Rectangle cellRectangle = cs.getCellRectangle(rect); |
Rectangle cellRectangle = cs.getCellRectangle(rect); |
||||||
for (int j = 0; j < cellRectangle.height; j++) { |
for (int j = 0; j < cellRectangle.height; j++) { |
||||||
for (int i = 0; i < cellRectangle.width; i++) { |
for (int i = 0; i < cellRectangle.width; i++) { |
||||||
int column = i + cellRectangle.x; |
int column = i + cellRectangle.x; |
||||||
int row = j + cellRectangle.y; |
int row = j + cellRectangle.y; |
||||||
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
||||||
if (cellElement == null) { |
if (cellElement == null) { |
||||||
cellElement = new DefaultTemplateCellElement(column, row); |
cellElement = new DefaultTemplateCellElement(column, row); |
||||||
elementCase.addCellElement(cellElement); |
elementCase.addCellElement(cellElement); |
||||||
} |
} |
||||||
Style style = cellElement.getStyle(); |
Style style = cellElement.getStyle(); |
||||||
if (style == null) { |
if (style == null) { |
||||||
style = style.DEFAULT_STYLE; |
style = style.DEFAULT_STYLE; |
||||||
} |
} |
||||||
style = stylePane.updateStyle(style); |
style = stylePane.updateStyle(style); |
||||||
cellElement.setStyle(style); |
cellElement.setStyle(style); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
stylePane.updateBorder();// border必须特别处理
|
stylePane.updateBorder();// border必须特别处理
|
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void populateBean() { |
protected void populateBean() { |
||||||
stylePane.populateBean(cellElement.getStyle()); |
stylePane.populateBean(cellElement.getStyle()); |
||||||
stylePane.dealWithBorder(elementCasePane); |
stylePane.dealWithBorder(elementCasePane); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return Inter.getLocText(Inter.getLocText("FR-Designer_Style")); |
return Inter.getLocText(Inter.getLocText("FR-Designer_Style")); |
||||||
} |
} |
||||||
|
|
||||||
public void setSelectedByIds(int level, String... id) { |
public void setSelectedByIds(int level, String... id) { |
||||||
stylePane.setSelctedByName(id[level]); |
stylePane.setSelctedByName(id[level]); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,170 +1,170 @@ |
|||||||
package com.fr.design.mainframe.cell.settingpane.style; |
package com.fr.design.mainframe.cell.settingpane.style; |
||||||
|
|
||||||
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.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.dialog.MultiTabPane; |
import com.fr.design.dialog.MultiTabPane; |
||||||
import com.fr.design.gui.ibutton.FiveButtonLayout; |
import com.fr.design.gui.ibutton.FiveButtonLayout; |
||||||
import com.fr.design.gui.style.*; |
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.style.BorderUtils; |
||||||
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 javax.swing.*; |
import javax.swing.*; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.List; |
import java.util.List; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 哎,复杂的原型图导致复杂的画法。非我所愿也 |
* 哎,复杂的原型图导致复杂的画法。非我所愿也 |
||||||
* |
* |
||||||
* @author zhou |
* @author zhou |
||||||
* @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 static final int TWO_INDEX = 2; |
private static final int TWO_INDEX = 2; |
||||||
private static final int ONE_INDEX = 1; |
private static final int ONE_INDEX = 1; |
||||||
private String[] NameArray; |
private String[] NameArray; |
||||||
private ElementCasePane reportPane; |
private ElementCasePane reportPane; |
||||||
private BackgroundPane backgroundPane = null; |
private BackgroundPane backgroundPane = null; |
||||||
|
|
||||||
|
|
||||||
public CustomStylePane() { |
public CustomStylePane() { |
||||||
super(); |
super(); |
||||||
tabPane.setOneLineTab(true); |
tabPane.setOneLineTab(true); |
||||||
tabPane.setLayout(new FiveButtonLayout(1)); |
tabPane.setLayout(new FiveButtonLayout(1)); |
||||||
} |
} |
||||||
|
|
||||||
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 CustomStylePane(), BorderLayout.CENTER); |
content.add(new CustomStylePane(), BorderLayout.CENTER); |
||||||
GUICoreUtils.centerWindow(jf); |
GUICoreUtils.centerWindow(jf); |
||||||
jf.setSize(290, 400); |
jf.setSize(250, 400); |
||||||
jf.setVisible(true); |
jf.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @return |
* @return |
||||||
*/ |
*/ |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return Inter.getLocText(new String[]{"Custom", "Style"}); |
return Inter.getLocText(new String[]{"Custom", "Style"}); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* for ScrollBar |
* for ScrollBar |
||||||
* |
* |
||||||
* @param l |
* @param l |
||||||
*/ |
*/ |
||||||
public void addTabChangeListener(ChangeListener l) { |
public void addTabChangeListener(ChangeListener l) { |
||||||
if (tabPane != null) { |
if (tabPane != null) { |
||||||
tabPane.addChangeListener(l); |
tabPane.addChangeListener(l); |
||||||
} |
} |
||||||
if (backgroundPane != null) { |
if (backgroundPane != null) { |
||||||
backgroundPane.addChangeListener(l); |
backgroundPane.addChangeListener(l); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void reset() { |
public void reset() { |
||||||
populateBean(null); |
populateBean(null); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void populateBean(Style ob) { |
public void populateBean(Style ob) { |
||||||
for (int i = 0; i < paneList.size(); i++) { |
for (int i = 0; i < paneList.size(); i++) { |
||||||
((AbstractBasicStylePane) paneList.get(i)).populateBean(ob); |
((AbstractBasicStylePane) paneList.get(i)).populateBean(ob); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public Style updateBean() { |
public Style updateBean() { |
||||||
return updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
return updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @param style |
* @param style |
||||||
* @return |
* @return |
||||||
*/ |
*/ |
||||||
public Style updateStyle(Style style) { |
public Style updateStyle(Style style) { |
||||||
return ((AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex())).update(style);//只更新当前选中面板的样式
|
return ((AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex())).update(style);//只更新当前选中面板的样式
|
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
public boolean isBorderPaneSelected() { |
public boolean isBorderPaneSelected() { |
||||||
return tabPane.getSelectedIndex() == TWO_INDEX; |
return tabPane.getSelectedIndex() == TWO_INDEX; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @param ePane |
* @param ePane |
||||||
*/ |
*/ |
||||||
public void dealWithBorder(ElementCasePane ePane) { |
public void dealWithBorder(ElementCasePane ePane) { |
||||||
this.reportPane = ePane; |
this.reportPane = ePane; |
||||||
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); |
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); |
||||||
|
|
||||||
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { |
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { |
||||||
if (fourObjectArray.length == LENGTH_FOUR) { |
if (fourObjectArray.length == LENGTH_FOUR) { |
||||||
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(), |
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(), |
||||||
(Color) fourObjectArray[THREE_INDEX]); |
(Color) fourObjectArray[THREE_INDEX]); |
||||||
} else { |
} else { |
||||||
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE, |
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE, |
||||||
(Color) fourObjectArray[THREE_INDEX]); |
(Color) fourObjectArray[THREE_INDEX]); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void updateBorder() { |
public void updateBorder() { |
||||||
BorderUtils.update(reportPane, ((BorderPane) paneList.get(TWO_INDEX)).update()); |
BorderUtils.update(reportPane, ((BorderPane) paneList.get(TWO_INDEX)).update()); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @param ob |
* @param ob |
||||||
* @return |
* @return |
||||||
*/ |
*/ |
||||||
public boolean accept(Object ob) { |
public boolean accept(Object ob) { |
||||||
return ob instanceof Style && !(ob instanceof NameStyle); |
return ob instanceof Style && !(ob instanceof NameStyle); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected List<BasicPane> initPaneList() { |
protected List<BasicPane> initPaneList() { |
||||||
paneList = new ArrayList<BasicPane>(); |
paneList = new ArrayList<BasicPane>(); |
||||||
paneList.add(new FormatPane()); |
paneList.add(new FormatPane()); |
||||||
paneList.add(new BorderPane()); |
paneList.add(new BorderPane()); |
||||||
paneList.add(new AlignmentPane()); |
paneList.add(new AlignmentPane()); |
||||||
// paneList.add(new FRFontPane());
|
// paneList.add(new FRFontPane());
|
||||||
// paneList.add(backgroundPane = new BackgroundPane());
|
// paneList.add(backgroundPane = new BackgroundPane());
|
||||||
return paneList; |
return paneList; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void updateBean(Style ob) { |
public void updateBean(Style ob) { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
} |
} |
@ -1,155 +1,157 @@ |
|||||||
package com.fr.design.mainframe.cell.settingpane.style; |
package com.fr.design.mainframe.cell.settingpane.style; |
||||||
|
|
||||||
import com.fr.base.ConfigManager; |
import com.fr.base.ConfigManager; |
||||||
import com.fr.base.NameStyle; |
import com.fr.base.NameStyle; |
||||||
import com.fr.base.ScreenResolution; |
import com.fr.base.ScreenResolution; |
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.mainframe.DesignerBean; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.mainframe.DesignerBean; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
import javax.swing.*; |
|
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.*; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeEvent; |
||||||
import java.awt.*; |
import javax.swing.event.ChangeListener; |
||||||
import java.awt.event.MouseAdapter; |
import java.awt.*; |
||||||
import java.awt.event.MouseEvent; |
import java.awt.event.MouseAdapter; |
||||||
import java.util.Iterator; |
import java.awt.event.MouseEvent; |
||||||
|
import java.util.Iterator; |
||||||
public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> implements DesignerBean { |
|
||||||
|
public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> implements DesignerBean { |
||||||
private DefaultListModel defaultListModel; |
|
||||||
private JList styleList; |
private DefaultListModel defaultListModel; |
||||||
private ChangeListener changeListener; |
private JList styleList; |
||||||
|
private ChangeListener changeListener; |
||||||
public PredefinedStylePane() { |
|
||||||
defaultListModel = new DefaultListModel(); |
public PredefinedStylePane() { |
||||||
styleList = new JList(defaultListModel); |
defaultListModel = new DefaultListModel(); |
||||||
DefaultListCellRenderer render = new DefaultListCellRenderer() { |
styleList = new JList(defaultListModel); |
||||||
private Style nameStyle; |
DefaultListCellRenderer render = new DefaultListCellRenderer() { |
||||||
|
private Style nameStyle; |
||||||
@Override |
|
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
@Override |
||||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
if (value instanceof Style) { |
|
||||||
this.nameStyle = (Style) value; |
if (value instanceof Style) { |
||||||
this.setText(" "); |
this.nameStyle = (Style) value; |
||||||
} |
this.setText(" "); |
||||||
this.setPreferredSize(new Dimension(210, 22)); |
} |
||||||
return this; |
this.setPreferredSize(new Dimension(210, 22)); |
||||||
} |
return this; |
||||||
|
} |
||||||
@Override |
|
||||||
public void paintComponent(Graphics g) { |
@Override |
||||||
super.paintComponent(g); |
public void paintComponent(Graphics g) { |
||||||
|
super.paintComponent(g); |
||||||
if (nameStyle == null) { |
|
||||||
return; |
if (nameStyle == null) { |
||||||
} |
return; |
||||||
String text = "abcedfgh"; |
} |
||||||
if (nameStyle instanceof NameStyle) { |
String text = "abcedfgh"; |
||||||
text = ((NameStyle) nameStyle).getName(); |
if (nameStyle instanceof NameStyle) { |
||||||
} |
text = ((NameStyle) nameStyle).getName(); |
||||||
Style.paintBackground((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
} |
||||||
Style.paintContent((Graphics2D) g, text, nameStyle, getWidth() - 1, getHeight() - 1, ScreenResolution.getScreenResolution()); |
Style.paintBackground((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
||||||
Style.paintBorder((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
Style.paintContent((Graphics2D) g, text, nameStyle, getWidth() - 1, getHeight() - 1, ScreenResolution.getScreenResolution()); |
||||||
} |
Style.paintBorder((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
||||||
|
} |
||||||
}; |
|
||||||
styleList.setCellRenderer(render); |
}; |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
styleList.setCellRenderer(render); |
||||||
this.add(styleList, BorderLayout.CENTER); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
this.add(styleList, BorderLayout.CENTER); |
||||||
styleList.addMouseListener(new MouseAdapter() { |
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
@Override |
|
||||||
public void mouseClicked(MouseEvent e) { |
styleList.addMouseListener(new MouseAdapter() { |
||||||
int clickedNumber = e.getClickCount(); |
@Override |
||||||
if (clickedNumber == 1) { |
public void mouseClicked(MouseEvent e) { |
||||||
if (changeListener != null) { |
int clickedNumber = e.getClickCount(); |
||||||
changeListener.stateChanged(new ChangeEvent(styleList)); |
if (clickedNumber == 1) { |
||||||
} |
if (changeListener != null) { |
||||||
} |
changeListener.stateChanged(new ChangeEvent(styleList)); |
||||||
// 如果点击次数大于2认为发生双击,弹出编辑界面
|
} |
||||||
// if (clickedNumber >= 2) {
|
} |
||||||
// }
|
// 如果点击次数大于2认为发生双击,弹出编辑界面
|
||||||
} |
// if (clickedNumber >= 2) {
|
||||||
}); |
// }
|
||||||
|
} |
||||||
DesignerContext.setDesignerBean("predefinedStyle", this); |
}); |
||||||
} |
|
||||||
|
DesignerContext.setDesignerBean("predefinedStyle", this); |
||||||
/** |
} |
||||||
* 添加改变监听 |
|
||||||
* |
/** |
||||||
* @param changeListener 监听事件 |
* 添加改变监听 |
||||||
*/ |
* |
||||||
public void addChangeListener(ChangeListener changeListener) { |
* @param changeListener 监听事件 |
||||||
this.changeListener = changeListener; |
*/ |
||||||
} |
public void addChangeListener(ChangeListener changeListener) { |
||||||
|
this.changeListener = changeListener; |
||||||
/** |
} |
||||||
* 重置 |
|
||||||
*/ |
/** |
||||||
public void reset() { |
* 重置 |
||||||
|
*/ |
||||||
} |
public void reset() { |
||||||
|
|
||||||
@Override |
} |
||||||
public void populateBean(NameStyle ob) { |
|
||||||
refreshBeanElement(); |
@Override |
||||||
for (int i = 0; i < defaultListModel.getSize(); i++) { |
public void populateBean(NameStyle ob) { |
||||||
if (ComparatorUtils.equals(ob, defaultListModel.get(i))) { |
refreshBeanElement(); |
||||||
styleList.setSelectedIndex(i); |
for (int i = 0; i < defaultListModel.getSize(); i++) { |
||||||
break; |
if (ComparatorUtils.equals(ob, defaultListModel.get(i))) { |
||||||
} |
styleList.setSelectedIndex(i); |
||||||
} |
break; |
||||||
} |
} |
||||||
|
} |
||||||
@Override |
} |
||||||
public NameStyle updateBean() { |
|
||||||
return (NameStyle) styleList.getSelectedValue(); |
@Override |
||||||
} |
public NameStyle updateBean() { |
||||||
|
return (NameStyle) styleList.getSelectedValue(); |
||||||
/** |
} |
||||||
* 获取面板标题 |
|
||||||
* |
/** |
||||||
* @return 标题 |
* 获取面板标题 |
||||||
*/ |
* |
||||||
public String title4PopupWindow() { |
* @return 标题 |
||||||
return Inter.getLocText(new String[]{"PageSetup-Predefined", "Style"}); |
*/ |
||||||
} |
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText(new String[]{"PageSetup-Predefined", "Style"}); |
||||||
/** |
} |
||||||
* 是否可以接纳对象 |
|
||||||
* |
/** |
||||||
* @param ob 组件对象 |
* 是否可以接纳对象 |
||||||
* @return 是否可以接纳对象 |
* |
||||||
*/ |
* @param ob 组件对象 |
||||||
public boolean accept(Object ob) { |
* @return 是否可以接纳对象 |
||||||
return ob instanceof NameStyle; |
*/ |
||||||
} |
public boolean accept(Object ob) { |
||||||
|
return ob instanceof NameStyle; |
||||||
/** |
} |
||||||
* 刷新组件对象 |
|
||||||
*/ |
/** |
||||||
public void refreshBeanElement() { |
* 刷新组件对象 |
||||||
defaultListModel.removeAllElements(); |
*/ |
||||||
if (ConfigManager.getProviderInstance().hasStyle()) { |
public void refreshBeanElement() { |
||||||
Iterator iterato = ConfigManager.getProviderInstance().getStyleNameIterator(); |
defaultListModel.removeAllElements(); |
||||||
while (iterato.hasNext()) { |
if (ConfigManager.getProviderInstance().hasStyle()) { |
||||||
String name = (String) iterato.next(); |
Iterator iterato = ConfigManager.getProviderInstance().getStyleNameIterator(); |
||||||
NameStyle nameStyle = NameStyle.getInstance(name); |
while (iterato.hasNext()) { |
||||||
defaultListModel.addElement(nameStyle); |
String name = (String) iterato.next(); |
||||||
} |
NameStyle nameStyle = NameStyle.getInstance(name); |
||||||
} |
defaultListModel.addElement(nameStyle); |
||||||
styleList.setModel(defaultListModel); |
} |
||||||
GUICoreUtils.repaint(this); |
} |
||||||
|
styleList.setModel(defaultListModel); |
||||||
} |
GUICoreUtils.repaint(this); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,109 +1,115 @@ |
|||||||
package com.fr.design.present; |
package com.fr.design.present; |
||||||
|
|
||||||
import com.fr.base.present.DictPresent; |
import com.fr.base.present.DictPresent; |
||||||
import com.fr.base.present.FormulaPresent; |
import com.fr.base.present.FormulaPresent; |
||||||
import com.fr.base.present.Present; |
import com.fr.base.present.Present; |
||||||
import com.fr.design.ExtraDesignClassManager; |
import com.fr.design.ExtraDesignClassManager; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.fun.PresentKindProvider; |
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.gui.frpane.UIComboBoxPane; |
import com.fr.design.fun.PresentKindProvider; |
||||||
import com.fr.design.gui.icombobox.DictionaryComboBox; |
import com.fr.design.gui.frpane.UIComboBoxPane; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
import com.fr.general.Inter; |
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.report.cell.cellattr.BarcodePresent; |
import com.fr.general.Inter; |
||||||
import com.fr.report.cell.cellattr.CurrencyLinePresent; |
import com.fr.report.cell.cellattr.BarcodePresent; |
||||||
|
import com.fr.report.cell.cellattr.CurrencyLinePresent; |
||||||
import java.awt.event.ItemListener; |
|
||||||
import java.util.ArrayList; |
import java.awt.event.ItemListener; |
||||||
import java.util.List; |
import java.util.ArrayList; |
||||||
import java.util.Set; |
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
/** |
|
||||||
* @author zhou |
/** |
||||||
* @since 2012-5-31上午11:22:28 |
* @author zhou |
||||||
*/ |
* @since 2012-5-31上午11:22:28 |
||||||
public class PresentPane extends UIComboBoxPane<Present> { |
*/ |
||||||
private DictPresentPane dictPresentPane; |
public class PresentPane extends UIComboBoxPane<Present> { |
||||||
private List<String> keys; |
private DictPresentPane dictPresentPane; |
||||||
private List<String> displays; |
private List<String> keys; |
||||||
|
private List<String> displays; |
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
@Override |
||||||
return Inter.getLocText("FR-Designer_Present"); |
protected String title4PopupWindow() { |
||||||
} |
return Inter.getLocText("FR-Designer_Present"); |
||||||
|
} |
||||||
public void setSelectedByName(String radioName) { |
|
||||||
jcb.setSelectedItem(radioName); |
public void setSelectedByName(String radioName) { |
||||||
} |
jcb.setSelectedItem(radioName); |
||||||
|
} |
||||||
/** |
|
||||||
* 增加tab改变监听事件 |
/** |
||||||
* @param l 监听事件 |
* 增加tab改变监听事件 |
||||||
*/ |
* @param l 监听事件 |
||||||
public void addTabChangeListener(ItemListener l) { |
*/ |
||||||
super.addTabChangeListener(l); |
public void addTabChangeListener(ItemListener l) { |
||||||
dictPresentPane.addTabChangeListener(l); |
super.addTabChangeListener(l); |
||||||
} |
dictPresentPane.addTabChangeListener(l); |
||||||
|
} |
||||||
@Override |
|
||||||
public void populateBean(Present ob) { |
@Override |
||||||
if(ob == null) { |
public void populateBean(Present ob) { |
||||||
dictPresentPane.reset(); |
if(ob == null) { |
||||||
} |
dictPresentPane.reset(); |
||||||
super.populateBean(ob); |
} |
||||||
} |
super.populateBean(ob); |
||||||
|
} |
||||||
@Override |
|
||||||
protected List<FurtherBasicBeanPane<? extends Present>> initPaneList() { |
@Override |
||||||
if (keys == null) { |
protected List<FurtherBasicBeanPane<? extends Present>> initPaneList() { |
||||||
keys = new ArrayList<>(); |
if (keys == null) { |
||||||
} |
keys = new ArrayList<>(); |
||||||
if (displays == null) { |
} |
||||||
displays = new ArrayList<>(); |
if (displays == null) { |
||||||
} |
displays = new ArrayList<>(); |
||||||
List<FurtherBasicBeanPane<? extends Present>> paneList = new ArrayList<>(); |
} |
||||||
FurtherBasicBeanPane<Present> none = new NonePresentPane(); |
List<FurtherBasicBeanPane<? extends Present>> paneList = new ArrayList<>(); |
||||||
paneList.add(none); |
FurtherBasicBeanPane<Present> none = new NonePresentPane(); |
||||||
keys.add("NOPRESENT"); |
paneList.add(none); |
||||||
displays.add(none.title4PopupWindow()); |
keys.add("NOPRESENT"); |
||||||
|
displays.add(none.title4PopupWindow()); |
||||||
paneList.add(dictPresentPane = new DictPresentPane()); |
|
||||||
keys.add(DictPresent.class.getName()); |
dictPresentPane = new DictPresentPane(); |
||||||
displays.add(dictPresentPane.title4PopupWindow()); |
dictPresentPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
|
paneList.add(dictPresentPane); |
||||||
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane(); |
keys.add(DictPresent.class.getName()); |
||||||
paneList.add(bar); |
displays.add(dictPresentPane.title4PopupWindow()); |
||||||
keys.add(BarcodePresent.class.getName()); |
|
||||||
displays.add(bar.title4PopupWindow()); |
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane(); |
||||||
|
bar.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane(); |
paneList.add(bar); |
||||||
paneList.add(formula); |
keys.add(BarcodePresent.class.getName()); |
||||||
keys.add(FormulaPresent.class.getName()); |
displays.add(bar.title4PopupWindow()); |
||||||
displays.add(formula.title4PopupWindow()); |
|
||||||
|
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane(); |
||||||
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane(); |
formula.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
paneList.add(currency); |
paneList.add(formula); |
||||||
keys.add(CurrencyLinePresent.class.getName()); |
keys.add(FormulaPresent.class.getName()); |
||||||
displays.add(currency.title4PopupWindow()); |
displays.add(formula.title4PopupWindow()); |
||||||
|
|
||||||
Set<PresentKindProvider> providers = ExtraDesignClassManager.getInstance().getArray(PresentKindProvider.MARK_STRING); |
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane(); |
||||||
for (PresentKindProvider provider : providers) { |
currency.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
FurtherBasicBeanPane<? extends Present> extra = provider.appearanceForPresent(); |
paneList.add(currency); |
||||||
paneList.add(extra); |
keys.add(CurrencyLinePresent.class.getName()); |
||||||
keys.add(provider.kindOfPresent().getName()); |
displays.add(currency.title4PopupWindow()); |
||||||
displays.add(extra.title4PopupWindow()); |
|
||||||
} |
Set<PresentKindProvider> providers = ExtraDesignClassManager.getInstance().getArray(PresentKindProvider.MARK_STRING); |
||||||
return paneList; |
for (PresentKindProvider provider : providers) { |
||||||
} |
FurtherBasicBeanPane<? extends Present> extra = provider.appearanceForPresent(); |
||||||
|
paneList.add(extra); |
||||||
@Override |
keys.add(provider.kindOfPresent().getName()); |
||||||
protected UIComboBox createComboBox() { |
displays.add(extra.title4PopupWindow()); |
||||||
return new DictionaryComboBox<>(keys.toArray(new String[keys.size()]), displays.toArray(new String[displays.size()])); |
} |
||||||
} |
return paneList; |
||||||
|
} |
||||||
@Override |
|
||||||
protected void addComboBoxItem(List<FurtherBasicBeanPane<? extends Present>> cards, int index) { |
@Override |
||||||
// 初始化的时候已经加了,所以这里不用加了
|
protected UIComboBox createComboBox() { |
||||||
} |
return new DictionaryComboBox<>(keys.toArray(new String[keys.size()]), displays.toArray(new String[displays.size()])); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void addComboBoxItem(List<FurtherBasicBeanPane<? extends Present>> cards, int index) { |
||||||
|
// 初始化的时候已经加了,所以这里不用加了
|
||||||
|
} |
||||||
} |
} |
@ -1,228 +1,230 @@ |
|||||||
package com.fr.design.widget; |
package com.fr.design.widget; |
||||||
|
|
||||||
import com.fr.design.data.DataCreatorUI; |
import com.fr.design.data.DataCreatorUI; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
import com.fr.design.gui.frpane.TreeSettingPane; |
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
import com.fr.design.gui.ibutton.UIHeadGroup; |
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
import com.fr.design.present.dict.DictionaryPane; |
import com.fr.design.present.dict.DictionaryPane; |
||||||
import com.fr.design.widget.ui.BasicWidgetPropertySettingPane; |
import com.fr.design.widget.ui.BasicWidgetPropertySettingPane; |
||||||
import com.fr.form.event.Listener; |
import com.fr.form.event.Listener; |
||||||
import com.fr.form.ui.NoneWidget; |
import com.fr.form.ui.NoneWidget; |
||||||
import com.fr.form.ui.Widget; |
import com.fr.form.ui.Widget; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
|
|
||||||
/* |
/* |
||||||
* carl :单独弄出来 |
* carl :单独弄出来 |
||||||
*/ |
*/ |
||||||
public class CellWidgetCardPane extends BasicPane { |
public class CellWidgetCardPane extends BasicPane { |
||||||
//当前的编辑器属性定义面板
|
//当前的编辑器属性定义面板
|
||||||
private DataModify<? extends Widget> currentEditorDefinePane; |
private DataModify<? extends Widget> currentEditorDefinePane; |
||||||
//属性配置切换面板
|
//属性配置切换面板
|
||||||
private ArrayList<JPanel> paneList; |
private ArrayList<JPanel> paneList; |
||||||
private JPanel center; |
private JPanel center; |
||||||
private UIHeadGroup tabsHeaderIconPane; |
private UIHeadGroup tabsHeaderIconPane; |
||||||
private CardLayout tabbedPane; |
private CardLayout tabbedPane; |
||||||
private BasicWidgetPropertySettingPane widgetPropertyPane; |
private BasicWidgetPropertySettingPane widgetPropertyPane; |
||||||
|
|
||||||
//通用属性容器
|
//通用属性容器
|
||||||
private JPanel attriTabPane; |
private JPanel attriTabPane; |
||||||
private JPanel attriCardPane; |
private JPanel attriCardPane; |
||||||
private CardLayout attriCardLayout; |
private CardLayout attriCardLayout; |
||||||
|
|
||||||
//数字字典属性容器
|
//数字字典属性容器
|
||||||
private JPanel dictTabPane; |
private JPanel dictTabPane; |
||||||
private JPanel dictCardPane; |
private JPanel dictCardPane; |
||||||
private CardLayout dictCardLayout; |
private CardLayout dictCardLayout; |
||||||
|
|
||||||
//构建树属性容器
|
//构建树属性容器
|
||||||
private JPanel treeTabPane; |
private JPanel treeTabPane; |
||||||
|
|
||||||
//事件属性容器
|
//事件属性容器
|
||||||
private JPanel eventTabPane; |
private JPanel eventTabPane; |
||||||
private WidgetEventPane eventPane; |
private WidgetEventPane eventPane; |
||||||
|
|
||||||
private ElementCasePane pane; |
private ElementCasePane pane; |
||||||
|
|
||||||
public CellWidgetCardPane(ElementCasePane pane) { |
public CellWidgetCardPane(ElementCasePane pane) { |
||||||
this.pane = pane; |
this.pane = pane; |
||||||
// this.initComponents(pane);
|
// this.initComponents(pane);
|
||||||
} |
} |
||||||
|
|
||||||
public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane(){ |
public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane() { |
||||||
return new BasicWidgetPropertySettingPane(); |
return new BasicWidgetPropertySettingPane(); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
private void initComponents(ElementCasePane pane) { |
private void initComponents(ElementCasePane pane) { |
||||||
|
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.removeAll(); |
||||||
//k
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
tabbedPane = new CardLayout(); |
//k
|
||||||
center = new JPanel(tabbedPane); |
tabbedPane = new CardLayout(); |
||||||
this.add(center, BorderLayout.CENTER); |
center = new JPanel(tabbedPane); |
||||||
|
this.add(center, BorderLayout.CENTER); |
||||||
attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
initPaneList(); |
eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
eventPane = new WidgetEventPane(pane); |
initPaneList(); |
||||||
eventTabPane.add(eventPane, BorderLayout.CENTER); |
eventPane = new WidgetEventPane(pane); |
||||||
//k
|
eventTabPane.add(eventPane, BorderLayout.CENTER); |
||||||
center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute")); |
//k
|
||||||
center.add(eventTabPane, Inter.getLocText("FR-Designer_Form_Editing_Listeners")); |
center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute")); |
||||||
final String [] tabTitles = new String[]{Inter.getLocText("FR-Designer_Attribute"), Inter.getLocText("FR-Designer_Form_Editing_Listeners")}; |
center.add(eventTabPane, Inter.getLocText("FR-Designer_Form_Editing_Listeners")); |
||||||
|
final String[] tabTitles = new String[]{Inter.getLocText("FR-Designer_Attribute"), Inter.getLocText("FR-Designer_Form_Editing_Listeners")}; |
||||||
tabsHeaderIconPane = new UIHeadGroup(tabTitles) { |
|
||||||
@Override |
tabsHeaderIconPane = new UIHeadGroup(tabTitles) { |
||||||
public void tabChanged(int index) { |
@Override |
||||||
tabbedPane.show(center, tabTitles[index]); |
public void tabChanged(int index) { |
||||||
} |
tabbedPane.show(center, tabTitles[index]); |
||||||
}; |
} |
||||||
tabsHeaderIconPane.setNeedLeftRightOutLine(false); |
}; |
||||||
this.add(tabsHeaderIconPane, BorderLayout.NORTH); |
tabsHeaderIconPane.setNeedLeftRightOutLine(false); |
||||||
|
this.add(tabsHeaderIconPane, BorderLayout.NORTH); |
||||||
//数据字典
|
|
||||||
dictTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
//数据字典
|
||||||
dictCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); |
dictTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
dictTabPane.add(dictCardPane, BorderLayout.CENTER); |
dictCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); |
||||||
dictCardLayout = new CardLayout(); |
dictTabPane.add(dictCardPane, BorderLayout.CENTER); |
||||||
dictCardPane.setLayout(dictCardLayout); |
dictCardLayout = new CardLayout(); |
||||||
|
dictCardPane.setLayout(dictCardLayout); |
||||||
//构建树
|
|
||||||
treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
//构建树
|
||||||
|
treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
widgetPropertyPane = new BasicWidgetPropertySettingPane(); |
|
||||||
|
widgetPropertyPane = new BasicWidgetPropertySettingPane(); |
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); |
|
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, widgetPropertyPane); |
||||||
attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); |
|
||||||
|
attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
||||||
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); |
attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
attriTabPane.add(attriCardPane, BorderLayout.CENTER); |
|
||||||
attriCardLayout = (CardLayout) attriCardPane.getLayout(); |
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); |
||||||
this.setPreferredSize(new Dimension(600, 450)); |
attriTabPane.add(attriCardPane, BorderLayout.CENTER); |
||||||
} |
attriCardLayout = (CardLayout) attriCardPane.getLayout(); |
||||||
|
this.setPreferredSize(new Dimension(600, 450)); |
||||||
private void initPaneList(){ |
} |
||||||
paneList = new ArrayList<JPanel>(); |
|
||||||
paneList.add(attriTabPane); |
private void initPaneList() { |
||||||
paneList.add(eventPane); |
paneList = new ArrayList<JPanel>(); |
||||||
} |
paneList.add(attriTabPane); |
||||||
|
paneList.add(eventPane); |
||||||
@Override |
} |
||||||
protected String title4PopupWindow() { |
|
||||||
return "Widget"; |
@Override |
||||||
} |
protected String title4PopupWindow() { |
||||||
|
return "Widget"; |
||||||
public void populate(Widget cellWidget) { |
} |
||||||
initComponents(pane); |
|
||||||
// super.populate(cellWidget);
|
public void populate(Widget cellWidget) { |
||||||
currentEditorDefinePane = null; |
initComponents(pane); |
||||||
|
// super.populate(cellWidget);
|
||||||
if (cellWidget instanceof NoneWidget) { |
currentEditorDefinePane = null; |
||||||
// this.tabbedPane.setEnabled(false);
|
|
||||||
} else { |
if (cellWidget instanceof NoneWidget) { |
||||||
// this.tabbedPane.setEnabled(true);
|
// this.tabbedPane.setEnabled(false);
|
||||||
} |
} else { |
||||||
|
// this.tabbedPane.setEnabled(true);
|
||||||
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { |
} |
||||||
@Override |
|
||||||
public void did(DataCreatorUI ui, String cardName) { |
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { |
||||||
if (ui == null) { |
@Override |
||||||
removeDictAttriPane(); |
public void did(DataCreatorUI ui, String cardName) { |
||||||
removeTreeAttriPane(); |
if (ui == null) { |
||||||
} |
removeDictAttriPane(); |
||||||
if (ui instanceof DictionaryPane) { |
removeTreeAttriPane(); |
||||||
removeDictAttriPane(); |
} |
||||||
removeTreeAttriPane(); |
if (ui instanceof DictionaryPane) { |
||||||
showDictPane(ui, cardName); |
removeDictAttriPane(); |
||||||
} else if (ui instanceof TreeSettingPane) { |
removeTreeAttriPane(); |
||||||
removeDictAttriPane(); |
showDictPane(ui, cardName); |
||||||
removeTreeAttriPane(); |
} else if (ui instanceof TreeSettingPane) { |
||||||
showTreePane(ui); |
removeDictAttriPane(); |
||||||
} |
removeTreeAttriPane(); |
||||||
} |
showTreePane(ui); |
||||||
}); |
} |
||||||
DataModify<? extends Widget> definePane = rn.getDefinePane(); |
} |
||||||
attriCardPane.add(definePane.toSwingComponent(), rn.getCardName()); |
}); |
||||||
attriCardLayout.show(attriCardPane, rn.getCardName()); |
DataModify<? extends Widget> definePane = rn.getDefinePane(); |
||||||
currentEditorDefinePane = definePane; |
attriCardPane.add(definePane.toSwingComponent(), rn.getCardName()); |
||||||
eventPane.populate(cellWidget); |
attriCardLayout.show(attriCardPane, rn.getCardName()); |
||||||
widgetPropertyPane.populate(cellWidget); |
currentEditorDefinePane = definePane; |
||||||
tabsHeaderIconPane.setSelectedIndex(0); |
eventPane.populate(cellWidget); |
||||||
} |
widgetPropertyPane.populate(cellWidget); |
||||||
|
tabsHeaderIconPane.setSelectedIndex(0); |
||||||
private void showDictPane(DataCreatorUI ui, String cardName) { |
} |
||||||
dictCardPane.removeAll(); |
|
||||||
dictCardPane.add(ui.toSwingComponent(), cardName); |
private void showDictPane(DataCreatorUI ui, String cardName) { |
||||||
dictCardLayout.show(dictCardPane, cardName); |
dictCardPane.removeAll(); |
||||||
addDictAttriPane(); |
dictCardPane.add(ui.toSwingComponent(), cardName); |
||||||
} |
dictCardLayout.show(dictCardPane, cardName); |
||||||
|
addDictAttriPane(); |
||||||
private void showTreePane(DataCreatorUI ui) { |
} |
||||||
treeTabPane.removeAll(); |
|
||||||
treeTabPane.add(ui.toSwingComponent()); |
private void showTreePane(DataCreatorUI ui) { |
||||||
addTreeAttriPane(); |
treeTabPane.removeAll(); |
||||||
} |
treeTabPane.add(ui.toSwingComponent()); |
||||||
|
addTreeAttriPane(); |
||||||
public Widget update() { |
} |
||||||
if (currentEditorDefinePane == null) { |
|
||||||
return null; |
public Widget update() { |
||||||
} |
if (currentEditorDefinePane == null) { |
||||||
Widget widget = currentEditorDefinePane.updateBean(); |
return null; |
||||||
if (widget == null) { |
} |
||||||
return null; |
Widget widget = currentEditorDefinePane.updateBean(); |
||||||
} |
if (widget == null) { |
||||||
widgetPropertyPane.update(widget); |
return null; |
||||||
// super.update(widget);
|
} |
||||||
|
widgetPropertyPane.update(widget); |
||||||
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(); |
// super.update(widget);
|
||||||
widget.clearListeners(); |
|
||||||
for (Listener l : listener) { |
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(); |
||||||
widget.addListener(l); |
widget.clearListeners(); |
||||||
} |
for (Listener l : listener) { |
||||||
|
widget.addListener(l); |
||||||
return widget; |
} |
||||||
} |
|
||||||
|
return widget; |
||||||
|
} |
||||||
@Override |
|
||||||
/** |
|
||||||
*检查 |
@Override |
||||||
*/ |
/** |
||||||
public void checkValid() throws Exception { |
*检查 |
||||||
currentEditorDefinePane.checkValid(); |
*/ |
||||||
eventPane.checkValid(); |
public void checkValid() throws Exception { |
||||||
} |
currentEditorDefinePane.checkValid(); |
||||||
|
eventPane.checkValid(); |
||||||
|
} |
||||||
private void addDictAttriPane() { |
|
||||||
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_DS_Dictionary")); |
|
||||||
reInitHeaderPane(this.dictTabPane); |
private void addDictAttriPane() { |
||||||
} |
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_DS_Dictionary")); |
||||||
|
reInitHeaderPane(this.dictTabPane); |
||||||
private void addTreeAttriPane() { |
} |
||||||
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_Create_Tree")); |
|
||||||
reInitHeaderPane(this.treeTabPane); |
private void addTreeAttriPane() { |
||||||
} |
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_Create_Tree")); |
||||||
|
reInitHeaderPane(this.treeTabPane); |
||||||
private void removeDictAttriPane() { |
} |
||||||
center.remove(this.dictTabPane); |
|
||||||
} |
private void removeDictAttriPane() { |
||||||
|
center.remove(this.dictTabPane); |
||||||
private void removeTreeAttriPane() { |
} |
||||||
center.remove(this.treeTabPane); |
|
||||||
} |
private void removeTreeAttriPane() { |
||||||
|
center.remove(this.treeTabPane); |
||||||
private void reInitHeaderPane(JPanel jPanel){ |
} |
||||||
paneList.add(jPanel); |
|
||||||
// tabsHeaderIconPane = new
|
private void reInitHeaderPane(JPanel jPanel) { |
||||||
} |
paneList.add(jPanel); |
||||||
|
// tabsHeaderIconPane = new
|
||||||
} |
} |
||||||
|
|
||||||
|
} |
||||||
|
@ -1,274 +1,287 @@ |
|||||||
package com.fr.design.widget; |
package com.fr.design.widget; |
||||||
|
|
||||||
import com.fr.design.ExtraDesignClassManager; |
import com.fr.design.ExtraDesignClassManager; |
||||||
import com.fr.design.fun.WidgetDesignHandler; |
import com.fr.design.fun.WidgetDesignHandler; |
||||||
import com.fr.design.gui.core.WidgetOption; |
import com.fr.design.gui.core.WidgetOption; |
||||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
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.ilable.UILabel; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.mainframe.CellWidgetPropertyPane; |
import com.fr.design.mainframe.CellWidgetPropertyPane; |
||||||
import com.fr.design.widget.btn.ButtonConstants; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.form.ui.Button; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
import com.fr.form.ui.*; |
import com.fr.design.widget.btn.ButtonConstants; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.form.ui.Button; |
||||||
import com.fr.general.Inter; |
import com.fr.form.ui.*; |
||||||
import com.fr.stable.ArrayUtils; |
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
import javax.swing.*; |
import com.fr.stable.ArrayUtils; |
||||||
import java.awt.*; |
|
||||||
import java.awt.event.ItemEvent; |
import javax.swing.*; |
||||||
import java.awt.event.ItemListener; |
import java.awt.*; |
||||||
import java.util.Vector; |
import java.awt.event.ItemEvent; |
||||||
|
import java.awt.event.ItemListener; |
||||||
/** |
import java.util.Vector; |
||||||
* CellEditorDef Pane. |
|
||||||
*/ |
/** |
||||||
public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener { |
* CellEditorDef Pane. |
||||||
|
*/ |
||||||
private EditorTypeComboBox editorTypeComboBox; |
public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener { |
||||||
private CellWidgetCardPane cellEditorCardPane; |
|
||||||
private boolean shouldFireSelectedEvent = true; |
private EditorTypeComboBox editorTypeComboBox; |
||||||
protected JPanel northPane; |
private CellWidgetCardPane cellEditorCardPane; |
||||||
|
private boolean shouldFireSelectedEvent = true; |
||||||
public WidgetPane() { |
protected JPanel northPane; |
||||||
this(null); |
|
||||||
} |
public WidgetPane() { |
||||||
|
this(null); |
||||||
/** |
} |
||||||
* Constructor |
|
||||||
*/ |
/** |
||||||
public WidgetPane(ElementCasePane pane) { |
* Constructor |
||||||
this.initComponents(pane); |
*/ |
||||||
} |
public WidgetPane(ElementCasePane pane) { |
||||||
|
this.initComponents(pane); |
||||||
protected void initComponents(ElementCasePane pane) { |
} |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
protected void initComponents(ElementCasePane pane) { |
||||||
northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
this.add(northPane, BorderLayout.NORTH); |
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
|
||||||
northPane.add(new UILabel(Inter.getLocText("FR-Designer_Type") + ":")); |
editorTypeComboBox = new EditorTypeComboBox(pane != null); |
||||||
editorTypeComboBox = new EditorTypeComboBox(pane != null); |
editorTypeComboBox.setPreferredSize(new Dimension(155, 30)); |
||||||
editorTypeComboBox.setPreferredSize(new Dimension(150, 30)); |
editorTypeComboBox.setMaximumRowCount(16); |
||||||
editorTypeComboBox.setMaximumRowCount(16); |
|
||||||
northPane.add(editorTypeComboBox); |
UILabel emptyLabel = new UILabel(); |
||||||
editorTypeComboBox.addItemListener(this); |
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
|
|
||||||
cellEditorCardPane = new CellWidgetCardPane(pane); |
double p = TableLayout.PREFERRED; |
||||||
this.add(cellEditorCardPane, BorderLayout.CENTER); |
double f = TableLayout.FILL; |
||||||
this.addAttributeChangeListener(listener); |
double[] columnSize = {p, p, f}; |
||||||
} |
double[] rowSize = {p}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
protected JPanel createContentPane(){ |
new Component[]{new UILabel(Inter.getLocText(new String[]{"FR-Designer_Selection", "FR-Designer_Widget"})), emptyLabel, editorTypeComboBox}, |
||||||
return new JPanel(); |
}; |
||||||
} |
northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15)); |
||||||
|
this.add(northPane, BorderLayout.NORTH); |
||||||
|
|
||||||
AttributeChangeListener listener = new AttributeChangeListener() { |
editorTypeComboBox.addItemListener(this); |
||||||
@Override |
|
||||||
public void attributeChange() { |
cellEditorCardPane = new CellWidgetCardPane(pane); |
||||||
CellWidgetPropertyPane.getInstance().update(); |
this.add(cellEditorCardPane, BorderLayout.CENTER); |
||||||
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
this.addAttributeChangeListener(listener); |
||||||
} |
} |
||||||
}; |
|
||||||
|
protected JPanel createContentPane() { |
||||||
/** |
return new JPanel(); |
||||||
* 状态改变 |
} |
||||||
* |
|
||||||
* @param e 事件对象 |
|
||||||
*/ |
AttributeChangeListener listener = new AttributeChangeListener() { |
||||||
public void itemStateChanged(ItemEvent e) { |
@Override |
||||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
public void attributeChange() { |
||||||
Widget oldWidget = update(); |
CellWidgetPropertyPane.getInstance().update(); |
||||||
Widget selectedItem = editorTypeComboBox.getCellWidget(); |
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
WidgetDesignHandler handler = ExtraDesignClassManager.getInstance().getSingle(WidgetDesignHandler.XML_TAG); |
} |
||||||
if (handler != null) { |
}; |
||||||
handler.transferWidgetProperties(oldWidget, selectedItem); |
|
||||||
} |
/** |
||||||
if (e.getItem() instanceof Item && ((Item) e.getItem()).getValue() instanceof WidgetConfig) { |
* 状态改变 |
||||||
populate(selectedItem); |
* |
||||||
return; |
* @param e 事件对象 |
||||||
} |
*/ |
||||||
if (shouldFireSelectedEvent) { |
public void itemStateChanged(ItemEvent e) { |
||||||
populateWidgetConfig(selectedItem); |
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
} |
Widget oldWidget = update(); |
||||||
} |
Widget selectedItem = editorTypeComboBox.getCellWidget(); |
||||||
} |
WidgetDesignHandler handler = ExtraDesignClassManager.getInstance().getSingle(WidgetDesignHandler.XML_TAG); |
||||||
|
if (handler != null) { |
||||||
@Override |
handler.transferWidgetProperties(oldWidget, selectedItem); |
||||||
public String title4PopupWindow() { |
} |
||||||
return Inter.getLocText("FR-Designer_Widget"); |
if (e.getItem() instanceof Item && ((Item) e.getItem()).getValue() instanceof WidgetConfig) { |
||||||
} |
populate(selectedItem); |
||||||
|
return; |
||||||
public void populate(Widget widget) { |
} |
||||||
if (widget == null) { |
if (shouldFireSelectedEvent) { |
||||||
return; |
populateWidgetConfig(selectedItem); |
||||||
} |
} |
||||||
|
} |
||||||
if (widget instanceof NameWidget) { |
} |
||||||
String name = ((NameWidget) widget).getName(); |
|
||||||
shouldFireSelectedEvent = false; |
@Override |
||||||
editorTypeComboBox.setSelectedItem(new Item(name, name)); |
public String title4PopupWindow() { |
||||||
shouldFireSelectedEvent = true; |
return Inter.getLocText("FR-Designer_Widget"); |
||||||
cellEditorCardPane.populate(widget); |
} |
||||||
return; |
|
||||||
} |
public void populate(Widget widget) { |
||||||
|
if (widget == null) { |
||||||
Class clazz = widget.getClass(); |
return; |
||||||
if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) { |
} |
||||||
clazz = Button.class; |
|
||||||
} |
if (widget instanceof NameWidget) { |
||||||
cellEditorCardPane.populate(widget); |
String name = ((NameWidget) widget).getName(); |
||||||
|
shouldFireSelectedEvent = false; |
||||||
shouldFireSelectedEvent = false; |
editorTypeComboBox.setSelectedItem(new Item(name, name)); |
||||||
editorTypeComboBox.setSelectedItemByWidgetClass(clazz); |
shouldFireSelectedEvent = true; |
||||||
shouldFireSelectedEvent = true; |
cellEditorCardPane.populate(widget); |
||||||
|
return; |
||||||
removeAttributeChangeListener(); |
} |
||||||
initAllListeners(); |
|
||||||
this.addAttributeChangeListener(listener); |
Class clazz = widget.getClass(); |
||||||
|
if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) { |
||||||
} |
clazz = Button.class; |
||||||
|
} |
||||||
public Widget update() { |
cellEditorCardPane.populate(widget); |
||||||
return cellEditorCardPane.update(); |
|
||||||
} |
shouldFireSelectedEvent = false; |
||||||
|
editorTypeComboBox.setSelectedItemByWidgetClass(clazz); |
||||||
protected void populateWidgetConfig(Widget widget) { |
shouldFireSelectedEvent = true; |
||||||
this.populate(widget); |
|
||||||
} |
removeAttributeChangeListener(); |
||||||
|
initAllListeners(); |
||||||
|
this.addAttributeChangeListener(listener); |
||||||
private static class EditorTypeComboBox extends UIComboBox { |
|
||||||
|
} |
||||||
private Item item = new Item(Inter.getLocText("Widget-User_Defined"), |
|
||||||
Inter.getLocText("Widget-User_Defined")); |
public Widget update() { |
||||||
|
return cellEditorCardPane.update(); |
||||||
public EditorTypeComboBox(boolean userDefined) { |
} |
||||||
this.setEditable(false); |
|
||||||
this.setModel(new DefaultComboBoxModel(getWidgetsName(userDefined))); |
protected void populateWidgetConfig(Widget widget) { |
||||||
this.setRenderer(new UIComboBoxRenderer() { |
this.populate(widget); |
||||||
public Component getListCellRendererComponent(JList list, |
} |
||||||
Object value, int index, boolean isSelected, |
|
||||||
boolean cellHasFocus) { |
|
||||||
if (value == item) { |
private static class EditorTypeComboBox extends UIComboBox { |
||||||
UILabel label = new UILabel(Inter |
|
||||||
.getLocText("Widget-User_Defined") |
private Item item = new Item(Inter.getLocText("Widget-User_Defined"), |
||||||
+ " ————"); |
Inter.getLocText("Widget-User_Defined")); |
||||||
label.setEnabled(false); |
|
||||||
return label; |
public EditorTypeComboBox(boolean userDefined) { |
||||||
} |
this.setEditable(false); |
||||||
return super.getListCellRendererComponent(list, value, |
this.setModel(new DefaultComboBoxModel(getWidgetsName(userDefined))); |
||||||
index, isSelected, cellHasFocus); |
this.setRenderer(new UIComboBoxRenderer() { |
||||||
} |
public Component getListCellRendererComponent(JList list, |
||||||
}); |
Object value, int index, boolean isSelected, |
||||||
this.setPreferredSize(new Dimension(100, 20)); |
boolean cellHasFocus) { |
||||||
} |
if (value == item) { |
||||||
|
UILabel label = new UILabel(Inter |
||||||
public void setSelectedItemByWidgetClass(Class clazz) { |
.getLocText("Widget-User_Defined") |
||||||
WidgetOption[] options = getWidgetOptions(); |
+ " ————"); |
||||||
for (int i = 0, l = this.getModel().getSize(); i < l; i++) { |
label.setEnabled(false); |
||||||
Item item = (Item) this.getModel().getElementAt(i); |
return label; |
||||||
if (item.getValue() instanceof Integer |
} |
||||||
&& options[(Integer) item.getValue()].widgetClass() == clazz) { |
return super.getListCellRendererComponent(list, value, |
||||||
this.setSelectedItem(item); |
index, isSelected, cellHasFocus); |
||||||
} |
} |
||||||
} |
}); |
||||||
} |
this.setPreferredSize(new Dimension(100, 20)); |
||||||
|
} |
||||||
public void setSelectedItem(Object anObject) { |
|
||||||
if (anObject == item) { |
public void setSelectedItemByWidgetClass(Class clazz) { |
||||||
return; |
WidgetOption[] options = getWidgetOptions(); |
||||||
} |
for (int i = 0, l = this.getModel().getSize(); i < l; i++) { |
||||||
super.setSelectedItem(anObject); |
Item item = (Item) this.getModel().getElementAt(i); |
||||||
} |
if (item.getValue() instanceof Integer |
||||||
|
&& options[(Integer) item.getValue()].widgetClass() == clazz) { |
||||||
private Vector getWidgetsName(boolean userDefined) { |
this.setSelectedItem(item); |
||||||
|
} |
||||||
WidgetOption[] reportWidgetInstance = getWidgetOptions(); |
} |
||||||
Vector<Item> items = new Vector<Item>(); |
} |
||||||
for (int i = 0, l = reportWidgetInstance.length; i < l; i++) { |
|
||||||
items.add(new Item(reportWidgetInstance[i].optionName(), i)); |
public void setSelectedItem(Object anObject) { |
||||||
} |
if (anObject == item) { |
||||||
WidgetManagerProvider manager = WidgetManager.getProviderInstance(); |
return; |
||||||
java.util.Iterator<String> nameIt = manager.getWidgetConfigNameIterator(); |
} |
||||||
if (userDefined && nameIt.hasNext()) { |
super.setSelectedItem(anObject); |
||||||
items.add(item); |
} |
||||||
while (nameIt.hasNext()) { |
|
||||||
String name = nameIt.next(); |
private Vector getWidgetsName(boolean userDefined) { |
||||||
items.add(new Item(name, name)); |
|
||||||
} |
WidgetOption[] reportWidgetInstance = getWidgetOptions(); |
||||||
} |
Vector<Item> items = new Vector<Item>(); |
||||||
|
for (int i = 0, l = reportWidgetInstance.length; i < l; i++) { |
||||||
return items; |
items.add(new Item(reportWidgetInstance[i].optionName(), i)); |
||||||
} |
} |
||||||
|
WidgetManagerProvider manager = WidgetManager.getProviderInstance(); |
||||||
public Widget getCellWidget() { |
java.util.Iterator<String> nameIt = manager.getWidgetConfigNameIterator(); |
||||||
Item item = (Item) this.getSelectedItem(); |
if (userDefined && nameIt.hasNext()) { |
||||||
if (item.getValue() instanceof Integer) { |
items.add(item); |
||||||
return getWidgetOptions()[(Integer) item.getValue()].createWidget(); |
while (nameIt.hasNext()) { |
||||||
} else if (item.getValue() instanceof String) { |
String name = nameIt.next(); |
||||||
return new NameWidget((String) item.getValue()); |
items.add(new Item(name, name)); |
||||||
} |
} |
||||||
return null; |
} |
||||||
} |
|
||||||
|
return items; |
||||||
private WidgetOption[] getWidgetOptions() { |
} |
||||||
return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); |
|
||||||
} |
public Widget getCellWidget() { |
||||||
} |
Item item = (Item) this.getSelectedItem(); |
||||||
|
if (item.getValue() instanceof Integer) { |
||||||
/** |
return getWidgetOptions()[(Integer) item.getValue()].createWidget(); |
||||||
* 校验 |
} else if (item.getValue() instanceof String) { |
||||||
* |
return new NameWidget((String) item.getValue()); |
||||||
* @throws Exception 抛出异常 |
} |
||||||
*/ |
return null; |
||||||
public void checkValid() throws Exception { |
} |
||||||
this.cellEditorCardPane.checkValid(); |
|
||||||
} |
private WidgetOption[] getWidgetOptions() { |
||||||
|
return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); |
||||||
public static class Item { |
} |
||||||
private String name; |
} |
||||||
private Object value; |
|
||||||
|
/** |
||||||
|
* 校验 |
||||||
public Item(String name, Object value) { |
* |
||||||
this.name = name; |
* @throws Exception 抛出异常 |
||||||
this.value = value; |
*/ |
||||||
} |
public void checkValid() throws Exception { |
||||||
|
this.cellEditorCardPane.checkValid(); |
||||||
public Object getValue() { |
} |
||||||
return value; |
|
||||||
} |
public static class Item { |
||||||
|
private String name; |
||||||
public String getName() { |
private Object value; |
||||||
return name; |
|
||||||
} |
|
||||||
|
public Item(String name, Object value) { |
||||||
/** |
this.name = name; |
||||||
* 转化成字符串形式 |
this.value = value; |
||||||
* |
} |
||||||
* @return 返回字符串 |
|
||||||
*/ |
public Object getValue() { |
||||||
public String toString() { |
return value; |
||||||
return name; |
} |
||||||
} |
|
||||||
|
public String getName() { |
||||||
@Override |
return name; |
||||||
public boolean equals(Object o) { |
} |
||||||
return o instanceof Item |
|
||||||
&& ComparatorUtils.equals(((Item) o).value, value) |
/** |
||||||
&& ComparatorUtils.equals(((Item) o).name, name); |
* 转化成字符串形式 |
||||||
} |
* |
||||||
} |
* @return 返回字符串 |
||||||
public String getIconPath(){ |
*/ |
||||||
return ""; |
public String toString() { |
||||||
} |
return name; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object o) { |
||||||
|
return o instanceof Item |
||||||
|
&& ComparatorUtils.equals(((Item) o).value, value) |
||||||
|
&& ComparatorUtils.equals(((Item) o).name, name); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public String getIconPath() { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,70 +1,74 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.form.ui.NoneWidget; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.form.ui.Widget; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.general.Inter; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.form.ui.NoneWidget; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
import javax.swing.*; |
import com.fr.general.Inter; |
||||||
import java.awt.*; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
|
||||||
public class BasicWidgetPropertySettingPane extends BasicPane { |
import javax.swing.*; |
||||||
private ParameterTreeComboBox widgetNameComboBox; |
import java.awt.*; |
||||||
private UICheckBox enableCheckBox; |
|
||||||
private UICheckBox visibleCheckBox; |
public class BasicWidgetPropertySettingPane extends BasicPane { |
||||||
private Widget widget; |
private ParameterTreeComboBox widgetNameComboBox; |
||||||
|
private UICheckBox enableCheckBox; |
||||||
public BasicWidgetPropertySettingPane() { |
private UICheckBox visibleCheckBox; |
||||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
private Widget widget; |
||||||
JPanel pane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
pane1.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); |
public BasicWidgetPropertySettingPane() { |
||||||
this.add(pane1); |
this.setLayout(new BorderLayout()); |
||||||
|
enableCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Visible"), true); |
||||||
JPanel pane2 = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
visibleCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget-Visible"), true); |
||||||
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true); |
widgetNameComboBox = new ParameterTreeComboBox(); |
||||||
pane2.add(enableCheckBox); |
widgetNameComboBox.refreshTree(); |
||||||
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); |
double f = TableLayout.FILL; |
||||||
pane2.add(visibleCheckBox); |
double p = TableLayout.PREFERRED; |
||||||
pane1.add(pane2, BorderLayout.NORTH); |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name") + " "), widgetNameComboBox}, |
||||||
JPanel pane3 = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
new Component[]{enableCheckBox, null}, |
||||||
widgetNameComboBox = new ParameterTreeComboBox(); |
new Component[]{visibleCheckBox, null}, |
||||||
widgetNameComboBox.refreshTree(); |
}; |
||||||
pane3.add(new UILabel(Inter.getLocText("Form-Widget_Name") + ":")); |
double[] rowSize = {p, p, p}; |
||||||
pane3.add(widgetNameComboBox); |
double[] columnSize = {p, f}; |
||||||
pane1.add(pane3, BorderLayout.CENTER); |
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||||
|
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
||||||
} |
pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0)); |
||||||
|
|
||||||
@Override |
this.add(pane, BorderLayout.CENTER); |
||||||
protected String title4PopupWindow() { |
|
||||||
return "property"; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
public void populate(Widget widget){ |
protected String title4PopupWindow() { |
||||||
//:jackie
|
return "property"; |
||||||
if(widget instanceof NoneWidget){ |
} |
||||||
this.widget = null; |
|
||||||
GUICoreUtils.setEnabled(this, false); |
public void populate(Widget widget){ |
||||||
return; |
//:jackie
|
||||||
} else{ |
if(widget instanceof NoneWidget){ |
||||||
GUICoreUtils.setEnabled(this, true); |
this.widget = null; |
||||||
this.widget = widget; |
GUICoreUtils.setEnabled(this, false); |
||||||
widgetNameComboBox.setSelectedItem(widget.getWidgetName()); |
return; |
||||||
enableCheckBox.setSelected(this.widget.isEnabled()); |
} else{ |
||||||
visibleCheckBox.setSelected(this.widget.isVisible()); |
GUICoreUtils.setEnabled(this, true); |
||||||
} |
this.widget = widget; |
||||||
} |
widgetNameComboBox.setSelectedItem(widget.getWidgetName()); |
||||||
|
enableCheckBox.setSelected(this.widget.isEnabled()); |
||||||
public void update(Widget widget){ |
visibleCheckBox.setSelected(this.widget.isVisible()); |
||||||
if(this.widget == null) |
} |
||||||
return ; |
} |
||||||
widget.setWidgetName(widgetNameComboBox.getSelectedParameterName()); |
|
||||||
widget.setEnabled(enableCheckBox.isSelected()); |
public void update(Widget widget){ |
||||||
widget.setVisible(visibleCheckBox.isSelected()); |
if(this.widget == null) |
||||||
} |
return ; |
||||||
|
widget.setWidgetName(widgetNameComboBox.getSelectedParameterName()); |
||||||
|
widget.setEnabled(enableCheckBox.isSelected()); |
||||||
|
widget.setVisible(visibleCheckBox.isSelected()); |
||||||
|
} |
||||||
} |
} |
@ -1,164 +1,160 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.*; |
import com.fr.base.GraphHelper; |
||||||
import java.awt.event.ItemEvent; |
import com.fr.design.constants.LayoutConstants; |
||||||
import java.awt.event.ItemListener; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import javax.swing.*; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.base.GraphHelper; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.form.ui.FieldEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
import javax.swing.event.DocumentEvent; |
|
||||||
import javax.swing.event.DocumentListener; |
import javax.swing.*; |
||||||
|
import javax.swing.event.DocumentEvent; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import javax.swing.event.DocumentListener; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import java.awt.*; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import java.awt.event.ItemEvent; |
||||||
import com.fr.design.layout.TableLayout; |
import java.awt.event.ItemListener; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.form.ui.FieldEditor; |
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
||||||
import com.fr.general.Inter; |
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; |
||||||
|
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; |
||||||
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
protected UICheckBox allowBlankCheckBox; |
||||||
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; |
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
||||||
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; |
protected UITextField errorMsgTextField; |
||||||
protected UICheckBox allowBlankCheckBox; |
protected JPanel validatePane; |
||||||
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
|
||||||
protected UITextField errorMsgTextField; |
public FieldEditorDefinePane() { |
||||||
protected JPanel validatePane; |
this.initComponents(); |
||||||
|
} |
||||||
public FieldEditorDefinePane() { |
|
||||||
this.initComponents(); |
protected void initComponents() { |
||||||
} |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
initErrorMsgPane(); |
||||||
protected void initComponents() { |
JPanel contentPane = this.setFirstContentPane(); |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
if (contentPane != null) { |
||||||
initErrorMsgPane(); |
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane); |
||||||
JPanel contentPane = this.setFirstContentPane(); |
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
if (contentPane != null) { |
} |
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); |
this.addValidatePane(); |
||||||
this.add(uiExpandablePane, BorderLayout.NORTH); |
} |
||||||
} |
|
||||||
this.addValidatePane(); |
|
||||||
} |
protected void initErrorMsgPane() { |
||||||
|
// 错误信息
|
||||||
|
errorMsgTextField = new UITextField(10); |
||||||
protected void initErrorMsgPane() { |
|
||||||
// 错误信息
|
// richer:主要为了方便查看比较长的错误信息
|
||||||
errorMsgTextField = new UITextField(10); |
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
||||||
|
|
||||||
// richer:主要为了方便查看比较长的错误信息
|
public void changedUpdate(DocumentEvent e) { |
||||||
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
|
} |
||||||
public void changedUpdate(DocumentEvent e) { |
|
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
public void insertUpdate(DocumentEvent e) { |
||||||
} |
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
|
} |
||||||
public void insertUpdate(DocumentEvent e) { |
|
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
public void removeUpdate(DocumentEvent e) { |
||||||
} |
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
|
} |
||||||
public void removeUpdate(DocumentEvent e) { |
}); |
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
||||||
} |
} |
||||||
}); |
|
||||||
|
@Override |
||||||
} |
public void populateBean(T ob) { |
||||||
|
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
||||||
@Override |
// errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
|
||||||
public void populateBean(T ob) { |
this.errorMsgTextField.setText(ob.getErrorMessage()); |
||||||
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
|
||||||
// errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
|
populateSubFieldEditorBean(ob); |
||||||
this.errorMsgTextField.setText(ob.getErrorMessage()); |
} |
||||||
|
|
||||||
populateSubFieldEditorBean(ob); |
protected abstract void populateSubFieldEditorBean(T ob); |
||||||
} |
|
||||||
|
@Override |
||||||
protected abstract void populateSubFieldEditorBean(T ob); |
public T updateBean() { |
||||||
|
T e = updateSubFieldEditorBean(); |
||||||
@Override |
|
||||||
public T updateBean() { |
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
||||||
T e = updateSubFieldEditorBean(); |
e.setErrorMessage(this.errorMsgTextField.getText()); |
||||||
|
|
||||||
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
return e; |
||||||
e.setErrorMessage(this.errorMsgTextField.getText()); |
} |
||||||
|
|
||||||
return e; |
protected abstract T updateSubFieldEditorBean(); |
||||||
} |
|
||||||
|
protected abstract JPanel setFirstContentPane(); |
||||||
protected abstract T updateSubFieldEditorBean(); |
|
||||||
|
|
||||||
protected abstract JPanel setFirstContentPane(); |
@Override |
||||||
|
public void checkValid() throws Exception { |
||||||
|
|
||||||
@Override |
} |
||||||
public void checkValid() throws Exception { |
|
||||||
|
protected void addValidatePane() { |
||||||
} |
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Error", "FR-Designer_Tooltips"})); |
||||||
protected void addValidatePane() { |
errorMsgTextField = new UITextField(10); |
||||||
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); |
||||||
final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"); |
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); |
||||||
errorMsgTextField = new UITextField(10); |
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); |
||||||
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); |
allowBlankCheckBox.addItemListener(new ItemListener() { |
||||||
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); |
|
||||||
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); |
@Override |
||||||
allowBlankCheckBox.addItemListener(new ItemListener() { |
public void itemStateChanged(ItemEvent e) { |
||||||
|
boolean isSelected = allowBlankCheckBox.isSelected(); |
||||||
@Override |
uiLabel.setVisible(!isSelected); |
||||||
public void itemStateChanged(ItemEvent e) { |
errorMsgTextField.setVisible(!isSelected); |
||||||
boolean isSelected = allowBlankCheckBox.isSelected(); |
if (isSelected) { |
||||||
uiLabel.setVisible(!isSelected); |
uiLabel.setPreferredSize(new Dimension(0, 0)); |
||||||
errorMsgTextField.setVisible(!isSelected); |
errorMsgTextField.setPreferredSize(new Dimension(0, 0)); |
||||||
if(isSelected){ |
} else { |
||||||
uiLabel.setPreferredSize(new Dimension(0, 0)); |
uiLabel.setPreferredSize(new Dimension(66, 20)); |
||||||
errorMsgTextField.setPreferredSize(new Dimension(0, 0)); |
errorMsgTextField.setPreferredSize(new Dimension(150, 20)); |
||||||
}else{ |
} |
||||||
uiLabel.setPreferredSize(new Dimension(66, 20)); |
} |
||||||
errorMsgTextField.setPreferredSize(new Dimension(150, 20)); |
}); |
||||||
} |
|
||||||
} |
|
||||||
}); |
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
double f = TableLayout.FILL; |
new Component[]{allowBlankCheckBox, null}, |
||||||
double p = TableLayout.PREFERRED; |
new Component[]{uiLabel, errorMsgTextField}, |
||||||
Component[][] components = new Component[][]{ |
}; |
||||||
new Component[]{allowBlankCheckBox, null }, |
double[] rowSize = {p, p}; |
||||||
new Component[]{uiLabel, errorMsgTextField}, |
double[] columnSize = {p, f}; |
||||||
}; |
int[][] rowCount = {{1, 1}, {1, 1}}; |
||||||
double[] rowSize = {p, p}; |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); |
||||||
double[] columnSize = {p,f}; |
validatePane.add(panel, BorderLayout.NORTH); |
||||||
int[][] rowCount = {{1, 1},{1, 1}}; |
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); |
JPanel contentPane = this.setValidatePane(); |
||||||
validatePane.add(panel, BorderLayout.NORTH); |
if (contentPane != null) { |
||||||
|
validatePane.add(contentPane, BorderLayout.CENTER); |
||||||
JPanel contentPane = this.setValidatePane(); |
} |
||||||
if (contentPane != null) { |
|
||||||
validatePane.add(contentPane, BorderLayout.CENTER); |
|
||||||
} |
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 24, validatePane); |
||||||
|
this.add(uiExpandablePane, BorderLayout.CENTER); |
||||||
|
|
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane); |
// JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5);
|
||||||
this.add(uiExpandablePane, BorderLayout.CENTER); |
// validatePane.add(firstPane);
|
||||||
|
// JPanel secondPane = new JPanel(FRGUIPaneFactory.createLabelFlowLayout());
|
||||||
// JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5);
|
// secondPane.add(new UILabel("错误提示" + ":"));
|
||||||
// validatePane.add(firstPane);
|
// secondPane.add(errorMsgTextField);
|
||||||
// JPanel secondPane = new JPanel(FRGUIPaneFactory.createLabelFlowLayout());
|
// JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24);
|
||||||
// secondPane.add(new UILabel("错误提示" + ":"));
|
// secondPane.setPreferredSize(new Dimension(400, 23));
|
||||||
// secondPane.add(errorMsgTextField);
|
// validatePane.add(secondPane);
|
||||||
// JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24);
|
} |
||||||
// secondPane.setPreferredSize(new Dimension(400, 23));
|
|
||||||
// validatePane.add(secondPane);
|
public JPanel setValidatePane() { |
||||||
} |
return null; |
||||||
|
} |
||||||
public JPanel setValidatePane(){ |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
} |
@ -1,45 +1,70 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.event.KeyListener; |
import java.awt.*; |
||||||
|
import java.awt.event.KeyListener; |
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
import javax.swing.*; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
import javax.swing.*; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.form.ui.WaterMark; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.general.Inter; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
public class WaterMarkDictPane extends JPanel{ |
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.form.ui.WaterMark; |
||||||
private UITextField waterMarkTextField; |
import com.fr.general.Inter; |
||||||
|
|
||||||
public WaterMarkDictPane() { |
public class WaterMarkDictPane extends JPanel { |
||||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); |
private UITextField waterMarkTextField; |
||||||
this.add(new UILabel(Inter.getLocText("WaterMark") + ":")); |
|
||||||
waterMarkTextField = new UITextField(13); |
public WaterMarkDictPane() { |
||||||
this.add(waterMarkTextField); |
this.setLayout(new BorderLayout()); |
||||||
} |
|
||||||
|
// this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
|
||||||
public void populate(WaterMark waterMark) { |
// this.add(new UILabel(Inter.getLocText("WaterMark") + ":"));
|
||||||
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
waterMarkTextField = new UITextField(13); |
||||||
} |
|
||||||
public void addInputKeyListener(KeyListener kl) { |
UILabel emptyLabel = new UILabel(); |
||||||
this.waterMarkTextField.addKeyListener(kl); |
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 33, 0, 0)); |
||||||
} |
|
||||||
public void removeInputKeyListener(KeyListener kl) { |
double f = TableLayout.FILL; |
||||||
this.waterMarkTextField.removeKeyListener(kl); |
double p = TableLayout.PREFERRED; |
||||||
} |
Component[][] components = new Component[][]{ |
||||||
public void update(WaterMark waterMark) { |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), emptyLabel, waterMarkTextField}, |
||||||
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
}; |
||||||
} |
double[] rowSize = {p}; |
||||||
public void setWaterMark(String waterMark) { |
double[] columnSize = {p, p, f}; |
||||||
this.waterMarkTextField.setText(waterMark); |
int[][] rowCount = {{1, 1}}; |
||||||
} |
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
public String getWaterMark() { |
// JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
|
||||||
return this.waterMarkTextField.getText(); |
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0)); |
||||||
} |
this.add(panel, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(WaterMark waterMark) { |
||||||
|
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
||||||
|
} |
||||||
|
|
||||||
|
public void addInputKeyListener(KeyListener kl) { |
||||||
|
this.waterMarkTextField.addKeyListener(kl); |
||||||
|
} |
||||||
|
|
||||||
|
public void removeInputKeyListener(KeyListener kl) { |
||||||
|
this.waterMarkTextField.removeKeyListener(kl); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(WaterMark waterMark) { |
||||||
|
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setWaterMark(String waterMark) { |
||||||
|
this.waterMarkTextField.setText(waterMark); |
||||||
|
} |
||||||
|
|
||||||
|
public String getWaterMark() { |
||||||
|
return this.waterMarkTextField.getText(); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,77 +1,77 @@ |
|||||||
package com.fr.quickeditor.floatquick; |
package com.fr.quickeditor.floatquick; |
||||||
|
|
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
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.report.SelectImagePane; |
import com.fr.design.report.SelectImagePane; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.FloatQuickEditor; |
import com.fr.quickeditor.FloatQuickEditor; |
||||||
import com.fr.report.cell.cellattr.CellImage; |
import com.fr.report.cell.cellattr.CellImage; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
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; |
||||||
|
|
||||||
public class FloatImageQuickEditor extends FloatQuickEditor { |
public class FloatImageQuickEditor extends FloatQuickEditor { |
||||||
|
|
||||||
public FloatImageQuickEditor() { |
public FloatImageQuickEditor() { |
||||||
super(); |
super(); |
||||||
UIButton editbutton = new UIButton(Inter.getLocText("FR-Designer_Edit")); |
UIButton editbutton = new UIButton(Inter.getLocText("FR-Designer_Edit")); |
||||||
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); |
||||||
Component[][] components = new Component[][]{ |
Component[][] components = new Component[][]{ |
||||||
new Component[]{editbutton} |
new Component[]{editbutton} |
||||||
}; |
}; |
||||||
double p = TableLayout.PREFERRED; |
double p = TableLayout.PREFERRED; |
||||||
double f = TableLayout.FILL; |
double f = TableLayout.FILL; |
||||||
double[] columnSize = {f}; |
double[] columnSize = {f}; |
||||||
double[] rowSize = {p}; |
double[] rowSize = {p}; |
||||||
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
|
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10)); |
this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 17)); |
||||||
this.add(pane, BorderLayout.CENTER); |
this.add(pane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
private void showEditingDialog() { |
private void showEditingDialog() { |
||||||
final SelectImagePane imageEditorPane = new SelectImagePane(); |
final SelectImagePane imageEditorPane = new SelectImagePane(); |
||||||
imageEditorPane.populate(floatElement); |
imageEditorPane.populate(floatElement); |
||||||
final Object oldValue = floatElement.getValue(); |
final Object oldValue = floatElement.getValue(); |
||||||
final Style oldStyle = floatElement.getStyle(); |
final Style oldStyle = floatElement.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)) { |
||||||
floatElement.setValue(cellImage.getImage()); |
floatElement.setValue(cellImage.getImage()); |
||||||
floatElement.setStyle(cellImage.getStyle()); |
floatElement.setStyle(cellImage.getStyle()); |
||||||
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,127 +1,128 @@ |
|||||||
package com.fr.quickeditor.floatquick; |
package com.fr.quickeditor.floatquick; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Formula; |
import com.fr.base.Formula; |
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
import com.fr.base.TextFormat; |
import com.fr.base.TextFormat; |
||||||
import com.fr.design.file.HistoryTemplateListPane; |
import com.fr.design.file.HistoryTemplateListPane; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
import com.fr.quickeditor.FloatQuickEditor; |
import com.fr.quickeditor.FloatQuickEditor; |
||||||
import com.fr.report.ReportHelper; |
import com.fr.report.ReportHelper; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import javax.swing.event.DocumentEvent; |
import javax.swing.event.DocumentEvent; |
||||||
import javax.swing.event.DocumentListener; |
import javax.swing.event.DocumentListener; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
||||||
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
||||||
|
|
||||||
public class FloatStringQuickEditor extends FloatQuickEditor { |
public class FloatStringQuickEditor extends FloatQuickEditor { |
||||||
private JTextArea stringTextField; |
private JTextArea stringTextField; |
||||||
private UIButton formulaButton; |
private UIButton formulaButton; |
||||||
|
|
||||||
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
|
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
|
||||||
private boolean reserveInResult = false; |
private boolean reserveInResult = false; |
||||||
private boolean reserveOnWriteOrAnaly = true; |
private boolean reserveOnWriteOrAnaly = true; |
||||||
|
|
||||||
public FloatStringQuickEditor() { |
public FloatStringQuickEditor() { |
||||||
super(); |
super(); |
||||||
stringTextField = new JTextArea(); |
stringTextField = new JTextArea(); |
||||||
initTextField(); |
initTextField(); |
||||||
formulaButton = new UIButton(); |
formulaButton = new UIButton(); |
||||||
formulaButton.setPreferredSize(new Dimension(25, 23)); |
formulaButton.setPreferredSize(new Dimension(25, 23)); |
||||||
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
||||||
formulaButton.addActionListener(getFormulaActionListener); |
formulaButton.addActionListener(getFormulaActionListener); |
||||||
JPanel pane = new JPanel(new BorderLayout(5, 0)); |
JPanel pane = new JPanel(new BorderLayout(5, 0)); |
||||||
pane.add(stringTextField, BorderLayout.CENTER); |
pane.add(stringTextField, BorderLayout.CENTER); |
||||||
pane.add(formulaButton, BorderLayout.EAST); |
pane.add(formulaButton, BorderLayout.EAST); |
||||||
formulaButton.setVisible(false); |
pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,7)); |
||||||
this.setLayout(new BorderLayout()); |
formulaButton.setVisible(false); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
this.setLayout(new BorderLayout()); |
||||||
this.add(pane, BorderLayout.NORTH); |
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
} |
this.add(pane, BorderLayout.NORTH); |
||||||
|
} |
||||||
private void initTextField() { |
|
||||||
stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12)); |
private void initTextField() { |
||||||
stringTextField.setOpaque(true); |
stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12)); |
||||||
stringTextField.setLineWrap(true); |
stringTextField.setOpaque(true); |
||||||
stringTextField.setWrapStyleWord(true); |
stringTextField.setLineWrap(true); |
||||||
stringTextField.setMargin(new Insets(5, 5, 5, 5)); |
stringTextField.setWrapStyleWord(true); |
||||||
stringTextField.setBorder(BorderFactory.createLineBorder(Color.gray)); |
stringTextField.setMargin(new Insets(5, 5, 5, 5)); |
||||||
stringTextField.setBackground(Color.WHITE); |
stringTextField.setBorder(BorderFactory.createLineBorder(Color.gray)); |
||||||
} |
stringTextField.setBackground(Color.WHITE); |
||||||
|
} |
||||||
ActionListener getFormulaActionListener = new ActionListener() { |
|
||||||
@Override |
ActionListener getFormulaActionListener = new ActionListener() { |
||||||
public void actionPerformed(ActionEvent e) { |
@Override |
||||||
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing(); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing(); |
||||||
}; |
} |
||||||
|
}; |
||||||
@Override |
|
||||||
protected void refreshDetails() { |
@Override |
||||||
String str = null; |
protected void refreshDetails() { |
||||||
Object value = floatElement.getValue(); |
String str = null; |
||||||
if (value == null) { |
Object value = floatElement.getValue(); |
||||||
str = StringUtils.EMPTY; |
if (value == null) { |
||||||
} else if (value instanceof Formula) { |
str = StringUtils.EMPTY; |
||||||
//MoMeak: 没拆文本框和公式所以需要这么个玩意
|
} else if (value instanceof Formula) { |
||||||
formulaButton.setVisible(true); |
//MoMeak: 没拆文本框和公式所以需要这么个玩意
|
||||||
Formula formula = (Formula) value; |
formulaButton.setVisible(true); |
||||||
str = formula.getContent(); |
Formula formula = (Formula) value; |
||||||
stringTextField.setLineWrap(false); |
str = formula.getContent(); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10)); |
stringTextField.setLineWrap(false); |
||||||
reserveInResult = formula.isReserveInResult(); |
this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 10)); |
||||||
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); |
reserveInResult = formula.isReserveInResult(); |
||||||
} else { |
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); |
||||||
str = value.toString(); |
} else { |
||||||
} |
str = value.toString(); |
||||||
showText(str); |
} |
||||||
} |
showText(str); |
||||||
|
} |
||||||
public void showText(String str) { |
|
||||||
stringTextField.getDocument().removeDocumentListener(documentListener); |
public void showText(String str) { |
||||||
stringTextField.setText(str); |
stringTextField.getDocument().removeDocumentListener(documentListener); |
||||||
stringTextField.getDocument().addDocumentListener(documentListener); |
stringTextField.setText(str); |
||||||
} |
stringTextField.getDocument().addDocumentListener(documentListener); |
||||||
|
} |
||||||
DocumentListener documentListener = new DocumentListener() { |
|
||||||
|
DocumentListener documentListener = new DocumentListener() { |
||||||
@Override |
|
||||||
public void insertUpdate(DocumentEvent e) { |
@Override |
||||||
changeReportPaneCell(stringTextField.getText().trim()); |
public void insertUpdate(DocumentEvent e) { |
||||||
} |
changeReportPaneCell(stringTextField.getText().trim()); |
||||||
|
} |
||||||
@Override |
|
||||||
public void removeUpdate(DocumentEvent e) { |
@Override |
||||||
changeReportPaneCell(stringTextField.getText().trim()); |
public void removeUpdate(DocumentEvent e) { |
||||||
} |
changeReportPaneCell(stringTextField.getText().trim()); |
||||||
|
} |
||||||
@Override |
|
||||||
public void changedUpdate(DocumentEvent e) { |
@Override |
||||||
changeReportPaneCell(stringTextField.getText().trim()); |
public void changedUpdate(DocumentEvent e) { |
||||||
} |
changeReportPaneCell(stringTextField.getText().trim()); |
||||||
|
} |
||||||
}; |
|
||||||
|
}; |
||||||
protected void changeReportPaneCell(String tmpText) { |
|
||||||
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { |
protected void changeReportPaneCell(String tmpText) { |
||||||
Formula textFormula = new Formula(tmpText); |
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { |
||||||
textFormula.setReserveInResult(reserveInResult); |
Formula textFormula = new Formula(tmpText); |
||||||
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); |
textFormula.setReserveInResult(reserveInResult); |
||||||
floatElement.setValue(textFormula); |
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); |
||||||
} else { |
floatElement.setValue(textFormula); |
||||||
Style style = floatElement.getStyle(); |
} else { |
||||||
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { |
Style style = floatElement.getStyle(); |
||||||
floatElement.setValue(tmpText); |
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { |
||||||
} else { |
floatElement.setValue(tmpText); |
||||||
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); |
} else { |
||||||
} |
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); |
||||||
} |
} |
||||||
fireTargetModified(); |
} |
||||||
stringTextField.requestFocus(); |
fireTargetModified(); |
||||||
} |
stringTextField.requestFocus(); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,181 +1,191 @@ |
|||||||
/* |
/* |
||||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||||
*/ |
*/ |
||||||
package com.fr.design.constants; |
package com.fr.design.constants; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.stable.Constants; |
import com.fr.stable.Constants; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import javax.swing.border.Border; |
||||||
import java.awt.image.BufferedImage; |
import java.awt.*; |
||||||
|
import java.awt.image.BufferedImage; |
||||||
/** |
|
||||||
* This class defines the constants used in the designer. |
/** |
||||||
*/ |
* This class defines the constants used in the designer. |
||||||
public interface UIConstants { |
*/ |
||||||
|
public interface UIConstants { |
||||||
|
|
||||||
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); |
|
||||||
|
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); |
||||||
|
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 0); |
||||||
public static final int SIZE = 17; |
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15); |
||||||
|
|
||||||
/** |
|
||||||
* Cell default cursor. |
public static final int SIZE = 17; |
||||||
*/ |
|
||||||
public static final Cursor CELL_DEFAULT_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
public static final int GAP_NORMAL = 10; // 10px
|
||||||
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cell_default.png"), |
|
||||||
new Point(16, 16), "CellDefaultCursor"); |
/** |
||||||
public static final Cursor DRAW_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
* Cell default cursor. |
||||||
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cursor_draw.png"), |
*/ |
||||||
new Point(16, 16), "DrawCursor"); |
public static final Cursor CELL_DEFAULT_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
||||||
|
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cell_default.png"), |
||||||
|
new Point(16, 16), "CellDefaultCursor"); |
||||||
public static final Cursor FORMAT_BRUSH_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
public static final Cursor DRAW_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
||||||
BaseUtils.readImage("/com/fr/base/images/cell/cursor/brush_cursor0.png"), |
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cursor_draw.png"), |
||||||
new Point(16, 16), "formatBrushCursor"); |
new Point(16, 16), "DrawCursor"); |
||||||
|
|
||||||
/** |
|
||||||
* Border style array. |
public static final Cursor FORMAT_BRUSH_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor( |
||||||
*/ |
BaseUtils.readImage("/com/fr/base/images/cell/cursor/brush_cursor0.png"), |
||||||
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{ |
new Point(16, 16), "formatBrushCursor"); |
||||||
Constants.LINE_THIN, //Thin border.
|
|
||||||
Constants.LINE_MEDIUM, //Medium border
|
/** |
||||||
Constants.LINE_DASH, //dash border
|
* Border style array. |
||||||
Constants.LINE_HAIR, //hair-line border
|
*/ |
||||||
Constants.LINE_HAIR2, //hair-line border
|
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{ |
||||||
Constants.LINE_THICK, //Thick border
|
Constants.LINE_THIN, //Thin border.
|
||||||
Constants.LINE_DOUBLE, //double-line border
|
Constants.LINE_MEDIUM, //Medium border
|
||||||
Constants.LINE_DOT, //dot border
|
Constants.LINE_DASH, //dash border
|
||||||
Constants.LINE_MEDIUM_DASH, //Medium dashed border
|
Constants.LINE_HAIR, //hair-line border
|
||||||
Constants.LINE_DASH_DOT, //dash-dot border
|
Constants.LINE_HAIR2, //hair-line border
|
||||||
Constants.LINE_MEDIUM_DASH_DOT, //medium dash-dot border
|
Constants.LINE_THICK, //Thick border
|
||||||
Constants.LINE_DASH_DOT_DOT, //dash-dot-dot border
|
Constants.LINE_DOUBLE, //double-line border
|
||||||
Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border
|
Constants.LINE_DOT, //dot border
|
||||||
Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border
|
Constants.LINE_MEDIUM_DASH, //Medium dashed border
|
||||||
}; |
Constants.LINE_DASH_DOT, //dash-dot border
|
||||||
public static final Color LINE_COLOR = new Color(153, 153, 153); |
Constants.LINE_MEDIUM_DASH_DOT, //medium dash-dot border
|
||||||
public static final Color FONT_COLOR = new Color(51, 51, 51); |
Constants.LINE_DASH_DOT_DOT, //dash-dot-dot border
|
||||||
public static final Color LIGHT_BLUE = new Color(182, 217, 253); |
Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border
|
||||||
public static final Color SKY_BLUE = new Color(164, 192, 220); |
Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border
|
||||||
public static final Color OCEAN_BLUE = new Color(141, 179, 217); |
}; |
||||||
public static final Color DARK_BLUE = new Color(0, 88, 144); |
public static final Color LINE_COLOR = new Color(153, 153, 153); |
||||||
public static final Color NORMAL_BACKGROUND = new Color(212, 212, 216); |
public static final Color FONT_COLOR = new Color(51, 51, 51); |
||||||
public static final Color TREE_BACKGROUND = new Color(240, 240, 243); |
public static final Color LIGHT_BLUE = new Color(182, 217, 253); |
||||||
public static final Color TOOL_PANE_BACKGROUND = new Color(232, 232, 223); |
public static final Color SKY_BLUE = new Color(164, 192, 220); |
||||||
public static final Color SELECT_TAB = new Color(245, 245, 247); |
public static final Color OCEAN_BLUE = new Color(141, 179, 217); |
||||||
public static final Color TOOLBARUI_BACKGROUND = new Color(255, 255, 255); |
public static final Color DARK_BLUE = new Color(0, 88, 144); |
||||||
public static final Color SHADOW_GREY = new Color(217, 218, 221); |
public static final Color NORMAL_BACKGROUND = new Color(212, 212, 216); |
||||||
public static final Color SHADOW_CENTER = new Color(200, 200, 200); |
public static final Color TREE_BACKGROUND = new Color(240, 240, 243); |
||||||
public static final Color SHADOW_PURPLE = new Color(255, 0, 255); |
public static final Color TOOL_PANE_BACKGROUND = new Color(232, 232, 223); |
||||||
public static final Color FLESH_BLUE = new Color(65, 155, 249); |
public static final Color SELECT_TAB = new Color(245, 245, 247); |
||||||
public static final Color HOVER_BLUE = new Color(0xd2d2d2); |
public static final Color TOOLBARUI_BACKGROUND = new Color(255, 255, 255); |
||||||
public static final Color DOTTED_LINE_COLOR = new Color(35, 108, 184); |
public static final Color SHADOW_GREY = new Color(217, 218, 221); |
||||||
public static final Color AUTHORITY_COLOR = new Color(88, 125, 153); |
public static final Color SHADOW_CENTER = new Color(200, 200, 200); |
||||||
public static final Color AUTHORITY_BLUE = new Color(0xe2e2e2); |
public static final Color SHADOW_PURPLE = new Color(255, 0, 255); |
||||||
public static final Color AUTHORITY_DARK_BLUE = new Color(136, 164, 186); |
public static final Color FLESH_BLUE = new Color(65, 155, 249); |
||||||
public static final Color AUTHORITY_PRESS_BLUE = new Color(131, 159, 181); |
public static final Color HOVER_BLUE = new Color(0xd2d2d2); |
||||||
public static final Color AUTHORITY_LINE_COLOR = new Color(0, 124, 229); |
public static final Color DOTTED_LINE_COLOR = new Color(35, 108, 184); |
||||||
public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143); |
public static final Color AUTHORITY_COLOR = new Color(88, 125, 153); |
||||||
public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238); |
public static final Color AUTHORITY_BLUE = new Color(0xe2e2e2); |
||||||
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); |
public static final Color AUTHORITY_DARK_BLUE = new Color(136, 164, 186); |
||||||
public static final Color ATTRIBUTE_PRESS = new Color(0xD8F2FD); |
public static final Color AUTHORITY_PRESS_BLUE = new Color(131, 159, 181); |
||||||
public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD); |
public static final Color AUTHORITY_LINE_COLOR = new Color(0, 124, 229); |
||||||
public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD); |
public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143); |
||||||
public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0); |
public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238); |
||||||
public static final Color TEXT_FILED_BORDER_SELECTED = new Color(0x3384f0); |
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); |
||||||
public static final Color SHEET_NORMAL = new Color(0xc8c8ca); |
public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9); |
||||||
public static final Color SELECTED_BACKGROUND = new Color(0xdeedfe); |
public static final Color NORMAL_BLUE = new Color(0x419BF9); |
||||||
public static final Color SELECTED_BORDER_LINE_COLOR = new Color(0x3384f0); |
public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD); |
||||||
public static final Color DEFAULT_BG_RULER = new Color(0xffffff); |
public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD); |
||||||
public static final Color RULER_LINE_COLOR = new Color(0xababab); |
public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0); |
||||||
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); |
public static final Color TEXT_FILED_BORDER_SELECTED = new Color(0x3384f0); |
||||||
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); |
public static final Color SHEET_NORMAL = new Color(0xc8c8ca); |
||||||
|
public static final Color SELECTED_BACKGROUND = new Color(0xdeedfe); |
||||||
|
public static final Color SELECTED_BORDER_LINE_COLOR = new Color(0x3384f0); |
||||||
public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png"); |
public static final Color DEFAULT_BG_RULER = new Color(0xffffff); |
||||||
public static final BufferedImage DRAG_BAR_RIGHT = BaseUtils.readImage("com/fr/design/images/control/barm.png"); |
public static final Color RULER_LINE_COLOR = new Color(0xababab); |
||||||
public static final BufferedImage DRAG_BAR_LEFT = BaseUtils.readImage("com/fr/design/images/control/barl.png"); |
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); |
||||||
public static final BufferedImage DRAG_UP_NORMAL = BaseUtils.readImage("com/fr/design/images/control/upnor.png"); |
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); |
||||||
public static final BufferedImage DRAG_UP_PRESS = BaseUtils.readImage("com/fr/design/images/control/uppre.png"); |
public static final Color SPLIT_LINE = new Color(201, 198, 184); |
||||||
public static final BufferedImage DRAG_DOWN_NORMAL = BaseUtils.readImage("com/fr/design/images/control/downnor.png"); |
|
||||||
public static final BufferedImage DRAG_DOWN_PRESS = BaseUtils.readImage("com/fr/design/images/control/downpre.png"); |
|
||||||
public static final BufferedImage DRAG_RIGHT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/rightnor.png"); |
public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png"); |
||||||
public static final BufferedImage DRAG_RIGHT_PRESS = BaseUtils.readImage("com/fr/design/images/control/rightpre.png"); |
public static final BufferedImage DRAG_BAR_RIGHT = BaseUtils.readImage("com/fr/design/images/control/barm.png"); |
||||||
public static final BufferedImage DRAG_LEFT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/leftnor.png"); |
public static final BufferedImage DRAG_BAR_LEFT = BaseUtils.readImage("com/fr/design/images/control/barl.png"); |
||||||
public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png"); |
public static final BufferedImage DRAG_UP_NORMAL = BaseUtils.readImage("com/fr/design/images/control/upnor.png"); |
||||||
public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png"); |
public static final BufferedImage DRAG_UP_PRESS = BaseUtils.readImage("com/fr/design/images/control/uppre.png"); |
||||||
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png"); |
public static final BufferedImage DRAG_DOWN_NORMAL = BaseUtils.readImage("com/fr/design/images/control/downnor.png"); |
||||||
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png"); |
public static final BufferedImage DRAG_DOWN_PRESS = BaseUtils.readImage("com/fr/design/images/control/downpre.png"); |
||||||
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png"); |
public static final BufferedImage DRAG_RIGHT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/rightnor.png"); |
||||||
public static final int MODEL_NORMAL = 0; |
public static final BufferedImage DRAG_RIGHT_PRESS = BaseUtils.readImage("com/fr/design/images/control/rightpre.png"); |
||||||
public static final int MODEL_PRESS = 1; |
public static final BufferedImage DRAG_LEFT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/leftnor.png"); |
||||||
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); |
public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png"); |
||||||
public static final Icon ARROW_UP_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png"); |
public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png"); |
||||||
public static final Icon YES_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); |
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png"); |
||||||
public static final Icon CHOOSEN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); |
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png"); |
||||||
public static final Icon PRE_WIDGET_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); |
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png"); |
||||||
public static final Icon EDIT_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); |
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/downSelected.png"); |
||||||
public static final Icon EDIT_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); |
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png"); |
||||||
public static final Icon HIDE_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); |
public static final int MODEL_NORMAL = 0; |
||||||
public static final Icon HIDE_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hidep.png"); |
public static final int MODEL_PRESS = 1; |
||||||
public static final Icon VIEW_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewn.png"); |
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); |
||||||
public static final Icon VIEW_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewp.png"); |
public static final Icon ARROW_UP_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png"); |
||||||
public static final Icon RUN_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/run24.png"); |
public static final Icon YES_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); |
||||||
public static final Icon RUN_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/runs.png"); |
public static final Icon CHOOSEN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); |
||||||
public static final Icon PAGE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png"); |
public static final Icon PRE_WIDGET_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); |
||||||
public static final Icon WRITE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writeb24.png"); |
public static final Icon EDIT_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); |
||||||
public static final Icon ANA_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anab24.png"); |
public static final Icon EDIT_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); |
||||||
public static final Icon PAGE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pages.png"); |
public static final Icon HIDE_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); |
||||||
public static final Icon WRITE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writes.png"); |
public static final Icon HIDE_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hidep.png"); |
||||||
public static final Icon ANA_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); |
public static final Icon VIEW_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewn.png"); |
||||||
public static final Icon REFRESH_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); |
public static final Icon VIEW_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewp.png"); |
||||||
public static final Icon FONT_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); |
public static final Icon RUN_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/run24.png"); |
||||||
public static final Icon HISTORY_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/history.png"); |
public static final Icon RUN_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/runs.png"); |
||||||
public static final Icon DELETE_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/close.png"); |
public static final Icon PAGE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png"); |
||||||
public static final Icon EDIT_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/edit.png"); |
public static final Icon WRITE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writeb24.png"); |
||||||
public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png"); |
public static final Icon ANA_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anab24.png"); |
||||||
public static final Icon CLEAR_ICON = BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png"); |
public static final Icon PAGE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pages.png"); |
||||||
public static final Icon LIST_EDIT_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png"); |
public static final Icon WRITE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writes.png"); |
||||||
public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png"); |
public static final Icon ANA_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); |
||||||
public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127); |
public static final Icon REFRESH_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); |
||||||
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45); |
public static final Icon FONT_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); |
||||||
public static final Color BARNOMAL = new Color(232, 232, 233); |
public static final Icon HISTORY_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/history.png"); |
||||||
public static final int ARC = 0; |
public static final Icon DELETE_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/close.png"); |
||||||
public static final int BUTTON_GROUP_ARC = 6; |
public static final Icon EDIT_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/edit.png"); |
||||||
public static final int LARGEARC = 6; |
public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png"); |
||||||
public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0); |
public static final Icon CLEAR_ICON = BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png"); |
||||||
public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png"); |
public static final Icon LIST_EDIT_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png"); |
||||||
public static final Icon CLOSE_OF_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close.png"); |
public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit_white.png"); |
||||||
public static final Icon CLOSE_OVER_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_over.png"); |
public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127); |
||||||
public static final Icon CLOSE_PRESS_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_press.png"); |
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45); |
||||||
public static final int CLOSE_AUTHORITY_HEIGHT_AND_WIDTH = 24; |
public static final Color BARNOMAL = new Color(232, 232, 233); |
||||||
|
public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238); |
||||||
|
public static final int ARC = 0; |
||||||
/** |
public static final int BUTTON_GROUP_ARC = 6; |
||||||
* 正在加载的界面 |
public static final int LARGEARC = 6; |
||||||
*/ |
public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0); |
||||||
public static final Object PENDING = new Object() { |
public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png"); |
||||||
|
public static final Icon CLOSE_OF_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close.png"); |
||||||
@Override |
public static final Icon CLOSE_OVER_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_over.png"); |
||||||
public String toString() { |
public static final Icon CLOSE_PRESS_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_press.png"); |
||||||
return Inter.getLocText("Loading") + "..."; |
public static final int CLOSE_AUTHORITY_HEIGHT_AND_WIDTH = 24; |
||||||
} |
|
||||||
}; |
|
||||||
/** |
/** |
||||||
* 数据库连接失败的界面 |
* 正在加载的界面 |
||||||
*/ |
*/ |
||||||
public static final Object CONNECTION_FAILED = new Object() { |
public static final Object PENDING = new Object() { |
||||||
|
|
||||||
public String toString() { |
@Override |
||||||
return Inter.getLocText(new String[]{"Database", "Datasource-Connection_failed"}) + "!"; |
public String toString() { |
||||||
} |
return Inter.getLocText("Loading") + "..."; |
||||||
}; |
} |
||||||
|
}; |
||||||
/** |
/** |
||||||
* 自动补全的默认快捷键,一般来说是 alt + /. |
* 数据库连接失败的界面 |
||||||
*/ |
*/ |
||||||
public static final String DEFAULT_AUTO_COMPLETE = "alt + SLASH"; |
public static final Object CONNECTION_FAILED = new Object() { |
||||||
|
|
||||||
|
public String toString() { |
||||||
|
return Inter.getLocText(new String[]{"Database", "Datasource-Connection_failed"}) + "!"; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
/** |
||||||
|
* 自动补全的默认快捷键,一般来说是 alt + /. |
||||||
|
*/ |
||||||
|
public static final String DEFAULT_AUTO_COMPLETE = "alt + SLASH"; |
||||||
} |
} |
@ -1,144 +1,136 @@ |
|||||||
package com.fr.design.formula; |
package com.fr.design.formula; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Formula; |
import com.fr.base.Formula; |
||||||
import com.fr.design.beans.BasicBeanPane; |
import com.fr.design.beans.BasicBeanPane; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
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.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
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.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
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; |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
* @author zhou |
* @author zhou |
||||||
* @since 2012-6-1下午3:50:37 |
* @since 2012-6-1下午3:50:37 |
||||||
*/ |
*/ |
||||||
public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver{ |
public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver{ |
||||||
|
|
||||||
private static final long serialVersionUID = 1L; |
private static final long serialVersionUID = 1L; |
||||||
protected UITextField formulaTextField; |
protected UITextField formulaTextField; |
||||||
protected UIButton formulaTextFieldButton; |
protected UIButton formulaTextFieldButton; |
||||||
|
|
||||||
public TinyFormulaPane() { |
public TinyFormulaPane() { |
||||||
this.initComponents(); |
this.initComponents(); |
||||||
} |
} |
||||||
|
|
||||||
protected void initComponents() { |
protected void initComponents() { |
||||||
|
|
||||||
formulaTextField = new UITextField(); |
formulaTextField = new UITextField(); |
||||||
formulaTextField.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand")); |
formulaTextField.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand")); |
||||||
|
|
||||||
// 添加一公式编辑器按钮
|
// 添加一公式编辑器按钮
|
||||||
formulaTextFieldButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
formulaTextFieldButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
||||||
formulaTextFieldButton.setToolTipText(Inter.getLocText("FR-Designer_Formula") + "..."); |
formulaTextFieldButton.setToolTipText(Inter.getLocText("FR-Designer_Formula") + "..."); |
||||||
formulaTextFieldButton.setPreferredSize(new Dimension(24, 20)); |
formulaTextFieldButton.setPreferredSize(new Dimension(24, 20)); |
||||||
formulaTextFieldButton.setOpaque(false); |
formulaTextFieldButton.setOpaque(false); |
||||||
formulaTextFieldButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
formulaTextFieldButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
||||||
formulaTextFieldButton.addActionListener(new ActionListener() { |
formulaTextFieldButton.addActionListener(new ActionListener() { |
||||||
public void actionPerformed(ActionEvent evt) { |
public void actionPerformed(ActionEvent evt) { |
||||||
String text = formulaTextField.getText(); |
String text = formulaTextField.getText(); |
||||||
|
|
||||||
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
||||||
formulaPane.populate(new Formula(text)); |
formulaPane.populate(new Formula(text)); |
||||||
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
Formula fm = formulaPane.update(); |
Formula fm = formulaPane.update(); |
||||||
populateTextField(fm); |
populateTextField(fm); |
||||||
okEvent(); |
okEvent(); |
||||||
} |
} |
||||||
}).setVisible(true); |
}).setVisible(true); |
||||||
} |
} |
||||||
}); |
}); |
||||||
initLayout(); |
initLayout(); |
||||||
} |
} |
||||||
|
|
||||||
protected void populateTextField(Formula fm) { |
protected void populateTextField(Formula fm) { |
||||||
if (fm.getContent().length() <= 1) { |
if (fm.getContent().length() <= 1) { |
||||||
formulaTextField.setText("$$$"); |
formulaTextField.setText("$$$"); |
||||||
} else { |
} else { |
||||||
formulaTextField.setText(fm.getContent()); |
formulaTextField.setText(fm.getContent()); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
protected void initLayout() { |
protected void initLayout() { |
||||||
double p = TableLayout.PREFERRED; |
double p = TableLayout.PREFERRED; |
||||||
double f = TableLayout.FILL; |
double f = TableLayout.FILL; |
||||||
double[] columnSize = {f }; |
JPanel pane = new JPanel(new BorderLayout(0,0)); |
||||||
double[] rowSize = { p }; |
JPanel pane1 = new JPanel(new BorderLayout(0,0)); |
||||||
|
pane1.add(formulaTextField, BorderLayout.NORTH); |
||||||
Component[] components1 = new Component[]{ |
pane1.setBorder(BorderFactory.createEmptyBorder(0,0,0,5)); |
||||||
formulaTextFieldButton |
pane.add(pane1,BorderLayout.CENTER); |
||||||
} ; |
pane.add(formulaTextFieldButton,BorderLayout.EAST); |
||||||
JPanel pane = new JPanel(new BorderLayout(0,0)); |
|
||||||
pane.add(formulaTextField,BorderLayout.CENTER); |
this.setLayout(new BorderLayout()); |
||||||
pane.add(GUICoreUtils.createFlowPane(components1,FlowLayout.LEFT, LayoutConstants.HGAP_LARGE),BorderLayout.EAST); |
this.add(pane,BorderLayout.NORTH) ; |
||||||
|
} |
||||||
Component[][] components2 = new Component[][]{ |
|
||||||
new Component[]{pane} |
/** |
||||||
}; |
* 公式窗口点击确定后的事件接口 |
||||||
|
*/ |
||||||
JPanel panel= TableLayoutHelper.createTableLayoutPane(components2,rowSize,columnSize) ; |
public void okEvent() { |
||||||
this.setLayout(new BorderLayout()); |
|
||||||
this.add(panel,BorderLayout.CENTER) ; |
} |
||||||
} |
|
||||||
|
public UITextField getUITextField() { |
||||||
/** |
return formulaTextField; |
||||||
* 公式窗口点击确定后的事件接口 |
} |
||||||
*/ |
|
||||||
public void okEvent() { |
@Override |
||||||
|
public void populateBean(String ob) { |
||||||
} |
this.formulaTextField.setText(ob); |
||||||
|
} |
||||||
public UITextField getUITextField() { |
|
||||||
return formulaTextField; |
@Override |
||||||
} |
public String updateBean() { |
||||||
|
return formulaTextField.getText().trim(); |
||||||
@Override |
} |
||||||
public void populateBean(String ob) { |
|
||||||
this.formulaTextField.setText(ob); |
@Override |
||||||
} |
protected String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Present-Formula_Present"); |
||||||
@Override |
} |
||||||
public String updateBean() { |
|
||||||
return formulaTextField.getText().trim(); |
@Override |
||||||
} |
public Dimension getPreferredSize() { |
||||||
|
return new Dimension(super.getPreferredSize().width, 20); |
||||||
@Override |
} |
||||||
protected String title4PopupWindow() { |
|
||||||
return Inter.getLocText("Present-Formula_Present"); |
@Override |
||||||
} |
public void registerChangeListener(UIObserverListener listener) { |
||||||
|
if(formulaTextField != null) { |
||||||
@Override |
formulaTextField.registerChangeListener(listener); |
||||||
public Dimension getPreferredSize() { |
} |
||||||
return new Dimension(super.getPreferredSize().width, 20); |
if(formulaTextFieldButton != null) { |
||||||
} |
formulaTextFieldButton.registerChangeListener(listener); |
||||||
|
} |
||||||
@Override |
} |
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
if(formulaTextField != null) { |
@Override |
||||||
formulaTextField.registerChangeListener(listener); |
public boolean shouldResponseChangeListener() { |
||||||
} |
return true; |
||||||
if(formulaTextFieldButton != null) { |
} |
||||||
formulaTextFieldButton.registerChangeListener(listener); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
File diff suppressed because it is too large
Load Diff
@ -1,398 +1,403 @@ |
|||||||
package com.fr.design.gui.style; |
package com.fr.design.gui.style; |
||||||
|
|
||||||
import com.fr.base.CoreDecimalFormat; |
import com.fr.base.CoreDecimalFormat; |
||||||
import com.fr.base.GraphHelper; |
import com.fr.base.GraphHelper; |
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
import com.fr.base.TextFormat; |
import com.fr.base.TextFormat; |
||||||
import com.fr.data.core.FormatField; |
import com.fr.data.core.FormatField; |
||||||
import com.fr.data.core.FormatField.FormatContents; |
import com.fr.data.core.FormatField.FormatContents; |
||||||
import com.fr.design.border.UIRoundedBorder; |
import com.fr.design.border.UIRoundedBorder; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.design.constants.UIConstants; |
||||||
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.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.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; |
||||||
|
|
||||||
import javax.swing.*; |
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.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
import java.text.Format; |
import java.text.Format; |
||||||
import java.text.SimpleDateFormat; |
import java.text.SimpleDateFormat; |
||||||
|
|
||||||
/** |
/** |
||||||
* Format pane to edit java.text.Format. |
* Format pane to edit java.text.Format. |
||||||
* |
* |
||||||
* @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; |
||||||
private static final int LABLE_Y = 18; |
private static final int LABLE_Y = 18; |
||||||
private static final int LABLE_DELTA_WIDTH = 8; |
private static final int LABLE_DELTA_WIDTH = 8; |
||||||
private static final int LABLE_HEIGHT = 15; //标签背景的范围
|
private static final int LABLE_HEIGHT = 15; //标签背景的范围
|
||||||
private static final int CURRENCY_FLAG_POINT = 6; |
private static final int CURRENCY_FLAG_POINT = 6; |
||||||
|
|
||||||
private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC, |
private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC, |
||||||
FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; |
FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; |
||||||
|
|
||||||
private static final Integer[] DATETYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME,}; |
private static final Integer[] DATETYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME,}; |
||||||
|
|
||||||
private Format format; |
private Format format; |
||||||
|
|
||||||
private UIComboBox typeComboBox; |
private UIComboBox typeComboBox; |
||||||
private UIComboBox textField; |
private UIComboBox textField; |
||||||
private UILabel sampleLabel; |
private UILabel sampleLabel; |
||||||
private JPanel contentPane; |
private JPanel contentPane; |
||||||
private JPanel txtCenterPane; |
private JPanel txtCenterPane; |
||||||
private JPanel centerPane; |
private JPanel centerPane; |
||||||
private JPanel formatFontPane; |
private JPanel formatFontPane; |
||||||
private FRFontPane frFontPane; |
private FRFontPane frFontPane; |
||||||
private boolean isRightFormate; |
private boolean isRightFormate; |
||||||
private boolean isDate = false; |
private boolean isDate = false; |
||||||
private boolean isFormat = false; |
private boolean isFormat = false; |
||||||
|
|
||||||
/** |
/** |
||||||
* Constructor. |
* Constructor. |
||||||
*/ |
*/ |
||||||
public FormatPane() { |
public FormatPane() { |
||||||
this.initComponents(TYPES); |
this.initComponents(TYPES); |
||||||
} |
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); |
||||||
|
} |
||||||
protected void initComponents(Integer[] types) { |
|
||||||
this.setLayout(new BorderLayout(0, 4)); |
protected void initComponents(Integer[] types) { |
||||||
iniSampleLable(); |
this.setLayout(new BorderLayout(0, 4)); |
||||||
contentPane = new JPanel(new BorderLayout(0, 4)) { |
iniSampleLable(); |
||||||
@Override |
contentPane = new JPanel(new BorderLayout(0, 4)) { |
||||||
public Dimension getPreferredSize() { |
@Override |
||||||
return new Dimension(super.getPreferredSize().width, 70); |
public Dimension getPreferredSize() { |
||||||
} |
return new Dimension(super.getPreferredSize().width, 70); |
||||||
}; |
} |
||||||
typeComboBox = new UIComboBox(types); |
}; |
||||||
UIComboBoxRenderer render = createComBoxRender(); |
typeComboBox = new UIComboBox(types); |
||||||
typeComboBox.setRenderer(render); |
UIComboBoxRenderer render = createComBoxRender(); |
||||||
typeComboBox.addItemListener(itemListener); |
typeComboBox.setRenderer(render); |
||||||
contentPane.add(sampleLabel, BorderLayout.NORTH); |
typeComboBox.addItemListener(itemListener); |
||||||
centerPane = new JPanel(new CardLayout()); |
contentPane.add(sampleLabel, BorderLayout.NORTH); |
||||||
centerPane.add(new JPanel(), "hide"); |
centerPane = new JPanel(new CardLayout()); |
||||||
centerPane.setPreferredSize(new Dimension(0, 0)); |
centerPane.add(new JPanel(), "hide"); |
||||||
centerPane.add(contentPane, "show"); |
centerPane.setPreferredSize(new Dimension(0, 0)); |
||||||
formatFontPane = new JPanel(new BorderLayout()); |
centerPane.add(contentPane, "show"); |
||||||
formatFontPane.add(centerPane, BorderLayout.NORTH); |
formatFontPane = new JPanel(new BorderLayout()); |
||||||
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER); |
formatFontPane.add(centerPane, BorderLayout.NORTH); |
||||||
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER); |
||||||
contentPane.add(txtCenterPane, BorderLayout.CENTER); |
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); |
contentPane.add(txtCenterPane, BorderLayout.CENTER); |
||||||
textField.addItemListener(textFieldItemListener); |
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); |
||||||
textField.setEditable(true); |
textField.addItemListener(textFieldItemListener); |
||||||
txtCenterPane.add(textField, BorderLayout.NORTH); |
textField.setEditable(true); |
||||||
frFontPane = new FRFontPane(); |
txtCenterPane.add(textField, BorderLayout.NORTH); |
||||||
double f = TableLayout.FILL; |
frFontPane = new FRFontPane(); |
||||||
double p = TableLayout.PREFERRED; |
UILabel font = new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT); |
||||||
Component[][] components = new Component[][]{ |
JPanel fontPane = new JPanel(new BorderLayout()); |
||||||
new Component[]{null, null}, |
fontPane.add(font, BorderLayout.NORTH); |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox}, |
|
||||||
new Component[]{null, centerPane}, |
double f = TableLayout.FILL; |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane}, |
double p = TableLayout.PREFERRED; |
||||||
new Component[]{null, null} |
Component[][] components = new Component[][]{ |
||||||
}; |
new Component[]{null, null}, |
||||||
double[] rowSize = {p, p, p, p, p}; |
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox}, |
||||||
double[] columnSize = {p, f}; |
new Component[]{null, centerPane}, |
||||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 3}, {1, 1}}; |
new Component[]{fontPane, frFontPane}, |
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); |
new Component[]{null, null} |
||||||
this.add(panel, BorderLayout.CENTER); |
}; |
||||||
} |
double[] rowSize = {p, p, p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
protected UIComboBoxRenderer createComBoxRender() { |
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 3}, {1, 1}}; |
||||||
return new UIComboBoxRenderer() { |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); |
||||||
@Override |
this.add(panel, BorderLayout.CENTER); |
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
} |
||||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
||||||
if (value instanceof Integer) { |
protected UIComboBoxRenderer createComBoxRender() { |
||||||
label.setText(" " + FormatField.getInstance().getName((Integer) value)); |
return new UIComboBoxRenderer() { |
||||||
} |
@Override |
||||||
return label; |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
} |
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
}; |
if (value instanceof Integer) { |
||||||
} |
label.setText(" " + FormatField.getInstance().getName((Integer) value)); |
||||||
|
} |
||||||
private void iniSampleLable() { |
return label; |
||||||
Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); |
} |
||||||
Font tmpFont = null; |
}; |
||||||
Border border = BorderFactory.createTitledBorder(innterborder, Inter.getLocText("FR-Base_StyleFormat_Sample"), TitledBorder.LEFT, 0, tmpFont, UIConstants.LINE_COLOR); |
} |
||||||
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { |
|
||||||
|
private void iniSampleLable() { |
||||||
@Override |
Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); |
||||||
public void paint(Graphics g) { |
Font tmpFont = null; |
||||||
super.paint(g); |
Border border = BorderFactory.createTitledBorder(innterborder, Inter.getLocText("FR-Base_StyleFormat_Sample"), TitledBorder.LEFT, 0, tmpFont, UIConstants.LINE_COLOR); |
||||||
int width = getWidth(); |
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { |
||||||
Color orignal = g.getColor(); |
|
||||||
g.setColor(getBackground()); |
@Override |
||||||
g.fillRect(LABLE_X, LABLE_Y, width - LABLE_DELTA_WIDTH, LABLE_HEIGHT); |
public void paint(Graphics g) { |
||||||
g.setColor(UIConstants.LINE_COLOR); |
super.paint(g); |
||||||
FontMetrics cellFM = g.getFontMetrics(); |
int width = getWidth(); |
||||||
int textWidth = cellFM.stringWidth(getText()); |
Color orignal = g.getColor(); |
||||||
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); |
g.setColor(getBackground()); |
||||||
g.setColor(orignal); |
g.fillRect(LABLE_X, LABLE_Y, width - LABLE_DELTA_WIDTH, LABLE_HEIGHT); |
||||||
} |
g.setColor(UIConstants.LINE_COLOR); |
||||||
}; |
FontMetrics cellFM = g.getFontMetrics(); |
||||||
sampleLabel.setHorizontalAlignment(UILabel.CENTER); |
int textWidth = cellFM.stringWidth(getText()); |
||||||
sampleLabel.setBorder(border); |
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); |
||||||
} |
g.setColor(orignal); |
||||||
|
} |
||||||
|
}; |
||||||
@Override |
sampleLabel.setHorizontalAlignment(UILabel.CENTER); |
||||||
/** |
sampleLabel.setBorder(border); |
||||||
* 得到合适的大小 |
} |
||||||
*/ |
|
||||||
public Dimension getPreferredSize() { |
|
||||||
if (this.typeComboBox.getSelectedIndex() == FormatContents.NULL) { |
@Override |
||||||
return typeComboBox.getPreferredSize(); |
/** |
||||||
} |
* 得到合适的大小 |
||||||
return super.getPreferredSize(); |
*/ |
||||||
} |
public Dimension getPreferredSize() { |
||||||
|
if (this.typeComboBox.getSelectedIndex() == FormatContents.NULL) { |
||||||
/** |
return typeComboBox.getPreferredSize(); |
||||||
* 弹出框标题 |
} |
||||||
* |
return super.getPreferredSize(); |
||||||
* @return 标题 |
} |
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
/** |
||||||
return Inter.getLocText("FR-Designer_Text"); |
* 弹出框标题 |
||||||
} |
* |
||||||
|
* @return 标题 |
||||||
/** |
*/ |
||||||
* Populate |
public String title4PopupWindow() { |
||||||
*/ |
return Inter.getLocText("FR-Designer_Text"); |
||||||
public void populateBean(Format format) { |
} |
||||||
this.format = format; |
|
||||||
|
/** |
||||||
if (format == null) { |
* Populate |
||||||
this.typeComboBox.setSelectedIndex(FormatContents.NULL); |
*/ |
||||||
} else { |
public void populateBean(Format format) { |
||||||
if (format instanceof CoreDecimalFormat) { |
this.format = format; |
||||||
// check all value
|
|
||||||
String pattern = ((CoreDecimalFormat) format).toPattern(); |
if (format == null) { |
||||||
boolean isCurrency1 = (pattern.length() > 0 && pattern.charAt(0) == '¤'); |
this.typeComboBox.setSelectedIndex(FormatContents.NULL); |
||||||
boolean isCurrency2 = (pattern.length() > 0 && pattern.charAt(0) == '$'); |
} else { |
||||||
boolean isCurrency = isCurrency1 || isCurrency2; |
if (format instanceof CoreDecimalFormat) { |
||||||
boolean isCurrency4 = (pattern.length() > CURRENCY_FLAG_POINT && ComparatorUtils.equals(pattern.substring(0, CURRENCY_FLAG_POINT), "#,##0;")); |
// check all value
|
||||||
if (isCurrency || isCurrency4) { |
String pattern = ((CoreDecimalFormat) format).toPattern(); |
||||||
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern); |
boolean isCurrency1 = (pattern.length() > 0 && pattern.charAt(0) == '¤'); |
||||||
} else if (pattern.endsWith("%")) { |
boolean isCurrency2 = (pattern.length() > 0 && pattern.charAt(0) == '$'); |
||||||
setPatternComboBoxAndList(FormatContents.PERCENT, pattern); |
boolean isCurrency = isCurrency1 || isCurrency2; |
||||||
} else if (pattern.indexOf("E") > 0) { |
boolean isCurrency4 = (pattern.length() > CURRENCY_FLAG_POINT && ComparatorUtils.equals(pattern.substring(0, CURRENCY_FLAG_POINT), "#,##0;")); |
||||||
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern); |
if (isCurrency || isCurrency4) { |
||||||
} else { |
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern); |
||||||
setPatternComboBoxAndList(FormatContents.NUMBER, pattern); |
} else if (pattern.endsWith("%")) { |
||||||
} |
setPatternComboBoxAndList(FormatContents.PERCENT, pattern); |
||||||
} else if (format instanceof SimpleDateFormat) { // date and time
|
} else if (pattern.indexOf("E") > 0) { |
||||||
String pattern = ((SimpleDateFormat) format).toPattern(); |
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern); |
||||||
if (!isTimeType(pattern)) { |
} else { |
||||||
setPatternComboBoxAndList(FormatContents.DATE, pattern); |
setPatternComboBoxAndList(FormatContents.NUMBER, pattern); |
||||||
} else { |
} |
||||||
setPatternComboBoxAndList(FormatContents.TIME, pattern); |
} else if (format instanceof SimpleDateFormat) { // date and time
|
||||||
} |
String pattern = ((SimpleDateFormat) format).toPattern(); |
||||||
} else if (format instanceof TextFormat) { // Text
|
if (!isTimeType(pattern)) { |
||||||
this.typeComboBox.setSelectedItem(FormatContents.TEXT); |
setPatternComboBoxAndList(FormatContents.DATE, pattern); |
||||||
} |
} else { |
||||||
} |
setPatternComboBoxAndList(FormatContents.TIME, pattern); |
||||||
} |
} |
||||||
|
} else if (format instanceof TextFormat) { // Text
|
||||||
|
this.typeComboBox.setSelectedItem(FormatContents.TEXT); |
||||||
/** |
} |
||||||
* 判断是否是数组有模式 |
} |
||||||
* |
} |
||||||
* @param stringArray 字符串数组 |
|
||||||
* @param pattern 格式 |
|
||||||
* @return 是否是数组有模式 |
/** |
||||||
*/ |
* 判断是否是数组有模式 |
||||||
public static int isArrayContainPattern(String[] stringArray, String pattern) { |
* |
||||||
for (int i = 0; i < stringArray.length; i++) { |
* @param stringArray 字符串数组 |
||||||
if (ComparatorUtils.equals(stringArray[i], pattern)) { |
* @param pattern 格式 |
||||||
return i; |
* @return 是否是数组有模式 |
||||||
} |
*/ |
||||||
} |
public static int isArrayContainPattern(String[] stringArray, String pattern) { |
||||||
|
for (int i = 0; i < stringArray.length; i++) { |
||||||
return -1; |
if (ComparatorUtils.equals(stringArray[i], pattern)) { |
||||||
} |
return i; |
||||||
|
} |
||||||
private void setPatternComboBoxAndList(int formatStyle, String pattern) { |
} |
||||||
this.typeComboBox.setSelectedItem(formatStyle); |
|
||||||
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern); |
return -1; |
||||||
if (i == -1) { |
} |
||||||
this.textField.setSelectedIndex(0); |
|
||||||
} else { |
private void setPatternComboBoxAndList(int formatStyle, String pattern) { |
||||||
this.textField.setSelectedIndex(i); |
this.typeComboBox.setSelectedItem(formatStyle); |
||||||
} |
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern); |
||||||
} |
if (i == -1) { |
||||||
|
this.textField.setSelectedIndex(0); |
||||||
private boolean isTimeType(String pattern) { |
} else { |
||||||
return pattern.matches(".*[Hhmsa].*"); |
this.textField.setSelectedIndex(i); |
||||||
} |
} |
||||||
|
} |
||||||
/** |
|
||||||
* update |
private boolean isTimeType(String pattern) { |
||||||
*/ |
return pattern.matches(".*[Hhmsa].*"); |
||||||
public Format update() { |
} |
||||||
String patternString = String.valueOf(textField.getSelectedItem()); |
|
||||||
if (getFormatContents() == FormatContents.TEXT) { |
/** |
||||||
return FormatField.getInstance().getFormat(getFormatContents(), patternString); |
* update |
||||||
} |
*/ |
||||||
if (isRightFormate) { |
public Format update() { |
||||||
if (StringUtils.isNotEmpty(patternString)) { |
String patternString = String.valueOf(textField.getSelectedItem()); |
||||||
return FormatField.getInstance().getFormat(getFormatContents(), patternString); |
if (getFormatContents() == FormatContents.TEXT) { |
||||||
} |
return FormatField.getInstance().getFormat(getFormatContents(), patternString); |
||||||
} |
} |
||||||
return null; |
if (isRightFormate) { |
||||||
} |
if (StringUtils.isNotEmpty(patternString)) { |
||||||
|
return FormatField.getInstance().getFormat(getFormatContents(), patternString); |
||||||
private int getFormatContents() { |
} |
||||||
return (Integer) typeComboBox.getSelectedItem(); |
} |
||||||
} |
return null; |
||||||
|
} |
||||||
/** |
|
||||||
* Refresh preview label. |
private int getFormatContents() { |
||||||
*/ |
return (Integer) typeComboBox.getSelectedItem(); |
||||||
private void refreshPreviewLabel() { |
} |
||||||
this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); |
|
||||||
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); |
/** |
||||||
try { |
* Refresh preview label. |
||||||
isRightFormate = true; |
*/ |
||||||
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { |
private void refreshPreviewLabel() { |
||||||
return; |
this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); |
||||||
} |
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); |
||||||
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem()))); |
try { |
||||||
} catch (Exception e) { |
isRightFormate = true; |
||||||
this.sampleLabel.setForeground(Color.red); |
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { |
||||||
this.sampleLabel.setText(e.getMessage()); |
return; |
||||||
isRightFormate = false; |
} |
||||||
} |
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem()))); |
||||||
} |
} catch (Exception e) { |
||||||
|
this.sampleLabel.setForeground(Color.red); |
||||||
private boolean isTextOrNull() { |
this.sampleLabel.setText(e.getMessage()); |
||||||
int contents = getFormatContents(); |
isRightFormate = false; |
||||||
return contents == FormatContents.TEXT || contents == FormatContents.NULL; |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
private boolean isTextOrNull() { |
||||||
* Radio selection listener. |
int contents = getFormatContents(); |
||||||
*/ |
return contents == FormatContents.TEXT || contents == FormatContents.NULL; |
||||||
ItemListener itemListener = new ItemListener() { |
} |
||||||
|
|
||||||
@Override |
/** |
||||||
public void itemStateChanged(ItemEvent e) { |
* Radio selection listener. |
||||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
*/ |
||||||
int contents = getFormatContents(); |
ItemListener itemListener = new ItemListener() { |
||||||
String[] items = FormatField.getInstance().getFormatArray(contents); |
|
||||||
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); |
@Override |
||||||
|
public void itemStateChanged(ItemEvent e) { |
||||||
if (isTextOrNull()) { |
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
centerPane.setPreferredSize(new Dimension(0, 0)); |
int contents = getFormatContents(); |
||||||
cardLayout.show(centerPane, "hide"); |
String[] items = FormatField.getInstance().getFormatArray(contents); |
||||||
} else { |
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); |
||||||
textField.removeAllItems(); |
|
||||||
for (int i = 0; i < items.length; i++) { |
if (isTextOrNull()) { |
||||||
textField.addItem(items[i]); |
centerPane.setPreferredSize(new Dimension(0, 0)); |
||||||
} |
cardLayout.show(centerPane, "hide"); |
||||||
centerPane.setPreferredSize(new Dimension(270, 70)); |
} else { |
||||||
cardLayout.show(centerPane, "show"); |
textField.removeAllItems(); |
||||||
} |
for (int i = 0; i < items.length; i++) { |
||||||
isFormat = true; |
textField.addItem(items[i]); |
||||||
} |
} |
||||||
|
centerPane.setPreferredSize(new Dimension(270, 70)); |
||||||
} |
cardLayout.show(centerPane, "show"); |
||||||
}; |
} |
||||||
|
isFormat = true; |
||||||
ItemListener textFieldItemListener = new ItemListener() { |
} |
||||||
@Override |
|
||||||
public void itemStateChanged(ItemEvent e) { |
} |
||||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
}; |
||||||
isFormat = true; |
|
||||||
refreshPreviewLabel(); |
ItemListener textFieldItemListener = new ItemListener() { |
||||||
} |
@Override |
||||||
} |
public void itemStateChanged(ItemEvent e) { |
||||||
}; |
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
|
isFormat = true; |
||||||
@Override |
refreshPreviewLabel(); |
||||||
/** |
} |
||||||
* populate |
} |
||||||
*/ |
}; |
||||||
public void populateBean(Style style) { |
|
||||||
this.populateBean(style.getFormat()); |
@Override |
||||||
isFormat = false; |
/** |
||||||
this.frFontPane.populateBean(style.getFRFont()); |
* populate |
||||||
} |
*/ |
||||||
|
public void populateBean(Style style) { |
||||||
@Override |
this.populateBean(style.getFormat()); |
||||||
/** |
isFormat = false; |
||||||
* update |
this.frFontPane.populateBean(style.getFRFont()); |
||||||
*/ |
} |
||||||
public Style update(Style style) { |
|
||||||
if (isFormat) { |
@Override |
||||||
isFormat = false; |
/** |
||||||
return style.deriveFormat(this.update()); |
* update |
||||||
} else { |
*/ |
||||||
return style.deriveFRFont(this.frFontPane.update(style.getFRFont())); |
public Style update(Style style) { |
||||||
} |
if (isFormat) { |
||||||
} |
isFormat = false; |
||||||
|
return style.deriveFormat(this.update()); |
||||||
/** |
} else { |
||||||
* 默认只显示百分比的编辑下拉. |
return style.deriveFRFont(this.frFontPane.update(style.getFRFont())); |
||||||
*/ |
} |
||||||
public void justUsePercentFormat() { |
} |
||||||
typeComboBox.setEnabled(false); |
|
||||||
this.typeComboBox.setSelectedItem(FormatContents.PERCENT); |
/** |
||||||
} |
* 默认只显示百分比的编辑下拉. |
||||||
|
*/ |
||||||
public void setForDataSheet() { |
public void justUsePercentFormat() { |
||||||
Integer[] otherTypes = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC,}; |
typeComboBox.setEnabled(false); |
||||||
this.typeComboBox = new UIComboBox(otherTypes); |
this.typeComboBox.setSelectedItem(FormatContents.PERCENT); |
||||||
UIComboBoxRenderer render = new UIComboBoxRenderer() { |
} |
||||||
@Override |
|
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
public void setForDataSheet() { |
||||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
Integer[] otherTypes = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC,}; |
||||||
if (value instanceof Integer) { |
this.typeComboBox = new UIComboBox(otherTypes); |
||||||
label.setText(" " + FormatField.getInstance().getName((Integer) value)); |
UIComboBoxRenderer render = new UIComboBoxRenderer() { |
||||||
} |
@Override |
||||||
return label; |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
} |
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
}; |
if (value instanceof Integer) { |
||||||
typeComboBox.setRenderer(render); |
label.setText(" " + FormatField.getInstance().getName((Integer) value)); |
||||||
typeComboBox.addItemListener(itemListener); |
} |
||||||
this.add(typeComboBox, BorderLayout.NORTH); |
return label; |
||||||
} |
} |
||||||
|
}; |
||||||
public void setComboBoxModel(boolean isDate) { |
typeComboBox.setRenderer(render); |
||||||
if (this.isDate != isDate) { |
typeComboBox.addItemListener(itemListener); |
||||||
this.isDate = isDate; |
this.add(typeComboBox, BorderLayout.NORTH); |
||||||
this.typeComboBox.setSelectedIndex(0); |
} |
||||||
if (isDate) { |
|
||||||
for (int i = 0; i < DATETYPES.length; i++) { |
public void setComboBoxModel(boolean isDate) { |
||||||
this.typeComboBox.addItem(DATETYPES[i]); |
if (this.isDate != isDate) { |
||||||
} |
this.isDate = isDate; |
||||||
for (int i = 0; i < TYPES.length; i++) { |
this.typeComboBox.setSelectedIndex(0); |
||||||
this.typeComboBox.removeItemAt(1); |
if (isDate) { |
||||||
} |
for (int i = 0; i < DATETYPES.length; i++) { |
||||||
} else { |
this.typeComboBox.addItem(DATETYPES[i]); |
||||||
for (int i = 0; i < TYPES.length; i++) { |
} |
||||||
this.typeComboBox.addItem(TYPES[i]); |
for (int i = 0; i < TYPES.length; i++) { |
||||||
} |
this.typeComboBox.removeItemAt(1); |
||||||
for (int i = 0; i < DATETYPES.length; i++) { |
} |
||||||
this.typeComboBox.removeItemAt(1); |
} else { |
||||||
} |
for (int i = 0; i < TYPES.length; i++) { |
||||||
} |
this.typeComboBox.addItem(TYPES[i]); |
||||||
} |
} |
||||||
} |
for (int i = 0; i < DATETYPES.length; i++) { |
||||||
|
this.typeComboBox.removeItemAt(1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
} |
} |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 250 B |
@ -0,0 +1,50 @@ |
|||||||
|
package com.fr.design.mainframe.widget; |
||||||
|
|
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by plough on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class BasicPropertyPane extends BasicPane { |
||||||
|
protected UITextField widgetName; |
||||||
|
|
||||||
|
public BasicPropertyPane(){ |
||||||
|
initContentPane(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initContentPane() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
widgetName = new UITextField(); |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Name")), widgetName}, |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
|
this.add(panel, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
public UITextField getWidgetNameField() { |
||||||
|
return widgetName; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "basicProperty"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
|
import com.fr.design.present.dict.DictionaryPane; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public interface DataModify<T> { |
||||||
|
|
||||||
|
void populateBean(T ob); |
||||||
|
|
||||||
|
T updateBean(); |
||||||
|
|
||||||
|
void checkValid() throws Exception; |
||||||
|
|
||||||
|
DataCreatorUI dataUI(); |
||||||
|
|
||||||
|
JComponent toSwingComponent(); |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by richie on 15/11/16. |
||||||
|
*/ |
||||||
|
public interface Operator { |
||||||
|
|
||||||
|
void did(DataCreatorUI ui, String cardName); |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by plough on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class WidgetBoundsPaneFactory { |
||||||
|
|
||||||
|
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, f, f}; |
||||||
|
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}}; |
||||||
|
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
|
|
||||||
|
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, panel); |
||||||
|
} |
||||||
|
|
||||||
|
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y}, |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p}; |
||||||
|
double[] columnSize = {p, f, f}; |
||||||
|
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; |
||||||
|
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
|
|
||||||
|
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, panel); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.fr.design.mainframe.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.widget.BasicPropertyPane; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/4. |
||||||
|
*/ |
||||||
|
public class FormBasicPropertyPane extends BasicPropertyPane { |
||||||
|
|
||||||
|
public void populate(Widget widget) { |
||||||
|
widgetName.setText(widget.getWidgetName()); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(Widget widget) { |
||||||
|
widget.setWidgetName(widgetName.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.design.mainframe.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/7/26. |
||||||
|
*/ |
||||||
|
public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane { |
||||||
|
private UICheckBox enableCheckBox; |
||||||
|
private UICheckBox visibleCheckBox; |
||||||
|
|
||||||
|
public FormBasicWidgetPropertyPane (){ |
||||||
|
initOtherPane(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initOtherPane() { |
||||||
|
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||||
|
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true); |
||||||
|
pane2.add(enableCheckBox); |
||||||
|
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); |
||||||
|
pane2.add(visibleCheckBox); |
||||||
|
this.add(pane2, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "basicProperty"; |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(Widget widget) { |
||||||
|
super.populate(widget); |
||||||
|
enableCheckBox.setSelected(widget.isEnabled()); |
||||||
|
visibleCheckBox.setSelected(widget.isVisible()); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(Widget widget) { |
||||||
|
super.update(widget); |
||||||
|
widget.setEnabled(enableCheckBox.isSelected()); |
||||||
|
widget.setEnabled(visibleCheckBox.isSelected()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,224 @@ |
|||||||
|
package com.fr.design.mainframe.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.*; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.widget.DataModify; |
||||||
|
import com.fr.design.widget.Operator; |
||||||
|
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; |
||||||
|
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.WidgetBoundPane; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.container.WScaleLayout; |
||||||
|
import com.fr.form.ui.container.WTitleLayout; |
||||||
|
import com.fr.form.ui.widget.CRBoundsWidget; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/7/25. |
||||||
|
*/ |
||||||
|
public class FormWidgetCardPane extends AbstractAttrNoScrollPane { |
||||||
|
private AttributeChangeListener listener2; |
||||||
|
private FormDesigner designer; |
||||||
|
//当前的编辑器属性定义面板
|
||||||
|
private DataModify<Widget> currentEditorDefinePane; |
||||||
|
private FormBasicPropertyPane widgetPropertyPane; |
||||||
|
private JPanel attriCardPane; |
||||||
|
|
||||||
|
private XCreator xCreator; |
||||||
|
private WidgetBoundPane widgetBoundPane; |
||||||
|
|
||||||
|
|
||||||
|
public FormWidgetCardPane(FormDesigner designer) { |
||||||
|
super(); |
||||||
|
this.xCreator = findXcreator(designer); |
||||||
|
this.designer = designer; |
||||||
|
initComponents(); |
||||||
|
initDefinePane(); |
||||||
|
widgetBoundPane = createWidgetBoundPane(xCreator); |
||||||
|
if (widgetBoundPane != null) { |
||||||
|
attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public XLayoutContainer getParent(XCreator source) { |
||||||
|
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); |
||||||
|
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { |
||||||
|
container = null; |
||||||
|
} |
||||||
|
return container; |
||||||
|
} |
||||||
|
|
||||||
|
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { |
||||||
|
XLayoutContainer xLayoutContainer = getParent(xCreator); |
||||||
|
if (xLayoutContainer == null || xCreator instanceof XWParameterLayout || xCreator instanceof XWAbsoluteLayout) { |
||||||
|
return null; |
||||||
|
} else if (xLayoutContainer instanceof XWAbsoluteLayout) { |
||||||
|
return new WidgetAbsoluteBoundPane(xCreator); |
||||||
|
} |
||||||
|
return new WidgetBoundPane(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel createContentPane() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public XCreator findXcreator(FormDesigner designer) { |
||||||
|
int size = designer.getSelectionModel().getSelection().size(); |
||||||
|
if (size == 0 || size == 1) { |
||||||
|
XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection() |
||||||
|
.getSelectedCreator(); |
||||||
|
return creator; |
||||||
|
} else { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 后台初始化所有事件. |
||||||
|
*/ |
||||||
|
public void initAllListeners() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 后台初始化所有事件. |
||||||
|
*/ |
||||||
|
public void reinitAllListeners() { |
||||||
|
initListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected void initContentPane() { |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
|
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
if (xCreator.supportSetVisibleOrEnable()) { |
||||||
|
widgetPropertyPane = new FormBasicWidgetPropertyPane(); |
||||||
|
} else { |
||||||
|
widgetPropertyPane = new FormBasicPropertyPane(); |
||||||
|
} |
||||||
|
|
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); |
||||||
|
|
||||||
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
|
|
||||||
|
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
|
||||||
|
this.add(attriCardPane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
this.listener2 = new AttributeChangeListener() { |
||||||
|
@Override |
||||||
|
public void attributeChange() { |
||||||
|
updateCreator(); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void initDefinePane() { |
||||||
|
currentEditorDefinePane = null; |
||||||
|
XCreator creator = xCreator; |
||||||
|
if (xCreator.acceptType(XWScaleLayout.class)) { |
||||||
|
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { |
||||||
|
creator = (XCreator) xCreator.getComponent(0); |
||||||
|
} |
||||||
|
} |
||||||
|
if(xCreator.acceptType(XWTitleLayout.class)){ |
||||||
|
creator = (XCreator) xCreator.getComponent(0); |
||||||
|
} |
||||||
|
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() { |
||||||
|
@Override |
||||||
|
public void did(DataCreatorUI ui, String cardName) { |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
DataModify<Widget> definePane = rn.getDefinePane(); |
||||||
|
|
||||||
|
JComponent jComponent = definePane.toSwingComponent(); |
||||||
|
|
||||||
|
attriCardPane.add(jComponent, BorderLayout.NORTH); |
||||||
|
currentEditorDefinePane = definePane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "Widget"; |
||||||
|
} |
||||||
|
|
||||||
|
public void populate() { |
||||||
|
//populate之前先移除所有的监听
|
||||||
|
removeAttributeChangeListener(); |
||||||
|
Widget cellWidget = xCreator.toData(); |
||||||
|
if (widgetBoundPane != null) { |
||||||
|
widgetBoundPane.populate(); |
||||||
|
} |
||||||
|
if (cellWidget instanceof WScaleLayout) { |
||||||
|
Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget(); |
||||||
|
currentEditorDefinePane.populateBean(((CRBoundsWidget) crBoundsWidget).getWidget()); |
||||||
|
} else if(cellWidget instanceof WTitleLayout){ |
||||||
|
CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget(); |
||||||
|
currentEditorDefinePane.populateBean(crBoundsWidget.getWidget()); |
||||||
|
}else{ |
||||||
|
currentEditorDefinePane.populateBean(cellWidget); |
||||||
|
} |
||||||
|
widgetPropertyPane.populate(cellWidget); |
||||||
|
reinitAllListeners(); |
||||||
|
this.addAttributeChangeListener(listener2); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void updateCreator() { |
||||||
|
Widget widget = currentEditorDefinePane.updateBean(); |
||||||
|
widgetPropertyPane.update(widget); |
||||||
|
if (widgetBoundPane != null) { |
||||||
|
widgetBoundPane.update(); |
||||||
|
} |
||||||
|
fireValueChanged(); |
||||||
|
|
||||||
|
if (xCreator instanceof XWScaleLayout) { |
||||||
|
XCreator xCreator1 = xCreator.getEditingChildCreator(); |
||||||
|
xCreator1.resetData(widget); |
||||||
|
xCreator.removeAll(); |
||||||
|
xCreator.add(xCreator1); |
||||||
|
}else if(xCreator instanceof XWTitleLayout){ |
||||||
|
XCreator xCreator1 = ((XWTitleLayout) xCreator).getXCreator(0); |
||||||
|
xCreator1.resetData(widget); |
||||||
|
xCreator.removeAll(); |
||||||
|
xCreator.add(xCreator1); |
||||||
|
} else { |
||||||
|
xCreator.resetData(widget); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
*检查 |
||||||
|
*/ |
||||||
|
public void checkValid() throws Exception { |
||||||
|
currentEditorDefinePane.checkValid(); |
||||||
|
} |
||||||
|
|
||||||
|
public void fireValueChanged() { |
||||||
|
designer.repaint(); |
||||||
|
} |
||||||
|
|
||||||
|
public String getIconPath() { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,121 @@ |
|||||||
|
package com.fr.design.parameter; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.designer.creator.XWParameterLayout; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; |
||||||
|
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||||
|
import com.fr.form.ui.container.WParameterLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/2. |
||||||
|
*/ |
||||||
|
public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> { |
||||||
|
private XWParameterLayout root; |
||||||
|
private UISpinner designerWidth; |
||||||
|
private UICheckBox displayReport; |
||||||
|
private AccessibleBackgroundEditor background; |
||||||
|
private UIButtonGroup hAlignmentPane; |
||||||
|
|
||||||
|
public RootDesignDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
this.root = (XWParameterLayout) xCreator; |
||||||
|
initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void initComponent() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
designerWidth = new UISpinner(1, 1000, 1); |
||||||
|
JPanel advancePane = createAdvancePane(); |
||||||
|
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||||
|
this.add(advanceExpandablePane, BorderLayout.NORTH); |
||||||
|
JPanel layoutPane = createBoundsPane(); |
||||||
|
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("Size"), 280, 20, layoutPane); |
||||||
|
this.add(layoutExpandablePane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createBoundsPane() { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Form-Desin_Width")), designerWidth}, |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createAdvancePane() { |
||||||
|
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery")); |
||||||
|
background = new AccessibleBackgroundEditor(); |
||||||
|
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_right_normal.png"),}; |
||||||
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
||||||
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left") |
||||||
|
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")}); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}, |
||||||
|
new Component[]{displayReport, null}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), hAlignmentPane} |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "parameter"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(WParameterLayout ob) { |
||||||
|
background.setValue(ob.getBackground()); |
||||||
|
displayReport.setSelected(ob.isDelayDisplayContent()); |
||||||
|
designerWidth.setValue(ob.getDesignWidth()); |
||||||
|
hAlignmentPane.setSelectedIndex(ob.getPosition()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public WParameterLayout updateBean() { |
||||||
|
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); |
||||||
|
wParameterLayout.setDesignWidth((int) designerWidth.getValue()); |
||||||
|
wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); |
||||||
|
wParameterLayout.setBackground(wParameterLayout.getBackground()); |
||||||
|
wParameterLayout.setPosition(hAlignmentPane.getSelectedIndex()); |
||||||
|
return wParameterLayout; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
import com.fr.base.FRContext; |
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.core.WidgetConstants; |
||||||
|
import com.fr.design.parameter.RootDesignDefinePane; |
||||||
|
import com.fr.design.widget.ui.designer.*; |
||||||
|
import com.fr.design.widget.ui.designer.layout.*; |
||||||
|
import com.fr.form.ui.*; |
||||||
|
import com.fr.form.ui.container.*; |
||||||
|
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
||||||
|
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.bridge.BridgeMark; |
||||||
|
import com.fr.stable.bridge.StableFactory; |
||||||
|
|
||||||
|
import java.lang.reflect.Constructor; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by IntelliJ IDEA. |
||||||
|
* Author : Richer |
||||||
|
* Version: 6.5.6 |
||||||
|
* Date : 11-11-14 |
||||||
|
* Time : 上午11:17 |
||||||
|
*/ |
||||||
|
public class FormWidgetDefinePaneFactoryBase { |
||||||
|
private static Map<Class<? extends Widget>, Appearance> defineMap = new HashMap<Class<? extends Widget>, Appearance>(); |
||||||
|
|
||||||
|
static { |
||||||
|
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + "")); |
||||||
|
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); |
||||||
|
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); |
||||||
|
defineMap.put(Radio.class, new Appearance(RadioDefinePane.class, WidgetConstants.RADIO + "")); |
||||||
|
defineMap.put(CheckBox.class, new Appearance(CheckBoxDefinePane.class, WidgetConstants.CHECKBOX + "")); |
||||||
|
defineMap.put(TreeComboBoxEditor.class, new Appearance(TreeComboBoxEditorDefinePane.class, WidgetConstants.TREECOMBOBOX + "")); |
||||||
|
defineMap.put(TreeEditor.class, new Appearance(TreeEditorDefinePane.class, WidgetConstants.TREE + "")); |
||||||
|
defineMap.put(MultiFileEditor.class, new Appearance(MultiFileEditorPane.class, WidgetConstants.MULTI_FILE + "")); |
||||||
|
defineMap.put(TextArea.class, new Appearance(TextAreaDefinePane.class, WidgetConstants.TEXTAREA + "")); |
||||||
|
defineMap.put(Password.class, new Appearance(PasswordDefinePane.class, WidgetConstants.PASSWORD + "")); |
||||||
|
defineMap.put(IframeEditor.class, new Appearance(IframeEditorDefinePane.class, WidgetConstants.IFRAME + "")); |
||||||
|
defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); |
||||||
|
defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); |
||||||
|
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); |
||||||
|
defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); |
||||||
|
defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); |
||||||
|
defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); |
||||||
|
|
||||||
|
defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + "")); |
||||||
|
defineMap.put(Button.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||||
|
defineMap.put(FreeButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||||
|
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); |
||||||
|
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, Inter.getLocText("WLayout-Card-ToolTips"))); |
||||||
|
// if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) {
|
||||||
|
// defineMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class), new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
|
||||||
|
// }
|
||||||
|
|
||||||
|
defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, Inter.getLocText("FR-Designer_AbsoluteLayout"))); |
||||||
|
defineMap.put(ElementCaseEditor.class, new Appearance(ElementEditorDefinePane.class, Inter.getLocText("FR-Designer_AbsoluteLayout"))); |
||||||
|
defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); |
||||||
|
defineMap.put(WParameterLayout.class, new Appearance(RootDesignDefinePane.class, Inter.getLocText("FR-Designer_Para-Body"))); |
||||||
|
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "tab")); |
||||||
|
defineMap.put(WCardLayout.class, new Appearance(WCardLayoutDefinePane.class, "tablayout")); |
||||||
|
defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label")); |
||||||
|
defineMap.put(WTabFitLayout.class, new Appearance(WTabFitLayoutDefinePane.class, "label")); |
||||||
|
defineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap()); |
||||||
|
} |
||||||
|
|
||||||
|
private FormWidgetDefinePaneFactoryBase() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public static RN createWidgetDefinePane(XCreator creator, Widget widget, Operator operator) { |
||||||
|
Appearance dn = defineMap.get(widget.getClass()); |
||||||
|
DataModify<Widget> definePane = null; |
||||||
|
try { |
||||||
|
Constructor con = dn.getDefineClass().getConstructor(XCreator.class); |
||||||
|
definePane = (DataModify)con.newInstance(creator); |
||||||
|
operator.did(definePane.dataUI(), dn.getDisplayName()); |
||||||
|
} catch (Exception e) { |
||||||
|
FRContext.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
return new RN(definePane, dn.getDisplayName()); |
||||||
|
} |
||||||
|
|
||||||
|
public static class RN { |
||||||
|
private DataModify<Widget> definePane; |
||||||
|
private String cardName; |
||||||
|
|
||||||
|
public RN(DataModify<Widget> definePane, String cardName) { |
||||||
|
this.definePane = definePane; |
||||||
|
this.cardName = cardName; |
||||||
|
} |
||||||
|
|
||||||
|
public DataModify<Widget> getDefinePane() { |
||||||
|
return definePane; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCardName() { |
||||||
|
return cardName; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.widget.DataModify; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 17/07/28. |
||||||
|
*/ |
||||||
|
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> { |
||||||
|
protected XCreator creator; |
||||||
|
|
||||||
|
public AbstractDataModify(){ |
||||||
|
|
||||||
|
} |
||||||
|
public AbstractDataModify(XCreator xCreator){ |
||||||
|
this.creator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JComponent toSwingComponent() { |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,92 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor; |
||||||
|
import com.fr.design.widget.btn.ButtonConstants; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.StableUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> { |
||||||
|
private UITextField hotkeysTextField; |
||||||
|
private UITextField buttonNameTextField; |
||||||
|
private AccessibleIconEditor iconPane; |
||||||
|
|
||||||
|
|
||||||
|
public ButtonDefinePane(XCreator creator){ |
||||||
|
super(creator); |
||||||
|
this.initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponent() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double rowSize[] = {p, p, p, p, p, p, p}; |
||||||
|
double columnSize[] = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||||
|
iconPane = new AccessibleIconEditor(); |
||||||
|
hotkeysTextField = new UITextField(); |
||||||
|
buttonNameTextField = new UITextField(); |
||||||
|
Component[] backgroundCompPane = createBackgroundComp(); |
||||||
|
Component[] frFont = createFontPane(); |
||||||
|
UILabel backgroundLabel = new UILabel(Inter.getLocText("FR-Designer_Background")); |
||||||
|
backgroundLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
Component[][] n_components = { |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField}, |
||||||
|
backgroundCompPane, |
||||||
|
frFont, |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Icon" + ":")), iconPane}, |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField} |
||||||
|
}; |
||||||
|
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel); |
||||||
|
this.add(advancedPane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "Button"; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createBackgroundComp(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createFontPane(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(T btn) { |
||||||
|
hotkeysTextField.setText(btn.getHotkeys()); |
||||||
|
buttonNameTextField.setText(btn.getLabelName()); |
||||||
|
iconPane.setValue(btn.getIconName()); |
||||||
|
populateSubButtonPane(btn); |
||||||
|
} |
||||||
|
|
||||||
|
public abstract void populateSubButtonPane(T e); |
||||||
|
|
||||||
|
public abstract T updateSubButtonPane(); |
||||||
|
|
||||||
|
@Override |
||||||
|
public T updateBean() { |
||||||
|
T btn = updateSubButtonPane(); |
||||||
|
btn.setHotkeys(hotkeysTextField.getText()); |
||||||
|
btn.setLabelName(buttonNameTextField.getText()); |
||||||
|
btn.setIconName((String)iconPane.getValue()); |
||||||
|
return btn; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
|
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.ButtonGroup; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
|
||||||
|
public class ButtonGroupDictPane extends JPanel { |
||||||
|
private UIBasicSpinner columnSpinner; |
||||||
|
private UICheckBox adaptiveCheckbox; |
||||||
|
private UILabel columnLabel; |
||||||
|
|
||||||
|
public ButtonGroupDictPane() { |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
public void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||||
|
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
||||||
|
this.add(adaptiveCheckbox); |
||||||
|
|
||||||
|
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); |
||||||
|
this.add(columnLabel); |
||||||
|
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
||||||
|
this.add(columnSpinner); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(ButtonGroup buttonGroup) { |
||||||
|
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
||||||
|
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
|
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
|
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(ButtonGroup buttonGroup) { |
||||||
|
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
|
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
|
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
||||||
|
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.CheckBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
||||||
|
private UITextField text; |
||||||
|
private UISpinner fontSizePane; |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
|
||||||
|
public CheckBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
iniComoponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void iniComoponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
text = new UITextField(); |
||||||
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), text }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 3},{1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel); |
||||||
|
|
||||||
|
this.add(uiExpandablePane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "CheckBox"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(CheckBox check) { |
||||||
|
text.setText(check.getText()); |
||||||
|
fontSizePane.setValue(check.getFontSize()); |
||||||
|
formWidgetValuePane.populate(check); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CheckBox updateBean() { |
||||||
|
CheckBox box = (CheckBox)creator.toData(); |
||||||
|
box.setText(text.getText()); |
||||||
|
box.setFontSize((int)fontSizePane.getValue()); |
||||||
|
formWidgetValuePane.update(box); |
||||||
|
return box; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
|
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.CheckBoxGroup; |
||||||
|
import com.fr.form.ui.ComboCheckBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
public class CheckBoxDictPane extends JPanel { |
||||||
|
|
||||||
|
private DictionaryComboBox delimiterComboBox; |
||||||
|
private UIComboBox returnTypeComboBox; |
||||||
|
private DictionaryComboBox startComboBox; |
||||||
|
private DictionaryComboBox endComboBox; |
||||||
|
|
||||||
|
private JPanel delimiterPane; |
||||||
|
private JPanel startPane; |
||||||
|
private JPanel endPane; |
||||||
|
|
||||||
|
public CheckBoxDictPane() { |
||||||
|
JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||||
|
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
||||||
|
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}); |
||||||
|
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER); |
||||||
|
this.add(returnTypePane); |
||||||
|
|
||||||
|
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":"); |
||||||
|
delimiterPane.add(label, BorderLayout.WEST); |
||||||
|
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER); |
||||||
|
delimiterComboBox.setEditable(true); |
||||||
|
this.add(delimiterPane); |
||||||
|
|
||||||
|
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST); |
||||||
|
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); |
||||||
|
startComboBox.setEditable(true); |
||||||
|
this.add(startPane); |
||||||
|
|
||||||
|
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST); |
||||||
|
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); |
||||||
|
endComboBox.setEditable(true); |
||||||
|
this.add(endPane); |
||||||
|
|
||||||
|
returnTypeComboBox.addActionListener(new ActionListener(){ |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkVisible(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkVisible(){ |
||||||
|
delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||||
|
startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||||
|
endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(ComboCheckBox comboCheckBox) { |
||||||
|
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter()); |
||||||
|
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0); |
||||||
|
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol()); |
||||||
|
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol()); |
||||||
|
checkVisible(); |
||||||
|
} |
||||||
|
public void update(ComboCheckBox comboCheckBox) { |
||||||
|
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); |
||||||
|
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); |
||||||
|
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem()); |
||||||
|
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem()); |
||||||
|
} |
||||||
|
public void populate(CheckBoxGroup checkBoxGroup) { |
||||||
|
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter()); |
||||||
|
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0); |
||||||
|
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol()); |
||||||
|
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol()); |
||||||
|
checkVisible(); |
||||||
|
} |
||||||
|
public void update(CheckBoxGroup checkBoxGroup) { |
||||||
|
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); |
||||||
|
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); |
||||||
|
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem()); |
||||||
|
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,97 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.present.dict.DictionaryPane; |
||||||
|
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; |
||||||
|
import com.fr.form.ui.CheckBoxGroup; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup> { |
||||||
|
private DictionaryPane dictPane; |
||||||
|
private UIHeadGroup returnType; |
||||||
|
private UICheckBox checkbox; |
||||||
|
|
||||||
|
public CheckBoxGroupDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initComponents() { |
||||||
|
super.initComponents(); |
||||||
|
|
||||||
|
dictPane = new DictionaryPane(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "CheckBoxGroup"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel createOtherPane(){ |
||||||
|
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"})); |
||||||
|
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}; |
||||||
|
returnType = new UIHeadGroup(tabTitles) { |
||||||
|
@Override |
||||||
|
public void tabChanged(int index) { |
||||||
|
CheckBoxGroup combo = (CheckBoxGroup) creator.toData(); |
||||||
|
//todo
|
||||||
|
if (index == 1) { |
||||||
|
combo.setReturnString(true); |
||||||
|
} else { |
||||||
|
combo.setReturnString(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{checkbox, null }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubButtonGroupBean(CheckBoxGroup ob) { |
||||||
|
if (ob.isReturnString()) { |
||||||
|
returnType.setSelectedIndex(1); |
||||||
|
} else { |
||||||
|
returnType.setSelectedIndex(0); |
||||||
|
} |
||||||
|
this.dictPane.populateBean(ob.getDictionary()); |
||||||
|
checkbox.setSelected(ob.isChooseAll()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected CheckBoxGroup updateSubButtonGroupBean() { |
||||||
|
CheckBoxGroup ob = (CheckBoxGroup) creator.toData(); |
||||||
|
ob.setDictionary(this.dictPane.updateBean()); |
||||||
|
ob.setChooseAll(checkbox.isSelected()); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return dictPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.form.ui.ComboBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> { |
||||||
|
private UICheckBox removeRepeatCheckBox; |
||||||
|
private UITextField waterMarkField; |
||||||
|
|
||||||
|
public ComboBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public UICheckBox createRepeatCheckBox(){ |
||||||
|
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat")); |
||||||
|
return removeRepeatCheckBox; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
waterMarkField = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkField}; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(ComboBox ob){ |
||||||
|
removeRepeatCheckBox.setSelected(ob.isRemoveRepeat()); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
} |
||||||
|
|
||||||
|
protected ComboBox updateSubDictionaryEditorBean(){ |
||||||
|
ComboBox combo = (ComboBox) creator.toData(); |
||||||
|
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||||
|
formWidgetValuePane.update(combo); |
||||||
|
return combo; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "ComboBox"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,100 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.form.ui.ComboCheckBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox> { |
||||||
|
private UICheckBox supportTagCheckBox; |
||||||
|
private UIHeadGroup returnType; |
||||||
|
private UITextField waterMarkDictPane; |
||||||
|
private UICheckBox removeRepeatCheckBox; |
||||||
|
|
||||||
|
public ComboCheckBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public UICheckBox createRepeatCheckBox(){ |
||||||
|
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat")); |
||||||
|
return removeRepeatCheckBox; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
waterMarkDictPane = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel createOtherPane(){ |
||||||
|
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); |
||||||
|
|
||||||
|
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}; |
||||||
|
returnType = new UIHeadGroup(tabTitles) { |
||||||
|
@Override |
||||||
|
public void tabChanged(int index) { |
||||||
|
ComboCheckBox combo = (ComboCheckBox) creator.toData(); |
||||||
|
//todo
|
||||||
|
if (index == 1) { |
||||||
|
combo.setReturnString(true); |
||||||
|
} else { |
||||||
|
combo.setReturnString(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{supportTagCheckBox, null }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(ComboCheckBox ob){ |
||||||
|
if (ob.isReturnString()) { |
||||||
|
returnType.setSelectedIndex(1); |
||||||
|
} else { |
||||||
|
returnType.setSelectedIndex(0); |
||||||
|
} |
||||||
|
waterMarkDictPane.setText(ob.getWaterMark()); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
this.supportTagCheckBox.setSelected(ob.isSupportTag()); |
||||||
|
this.removeRepeatCheckBox.setSelected(ob.isRemoveRepeat()); |
||||||
|
} |
||||||
|
|
||||||
|
protected ComboCheckBox updateSubDictionaryEditorBean(){ |
||||||
|
ComboCheckBox combo = (ComboCheckBox) creator.toData(); |
||||||
|
formWidgetValuePane.update(combo); |
||||||
|
combo.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
combo.setSupportTag(this.supportTagCheckBox.isSelected()); |
||||||
|
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||||
|
return combo; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "ComboCheckBox"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.form.ui.CustomWriteAbleRepeatEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Author : Shockway |
||||||
|
* Date: 13-9-18 |
||||||
|
* Time: 下午2:17 |
||||||
|
*/ |
||||||
|
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { |
||||||
|
|
||||||
|
private UICheckBox customDataCheckBox; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; |
||||||
|
|
||||||
|
public CustomWritableRepeatEditorPane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); |
||||||
|
this.customDataCheckBox.setPreferredSize( |
||||||
|
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); |
||||||
|
JPanel otherContentPane = super.setValidatePane(); |
||||||
|
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void populateSubWritableRepeatEditorBean(T e) { |
||||||
|
this.customDataCheckBox.setSelected(e.isCustomData()); |
||||||
|
populateSubCustomWritableRepeatEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubCustomWritableRepeatEditorBean(T e); |
||||||
|
|
||||||
|
protected T updateSubWritableRepeatEditorBean() { |
||||||
|
T e = updateSubCustomWritableRepeatEditorBean(); |
||||||
|
e.setCustomData(this.customDataCheckBox.isSelected()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract T updateSubCustomWritableRepeatEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,265 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.FRContext; |
||||||
|
import com.fr.base.Formula; |
||||||
|
import com.fr.data.core.FormatField; |
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.editor.ValueEditorPane; |
||||||
|
import com.fr.design.editor.ValueEditorPaneFactory; |
||||||
|
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.DateEditor; |
||||||
|
import com.fr.general.DateUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.script.Calculator; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.stable.UtilEvalError; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { |
||||||
|
private UIComboBox returnTypeComboBox; |
||||||
|
private UILabel sampleLabel;// preview
|
||||||
|
private UIComboBox dateFormatComboBox; |
||||||
|
private ValueEditorPane startDv; |
||||||
|
private ValueEditorPane endDv; |
||||||
|
private WaterMarkDictPane waterMarkDictPane; |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
private UISpinner fontSizePane; |
||||||
|
private UIHeadGroup formatHeader; |
||||||
|
|
||||||
|
public DateEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "Date"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
waterMarkDictPane = new WaterMarkDictPane(); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||||
|
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
||||||
|
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("String"), Inter.getLocText("Date")}); |
||||||
|
returnTypeComboBox.setPreferredSize(new Dimension(70, 20)); |
||||||
|
// sample pane
|
||||||
|
sampleLabel = new UILabel(""); |
||||||
|
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); |
||||||
|
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||||
|
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); |
||||||
|
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例"); |
||||||
|
previewPane.add(sampleLabel); |
||||||
|
// content pane
|
||||||
|
String[] arr = getDateFormateArray(); |
||||||
|
dateFormatComboBox = new UIComboBox(arr); |
||||||
|
dateFormatComboBox.setPreferredSize(new Dimension(150, 20)); |
||||||
|
dateFormatComboBox.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
refreshPreviewLabel(); |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
initFormatHeader(); |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox}, |
||||||
|
new Component[]{null, previewPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox} |
||||||
|
|
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
|
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
protected void initFormatHeader() { |
||||||
|
String [] tabTitles = getDateFormateArray(); |
||||||
|
formatHeader = new UIHeadGroup(tabTitles){ |
||||||
|
protected void tabChanged(int newSelectedIndex) { |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
private String[] getDateFormateArray() { |
||||||
|
return FormatField.getInstance().getDateFormatArray(); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel initStartEndDatePane() { |
||||||
|
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||||
|
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":")); |
||||||
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
rangePane.add(startDv); |
||||||
|
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":")); |
||||||
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
rangePane.add(endDv); |
||||||
|
|
||||||
|
return rangePane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void refreshPreviewLabel() { |
||||||
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
||||||
|
if (text != null && text.length() > 0) { |
||||||
|
try { |
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); |
||||||
|
String sample = simpleDateFormat.format(new Date()); |
||||||
|
Color c = Color.black; |
||||||
|
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { |
||||||
|
sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); |
||||||
|
c = Color.red; |
||||||
|
} |
||||||
|
this.sampleLabel.setText(sample); |
||||||
|
this.sampleLabel.setForeground(c); |
||||||
|
} catch (Exception exp) { |
||||||
|
this.sampleLabel.setForeground(Color.red); |
||||||
|
this.sampleLabel.setText(exp.getMessage()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
this.sampleLabel.setText(new Date().toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubDirectWriteEditorBean(DateEditor e) { |
||||||
|
String formatText = e.getFormatText(); |
||||||
|
dateFormatComboBox.setSelectedItem(formatText); |
||||||
|
|
||||||
|
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0); |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
populateStartEnd(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected DateEditor updateSubDirectWriteEditorBean() { |
||||||
|
DateEditor ob = new DateEditor(); |
||||||
|
|
||||||
|
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
||||||
|
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
updateStartEnd(ob); |
||||||
|
|
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始起止日期 |
||||||
|
* |
||||||
|
* @param dateWidgetEditor 日期控件 |
||||||
|
*/ |
||||||
|
public void populateStartEnd(DateEditor dateWidgetEditor) { |
||||||
|
Formula startFM = dateWidgetEditor.getStartDateFM(); |
||||||
|
Formula endFM = dateWidgetEditor.getEndDateFM(); |
||||||
|
if (startFM != null) { |
||||||
|
startDv.populate(startFM); |
||||||
|
} else { |
||||||
|
String startStr = dateWidgetEditor.getStartText(); |
||||||
|
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true)); |
||||||
|
} |
||||||
|
if (endFM != null) { |
||||||
|
endDv.populate(endFM); |
||||||
|
} else { |
||||||
|
String endStr = dateWidgetEditor.getEndText(); |
||||||
|
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新日期控件的起止日期 |
||||||
|
* |
||||||
|
* @param dateWidgetEditor 日期控件 |
||||||
|
*/ |
||||||
|
public void updateStartEnd(DateEditor dateWidgetEditor) { |
||||||
|
Object startObject = startDv.update(); |
||||||
|
Object endObject = endDv.update(); |
||||||
|
// wei : 对公式的处理
|
||||||
|
Calculator cal = null; |
||||||
|
if (startObject instanceof Formula) { |
||||||
|
cal = Calculator.createCalculator(); |
||||||
|
Formula startFormula = (Formula) startObject; |
||||||
|
try { |
||||||
|
startFormula.setResult(cal.evalValue(startFormula.getContent())); |
||||||
|
} catch (UtilEvalError e) { |
||||||
|
FRContext.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
startObject = startFormula.getResult(); |
||||||
|
dateWidgetEditor.setStartDateFM(startFormula); |
||||||
|
dateWidgetEditor.setStartText(null); |
||||||
|
} else { |
||||||
|
try { |
||||||
|
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) startObject)); |
||||||
|
} catch (ClassCastException e) { |
||||||
|
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
|
||||||
|
} |
||||||
|
} |
||||||
|
if (endObject instanceof Formula) { |
||||||
|
cal = Calculator.createCalculator(); |
||||||
|
Formula endFormula = (Formula) endObject; |
||||||
|
try { |
||||||
|
endFormula.setResult(cal.evalValue(endFormula.getContent())); |
||||||
|
} catch (UtilEvalError e) { |
||||||
|
FRContext.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
endObject = endFormula.getResult(); |
||||||
|
dateWidgetEditor.setEndDateFM(endFormula); |
||||||
|
dateWidgetEditor.setEndText(null); |
||||||
|
} else { |
||||||
|
try { |
||||||
|
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) endObject)); |
||||||
|
} catch (ClassCastException e) { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private SimpleDateFormat getSimpleDateFormat() { |
||||||
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
||||||
|
SimpleDateFormat simpleDateFormat; |
||||||
|
if (text != null && text.length() > 0) { |
||||||
|
try { |
||||||
|
simpleDateFormat = new SimpleDateFormat(text); |
||||||
|
this.sampleLabel.setText(simpleDateFormat.format(new Date())); |
||||||
|
} catch (Exception exp) { |
||||||
|
simpleDateFormat = new SimpleDateFormat(""); |
||||||
|
} |
||||||
|
} else { |
||||||
|
simpleDateFormat = new SimpleDateFormat(""); |
||||||
|
} |
||||||
|
|
||||||
|
return simpleDateFormat; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.data.Dictionary; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; |
||||||
|
import com.fr.form.ui.DictContainedCustomWriteAbleEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public abstract class DictEditorDefinePane<T extends DictContainedCustomWriteAbleEditor> extends CustomWritableRepeatEditorPane<T> { |
||||||
|
private AccessibleDictionaryEditor dictionaryEditor; |
||||||
|
|
||||||
|
|
||||||
|
public DictEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected Component[] createDictPane(){ |
||||||
|
dictionaryEditor = new AccessibleDictionaryEditor(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictionaryEditor}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubCustomWritableRepeatEditorBean(T e) { |
||||||
|
populateSubDictionaryEditorBean(e); |
||||||
|
dictionaryEditor.setValue(e.getDictionary()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected T updateSubCustomWritableRepeatEditorBean() { |
||||||
|
T e = updateSubDictionaryEditorBean(); |
||||||
|
e.setDictionary((Dictionary) dictionaryEditor.getValue()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubDictionaryEditorBean(T e); |
||||||
|
|
||||||
|
protected abstract T updateSubDictionaryEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,100 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.DirectWriteEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
|
||||||
|
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { |
||||||
|
public UICheckBox directWriteCheckBox; |
||||||
|
protected FormWidgetValuePane formWidgetValuePane; |
||||||
|
|
||||||
|
public DirectWriteEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null}; |
||||||
|
Component[] dicPane = createDictPane(); |
||||||
|
Component[] waterMarkComponent = createWaterMarkPane(); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||||
|
dicPane, |
||||||
|
removeRepeatPane, |
||||||
|
waterMarkComponent, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane} |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p, p,p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1,1},{1,1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
advancePane.add(panel, BorderLayout.NORTH); |
||||||
|
JPanel otherPane = createOtherPane(); |
||||||
|
if(otherPane != null){ |
||||||
|
advancePane.add(otherPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
return advancePane; |
||||||
|
} |
||||||
|
|
||||||
|
public UICheckBox createRepeatCheckBox(){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
protected Component[] createDictPane(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createOtherPane(){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); |
||||||
|
JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||||
|
otherContentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); |
||||||
|
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5); |
||||||
|
jPanel.setPreferredSize(new Dimension(220, 30)); |
||||||
|
otherContentPane.add(jPanel); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubFieldEditorBean(T e) { |
||||||
|
this.directWriteCheckBox.setSelected(e.isDirectEdit()); |
||||||
|
populateSubDirectWriteEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubDirectWriteEditorBean(T e); |
||||||
|
|
||||||
|
@Override |
||||||
|
protected T updateSubFieldEditorBean() { |
||||||
|
T e = updateSubDirectWriteEditorBean(); |
||||||
|
e.setDirectEdit(directWriteCheckBox.isSelected()); |
||||||
|
|
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract T updateSubDirectWriteEditorBean(); |
||||||
|
} |
@ -0,0 +1,140 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.design.designer.creator.*; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.form.ui.FieldEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ItemEvent; |
||||||
|
import java.awt.event.ItemListener; |
||||||
|
|
||||||
|
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
||||||
|
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; |
||||||
|
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; |
||||||
|
protected UICheckBox allowBlankCheckBox; |
||||||
|
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
||||||
|
protected UITextField errorMsgTextField; |
||||||
|
protected JPanel validatePane; |
||||||
|
protected UISpinner fontSizePane; |
||||||
|
|
||||||
|
public FieldEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
public FieldEditorDefinePane() { |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); |
||||||
|
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); |
||||||
|
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); |
||||||
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||||
|
errorMsgTextField = new UITextField(); |
||||||
|
JPanel contentPane = this.setFirstContentPane(); |
||||||
|
if (contentPane != null) { |
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane("高级", 280, 20, contentPane); |
||||||
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
this.addValidatePane(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(T ob) { |
||||||
|
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
||||||
|
this.errorMsgTextField.setText(ob.getErrorMessage()); |
||||||
|
this.fontSizePane.setValue(ob.getFontSize()); |
||||||
|
populateSubFieldEditorBean(ob); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubFieldEditorBean(T ob); |
||||||
|
|
||||||
|
@Override |
||||||
|
public T updateBean() { |
||||||
|
T e = updateSubFieldEditorBean(); |
||||||
|
|
||||||
|
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
||||||
|
e.setErrorMessage(this.errorMsgTextField.getText()); |
||||||
|
e.setFontSize((int)fontSizePane.getValue()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected abstract T updateSubFieldEditorBean(); |
||||||
|
|
||||||
|
protected abstract JPanel setFirstContentPane(); |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void checkValid() throws Exception { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected void addValidatePane() { |
||||||
|
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")); |
||||||
|
allowBlankCheckBox.addItemListener(new ItemListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void itemStateChanged(ItemEvent e) { |
||||||
|
boolean isSelected = allowBlankCheckBox.isSelected(); |
||||||
|
uiLabel.setVisible(!isSelected); |
||||||
|
errorMsgTextField.setVisible(!isSelected); |
||||||
|
if (isSelected) { |
||||||
|
uiLabel.setPreferredSize(new Dimension(0, 0)); |
||||||
|
errorMsgTextField.setPreferredSize(new Dimension(0, 0)); |
||||||
|
} else { |
||||||
|
uiLabel.setPreferredSize(new Dimension(66, 20)); |
||||||
|
errorMsgTextField.setPreferredSize(new Dimension(150, 20)); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{allowBlankCheckBox, null}, |
||||||
|
new Component[]{uiLabel, errorMsgTextField}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 2); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
validatePane.add(panel, BorderLayout.NORTH); |
||||||
|
JPanel contentPane = this.setValidatePane(); |
||||||
|
if (contentPane != null) { |
||||||
|
validatePane.add(contentPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane); |
||||||
|
this.add(uiExpandablePane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public XLayoutContainer getParent(XCreator source) { |
||||||
|
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); |
||||||
|
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { |
||||||
|
container = null; |
||||||
|
} |
||||||
|
return container; |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel setValidatePane() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FRFontPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.BackgroundCompPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.MouseActionBackground; |
||||||
|
import com.fr.form.ui.FreeButton; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> { |
||||||
|
private BackgroundCompPane backgroundCompPane; |
||||||
|
private FRFontPane frFontPane; |
||||||
|
|
||||||
|
public FreeButtonDefinePane(XCreator xcreator) { |
||||||
|
super(xcreator); |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createBackgroundComp() { |
||||||
|
backgroundCompPane = new BackgroundCompPane(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createFontPane() { |
||||||
|
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font")); |
||||||
|
fontLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
frFontPane = new FRFontPane(); |
||||||
|
return new Component[]{fontLabel, frFontPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public void populateSubButtonPane(FreeButton e) { |
||||||
|
MouseActionBackground mouseActionBackground = new MouseActionBackground(e.getInitialBackground(), e.getOverBackground(), e.getClickBackground()); |
||||||
|
backgroundCompPane.populate(mouseActionBackground); |
||||||
|
FRFont frFont = e.getFont(); |
||||||
|
if (frFont != null) { |
||||||
|
frFontPane.populateBean(e.getFont()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public FreeButton updateSubButtonPane() { |
||||||
|
FreeButton freeButton = (FreeButton) creator.toData(); |
||||||
|
MouseActionBackground mouseActionBackground = backgroundCompPane.update(); |
||||||
|
freeButton.setInitialBackground(mouseActionBackground.getInitialBackground()); |
||||||
|
freeButton.setOverBackground(mouseActionBackground.getOverBackground()); |
||||||
|
freeButton.setClickBackground(mouseActionBackground.getClickBackground()); |
||||||
|
frFontPane.update(freeButton.getFont()); |
||||||
|
return freeButton; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,83 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.frpane.ReportletParameterViewPane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.form.ui.IframeEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.ParameterProvider; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> { |
||||||
|
private UITextField srcTextField; |
||||||
|
private ReportletParameterViewPane parameterViewPane; |
||||||
|
private UICheckBox horizontalCheck; |
||||||
|
private UICheckBox verticalCheck; |
||||||
|
|
||||||
|
public IframeEditorDefinePane() { |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||||
|
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
||||||
|
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||||
|
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); |
||||||
|
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); |
||||||
|
contentPane.add(attr); |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] rowSize = { p, p, p, p }; |
||||||
|
double[] columnSize = { p, f }; |
||||||
|
|
||||||
|
Component[][] coms = { |
||||||
|
{ horizontalCheck, null }, |
||||||
|
{ verticalCheck, null }, |
||||||
|
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, |
||||||
|
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); |
||||||
|
|
||||||
|
contentPane.add(panel); |
||||||
|
|
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); |
||||||
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "iframe"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(IframeEditor e) { |
||||||
|
srcTextField.setText(e.getSrc()); |
||||||
|
parameterViewPane.populate(e.getParameters()); |
||||||
|
this.horizontalCheck.setSelected(e.isOverflowx()); |
||||||
|
this.verticalCheck.setSelected(e.isOverflowy()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public IframeEditor updateBean() { |
||||||
|
IframeEditor ob = new IframeEditor(); |
||||||
|
ob.setSrc(srcTextField.getText()); |
||||||
|
List<ParameterProvider> parameterList = parameterViewPane.update(); |
||||||
|
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); |
||||||
|
ob.setOverflowx(this.horizontalCheck.isSelected()); |
||||||
|
ob.setOverflowy(this.verticalCheck.isSelected()); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,100 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FRFontPane; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.Label; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/3. |
||||||
|
*/ |
||||||
|
public class LabelDefinePane extends AbstractDataModify<Label> { |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
private UICheckBox isPageSetupVertically; |
||||||
|
private UICheckBox isStyleAlignmentWrapText; |
||||||
|
private UIButtonGroup hAlignmentPane; |
||||||
|
private FRFontPane frFontPane; |
||||||
|
|
||||||
|
public LabelDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
public void initComponent() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
JPanel advancePane = createAdvancePane(); |
||||||
|
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||||
|
this.add(advanceExpandablePane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createAdvancePane() { |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
isPageSetupVertically = new UICheckBox(Inter.getLocText("FR-Designer_PageSetup-Vertically")); |
||||||
|
isStyleAlignmentWrapText = new UICheckBox(Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")); |
||||||
|
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_right_normal.png"),}; |
||||||
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
||||||
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left") |
||||||
|
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")}); |
||||||
|
frFontPane = new FRFontPane(); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p, p, p, p, p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||||
|
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font-Size")); |
||||||
|
fontLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
||||||
|
new Component[]{isStyleAlignmentWrapText, null}, |
||||||
|
new Component[]{isPageSetupVertically, null}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Display_Position")), hAlignmentPane}, |
||||||
|
new Component[]{fontLabel, frFontPane}, |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "label"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(Label ob) { |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
isStyleAlignmentWrapText.setSelected(ob.isAutoLine()); |
||||||
|
isPageSetupVertically.setSelected(ob.isVerticalCenter()); |
||||||
|
hAlignmentPane.setSelectedIndex(ob.getTextalign()); |
||||||
|
frFontPane.populateBean(ob.getFont()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public Label updateBean() { |
||||||
|
Label layout = (Label) creator.toData(); |
||||||
|
formWidgetValuePane.update(layout); |
||||||
|
layout.setAutoLine(isStyleAlignmentWrapText.isSelected()); |
||||||
|
layout.setVerticalCenter(isPageSetupVertically.isSelected()); |
||||||
|
layout.setTextalign(hAlignmentPane.getSelectedIndex()); |
||||||
|
layout.setFont(frFontPane.update(layout.getFont())); |
||||||
|
return layout; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
|
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.gui.itextfield.UINumberField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.form.ui.MultiFileEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
||||||
|
private DictionaryComboBox acceptType; |
||||||
|
private UICheckBox singleFileCheckBox; |
||||||
|
private UINumberField fileSizeField; |
||||||
|
private UISpinner fontSizeField; |
||||||
|
|
||||||
|
public MultiFileEditorPane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "file"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
||||||
|
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
||||||
|
fileSizeField = new UINumberField(); |
||||||
|
fontSizeField = new UISpinner(0, 20, 1, 0); |
||||||
|
|
||||||
|
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||||
|
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
singleFilePane.add(singleFileCheckBox); |
||||||
|
|
||||||
|
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||||
|
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||||
|
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); |
||||||
|
allowTypePane.add(acceptType); |
||||||
|
|
||||||
|
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||||
|
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); |
||||||
|
fileSizePane.add(fileSizeField); |
||||||
|
fileSizePane.add(new UILabel(" KB")); |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{singleFileCheckBox, null }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType}, |
||||||
|
new Component[]{new UILabel( Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField}, |
||||||
|
new Component[]{new UILabel( Inter.getLocText("FR-Designer_Font-Size")), fontSizeField} |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p,p,p}; |
||||||
|
double[] columnSize = {p,f}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
|
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
||||||
|
// 这里存在兼容问题 getAccept可能没在待选项目中
|
||||||
|
acceptType.setSelectedItem(e.getAccept()); |
||||||
|
singleFileCheckBox.setSelected(e.isSingleFile()); |
||||||
|
fileSizeField.setValue(e.getMaxSize()); |
||||||
|
fontSizeField.setValue(e.getFontSize()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected MultiFileEditor updateSubFieldEditorBean() { |
||||||
|
MultiFileEditor ob = new MultiFileEditor(); |
||||||
|
ob.setAccept((String) acceptType.getSelectedItem()); |
||||||
|
ob.setSingleFile(singleFileCheckBox.isSelected()); |
||||||
|
ob.setMaxSize(fileSizeField.getValue()); |
||||||
|
ob.setFontSize((int)fontSizeField.getValue()); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.form.ui.NoneWidget; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author Administrator |
||||||
|
* 用于处理没有控件的情况 |
||||||
|
*/ |
||||||
|
public class NoneWidgetDefinePane extends AbstractDataModify<NoneWidget> { |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "none"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(NoneWidget w) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public NoneWidget updateBean() { |
||||||
|
return new NoneWidget(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,312 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.NumberEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.event.ChangeEvent; |
||||||
|
import javax.swing.event.ChangeListener; |
||||||
|
import javax.swing.text.DefaultFormatter; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { |
||||||
|
public NumberEditorDefinePane(XCreator xCreator){ |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
private static final long serialVersionUID = 8011242951911686805L; |
||||||
|
private UICheckBox allowDecimalsCheckBox; |
||||||
|
private UICheckBox allowNegativeCheckBox; |
||||||
|
private UICheckBox setMaxValueCheckBox; |
||||||
|
private UICheckBox setMinValueCheckBox; |
||||||
|
private UIBasicSpinner maxValueSpinner; |
||||||
|
private SpinnerNumberModel maxValueModel; |
||||||
|
private UIBasicSpinner minValueSpinner; |
||||||
|
private SpinnerNumberModel minValueModel; |
||||||
|
private com.fr.design.editor.editor.IntegerEditor decimalLength; |
||||||
|
private JPanel limitNumberPane; |
||||||
|
private WaterMarkDictPane waterMarkDictPane; |
||||||
|
|
||||||
|
private ActionListener actionListener1 = new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
if (allowDecimalsCheckBox.isSelected()) { |
||||||
|
limitNumberPane.setVisible(true); |
||||||
|
} else { |
||||||
|
limitNumberPane.setVisible(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
private ActionListener actionListener2 = new ActionListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
if (allowNegativeCheckBox.isSelected()) { |
||||||
|
minValueModel.setMinimum(-Double.MAX_VALUE); |
||||||
|
if (!setMinValueCheckBox.isSelected()) { |
||||||
|
maxValueModel.setMinimum(-Double.MAX_VALUE); |
||||||
|
} |
||||||
|
} else { |
||||||
|
minValueModel.setMinimum(0.0); |
||||||
|
if (!setMinValueCheckBox.isSelected()) { |
||||||
|
maxValueModel.setMinimum(0.0); |
||||||
|
} |
||||||
|
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); |
||||||
|
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); |
||||||
|
if (minValue < 0.0) { |
||||||
|
minValueSpinner.setValue(0.0); |
||||||
|
} |
||||||
|
if (maxValue < 0.0) { |
||||||
|
maxValueSpinner.setValue(0.0); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
private ActionListener actionListener3 = new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
if (setMaxValueCheckBox.isSelected()) { |
||||||
|
maxValueSpinner.setEnabled(true); |
||||||
|
Double value = new Double(0); |
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); |
||||||
|
if (minValue > value) { |
||||||
|
value = minValue; |
||||||
|
} |
||||||
|
} |
||||||
|
maxValueSpinner.setValue(value); |
||||||
|
} else { |
||||||
|
maxValueSpinner.setEnabled(false); |
||||||
|
minValueModel.setMaximum(Double.MAX_VALUE); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
private ActionListener actionListener4 = new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
minValueSpinner.setEnabled(true); |
||||||
|
Double value = new Double(0); |
||||||
|
if (setMaxValueCheckBox.isSelected()) { |
||||||
|
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); |
||||||
|
if (maxValue < value) { |
||||||
|
value = maxValue; |
||||||
|
} |
||||||
|
} |
||||||
|
minValueSpinner.setValue(value); |
||||||
|
} else { |
||||||
|
minValueSpinner.setEnabled(false); |
||||||
|
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
private ChangeListener changeListener1 = new ChangeListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void stateChanged(ChangeEvent e) { |
||||||
|
if (setMaxValueCheckBox.isSelected()) { |
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
private ChangeListener changeListener2 = new ChangeListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void stateChanged(ChangeEvent e) { |
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
if (setMaxValueCheckBox.isSelected()) { |
||||||
|
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
public NumberEditorDefinePane() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "number"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
// richer:数字的允许直接编辑没有意义
|
||||||
|
waterMarkDictPane = new WaterMarkDictPane(); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane} |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p}; |
||||||
|
double[] columnSize = {p,f}; |
||||||
|
int[][] rowCount = {{1, 3},{1, 1},{1, 1}}; |
||||||
|
JPanel advancePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
advancePane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
|
||||||
|
return advancePane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel setValidatePane() { |
||||||
|
// super.addValidatePane();
|
||||||
|
|
||||||
|
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); |
||||||
|
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); |
||||||
|
this.decimalLength.setColumns(4); |
||||||
|
|
||||||
|
this.allowDecimalsCheckBox.addActionListener(actionListener1); |
||||||
|
|
||||||
|
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); |
||||||
|
this.allowNegativeCheckBox.addActionListener(actionListener2); |
||||||
|
|
||||||
|
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); |
||||||
|
|
||||||
|
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
||||||
|
maxValueSpinner.setPreferredSize(new Dimension(120, 20)); |
||||||
|
setNotAllowsInvalid(this.maxValueSpinner); |
||||||
|
|
||||||
|
this.setMaxValueCheckBox.addActionListener(actionListener3); |
||||||
|
this.maxValueSpinner.addChangeListener(changeListener1); |
||||||
|
|
||||||
|
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false); |
||||||
|
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
||||||
|
minValueSpinner.setPreferredSize(new Dimension(120, 20)); |
||||||
|
setNotAllowsInvalid(this.minValueSpinner); |
||||||
|
|
||||||
|
this.setMinValueCheckBox.addActionListener(actionListener4); |
||||||
|
this.minValueSpinner.addChangeListener(changeListener2); |
||||||
|
|
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{allowDecimalsCheckBox, null }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength }, |
||||||
|
new Component[]{allowNegativeCheckBox, null}, |
||||||
|
new Component[]{setMaxValueCheckBox, maxValueSpinner}, |
||||||
|
new Component[]{setMinValueCheckBox, minValueSpinner}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p}; |
||||||
|
double[] columnSize = {p,f}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 3); |
||||||
|
return panel; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubFieldEditorBean(NumberEditor e) { |
||||||
|
allowDecimalsCheckBox.setSelected(e.isAllowDecimals()); |
||||||
|
if (e.isAllowDecimals()) { |
||||||
|
this.decimalLength.setValue(e.getMaxDecimalLength()); |
||||||
|
} else { |
||||||
|
this.limitNumberPane.setVisible(false); |
||||||
|
} |
||||||
|
|
||||||
|
allowNegativeCheckBox.setSelected(e.isAllowNegative()); |
||||||
|
if (e.getMaxValue() == Double.MAX_VALUE) { |
||||||
|
setMaxValueCheckBox.setSelected(false); |
||||||
|
maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); |
||||||
|
maxValueSpinner.setEnabled(false); |
||||||
|
|
||||||
|
} else { |
||||||
|
setMaxValueCheckBox.setSelected(true); |
||||||
|
maxValueSpinner.setEnabled(true); |
||||||
|
maxValueSpinner.setValue(new Double(e.getMaxValue())); |
||||||
|
} |
||||||
|
|
||||||
|
if (e.getMinValue() == -Double.MAX_VALUE) { |
||||||
|
setMinValueCheckBox.setSelected(false); |
||||||
|
minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); |
||||||
|
minValueSpinner.setEnabled(false); |
||||||
|
|
||||||
|
} else { |
||||||
|
setMinValueCheckBox.setSelected(true); |
||||||
|
minValueSpinner.setEnabled(true); |
||||||
|
minValueSpinner.setValue(new Double(e.getMinValue())); |
||||||
|
} |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
|
||||||
|
this.waterMarkDictPane.populate(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected NumberEditor updateSubFieldEditorBean() { |
||||||
|
|
||||||
|
NumberEditor ob = new NumberEditor(); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected()); |
||||||
|
if (allowDecimalsCheckBox.isSelected()) { |
||||||
|
ob.setMaxDecimalLength(this.decimalLength.getValue()); |
||||||
|
} |
||||||
|
|
||||||
|
ob.setAllowNegative(allowNegativeCheckBox.isSelected()); |
||||||
|
if (setMaxValueCheckBox.isSelected()) { |
||||||
|
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue())); |
||||||
|
} else { |
||||||
|
ob.setMaxValue(Double.MAX_VALUE); |
||||||
|
} |
||||||
|
|
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue())); |
||||||
|
} else { |
||||||
|
ob.setMinValue(-Double.MAX_VALUE); |
||||||
|
} |
||||||
|
|
||||||
|
this.waterMarkDictPane.update(ob); |
||||||
|
|
||||||
|
|
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
private void checkVisible() { |
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
minValueSpinner.setEnabled(true); |
||||||
|
} else { |
||||||
|
minValueSpinner.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
if (setMinValueCheckBox.isSelected()) { |
||||||
|
minValueSpinner.setEnabled(true); |
||||||
|
} else { |
||||||
|
minValueSpinner.setEnabled(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void setNotAllowsInvalid(UIBasicSpinner jspinner) { |
||||||
|
JComponent editor = jspinner.getEditor(); |
||||||
|
if (editor instanceof UIBasicSpinner.DefaultEditor) { |
||||||
|
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField(); |
||||||
|
ftf.setColumns(10); |
||||||
|
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter(); |
||||||
|
DefaultFormatter df = (DefaultFormatter) formatter; |
||||||
|
df.setAllowsInvalid(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,179 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.base.ConfigManager; |
||||||
|
import com.fr.base.Parameter; |
||||||
|
import com.fr.base.TableData; |
||||||
|
import com.fr.design.DesignModelAdapter; |
||||||
|
import com.fr.design.gui.icombobox.FRTreeComboBox; |
||||||
|
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; |
||||||
|
import com.fr.design.parameter.ParameterGroup; |
||||||
|
import com.fr.file.DatasourceManager; |
||||||
|
import com.fr.file.DatasourceManagerProvider; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.script.Calculator; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
import com.fr.stable.ParameterProvider; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.tree.DefaultMutableTreeNode; |
||||||
|
import javax.swing.tree.DefaultTreeCellRenderer; |
||||||
|
import javax.swing.tree.DefaultTreeModel; |
||||||
|
import javax.swing.tree.TreePath; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ItemEvent; |
||||||
|
import java.awt.event.ItemListener; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Iterator; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 控件设置面板的“控件名”下拉框,里面是所有参数的名字 |
||||||
|
* |
||||||
|
* @author zhou |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class ParameterTreeComboBox extends FRTreeComboBox { |
||||||
|
|
||||||
|
public ParameterTreeComboBox() { |
||||||
|
super(new JTree(), new DefaultTreeCellRenderer() { |
||||||
|
@Override |
||||||
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
||||||
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
||||||
|
if (value instanceof DefaultMutableTreeNode) { |
||||||
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; |
||||||
|
Object userObj = node.getUserObject(); |
||||||
|
if (userObj instanceof String) { |
||||||
|
this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); |
||||||
|
} else if (userObj instanceof Parameter) { |
||||||
|
Parameter parameter = (Parameter)userObj; |
||||||
|
this.setText(parameter.getName()); |
||||||
|
} |
||||||
|
} |
||||||
|
return this; |
||||||
|
} |
||||||
|
}); |
||||||
|
this.addItemListener(new ItemListener() { |
||||||
|
public void itemStateChanged(ItemEvent e) { |
||||||
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
|
if (e.getItem() instanceof TreePath) { |
||||||
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreePath)e.getItem()).getLastPathComponent(); |
||||||
|
if (node.getUserObject() instanceof Parameter) { |
||||||
|
ParameterTreeComboBox.this.getEditor().setItem(((Parameter)node.getUserObject()).getName()); |
||||||
|
} else { |
||||||
|
ParameterTreeComboBox.this.getEditor().setItem(null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
this.setEditable(true); |
||||||
|
} |
||||||
|
|
||||||
|
public String getSelectedParameterName() { |
||||||
|
Object obj = this.getSelectedItem(); |
||||||
|
if (obj instanceof TreePath) { |
||||||
|
return ((Parameter)((ExpandMutableTreeNode)((TreePath)obj).getLastPathComponent()).getUserObject()).getName(); |
||||||
|
} |
||||||
|
return (String)obj; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void setSelectedItem(Object o) { |
||||||
|
if (o instanceof String) { |
||||||
|
this.setSelectedItemString((String)o); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.tree.setSelectionPath((TreePath)o); |
||||||
|
this.getModel().setSelectedItem(o); |
||||||
|
} |
||||||
|
|
||||||
|
public void setSelectedParameterName(String name) { |
||||||
|
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
||||||
|
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot(); |
||||||
|
DefaultMutableTreeNode leaf = rootTreeNode.getFirstLeaf(); |
||||||
|
do { |
||||||
|
if (leaf.getUserObject() instanceof Parameter) { |
||||||
|
if (ComparatorUtils.equals(((Parameter) leaf.getUserObject()).getName(), name)) { |
||||||
|
TreePath visiblePath = new TreePath(treeModel.getPathToRoot(leaf)); |
||||||
|
tree.setSelectionPath(visiblePath); |
||||||
|
this.setSelectedItem(visiblePath); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} while ((leaf = leaf.getNextLeaf()) != null); |
||||||
|
if (this.getSelectedItem() == null) { |
||||||
|
((ComboBoxModel)treeModel).setSelectedItem(name); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 刷新目录树 |
||||||
|
*/ |
||||||
|
public void refreshTree() { |
||||||
|
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot(); |
||||||
|
rootTreeNode.removeAllChildren(); |
||||||
|
addParameterTreeNode(rootTreeNode); |
||||||
|
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
||||||
|
if (treeModel != null) { |
||||||
|
treeModel.reload(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void addParameterTreeNode(DefaultMutableTreeNode rootTreeNode) { |
||||||
|
ParameterGroup[] groups = getParameterGroup(); |
||||||
|
for (ParameterGroup group : groups) { |
||||||
|
ExpandMutableTreeNode paraTreeNode = new ExpandMutableTreeNode(group.getGroupName()); |
||||||
|
rootTreeNode.add(paraTreeNode); |
||||||
|
for (Parameter parameter : group.getParameter()) { |
||||||
|
if (parameter != null) { |
||||||
|
ExpandMutableTreeNode childTreeNode = new ExpandMutableTreeNode(parameter); |
||||||
|
paraTreeNode.add(childTreeNode); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private ParameterGroup[] getParameterGroup() { |
||||||
|
List<ParameterGroup> groupList = new ArrayList<ParameterGroup>(); |
||||||
|
Parameter[] parameters; |
||||||
|
DesignModelAdapter<?,?> model = DesignModelAdapter.getCurrentModelAdapter(); |
||||||
|
if (model != null) { |
||||||
|
// 报表参数
|
||||||
|
parameters = model.getReportParameters(); |
||||||
|
if (!ArrayUtils.isEmpty(parameters)) { |
||||||
|
groupList.add(new ParameterGroup(Inter.getLocText("ParameterD-Report_Parameter"), parameters)); |
||||||
|
} |
||||||
|
// 数据源参数
|
||||||
|
parameters = model.getTableDataParameters(); |
||||||
|
if (!ArrayUtils.isEmpty(parameters)) { |
||||||
|
groupList.add(new ParameterGroup(Inter.getLocText("FR-Designer_Datasource-Parameter"), parameters)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 全局参数
|
||||||
|
parameters = ConfigManager.getProviderInstance().getGlobal_Parameters(); |
||||||
|
if (!ArrayUtils.isEmpty(parameters)) { |
||||||
|
groupList.add(new ParameterGroup(Inter.getLocText("M_Server-Global_Parameters"), parameters)); |
||||||
|
} |
||||||
|
// 全局数据源参数
|
||||||
|
parameters = new Parameter[0]; |
||||||
|
Calculator c = Calculator.createCalculator(); |
||||||
|
DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
||||||
|
Iterator<String> nameIt = datasourceManager.getTableDataNameIterator(); |
||||||
|
while (nameIt.hasNext()) { |
||||||
|
TableData tableData = datasourceManager.getTableData(nameIt.next()); |
||||||
|
ParameterProvider[] ps = tableData.getParameters(c); |
||||||
|
if (!ArrayUtils.isEmpty(ps)) { |
||||||
|
parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); |
||||||
|
} |
||||||
|
} |
||||||
|
if (!ArrayUtils.isEmpty(parameters)) { |
||||||
|
groupList.add(new ParameterGroup(Inter.getLocText(new String[]{"Server", "Datasource-Datasource", "Parameter"}), parameters)); |
||||||
|
} |
||||||
|
return groupList.toArray(new ParameterGroup[0]); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.frpane.RegPane; |
||||||
|
import com.fr.form.ui.Password; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
|
||||||
|
public class PasswordDefinePane extends TextFieldEditorDefinePane { |
||||||
|
|
||||||
|
public PasswordDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
private static final long serialVersionUID = 4737910705071750562L; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected TextEditor newTextEditorInstance() { |
||||||
|
return new Password(); |
||||||
|
} |
||||||
|
|
||||||
|
protected RegPane createRegPane() { |
||||||
|
return new RegPane(RegPane.PASSWORD_REG_TYPE); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.FRContext; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.Radio; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class RadioDefinePane extends AbstractDataModify<Radio> { |
||||||
|
public RadioDefinePane() { |
||||||
|
this.iniComoponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void iniComoponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
|
||||||
|
UILabel infoLabel = new UILabel(); |
||||||
|
FRFont frFont = FRContext.getDefaultValues().getFRFont(); |
||||||
|
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); |
||||||
|
infoLabel.setText(Inter.getLocText( |
||||||
|
"No_Editor_Property_Definition") + "."); |
||||||
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||||
|
|
||||||
|
this.add(infoLabel, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "radio"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(Radio cellWidget) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Radio updateBean() { |
||||||
|
return new Radio(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.present.dict.DictionaryPane; |
||||||
|
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; |
||||||
|
import com.fr.form.ui.RadioGroup; |
||||||
|
|
||||||
|
public class RadioGroupDefinePane extends ButtonGroupDefinePane<RadioGroup> { |
||||||
|
private DictionaryPane dictPane; |
||||||
|
|
||||||
|
|
||||||
|
public RadioGroupDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initComponents() { |
||||||
|
super.initComponents(); |
||||||
|
|
||||||
|
dictPane = new DictionaryPane(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected RadioGroup updateSubButtonGroupBean() { |
||||||
|
RadioGroup ob = (RadioGroup)creator.toData(); |
||||||
|
|
||||||
|
ob.setDictionary(this.dictPane.updateBean()); |
||||||
|
|
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "radiogroup"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubButtonGroupBean(RadioGroup ob) { |
||||||
|
this.dictPane.populateBean(ob.getDictionary()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return dictPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.frpane.RegPane; |
||||||
|
import com.fr.form.ui.TextArea; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
|
||||||
|
|
||||||
|
public class TextAreaDefinePane extends TextFieldEditorDefinePane { |
||||||
|
public TextAreaDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
@Override |
||||||
|
protected TextEditor newTextEditorInstance() { |
||||||
|
return new TextArea(); |
||||||
|
} |
||||||
|
|
||||||
|
protected RegPane createRegPane() { |
||||||
|
return new RegPane(RegPane.TEXTAREA_REG_TYPE); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,122 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.frpane.RegPane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.KeyAdapter; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { |
||||||
|
protected RegPane regPane; |
||||||
|
private UITextField waterMarkDictPane; |
||||||
|
FormWidgetValuePane formWidgetValuePane; |
||||||
|
|
||||||
|
public TextFieldEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public TextFieldEditorDefinePane() { |
||||||
|
super(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
regPane = createRegPane(); |
||||||
|
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void regChangeAction() { |
||||||
|
waterMarkDictPane.setText(""); |
||||||
|
regPane.removeRegChangeListener(this); |
||||||
|
} |
||||||
|
}; |
||||||
|
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
||||||
|
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
||||||
|
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
||||||
|
&& StringUtils.isEmpty(waterMarkDictPane.getText())) { |
||||||
|
waterMarkDictPane.setText(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
||||||
|
regPane.addRegChangeListener(rl); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
regPane.addPhoneRegListener(pl); |
||||||
|
waterMarkDictPane = new UITextField(13); |
||||||
|
waterMarkDictPane.addKeyListener(new KeyAdapter() { |
||||||
|
public void keyTyped(KeyEvent e) { |
||||||
|
regPane.removePhoneRegListener(pl); |
||||||
|
regPane.removeRegChangeListener(rl); |
||||||
|
waterMarkDictPane.removeKeyListener(this); |
||||||
|
} |
||||||
|
}); |
||||||
|
//监听填写规则下拉框的值的变化
|
||||||
|
// regPane.getRegComboBox().addActionListener(new ActionListener() {
|
||||||
|
// public void actionPerformed(ActionEvent e) {
|
||||||
|
// RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem();
|
||||||
|
//// regErrorMsgTextField.setEnabled(regExp.errorMessageEditable());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value"), SwingConstants.LEFT), formWidgetValuePane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size"), SwingConstants.LEFT), fontSizePane} |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p}; |
||||||
|
double[] columnSize = {p,f}; |
||||||
|
int[][] rowCount = {{1, 3},{1, 1},{1, 1}}; |
||||||
|
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
return regPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected RegPane createRegPane() { |
||||||
|
return new RegPane(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "text"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubFieldEditorBean(TextEditor e) { |
||||||
|
this.regPane.populate(e.getRegex()); |
||||||
|
waterMarkDictPane.setText(e.getWaterMark()); |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected TextEditor updateSubFieldEditorBean() { |
||||||
|
TextEditor ob = newTextEditorInstance(); |
||||||
|
ob.setRegex(this.regPane.update()); |
||||||
|
ob.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
protected TextEditor newTextEditorInstance() { |
||||||
|
return new TextEditor(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.form.ui.TreeEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class TreeComboBoxEditorDefinePane extends TreeEditorDefinePane { |
||||||
|
|
||||||
|
protected UITextField waterMarkDictPane; |
||||||
|
|
||||||
|
public TreeComboBoxEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane(){ |
||||||
|
waterMarkDictPane = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "treecombobox"; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(TreeEditor ob){ |
||||||
|
super.populateSubDictionaryEditorBean(ob); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
waterMarkDictPane.setText(ob.getWaterMark()); |
||||||
|
} |
||||||
|
|
||||||
|
protected TreeEditor updateSubDictionaryEditorBean(){ |
||||||
|
TreeEditor editor = super.updateSubDictionaryEditorBean(); |
||||||
|
formWidgetValuePane.update(editor); |
||||||
|
editor.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
return editor; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return treeSettingPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
|
||||||
|
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
|
||||||
|
import com.fr.form.ui.TreeEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
* richer:tree editor |
||||||
|
*/ |
||||||
|
public class TreeEditorDefinePane extends DictEditorDefinePane<TreeEditor> { |
||||||
|
protected TreeSettingPane treeSettingPane; |
||||||
|
protected TreeRootPane treeRootPane; |
||||||
|
private UICheckBox mutiSelect; |
||||||
|
private UICheckBox loadAsync; |
||||||
|
private UICheckBox returnLeaf; |
||||||
|
private UICheckBox returnPath; |
||||||
|
|
||||||
|
public TreeEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
treeRootPane = new TreeRootPane(); |
||||||
|
treeSettingPane = new TreeSettingPane(true); |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createOtherPane() { |
||||||
|
mutiSelect = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not")); |
||||||
|
loadAsync = new UICheckBox(Inter.getLocText("Widget-Load_By_Async")); |
||||||
|
returnLeaf = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf")); |
||||||
|
returnPath = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path")); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{mutiSelect}, |
||||||
|
new Component[]{loadAsync}, |
||||||
|
new Component[]{returnLeaf}, |
||||||
|
new Component[]{returnPath} |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p}; |
||||||
|
double[] columnSize = {p}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "tree"; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(TreeEditor e){ |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
treeSettingPane.populate(e); |
||||||
|
treeRootPane.populate(e.getTreeAttr()); |
||||||
|
mutiSelect.setSelected(e.isMultipleSelection()); |
||||||
|
loadAsync.setSelected(e.isAjax()); |
||||||
|
returnLeaf.setSelected(e.isSelectLeafOnly()); |
||||||
|
returnPath.setSelected(e.isReturnFullPath()); |
||||||
|
} |
||||||
|
|
||||||
|
protected TreeEditor updateSubDictionaryEditorBean(){ |
||||||
|
TreeEditor editor = (TreeEditor)creator.toData(); |
||||||
|
formWidgetValuePane.update(editor); |
||||||
|
editor.setTreeAttr(treeRootPane.update()); |
||||||
|
editor.setMultipleSelection(mutiSelect.isSelected()); |
||||||
|
editor.setAjax(loadAsync.isSelected()); |
||||||
|
editor.setSelectLeafOnly(returnLeaf.isSelected()); |
||||||
|
editor.setReturnFullPath(returnPath.isSelected()); |
||||||
|
return editor; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return treeSettingPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.FRContext; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.NameWidget; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class UserEditorDefinePane extends AbstractDataModify<NameWidget> { |
||||||
|
private NameWidget nWidget; |
||||||
|
public UserEditorDefinePane() { |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
|
||||||
|
UILabel infoLabel = new UILabel(); |
||||||
|
FRFont frFont = FRContext.getDefaultValues().getFRFont(); |
||||||
|
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); |
||||||
|
infoLabel.setText(Inter.getLocText( |
||||||
|
"Widget-User_Defined_Editor") + "."); |
||||||
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||||
|
|
||||||
|
this.add(infoLabel, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "name"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(NameWidget cellWidget) { |
||||||
|
nWidget = cellWidget; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public NameWidget updateBean() { |
||||||
|
return nWidget; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.WaterMark; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public class WaterMarkDictPane extends JPanel{ |
||||||
|
|
||||||
|
private UITextField waterMarkTextField; |
||||||
|
|
||||||
|
public WaterMarkDictPane() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); |
||||||
|
waterMarkTextField = new UITextField(); |
||||||
|
this.add(waterMarkTextField); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(WaterMark waterMark) { |
||||||
|
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(WaterMark waterMark) { |
||||||
|
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.form.ui.WriteAbleRepeatEditor; |
||||||
|
|
||||||
|
|
||||||
|
public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor> extends DirectWriteEditorDefinePane<E> { |
||||||
|
|
||||||
|
public WritableRepeatEditorPane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubDirectWriteEditorBean(E e) { |
||||||
|
populateSubWritableRepeatEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubWritableRepeatEditorBean(E e); |
||||||
|
|
||||||
|
@Override |
||||||
|
protected E updateSubDirectWriteEditorBean() { |
||||||
|
return updateSubWritableRepeatEditorBean(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract E updateSubWritableRepeatEditorBean(); |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue