Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~alex.sung/design into release/10.0

final/10.0
alex.sung 6 years ago
parent
commit
24bd4c9197
  1. 42
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  3. 475
      designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  5. 13
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java
  6. 28
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  7. 5
      designer-form/src/main/java/com/fr/design/form/mobile/FormMobileAttrPane.java
  8. 260
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  9. 5
      designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java
  10. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

42
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -155,8 +155,6 @@ public class PreferencePane extends BasicPane {
createServerPane(advancePane);
createJdkHomePane(advancePane);
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
@ -470,42 +468,6 @@ public class PreferencePane extends BasicPane {
serverPortPane.add(choosePortPane, BorderLayout.CENTER);
}
private void createJdkHomePane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_JDK_Home"));
advancePane.add(serverPortPane);
jdkHomeTextField = new UITextField();
UIButton chooseBtn = new UIButton("...");
chooseBtn.setPreferredSize(new Dimension(20, 20));
JPanel panel = GUICoreUtils.createBorderLayoutPane(
jdkHomeTextField, BorderLayout.CENTER,
chooseBtn, BorderLayout.EAST
);
chooseBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnValue = fileChooser.showOpenDialog(PreferencePane.this);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
jdkHomeTextField.setText(file.getAbsolutePath());
}
}
});
panel.setPreferredSize(new Dimension(300, 20));
UILabel notiJlabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));
UILabel serverPortLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_JDK_Home") + ":");
Component[][] portComponents = {
{serverPortLabel, panel, notiJlabel},
};
JPanel choosePortPane = TableLayoutHelper.createTableLayoutPane(portComponents, rowSize, columnSize);
serverPortPane.add(choosePortPane, BorderLayout.CENTER);
}
private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
@ -575,8 +537,6 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
this.jdkHomeTextField.setText(designerEnvManager.getJdkHome());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
@ -636,8 +596,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setJdkHome(jdkHomeTextField.getText());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());

6
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -35,6 +35,7 @@ public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name";
public static final int TIME_MULTIPLE = 1000;
private static final String EMPTY_DB = StringUtils.EMPTY;
private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>();
@ -64,7 +65,7 @@ public class JDBCDefPane extends JPanel {
private UITextField userNameTextField;
private JPasswordField passwordTextField;
// 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", "Others"};
private final String[] dbtype = {EMPTY_DB, "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", "Others"};
// carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
@ -182,6 +183,9 @@ public class JDBCDefPane extends JPanel {
break;
}
}
if (!out) {
this.dbtypeComboBox.setSelectedItem(EMPTY_DB);
}
}
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL());

475
designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -1,8 +1,17 @@
package com.fr.design.gui.columnrow;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.JFormattedTextField;
import javax.swing.JPanel;
@ -16,19 +25,9 @@ import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
/**
* the component to edit ColumnRow
@ -37,224 +36,228 @@ import com.fr.design.utils.gui.GUICoreUtils;
*/
public class ColumnRowPane extends JPanel implements UIObserver {
private static final long serialVersionUID = 1L;
private static String[] columnarray = new String[1000];
private static String[] rowarray = new String[5000];
protected UpperCaseSpinner columnSpinner;
protected UIBasicSpinner rowSpinner;
static {
for (int i = 1; i < 1000; i++) {
columnarray[i - 1] = StableUtils.convertIntToABC(i);
}
for (int i = 1; i < 5000; i++) {
rowarray[i - 1] = StringUtils.EMPTY + i;
}
}
protected DocumentListener d = new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
String rolText = ((DefaultEditor) columnSpinner.getEditor()).getTextField().getText();
String rowText = ((DefaultEditor) rowSpinner.getEditor()).getTextField().getText();
if (rolText == null || rolText.length() == 0 || rowText == null || rowText.length() == 0) {
return;
}
int col = StableUtils.convertABCToInt(rolText) - 1;
int row = Integer.parseInt(rowText) - 1;
setColumnRow(ColumnRow.valueOf(col, row));
}
@Override
public void insertUpdate(DocumentEvent e) {
int col = StableUtils.convertABCToInt(((DefaultEditor) columnSpinner.getEditor()).getTextField().getText()) - 1;
int row = Integer.parseInt(((DefaultEditor) rowSpinner.getEditor()).getTextField().getText()) - 1;
setColumnRow(ColumnRow.valueOf(col, row));
}
@Override
public void changedUpdate(DocumentEvent e) {
}
};
private UIObserverListener uiObserverListener;
private ColumnRow cr;
public ColumnRowPane() {
this.initComponents();
iniListener();
}
/**
* 初始化元素
*/
public void initComponents() {
this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0));
initColSpinner();
this.add(columnSpinner, BorderLayout.WEST);
initRowSpinner();
this.add(rowSpinner);
this.addDocumentListener(d);
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
}
uiObserverListener.doChange();
}
});
}
}
protected void initRowSpinner() {
rowSpinner = new ColumnRowSpinner((new SpinnerListModel(rowarray))) {
public boolean shouldResponseChangeListener() {
return false;
}
};
rowSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField rftf = GUICoreUtils.getSpinnerTextField(rowSpinner);
if (rftf != null) {
rftf.setColumns(4); // specify more width than we need
rftf.setHorizontalAlignment(UITextField.LEFT);
}
}
protected void initColSpinner() {
SpinnerListModel columnSpinnerListModel = new SpinnerListModel(columnarray);
columnSpinner = new UpperCaseSpinner(columnSpinnerListModel) {
public boolean shouldResponseChangeListener() {
return false;
}
};
columnSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField cftf = GUICoreUtils.getSpinnerTextField(columnSpinner);
if (cftf != null) {
cftf.setColumns(3); // specify more width than we need
cftf.setHorizontalAlignment(UITextField.LEFT);
}
((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() {
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
fb.insertString(offset, string.toUpperCase(), attr);
}
public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException {
if (string != null) {
string = string.toUpperCase();
}
fb.replace(offset, length, string, attr);
}
});
}
protected void addDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
}
private void removeDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
}
/**
* columnSpinner与rowSpinner应该整体考虑设置ColumnRow应该只触发一次事件
*
* @param columnRow
*/
public void setColumnRow(ColumnRow columnRow) {
if (!ComparatorUtils.equals(cr, columnRow)) {
setGlobalName();
removeDocumentListener(d);
cr = columnRow;
addDocumentListener(d);
fireChanged();
}
}
public void setGlobalName(){
}
public void populate(ColumnRow columnRow) {
cr = columnRow;
int column = columnRow.getColumn();
if (column < 0) {
column = 0;
}
removeDocumentListener(d);
columnSpinner.setValue(StableUtils.convertIntToABC(column + 1));
int row = columnRow.getRow();
// shoc 小于0就蹦了
if (row < 0) {
row = 0;
}
rowSpinner.setValue("" + (row + 1));
addDocumentListener(d);
fireChanged();
}
public ColumnRow update() {
return cr;
}
/**
* 添加一个listener到listenerList中
* @param l 监听
*/
public void addChangeListener(ChangeListener l) {
this.listenerList.add(ChangeListener.class, l);
}
/**
* 从listenerList中移除一个listener
* @param l 监听
*/
public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l);
}
// august: Process the listeners last to first
protected void fireChanged() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this));
}
}
}
/**
* 给组件登记一个观察者监听事件
* @param listener 监听
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
/**
* 组件是否需要响应添加的观察者事件
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
private static final long serialVersionUID = 1L;
private static String[] columnarray = new String[1000];
private static String[] rowarray = new String[5000];
protected UpperCaseSpinner columnSpinner;
protected UIBasicSpinner rowSpinner;
static {
for (int i = 1; i <= 1000; i++) {
columnarray[i - 1] = StableUtils.convertIntToABC(i);
}
for (int i = 1; i <= 5000; i++) {
rowarray[i - 1] = StringUtils.EMPTY + i;
}
}
protected DocumentListener d = new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
String rolText = ((DefaultEditor) columnSpinner.getEditor()).getTextField().getText();
String rowText = ((DefaultEditor) rowSpinner.getEditor()).getTextField().getText();
if (rolText == null || rolText.length() == 0 || rowText == null || rowText.length() == 0) {
return;
}
int col = StableUtils.convertABCToInt(rolText) - 1;
int row = Integer.parseInt(rowText) - 1;
setColumnRow(ColumnRow.valueOf(col, row));
}
@Override
public void insertUpdate(DocumentEvent e) {
int col = StableUtils.convertABCToInt(((DefaultEditor) columnSpinner.getEditor()).getTextField().getText()) - 1;
int row = Integer.parseInt(((DefaultEditor) rowSpinner.getEditor()).getTextField().getText()) - 1;
setColumnRow(ColumnRow.valueOf(col, row));
}
@Override
public void changedUpdate(DocumentEvent e) {
}
};
private UIObserverListener uiObserverListener;
private ColumnRow cr;
public ColumnRowPane() {
this.initComponents();
iniListener();
}
/**
* 初始化元素
*/
public void initComponents() {
this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0));
initColSpinner();
this.add(columnSpinner, BorderLayout.WEST);
initRowSpinner();
this.add(rowSpinner);
this.addDocumentListener(d);
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
}
uiObserverListener.doChange();
}
});
}
}
protected void initRowSpinner() {
rowSpinner = new ColumnRowSpinner((new SpinnerListModel(rowarray))) {
public boolean shouldResponseChangeListener() {
return false;
}
};
rowSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField rftf = GUICoreUtils.getSpinnerTextField(rowSpinner);
if (rftf != null) {
rftf.setColumns(4); // specify more width than we need
rftf.setHorizontalAlignment(UITextField.LEFT);
}
}
protected void initColSpinner() {
SpinnerListModel columnSpinnerListModel = new SpinnerListModel(columnarray);
columnSpinner = new UpperCaseSpinner(columnSpinnerListModel) {
public boolean shouldResponseChangeListener() {
return false;
}
};
columnSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField cftf = GUICoreUtils.getSpinnerTextField(columnSpinner);
if (cftf != null) {
cftf.setColumns(3); // specify more width than we need
cftf.setHorizontalAlignment(UITextField.LEFT);
}
((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() {
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
fb.insertString(offset, string.toUpperCase(), attr);
}
public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException {
if (string != null) {
string = string.toUpperCase();
}
fb.replace(offset, length, string, attr);
}
});
}
protected void addDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
}
private void removeDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
}
/**
* columnSpinner与rowSpinner应该整体考虑设置ColumnRow应该只触发一次事件
*
* @param columnRow
*/
public void setColumnRow(ColumnRow columnRow) {
if (!ComparatorUtils.equals(cr, columnRow)) {
setGlobalName();
removeDocumentListener(d);
cr = columnRow;
addDocumentListener(d);
fireChanged();
}
}
public void setGlobalName() {
}
public void populate(ColumnRow columnRow) {
cr = columnRow;
int column = columnRow.getColumn();
if (column < 0) {
column = 0;
}
removeDocumentListener(d);
columnSpinner.setValue(StableUtils.convertIntToABC(column + 1));
int row = columnRow.getRow();
// shoc 小于0就蹦了
if (row < 0) {
row = 0;
}
rowSpinner.setValue("" + (row + 1));
addDocumentListener(d);
fireChanged();
}
public ColumnRow update() {
return cr;
}
/**
* 添加一个listener到listenerList中
*
* @param l 监听
*/
public void addChangeListener(ChangeListener l) {
this.listenerList.add(ChangeListener.class, l);
}
/**
* 从listenerList中移除一个listener
*
* @param l 监听
*/
public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l);
}
// august: Process the listeners last to first
protected void fireChanged() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this));
}
}
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 监听
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
}

7
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -246,6 +246,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
new MkdirDialog();
stateChange();
}
}
@ -263,7 +264,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override
public void actionPerformed(ActionEvent evt) {
selectedOperation.showInExplorer();
}
}
@ -281,10 +281,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override
public void actionPerformed(ActionEvent evt) {
selectedOperation.refresh();
stateChange();
}
}
@ -322,6 +320,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new FileRenameDialog(node);
MutilTempalteTabPane.getInstance().repaint();
stateChange();
}
}
@ -347,8 +346,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
WARNING_MESSAGE);
return;
}
selectedOperation.deleteFile();
stateChange();
}
}

13
designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java

@ -10,14 +10,13 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.general.GeneralUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
/**
* Created by shine on 2018/3/2.
@ -54,7 +53,7 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
this.add(panel, BorderLayout.NORTH);
if (hasCustomFieldPane()) {
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane();
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane(hasNoneItem());
this.add(customFieldComboBoxPane, BorderLayout.CENTER);
}
@ -69,6 +68,10 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
return false;
}
protected boolean hasNoneItem() {
return false;
}
protected Component[] fieldComponents() {
return filedComboBoxes();
}

28
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -11,16 +11,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UITable;
import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@ -30,6 +26,10 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
/**
* Created by shine on 2018/9/12.
@ -38,10 +38,17 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private UseFieldValuePane useFieldValuePane;
private boolean hasNoneItem = false;
private CustomFieldNamePane customFieldNamePane;
private List<String> fieldList = new ArrayList<String>();
public ExtendedCustomFieldComboBoxPane(boolean hasNoneItem) {
this.hasNoneItem = hasNoneItem;
}
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
@ -119,6 +126,11 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
series = new UIComboBox();
value = new UIComboBox();
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
function = new CalculateComboBox();
Component[][] components = new Component[][]{
@ -146,11 +158,17 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
public void clearAllBoxList() {
DataPaneHelper.clearBoxItems(series);
DataPaneHelper.clearBoxItems(value);
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
public void refreshBoxListWithSelectTableData(List columnNameList) {
DataPaneHelper.refreshBoxItems(series, columnNameList);
DataPaneHelper.refreshBoxItems(value, columnNameList);
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
@Override

5
designer-form/src/main/java/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -13,8 +13,6 @@ import java.awt.*;
* Created by fanglei on 2016/11/17.
*/
public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 模版设置面板
private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane;
// 其他
@ -33,7 +31,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
panel.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
panel.add(formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane());
panel.add(mobileToolBarPane = new MobileToolBarPane());
panel.add(formMobileOthersPane = new FormMobileOthersPane());
JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -47,7 +44,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
if (ob == null) {
ob = new FormMobileAttr();
}
this.mobileToolBarPane.populateBean(ob);
this.formMobileTemplateSettingsPane.populateBean(ob);
this.formMobileOthersPane.populateBean(ob);
}
@ -55,7 +51,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
@Override
public FormMobileAttr updateBean() {
FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr);
this.formMobileTemplateSettingsPane.updateBean(formMobileAttr);
this.formMobileOthersPane.updateBean(formMobileAttr);
return formMobileAttr;

260
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -7,6 +7,7 @@ import com.fr.design.fun.JavaScriptActionProvider;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -28,140 +29,143 @@ import java.util.List;
import java.util.Set;
public class ListenerEditPane extends BasicBeanPane<Listener> {
private UITextField nameText;
private UIComboBox styleBox;
private CardLayout card;
private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane;
private JavaScriptImplPane javaScriptPane;
private FormSubmitJavaScriptPane formSubmitScriptPane;
private Commit2DBJavaScriptPane commit2DBJavaScriptPane;
// 自定义事件
private CustomActionPane customActionPane;
// 发送邮件
private EmailPane emailPane;
private static final String JS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript");
private static final String FORMSUBMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Form_Submit");
private static final String DBCOMMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Commit_To_Database");
private static final String CUSTOMACTION= com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Custom_Submit");
private static final String EMAIL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
private Listener listener;
public ListenerEditPane() {
this.initComponents(new String[0]);
}
private UITextField nameText;
private UIComboBox styleBox;
private CardLayout card;
private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane;
public ListenerEditPane(String[] defaultArgs) {
this.initComponents(defaultArgs);
}
private static final String JS = Toolkit.i18nText("Fine-Design_Report_JavaScript");
private static final String DBCOMMIT = Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
private static final String CUSTOMACTION = Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom");
private static final String EMAIL = Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
/**
* 初始化各个组件
* @param defaultArgs 初始化参数
*/
public void initComponents(String[] defaultArgs) {
cards = new ArrayList<FurtherBasicBeanPane<? extends JavaScript>>();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8);
nameText.setEditable(false);
namePane.add(nameText, BorderLayout.WEST);
String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL};
styleBox = new UIComboBox(style);
namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"), nameText, new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"), styleBox}, FlowLayout.LEFT);
namePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")));
this.add(namePane, BorderLayout.NORTH);
card = new CardLayout();
hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
hyperlinkPane.setLayout(card);
javaScriptPane = new JavaScriptImplPane(defaultArgs);
hyperlinkPane.add(JS, javaScriptPane);
// 提交入库
List dbmaniList = new ArrayList();
dbmaniList.add(autoCreateDBManipulationPane());
commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane,
dbmaniList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件
emailPane = new EmailPane();
hyperlinkPane.add(EMAIL,emailPane);
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
//其他事件
addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Set")));
this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
card.show(hyperlinkPane, styleBox.getSelectedItem().toString());
}
});
}
private Listener listener;
private void addOtherEvent(){
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane();
String title = pane.title4PopupWindow();
styleBox.addItem(title);
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
}
public ListenerEditPane() {
this.initComponents(new String[0]);
}
public ListenerEditPane(String[] defaultArgs) {
this.initComponents(defaultArgs);
}
/**
* 根据有无单元格创建 DBManipulationPane
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane
* 初始化各个组件
*
* @param defaultArgs 初始化参数
*/
private DBManipulationPane autoCreateDBManipulationPane() {
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
return jTemplate.createDBManipulationPane();
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Set");
}
@Override
public void populateBean(Listener listener) {
this.listener = listener;
if (this.listener == null) {
this.listener = new Listener();
}
this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction();
for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(js)) {
styleBox.setSelectedItem(pane.title4PopupWindow());
card.show(hyperlinkPane, pane.title4PopupWindow());
pane.populateBean(js);
return;
}
}
}
public void initComponents(String[] defaultArgs) {
cards = new ArrayList<>();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8);
nameText.setEditable(false);
namePane.add(nameText, BorderLayout.WEST);
final String[] style = {JS, DBCOMMIT, CUSTOMACTION, EMAIL};
styleBox = new UIComboBox(style);
namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{
new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"),
nameText,
new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"),
styleBox},
FlowLayout.LEFT);
namePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")));
this.add(namePane, BorderLayout.NORTH);
card = new CardLayout();
hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
hyperlinkPane.setLayout(card);
JavaScriptImplPane javaScriptPane = new JavaScriptImplPane(defaultArgs);
hyperlinkPane.add(JS, javaScriptPane);
// 提交入库
List dbManiList = new ArrayList();
dbManiList.add(autoCreateDBManipulationPane());
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane,
dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
CustomActionPane customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件
EmailPane emailPane = new EmailPane();
hyperlinkPane.add(EMAIL, emailPane);
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
//其他事件
addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_JavaScript_Set")));
this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
Object selected = styleBox.getSelectedItem();
if (selected == null) {
return;
}
card.show(hyperlinkPane, selected.toString());
}
});
}
private void addOtherEvent() {
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane();
String title = pane.title4PopupWindow();
styleBox.addItem(title);
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
}
/**
* 根据有无单元格创建 DBManipulationPane
*
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane
*/
private DBManipulationPane autoCreateDBManipulationPane() {
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
return jTemplate.createDBManipulationPane();
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Event_Set");
}
@Override
public void populateBean(Listener listener) {
this.listener = listener;
if (this.listener == null) {
this.listener = new Listener();
}
this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction();
for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(js)) {
styleBox.setSelectedItem(pane.title4PopupWindow());
card.show(hyperlinkPane, pane.title4PopupWindow());
pane.populateBean(js);
return;
}
}
}
public void checkValid() throws Exception{
this.cards.get(this.styleBox.getSelectedIndex()).checkValid();
}
public void checkValid() throws Exception {
this.cards.get(this.styleBox.getSelectedIndex()).checkValid();
}
@Override
public Listener updateBean(){
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());
return this.listener;
}
@Override
public Listener updateBean() {
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());
return this.listener;
}
}

5
designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -15,8 +15,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private ReportMobileTemplateSettingsPane reportMobileTemplateSettingsPane; // 模版设置面板
private AppFitBrowserPane appFitBrowserPane;
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 其他
private MobileOthersPane mobileOthersPane;
@ -38,7 +36,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
jPanel.add(appFitBrowserPane);
jPanel.add(mobileToolBarPane = new MobileToolBarPane());
jPanel.add(mobileOthersPane = new MobileOthersPane());
jPanel.add(appFitPreviewPane);
@ -52,7 +49,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
ob = new ElementCaseMobileAttr();
}
appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob);
mobileOthersPane.populateBean(ob);
reportMobileTemplateSettingsPane.populateBean(ob);
}
@ -60,7 +56,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
@Override
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr);
mobileOthersPane.updateBean(caseMobileAttr);
reportMobileTemplateSettingsPane.updateBean(caseMobileAttr);

2
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -86,7 +86,7 @@ public class DesignerStartup extends Activator {
getSub(EnvBasedModule.class).stop();
}
});
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MAX_VALUE) {
@Override
public void on(Event event, Workspace param) {

Loading…
Cancel
Save