Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
0d65911340
  1. 1
      build.gradle
  2. 48
      designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java
  3. 49
      designer-base/src/main/java/com/fr/design/actions/community/TechSupportAction.java
  4. 18
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  5. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  6. 13
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  7. 9
      designer-base/src/main/java/com/fr/design/event/StateChangeListener.java
  8. 245
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  9. 23
      designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java
  10. 7
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  11. 35
      designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java
  12. 20
      designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/TristateCheckBox.java
  13. 4
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  14. 29
      designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java
  15. 118
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  16. 30
      designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java
  17. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  18. 43
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  19. 351
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  20. 25
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  21. 69
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  22. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java
  23. 3
      designer-base/src/main/java/com/fr/file/FileFILE.java
  24. 3
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  25. 22
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  26. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/support.png
  27. 51
      designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java
  28. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java
  29. 15
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  30. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  31. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  32. 125
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  33. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java
  34. 6
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java
  35. 15
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  36. 23
      designer-form/src/main/java/com/fr/design/designer/creator/XButton.java
  37. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  38. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java
  39. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java
  40. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java
  41. 16
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  42. 56
      designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java
  43. 86
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  44. 6
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  45. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  46. 83
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  47. 194
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  48. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  49. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java
  50. 17
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  51. 32
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  52. 24
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java
  53. 7
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  54. 4
      designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java
  55. 6
      designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java
  56. 2
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

1
build.gradle

@ -58,7 +58,6 @@ allprojects {
dependencies { dependencies {
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-swing:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23' implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third.server:servlet-api:3.0' implementation 'com.fr.third.server:servlet-api:3.0'

48
designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java

@ -0,0 +1,48 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.BugNeedMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/28
*/
public class BugNeedAction extends UpdateAction {
public BugNeedAction() {
this.setMenuKeySet(BugAndNeed);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
LocaleMark<String> localeMark = LocaleCenter.getMark(BugNeedMark.class);
BrowseUtils.browser(localeMark.getValue());
}
public static final MenuKeySet BugAndNeed = new MenuKeySet() {
@Override
public char getMnemonic() {
return 0;
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_BugAndNeed");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

49
designer-base/src/main/java/com/fr/design/actions/community/TechSupportAction.java

@ -0,0 +1,49 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.TechSupportMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/28
*/
public class TechSupportAction extends UpdateAction {
public TechSupportAction() {
this.setMenuKeySet(TechSupport);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/support.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
LocaleMark<String> localeMark = LocaleCenter.getMark(TechSupportMark.class);
String str=localeMark.getValue();
BrowseUtils.browser(localeMark.getValue());
}
public static final MenuKeySet TechSupport = new MenuKeySet() {
@Override
public char getMnemonic() {
return 0;
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_TechSupport");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

18
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -439,9 +439,14 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar); return previewTableDataNeedInputParameters(tableDataSource, tabledata, rowCount, needLoadingBar, null);
} }
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar, AutoProgressBar progressBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar, progressBar);
}
/** /**
* 预览不需要参数的数据集 * 预览不需要参数的数据集
* *
@ -478,7 +483,16 @@ public abstract class DesignTableDataManager {
* @return * @return
*/ */
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); return previewTableData(tableDataSource, tabledata, rowCount, isMustInputParameters, needLoadingBar, null);
}
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar, AutoProgressBar progressBar) throws Exception {
final AutoProgressBar loadingBar;
if (progressBar == null) {
loadingBar = PreviewTablePane.getInstance().getProgressBar();
} else {
loadingBar = progressBar;
}
ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tabledata); ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tabledata);
if (ArrayUtils.isEmpty(parameters)) { if (ArrayUtils.isEmpty(parameters)) {
parameters = tabledata.getParameters(Calculator.createCalculator()); parameters = tabledata.getParameters(Calculator.createCalculator());

2
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -372,7 +372,7 @@ public class PreviewTablePane extends BasicPane {
connectionBar.close(); connectionBar.close();
} }
TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget(); TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget();
previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true); previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true, progressBar);
// parameterInputDialog // parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData // update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue()); PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue());

13
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -11,6 +12,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
public class MaxMemRowCountPanel extends UIToolbar { public class MaxMemRowCountPanel extends UIToolbar {
@ -19,7 +22,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250; private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250;
private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() { private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]); int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) { for (int i = 1; i < CACHE_LIST.length; i++) {
@ -86,9 +89,13 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.removeAll(); this.removeAll();
this.add(switchCache); this.add(switchCache);
switchCache.setSelectedIndex(MAX_IN_MEMORY); switchCache.setSelectedIndex(MAX_IN_MEMORY);
this.add(new UILabel(" ")); if (this.getComponentCount() == MAX_COMPONENT_COUNT_OF_MAX_MEMORY) {
//此处因为switchCache的setSelectedIndex可能会造成双层调用,然后因为重复添加组件产生bug,故而定义这个工具栏的正常最大组件数,做个判断
return;
}
this.add(new UILabel(StringUtils.BLANK));
this.add(numberSpinner); this.add(numberSpinner);
this.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row"))); this.add(new UILabel(StringUtils.BLANK + Toolkit.i18nText("Fine-Design_Basic_Row")));
this.validate(); this.validate();
this.repaint(); this.repaint();
} }

9
designer-base/src/main/java/com/fr/design/event/StateChangeListener.java

@ -0,0 +1,9 @@
package com.fr.design.event;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public interface StateChangeListener {
public void stateChange();
}

245
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

File diff suppressed because one or more lines are too long

23
designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java

@ -1,11 +1,12 @@
package com.fr.design.gui.ipasswordfield; package com.fr.design.gui.ipasswordfield;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import javax.swing.*; import javax.swing.JPasswordField;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.Graphics;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -21,26 +22,34 @@ public class UIPassWordField extends JPasswordField {
public UIPassWordField() { public UIPassWordField() {
super(); super();
addRollOverListener(); init();
} }
public UIPassWordField(String text) { public UIPassWordField(String text) {
super(text); super(text);
addRollOverListener(); init();
} }
public UIPassWordField(int columns) { public UIPassWordField(int columns) {
super(columns); super(columns);
addRollOverListener(); init();
} }
public UIPassWordField(String text, int columns) { public UIPassWordField(String text, int columns) {
super(text, columns); super(text, columns);
addRollOverListener(); init();
} }
public UIPassWordField(Document doc, String txt, int columns) { public UIPassWordField(Document doc, String txt, int columns) {
super(doc, txt, columns); super(doc, txt, columns);
init();
}
/**
* 每个构造方法里都需要做的一些操作
*/
public void init() {
InputEventBaseOnOS.addBasicEditInputMap(this);
addRollOverListener(); addRollOverListener();
} }
@ -69,4 +78,4 @@ public class UIPassWordField extends JPasswordField {
super.paintBorder(g); super.paintBorder(g);
} }
} }
} }

7
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -96,4 +96,11 @@ public class ProgressDialog extends UIDialog {
public void updateLoadingText(String text) { public void updateLoadingText(String text) {
this.text.setText(text); this.text.setText(text);
} }
public void updateLoadingText(String text, FRFont font) {
if (font != null) {
this.text.setFont(font);
}
this.text.setText(text);
}
} }

35
designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java

@ -9,11 +9,20 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.RenderingHints;
/** /**
* @author Jerry * @author Jerry
@ -33,31 +42,33 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() { public UITextField() {
super(); super();
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(int columns) { public UITextField(int columns) {
super(columns); super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(String text, int columns) { public UITextField(String text, int columns) {
super(text, columns); super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(String text) { public UITextField(String text) {
super(text); super(text);
InputEventBaseOnOS.addBasicEditInputMap(this); init();
initListener();
} }
public UITextField(Document doc, String text, int columns) { public UITextField(Document doc, String text, int columns) {
super(doc, text, columns); super(doc, text, columns);
init();
}
/**
* 每个构造方法里都需要做的一些操作
*/
public void init() {
InputEventBaseOnOS.addBasicEditInputMap(this); InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }
@ -251,4 +262,4 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
this.isBorderPainted = isBorderPainted; this.isBorderPainted = isBorderPainted;
} }
} }

20
designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/TristateCheckBox.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itree.checkboxtree; package com.fr.design.gui.itree.checkboxtree;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.StateChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -75,6 +76,8 @@ public class TristateCheckBox extends UICheckBox {
private final TristateDecorator model; private final TristateDecorator model;
public StateChangeListener stateChangeListener;
public TristateCheckBox(String text, Icon icon, State initial) { public TristateCheckBox(String text, Icon icon, State initial) {
super(text, icon); super(text, icon);
setUI(new TristateCheckBoxUI()); setUI(new TristateCheckBoxUI());
@ -83,7 +86,7 @@ public class TristateCheckBox extends UICheckBox {
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
grabFocus(); grabFocus();
model.setState(getNextState(model.getState())); setState(getNextState(model.getState()));
} }
}); });
// Reset the keyboard action map // Reset the keyboard action map
@ -92,7 +95,7 @@ public class TristateCheckBox extends UICheckBox {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
grabFocus(); grabFocus();
model.setState(getNextState(model.getState())); setState(getNextState(model.getState()));
} }
}); });
map.put("released", null); map.put("released", null);
@ -125,12 +128,20 @@ public class TristateCheckBox extends UICheckBox {
public void addMouseListener(MouseListener l) { public void addMouseListener(MouseListener l) {
} }
public void addStateChangeListener(StateChangeListener stateChangeListener) {
this.stateChangeListener=stateChangeListener;
}
/** /**
* Set the new state to either SELECTED, NOT_SELECTED or * Set the new state to either SELECTED, NOT_SELECTED or
* DO_NOT_CARE. If state == null, it is treated as DO_NOT_CARE. * DO_NOT_CARE. If state == null, it is treated as DO_NOT_CARE.
*/ */
public void setState(State state) { public void setState(State state) {
State old = getState();
model.setState(state); model.setState(state);
if (old != state) {
fireBoxStateChanged();
}
} }
/** /**
@ -141,6 +152,11 @@ public class TristateCheckBox extends UICheckBox {
return model.getState(); return model.getState();
} }
public void fireBoxStateChanged() {
if (stateChangeListener != null) {
stateChangeListener.stateChange();
}
}
/** /**
* Exactly which Design Pattern is this? Is it an Adapter, * Exactly which Design Pattern is this? Is it an Adapter,

4
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -395,7 +395,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 自定义 // 自定义
custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom")); custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom"));
custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); custom.setBorder(BorderFactory.createEmptyBorder(4, 15, 4, 5));
ButtonGroup group = new ButtonGroup(); ButtonGroup group = new ButtonGroup();
group.setSelected(center.getModel(), true); group.setSelected(center.getModel(), true);
group.add(center); group.add(center);
@ -405,7 +405,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 位置 距左 // 位置 距左
final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left")); final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left"));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10)); leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 10));
leftLocation = new UINumberField(); leftLocation = new UINumberField();
leftLocation.setMinValue(0); leftLocation.setMinValue(0);
leftLocation.setPreferredSize(new Dimension(40, 20)); leftLocation.setPreferredSize(new Dimension(40, 20));

29
designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java

@ -0,0 +1,29 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public class BugNeedMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>();
private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW");
public BugNeedMark() {
map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? TW_BUG_AND_NEEDS : result;
}
}

118
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

@ -10,6 +10,7 @@ import java.util.Set;
* 某些国际化环境支持的操作 * 某些国际化环境支持的操作
* 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 * 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码
* 后续有新的不同语言下的差异操作 添加新的枚举 * 后续有新的不同语言下的差异操作 添加新的枚举
*
* @author Hades * @author Hades
* @date 2019/6/24 * @date 2019/6/24
*/ */
@ -38,6 +39,123 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN); set.add(Locale.TAIWAN);
return set; return set;
} }
},
/**
* 支持韩文
*/
SUPPORT_KOREA {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.KOREA);
return set;
}
},
/**
* BUG反馈
*/
BUG {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.US);
set.add(Locale.JAPAN);
set.add(Locale.KOREA);
return set;
}
},
/**
* 需求反馈
*/
NEED {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.US);
set.add(Locale.JAPAN);
set.add(Locale.KOREA);
return set;
}
},
/**
* BUG需求反馈
*/
BUG_AND_NEED {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.TAIWAN);
return set;
}
},
/**
* 视频
*/
VIDEO {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
return set;
}
},
/**
* 技术支持-帮助菜单下
*/
TECH_SUPPORT_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
return set;
}
},
/**
* 技术支持-社区菜单下
*/
TECH_SUPPORT_COMMUNITY {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.TAIWAN);
return set;
}
},
/**
* 帮助文档-帮助菜单下
*/
TUTORIAL_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.US);
set.add(Locale.KOREA);
set.add(Locale.JAPAN);
return set;
}
},
/**
* 帮助文档-社区菜单下
*/
TUTORIAL_COMMUNITY {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.CHINA);
set.add(Locale.TAIWAN);
return set;
}
} }

30
designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java

@ -0,0 +1,30 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @Author: Yuan.Wang
* @Date: 2020/7/29
*/
public class TechSupportMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>();
private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US");
private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW");
public TechSupportMark() {
map.put(Locale.US, EN_TECH_SUPPORT);
map.put(Locale.TAIWAN, TW_TECH_SUPPORT);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? EN_TECH_SUPPORT : result;
}
}

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

@ -328,6 +328,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
doResize(); doResize();
} }
//刷新FixedPopupPane的位置
EastRegionContainerPane.getInstance().freshCurrentPopupPane();
} }
}); });
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
@ -972,6 +974,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象 //释放模板对象
ActionFactory.editorRelease(); ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -991,6 +995,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板 * @param jt 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象 //释放模板对象
ActionFactory.editorRelease(); ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -1101,7 +1107,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @date 2014-10-14-下午6:31:05 * @date 2014-10-14-下午6:31:05
*/ */
private void openFile(FILE tplFile) { private void openFile(FILE tplFile) {
//切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane();
if (tplFile != null) { if (tplFile != null) {
int index = HistoryTemplateListCache.getInstance().contains(tplFile); int index = HistoryTemplateListCache.getInstance().contains(tplFile);
if (index != -1) { if (index != -1) {

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

@ -67,6 +67,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane; private JPanel leftPane;
private JPanel rightPane; private JPanel rightPane;
private FixedPopupPane currentPopupPane; private FixedPopupPane currentPopupPane;
private UIButton currentButton;
private static final int CONTAINER_WIDTH = containerWidth(); private static final int CONTAINER_WIDTH = containerWidth();
private static final int TAB_WIDTH = 38; private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32; private static final int TAB_BUTTON_WIDTH = 32;
@ -495,17 +496,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceAuthorityEditionPane(JComponent pane) { public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
} }
public JComponent getAuthorityEditionPane() { public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
} }
public void replaceConfiguredRolesPane(JComponent pane) { public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
} }
public void replaceKeyPane(final String key, final JComponent pane) { public void replaceKeyPane(final String key, final JComponent pane) {
//需要放到 ui 线程中处理 //需要放到 ui 线程中处理
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
@ -514,11 +515,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
}); });
} }
public JComponent getConfiguredRolesPane() { public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
} }
public void addParameterPane(JComponent paraPane) { public void addParameterPane(JComponent paraPane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
} }
@ -929,6 +930,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} else { } else {
hideCurrentPopupPane(); hideCurrentPopupPane();
currentPopupPane = popupPane; currentPopupPane = popupPane;
currentButton = button;
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
} }
} }
@ -1009,6 +1011,35 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
} }
/**
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @param
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:39
*/
public void freshCurrentPopupPane() {
if (currentPopupPane != null && currentPopupPane.isVisible()) {
hideCurrentPopupPane();
if (currentButton != null && !isRightPaneVisible()) {
GUICoreUtils.showPopupMenu(currentPopupPane, currentButton, -currentPopupPane.getPreferredSize().width, 0);
}
}
}
/**
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @param
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:42
*/
public void clearCurrentPopupPane() {
hideCurrentPopupPane();
currentPopupPane = null;
currentButton = null;
}
// 弹出属性面板的工具条 // 弹出属性面板的工具条
private class PopupToolPane extends JPanel { private class PopupToolPane extends JPanel {
private String title; private String title;

351
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -1,45 +1,27 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ibutton.UISliderButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.AttributeSet;
import javax.swing.text.NumberFormatter; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.KeyEvent;
import java.awt.event.ItemListener; import java.awt.event.KeyListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -51,72 +33,37 @@ public class JFormSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50; private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 172;
private static final int SLIDER_WIDTH = 220;
private static final int SLIDER_HEIGHT = 20;
private static final int SHOWVALBUTTON_WIDTH = 40; private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20; private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5; private static final String SUFFIX = "%";
private static final String REGEX = "[\\d%]*";
private static final int TOOLTIP_Y = 30; private static final int TOOLTIP_Y = 30;
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; private UITextField showValField;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
private int times; private int times;
private int sliderValue; private int sliderValue;
private UIButton downButton; private UIButton downButton;
private UIButton upButton; private UIButton upButton;
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 //拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JFormSliderPane() { public JFormSliderPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
initSlider(); initSlider();
initShowValSpinner();
//MoMeak:控制只能输入10-400
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
initDownUpButton(); initDownUpButton();
initShowValButton(); initShowValField();
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValField);
panel.setBackground(BACK_COLOR); panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
@ -131,6 +78,7 @@ public class JFormSliderPane extends JPanel {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
slider.setValue(HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
slider.setPreferredSize(new Dimension(220, 20)); slider.setPreferredSize(new Dimension(220, 20));
@ -139,16 +87,6 @@ public class JFormSliderPane extends JPanel {
slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider")); slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider"));
} }
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
}
private void initDownUpButton() { private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) { downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
@ -173,128 +111,76 @@ public class JFormSliderPane extends JPanel {
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
} }
private void initShowValButton() { private void initShowValField() {
showValButton = new UISliderButton(showValSpinner.getValue() + "%"); showValField = new UITextField(showValue + SUFFIX);
showValButton.setBackground(BACK_COLOR); showValField.setBorderPainted(false);
showValButton.setBorderPainted(false); showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValField.addKeyListener(new KeyListener() {
showValButton.addActionListener(showValButtonActionListener); @Override
showValButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Grade")); public void keyTyped(KeyEvent e) {
}
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent evt) {
int code = evt.getKeyCode();
private void initUIRadioButton() { if (code == KeyEvent.VK_ENTER) {
twoHundredButton = new UIRadioButton("200%"); showValue = parseInputValue(showValField.getText());
oneHundredButton = new UIRadioButton("100%"); showValField.setText(showValue + SUFFIX);
sevenFiveButton = new UIRadioButton("75%"); showValFieldChange();
fiveTenButton = new UIRadioButton("50%"); }
twoFiveButton = new UIRadioButton("25%"); }
selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button")); });
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); showValField.setDocument(new PlainDocument() {
customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void insertString(int offset, String s, AttributeSet a) throws BadLocationException {
JRadioButton temp = (JRadioButton) e.getSource(); if (!s.matches(REGEX)) {
if (temp.isSelected()) { return;
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.requestFocus();
textField.selectAll();
} }
super.insertString(offset, s, a);
} }
}); });
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
customButton.setSelected(true);
} }
private void initPane() { private void showValFieldChange() {
double p = TableLayout.PREFERRED; isButtonOrIsTxt = true;
double f = TableLayout.FILL; showValue = getPreferredValue(showValue);
double[] columnSize = {p, f}; refreshShowValueFieldText();
double[] rowSize = {p, p, p, p, p, p, p, p}; refreshSlider();
UILabel upLabel = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce"));
upLabel.setOpaque(false);
JPanel septPane = new JPanel(new BorderLayout());
JSeparator sept = new JSeparator();
sept.setBackground(new Color(232, 232, 233));
septPane.add(sept, BorderLayout.NORTH);
septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10));
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
customButton.setBackground(BACK_COLOR);
Component[][] components = new Component[][]{
new Component[]{upLabel, null},
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0);
dialogContentPanel.setBackground(BACK_COLOR);
dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
private JPanel createSpinnerPanel() { private int getPreferredValue(int value){
JPanel spinnerPanel = new JPanel(new FlowLayout()); if (value > FOUR_HUNDRED) {
spinnerPanel.add(showValSpinner); value = FOUR_HUNDRED;
UILabel percent = new UILabel("%"); }
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); if (value < TEN) {
spinnerPanel.add(percent); value = TEN;
spinnerPanel.setBackground(BACK_COLOR); }
return spinnerPanel; return value;
} }
private ActionListener showValButtonActionListener = new ActionListener() { private void refreshShowValueFieldText(){
@Override showValField.setText(showValue + SUFFIX);
public void actionPerformed(ActionEvent e) { }
popupDialog();
}
};
private ChangeListener showValSpinnerChangeListener = new ChangeListener() { private int parseInputValue(String text){
@Override if (text.endsWith(SUFFIX)){
public void stateChanged(ChangeEvent e) { text = text.substring(0, text.length() -1);
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue, 100, 2);
if (val > FOUR_HUNDRED) {
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN) {
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val);
refreshBottun(val);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setCaretPosition(showValSpinner.getValue().toString().length());
if (!selectSpecified) {
customButton.setSelected(true);
}
} }
}; try{
return Integer.parseInt(text);
}catch (NumberFormatException e){
return HUNDRED;
}
}
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
@ -302,13 +188,12 @@ public class JFormSliderPane extends JPanel {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
sliderValue = slider.getValue(); sliderValue = slider.getValue();
getTimes(sliderValue); getTimes(sliderValue);
showValue = times; showValue = times;
showValSpinner.setValue(times); refreshShowValueFieldText();
} }
}); });
} else { } else {
@ -317,41 +202,23 @@ public class JFormSliderPane extends JPanel {
} }
}; };
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
selectSpecified = true;
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
selectSpecified = false;
}
}
};
private void refreshSlider(int val) { private void refreshSlider() {
showValue = val; slider.setValue(calSliderValue(showValue));
if (showValue > HUNDRED) {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else {
slider.setValue(HALF_HUNDRED);
}
}
private void refreshBottun(int val) {
showValButton.setText(val + "%");
} }
public double getResolutionTimes() { private int calSliderValue(int value) {
return this.resolutionTimes; int result;
if (value > HUNDRED) {
result = (value + TWO_HUNDRED) / SIX;
} else if (value < HUNDRED) {
result = (int) ((value - TEN) / ONEPOINTEIGHT);
} else {
result = HALF_HUNDRED;
}
return result;
} }
public int getshowValue() {
return this.showValue;
}
public static double divide(double v1, double v2, int scale) { public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b1 = new BigDecimal(Double.toString(v1));
@ -362,30 +229,28 @@ public class JFormSliderPane extends JPanel {
private ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
if ("less".equals(e.getActionCommand())) { if ("less".equals(e.getActionCommand())) {
int newDownVal = showValue - TEN; int newDownVal = showValue - TEN;
if (newDownVal >= TEN) { if (newDownVal >= TEN) {
showValue = newDownVal; showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else { } else {
showValue = newDownVal; showValue = TEN;
showValSpinner.setValue(TEN);
} }
refreshShowValueFieldText();
refreshSlider();
} }
if ("more".equals(e.getActionCommand())) { if ("more".equals(e.getActionCommand())) {
int newUpVal = showValue + TEN; int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) { if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else { } else {
showValue = newUpVal; showValue = TEN;
showValSpinner.setValue(FOUR_HUNDRED);
} }
refreshShowValueFieldText();
refreshSlider();
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
customButton.setSelected(true);
} }
}; };
@ -396,37 +261,26 @@ public class JFormSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) { } else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else { } else {
times = (int) (SIX * value - TWO_HUNDRED); times = SIX * value - TWO_HUNDRED;
} }
} }
public JSpinner getShowVal() { public int getShowValue() {
return this.showValSpinner; return this.showValue;
} }
public UIRadioButton getSelfAdaptButton() { public void setShowValue(int value) {
return this.selfAdaptButton; showValue = value;
showValFieldChange();
} }
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen(); public void addValueChangeListener(ChangeListener changeListener){
if (dialog == null) { this.slider.addChangeListener(changeListener);
dialog = new FormPopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
} else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
}
} }
public static void main(String[] args) { public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -440,16 +294,3 @@ public class JFormSliderPane extends JPanel {
} }
} }
class FormPopupPane extends JPopupMenu {
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 172;
FormPopupPane(UIButton b, JPanel dialogContentPanel) {
this.add(dialogContentPanel, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setBackground(new Color(245, 245, 247));
}
}

25
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -8,6 +8,7 @@ import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation; import com.fr.third.apache.log4j.spi.ThrowableInformation;
@ -53,12 +54,14 @@ public class DesignerLogHandler {
private static final int SERVER_GAP_Y = -20; private static final int SERVER_GAP_Y = -20;
private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":"; private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":";
private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":"; private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":";
private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":"; private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":";
private static final String ACTION_MAP_KEY = "clear";
public static DesignerLogHandler getInstance() { public static DesignerLogHandler getInstance() {
return HOLDER.singleton; return HOLDER.singleton;
@ -223,14 +226,14 @@ public class DesignerLogHandler {
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), ACTION_MAP_KEY);
ActionMap actionMap = resultPane.getActionMap(); ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() { actionMap.put(ACTION_MAP_KEY, new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
resultPane.setText(""); resultPane.setText(StringUtils.EMPTY);
caption.clearMessage(); caption.clearMessage();
} }
}); });
@ -293,10 +296,10 @@ public class DesignerLogHandler {
SimpleAttributeSet attrSet = new SimpleAttributeSet(); SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == DesignerLogger.ERROR_INT) { if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); StyleConstants.setForeground(attrSet, Color.RED);
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.WARN_INT) { } else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red); StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.INFO_INT) { } else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black); StyleConstants.setForeground(attrSet, Color.black);
@ -330,9 +333,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message); LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) { if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd(); caption.infoAdd();
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) { } else if (level == DesignerLogger.WARN_INT && showError.isSelected()) {
caption.errorAdd(); caption.errorAdd();
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) { } else if (level == DesignerLogger.ERROR_INT && showServer.isSelected()) {
caption.serverAdd(); caption.serverAdd();
} }
} }
@ -343,7 +346,7 @@ public class DesignerLogHandler {
this.copy.setEnabled(true); this.copy.setEnabled(true);
this.clear.setEnabled(true); this.clear.setEnabled(true);
if (ComparatorUtils.equals(this.jTextArea.getText(), "")) { if (ComparatorUtils.equals(this.jTextArea.getText(), StringUtils.EMPTY)) {
this.selectAll.setEnabled(false); this.selectAll.setEnabled(false);
this.clear.setEnabled(false); this.clear.setEnabled(false);
} }
@ -367,7 +370,7 @@ public class DesignerLogHandler {
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) {
LogHandlerArea.this.jTextArea.copy(); LogHandlerArea.this.jTextArea.copy();
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) {
LogHandlerArea.this.jTextArea.setText(""); LogHandlerArea.this.jTextArea.setText(StringUtils.EMPTY);
caption.clearMessage(); caption.clearMessage();
} }
} }

69
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -11,12 +11,14 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction; import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.BugNeedAction;
import com.fr.design.actions.community.CenterAction; import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.FacebookFansAction; import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction; import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.TechSolutionAction; import com.fr.design.actions.community.TechSolutionAction;
import com.fr.design.actions.community.TechSupportAction;
import com.fr.design.actions.community.VideoAction; import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.ExitDesignerAction;
@ -529,11 +531,30 @@ public abstract class ToolBarMenuDock {
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
// 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) { Locale locale = GeneralContext.getLocale();
shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); LocaleCenter.buildAction(new LocaleAction() {
} @Override
public void execute() {
shortCuts.add(new VideoAction());
}
}, SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示 //远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction()); shortCuts.add(new WebDemoAction());
@ -571,14 +592,44 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new VideoAction()); shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_COMMUNITY);
shortCuts.add(new QuestionAction()); shortCuts.add(new QuestionAction());
shortCuts.add(new TechSolutionAction()); shortCuts.add(new TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new BugAction()); LocaleCenter.buildAction(new LocaleAction() {
shortCuts.add(new NeedAction()); @Override
public void execute() {
shortCuts.add(new BugAction());
}
}, SupportLocaleImpl.BUG);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new NeedAction());
}
}, SupportLocaleImpl.NEED);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new BugNeedAction());
}
}, SupportLocaleImpl.BUG_AND_NEED);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY);
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.common; package com.fr.design.mainframe.vcs.common;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -48,7 +49,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE {
); );
return envPath.endsWith(".cpt") || envPath.endsWith(".frm") return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(in) : in; ? XMLEncryptUtils.decodeInputStream(FineEncryptUtils.decode(in)) : in;
} }

3
designer-base/src/main/java/com/fr/file/FileFILE.java

@ -1,5 +1,6 @@
package com.fr.file; package com.fr.file;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.gui.itree.filetree.FileComparator; import com.fr.design.gui.itree.filetree.FileComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.gui.itree.filetree.FileTreeIcon;
@ -186,7 +187,7 @@ public class FileFILE implements FILE {
public InputStream asInputStream() throws Exception { public InputStream asInputStream() throws Exception {
InputStream in = new java.io.FileInputStream(file); InputStream in = new java.io.FileInputStream(file);
return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm") return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
} }
/** /**

3
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -2,6 +2,7 @@ package com.fr.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.io.FineEncryptUtils;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.filetree.FileNodeComparator; import com.fr.design.gui.itree.filetree.FileNodeComparator;
@ -388,7 +389,7 @@ public class FileNodeFILE implements FILE {
); );
return envPath.endsWith(".cpt") || envPath.endsWith(".frm") return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
} }
/** /**

22
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -2,12 +2,18 @@ package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.general.FRFont;
import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter;
import javax.swing.plaf.ColorUIResource;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -27,6 +33,11 @@ public class FineEmbedServerMonitor {
private static final int STEP_HEARTBEAT = 40; private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor; private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog(); private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
//由于默认值的字体不支持韩文,所以要对韩文单独生成字体
private FRFont font = null;
private static final int FONT_RGB = 333334;
private static final int FONT_SIZE = 14;
private static final String FONT_NAME = "Dialog";
private FineEmbedServerMonitor() { private FineEmbedServerMonitor() {
} }
@ -86,8 +97,15 @@ public class FineEmbedServerMonitor {
} }
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog(); DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog() //如果为韩文则改变字体
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server")); LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
font = FRFont.getInstance().applySize(FONT_SIZE).applyForeground(new ColorUIResource(FONT_RGB)).applyName(FONT_NAME);
}
}, SupportLocaleImpl.SUPPORT_KOREA);
String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server");
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font);
} }
DesignerContext.getDesignerFrame().updateProgress(getProgress()); DesignerContext.getDesignerFrame().updateProgress(getProgress());
} }

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

51
designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java

@ -0,0 +1,51 @@
package com.fr.design.mainframe;
import com.fr.invoke.Reflect;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-07-28
*/
public class JFormSliderPaneTest {
@Test
public void testParseInputValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("parseInputValue", "100%").get();
Assert.assertEquals(100, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50%").get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50").get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50abc").get();
Assert.assertEquals(100, result);
}
@Test
public void testGetPreferredValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get();
Assert.assertEquals(100, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get();
Assert.assertEquals(10, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get();
Assert.assertEquals(400, result);
}
@Test
public void testCalSliderValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get();
Assert.assertEquals(0, result);
result = Reflect.on(sliderPane).call("calSliderValue", 90).get();
Assert.assertEquals(44, result);
result = Reflect.on(sliderPane).call("calSliderValue", 100).get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("calSliderValue", 200).get();
Assert.assertEquals(66, result);
result = Reflect.on(sliderPane).call("calSliderValue", 400).get();
Assert.assertEquals(100, result);
}
}

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java

@ -13,21 +13,20 @@ import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
@ -72,14 +71,14 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor
catePane.add(boxPane, BorderLayout.SOUTH); catePane.add(boxPane, BorderLayout.SOUTH);
catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,6)); catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,20));
this.add(catePane, "0,0,2,0"); this.add(catePane, "0,0,2,0");
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
panel.setBorder(getSidesBorder()); panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder()); filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,2,4"); this.add(panel, "0,6,1,4");
addButton.addActionListener(new ActionListener() { addButton.addActionListener(new ActionListener() {
@Override @Override

15
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -11,7 +11,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -19,9 +18,9 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.List;
public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane { public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane {
protected static final int PRE_WIDTH = 210; protected static final int PRE_WIDTH = 210;
@ -35,16 +34,28 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
public CategoryPlotReportDataContentPane(ChartDataPane parent) { public CategoryPlotReportDataContentPane(ChartDataPane parent) {
initEveryPane(); initEveryPane();
<<<<<<< HEAD
categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName.setPreferredSize(new Dimension(246,30)); categoryName.setPreferredSize(new Dimension(246,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7)); categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7));
this.add(categoryName, "0,0,2,0"); this.add(categoryName, "0,0,2,0");
=======
categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName.setPreferredSize(new Dimension(236,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20));
this.add(categoryName, "0,0,1,0");
>>>>>>> e4e801e2792ee3f3f6cef022e6c646ff7ec97091
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane);
panel.setBorder(getSidesBorder()); panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder()); filterPane.setBorder(getFilterPaneBorder());
<<<<<<< HEAD
this.add(panel, "0,6,2,4"); } this.add(panel, "0,6,2,4"); }
=======
this.add(panel, "0,6,1,4"); }
>>>>>>> e4e801e2792ee3f3f6cef022e6c646ff7ec97091
protected TinyFormulaPane initCategoryBox(final String leftLabel) { protected TinyFormulaPane initCategoryBox(final String leftLabel) {
TinyFormulaPane categoryName = new TinyFormulaPane() { TinyFormulaPane categoryName = new TinyFormulaPane() {
@Override @Override

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -24,6 +24,8 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -31,8 +33,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* 属性表 数据集界面: 系列名 使用字段名. * 属性表 数据集界面: 系列名 使用字段名.
@ -129,7 +129,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); return Toolkit.i18nText("Fine-Design_Basic_Chart_Field_Name");
} }
/** /**

7
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -14,15 +14,16 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.extended.chart.UIComboBoxWithNone;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
/** /**
* 属性表 数据集 系列名使用 系列值 界面. * 属性表 数据集 系列名使用 系列值 界面.
@ -38,7 +39,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
private boolean isNeedSummary = true; private boolean isNeedSummary = true;
public SeriesNameUseFieldValuePane() { public SeriesNameUseFieldValuePane() {
seriesName = new UIComboBox(); seriesName = new UIComboBoxWithNone();
seriesValue = new UIComboBox(); seriesValue = new UIComboBox();
calculateCombox = new CalculateComboBox(); calculateCombox = new CalculateComboBox();
calculateCombox.reset(); calculateCombox.reset();
@ -184,7 +185,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* @return 界面标题 * @return 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Value"); return Toolkit.i18nText("Fine-Design_Chart_Field_Value");
} }
/** /**

125
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java

@ -5,24 +5,25 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面. * 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面.
@ -30,7 +31,7 @@ import java.awt.Dimension;
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 下午03:17:08 * @version 创建时间2012-12-26 下午03:17:08
*/ */
public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> { public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
private SeriesNameUseFieldValuePane nameFieldValuePane; private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane; private SeriesNameUseFieldNamePane nameFieldNamePane;
@ -39,50 +40,100 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
private ChartDataPane parent; private ChartDataPane parent;
private Plot initplot; private Plot initplot;
private boolean isNeedSummary = true; private boolean isNeedSummary;
protected UIButtonGroup<Integer> content;
protected JPanel cardPane;
public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) { public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) {
this.initplot = initplot; this.initplot = initplot;
this.parent = parent; this.parent = parent;
cards = initPaneList();
this.isNeedSummary = true; this.isNeedSummary = true;
initComponents(); initComponents();
} }
protected void initComponents() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
cardPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
content = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
addItemChangeEvent();
initLayout();
content.setSelectedIndex(0);
}
private void addItemChangeEvent() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
protected void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (content.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); JPanel northPane = new JPanel(new BorderLayout(4, 0));
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, label1, null});
northPane.add(borderLayoutPane);
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15)); northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() { public Dimension getPreferredSize() {
UIComboBox uiComboBox = new UIComboBox(); Dimension preferredSize = super.getPreferredSize();
UIComponentUtils.setPreferedWidth(uiComboBox, 100); return new Dimension(260, (int) preferredSize.getHeight());
return uiComboBox;
} }
/** /**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
*
* @param hasUse 是否使用 * @param hasUse 是否使用
*/ */
public void checkUseBox(boolean hasUse) { public void checkUseBox(boolean hasUse) {
jcb.setEnabled(hasUse); content.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse); nameFieldValuePane.checkUse(hasUse);
dataScreeningPane.checkBoxUse(); dataScreeningPane.checkBoxUse();
} }
/** /**
* 切换 变更数据集时, 刷新Box选中项目 * 切换 变更数据集时, 刷新Box选中项目
*
* @param list 列表 * @param list 列表
*/ */
public void refreshBoxListWithSelectTableData(List list) { public void refreshBoxListWithSelectTableData(List list) {
@ -93,28 +144,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
/** /**
* 清空所有的box设置 * 清空所有的box设置
*/ */
public void clearAllBoxList(){ public void clearAllBoxList() {
nameFieldValuePane.clearAllBoxList(); nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList(); nameFieldNamePane.clearAllBoxList();
} }
/** /**
* 界面标题 * 界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From");
} }
@Override
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(nameFieldValuePane);
paneList.add(nameFieldNamePane);
return paneList;
}
protected SeriesNameUseFieldValuePane createValuePane() { protected SeriesNameUseFieldValuePane createValuePane() {
return new SeriesNameUseFieldValuePane(); return new SeriesNameUseFieldValuePane();
@ -135,15 +178,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
nameFieldNamePane.populateBean(ob, isNeedSummary); nameFieldNamePane.populateBean(ob, isNeedSummary);
} }
dataScreeningPane.populateBean(ob, isNeedSummary); dataScreeningPane.populateBean(ob, isNeedSummary);
checkCardPane();
} }
/** /**
* 重新布局整个面板 * 重新布局整个面板
*
* @param isNeedSummary 是否需要汇总 * @param isNeedSummary 是否需要汇总
*/ */
public void relayoutPane(boolean isNeedSummary) { public void relayoutPane(boolean isNeedSummary) {
this.isNeedSummary = isNeedSummary; this.isNeedSummary = isNeedSummary;
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -152,9 +197,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
} }
@Override
protected void comboBoxItemStateChanged() { protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -178,4 +222,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
dataScreeningPane.updateBean(ob); dataScreeningPane.updateBean(ob);
} }
/**
* 保存数据
*
* @return 待保存的对象
*/
public ChartCollection updateBean() {
return null;
}
public int getSelectedIndex() {
return content.getSelectedIndex();
}
public void setSelectedIndex(int index) {
content.setSelectedIndex(index);
}
} }

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -20,7 +21,6 @@ import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List;
public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
@ -74,16 +74,6 @@ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
} }
} }
@Override
public void paint(Graphics g) {
super.paint(g);
if (!paneList.isEmpty()) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(UIConstants.LINE_COLOR);
g2d.drawLine(getWidth() - 2, tabPane.getPreferredSize().height, getWidth() - 2, getHeight() - 1);
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
if (!paneList.isEmpty()) { if (!paneList.isEmpty()) {

6
designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java

@ -109,7 +109,7 @@ public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAtt
} }
}); });
autoRefreshTime = new UISpinner(0, Integer.MAX_VALUE, 1, 0); autoRefreshTime = createIntervalTime();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f, 20}; double[] columnSize = {p, f, 20};
@ -129,6 +129,10 @@ public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAtt
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Refresh"), gapPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Refresh"), gapPane);
} }
protected UISpinner createIntervalTime() {
return new UISpinner(1, Integer.MAX_VALUE, 5, 60);
}
private JPanel createHyperlinkPane() { private JPanel createHyperlinkPane() {
hyperLinkPane = new ExtendedChartHyperLinkPane(); hyperLinkPane = new ExtendedChartHyperLinkPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), hyperLinkPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), hyperLinkPane);

15
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java

@ -35,18 +35,19 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
* @param creator 组件 * @param creator 组件
*/ */
public void fix(XCreator creator) { public void fix(XCreator creator) {
FRBorderLayout layout = (FRBorderLayout)container.getFRLayout(); FRBorderLayout layout = (FRBorderLayout) container.getFRLayout();
Object constraints = layout.getConstraints(creator); Object constraints = layout.getConstraints(creator);
double scale = container.getScale();
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) { if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) {
((XWBorderLayout)container).toData().setNorthSize(creator.getHeight()); ((XWBorderLayout) container).toData().setNorthSize((int) (creator.getHeight() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) {
((XWBorderLayout)container).toData().setSouthSize(creator.getHeight()); ((XWBorderLayout) container).toData().setSouthSize((int) (creator.getHeight() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.EAST)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.EAST)) {
((XWBorderLayout)container).toData().setEastSize(creator.getWidth()); ((XWBorderLayout) container).toData().setEastSize((int) (creator.getWidth() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.WEST)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.WEST)) {
((XWBorderLayout)container).toData().setWestSize(creator.getWidth()); ((XWBorderLayout) container).toData().setWestSize((int) (creator.getWidth() / scale));
} else { } else {
return; return;
} }
container.recalculateChildrenPreferredSize(); container.recalculateChildrenPreferredSize();
} }
@ -185,4 +186,4 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
return new FRBorderLayoutConstraints(container, creator); return new FRBorderLayoutConstraints(container, creator);
} }
} }

23
designer-form/src/main/java/com/fr/design/designer/creator/XButton.java

@ -147,7 +147,7 @@ public class XButton extends XWidgetCreator {
public void propertyChange() { public void propertyChange() {
FreeButton button = (FreeButton) data; FreeButton button = (FreeButton) data;
if (button.getFont() != null) { if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP( setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
@ -230,7 +230,7 @@ public class XButton extends XWidgetCreator {
if (!button.isCustomStyle()) { if (!button.isCustomStyle()) {
l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148)));
bg = DEFAULTBG; bg = DEFAULTBG;
contentLabel.setFont(DEFAULTFT); setContentLabelFont(DEFAULTFT);
contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR); contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR);
editor.setLayout(new BorderLayout()); editor.setLayout(new BorderLayout());
editor.add(l, BorderLayout.CENTER); editor.add(l, BorderLayout.CENTER);
@ -239,7 +239,7 @@ public class XButton extends XWidgetCreator {
editor.setLayout(new BorderLayout()); editor.setLayout(new BorderLayout());
editor.add(l,BorderLayout.CENTER); editor.add(l,BorderLayout.CENTER);
if (button.getFont() != null) { if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP( setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
@ -302,11 +302,26 @@ public class XButton extends XWidgetCreator {
setButtonText(button.getText()); setButtonText(button.getText());
checkButonType(); checkButonType();
if (button.getFont() != null) { if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP( setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
} }
private void setContentLabelFont(Font font) {
float size = (float) (font.getSize() * getScale());
contentLabel.setFont(font.deriveFont(size));
}
public void setScale(double scale){
super.setScale(scale);
FreeButton button = (FreeButton) data;
if (button.getFont() != null) {
setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
}else {
setContentLabelFont(DEFAULTFT);
}
}
} }

9
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -49,6 +49,7 @@ import java.util.Set;
* *
*/ */
public abstract class XCreator extends JPanel implements XComponent, XCreatorTools { public abstract class XCreator extends JPanel implements XComponent, XCreatorTools {
private double scale = 1.0;
protected static final Border DEFALUTBORDER = BorderFactory.createLineBorder(new Color(210, 210, 210), 1); protected static final Border DEFALUTBORDER = BorderFactory.createLineBorder(new Color(210, 210, 210), 1);
public static final Dimension SMALL_PREFERRED_SIZE = new Dimension(80, 21); public static final Dimension SMALL_PREFERRED_SIZE = new Dimension(80, 21);
@ -102,6 +103,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
} }
public double getScale() {
return scale;
}
public void setScale(double scale) {
this.scale = scale;
}
/** /**
* 初始化组件大小 * 初始化组件大小
*/ */

6
designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.FRFont;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -94,8 +95,11 @@ public class XLabel extends XWidgetCreator {
} }
if (label.getWidgetValue() != null) { if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = label.getFont();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue()
.toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign()) .toString(), Style.getInstance(font.applySize(fontsize))
.deriveHorizontalAlignment(label.getTextalign())
.deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP) .deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
.deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE), .deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE),
FontTransformUtil.getDesignerFontResolution()); FontTransformUtil.getDesignerFontResolution());

4
designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java

@ -59,8 +59,10 @@ public class XTextArea extends XFieldEditor {
TextArea area = (TextArea) data; TextArea area = (TextArea) data;
if (area.getWidgetValue() != null) { if (area.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = FRFont.getInstance();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) .toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT)
.deriveVerticalAlignment(SwingConstants.TOP) .deriveVerticalAlignment(SwingConstants.TOP)
.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution()); .deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution());
} }

4
designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java

@ -67,8 +67,10 @@ public class XTextEditor extends XWrapperedFieldEditor {
TextEditor area = (TextEditor) data; TextEditor area = (TextEditor) data;
if (area.getWidgetValue() != null) { if (area.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = FRFont.getInstance();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) .toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution());
} }
} }

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

@ -30,6 +30,8 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -397,6 +399,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
return; return;
} }
XWidgetCreator creator = (XWidgetCreator) e.getChild(); XWidgetCreator creator = (XWidgetCreator) e.getChild();
creator.setScale(this.getScale());
WAbsoluteLayout wabs = this.toData(); WAbsoluteLayout wabs = this.toData();
if (!creator.acceptType(XWFitLayout.class)) { if (!creator.acceptType(XWFitLayout.class)) {
creator.setDirections(Direction.ALL); creator.setDirections(Direction.ALL);
@ -602,4 +605,17 @@ public class XWAbsoluteLayout extends XLayoutContainer {
return super.getWidgetPropertyUIProviders(); return super.getWidgetPropertyUIProviders();
} }
} }
public void adjustCompSize(double percent) {
double p = percent + 1;
WAbsoluteLayout absoluteLayout = this.toData();
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator component = (XCreator) this.getComponent(i);
CRBoundsWidget boundsWidget = absoluteLayout.getBoundsWidget(component.toData());
Rectangle rec = new Rectangle(boundsWidget.getBounds());
component.adjustCompSize(percent);
component.setBounds((int) (rec.x * p), (int) (rec.y * p), (int) (rec.width * p), (int) (rec.height * p));
}
}
} }

56
designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java

@ -126,14 +126,14 @@ public class XWBorderLayout extends XLayoutContainer {
WBorderLayout wlayout = this.toData(); WBorderLayout wlayout = this.toData();
Object constraints = wlayout.getConstraints(wgt); Object constraints = wlayout.getConstraints(wgt);
Dimension d = new Dimension(); Dimension d = new Dimension();
if (ComparatorUtils.equals(WBorderLayout.NORTH,constraints)) { if (ComparatorUtils.equals(WBorderLayout.NORTH, constraints)) {
d.height = wlayout.getNorthSize(); d.height = (int) (wlayout.getNorthSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.SOUTH,constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.SOUTH, constraints)) {
d.height = wlayout.getSouthSize(); d.height = (int) (wlayout.getSouthSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.EAST,constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.EAST, constraints)) {
d.width = wlayout.getEastSize(); d.width = (int) (wlayout.getEastSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.WEST,constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.WEST, constraints)) {
d.width = wlayout.getWestSize(); d.width = (int) (wlayout.getWestSize() * getScale());
} }
return d; return d;
} }
@ -203,8 +203,40 @@ public class XWBorderLayout extends XLayoutContainer {
} }
} }
@Override @Override
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
return new FRBorderLayoutAdapter(this); return new FRBorderLayoutAdapter(this);
} }
/**
* 自适应布局的缩放
*
* @param percent 百分比
*/
public void adjustCompSize(double percent) {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = this.getXCreator(i);
WBorderLayout wlayout = this.toData();
Object constraints = wlayout.getConstraints(creator.toData());
if (ComparatorUtils.equals(BorderLayout.NORTH, constraints)) {
int northSize = (int) (this.toData().getNorthSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(dim.width, northSize));
} else if (ComparatorUtils.equals(BorderLayout.SOUTH, constraints)) {
int southSize = (int) (this.toData().getSouthSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(dim.width, southSize));
} else if (ComparatorUtils.equals(BorderLayout.EAST, constraints)) {
int eastSize = (int) (this.toData().getEastSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(eastSize, dim.height));
} else if (ComparatorUtils.equals(BorderLayout.WEST, constraints)) {
int westSize = (int) (this.toData().getWestSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(westSize, dim.height));
}
}
}
} }

86
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -18,6 +18,7 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -129,6 +130,7 @@ public class XWFitLayout extends XLayoutContainer {
} }
} }
/** /**
* 直接拖动滑条改变整体像素大小时不用考虑控件的最小高度宽度内部组件全部一起缩小放大 * 直接拖动滑条改变整体像素大小时不用考虑控件的最小高度宽度内部组件全部一起缩小放大
* 只是界面显示大小改变不改变对应的BoundsWidget大小 * 只是界面显示大小改变不改变对应的BoundsWidget大小
@ -137,32 +139,28 @@ public class XWFitLayout extends XLayoutContainer {
public void adjustCreatorsWhileSlide(double percent) { public void adjustCreatorsWhileSlide(double percent) {
int count = this.getComponentCount(); int count = this.getComponentCount();
if (count == 0) { if (count == 0) {
Dimension size = new Dimension(this.getSize()); Dimension size = new Dimension(this.toData().getContentWidth(), this.toData().getContentHeight());
size.width += size.width*percent; size.width += size.width * percent;
size.height += size.height*percent; size.height += size.height * percent;
this.setSize(size); this.setSize(size);
return; return;
} }
// 初始化时还未加间隔
if (hasCalGap) {
moveContainerMargin();
moveCompInterval(backupGap);
LayoutUtils.layoutContainer(this);
}
int containerW = 0; int containerW = 0;
int containerH = 0; int containerH = 0;
int[] hors = getHors(false); int[] hors = getDataHors();
int[] veris = getVeris(false); int[] veris = getDataVeris();
PaddingMargin margin = toData().getMargin(); PaddingMargin margin = new PaddingMargin();
for (int i=0; i<count; i++) { for (int i = 0; i < count; i++) {
XCreator creator = getXCreator(i); XCreator creator = getXCreator(i);
WFitLayout fitLayout = this.toData();
CRBoundsWidget boundsWidget = fitLayout.getBoundsWidget(creator.toData());
// 百分比和updateBoundsWidget时都会调整大小 // 百分比和updateBoundsWidget时都会调整大小
// 子组件非空时,调整界面大小、 撤销、再次打开表单,都会按屏幕百分比调整,此时必须考虑内边距 // 子组件非空时,调整界面大小、 撤销、再次打开表单,都会按屏幕百分比调整,此时必须考虑内边距
Rectangle rec = modifyCreatorPoint(creator.getBounds(), percent, hors, veris); Rectangle rec = modifyCreatorPoint(boundsWidget.getBounds(), percent, hors, veris);
if (rec.x == margin.getLeft()) { if (rec.x == margin.getLeft()) {
containerH += rec.height; containerH += rec.height;
} }
if (rec.y == margin.getTop()) { if (rec.y == margin.getTop()) {
containerW += rec.width; containerW += rec.width;
} }
creator.setBounds(rec); creator.setBounds(rec);
@ -170,15 +168,12 @@ public class XWFitLayout extends XLayoutContainer {
} }
// 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器 // 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器
this.setSize( this.setSize(
containerW + (int)(margin.getLeft() * (1.0+percent) + margin.getRight() * (1.0+percent)), containerW + (int) (margin.getLeft() * (1.0 + percent) + margin.getRight() * (1.0 + percent)),
containerH + (int)(margin.getTop() * (1.0+percent) + margin.getBottom() * (1.0+percent)) containerH + (int) (margin.getTop() * (1.0 + percent) + margin.getBottom() * (1.0 + percent))
); );
updateCreatorsBackupBound(); updateCreatorsBackupBound();
// 间隔也按显示大小比例调整 // 间隔也按显示大小比例调整
if (!hasCalGap) { addCompInterval(getAcualInterval());
moveContainerMargin();
addCompInterval(getAcualInterval());
}
LayoutUtils.layoutContainer(this); LayoutUtils.layoutContainer(this);
} }
@ -186,6 +181,7 @@ public class XWFitLayout extends XLayoutContainer {
* 调整控件的point和size,避免拖动滑块出现空隙 * 调整控件的point和size,避免拖动滑块出现空隙
*/ */
private Rectangle modifyCreatorPoint(Rectangle rec, double percent, int[] hors, int[] veris) { private Rectangle modifyCreatorPoint(Rectangle rec, double percent, int[] hors, int[] veris) {
rec = new Rectangle(rec);
int xIndex = 0, yIndex = 0; int xIndex = 0, yIndex = 0;
PaddingMargin margin = toData().getMargin(); PaddingMargin margin = toData().getMargin();
Rectangle bound = new Rectangle(rec); Rectangle bound = new Rectangle(rec);
@ -264,6 +260,41 @@ public class XWFitLayout extends XLayoutContainer {
return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()})); return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()}));
} }
public int[] getDataHors() {
List<Integer> posX = new ArrayList<Integer>();
// 保存实际大小时,组件大小已经去除内边距,此处也判断下
posX.add(0);
int width = this.toData().getContainerWidth();
posX.add(width);
for (int i = 0, len = this.toData().getWidgetCount(); i < len; i++) {
CRBoundsWidget widget = (CRBoundsWidget) this.toData().getWidget(i);
Rectangle rec = widget.getBounds();
if (!posX.contains(rec.x)) {
posX.add(rec.x);
}
}
Collections.sort(posX);
return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()}));
}
public int[] getDataVeris() {
List<Integer> posY = new ArrayList<Integer>();
// 保存实际大小时,组件大小已经去除内边距,此处也判断下
posY.add(0);
int height = this.toData().getContainerHeight();
posY.add(height);
for (int i = 0, len = this.toData().getWidgetCount(); i < len; i++) {
CRBoundsWidget boundsWidget = (CRBoundsWidget) this.toData().getWidget(i);
Rectangle rec = boundsWidget.getBounds();
if (!posY.contains(rec.y)) {
posY.add(rec.y);
}
}
Collections.sort(posY);
return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()}));
}
/** /**
* 获取内部组件纵坐标值 * 获取内部组件纵坐标值
* @param isActualSize 实际大小 * @param isActualSize 实际大小
@ -290,6 +321,7 @@ public class XWFitLayout extends XLayoutContainer {
return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()})); return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()}));
} }
/** /**
* 是否能缩小 * 是否能缩小
* @param percent 百分比 * @param percent 百分比
@ -860,12 +892,14 @@ public class XWFitLayout extends XLayoutContainer {
} }
super.add(comp, constraints); super.add(comp, constraints);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, false); dealDirections(creator, false);
} }
private void add(Component comp, Object constraints, boolean isInit) { private void add(Component comp, Object constraints, boolean isInit) {
super.add(comp, constraints); super.add(comp, constraints);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, isInit); dealDirections(creator, isInit);
} }
@ -1331,4 +1365,14 @@ public class XWFitLayout extends XLayoutContainer {
} }
} }
} }
/**
* 自适应布局的缩放
*
* @param percent 百分比
*/
@Override
public void adjustCompSize(double percent) {
this.adjustCreatorsWhileSlide(percent);
}
} }

6
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -237,6 +237,7 @@ public class XCardSwitchButton extends XButton {
layout.setIndex(--tabFitIndex); layout.setIndex(--tabFitIndex);
} }
} }
tagLayout.setTabsAndAdjust();
} }
@ -337,7 +338,8 @@ public class XCardSwitchButton extends XButton {
String titleText = button.getText(); String titleText = button.getText();
this.setButtonText(titleText); this.setButtonText(titleText);
FRFont font = widgetTitle.getFrFont(); FRFont font = widgetTitle.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); int fontsize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(), (float) (fontsize * getScale()));
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
label.setForeground(font.getForeground()); label.setForeground(font.getForeground());
@ -459,7 +461,7 @@ public class XCardSwitchButton extends XButton {
TitlePacker title = getWidgetTitle(); TitlePacker title = getWidgetTitle();
FRFont font = title.getFrFont(); FRFont font = title.getFrFont();
int fontSize = font.getSize() + FONT_SIZE_ADJUST; int fontSize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), fontSize); FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), (float) (fontSize * getScale()));
FontMetrics fm = GraphHelper.getFontMetrics(newFont); FontMetrics fm = GraphHelper.getFontMetrics(newFont);
for (int i = 0; i < titleText.length(); i++) { for (int i = 0; i < titleText.length(); i++) {
titleStringBuf.append(titleText.charAt(i)); titleStringBuf.append(titleText.charAt(i));

2
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -290,7 +290,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
@Override @Override
public void doLayout() { public void doLayout() {
setTabsAndAdjust();
//设置布局 //设置布局
super.doLayout(); super.doLayout();
} }
@ -382,7 +381,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
} else { } else {
adjustTabsV(parent, tabLength, cardWidth, cardHeight); adjustTabsV(parent, tabLength, cardWidth, cardHeight);
} }
fixTitleLayout(parent);
} }
public void adjustTabsH(XLayoutContainer parent, int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) { public void adjustTabsH(XLayoutContainer parent, int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {

83
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -8,15 +8,11 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
@ -44,7 +40,7 @@ import java.beans.IntrospectionException;
* @date 2014-6-23 * @date 2014-6-23
*/ */
public class XWTabFitLayout extends XWFitLayout { public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 0; private static final int MIN_SIZE = 0;
private static final int WIDTH_SIDE_OFFSET = 57; private static final int WIDTH_SIDE_OFFSET = 57;
@ -101,7 +97,7 @@ public class XWTabFitLayout extends XWFitLayout {
public XWTabFitLayout(){ public XWTabFitLayout(){
this(new WTabFitLayout(), new Dimension()); this(new WTabFitLayout(), new Dimension());
} }
public XWTabFitLayout(WTabFitLayout widget, Dimension initSize) { public XWTabFitLayout(WTabFitLayout widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
@ -252,13 +248,13 @@ public class XWTabFitLayout extends XWFitLayout {
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
return new FRTabFitLayoutAdapter(this); return new FRTabFitLayoutAdapter(this);
} }
/** /**
* tab布局里删除XWTabFitLayout对应的tab按钮 * tab布局里删除XWTabFitLayout对应的tab按钮
* *
* @param creator 当前组件 * @param creator 当前组件
* @param designer 表单设计器 * @param designer 表单设计器
* *
*/ */
@Override @Override
public void deleteRelatedComponent(XCreator creator, FormDesigner designer){ public void deleteRelatedComponent(XCreator creator, FormDesigner designer){
@ -288,15 +284,15 @@ public class XWTabFitLayout extends XWFitLayout {
deleteTabLayout(mainLayout,designer); deleteTabLayout(mainLayout,designer);
return; return;
} }
//刷新tab按钮和tabFitLayout的index //刷新tab按钮和tabFitLayout的index
refreshIndex(tag,cardLayout,index); refreshIndex(tag,cardLayout,index);
LayoutUtils.layoutRootContainer(designer.getRootComponent()); LayoutUtils.layoutRootContainer(designer.getRootComponent());
} }
private void deleteTabLayout(XLayoutContainer mainLayout, FormDesigner designer){ private void deleteTabLayout(XLayoutContainer mainLayout, FormDesigner designer){
SelectionModel selectionModel = designer.getSelectionModel(); SelectionModel selectionModel = designer.getSelectionModel();
if(mainLayout != null){ if(mainLayout != null){
@ -323,7 +319,7 @@ public class XWTabFitLayout extends XWFitLayout {
} }
} }
} }
/** /**
* tab布局里切换到相应的tab按钮 * tab布局里切换到相应的tab按钮
* @param comp 当前组件 * @param comp 当前组件
@ -344,44 +340,37 @@ public class XWTabFitLayout extends XWFitLayout {
button.setShowButton(button.getIndex()==index); button.setShowButton(button.getIndex()==index);
} }
} }
/** /**
* 寻找最近的为自适应布局的父容器 * 寻找最近的为自适应布局的父容器
* *
* @return 布局容器 * @return 布局容器
* *
* *
* @date 2014-12-30-下午3:15:28 * @date 2014-12-30-下午3:15:28
* *
*/ */
@Override @Override
public XLayoutContainer findNearestFit(){ public XLayoutContainer findNearestFit(){
XLayoutContainer parent = this.getBackupParent(); XLayoutContainer parent = this.getBackupParent();
return parent == null ? null : parent.findNearestFit(); return parent == null ? null : parent.findNearestFit();
} }
/**
* 非顶层自适应布局的缩放
* @param percent 百分比
*/
@Override
public void adjustCompSize(double percent) {
this.adjustCreatorsWhileSlide(percent);
}
/** /**
* 该布局需要隐藏无需对边框进行操作 * 该布局需要隐藏无需对边框进行操作
* @param border 边框 * @param border 边框
* *
*/ */
public void setBorder(Border border) { public void setBorder(Border border) {
return; return;
} }
/** /**
* 按照百分比缩放内部组件宽度 * 按照百分比缩放内部组件宽度
* *
* @param percent 宽度变化的百分比 * @param percent 宽度变化的百分比
*/ */
@Override @Override
@ -397,7 +386,7 @@ public class XWTabFitLayout extends XWFitLayout {
moveCompInterval(getAcualInterval()); moveCompInterval(getAcualInterval());
updateCompsWidget(); updateCompsWidget();
} }
layoutWidthResize(percent); layoutWidthResize(percent);
if (percent < 0 && this.getNeedAddWidth() > 0) { if (percent < 0 && this.getNeedAddWidth() > 0) {
this.setSize(this.getWidth()+this.getNeedAddWidth(), this.getHeight()); this.setSize(this.getWidth()+this.getNeedAddWidth(), this.getHeight());
modifyEdgemostCreator(true); modifyEdgemostCreator(true);
@ -410,8 +399,8 @@ public class XWTabFitLayout extends XWFitLayout {
updateWidgetBackupBounds(); updateWidgetBackupBounds();
LayoutUtils.layoutContainer(this); LayoutUtils.layoutContainer(this);
} }
/** /**
* 布局容器高度手动修改时 * 布局容器高度手动修改时
* 同时调整容器内的组件们,缩小时需要考虑有的组件高度不满足缩小高度 * 同时调整容器内的组件们,缩小时需要考虑有的组件高度不满足缩小高度
@ -441,13 +430,13 @@ public class XWTabFitLayout extends XWFitLayout {
updateWidgetBackupBounds(); updateWidgetBackupBounds();
LayoutUtils.layoutContainer(this); LayoutUtils.layoutContainer(this);
} }
@Override @Override
public XLayoutContainer getOuterLayout(){ public XLayoutContainer getOuterLayout(){
XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent(); XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent();
return cardLayout.getBackupParent(); return cardLayout.getBackupParent();
} }
// 更新内部组件的widget // 更新内部组件的widget
private void updateCompsWidget(){ private void updateCompsWidget(){
for(int m=0;m<this.getComponentCount();m++){ for(int m=0;m<this.getComponentCount();m++){
@ -487,7 +476,7 @@ public class XWTabFitLayout extends XWFitLayout {
this.setxCardSwitchButton((XCardSwitchButton)xCreator); this.setxCardSwitchButton((XCardSwitchButton)xCreator);
} }
} }
/** /**
* 去除原有的间隔 * 去除原有的间隔
* @param gap 间隔 * @param gap 间隔
@ -498,11 +487,11 @@ public class XWTabFitLayout extends XWFitLayout {
return; return;
} }
int val = gap/2; int val = gap/2;
// 比较组件大小和tab布局的大小的参照宽高 // 比较组件大小和tab布局的大小的参照宽高
double referWidth = getReferWidth(); double referWidth = getReferWidth();
double referHeight = getReferHeight(); double referHeight = getReferHeight();
for (int i=0, len=this.getComponentCount(); i<len; i++) { for (int i=0, len=this.getComponentCount(); i<len; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
Rectangle rec = comp.getBounds(); Rectangle rec = comp.getBounds();
@ -523,10 +512,10 @@ public class XWTabFitLayout extends XWFitLayout {
} }
comp.setBounds(bound); comp.setBounds(bound);
} }
this.hasCalGap = false; this.hasCalGap = false;
} }
private double getReferWidth(){ private double getReferWidth(){
if(referDim != null){ if(referDim != null){
return referDim.getWidth(); return referDim.getWidth();
@ -534,7 +523,7 @@ public class XWTabFitLayout extends XWFitLayout {
return this.getWidth(); return this.getWidth();
} }
} }
private double getReferHeight(){ private double getReferHeight(){
if(referDim != null){ if(referDim != null){
return referDim.getHeight(); return referDim.getHeight();
@ -542,8 +531,8 @@ public class XWTabFitLayout extends XWFitLayout {
return this.getHeight(); return this.getHeight();
} }
} }
/** /**
* 间隔大于0时界面处加上间隔 * 间隔大于0时界面处加上间隔
* 界面的间隔是针对显示实际保存的大小不受间隔影响 * 界面的间隔是针对显示实际保存的大小不受间隔影响
@ -578,7 +567,7 @@ public class XWTabFitLayout extends XWFitLayout {
} }
comp.setBounds(bound); comp.setBounds(bound);
} }
this.hasCalGap = true; this.hasCalGap = true;
} }

194
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -2,16 +2,13 @@ package com.fr.design.mainframe;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -28,8 +25,10 @@ import com.fr.general.FRScreen;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.AbstractAction;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -46,13 +45,17 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener; import java.awt.event.MouseWheelListener;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class FormArea extends JComponent implements ScrollRulerComponent { public class FormArea extends JComponent implements ScrollRulerComponent {
private static final double SLIDER_FLOAT = 400.0; private static final double SLIDER_FLOAT = 400.0;
private static final double SLIDER_MIN = 10.0; private static final double SLIDER_MIN = 10.0;
private static final String SCALE_PLUS_COMMAND = "scale_plus";
private static final String SCALE_MINUS_COMMAND = "scale_minus";
public static final double DEFAULT_SLIDER = 100.0; public static final double DEFAULT_SLIDER = 100.0;
private static final int ROTATIONS = 50; private static final int ROTATIONS = 50;
private static final int SHOWVALMAX = 400; private static final int SHOWVALMAX = 400;
@ -72,8 +75,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private UINumberField heightPane; private UINumberField heightPane;
private JFormSliderPane slidePane; private JFormSliderPane slidePane;
private boolean isValid = true; private boolean isValid = true;
// 初始时滑块值为100,托动后的值设为START_VALUE;
private double START_VALUE = DEFAULT_SLIDER;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
private double screenValue; private double screenValue;
@ -112,16 +113,33 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
addFormRuler(); addFormRuler();
} }
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); this.addMouseWheelListener(showValSpinnerMouseWheelListener);
registerShortCutKey();
} }
private boolean openSliderZoom(){ /**
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); * 注册缩放快捷键
if (adaptiveConfigUI != null) { * mac: command + command -
return adaptiveConfigUI.openFormSliderZoom(); * windows: ctr + ctr -
} */
return false; private void registerShortCutKey() {
this.registerKeyboardAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
int old_resolution = slidePane.getShowValue();
slidePane.setShowValue(old_resolution + SHOWVALMIN);
}
}, SCALE_PLUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW);
this.registerKeyboardAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
int old_resolution = slidePane.getShowValue();
slidePane.setShowValue(old_resolution - SHOWVALMIN);
}
}, SCALE_MINUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW);
} }
public void onMobileAttrModified() { public void onMobileAttrModified() {
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr(); FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr();
if (formMobileAttr.isMobileOnly()) { if (formMobileAttr.isMobileOnly()) {
@ -138,12 +156,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) slidePane.getShowVal().getValue(); int old_resolution = slidePane.getShowValue();
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN)); slidePane.setShowValue(old_resolution - (dir * SHOWVALMIN));
} }
} }
}; };
/** /**
* 增加表单的页面大小控制界面包括手动修改和滑块拖动 * 增加表单的页面大小控制界面包括手动修改和滑块拖动
*/ */
@ -151,9 +171,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {f}; double[] rowSize = {f};
double[] columnSize = {p, f, p, p, p, p, p, p}; double[] columnSize = {p, f, p, p, p, p, p, f, p};
UILabel tipsPane = new UILabel("form"); UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(200, 0)); tipsPane.setPreferredSize(new Dimension(375, 0));
widthPane = new UINumberField(); widthPane = new UINumberField();
widthPane.setPreferredSize(new Dimension(60, 0)); widthPane.setPreferredSize(new Dimension(60, 0));
heightPane = new UINumberField(); heightPane = new UINumberField();
@ -167,17 +187,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel("x"), heightPane, new UILabel("x"), heightPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel(),
slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP); slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP);
this.add(FormRulerLayout.BOTTOM, resizePane); this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig(); setWidgetsConfig();
boolean needOpenSliderZoom = openSliderZoom();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(needOpenSliderZoom); slidePane.setEnabled(true);
slidePane.setVisible(needOpenSliderZoom); slidePane.setVisible(true);
if (needOpenSliderZoom) {
initTransparent();
}
initCalculateSize(); initCalculateSize();
slidePane.addValueChangeListener(showValSpinnerChangeListener);
} }
private void setWidgetsConfig() { private void setWidgetsConfig() {
@ -192,21 +210,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
addHeightPaneListener(); addHeightPaneListener();
} }
private void initTransparent() {
initCalculateSize();
slidePane.getShowVal().addChangeListener(showValSpinnerChangeListener);
}
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner) e.getSource()).getValue(); double value = slidePane.getShowValue();
value = value > SHOWVALMAX ? SHOWVALMAX : value; value = value > SHOWVALMAX ? SHOWVALMAX : value;
value = value < SHOWVALMIN ? SHOWVALMIN : value; value = value < SHOWVALMIN ? SHOWVALMIN : value;
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); scale((int) value);
jf.getFormDesign().setResolution((int) value);
jf.getFormDesign().getArea().resolution = (int) value;
reCalculateRoot(value, true);
JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (form != null) { if (form != null) {
form.fireTargetModified(); form.fireTargetModified();
@ -214,6 +225,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
}; };
private void scale(int value){
this.designer.setResolution(value);
this.designer.getArea().resolution = value;
reCalculateRoot(value, true);
}
/** /**
* 返回当前的屏幕分辨率对应的百分比值 * 返回当前的屏幕分辨率对应的百分比值
* *
@ -238,7 +255,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue();
XLayoutContainer root = FormArea.this.designer.getRootComponent(); XLayoutContainer root = FormArea.this.designer.getRootComponent();
// 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整 // 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整
// slidePane.populateBean(screenValue);
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
@ -246,7 +262,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} else { } else {
// 组件间隔啊 // 组件间隔啊
// REPORT-2585 原有的逻辑导致嵌套的tab中的间隔加不上去,会在后续拖动的过程中出问题 // REPORT-2585 原有的逻辑导致嵌套的tab中的间隔加不上去,会在后续拖动的过程中出问题
reCalculateDefaultRoot(screenValue, true); reCalculateDefaultRoot();
} }
} }
LayoutUtils.layoutContainer(root); LayoutUtils.layoutContainer(root);
@ -366,16 +382,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* 修改大小后再根据屏幕分辨率调整下 * 修改大小后再根据屏幕分辨率调整下
*/ */
private void doReCalculateRoot(int width, int height, XWFitLayout layout) { private void doReCalculateRoot(int width, int height, XWFitLayout layout) {
// double value = slidePane.updateBean();
//重置滑块的值为默认值100 //重置滑块的值为默认值100
START_VALUE = DEFAULT_SLIDER;
if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
layout.getParent().setSize(width, height + designer.getParaHeight()); layout.getParent().setSize(width, height + designer.getParaHeight());
FormArea.this.validate();
} else { } else {
layout.setBackupGap(screenValue / DEFAULT_SLIDER); layout.setBackupGap(screenValue / DEFAULT_SLIDER);
reCalculateRoot(screenValue, false);
} }
reCalculateRoot(slidePane.getShowValue(), true);
} }
/** /**
@ -385,71 +399,60 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @param value * @param value
*/ */
private void reCalculateRoot(double value, boolean needCalculateParaHeight) { private void reCalculateRoot(double value, boolean needCalculateParaHeight) {
if ( AssistUtils.equals(value, START_VALUE) ) { double percent = (value - DEFAULT_SLIDER) / DEFAULT_SLIDER;
return; double scale = value / DEFAULT_SLIDER;
}
double percent = (value - START_VALUE) / START_VALUE;
XLayoutContainer root = FormArea.this.designer.getRootComponent(); XLayoutContainer root = FormArea.this.designer.getRootComponent();
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(value / DEFAULT_SLIDER); layout.setContainerPercent(scale);
layout.adjustCompSize(percent);
traverAndAdjust(layout, percent); traverAndAdjust(layout, percent);
layout.adjustCreatorsWhileSlide(percent);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); Dimension d = new Dimension(layout.getWidth(), layout.getHeight());
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
root.setScale(scale);
// 自适应布局的父层是border // 自适应布局的父层是border
if (layout.getParent() != null) { if (parent != null) {
int paraHeight = designer.getParaHeight(); parent.setScale(scale);
if (needCalculateParaHeight && paraHeight > 0) { int paraHeight = parent.toData().getNorthSize();
designer.setParaHeight(paraHeight); XLayoutContainer paraComponent = designer.getParaComponent();
XWBorderLayout parent = (XWBorderLayout) layout.getParent(); if (needCalculateParaHeight && paraComponent != null) {
parent.toData().setNorthSize(paraHeight); paraComponent.setScale(scale);
this.designer.setParaHeight(paraHeight);
paraComponent.setPreferredSize(new Dimension(d.width, this.designer.getParaHeight()));
paraComponent.adjustCompSize( percent);
parent.removeAll(); parent.removeAll();
parent.add(designer.getParaComponent(), WBorderLayout.NORTH); parent.add(paraComponent, WBorderLayout.NORTH);
parent.add(designer.getRootComponent(), WBorderLayout.CENTER); parent.add(root, WBorderLayout.CENTER);
root.setBounds(0, this.designer.getParaHeight(), d.width, d.height);
} }
layout.getParent().setSize(d.width, d.height + paraHeight); parent.setSize(d.width, d.height + this.designer.getParaHeight());
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea // 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
FormArea.this.validate(); FormArea.this.validate();
LayoutUtils.layoutRootContainer(designer.getRootComponent());
} }
START_VALUE = value;
} }
} }
/** /**
* 按照界面大小的百分比值调整root大小 * 按照界面大小的百分比值调整root大小
* *
* @param needCalculateParaHeight 是否需要调整参数界面高度
* @param value
*/ */
private void reCalculateDefaultRoot(double value, boolean needCalculateParaHeight) { private void reCalculateDefaultRoot() {
XLayoutContainer root = FormArea.this.designer.getRootComponent(); XLayoutContainer root = FormArea.this.designer.getRootComponent();
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(1.0); Dimension dimension = layout.getSize();
traverAndAdjust(layout, 0.0); double widthScale = 960D / dimension.width;
layout.adjustCreatorsWhileSlide(0.0); double heightScale = 960D / dimension.height;
final double scaleValue = Math.min(widthScale, heightScale);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 int value = (int) (scaleValue * 100);
slidePane.setShowValue(value);
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); if (value == 100) {
// 自适应布局的父层是border return;
if (layout.getParent() != null) {
int paraHeight = designer.getParaHeight();
if (needCalculateParaHeight && paraHeight > 0) {
designer.setParaHeight(paraHeight);
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
parent.toData().setNorthSize(paraHeight);
parent.removeAll();
parent.add(designer.getParaComponent(), WBorderLayout.NORTH);
parent.add(designer.getRootComponent(), WBorderLayout.CENTER);
}
layout.getParent().setSize(d.width, d.height + paraHeight);
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
FormArea.this.validate();
} }
scale(value);
} }
} }
@ -459,6 +462,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
Object object = creator.getComponent(i); Object object = creator.getComponent(i);
if (object instanceof XCreator) { if (object instanceof XCreator) {
XCreator temp = (XCreator) object; XCreator temp = (XCreator) object;
temp.setScale(1 + percent);
temp.adjustCompSize(percent); temp.adjustCompSize(percent);
traverAndAdjust(temp, percent); traverAndAdjust(temp, percent);
} }
@ -480,17 +484,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* 鼠标滚轮事件 * 鼠标滚轮事件
* 由于表单设计界面要求 容器大小大于界面时滚动条才可以拖动所以不支持滚动无限往下滚 * 由于表单设计界面要求 容器大小大于界面时滚动条才可以拖动所以不支持滚动无限往下滚
*/ */
@Override // @Override
protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) { // protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) {
int id = evt.getID(); // int id = evt.getID();
switch (id) { // switch (id) {
case MouseEvent.MOUSE_WHEEL: { // case MouseEvent.MOUSE_WHEEL: {
onMouseWheelScroll(evt); // onMouseWheelScroll(evt);
break; // break;
} // }
default: // default:
} // }
} // }
private void onMouseWheelScroll(MouseWheelEvent evt) { private void onMouseWheelScroll(MouseWheelEvent evt) {
int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS; int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS;
@ -723,9 +727,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @return 百分比值 * @return 百分比值
*/ */
public double getSlideValue() { public double getSlideValue() {
// return slidePane.updateBean(); return slidePane.getShowValue();
//7.1.1不加缩放滑块
return this.screenValue;
} }
/** /**
@ -763,7 +765,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
layout.moveContainerMargin(); layout.moveContainerMargin();
layout.addCompInterval(layout.getAcualInterval()); layout.addCompInterval(layout.getAcualInterval());
} else if (designer.getRootComponent().acceptType(XWFitLayout.class)) { } else if (designer.getRootComponent().acceptType(XWFitLayout.class)) {
START_VALUE = DEFAULT_SLIDER;
reCalculateRoot(slide, true); reCalculateRoot(slide, true);
// slidePane.populateBean(slide); // slidePane.populateBean(slide);
} }
@ -840,7 +841,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH; DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;
DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT; DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT;
int designerLeft = left + (verScrollBar.getX() - DESIGNERWIDTH) / 2; int designerLeft = left + (verScrollBar.getX() - DESIGNERWIDTH) / 2;
rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT); int designerTop = top + (horScrollBar.getY() - DESIGNERHEIGHT) / 2;
rec = new Rectangle(designerLeft, designerTop, DESIGNERWIDTH, DESIGNERHEIGHT);
} }
// designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。 // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。
designer.setBounds(rec); designer.setBounds(rec);

6
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -493,10 +493,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
public void setParaHeight(int height) { public void setParaHeight(int height) {
XWBorderLayout container = (XWBorderLayout) getTopContainer(); XWBorderLayout container = (XWBorderLayout) getTopContainer();
container.toData().setNorthSize(height); container.toData().setNorthSize(height);
container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight()); int displayHeight = (int) (height * container.getScale());
paraHeight = height; container.setSize(container.getWidth(), container.getHeight() + displayHeight - getParaHeight());
paraHeight = displayHeight;
} }
/** /**
* 删除参数界面 * 删除参数界面
*/ */

9
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -15,6 +15,8 @@ import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.awt.LayoutManager; import java.awt.LayoutManager;
@ -232,12 +234,13 @@ public class FormSelection {
int size = selection.size(); int size = selection.size();
if (size == 1) { if (size == 1) {
XCreator creator = selection.get(0); XCreator creator = selection.get(0);
if(creator.acceptType(XWCardTagLayout.class)){ if (creator.acceptType(XWCardTagLayout.class)) {
creator = (XCreator)selection.get(0).getParent(); creator = (XCreator) selection.get(0).getParent();
} }
creator.setBounds(rec); creator.setBounds(rec);
if (creator.acceptType(XWParameterLayout.class)) { if (creator.acceptType(XWParameterLayout.class)) {
designer.setParaHeight((int) rec.getHeight()); double height = rec.getHeight() / creator.getScale();
designer.setParaHeight((int) height);
designer.getArea().doLayout(); designer.getArea().doLayout();
} }
LayoutUtils.layoutContainer(creator); LayoutUtils.layoutContainer(creator);

17
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -42,15 +43,13 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().getSelection().backupBounds(); formDesigner.getSelectionModel().getSelection().backupBounds();
super.update(); super.update();
Rectangle bounds = new Rectangle(creator.getBounds()); Rectangle bounds = new Rectangle((int) x.getValue(), (int) y.getValue(), (int) width.getValue(), (int) height.getValue());
bounds.x = (int) x.getValue();
bounds.y = (int) y.getValue();
if (parent == null) { if (parent == null) {
return; return;
} }
WLayout wabs = parent.toData(); WLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds); wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds); parent.adjustCompSize(parent.getScale() -1);
LayoutUtils.layoutContainer(creator); LayoutUtils.layoutContainer(creator);
XWAbsoluteLayout layout = (XWAbsoluteLayout) parent; XWAbsoluteLayout layout = (XWAbsoluteLayout) parent;
layout.updateBoundsWidget(creator); layout.updateBoundsWidget(creator);
@ -59,14 +58,13 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
@Override @Override
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){ public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){
bounds.width = w; bounds.width = w;
creator.setBounds(bounds);
} }
@Override @Override
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){ public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){
bounds.height = h; bounds.height = h;
creator.setBounds(bounds);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "absoluteBound"; return "absoluteBound";
@ -75,7 +73,12 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
@Override @Override
public void populate() { public void populate() {
super.populate(); super.populate();
Rectangle bounds = new Rectangle(creator.getBounds()); WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
if (boundsWidget == null){
return;
}
Rectangle bounds = boundsWidget.getBounds();
x.setValue(bounds.x); x.setValue(bounds.x);
y.setValue(bounds.y); y.setValue(bounds.y);
} }

32
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -20,9 +20,8 @@ import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import javax.swing.JOptionPane;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -46,8 +45,8 @@ public class WidgetBoundPane extends BasicPane {
} }
public XLayoutContainer getParent(XCreator source) { public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){ if (source.acceptType(XWCardTagLayout.class)) {
return (XLayoutContainer)source.getParent(); return (XLayoutContainer) source.getParent();
} }
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
@ -79,18 +78,24 @@ public class WidgetBoundPane extends BasicPane {
} }
public void populate() { public void populate() {
Rectangle bounds = new Rectangle(creator.getBounds()); WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
if (boundsWidget == null){
return;
}
Rectangle bounds = new Rectangle(boundsWidget.getBounds());
width.setValue(bounds.width); width.setValue(bounds.width);
height.setValue(bounds.height); height.setValue(bounds.height);
} }
public void fix() { public void fix() {
Rectangle bounds = new Rectangle(creator.getBounds()); WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
Rectangle bounds = new Rectangle(boundsWidget.getBounds());
creator.setBackupBound(creator.getBounds()); creator.setBackupBound(creator.getBounds());
int w = (int) width.getValue(); int w = (int) width.getValue();
int h = (int) height.getValue(); int h = (int) height.getValue();
Rectangle rec = ComponentUtils.getRelativeBounds(parent); Rectangle rec = ComponentUtils.getRelativeBounds(parent);
WLayout wabs = parent.toData();
if (bounds.width != w) { if (bounds.width != w) {
limitWidth(wabs, w, bounds, rec); limitWidth(wabs, w, bounds, rec);
} }
@ -101,25 +106,27 @@ public class WidgetBoundPane extends BasicPane {
public void adjustComponents(Rectangle bounds, int difference, int row) { public void adjustComponents(Rectangle bounds, int difference, int row) {
double scale = parent.getScale();
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBound(); Rectangle backupBounds = getBound();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator); FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator);
if (layoutAdapter != null) { if (layoutAdapter != null) {
layoutAdapter.setEdit(true); layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference); layoutAdapter.calculateBounds(backupBounds, new Rectangle((int) (bounds.x * scale), (int) (bounds.y * scale), (int) (bounds.width * scale), (int) (bounds.height * scale)), creator, row, difference);
} }
} }
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) { public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) {
int difference = 0; int difference = 0;
double scale = parent.getScale();
int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling()); int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling());
PaddingMargin margin = wabs.getMargin(); PaddingMargin margin = wabs.getMargin();
if (bounds.width != w) { if (bounds.width != w) {
if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) { if ((int) (bounds.width * scale) == rec.width - margin.getLeft() - margin.getRight()) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds"));
width.setValue(bounds.width); width.setValue(bounds.width);
return; return;
} else if (w < minWidth) { } else if (w * scale < minWidth) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Width") + Integer.toString(minWidth)); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Width") + Integer.toString(minWidth));
width.setValue(bounds.width); width.setValue(bounds.width);
return; return;
@ -132,15 +139,16 @@ public class WidgetBoundPane extends BasicPane {
} }
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) { public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) {
double scale = parent.getScale();
int difference = 0; int difference = 0;
PaddingMargin margin = wabs.getMargin(); PaddingMargin margin = wabs.getMargin();
int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling()); int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling());
if (bounds.height != h) { if (bounds.height != h) {
if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) { if ((int) (bounds.height * scale) == rec.height - margin.getTop() - margin.getBottom()) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds"));
height.setValue(bounds.height); height.setValue(bounds.height);
return; return;
} else if (h < minHeight) { } else if (h * scale < minHeight) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Height") + Integer.toString(minHeight)); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Height") + Integer.toString(minHeight));
height.setValue(bounds.height); height.setValue(bounds.height);
return; return;

24
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java

@ -10,11 +10,9 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WTabDisplayPosition; import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.JOptionPane;
import java.awt.Rectangle; import java.awt.Rectangle;
/** /**
@ -39,6 +37,7 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
if (parent == null) { if (parent == null) {
return; return;
} }
double scale = parent.getScale();
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle parentBounds = new Rectangle(parent.getBounds()); Rectangle parentBounds = new Rectangle(parent.getBounds());
@ -48,17 +47,17 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
XLayoutContainer tabLayout = creator.getTopLayout(); XLayoutContainer tabLayout = creator.getTopLayout();
Rectangle rectangle = tabLayout.getBounds(); Rectangle rectangle = tabLayout.getBounds();
if(ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){ if(ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
if(rectangle.height < size){ if(rectangle.height < size* scale){
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return; return;
} }
parentBounds.height = size; parentBounds.height = (int) (size * scale);
}else{ }else{
if(rectangle.width < size){ if(rectangle.width < size*scale){
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return; return;
} }
parentBounds.width = size; parentBounds.width = (int) (size * scale);
} }
parent.setBounds(parentBounds); parent.setBounds(parentBounds);
@ -76,15 +75,8 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
@Override @Override
public void populate() { public void populate() {
WCardTagLayout tagLayout = (WCardTagLayout)creator.toData(); WCardMainBorderLayout wCardMainBorderLayout = (WCardMainBorderLayout)creator.getTopLayout().toData();
Rectangle bounds = new Rectangle(creator.getBounds()); cardTagWidth.setValue(wCardMainBorderLayout.getTitleSize());
WTabDisplayPosition displayPosition = tagLayout.getDisplayPosition();
if( ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
cardTagWidth.setValue(bounds.height);
}else{
cardTagWidth.setValue(bounds.width);
}
} }
} }

7
designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -18,12 +18,15 @@ import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
/** /**
* Server Config Manager * Server Config Manager
*/ */
public class ServerConfigManagerAction extends UpdateAction { public class ServerConfigManagerAction extends UpdateAction {
public static final Dimension DEFAULT = new Dimension(700, 630);
public ServerConfigManagerAction() { public ServerConfigManagerAction() {
this.setMenuKeySet(SERVER_CONFIG_MANAGER); this.setMenuKeySet(SERVER_CONFIG_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
@ -48,8 +51,8 @@ public class ServerConfigManagerAction extends UpdateAction {
} }
}; };
final BasicDialog editReportServerParameterDialog = editReportServerParameterPane.showWindow( final BasicDialog editReportServerParameterDialog = editReportServerParameterPane.showWindowWithCustomSize(
DesignerContext.getDesignerFrame() DesignerContext.getDesignerFrame(), null, DEFAULT
); );
editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() { editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() {

4
designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java

@ -15,6 +15,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction; import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import javax.swing.*; import javax.swing.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -30,6 +31,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
protected UIButton hyperlinkButton; protected UIButton hyperlinkButton;
protected HyperlinkGroupPane pane; protected HyperlinkGroupPane pane;
protected BasicDialog dialog; protected BasicDialog dialog;
private static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(730, 600);
public HyperlinkPane(final ConditionAttributesPane conditionAttributesPane) { public HyperlinkPane(final ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane); super(conditionAttributesPane);
@ -39,7 +41,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
NameJavaScriptGroup nameHyperlinks = jsGroup; NameJavaScriptGroup nameHyperlinks = jsGroup;
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(HyperlinkGroupPaneActionImpl.getInstance()); pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks); pane.populate(nameHyperlinks);
dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane)); dialog = pane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(conditionAttributesPane), null, WINDOW_CUSTOM_SIZE);
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {

6
designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java

@ -12,10 +12,12 @@ import com.fr.design.widget.WidgetManageCardPane;
import com.fr.design.widget.WidgetPane; import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.form.ui.TextArea;
import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.WidgetHighlightAction; import com.fr.report.cell.cellattr.highlight.WidgetHighlightAction;
import javax.swing.*; import javax.swing.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -27,6 +29,7 @@ import java.awt.event.ActionListener;
public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<HighlightAction> { public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<HighlightAction> {
private static final int DIALOG_WIDTH = 700; private static final int DIALOG_WIDTH = 700;
private static final int DIALOG_HEIGHT = 400; private static final int DIALOG_HEIGHT = 400;
private static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(720, 600);
private Widget widget; private Widget widget;
private UIComboBox box; private UIComboBox box;
@ -45,8 +48,7 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<Highli
} }
}; };
widgetPane.populate(widget); widgetPane.populate(widget);
BasicDialog dialog = widgetPane.showWindow( BasicDialog dialog = widgetPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(conditionAttributesPane), null, WINDOW_CUSTOM_SIZE);
SwingUtilities.getWindowAncestor(conditionAttributesPane));
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
widget = widgetPane.update(); widget = widgetPane.update();

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

@ -760,6 +760,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (centerPane.isUpEditMode()) { if (centerPane.isUpEditMode()) {
if (hasParameterPane()) { if (hasParameterPane()) {
parameterPane.populate(u.getApplyTarget()); parameterPane.populate(u.getApplyTarget());
setAutoHeightForCenterPane();
DesignModuleFactory.getFormHierarchyPane().refreshRoot(); DesignModuleFactory.getFormHierarchyPane().refreshRoot();
} }
} else { } else {
@ -782,6 +783,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private void applyAll(WorkBookUndoState u) { private void applyAll(WorkBookUndoState u) {
if (hasParameterPane()) { if (hasParameterPane()) {
parameterPane.populate(u.getApplyTarget()); parameterPane.populate(u.getApplyTarget());
setAutoHeightForCenterPane();
DesignModuleFactory.getFormHierarchyPane().refreshRoot(); DesignModuleFactory.getFormHierarchyPane().refreshRoot();
} }
//报表主体 //报表主体

Loading…
Cancel
Save