Browse Source

Merge remote-tracking branch 'origin/release/9.0' into release/9.0

master
ju 7 years ago
parent
commit
c38b85b99c
  1. 1
      build.9.0.gradle
  2. 66
      designer/src/com/fr/design/mainframe/InformationCollector.java
  3. 4
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  4. 42
      designer_base/src/com/fr/design/DesignerEnvManager.java
  5. 37
      designer_base/src/com/fr/design/actions/file/PreferencePane.java
  6. 6
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  7. 7
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  8. 2
      designer_base/src/com/fr/design/gui/ispinner/UISpinner.java
  9. 38
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  10. 5
      designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java
  11. 2
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  12. 13
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  13. 9
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  14. 7
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  15. 38
      designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java
  16. 10
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  17. 8
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  18. 4
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  19. 20
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  20. 2
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  21. 19
      designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

1
build.9.0.gradle

@ -15,6 +15,7 @@ task appletJar<<{
fileset(dir:"${basicDir}/report/build/classes/main")
fileset(dir:"${basicDir}/platform/build/classes/main")
}
unjar(src:"${libDir}/fr-core-9.0.jar",dest:"./tmp")
unjar(src:"${libDir}/fr-third-9.0.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-9.0.jar"){

66
designer/src/com/fr/design/mainframe/InformationCollector.java

@ -3,7 +3,7 @@
*/
package com.fr.design.mainframe;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerFactory;
import com.fr.base.FRContext;
import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.DialectFactory;
@ -13,23 +13,51 @@ import com.fr.data.core.db.dml.Table;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.general.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.DesUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.record.DBRecordManager;
import com.fr.stable.*;
import com.fr.stable.xml.*;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import org.json.JSONObject;
import java.io.*;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author neil
@ -126,18 +154,22 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) {
JSONObject jo = new JSONObject();
try {
jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo);
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, ConfigManager.getProviderInstance().getBbsUsername());
content.put(XML_USERNAME, ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name"));
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
try {
return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8);
@ -162,7 +194,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
String res = hc.getResponseText();
//服务器返回true,说明已经取得成功,清空当前记录的信息
boolean success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
if (success){
this.reset();
}
@ -202,7 +239,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
String res = httpClient.getResponseText();
boolean success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
//服务器返回true, 说明已经获取成功, 清空当前记录的信息
if (success) {
deleteLogDB(conn, table);
@ -255,7 +297,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put("username", ConfigManager.getProviderInstance().getBbsUsername());
content.put("username", ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put("uuid", envManager.getUUID());
content.put("functions", functionArray);

4
designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -1,12 +1,12 @@
package com.fr.design.widget.ui;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.form.ui.NumberEditor;
import java.awt.BorderLayout;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/**
* FieldEditorDefinePane

42
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -14,7 +14,6 @@ import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLevel;
import com.fr.general.FRLogFormatter;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
@ -34,9 +33,10 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import javax.swing.*;
import javax.swing.SwingWorker;
import javax.swing.SwingWorker.StateValue;
import java.awt.*;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
@ -53,7 +53,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
/**
* The manager of Designer GUI.
@ -97,7 +96,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false;
private boolean isDragPermited = false;
private Level level = Level.INFO;
private int language;
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true;
@ -240,10 +238,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public static void loadLogSetting() {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
Level logLevel = designerEnvManager.getLogLevel();
if (logLevel != null) {
FRContext.getLogger().setLogLevel(logLevel, true);
}
if (StringUtils.isNotEmpty(designerEnvManager.getJdkHome())) {
System.setProperty("java.home", designerEnvManager.getJdkHome());
}
@ -1156,20 +1150,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.logLocation = logsLocation;
}
/**
* 返回日志的等级
*/
public Level getLogLevel() {
return this.level;
}
/**
* 设置log的等级
*/
public void setLogLevel(Level level) {
this.level = level;
}
/**
* 设置撤销的限制次数
*/
@ -1320,8 +1300,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readActiveKey(reader);
} else if ("LogLocation".equals(name)) {
readLogLocation(reader);
} else if ("LogLevel".equals(name)) {
this.readLogLevel(reader);
} else if ("Language".equals(name)) {
readLanguage(reader);
} else if ("JettyServerPort".equals(name)) {
@ -1516,15 +1494,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
checkRecentOpenedFileNum();
}
private void readLogLevel(XMLableReader reader) {
String level;
if ((level = reader.getElementValue()) != null) {
this.setLogLevel(FRLevel.getByName(level).getLevel());
}
}
/**
* Write XML.<br>
* The method will be invoked when save data to XML file.<br>
@ -1700,11 +1669,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writer.end();
}
if (this.level != null) {
writer.startTAG("LogLevel");
writer.textNode(FRLevel.getByLevel(this.level).getName());
writer.end();
}
if (StringUtils.isNotBlank(jdkHome)) {
writer.startTAG("jdkHome");
writer.textNode(jdkHome);

37
designer_base/src/com/fr/design/actions/file/PreferencePane.java

@ -1,6 +1,8 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog;
@ -25,9 +27,24 @@ import com.fr.general.FRFont;
import com.fr.general.FRLevel;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
@ -354,7 +371,7 @@ public class PreferencePane extends BasicPane {
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DesignerEnvManager.getEnvManager().setLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
ConfigManager.getProviderInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
}
});
}
@ -534,7 +551,7 @@ public class PreferencePane extends BasicPane {
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation());
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(designerEnvManager.getLogLevel()));
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(ConfigManager.getProviderInstance().getServerLogLevel()));
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage()));
designerEnvLanguageIndex = designerEnvManager.getLanguage();
@ -578,8 +595,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setLogLocation(this.logExportDirectoryField.getText());
designerEnvManager.setLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
designerEnvManager.setSupportUndo(supportUndoCheckBox.isSelected());
designerEnvManager.setSupportDefaultParentCalculate(supportDefaultParentCalculateCheckBox.isSelected());
@ -615,6 +630,14 @@ public class PreferencePane extends BasicPane {
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
ConfigManager.getProviderInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
try {
FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
/*

6
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -2,7 +2,6 @@ package com.fr.design.extra;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.ucenter.Client;
@ -10,6 +9,7 @@ import com.fr.design.extra.ucenter.XMLHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javafx.scene.web.WebEngine;
@ -312,9 +312,9 @@ public class LoginWebBridge {
* @param userInfo
*/
public void getLoginInfo(String userInfo) {
org.json.JSONObject jo = new org.json.JSONObject(userInfo);
String status = jo.get("status").toString();
try{
JSONObject jo = new JSONObject(userInfo);
String status = jo.get("status").toString();
if (status.equals(LOGIN_SUCCESS)) {
String username = jo.get("username").toString();
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString());

7
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -10,6 +10,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
@ -19,7 +21,6 @@ import javafx.scene.web.WebEngine;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
import org.json.JSONObject;
import javax.swing.*;
import java.awt.*;
@ -91,11 +92,15 @@ public class PluginWebBridge {
public String getRunConfig() {
if (action != null) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put(ACTION, action.getContext());
Set<String> keySet = config.keySet();
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
}
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return jsonObject.toString();
}
return StringUtils.EMPTY;

2
designer_base/src/com/fr/design/gui/ispinner/UISpinner.java

@ -262,7 +262,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value);
textField.getDocument().addDocumentListener(docListener);
}
});
}

38
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -1,20 +1,44 @@
package com.fr.design.mainframe.loghandler;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogLevel;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.LogHandler;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.LogRecordTimeProvider;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
@ -105,7 +129,7 @@ public class DesignerLogHandler {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu();
int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().intValue();
int logLevelvalue = ConfigManager.getProviderInstance().getServerLogLevel().intValue();
if (logLevelvalue <= INFO_INT) {
showsetPopup.add(showInfo);
showsetPopup.add(showError);

5
designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -254,11 +254,12 @@ public class NumberEditorValidatePane extends JPanel {
minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
errorMsgTextField.setText(e.getRegErrorMessage());
if(e.getMaxValue() == Double.MAX_VALUE || e.getMinValue() == -Double.MAX_VALUE){
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){
errorMsgTextFieldPane.setVisible(true);
errorMsgTextField.setText(e.getRegErrorMessage());
}else{
errorMsgTextFieldPane.setVisible(false);
errorMsgTextField.setText(StringUtils.EMPTY);
}
}

2
designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java

@ -47,7 +47,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
designerWidth = new UISpinner(1, 1000, 1);
designerWidth = new UISpinner(1, Integer.MAX_VALUE, 1);
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);

13
designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java

@ -4,21 +4,22 @@ import com.fr.design.designer.IntervalConstants;
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.FontSizeComboPane;
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.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Component;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text;
private UISpinner fontSizePane;
private FontSizeComboPane fontSizePane;
private FormWidgetValuePane formWidgetValuePane;
protected UITextField labelNameTextField;
@ -30,7 +31,7 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField();
fontSizePane = new UISpinner(0, 20, 1, 0);
fontSizePane = new FontSizeComboPane();
labelNameTextField = new UITextField();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL;
@ -70,7 +71,7 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
public CheckBox updateBean() {
CheckBox box = (CheckBox)creator.toData();
box.setText(text.getText());
box.setFontSize((int)fontSizePane.getValue());
box.setFontSize(fontSizePane.getValue());
formWidgetValuePane.update(box);
box.setLabelName(labelNameTextField.getText());
return box;

9
designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -6,11 +6,10 @@ 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.design.widget.ui.designer.component.FontSizeComboPane;
import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter;
@ -26,7 +25,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
// richer:错误信息,是所有控件共有的属性,所以放到这里来
protected UITextField errorMsgTextField;
protected JPanel validatePane;
protected UISpinner fontSizePane;
protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField;
@ -40,7 +39,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
labelNameTextField = new UITextField();
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fontSizePane = new UISpinner(0, 20, 1, 0);
fontSizePane = new FontSizeComboPane();
errorMsgTextField = new UITextField();
JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -70,7 +69,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setAllowBlank(this.allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize((int)fontSizePane.getValue());
e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText());
return e;
}

7
designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java

@ -10,6 +10,7 @@ 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.widget.ui.designer.component.FontSizeComboPane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter;
@ -20,7 +21,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
private DictionaryComboBox acceptType;
private UICheckBox singleFileCheckBox;
private UISpinner fileSizeField;
private UISpinner fontSizeField;
private FontSizeComboPane fontSizeField;
public MultiFileEditorPane(XCreator xCreator) {
super(xCreator);
@ -39,7 +40,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1);
fileSizeField.setPreferredSize(new Dimension(140, 20));
fontSizeField = new UISpinner(0, 20, 1, 0);
fontSizeField = new FontSizeComboPane();
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
@ -82,7 +83,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue());
ob.setFontSize((int)fontSizeField.getValue());
ob.setFontSize(fontSizeField.getValue());
return ob;
}

38
designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java

@ -0,0 +1,38 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.Vector;
/**
* Created by kerry on 2017/10/23.
*/
public class FontSizeComboPane extends JPanel{
private static final int MAX_FONT_SIZE = 100;
private UIComboBox comboBox;
public FontSizeComboPane(){
initComponent();
}
public void initComponent(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
Vector<Integer> integerList = new Vector<Integer>();
for (int i = 1; i < MAX_FONT_SIZE; i++) {
integerList.add(i);
}
comboBox = new UIComboBox(integerList);
comboBox.setEditable(true);
this.add(comboBox, BorderLayout.CENTER);
}
public int getValue() {
return Integer.valueOf(comboBox.getSelectedItem().toString());
}
public void setValue(int fontSize) {
comboBox.setSelectedItem(fontSize);
}
}

10
designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -32,10 +32,10 @@ public class PaddingBoundPane extends BasicPane{
public void initBoundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
top = new UISpinner(0, 1000, 1, 0);
bottom = new UISpinner(0, 1000, 1, 0);
left = new UISpinner(0, 1000, 1, 0);
right = new UISpinner(0, 1000, 1, 0);
top = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
bottom = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
left = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
right = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
left.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
@ -52,7 +52,7 @@ public class PaddingBoundPane extends BasicPane{
new Component[]{null, createRightPane(new UILabel(Inter.getLocText("FR-Designer_Left"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Right"), SwingConstants.CENTER))},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
this.add(panel);
}

8
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -21,10 +21,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
}
public void initBoundPane() {
x = new UISpinner(0, 1200, 1);
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
x = new UISpinner(0, Integer.MAX_VALUE, 1);
y = new UISpinner(0, Integer.MAX_VALUE, 1);
width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, Integer.MAX_VALUE, 1);
x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
y.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));

4
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -48,8 +48,8 @@ public class WidgetBoundPane extends BasicPane {
}
public void initBoundPane() {
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, Integer.MAX_VALUE, 1);
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) {

20
designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -80,7 +80,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS);
adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS);
componentIntervel = new UISpinner(0, 100, 1, 0);
componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
@ -185,10 +185,26 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
//todo 验证下
layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex());
layout.setCompInterval((int)componentIntervel.getValue());
int intervelValue = (int)componentIntervel.getValue();
if (xWFitLayout.canAddInterval(intervelValue)) {
// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果
setLayoutGap(intervelValue);
}
return layout;
}
private void setLayoutGap(int value) {
int interval = wFitLayout.getCompInterval();
if (value != interval) {
xWFitLayout.moveContainerMargin();
xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval());
wFitLayout.setCompInterval(value);
xWFitLayout.addCompInterval(xWFitLayout.getAcualInterval());
}
}
@Override
public DataCreatorUI dataUI() {
return null;

2
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -56,7 +56,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
}
public void initLayoutComponent(){
componentInterval = new UISpinner(0, 100, 1, 0);
componentInterval = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
titleField = new UITextField();
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval},

19
designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -3,6 +3,7 @@ package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -27,11 +28,11 @@ import java.awt.*;
* Created by fanglei on 2017/8/8.
*/
public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private static final String[] ITEMS = {
MobileFitAttrState.HORIZONTAL.description(),
MobileFitAttrState.VERTICAL.description(),
MobileFitAttrState.BIDIRECTIONAL.description(),
MobileFitAttrState.NONE.description()
private static final Item[] ITEMS = {
new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL),
new Item(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL),
new Item(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL),
new Item(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE)
};
private XCreator xCreator; // 当前选中控件的xCreator
@ -122,8 +123,8 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
this.designer = designer;
this.addAttributeChangeListener(changeListener);
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)xCreator.toData();
this.hComboBox.setSelectedIndex(elementCaseEditor.getHorziontalAttr().getState() - 1);
this.vComboBox.setSelectedIndex(elementCaseEditor.getVerticalAttr().getState() - 1);
this.hComboBox.setSelectedItem(new Item (elementCaseEditor.getHorziontalAttr().description(), elementCaseEditor.getHorziontalAttr()));
this.vComboBox.setSelectedItem(new Item (elementCaseEditor.getVerticalAttr().description(), elementCaseEditor.getVerticalAttr()));
this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict());
this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict());
@ -136,10 +137,10 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
String globalName = this.getGlobalName();
switch (globalName) {
case "hComboBox":
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(((MobileFitAttrState)((Item)hComboBox.getSelectedItem()).getValue()));
break;
case "vComboBox":
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(((MobileFitAttrState)((Item)vComboBox.getSelectedItem()).getValue()));
break;
case "heightRestrictCheckBox":
boolean isHeightRestrict = heightRestrictCheckBox.isSelected();

Loading…
Cancel
Save