@ -1,38 +0,0 @@ |
|||||||
package com.fr.design.dscolumn; |
|
||||||
|
|
||||||
import com.fr.design.mainframe.cell.CellEditorPane; |
|
||||||
import com.fr.report.cell.TemplateCellElement; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 单元格元素 数据列 基本设置内容面板 |
|
||||||
* |
|
||||||
* @author yaoh.wu |
|
||||||
* @version 2017年7月25日 |
|
||||||
* @since 9.0 |
|
||||||
*/ |
|
||||||
public class DSColumnAdvancedEditorPane extends CellEditorPane { |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String getIconPath() { |
|
||||||
return "Advanced"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return "Advanced"; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void update() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(TemplateCellElement cellElement) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,84 +0,0 @@ |
|||||||
package com.fr.design.dscolumn; |
|
||||||
|
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.cell.CellEditorPane; |
|
||||||
import com.fr.report.cell.TemplateCellElement; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* 单元格元素 数据列 高级设置内容面板 |
|
||||||
* |
|
||||||
* @author yaoh.wu |
|
||||||
* @version 2017年7月25日 |
|
||||||
* @since 9.0 |
|
||||||
*/ |
|
||||||
public class DSColumnBasicEditorPane extends CellEditorPane { |
|
||||||
|
|
||||||
//数据集和数据列
|
|
||||||
private SelectedDataColumnPane dataPane; |
|
||||||
//数据分组设置
|
|
||||||
private ResultSetGroupDockingPane groupPane; |
|
||||||
//当前编辑的单元格
|
|
||||||
private TemplateCellElement cellElement; |
|
||||||
//条件过滤按钮面板
|
|
||||||
private JPanel conditionPane; |
|
||||||
|
|
||||||
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) { |
|
||||||
this.setLayout(new BorderLayout()); |
|
||||||
this.cellElement = cellElement; |
|
||||||
this.dataPane = dataPane; |
|
||||||
this.groupPane = groupPane; |
|
||||||
this.conditionPane = conditionPane; |
|
||||||
this.add(this.createContentPane(), BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String getIconPath() { |
|
||||||
return "Basic"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return "Basic"; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void update() { |
|
||||||
dataPane.update(this.cellElement); |
|
||||||
groupPane.update(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(TemplateCellElement cellElement) { |
|
||||||
this.cellElement = cellElement; |
|
||||||
dataPane.populate(null, cellElement); |
|
||||||
groupPane.populate(cellElement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 创建有内容的面板显示信息 |
|
||||||
* |
|
||||||
* @return content JPanel |
|
||||||
*/ |
|
||||||
private JPanel createContentPane() { |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double f = TableLayout.FILL; |
|
||||||
double[] columnSize = {f}; |
|
||||||
double[] rowSize = {p, p, p}; |
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
//数据集列选择
|
|
||||||
new Component[]{this.dataPane}, |
|
||||||
//数据分组设置
|
|
||||||
new Component[]{this.groupPane}, |
|
||||||
//条件过滤
|
|
||||||
new Component[]{this.conditionPane} |
|
||||||
}; |
|
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
|
||||||
} |
|
@ -1,45 +1,45 @@ |
|||||||
package com.fr.design.dscolumn; |
package com.fr.design.dscolumn; |
||||||
|
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ItemEvent; |
|
||||||
import java.awt.event.ItemListener; |
|
||||||
import java.util.Iterator; |
|
||||||
|
|
||||||
import com.fr.data.TableDataSource; |
import com.fr.data.TableDataSource; |
||||||
import com.fr.design.data.datapane.TableDataComboBox; |
import com.fr.design.data.datapane.TableDataComboBox; |
||||||
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
||||||
import com.fr.main.impl.WorkBook; |
import com.fr.main.impl.WorkBook; |
||||||
import com.fr.report.cell.TemplateCellElement; |
import com.fr.report.cell.TemplateCellElement; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ItemEvent; |
||||||
|
import java.awt.event.ItemListener; |
||||||
|
import java.util.Iterator; |
||||||
|
|
||||||
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { |
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { |
||||||
|
|
||||||
public SelectedConfirmedDataColumnPane () { |
public SelectedConfirmedDataColumnPane() { |
||||||
super(false); |
super(false); |
||||||
} |
} |
||||||
|
|
||||||
protected void initTableNameComboBox() { |
protected void initTableNameComboBox() { |
||||||
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
||||||
tableNameComboBox.addItemListener(new ItemListener() { |
tableNameComboBox.addItemListener(new ItemListener() { |
||||||
@Override |
@Override |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
columnNameComboBox.setLoaded(false); |
columnNameComboBox.setLoaded(false); |
||||||
} |
} |
||||||
}); |
}); |
||||||
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
||||||
} |
} |
||||||
|
|
||||||
public void populate(TableDataSource source, TemplateCellElement cell) { |
public void populate(TableDataSource source, TemplateCellElement cell) { |
||||||
tableNameComboBox.refresh(source); |
tableNameComboBox.refresh(source); |
||||||
tableNameComboBox.setEditable(false); |
tableNameComboBox.setEditable(false); |
||||||
tableNameComboBox.setEnabled(false); |
tableNameComboBox.setEnabled(false); |
||||||
super.populate(source, cell); |
super.populate(source, cell); |
||||||
try { |
try { |
||||||
Iterator it = source.getTableDataNameIterator(); |
Iterator it = source.getTableDataNameIterator(); |
||||||
String name = (String)it.next(); |
String name = (String) it.next(); |
||||||
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
||||||
tableNameComboBox.setSelectedItem(wrapper); |
tableNameComboBox.setSelectedItem(wrapper); |
||||||
tableNameComboBox.getModel().setSelectedItem(wrapper); |
tableNameComboBox.getModel().setSelectedItem(wrapper); |
||||||
} catch (Exception e) { |
} catch (Exception e) { |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
@ -1,21 +0,0 @@ |
|||||||
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(); |
|
||||||
} |
|
@ -1,11 +0,0 @@ |
|||||||
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); |
|
||||||
} |
|
@ -1,48 +1,62 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.form.ui.CheckBox; |
import com.fr.form.ui.CheckBox; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
||||||
private UITextField text; |
private UITextField text; |
||||||
|
|
||||||
public CheckBoxDefinePane() { |
public CheckBoxDefinePane() { |
||||||
this.iniComoponents(); |
this.iniComoponents(); |
||||||
} |
} |
||||||
|
|
||||||
private void iniComoponents() { |
private void iniComoponents() { |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
text = new UITextField(8); |
||||||
JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
JPanel panel = new JPanel(new BorderLayout()); |
||||||
textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
panel.add(text, BorderLayout.CENTER); |
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); |
panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0)); |
||||||
textPane.add(new UILabel(Inter.getLocText("Text") + ":")); |
|
||||||
text = new UITextField(8); |
double f = TableLayout.FILL; |
||||||
textPane.add(text); |
double p = TableLayout.PREFERRED; |
||||||
this.add(uiExpandablePane); |
Component[][] components = new Component[][]{ |
||||||
} |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel}, |
||||||
|
}; |
||||||
@Override |
double[] rowSize = {p}; |
||||||
protected String title4PopupWindow() { |
double[] columnSize = {p, f}; |
||||||
return "CheckBox"; |
int[][] rowCount = {{1, 1}}; |
||||||
} |
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
||||||
|
|
||||||
@Override |
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane); |
||||||
public void populateBean(CheckBox check) { |
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
text.setText(check.getText()); |
|
||||||
} |
this.add(uiExpandablePane); |
||||||
|
} |
||||||
@Override |
|
||||||
public CheckBox updateBean() { |
@Override |
||||||
CheckBox box = new CheckBox(); |
protected String title4PopupWindow() { |
||||||
box.setText(text.getText()); |
return "CheckBox"; |
||||||
return box; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
|
public void populateBean(CheckBox check) { |
||||||
|
text.setText(check.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CheckBox updateBean() { |
||||||
|
CheckBox box = new CheckBox(); |
||||||
|
box.setText(text.getText()); |
||||||
|
return box; |
||||||
|
} |
||||||
} |
} |
@ -1 +1,66 @@ |
|||||||
package com.fr.design.widget.ui;
import com.fr.base.GraphHelper;
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() {
this.initComponents();
}
@Override
protected JPanel setThirdContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
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 = this.setForthContentPane();
if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER);
}
return contentPane;
}
public JPanel setValidatePane(){
JPanel otherContentPane = super.setValidatePane();
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5));
return otherContentPane;
}
protected abstract JPanel setForthContentPane();
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();
} |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
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() { |
||||||
|
this.initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setThirdContentPane() { |
||||||
|
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
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)); |
||||||
|
this.customDataCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
JPanel otherContentPane = this.setForthContentPane(); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
JPanel otherContentPane = super.setValidatePane(); |
||||||
|
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 0); |
||||||
|
otherContentPane.add(jPanel, BorderLayout.CENTER); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected abstract JPanel setForthContentPane(); |
||||||
|
|
||||||
|
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(); |
||||||
|
|
||||||
|
} |
@ -1,92 +1,83 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.*; |
|
||||||
|
|
||||||
import com.fr.design.constants.LayoutConstants; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.design.gui.icombobox.DictionaryComboBox; |
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
import com.fr.design.gui.icombobox.DictionaryConstants; |
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||||
import com.fr.design.gui.itextfield.UINumberField; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.gui.ispinner.UISpinner; |
||||||
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.form.ui.MultiFileEditor; |
import com.fr.form.ui.MultiFileEditor; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
import javax.swing.*; |
||||||
private DictionaryComboBox acceptType; |
import java.awt.*; |
||||||
private UICheckBox singleFileCheckBox; |
|
||||||
private UINumberField fileSizeField; |
|
||||||
|
|
||||||
public MultiFileEditorPane() { |
|
||||||
this.initComponents(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return "file"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel setFirstContentPane() { |
|
||||||
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
|
||||||
acceptType.setPreferredSize(new Dimension(200, 18)); |
|
||||||
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
|
||||||
fileSizeField = new UINumberField(); |
|
||||||
fileSizeField.setPreferredSize(new Dimension(80, 18)); |
|
||||||
|
|
||||||
|
|
||||||
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}, |
|
||||||
}; |
|
||||||
double[] rowSize = {p, p,p}; |
|
||||||
double[] columnSize = {p,f}; |
|
||||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; |
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); |
|
||||||
|
|
||||||
|
|
||||||
return panel; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
|
||||||
// 这里存在兼容问题 getAccept可能没在待选项目中
|
|
||||||
acceptType.setSelectedItem(e.getAccept()); |
|
||||||
singleFileCheckBox.setSelected(e.isSingleFile()); |
|
||||||
fileSizeField.setValue(e.getMaxSize()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
||||||
protected MultiFileEditor updateSubFieldEditorBean() { |
private DictionaryComboBox acceptType; |
||||||
MultiFileEditor ob = new MultiFileEditor(); |
private UICheckBox singleFileCheckBox; |
||||||
ob.setAccept((String) acceptType.getSelectedItem()); |
private UISpinner fileSizeField; |
||||||
ob.setSingleFile(singleFileCheckBox.isSelected()); |
|
||||||
ob.setMaxSize(fileSizeField.getValue()); |
public MultiFileEditorPane() { |
||||||
return ob; |
this.initComponents(); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return "file"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
JPanel contenter = new JPanel(new BorderLayout()); |
||||||
|
|
||||||
|
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
||||||
|
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
||||||
|
// acceptType.setPreferredSize(new Dimension(100, 20));
|
||||||
|
fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); |
||||||
|
fileSizeField.setPreferredSize(new Dimension(140, 20)); |
||||||
|
|
||||||
|
JPanel fileSizePane = new JPanel(new BorderLayout()); |
||||||
|
UILabel fileTypeLabel = new UILabel(Inter.getLocText("Utils-File_type")); |
||||||
|
UILabel fileSizeLabel = new UILabel(Inter.getLocText("FR-Designer_Size_Limit")); |
||||||
|
fileSizePane.add(fileSizeField, BorderLayout.CENTER); |
||||||
|
fileSizePane.add(new UILabel(" KB"), BorderLayout.EAST); |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{singleFileCheckBox, null}, |
||||||
|
new Component[]{fileTypeLabel, acceptType}, |
||||||
|
new Component[]{fileSizeLabel, fileSizePane}, |
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 22, 10); |
||||||
|
|
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 00)); |
||||||
|
contenter.add(panel, BorderLayout.CENTER); |
||||||
|
|
||||||
|
return contenter; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
||||||
|
// 这里存在兼容问题 getAccept可能没在待选项目中
|
||||||
|
acceptType.setSelectedItem(e.getAccept()); |
||||||
|
singleFileCheckBox.setSelected(e.isSingleFile()); |
||||||
|
fileSizeField.setValue(e.getMaxSize()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected MultiFileEditor updateSubFieldEditorBean() { |
||||||
|
MultiFileEditor ob = new MultiFileEditor(); |
||||||
|
ob.setAccept((String) acceptType.getSelectedItem()); |
||||||
|
ob.setSingleFile(singleFileCheckBox.isSelected()); |
||||||
|
ob.setMaxSize(fileSizeField.getValue()); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -0,0 +1,206 @@ |
|||||||
|
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
|
import com.fr.base.Formula; |
||||||
|
import com.fr.base.Style; |
||||||
|
import com.fr.base.TextFormat; |
||||||
|
import com.fr.design.actions.core.ActionFactory; |
||||||
|
import com.fr.design.actions.insert.cell.FormulaCellAction; |
||||||
|
import com.fr.design.dialog.DialogActionAdapter; |
||||||
|
import com.fr.design.formula.FormulaFactory; |
||||||
|
import com.fr.design.formula.UIFormula; |
||||||
|
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.grid.selection.CellSelection; |
||||||
|
import com.fr.quickeditor.CellQuickEditor; |
||||||
|
import com.fr.report.ReportHelper; |
||||||
|
import com.fr.report.cell.DefaultTemplateCellElement; |
||||||
|
import com.fr.stable.ColumnRow; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.event.DocumentEvent; |
||||||
|
import javax.swing.event.DocumentListener; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.awt.event.KeyAdapter; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 公式快速编辑面板,同文本数字编辑拆分 |
||||||
|
* |
||||||
|
* @author yaoh.wu |
||||||
|
* @version 2017年8月7日10点44分 |
||||||
|
* @since 9.0 |
||||||
|
*/ |
||||||
|
public class CellFormulaQuickEditor extends CellQuickEditor { |
||||||
|
//文本域
|
||||||
|
private UITextField formulaTextField; |
||||||
|
//编辑状态
|
||||||
|
private boolean isEditing = false; |
||||||
|
|
||||||
|
//编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
|
||||||
|
private boolean reserveInResult = false; |
||||||
|
private boolean reserveOnWriteOrAnaly = true; |
||||||
|
|
||||||
|
//默认值
|
||||||
|
private static final String DEFAULT_FORMULA = "="; |
||||||
|
|
||||||
|
private DocumentListener documentListener = new DocumentListener() { |
||||||
|
@Override |
||||||
|
public void insertUpdate(DocumentEvent e) { |
||||||
|
changeReportPaneCell(formulaTextField.getText().trim()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void removeUpdate(DocumentEvent e) { |
||||||
|
changeReportPaneCell(formulaTextField.getText().trim()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void changedUpdate(DocumentEvent e) { |
||||||
|
changeReportPaneCell(formulaTextField.getText().trim()); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
private CellFormulaQuickEditor() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 详细信息面板 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public JComponent createCenterBody() { |
||||||
|
JPanel content = new JPanel(new BorderLayout()); |
||||||
|
formulaTextField = new UITextField(); |
||||||
|
formulaTextField.addKeyListener(new KeyAdapter() { |
||||||
|
@Override |
||||||
|
public void keyReleased(KeyEvent e) { |
||||||
|
if (tc != null) { |
||||||
|
tc.getGrid().dispatchEvent(e); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
JPanel textFieldPane = new JPanel(new BorderLayout()); |
||||||
|
textFieldPane.add(formulaTextField, BorderLayout.CENTER); |
||||||
|
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); |
||||||
|
|
||||||
|
UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
||||||
|
formulaButton.setToolTipText(Inter.getLocText("Formula") + "..."); |
||||||
|
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); |
||||||
|
formulaButton.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent evt) { |
||||||
|
String text = formulaTextField.getText(); |
||||||
|
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
||||||
|
formulaPane.populate(new Formula(text)); |
||||||
|
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||||
|
@Override |
||||||
|
public void doOk() { |
||||||
|
Formula fm = formulaPane.update(); |
||||||
|
if (fm.getContent().length() <= 1) { |
||||||
|
formulaTextField.setText(DEFAULT_FORMULA); |
||||||
|
} else { |
||||||
|
formulaTextField.setText(fm.getContent()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}).setVisible(true); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
JPanel pane = new JPanel(new BorderLayout()); |
||||||
|
pane.add(textFieldPane, BorderLayout.CENTER); |
||||||
|
pane.add(formulaButton, BorderLayout.EAST); |
||||||
|
|
||||||
|
content.add(pane, BorderLayout.NORTH); |
||||||
|
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ |
||||||
|
new Component[]{emptyLabel, content}}, |
||||||
|
new double[]{TableLayout.PREFERRED}, |
||||||
|
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object getComboBoxSelected() { |
||||||
|
return ActionFactory.createAction(FormulaCellAction.class); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void changeReportPaneCell(String tmpText) { |
||||||
|
isEditing = true; |
||||||
|
//refresh一下,如果单元格内有新添加的控件,此时并不知道
|
||||||
|
CellSelection cs1 = (CellSelection) tc.getSelection(); |
||||||
|
ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow()); |
||||||
|
columnRowTextField.setText(columnRow.toString()); |
||||||
|
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow()); |
||||||
|
|
||||||
|
if (cellElement == null) { |
||||||
|
CellSelection cs = (CellSelection) tc.getSelection(); |
||||||
|
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||||
|
tc.getEditingElementCase().addCellElement(cellElement, false); |
||||||
|
} |
||||||
|
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { |
||||||
|
Formula textFormula = new Formula(tmpText); |
||||||
|
textFormula.setReserveInResult(reserveInResult); |
||||||
|
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); |
||||||
|
cellElement.setValue(textFormula); |
||||||
|
} else { |
||||||
|
Style style = cellElement.getStyle(); |
||||||
|
if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { |
||||||
|
cellElement.setValue(tmpText); |
||||||
|
} else { |
||||||
|
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); |
||||||
|
} |
||||||
|
} |
||||||
|
fireTargetModified(); |
||||||
|
formulaTextField.requestFocus(); |
||||||
|
isEditing = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 刷新详细内容 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected void refreshDetails() { |
||||||
|
String str; |
||||||
|
if (cellElement == null) { |
||||||
|
str = StringUtils.EMPTY; |
||||||
|
} else { |
||||||
|
Object value = cellElement.getValue(); |
||||||
|
if (value == null) { |
||||||
|
str = StringUtils.EMPTY; |
||||||
|
} else if (value instanceof Formula) { |
||||||
|
Formula formula = (Formula) value; |
||||||
|
str = formula.getContent(); |
||||||
|
reserveInResult = formula.isReserveInResult(); |
||||||
|
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); |
||||||
|
} else { |
||||||
|
str = value.toString(); |
||||||
|
} |
||||||
|
} |
||||||
|
showText(str); |
||||||
|
formulaTextField.setEditable(tc.isSelectedOneCell()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 显示文本 |
||||||
|
* |
||||||
|
* @param str 文本 |
||||||
|
*/ |
||||||
|
public void showText(String str) { |
||||||
|
// 正在编辑时不处理
|
||||||
|
if (isEditing) { |
||||||
|
return; |
||||||
|
} |
||||||
|
formulaTextField.getDocument().removeDocumentListener(documentListener); |
||||||
|
formulaTextField.setText(str); |
||||||
|
formulaTextField.getDocument().addDocumentListener(documentListener); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,50 +1,52 @@ |
|||||||
package com.fr.quickeditor.cellquick; |
package com.fr.quickeditor.cellquick; |
||||||
|
|
||||||
|
import com.fr.design.actions.core.ActionFactory; |
||||||
import com.fr.design.actions.insert.cell.RichTextCellAction; |
import com.fr.design.actions.insert.cell.RichTextCellAction; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.quickeditor.CellQuickEditor; |
import com.fr.quickeditor.CellQuickEditor; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* 单元格元素富文本编辑器 |
* 单元格元素富文本编辑器 |
||||||
* TODO 9.0 大体上没有改动 |
* |
||||||
|
* @author yaoh.wu |
||||||
|
* @version 2017年8月7日10点53分 |
||||||
*/ |
*/ |
||||||
public class CellRichTextEditor extends CellQuickEditor { |
public class CellRichTextEditor extends CellQuickEditor { |
||||||
private UIButton subReportButton; |
private UIButton richTextButton; |
||||||
private static CellRichTextEditor THIS; |
|
||||||
|
|
||||||
public static final CellRichTextEditor getInstance() { |
|
||||||
if (THIS == null) { |
|
||||||
THIS = new CellRichTextEditor(); |
|
||||||
} |
|
||||||
return THIS; |
|
||||||
} |
|
||||||
|
|
||||||
private CellRichTextEditor() { |
private CellRichTextEditor() { |
||||||
super(); |
super(); |
||||||
} |
} |
||||||
|
|
||||||
/** |
@Override |
||||||
* 创建界面上中间的部分 |
|
||||||
* |
|
||||||
* @return 界面元素 |
|
||||||
* @date 2014-12-7-下午9:41:52 |
|
||||||
*/ |
|
||||||
public JComponent createCenterBody() { |
public JComponent createCenterBody() { |
||||||
subReportButton = new UIButton(); |
JPanel content = new JPanel(new BorderLayout()); |
||||||
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
richTextButton = new UIButton(); |
||||||
subReportButton.setMargin(null); |
richTextButton.setOpaque(false); |
||||||
subReportButton.setOpaque(false); |
content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ |
||||||
return subReportButton; |
new Component[]{emptyLabel, richTextButton}}, |
||||||
|
new double[]{TableLayout.PREFERRED}, |
||||||
|
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); |
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object getComboBoxSelected() { |
||||||
|
return ActionFactory.createAction(RichTextCellAction.class); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void refreshDetails() { |
protected void refreshDetails() { |
||||||
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); |
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); |
||||||
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); |
subReportCellAction.setName(Inter.getLocText("Edit")); |
||||||
subReportButton.setAction(subReportCellAction); |
subReportCellAction.setSmallIcon(null); |
||||||
|
richTextButton.setAction(subReportCellAction); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 232 B |