Browse Source

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

bugfix/10.0
Hades 6 years ago
parent
commit
80707b0c52
  1. 57
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 8
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  3. 47
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  4. 5
      designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java
  5. 57
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 2
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  7. 1
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  8. 15
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  9. 5
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java
  10. 21
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  11. 24
      designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java
  12. 34
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  13. 62
      designer-base/src/main/java/com/fr/env/TestConnectionResult.java
  14. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java
  15. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java
  16. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java
  17. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java
  18. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java
  19. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  20. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java
  21. 16
      designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java
  22. 11
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  23. 5
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  24. 75
      designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java
  25. 157
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  26. 16
      designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java
  27. 4
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java
  28. 6
      designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java

57
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit;
@ -15,19 +16,25 @@ import com.fr.env.EnvListPane;
import com.fr.general.GeneralContext;
import com.fr.license.exception.RegistEditionException;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
public class EnvChangeEntrance {
@ -90,6 +97,12 @@ public class EnvChangeEntrance {
});
return false;
}
// 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
@ -138,6 +151,50 @@ public class EnvChangeEntrance {
return true;
}
/**
* 切换远程环境之前进行版本检测当版本不一致的时候提示
* 当用户确认选择 ok 才继续
*
* @param selectedEnv 选择的环境
* @return 是否一致
* 1. 非远程环境 返回 true
* 2. 远程环境
* 2.1 不匹配
* 2.1.1 当选择 ok 返回 true
* 2.1.2 当选择 no, 返回 false
* 2.2 匹配 返回 true
* @throws Exception 异常
*/
private boolean versionCheckAndConfirm(DesignerWorkspaceInfo selectedEnv) throws Exception {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) {
WorkspaceConnectionInfo info = selectedEnv.getConnection();
String serverVersion = new FunctionalHttpRequest(info).getServerVersion();
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) {
return true;
}
final List<Integer> result = new ArrayList<>(1);
PopTipStrategy.NOW.showTip(new PopTip() {
@Override
public void show() {
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")};
int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"),
UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1);
result.add(choice);
}
});
// 只有选择 yes , 这里的值才为 0, 返回 true
// 否着返回 false, 将不进行下面的连接操作。
return result.size() != 0 && result.get(0) == 0;
}
return true;
}
/**
* 编辑items
*

8
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -2,6 +2,7 @@ package com.fr.design.file;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent {
public void closeSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候退出权限编辑
if (DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().closeAuthorityEditing();
}
if (contains(selected) == -1) {
return;
}
@ -183,10 +188,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
/**
* 判断是否打开过该模板
* 由于切换环境不会关闭模板可能存在同名的模板所以该方法不能准确找到所选的模板
*
* @param filename 文件名
* @return 文件位置
* @deprecated use HistoryTemplateListCache#contains(com.fr.design.mainframe.JTemplate) instead
*/
@Deprecated
public int contains(String filename) {
for (int i = 0; i < historyList.size(); i++) {
String historyPath = historyList.get(i).getPath();

47
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -18,7 +18,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
@ -674,9 +673,6 @@ public class MutilTempalteTabPane extends JComponent {
return;
}
//当前激活的模板
String filename = openedTemplate.get(selectedIndex).getPath();
filename = FilenameUtils.standard(filename);
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing();
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
@ -684,20 +680,20 @@ public class MutilTempalteTabPane extends JComponent {
if (returnVal == JOptionPane.YES_OPTION) {
specifiedTemplate.saveTemplate();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
closeTpl(specifiedTemplate, filename);
closeTpl(specifiedTemplate);
} else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate, filename);
closeTpl(specifiedTemplate);
}
} else {
closeTpl(specifiedTemplate, filename);
closeTpl(specifiedTemplate);
}
}
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) {
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
closeAndFreeLock(specifiedTemplate);
activeTemplate(fileName);
activePrevTemplateAfterClose();
}
private void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) {
@ -729,11 +725,9 @@ public class MutilTempalteTabPane extends JComponent {
}
/**
* 关闭掉一个模板之后该激活的Tab
*
* @param fileName 关闭掉一个模板之后该激活的Tab的文件名绝对路径
* 关闭掉一个模板之后激活新的待显示模板
*/
private void activeTemplate(String fileName) {
private void activePrevTemplateAfterClose() {
if (openedTemplate.isEmpty()) {
//新建并激活模板
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
@ -742,23 +736,20 @@ public class MutilTempalteTabPane extends JComponent {
temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
} else {
//如果关闭的模板是当前选中的模板,则重新激活
if (closeIconIndex == selectedIndex) {
if (closeIconIndex == maxPaintIndex) {
// 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板;
// selectIndex 没有变化,但是对应的模板已经变成了前一张模板
if (closeIconIndex == selectedIndex || isCloseCurrent) {
// 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界
if (closeIconIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex--;
}
} else if (isCloseCurrent) {
//不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活
if (selectedIndex > openedTemplate.size() - 1) {
selectedIndex -= 1;
if (selectedIndex < 0) {
selectedIndex = 0;
}
isCloseCurrent = false;
}
} else {
//如果关闭的模板不是当前选中的模板,则激活的模板不变
selectedIndex = HistoryTemplateListCache.getInstance().contains(fileName);
isCloseCurrent = false;
}
// 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index
else {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
selectedIndex = HistoryTemplateListCache.getInstance().contains(template);
}
//如果是已后台关闭的模板,则重新打开文件
openedTemplate.get(selectedIndex).activeOldJTemplate();

5
designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java

@ -2,6 +2,8 @@ package com.fr.design.gui.itextfield;
import com.fr.design.gui.imenu.UIListPopup;
import com.fr.general.ComparatorUtils;
import com.fr.stable.OperatingSystem;
import javax.swing.JList;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
@ -82,6 +84,9 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen
}
private void textChanged() {
if (OperatingSystem.isMacOS()) {
return;
}
if (!popup.isVisible()) {
showPopup();
requestFocus();

57
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -10,6 +10,7 @@ import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
@ -29,6 +31,7 @@ import com.fr.design.gui.imenu.UIMenuHighLight;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -76,7 +79,6 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
@ -162,9 +164,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//用于判断设计器是否打开了
private boolean designerOpened = false;
private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight());
private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight());
private WindowAdapter windowAdapter = new WindowAdapter() {
@ -226,16 +228,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public void mouseReleased(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) {
DesignerMode.setMode(DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
refreshDottedLine();
fireAuthorityStateToNomal();
if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing();
}
}
@ -337,6 +331,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.progressDialog = new ProgressDialog(this);
}
public void closeAuthorityEditing(){
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
refreshDottedLine();
fireAuthorityStateToNomal();
}
/**
* 注册app.
*
@ -857,18 +863,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
editingTemplate.stopEditing();
if (!editingTemplate.getEditingFILE().exists()) {
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE()
Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE()
+ "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate();
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved",
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved",
editingTemplate.getEditingFILE().getName()));
}
} else {
if (editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate();
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved",
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved",
editingTemplate.getEditingFILE().getName()));
}
}
@ -965,8 +971,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// p:判断一下,如何文件为空或者文件不存在,直接返回.
if (tplFile == null || !tplFile.exists()) {
JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"),
ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(
this,
Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"),
ProductConstants.PRODUCT_NAME,
JOptionPane.INFORMATION_MESSAGE
);
DesignerFrameFileDealerPane.getInstance().refresh();
return;
}
@ -976,7 +986,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} catch (DecryptTemplateException e) {
JOptionPane.showMessageDialog(
this,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"),
Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"),
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.WARNING_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
@ -1035,7 +1045,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
MutilTempalteTabPane.getInstance().setTemTemplate(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
} else {
activeTemplate(tplFile, jt);
activeTemplate(jt);
}
opened = true;
break;
@ -1050,13 +1060,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 激活指定的模板
*
* @param tplFile 模板文件
* @param jt 当前报表
* @param jt 当前报表
* @date 2014-10-14-下午6:31:23
*/
private void activeTemplate(FILE tplFile, JTemplate jt) {
private void activeTemplate(JTemplate jt) {
// 如果该模板已经打开,则进行激活就可以了
int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath());
int index = HistoryTemplateListPane.getInstance().contains(jt);
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
if (index != -1) {
historyList.get(index).activeJTemplate(index, jt);

2
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) {
propertyCard.show(rightPane, tabName);
propertyItem.setTabButtonSelected();
//从单元格菜单过来也要关闭弹出窗
hideCurrentPopupPane();
}
}

1
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -73,5 +73,6 @@ public class LogMessageBar extends JPanel {
if (dlg != null) {
dlg.dispose();
}
THIS = null;
}
}

15
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java

@ -7,7 +7,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
@ -41,17 +44,17 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
@Override
public MobileTemplateStyle updateBean() {
return new DefaultMobileTemplateStyle();
return getDefaultTemplateStyle();
}
public MobileTemplateStyle updateConfig(){
return new DefaultMobileTemplateStyle();
return getDefaultTemplateStyle();
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new DefaultMobileTemplateStyle();
return new DefaultMobileTemplateStyle(new TabFontConfig(getTagLayout().getTitleFont()));
}
@Override
@ -74,6 +77,10 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR);
}
public Color getInitialColor() {
return DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR;
}
public void repaint() {
super.repaint();
}
@ -94,11 +101,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth);
int width = fm.stringWidth(displayName);
g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
if (i == 0) {
g2d.setColor(Color.BLACK);
g2d.setStroke(new BasicStroke(2.0f));
g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1);
}

5
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java

@ -24,9 +24,10 @@ public class TemplateStyleDefinePaneFactory {
public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) {
StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style);
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = styleDefinePaneUI.getaClass();
if (clazz == null) {
if(styleDefinePaneUI == null){
styleDefinePaneUI = defineMap.get(DefaultMobileTemplateStyle.STYLE_NAME);
}
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = styleDefinePaneUI.getaClass();
BasicBeanPane<MobileTemplateStyle> quickPane = null;
try {
quickPane = Reflect.on(clazz).create(tagLayout).get();

21
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
centerPane.add(Box.createVerticalStrut(1));
// mod by anchore 16/11/16
UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color"));
final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color"));
customButton.addActionListener(new ActionListener() {
// 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654)
customButton.addMouseListener(new MouseAdapter() {
@Override
public void actionPerformed(ActionEvent e) {
public void mousePressed(MouseEvent e) {
if (!customButton.isEnabled()) {
return;
}
customButtonPressed();
}
});

24
designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java

@ -4,11 +4,15 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.SpecialUIButton;
import com.fr.design.gui.ibutton.UIBasicButtonUI;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JButton;
import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by plough on 2016/12/22.
@ -28,7 +32,7 @@ class PickColorButtonFactory {
* @return SpecialUIButton 屏幕取色按钮
*/
static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) {
SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI());
final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI());
PickColorButtonFactory.iconType = iconType;
if (iconType == IconType.ICON16) {
@ -42,9 +46,13 @@ class PickColorButtonFactory {
pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize));
pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
pickColorButton.addActionListener(new ActionListener() {
// 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654)
pickColorButton.addMouseListener(new MouseAdapter() {
@Override
public void actionPerformed(ActionEvent e) {
public void mousePressed(MouseEvent e) {
if (!pickColorButton.isEnabled()) {
return;
}
new ColorPicker(colorSelectable, setColorRealTime);
}
});

34
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -511,14 +511,14 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
}
private void tryConnectRemoteEnv() {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
final WorkspaceConnectionInfo connection = remoteEnv.getConnection();
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
WorkspaceConnectionInfo connection = remoteEnv.getConnection();
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try {
@ -532,18 +532,26 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected void done() {
okButton.setEnabled(true);
try {
Boolean result = get();
if (result == null) {
TestConnectionResult result = TestConnectionResult.parse(get(), connection);
if (result == TestConnectionResult.Fully_Success) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
}
if (result == TestConnectionResult.Partly_Sucess) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
}
if (result == TestConnectionResult.Fully_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
if (result == TestConnectionResult.Auth_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
} else {
if (result) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
} else {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
}
} catch (InterruptedException | ExecutionException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());

62
designer-base/src/main/java/com/fr/env/TestConnectionResult.java vendored

@ -0,0 +1,62 @@
package com.fr.env;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
/**
* 测试连接的结果
* 不改变原有逻辑的情况下加入一层转化
* 根据这里的转化结果判断需要提示哪些内容
*
* created by Harrison on 2018/12/20
**/
public enum TestConnectionResult {
/**
* 完全成功, 版本匹配测试连接成功
*/
Fully_Success,
/**
* 不完全成功版本不匹配但测试连接成功
*/
Partly_Sucess,
/**
* 完全失败直接没连上
*/
Fully_Failed,
/**
* 验证 Token 失败
*/
Auth_Failed;
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) {
if (value == null) {
return Auth_Failed;
}
if (!value) {
return Fully_Failed;
}
try {
String serverVersion = new FunctionalHttpRequest(info).getServerVersion();
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) {
return Fully_Success;
}
return Partly_Sucess;
} catch (Exception e) {
// 发生异常,说明没连接上。返回完全失败。
FineLoggerFactory.getLogger().error(e.getMessage());
return Fully_Failed;
}
}
}

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java

@ -96,7 +96,7 @@ public class ChartDatapointLabelPane extends BasicPane{
boolean isGuidline = plot.isSupportLeadLine();
if(plot.isSupportCategoryFilter()) {
isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"));
isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"));
}
isSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
isValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value"));

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java

@ -240,7 +240,7 @@ public class CustomDefaultSeriesPane extends BasicPane{
isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth"));
lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray());
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
Boolean[] valueArray = {true, false};
isNullValueBreak = new UIButtonGroup<Boolean>(nameArray, valueArray);
double p = TableLayout.PREFERRED;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java

@ -449,7 +449,7 @@ public class CustomTypeConditionSeriesPane extends BasicBeanPane<CustomAttr>{
lineStyle.setPreferredSize(new Dimension(150,20));
markerPane.setPreferredSize(new Dimension(150,20));
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
Boolean[] valueArray = {true, false};
isNullValueBreak = new UIButtonGroup<Boolean>(nameArray, valueArray);
double p = TableLayout.PREFERRED;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java

@ -49,7 +49,7 @@ public class LineSeriesPane extends AbstractPlotSeriesPane{
isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth"));
lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray());
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
Boolean[] valueArray = {true, false};
isNullValueBreak = new UIButtonGroup<Boolean>(nameArray, valueArray);
double p = TableLayout.PREFERRED;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java

@ -45,7 +45,7 @@ public class RadarSeriesPane extends AbstractPlotSeriesPane{
isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill"));
lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray());
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")};
Boolean[] valueArray = {true, false};
isNullValueBreak = new UIButtonGroup<Boolean>(nameArray, valueArray);

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java

@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -28,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
double[] columnSize = {f, e};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox},
} ;
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
@ -36,8 +37,8 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
}
protected String[] getNameArray(){
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Top_Down_Shade")
return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"),
Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade")
};
}
@Override

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java

@ -1,6 +1,7 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -18,6 +19,7 @@ public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCh
@Override
protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name");
//"分类名" 图表(新特性)标签、提示时有用到
return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name");
}
}

16
designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java

@ -3,11 +3,15 @@ package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.form.mobile.FormMobileAttrPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.menu.MenuKeySet;
@ -73,6 +77,9 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent());
//改变布局为自适应布局,只在移动端属性设置保存后改变一次
doChangeBodyLayout();
WidgetPropertyPane.getInstance().refreshDockingView();
jf.fireTargetModified();
}
@ -80,6 +87,15 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
dialog.setVisible(true);
}
private void doChangeBodyLayout(){
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XLayoutContainer rootLayout = formDesigner.getRootComponent();
if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) {
rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0);
}
((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout);
}
@Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED)
private void recordFunction() {
// do nothing

11
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -137,14 +137,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
XLayoutContainer rootLayout = selectedBodyLayout(formDesigner);
if (rootLayout != formDesigner.getRootComponent()
&& formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) {
//原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式
Form form = formDesigner.getTarget();
if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) {
((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout);
} else {
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()}));
}
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()}));
}
paddingBound.populate(ob);
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue());

5
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -115,6 +115,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
templateStyleEditor.setValue(ob.getTemplateStyle());
FRFont frFont = layoutBorderStyle.getTitle().getFrFont();
if (frFont != null) {
ob.setTitleFont(frFont);
frFontPane.populateBean(frFont);
}
}
@ -126,8 +127,10 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart();
LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle();
FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont();
layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont));
FRFont titleFont = frFontPane.update(frFont);
layoutBorderStyle.getTitle().setFrFont(titleFont);
WCardTagLayout layout = (WCardTagLayout) creator.toData();
layout.setTitleFont(titleFont);
boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType();
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) {
layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex()));

75
designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java

@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerCallBack;
import com.fr.transaction.WorkerFacade;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -21,16 +24,17 @@ import java.awt.event.ActionEvent;
* StyleList Action
*/
public class StyleListAction extends UpdateAction {
public StyleListAction() {
public StyleListAction() {
this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png"));
this.generateAndSetSearchText(StyleManagerPane.class.getName());
}
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png"));
this.generateAndSetSearchText(StyleManagerPane.class.getName());
}
/**
* 动作
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction {
styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
Configurations.update(new Worker() {
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
styleListPane.update(ServerPreferenceConfig.getInstance());
}
}.addCallBack(new CallBackAdaptor(){
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement();
}
}));
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ServerPreferenceConfig.class};
}
});
}
}
});
ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror();
styleListPane.populate(mirror);
styleListDialog.setVisible(true);
}
ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror();
styleListPane.populate(mirror);
styleListDialog.setVisible(true);
}
@Override
public void update() {
this.setEnabled(true);
}
@Override
public void update() {
this.setEnabled(true);
}
public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'K';
}
public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'K';
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles");
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

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

@ -5,11 +5,6 @@ package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.config.MarketConfig;
import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.core.db.dml.Delete;
import com.fr.data.core.db.dml.Select;
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;
@ -19,18 +14,13 @@ import com.fr.general.DateUtils;
import com.fr.general.DesUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.intelli.record.FocusPoint;
import com.fr.intelli.record.MetricException;
import com.fr.intelli.record.MetricRegistry;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.log.message.ParameterMessage;
import com.fr.record.DBRecordXManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
@ -58,17 +48,15 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
* @author neil
@ -79,7 +67,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
// 24小时上传一次
private static final long DELTA = 24 * 3600 * 1000L;
private static final long SEND_DELAY = 30 * 1000L;
private static final long SEND_DELAY = 300 * 1000L;
private static final String FILE_NAME = "fr.info";
private static final String XML_START_STOP_LIST = "StartStopList";
private static final String XML_START_STOP = "StartStop";
@ -226,12 +214,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
if (currentTime - lastTime <= DELTA) {
return;
}
JSONArray content = null;
try {
content = getFunctionsContent(currentTime, lastTime);
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
JSONArray content = getFunctionsContent(currentTime, lastTime);
boolean success = false;
FineLoggerFactory.getLogger().info("Start sent function records to the cloud center...");
String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD);
@ -443,7 +426,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
});
}
public static JSONArray getFunctionsContent(long current, long last) throws JSONException{
public JSONArray getFunctionsContent(long current, long last) {
//记录当前条数,达到200条合并成一个请求
int count = 0;
JSONArray functionArray = new JSONArray();
@ -452,21 +435,20 @@ public class InformationCollector implements XMLReadable, XMLWriter {
.addRestriction(RestrictionFactory.gte(COLUMN_TIME, last));
try {
DataList<FocusPoint> focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition);
JSONArray temp = new JSONArray();
TreeSet<FunctionRecord> focusPointsList = new TreeSet<>();
if(!focusPoints.isEmpty()){
for(int i=0;i< focusPoints.getList().size();i++){
FocusPoint focusPoint = focusPoints.getList().get(i);
if(focusPoint != null){
if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){
temp.put(getOneRecord(focusPoint));
focusPointsList.add(getOneRecord(focusPoint));
} else {
count = 0;
functionArray.put(temp);
temp = new JSONArray();
temp.put(getOneRecord(focusPoint));
functionArray.put(setToJSONArray(focusPointsList));
focusPointsList.add(getOneRecord(focusPoint));
}
if(i == (focusPoints.getList().size() -1)){
functionArray.put(temp);
functionArray.put(setToJSONArray(focusPointsList));
}
}
}
@ -478,16 +460,33 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return functionArray;
}
private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{
com.fr.json.JSONObject record = new com.fr.json.JSONObject();
record.put(ATTR_ID, focusPoint.getId());
record.put(ATTR_TEXT, focusPoint.getText());
record.put(ATTR_SOURCE, focusPoint.getSource());
record.put(ATTR_TIME, focusPoint.getTime().getTime());
record.put(ATTR_TITLE, focusPoint.getTitle());
record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername());
record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID());
return record;
private FunctionRecord getOneRecord(FocusPoint focusPoint) {
FunctionRecord functionRecord = new FunctionRecord();
functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId());
functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText());
functionRecord.setSource(focusPoint.getSource());
functionRecord.setTime(focusPoint.getTime().getTime());
functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle());
functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername());
functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID());
return functionRecord;
}
private JSONArray setToJSONArray(Set set) throws JSONException {
JSONArray jsonArray = new JSONArray();
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
FunctionRecord functionRecord = (FunctionRecord)iter.next();
com.fr.json.JSONObject record = new com.fr.json.JSONObject();
record.put(ATTR_ID, functionRecord.getId());
record.put(ATTR_TEXT, functionRecord.getText());
record.put(ATTR_SOURCE, functionRecord.getSource());
record.put(ATTR_TIME, functionRecord.getTime());
record.put(ATTR_TITLE, functionRecord.getTitle());
record.put(ATTR_USER_NAME, functionRecord.getUsername());
record.put(ATTR_UUID, functionRecord.getUuid());
jsonArray.put(record);
}
return jsonArray;
}
private class StartStopTime implements XMLReadable, XMLWriter {
@ -529,4 +528,84 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
private class FunctionRecord implements Comparable{
private String id;
private String text;
private int source;
private long time;
private String title;
private String username;
private String uuid;
public FunctionRecord(){
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getSource() {
return source;
}
public void setSource(int source) {
this.source = source;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public int compareTo(Object o) {
FunctionRecord functionRecord = (FunctionRecord) o;
if(this.getId().equals((functionRecord.getId())) && this.getText().equals(functionRecord.getText())
&& this.getSource() == functionRecord.getSource() && this.getTime() == functionRecord.getTime()
&& this.getTitle().equals(functionRecord.getTitle()) && this.getUsername().equals(functionRecord.getUsername())
&& this.getUuid().equals(functionRecord.getUuid())){
return 0;
}
return 1;
}
}
}

16
designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java

@ -2,6 +2,7 @@ package com.fr.design.present;
import com.fr.base.Style;
import com.fr.config.ServerPreferenceConfig;
import com.fr.config.StyleMap;
import com.fr.design.gui.controlpane.AbstractNameableCreator;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
@ -13,6 +14,8 @@ import com.fr.design.style.StylePane;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor;
import java.util.ArrayList;
import java.util.Iterator;
@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane {
/**
* Update.
*/
public void update(ServerPreferenceConfig configManager) {
configManager.clearAllStyle();
public void update(final ServerPreferenceConfig configManager) {
//configManager.clearAllStyle();
// Nameable[]居然不能强转成Parameter[],一定要这么写...
Nameable[] nameables = this.update();
final StyleMap styleMap = new StyleMap();
for (int i = 0; i < nameables.length; i++) {
configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject());
styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject());
}
DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement();
}
configManager.setStyleMap(styleMap);
}
}

4
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -508,6 +508,10 @@ public class CellSelection extends Selection {
popup.add(DeprecatedActionManager.getInsertMenu(ePane));
popup.add(DeprecatedActionManager.getDeleteMenu(ePane));
popup.add(DeprecatedActionManager.getClearMenu(ePane));
popup.addSeparator();
addExtraMenu(ePane, popup);
return popup;
}

6
designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java

@ -1,6 +1,5 @@
package com.fr.grid.selection;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.cell.CleanAuthorityAction;
@ -27,7 +26,6 @@ import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.selection.QuickEditor;
import com.fr.design.utils.DesignUtils;
import com.fr.general.ComparatorUtils;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ColumnRow;
@ -149,6 +147,10 @@ public class FloatSelection extends Selection {
popup.add(new EditFloatElementNameAction(ePane).createMenuItem());
popup.addSeparator();
addExtraMenu(ePane, popup);
return popup;
}

Loading…
Cancel
Save