Browse Source

Merge branch 'release/10.0' of http://code.fineres.com/scm/~harrison/design into release/10.0

feature/big-screen
Harrison 4 years ago
parent
commit
599316e8b2
  1. 10
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  2. 22
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  3. 86
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  4. 7
      designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java
  5. 49
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java
  6. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java
  7. 5
      designer-base/src/main/java/com/fr/design/style/BorderPane.java
  8. 12
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  9. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  10. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  11. 3
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  12. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  13. 31
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  14. 3
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  15. 2
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java
  16. 23
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

10
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -72,11 +72,11 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail));
String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireConf("support.email." + GeneralContext.getLocale(), defaultEmail));
contentPane.add(urlActionPane);
contentPane.add(emailPane);
@ -96,7 +96,7 @@ public class AboutPane extends JPanel {
if (GeneralContext.getLocale().equals(Locale.US)) {
return;
}
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireConf("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ
if (GeneralContext.getLocale().equals(Locale.TAIWAN)) {
@ -176,7 +176,7 @@ public class AboutPane extends JPanel {
private String getCopyRight() {
return append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_CopyRight"), COPYRIGHT_LABEL,
ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME));
ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireConf("company.name", ProductConstants.COMPANY_NAME));
}
private String getBuildTitle() {

22
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -1,10 +1,10 @@
package com.fr.design.extra;
import com.fr.config.MarketConfig;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
@ -13,6 +13,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
@ -25,9 +26,9 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.*;
import java.io.File;
import java.net.HttpURLConnection;
import java.util.List;
@ -110,13 +111,18 @@ public class PluginOperateUtils {
public static String getRecommendPlugins() {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
JSONArray resultArray = JSONArray.create();
if (StringUtils.isBlank(plistUrl)) {
return resultArray.toString();
}
try {
HttpClient httpClient = new HttpClient(plistUrl);
String result = httpClient.getResponseText();
JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String result = httpClient.getResponseText();
JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
}
} catch (JSONException e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e);
}
return resultArray.toString();
}

86
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
@ -12,8 +13,8 @@ import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants;
@ -21,11 +22,12 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
@ -38,7 +40,7 @@ import java.util.Map;
* Created by ibm on 2017/5/25.
*/
public class PluginUtils {
private static final String ERROR_CODE_I18N_PREFIX = "FR-Plugin_Error_";
public static final String FR_VERSION = "fr_version";
@ -46,8 +48,7 @@ public class PluginUtils {
public static PluginMarker createPluginMarker(String pluginInfo) {
//todo 判空
String[] plugin = pluginInfo.split("_");
PluginMarker pluginMarker = PluginMarker.create(plugin[0], plugin[1]);
return pluginMarker;
return PluginMarker.create(plugin[0], plugin[1]);
}
public static JSONObject getLatestPluginInfo(String pluginID) throws Exception {
@ -90,7 +91,11 @@ public class PluginUtils {
InputStream reader = null;
FileOutputStream writer = null;
try {
HttpClient httpClient = new HttpClient(getDownloadPath(id));
String downloadPath = getDownloadPath(id);
if (StringUtils.isBlank(downloadPath)) {
throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
HttpClient httpClient = new HttpClient(downloadPath);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength();
reader = httpClient.getResponseStream();
@ -108,12 +113,12 @@ public class PluginUtils {
p.process(totalBytesRead / (double) totalSize);
}
} else {
throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
} catch (PluginVerifyException e) {
FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
} finally {
@ -122,7 +127,7 @@ public class PluginUtils {
return true;
}
private static void closeStream(InputStream reader, FileOutputStream writer){
private static void closeStream(InputStream reader, FileOutputStream writer) {
try {
if (null != reader) {
reader.close();
@ -136,18 +141,26 @@ public class PluginUtils {
}
}
private static String getDownloadPath(String id) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", id);
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.script.download")+ "?" + FR_VERSION + "=" + ProductConstants.VERSION);
private static String getDownloadPath(String id) {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.script.download");
if (StringUtils.isBlank(url)) {
return StringUtils.EMPTY;
}
HttpClient httpClient = new HttpClient(url + "?" + FR_VERSION + "=" + ProductConstants.VERSION);
httpClient.asGet();
String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText);
String scriptUrl = resultJSONObject.optString("result");
String charSet = EncodeConstants.ENCODING_UTF_8;
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
return scriptUrl;
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText);
String scriptUrl = resultJSONObject.optString("result");
String charSet = EncodeConstants.ENCODING_UTF_8;
try {
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
} catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return scriptUrl;
}
return StringUtils.EMPTY;
}
public static boolean isPluginMatch(PluginView pluginView, String text) {
@ -194,22 +207,22 @@ public class PluginUtils {
return StringUtils.EMPTY;
}
}
public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){
if (errorCode == PluginErrorCode.None) {
return "";
}
return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode));
}
private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription();
return errorCode.getDescription();
}
public static PluginMarker getInstalledPluginMarkerByID(String pluginID) {
PluginContext context = PluginManager.getContext(pluginID);
if (context != null) {
return context.getMarker();
@ -219,29 +232,30 @@ public class PluginUtils {
/**
* 在不同设计器版本下展示不同插件
*
* @return 插件
*/
public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) throws Exception{
JSONArray resultJSONArray = JSONArray.create();
for(int i = 0; i < oriJSONArray.length(); i++){
public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) {
JSONArray resultJSONArray = JSONArray.create();
for (int i = 0; i < oriJSONArray.length(); i++) {
JSONObject jo = oriJSONArray.getJSONObject(i);
String envVersion = jo.optString("envversion");
if(isCompatibleCurrentEnv(envVersion)){
if (isCompatibleCurrentEnv(envVersion)) {
resultJSONArray.put(jo);
}
}
return resultJSONArray;
}
private static boolean isCompatibleCurrentEnv(String envVersion){
private static boolean isCompatibleCurrentEnv(String envVersion) {
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
}
public static JSONArray transferStorePluginToJson(PluginContext [] pluginContexts){
public static JSONArray transferStorePluginToJson(PluginContext[] pluginContexts) {
JSONArray ja = JSONArray.create();
try {
for(PluginContext pluginContext : pluginContexts){
for (PluginContext pluginContext : pluginContexts) {
JSONObject jo = JSONObject.create();
jo.put("id", pluginContext.getID());
jo.put("name", pluginContext.getName());
@ -265,7 +279,7 @@ public class PluginUtils {
jo.put("switchedReason", pluginContext.getSwitchedReason());
ja.put(jo);
}
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return ja;

7
designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java

@ -15,6 +15,11 @@ import java.util.Locale;
public class DesignI18nImpl implements DesignI18nProvider {
static {
// GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题
GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage());
}
private static DesignI18nImpl instance = new DesignI18nImpl();
public static DesignI18nImpl getInstance() {
@ -30,7 +35,7 @@ public class DesignI18nImpl implements DesignI18nProvider {
@Override
public String i18nText(String key) {
return localeManager.getLocalBundle(DesignerEnvManager.getEnvManager().getLanguage()).getText(localeManager, key);
return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key);
}
@Override

49
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.mobile.ui;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
@ -34,6 +35,7 @@ import java.awt.*;
public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
private static final long serialVersionUID = 1L;
private static final int COLUMN_HEIGHT = 20;
private static final int COLUMN_WIDTH = 160;
private UnsignedIntUISpinner buttonWidthSpinner;
@ -73,9 +75,20 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(this.createNavButtonStylePanel());
this.add(this.createNormalStateStylePanel());
this.add(this.createSelectedStateStylePanel());
final JPanel contentPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
contentPanel.add(this.createNavButtonStylePanel());
contentPanel.add(this.createNormalStateStylePanel());
contentPanel.add(this.createSelectedStateStylePanel());
JPanel scrollPanel = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return contentPanel;
}
};
scrollPanel.setPreferredSize(new Dimension(-2, -2));
this.add(scrollPanel, BorderLayout.CENTER);
}
private JPanel createNavButtonStylePanel() {
@ -87,11 +100,11 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":",
SwingConstants.RIGHT);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizePane.add(buttonWidthSpinner);
sizePane.add(buttonHeightSpinner);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"),
SwingConstants.CENTER));
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"),
@ -103,7 +116,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
SwingConstants.RIGHT);
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH};
double[] verticalGaps = {0, 10, 10};
@ -145,7 +158,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
}
});
normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth());
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderLineStyle());
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor());
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -167,12 +180,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}},
new double[]{p},
new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p},
0, 5
7, 0
);
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -232,7 +245,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
}
});
selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth());
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderLineStyle());
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor());
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -254,12 +267,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}},
new double[]{p},
new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p},
0, 5
7, 0
);
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -316,7 +329,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
normalBackgroundColorBox.setSelectObject(style.getBackgroundColor());
normalOpacityDragBar.setValue(style.getOpacity());
normalOpacitySpinner.setValue(style.getOpacity());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderLineStyle());
normalBorderColorBox.setSelectObject(style.getBorderColor());
normalFontNameComboBox.setSelectedItem(style.getFontFamily());
normalFontSizeComboBox.setSelectedItem(style.getFontSize());
@ -327,7 +340,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor());
selectedOpacityDragBar.setValue(style.getSelectedOpacity());
selectedOpacitySpinner.setValue(style.getSelectedOpacity());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderLineStyle());
selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor());
selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily());
selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize());
@ -349,7 +362,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
}
style.setOpacity((int) normalOpacitySpinner.getValue());
style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderLineStyle(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderColor(normalBorderColorBox.getSelectObject());
if (normalFontNameComboBox.getSelectedItem() != null) {
style.setFontFamily((String) normalFontNameComboBox.getSelectedItem());
@ -365,7 +378,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
}
style.setSelectedOpacity((int) selectedOpacitySpinner.getValue());
style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderLineStyle(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject());
if (selectedFontNameComboBox.getSelectedItem() != null) {
style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem());

4
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java

@ -196,7 +196,7 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
this.initialBackgroundColorBox.setSelectObject(style.getInitialColor());
this.selectedBackgroundColorBox.setSelectObject(style.getSelectColor());
this.borderWidthComboBox.setSelectedLineStyle(style.getBorderWidth());
this.borderWidthComboBox.setSelectedLineStyle(style.getBorderLineStyle());
this.borderColorBox.setSelectObject(style.getBorderColor());
this.borderRadiusSpinner.setValue(style.getBorderRadius());
@ -213,7 +213,7 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
style.setInitialColor(this.initialBackgroundColorBox.getSelectObject());
style.setSelectColor(this.selectedBackgroundColorBox.getSelectObject());
style.setBorderWidth(this.borderWidthComboBox.getSelectedLineStyle());
style.setBorderLineStyle(this.borderWidthComboBox.getSelectedLineStyle());
style.setBorderColor(this.borderColorBox.getSelectObject());
style.setBorderRadius((int) this.borderRadiusSpinner.getValue());

5
designer-base/src/main/java/com/fr/design/style/BorderPane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
@ -69,7 +70,7 @@ public class BorderPane extends BasicPane {
private JToggleButton rightToggleButton;
private LineComboBox currentLineCombo;
private ColorSelectBox currentLineColorPane;
private NewColorSelectBox currentLineColorPane;
private UIButton insidebutton;
@ -88,7 +89,7 @@ public class BorderPane extends BasicPane {
verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER);
rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER);
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.currentLineColorPane = new ColorSelectBox(100);
this.currentLineColorPane = new NewColorSelectBox(100);
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout());

12
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -177,6 +177,8 @@ public class ColorSchemeComboBox extends UIComboBox {
private static final int MAX_COUNT = 5;
private static final int BLANK = 1;
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
@ -198,7 +200,8 @@ public class ColorSchemeComboBox extends UIComboBox {
comp.setText(BLANK_SPACE + schemeName);
} else {
FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
double width = (HEIGHT - 2 * Y) * MAX_COUNT;
//宽度是5倍的高加上4倍的留白
double width = (HEIGHT - 2 * Y) * MAX_COUNT + BLANK * (MAX_COUNT - 1);
String fill = BLANK_SPACE;
//图形和文字之间留的宽度大于3倍的X
while (fontMetrics.stringWidth(fill) < width + 3 * X) {
@ -228,7 +231,7 @@ public class ColorSchemeComboBox extends UIComboBox {
private void drawGradient(Graphics2D g2d, List<Color> colors) {
//上下留4px,宽度等于5倍高
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT;
double width = height * MAX_COUNT + BLANK * (MAX_COUNT - 1);
LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()]));
g2d.setPaint(linearGradientPaint);
Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height);
@ -238,10 +241,11 @@ public class ColorSchemeComboBox extends UIComboBox {
private void drawCombineColor(Graphics2D g2d, List<Color> colors) {
int size = Math.min(colors.size(), MAX_COUNT);
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT / size;
//加上1px留白
double width = ((height + BLANK) * MAX_COUNT - size) / size;
for (int i = 0; i < size; i++) {
g2d.setPaint(colors.get(i));
Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height);
Rectangle2D rec = new Rectangle2D.Double(X + (width + BLANK) * i, Y, width, height);
g2d.fill(rec);
}
}

19
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -52,7 +52,15 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
this.setLayout(new BorderLayout());
styleSelectBox = new ColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) {
@Override
public Dimension getPreferredSize() {
if (!gradientSelect) {
return colorAdjustPane.getPreferredSize();
}
return colorGradient.getPreferredSize();
}
};
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
@ -119,18 +127,11 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
}
protected void initLayout() {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
@Override
public Dimension getPreferredSize() {
if (gradientSelect) {
return new Dimension(225, 80);
}
return super.getPreferredSize();
}
protected JPanel getContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;

12
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -13,11 +13,8 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener;
@ -593,13 +590,4 @@ public class XWAbsoluteLayout extends XLayoutContainer {
public boolean isSupportShared() {
return true;
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) {
return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)};
} else {
return super.getWidgetPropertyUIProviders();
}
}
}

3
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -9,6 +9,7 @@ import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.designer.properties.mobile.MobileStylePropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -178,7 +179,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
if (selection != null && xCreator != null) {
embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders();
if(!designer.getDesignerMode().isFormParameterEditor()) {
if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class)) {
if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class) && FormDesignerUtils.isAppRelayout(designer)) {
embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator));
}
if (xCreator.supportMobileStyle()) {

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -107,9 +107,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox},
createComponents(),
new Component[] {heightRestrictCheckBox, null},
new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null},
new Component[] {heightRestrictCheckBox, null},
new Component[] {maxHeightLabel, maxHeightSpinner}
};
double f = TableLayout.FILL;

31
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -5,6 +5,7 @@ import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -14,6 +15,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
@ -30,6 +32,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener;
private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane;
private MobileBookMarkUsePane mobileBookMarkUsePane;
public TabMobileWidgetDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -62,9 +65,15 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding(designer)) {
JPanel innerAdvancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
if (FormDesignerUtils.isAppRelayout(designer)) {
mobileBookMarkUsePane = new MobileBookMarkUsePane();
innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.SOUTH);
}
innerAdvancePane.add(marginPane, BorderLayout.CENTER);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
//高级
holder.add(advancePane, BorderLayout.CENTER);
@ -77,27 +86,35 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
@Override
public void populate(FormDesigner designer) {
templateStyleEditor.setValue(((WCardTagLayout) xCreator.toData()).getMobileTemplateStyle());
WCardTagLayout wCardTagLayout = (WCardTagLayout) xCreator.toData();
templateStyleEditor.setValue((wCardTagLayout).getMobileTemplateStyle());
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点
marginPane.populate((WCardTagLayout) xCreator.toData());
marginPane.populate(wCardTagLayout);
}
if (intervalPane != null) {
intervalPane.populate((WCardTagLayout) xCreator.toData());
intervalPane.populate(wCardTagLayout);
}
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.populate(xCreator);
}
}
@Override
public void update() {
((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
WCardTagLayout wCardTagLayout = (WCardTagLayout) xCreator.toData();
(wCardTagLayout).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
if (marginPane != null) {
marginPane.update((WCardTagLayout) xCreator.toData());
marginPane.update(wCardTagLayout);
}
if (intervalPane != null) {
intervalPane.update((WCardTagLayout) xCreator.toData());
intervalPane.update(wCardTagLayout);
}
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.update(xCreator);
}
}
}

3
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -198,6 +198,9 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
JSONObject content = getJSONContentAsByte();
String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10");
if (StringUtils.isBlank(url)) {
return;
}
boolean success = false;
try {
HashMap<String, Object> para = new HashMap<>();

2
designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java

@ -64,7 +64,7 @@ public class BBSConstants {
}
private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) {
String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue);
String guest = CloudCenter.getInstance().acquireConf(key, defaultValue);
if (StringUtils.isNotEmpty(guest)) {
return guest.split("\\|");
}

23
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -17,6 +17,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import java.io.File;
import java.io.FileInputStream;
@ -100,7 +101,10 @@ public class ErrorInfoUploader {
private void downloadSolution(File localCacheZip) {
try {
String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution");
String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download");
if (StringUtils.isBlank(downloadURL)) {
return;
}
downloadURL = String.format("%s?token=%s", downloadURL, SiteCenterToken.generateToken());
InputStream in = HttpToolbox.post(downloadURL, new HashMap<String, Object>(), HttpResponseType.STREAM);
StableUtils.makesureFileExist(localCacheZip);
@ -119,7 +123,10 @@ public class ErrorInfoUploader {
private boolean needUpdate(File localCacheZip) {
if (localCacheZip.exists()) {
// 判断本地文件大小.
String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/solution/cache/check");
String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check");
if (StringUtils.isBlank(checkURL)) {
return false;
}
checkURL = String.format("%s?token=%s", checkURL, SiteCenterToken.generateToken());
try {
JSONObject res = new JSONObject(HttpToolbox.get(checkURL));
@ -143,6 +150,9 @@ public class ErrorInfoUploader {
}
File[] files = folder.listFiles();
if (files == null) {
return;
}
if (ArrayUtils.getLength(files) > MAX_ERROR_SIZE) {
CommonIOUtils.deleteFile(folder);
return;
@ -166,9 +176,12 @@ public class ErrorInfoUploader {
}
jsonArray.put(new JSONObject(content));
tempFiles.add(file);
if( jsonArray.length() == MAX_ITEMS || count == files.length){
if (jsonArray.length() == MAX_ITEMS || count == files.length) {
String url = CloudCenter.getInstance().acquireUrlByKind("design.error");
if(sendErrorInfo(url, jsonArray)){
if (StringUtils.isBlank(url)) {
return;
}
if (sendErrorInfo(url, jsonArray)) {
deleteFiles(tempFiles);
}
jsonArray = new JSONArray();
@ -182,7 +195,7 @@ public class ErrorInfoUploader {
}
private void deleteFiles(List<File> files) {
for(File file : files) {
for (File file : files) {
CommonIOUtils.deleteFile(file);
}
}

Loading…
Cancel
Save