Browse Source

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

feature/big-screen
Yuan.Wang 4 years ago
parent
commit
876b799612
  1. 4
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  3. 5
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  4. 36
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  5. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  6. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  7. 25
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  8. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/ConfigurableCaret.java
  9. 38
      designer-base/src/main/java/com/fr/design/jdk/JdkVersion.java
  10. 5
      designer-base/src/main/java/com/fr/design/object/NameObject.java
  11. 4
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  12. 10
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  13. 129
      designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java
  14. 50
      designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java
  15. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  16. 10
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  17. 36
      designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java
  18. 6
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  19. 34
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  20. 24
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java
  21. 28
      designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java
  22. 27
      designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java
  23. 2
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  24. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  25. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithBackGroundLabel.java
  26. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  27. 361
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  28. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java
  29. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java
  30. 196
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  31. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  32. 198
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  33. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java
  34. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java
  35. 22
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java
  36. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java
  37. 29
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  38. 23
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  39. 5
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java
  40. 22
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java
  41. 8
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java
  42. 3
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  43. 8
      designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java
  44. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  45. 4
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java
  46. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java
  47. 2
      designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java
  48. 1
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java
  49. 1
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java
  50. 4
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java
  51. 4
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java
  52. 10
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java
  53. 8
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureLabelContentPane.java
  54. 4
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java
  55. 22
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java
  56. 4
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java
  57. 1
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java
  58. 19
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  59. 19
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  60. 4
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  61. 9
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  62. 2
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js
  63. 3
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  64. 21
      designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java
  65. 18
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  66. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  67. 2
      designer-form/src/main/java/com/fr/design/mainframe/TopXCreators.java
  68. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java
  69. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  70. 12
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  71. 17
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  72. 9
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java
  73. 10
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java
  74. 3
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  75. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  76. 2
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java
  77. 53
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

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

@ -20,6 +20,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -39,6 +40,7 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations;
@ -216,7 +218,7 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
if (!OperatingSystem.isLinux()) {
if (!OperatingSystem.isLinux() && JdkVersion.LE_8.support()) {
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);

2
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -37,7 +37,7 @@ public interface UIConstants {
public static final Image APPFIT_H3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png");
public static final Image APPFIT_H4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 1, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0);
public static final Border CELL_ATTR_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15);

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

@ -97,7 +97,7 @@ public abstract class DesignTableDataManager {
*/
private static void fireDsChanged() {
fireDsChanged(globalDsListeners);
for (Iterator<Entry<String, List<ChangeListener>>> entryIterator = dsListenersMap.entrySet().iterator(); entryIterator.hasNext();) {
for (Iterator<Entry<String, List<ChangeListener>>> entryIterator = dsListenersMap.entrySet().iterator(); entryIterator.hasNext(); ) {
List<ChangeListener> dsListeners = entryIterator.next().getValue();
fireDsChanged(dsListeners);
}
@ -190,6 +190,7 @@ public abstract class DesignTableDataManager {
}
dsListeners.add(l);
}
/**
* 获取数据源source中dsName的所有字段
*
@ -280,7 +281,7 @@ public abstract class DesignTableDataManager {
Entry<String, TableDataWrapper> entry = entryIt.next();
list.add(entry.getKey());
}
return list.toArray(new String[list.size()]);
return list.toArray(new String[0]);
}
/**

36
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -7,6 +7,7 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
@ -34,7 +35,7 @@ import java.util.Map;
*/
public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController {
private boolean isNamePermitted = true;
private Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private Map<String, String> dsNameChangedMap = new HashMap<>();
public TableDataPaneListPane() {
super();
@ -43,11 +44,16 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override
public void propertyChange() {
isNamePermitted = true;
String tempName = getEditingName();
if (ComparatorUtils.equals(tempName, selectedName)) {
//说明双击之后又取消了,啥也不用做
return;
}
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
allListNames[editingIndex] = StringUtils.EMPTY;
Object editingType = getEditingType();
if (!BasicTableDataUtils.checkName(tempName)) {
@ -67,9 +73,8 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex);
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
boolean isRepeated = isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName);
if (isRepeated) {
isNamePermitted = false;
nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName));
@ -81,11 +86,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex);
}
if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName);
}
rename(selectedName, isRepeated ? NameInspector.ILLEGAL_NAME_HOLDER : tempName);
}
}
});
@ -93,6 +94,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
@Override
public void rename(String oldName, String newName) {
//如果a改成了b,b又被改成了c,就认为是a改成了c
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) {
if (StringUtils.equals(oldName, entry.getValue())) {
oldName = entry.getKey();
}
}
dsNameChangedMap.put(oldName, newName);
}
@ -192,7 +200,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
}
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
populate(nameObjectList.toArray(new NameObject[0]));
}
/**
@ -212,7 +220,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name)));
}
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
populate(nameObjectList.toArray(new NameObject[0]));
}
@Override
@ -220,7 +228,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
tableDataConfig.removeAllTableData();
ProcedureConfig.getInstance().removeAllProcedure();
Nameable[] tableDataArray = this.update();
Map<String,TableData> tableDataMap = new LinkedHashMap<String,TableData>();
Map<String, TableData> tableDataMap = new LinkedHashMap<String, TableData>();
for (int i = 0; i < tableDataArray.length; i++) {
NameObject nameObject = (NameObject) tableDataArray[i];
tableDataMap.put(nameObject.getName(), (TableData) nameObject.getObject());

5
designer-base/src/main/java/com/fr/design/dialog/UIDialog.java

@ -116,6 +116,11 @@ public abstract class UIDialog extends JDialog {
doCancel();
}
});
applyEnterAction();
}
protected void applyEnterAction() {
JPanel defaultPane = (JPanel) this.getContentPane();
InputMap inputMapAncestor = defaultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap actionMap = defaultPane.getActionMap();

2
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java

@ -65,7 +65,7 @@ class ListControlPaneHelper {
res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
}
return res.toArray(new Nameable[res.size()]);
return res.toArray(new Nameable[0]);
}
/**

25
designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java

@ -25,10 +25,20 @@ import com.fr.general.FRFont;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
@ -67,11 +77,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton subPane;
private JPanel linePane;
private int italic_bold;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public FRFontPane() {
this.initComponents();
}
public FRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -345,7 +364,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER);
return createPane;

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/ConfigurableCaret.java

@ -12,6 +12,7 @@ import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.awt.event.ActionEvent;
import java.awt.geom.Line2D;
import java.io.*;
import javax.swing.*;
import javax.swing.plaf.*;
@ -454,9 +455,10 @@ public class ConfigurableCaret extends DefaultCaret {
// A thicker vertical line.
case THICK_VERTICAL_LINE_STYLE:
g.drawLine(r.x,r.y, r.x,r.y+r.height);
r.x++;
g.drawLine(r.x,r.y, r.x,r.y+r.height);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(2));
// 向右再移动一个位置 避免光标太接近文字内容
g2.draw(new Line2D.Float(r.x + 1, r.y, r.x + 1, r.y + r.height));
break;
} // End of switch (style).

38
designer-base/src/main/java/com/fr/design/jdk/JdkVersion.java

@ -0,0 +1,38 @@
package com.fr.design.jdk;
import com.fr.stable.StableUtils;
/**
* 设计器运行jdk版本
*
* @author hades
* @version 10.0
* Created by hades on 2020/9/27
*/
public enum JdkVersion {
/**
* 小于或等于jdk 8
*/
LE_8 {
@Override
public boolean support() {
return StableUtils.getMajorJavaVersion() <= 8;
}
},
/**
* 大于或等于jdk 9
*/
GE_9 {
@Override
public boolean support() {
return StableUtils.getMajorJavaVersion() >= 9;
}
};
abstract public boolean support();
}

5
designer-base/src/main/java/com/fr/design/object/NameObject.java

@ -2,6 +2,7 @@ package com.fr.design.object;
import com.fr.base.BaseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
*
@ -60,10 +61,10 @@ public class NameObject<T> {
return "Name:" + this.getName() + "\tObject:" + this.getObject();
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes"})
public Object clone() throws CloneNotSupportedException {
NameObject newNameObject = (NameObject)super.clone();
newNameObject.object = BaseUtils.cloneObject(this.object);
newNameObject.object = StableUtils.cloneObject(this.object);
return newNameObject;
}

4
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -2,8 +2,10 @@ package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
@ -21,7 +23,7 @@ public class PMDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && JdkVersion.LE_8.support()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();

10
designer-base/src/main/java/com/fr/design/style/FormatPane.java

@ -393,6 +393,7 @@ public class FormatPane extends BasicPane {
patternTextField.setEditable(true);
patternList.setEnabled(true);
int contents = getContents(source);
String[] patternArray = FormatField.getInstance().getFormatArray(contents);
@ -407,6 +408,7 @@ public class FormatPane extends BasicPane {
//maybe need to select the first item.
String text = patternTextField.getText();
if (hasPattenText(text, patternModel)) {
String pattern = null;
if (format instanceof DecimalFormat) {
@ -418,6 +420,10 @@ public class FormatPane extends BasicPane {
if (pattern != null) {
patternList.setSelectedValue(pattern, true);
if (patternList.getSelectedIndex() == -1) {
//patten不在下拉框里面
patternList.setSelectedIndex(0);
}
} else {
patternList.setSelectedIndex(0);
}
@ -426,13 +432,13 @@ public class FormatPane extends BasicPane {
};
private boolean hasPattenText (String text, DefaultListModel patternModel) {
return (text == null || text.length() <= 0) && patternModel.size() > 0;
return StringUtils.isEmpty(text) && patternModel.size() > 0;
}
private void setPatternTextEnable() {
patternTextField.setEnabled(false);
patternTextField.setEditable(false);
patternTextField.setText("");
patternTextField.setText(StringUtils.EMPTY);
patternList.setEnabled(false);
}

129
designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java

@ -1,129 +0,0 @@
package com.fr.design.update.factory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
/**
* Created by XINZAI on 2018/8/21.
*/
public class DirectoryOperationFactory {
/**
* 新建一个目录
*
* @param dirPath 目录路径
*/
public static void createNewDirectory(String dirPath) {
try {
File newDirPath = new File(dirPath);
if (!newDirPath.exists()) {
StableUtils.mkdirs(newDirPath);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
/**
* 删除目录
*
* @param dirPath 目录路径
*/
public static void deleteDirectory(String dirPath) {
try {
File dir = new File(dirPath);
if (dir.isDirectory()) {
File[] file = dir.listFiles();
for (File fileTemp : file) {
deleteDirectory(fileTemp.toString());
fileTemp.delete();
}
} else {
dir.delete();
}
dir.delete();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
/**
* 复制目录
*
* @param oldDirPath 被复制目录
* @param newDirPath 新目录
*/
public static void copyDirectory(String oldDirPath, String newDirPath) {
File oldDir = new File(oldDirPath);
if (oldDir.isDirectory()) {
StableUtils.mkdirs(new File(newDirPath));
File[] files = oldDir.listFiles();
for (File fileTemp : files) {
copyDirectory(fileTemp.toString(), newDirPath + "/" + fileTemp.getName());
}
} else {
try {
copy(oldDirPath, newDirPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}
private static void copy(String path1, String path2) throws IOException {
try (DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(path1)));
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path2)))) {
byte[] date = new byte[in.available()];
in.read(date);
out.write(date);
}
}
/**
* 移动目录
*
* @param oldDirPath 被移动目录
* @param newDirPath 新目录
*/
public static void moveDirectory(String oldDirPath, String newDirPath) {
copyDirectory(oldDirPath, newDirPath);
deleteDirectory(oldDirPath);
}
/**
* 列出过滤后的文件
*
* @param installHome 安装目录
* @param backupdir 备份目录
* @return String数组
*/
public static String[] listFilteredFiles(String installHome, String backupdir) {
File backupDir = new File(StableUtils.pathJoin(installHome, backupdir));
StableUtils.mkdirs(backupDir);
File[] fileNames = backupDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
String[] jarFileName = new String[fileNames.length];
int j = 0;
for (File fileName : fileNames) {
if ((fileName.isDirectory()) && (ArrayUtils.getLength(fileName.listFiles()) > 0)) {//判断备份文件夹中是否为空,为空不显示
jarFileName[j++] = fileName.getName();
}
}
return Arrays.copyOf(jarFileName, j);
}
}

50
designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java

@ -0,0 +1,50 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import java.io.File;;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-29
*/
public class UpdateFileFactory {
private UpdateFileFactory() {
}
public static File[] getBackupVersions() {
File[] versions = null;
try {
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.mkdirs(backupDir);
versions = backupDir.listFiles();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return versions;
}
public static boolean isBackupVersionsValid(String version) {
boolean designerValid = false;
boolean envValid = false;
try {
File designerLib = new File(StableUtils.pathJoin(version, UpdateConstants.DESIGNERBACKUPPATH));
File[] jars = designerLib.listFiles();
if (jars != null && jars.length > 0) {
designerValid = true;
}
File envLib = new File(StableUtils.pathJoin(version, UpdateConstants.BACKUPPATH));
jars = envLib.listFiles();
if (jars != null && jars.length > 0) {
envValid = true;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return designerValid && envValid;
}
}

4
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java

@ -4,7 +4,7 @@ import com.fr.decision.update.data.UpdateConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.ColorfulCellRender;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
@ -86,7 +86,7 @@ public class RestoreDialog extends JDialog {
JPanel jarListPane = new JPanel();
jarListPane.setLayout(new BoxLayout(jarListPane, BoxLayout.Y_AXIS));
String[] jarBackupFiles = DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR);
String[] jarBackupFiles = UpdateFileUtils.listBackupVersions();
ArrayUtils.reverse(jarBackupFiles);
String[] jarFilesList = ((jarBackupFiles.length < NUMOFCELL_LEAST) ? Arrays.copyOf(jarBackupFiles, NUMOFCELL_LEAST) : jarBackupFiles);

10
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -17,7 +17,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.actions.FileProcess;
import com.fr.design.update.domain.UpdateInfoCachePropertyManager;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.LoadingLabel;
import com.fr.design.update.ui.widget.UpdateActionLabel;
import com.fr.design.update.ui.widget.UpdateInfoTable;
@ -320,7 +320,7 @@ public class UpdateMainDialog extends UIDialog {
}
});
//choose RestoreLabel to show
boolean isNeedRestore = ArrayUtils.isNotEmpty(DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), getBackupDirectory()));
boolean isNeedRestore = ArrayUtils.isNotEmpty(UpdateFileUtils.listBackupVersions());
jarRestoreLabel = isNeedRestore ? jarRestorePreviousRevision : noJarPreviousRevision;
}
@ -544,7 +544,7 @@ public class UpdateMainDialog extends UIDialog {
private void showDownLoadInfo() {
//形如 Build#release-2018.07.31.03.03.52.80
String buildNO = downloadFileConfig.optString("buildNO");
Date jarDate = (new SimpleDateFormat("yyyy.MM.dd")).parse(buildNO, new ParsePosition(buildNO.indexOf("-") + 1));
Date jarDate = (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss")).parse(buildNO, new ParsePosition(buildNO.indexOf("-") + 1));
String serverVersionNO = downloadFileConfig.optString("versionNO");
String currentVersionNO = ProductConstants.RELEASE_VERSION;
String[] serverVersionSplitStr = serverVersionNO.split("\\.");
@ -556,8 +556,8 @@ public class UpdateMainDialog extends UIDialog {
//形如 Build#release-2018.07.31.03.03.52.80
String currentNO = GeneralUtils.readBuildNO();
if (!".".equals(StableUtils.getInstallHome())) {
Date currentDate = (new SimpleDateFormat("yyyy.MM.dd")).parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (DateUtils.subtractDate(jarDate, currentDate, DateUtils.DAY) > 0) {
Date currentDate = (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss")).parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (DateUtils.subtractDate(jarDate, currentDate, DateUtils.SECOND) > 0) {
updateButton.setEnabled(true);
updateLabel.setVisible(true);
loadingLabel.stopLoading(buildNO.contains("-") ? buildNO.substring(buildNO.lastIndexOf("-") + 1) : buildNO);

36
designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java

@ -0,0 +1,36 @@
package com.fr.design.update.utils;
import com.fr.design.update.factory.UpdateFileFactory;
import com.fr.stable.StableUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-25
*/
public class UpdateFileUtils {
/**
* 列出过滤后的文件
*
* @return String数组
*/
public static String[] listBackupVersions() {
File[] versionBackup = UpdateFileFactory.getBackupVersions();
List<String> versions = new ArrayList<>();
if (versionBackup != null) {
for (File file : versionBackup) {
if (UpdateFileFactory.isBackupVersionsValid(file.getAbsolutePath())) {
versions.add(file.getName());
} else {
StableUtils.deleteFile(file);
}
}
}
String[] result = new String[versions.size()];
return versions.toArray(result);
}
}

6
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.Icon;
import com.fr.base.IconManager;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
@ -401,9 +402,8 @@ public class CustomIconPane extends BasicPane {
private void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
double p = TableLayout.PREFERRED;
double rowSize[] = {p, p};
double columnSize[] = {p, p, p};
double[] rowSize = {p, p};
double[] columnSize = {p, p};
UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"));
browseButton.setPreferredSize(new Dimension(80, 25));
browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button"));

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

@ -1,7 +1,5 @@
package com.fr.env;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
@ -444,38 +442,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
new double[]{FILL}
));
setDefaultAppAndServlet();
}
/**
* 设置 app servlet 默认值
*/
private void setDefaultAppAndServlet() {
setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
}
private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return supplier.get();
}
@Override
protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
if (StringUtils.isEmpty(textField.getText())) {
textField.setText(name);
}
}
}.execute();
}

24
designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

@ -0,0 +1,24 @@
package com.fr.design.data.datapane;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.*;
/**
* @author Yyming
* @version 10.0
* Created by Yyming on 2020/9/29
*/
public class TableDataPaneListPaneTest {
@Test
public void rename() {
TableDataPaneListPane listPane = new TableDataPaneListPane();
listPane.rename("111", "222");
listPane.rename("222", "333");
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap();
assertEquals(1, dsNameChangedMap.size());
}
}

28
designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java

@ -0,0 +1,28 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
public class UpdateFileFactoryTest {
@Test
public void testGetBackupVersions() {
Assert.assertEquals(0, UpdateFileFactory.getBackupVersions().length);
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.deleteFile(backupDir);
}
@Test
public void testIsBackupVersionsValid() {
File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
Assert.assertTrue(UpdateFileFactory.isBackupVersionsValid(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test")));
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
}
}

27
designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java

@ -0,0 +1,27 @@
package com.fr.design.update.utils;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-25
*/
public class UpdateFileUtilsTest {
@Test
public void testListFilteredFiles() {
File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
String[] result = UpdateFileUtils.listBackupVersions();
Assert.assertEquals(1, result.length);
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
}
}

2
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -5,6 +5,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
@ -276,6 +277,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -148,11 +148,12 @@ public class VanChartHtmlLabelPane extends JPanel{
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p, p};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight},
new Component[] {null, null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}

27
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithBackGroundLabel.java

@ -0,0 +1,27 @@
package com.fr.van.chart.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.Component;
public class VanChartHtmlLabelPaneWithBackGroundLabel extends VanChartHtmlLabelPane {
protected JPanel createWidthAndHeightPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
JPanel panel = super.createWidthAndHeightPane();
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Background")), panel},
};
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{d, f});
}
}

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java

@ -13,6 +13,6 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
return new VanChartHtmlLabelPaneWithBackGroundLabel();
}
}

361
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java

@ -1,361 +0,0 @@
package com.fr.van.chart.designer.component;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrTooltipContent> {
private UIButtonGroup<Integer> content;
private ValueFormatPaneWithCheckBox valueFormatPane;
private PercentFormatPaneWithCheckBox percentFormatPane;
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
private SeriesNameFormatPaneWithCheckBox seriesNameFormatPane;
//监控刷新时,自动数据点提示使用
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane;
private JPanel centerPane;
private JPanel commonPanel;
private JPanel stylePanel;
private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent;
private JPanel showOnPane;
public VanChartLabelContentPaneWithoutRichText(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent;
this.showOnPane = showOnPane;
this.setLayout(new BorderLayout());
this.add(createLabelContentPane(), BorderLayout.CENTER);
}
public ValueFormatPaneWithCheckBox getValueFormatPane() {
return valueFormatPane;
}
public void setValueFormatPane(ValueFormatPaneWithCheckBox valueFormatPane) {
this.valueFormatPane = valueFormatPane;
}
public PercentFormatPaneWithCheckBox getPercentFormatPane() {
return percentFormatPane;
}
public void setPercentFormatPane(PercentFormatPaneWithCheckBox percentFormatPane) {
this.percentFormatPane = percentFormatPane;
}
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
return categoryNameFormatPane;
}
public void setCategoryNameFormatPane(CategoryNameFormatPaneWithCheckBox categoryNameFormatPane) {
this.categoryNameFormatPane = categoryNameFormatPane;
}
public SeriesNameFormatPaneWithCheckBox getSeriesNameFormatPane() {
return seriesNameFormatPane;
}
public void setSeriesNameFormatPane(SeriesNameFormatPaneWithCheckBox seriesNameFormatPane) {
this.seriesNameFormatPane = seriesNameFormatPane;
}
private JPanel createLabelContentPane() {
content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
initFormatPane(parent, showOnPane);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent);
stylePanel = createTextStylePane();
centerPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return commonPanel.getPreferredSize();
} else {
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
centerPane.add(htmlLabelPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
centerPane.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
double[] column = {f, e};
double[] row = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(getLabelContentTitle()), content},
new Component[]{null, centerPane},
};
initContentListener();
JPanel paramsPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(paramsPanel, BorderLayout.CENTER);
contentPane.add(stylePanel, BorderLayout.SOUTH);
return getLabelContentPane(contentPane);
}
protected boolean hasTextStylePane() {
return true;
}
private JPanel createTextStylePane() {
styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
textAttrPane = new ChartTextAttrPane() {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton);
JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(buttonPane, BorderLayout.CENTER);
stylePanel.add(textAttrPane, BorderLayout.SOUTH);
initStyleButtonListener();
return stylePanel;
}
private void initStyleButtonListener() {
styleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkStylePane();
}
});
}
private void checkStylePane() {
if (hasTextStylePane()) {
stylePanel.setVisible(true);
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1);
} else {
stylePanel.setVisible(false);
}
}
protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
}
protected JPanel createCommonPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = getRowSize(p);
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null},
new Component[]{valueFormatPane, null},
new Component[]{percentFormatPane, null},
};
}
private void initContentListener() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (content.getSelectedIndex() == 1) {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if (isDirty()) {
setCustomFormatterText();
setDirty(false);
}
} else {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
}
protected void setCustomFormatterText() {
htmlLabelPane.setCustomFormatterText(updateBean().getFormatterTextFromCommon());
}
public boolean isDirty() {
return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty()
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) || (changedValueFormatPane != null && changedPercentFormatPane.isDirty());
}
public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty);
valueFormatPane.setDirty(isDirty);
percentFormatPane.setDirty(isDirty);
if (changedValueFormatPane != null) {
changedValueFormatPane.setDirty(isDirty);
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.setDirty(isDirty);
}
}
@Override
protected String title4PopupWindow() {
return "";
}
@Override
public void populateBean(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent == null) {
return;
}
content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1);
populateFormatPane(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if (!attrTooltipContent.isCommon()) {
setDirty(false);
}
if (hasTextStylePane()) {
this.styleButton.setSelectedIndex(attrTooltipContent.isCustom() ? 1 : 0);
this.textAttrPane.populate(attrTooltipContent.getTextAttr());
}
checkCardPane();
checkStylePane();
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat());
valueFormatPane.populate(attrTooltipContent.getValueFormat());
percentFormatPane.populate(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat());
}
}
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip();
attrTooltipContent.setCommon(content.getSelectedIndex() == 0);
updateFormatPane(attrTooltipContent);
updateFormatsWithPaneWidth(attrTooltipContent);
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
if (hasTextStylePane()) {
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
return attrTooltipContent;
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent();
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
valueFormatPane.update(attrTooltipContent.getValueFormat());
percentFormatPane.update(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.update(attrTooltipContent.getChangedPercentFormat());
}
}
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);
}
}
}

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

@ -22,6 +22,10 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan
return new double[]{p,p,p,p,p,p};
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);

32
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java

@ -0,0 +1,32 @@
package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.Dimension;
import java.awt.Frame;
public class VanChartRichEditorDialog extends BasicDialog {
public static final Dimension DEFAULT = new Dimension(660, 600);
public VanChartRichEditorDialog(Frame parent, BasicPane pane) {
super(parent, pane);
this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor"));
this.setBasicDialogSize(DEFAULT);
GUICoreUtils.centerWindow(this);
this.setResizable(true);
this.setModal(true);
}
protected void applyEnterAction() {
}
public void checkValid() {
}
}

196
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -9,6 +9,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
@ -32,7 +33,6 @@ import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheck
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
@ -51,6 +51,15 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private static final long serialVersionUID = 8825929000117843641L;
// 字符样式button
private static final int TEXT_ATTR_AUTO_INDEX = 0;
private static final int TEXT_ATTR_CUSTOM_INDEX = 1;
// 标签内容button
private static final int COMMON_INDEX = 0;
private static final int RICH_EDITOR_INDEX = 1;
private static final int CUSTOM_INDEX_WITH_RICH_EDITOR = 2;
private static final int CUSTOM_INDEX_WITHOUT_RICH_EDITOR = 1;
private UIButtonGroup<Integer> content;
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
@ -83,7 +92,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private AttrTooltipRichText richText;
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent;
this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText();
@ -92,7 +101,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout());
this.add(createLabelContentPane(),BorderLayout.CENTER);
this.add(createLabelContentPane(), BorderLayout.CENTER);
}
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
@ -195,6 +204,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return richText;
}
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
}
private JPanel createLabelContentPane() {
initDetailPane();
initCenterPane();
@ -218,14 +231,22 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
private void initCenterPane() {
if (supportRichEditor()) {
initCenterPaneWithRichEditor();
} else {
initCenterPaneWithoutRichEditor();
}
}
private void initCenterPaneWithRichEditor() {
centerPanel = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
if (content.getSelectedIndex() == COMMON_INDEX) {
return commonPanel.getPreferredSize();
} else if (content.getSelectedIndex() == 1) {
} else if (content.getSelectedIndex() == RICH_EDITOR_INDEX) {
return editorPanel.getPreferredSize();
} else {
return htmlPanel.getPreferredSize();
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
@ -235,6 +256,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
}
private void initCenterPaneWithoutRichEditor() {
centerPanel = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == COMMON_INDEX) {
return commonPanel.getPreferredSize();
} else {
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
centerPanel.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
}
protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
@ -243,6 +279,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
protected boolean supportRichEditor() {
return true;
}
protected boolean hasTextStylePane() {
return true;
}
private JPanel createButtonPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -250,11 +294,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double[] column = {f, p};
double[] row = {p, p};
if (supportRichEditor()) {
content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
} else {
content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
}
Component[][] components = new Component[][]{
new Component[]{null, null},
@ -279,7 +330,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
}
private JPanel createCommonStylePane() {
protected JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
@ -315,7 +366,12 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
private void checkStylePane() {
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1);
if (hasTextStylePane()) {
stylePanel.setVisible(true);
textAttrPane.setVisible(styleButton.getSelectedIndex() == TEXT_ATTR_CUSTOM_INDEX);
} else {
stylePanel.setVisible(false);
}
}
private JPanel createRichEditorPanel() {
@ -351,7 +407,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void fireRichEditor() {
final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText);
BasicDialog dialog = pane.showWindow(new JFrame());
BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane);
pane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
@ -418,8 +474,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
protected double[] getRowSize(double p){
return new double[]{p,p,p,p};
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p};
}
protected Component[][] getPaneComponents() {
@ -451,20 +507,46 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void checkCardPane() {
if (supportRichEditor()) {
checkCardPaneWithRichEditor();
} else {
checkCardPaneWithoutRichEditor();
}
}
private void checkCardPaneWithRichEditor() {
CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == 2) {
if (content.getSelectedIndex() == CUSTOM_INDEX_WITH_RICH_EDITOR) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if(isDirty()){
setCustomFormatterText();
setDirty(false);
}
} else if (content.getSelectedIndex() == 1) {
checkCustomPane();
} else if (content.getSelectedIndex() == RICH_EDITOR_INDEX) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text"));
} else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
stylePanel.setVisible(content.getSelectedIndex() != 1);
stylePanel.setVisible(hasTextStylePane() && content.getSelectedIndex() != RICH_EDITOR_INDEX);
}
private void checkCardPaneWithoutRichEditor() {
CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == CUSTOM_INDEX_WITHOUT_RICH_EDITOR) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
checkCustomPane();
} else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
stylePanel.setVisible(hasTextStylePane());
}
private void checkCustomPane() {
if (isDirty()) {
setCustomFormatterText();
setDirty(false);
}
}
protected void setCustomFormatterText() {
@ -502,37 +584,52 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
@Override
public void populateBean(AttrTooltipContent attrTooltipContent){
if(attrTooltipContent == null){
public void populateBean(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent == null) {
return;
}
if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(0);
} else if (attrTooltipContent.isRichText()) {
content.setSelectedIndex(1);
} else {
content.setSelectedIndex(2);
populateTypeButton(attrTooltipContent);
populateFormatPane(attrTooltipContent);
if (supportRichEditor()) {
populateRichEditor(attrTooltipContent);
}
if (hasTextStylePane()) {
if (attrTooltipContent.isCustom()) {
styleButton.setSelectedIndex(1);
styleButton.setSelectedIndex(TEXT_ATTR_CUSTOM_INDEX);
} else {
styleButton.setSelectedIndex(0);
styleButton.setSelectedIndex(TEXT_ATTR_AUTO_INDEX);
}
this.textAttrPane.populate(attrTooltipContent.getTextAttr());
populateFormatPane(attrTooltipContent);
populateRichEditor(attrTooltipContent);
}
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if(!attrTooltipContent.isCommon()){
if (!attrTooltipContent.isCommon()) {
setDirty(false);
}
checkCardPane();
checkStylePane();
checkCardPane();
}
private void populateTypeButton(AttrTooltipContent attrTooltipContent) {
if (supportRichEditor()) {
if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(COMMON_INDEX);
} else if (attrTooltipContent.isRichText()) {
content.setSelectedIndex(RICH_EDITOR_INDEX);
} else {
content.setSelectedIndex(CUSTOM_INDEX_WITH_RICH_EDITOR);
}
return;
}
if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(COMMON_INDEX);
} else {
content.setSelectedIndex(CUSTOM_INDEX_WITHOUT_RICH_EDITOR);
}
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -583,6 +680,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.getRichTextChangedPercentFormat()
};
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
@ -610,14 +708,17 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip();
attrTooltipContent.setCommon(content.getSelectedIndex() == 0);
attrTooltipContent.setRichText(content.getSelectedIndex() == 1);
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
updateLabelType(attrTooltipContent);
updateFormatPane(attrTooltipContent);
if (supportRichEditor()) {
updateRichEditor(attrTooltipContent);
updateTooltipRichText(attrTooltipContent);
}
if (hasTextStylePane()) {
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == TEXT_ATTR_CUSTOM_INDEX);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
updateFormatsWithPaneWidth(attrTooltipContent);
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
@ -625,6 +726,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return attrTooltipContent;
}
private void updateLabelType(AttrTooltipContent attrTooltipContent) {
if (supportRichEditor()) {
attrTooltipContent.setCommon(content.getSelectedIndex() == COMMON_INDEX);
attrTooltipContent.setRichText(content.getSelectedIndex() == RICH_EDITOR_INDEX);
return;
}
attrTooltipContent.setCommon(content.getSelectedIndex() == COMMON_INDEX);
attrTooltipContent.setRichText(false);
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent();
}
@ -688,9 +801,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
* CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加
*
* @param attrTooltipContent
*/
private void updateFormatsWithPaneWidth (AttrTooltipContent attrTooltipContent) {
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java

@ -10,7 +10,6 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Nameable;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -154,7 +153,7 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
HyperDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame(), true);
super(SwingUtilities.getWindowAncestor(VanChartUIListControlPane.this));
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout());

198
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

@ -1,58 +1,210 @@
package com.fr.van.chart.designer.component.border;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.Marker;
import com.fr.chart.chartglyph.MarkerFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.xcombox.MarkerComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.AttrBorderWithShape;
import com.fr.plugin.chart.marker.type.MarkerType;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartBorderWithShapePane extends VanChartBorderWithRadiusPane {
public class VanChartBorderWithShapePane extends BasicPane {
private static final int RECTANGULAR_INDEX = 0;
private static final int DIALOG_INDEX = 1;
private MarkerComboBox shapePane;
private static final int AUTO_COLOR = 0;
private static final int CUSTOM_COLOR = 1;
protected void initComponents() {
shapePane = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
super.initComponents();
private LineComboBox lineTypeBox;
private UIButtonGroup<Integer> lineColorButton;
private ColorSelectBox lineColorBox;
private MarkerComboBox borderShape;
private UISpinner borderRadius;
private JPanel detailPane;
private JPanel colorBoxPane;
public VanChartBorderWithShapePane() {
initComponents();
createBorderPane();
}
private void initComponents() {
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
lineColorButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
lineColorBox = new ColorSelectBox(100);
borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
borderRadius = new UISpinner(0, 1000, 1, 0);
}
private void createBorderPane() {
this.setLayout(new BorderLayout());
detailPane = createDetailPane();
this.add(createLineTypePane(), BorderLayout.CENTER);
this.add(detailPane, BorderLayout.SOUTH);
initLineTypeListener();
initLineColorListener();
initShapeListener();
}
private void initLineTypeListener() {
lineTypeBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkDetailPane();
}
});
}
private void checkDetailPane() {
detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE);
}
protected Component[][] getUseComponent() {
return new Component[][]{
private void initLineColorListener() {
lineColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkColorPane();
}
});
}
private void checkColorPane() {
colorBoxPane.setVisible(lineColorButton.getSelectedIndex() == CUSTOM_COLOR);
}
private void initShapeListener() {
borderShape.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkRadiusPane();
}
});
}
private void checkRadiusPane() {
borderRadius.setEnabled(borderShape.getSelectedIndex() == RECTANGULAR_INDEX || borderShape.getSelectedIndex() == DIALOG_INDEX);
}
private JPanel createLineTypePane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), currentLineColorPane},
UIComponentUtils.wrapWithBorderLayoutPane(lineTypeBox)}};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
private JPanel createDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")),
UIComponentUtils.wrapWithBorderLayoutPane(shapePane)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), getRadius()}
UIComponentUtils.wrapWithBorderLayoutPane(borderShape)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius}
};
JPanel center = createLineColorPane();
JPanel south = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(center, BorderLayout.CENTER);
panel.add(south, BorderLayout.SOUTH);
return panel;
}
protected double[] getRowSize() {
private JPanel createLineColorPane() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p, p};
}
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
public void populate(AttrBorder border) {
super.populate(border);
double[] columnSize = {f, e};
double[] rowSize = {p, p};
if (border instanceof AttrBorderWithShape) {
shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape())));
Component[][] center = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorButton}
};
Component[][] south = new Component[][]{
new Component[]{null, null},
new Component[]{null, lineColorBox}
};
colorBoxPane = TableLayout4VanChartHelper.createGapTableLayoutPane(south, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(center, rowSize, columnSize), BorderLayout.CENTER);
panel.add(colorBoxPane, BorderLayout.SOUTH);
return panel;
}
protected String title4PopupWindow() {
return null;
}
public void populate(AttrBorderWithShape border) {
if (border == null) {
return;
}
public void update(AttrBorder border) {
super.update(border);
lineTypeBox.setSelectedLineStyle(border.getBorderStyle());
lineColorButton.setSelectedIndex(border.isAutoColor() ? AUTO_COLOR : CUSTOM_COLOR);
lineColorBox.setSelectObject(border.getBorderColor());
borderShape.setSelectedMarker((Marker.createMarker(border.getShape())));
borderRadius.setValue(border.getRoundRadius());
if (border instanceof AttrBorderWithShape) {
((AttrBorderWithShape) border).setShape(MarkerType.parse(shapePane.getSelectedMarkder().getMarkerType()));
checkDetailPane();
checkColorPane();
checkRadiusPane();
}
public void update(AttrBorderWithShape border) {
if (border == null) {
return;
}
border.setBorderStyle(lineTypeBox.getSelectedLineStyle());
border.setAutoColor(lineColorButton.getSelectedIndex() == AUTO_COLOR);
border.setBorderColor(lineColorBox.getSelectObject());
border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType()));
border.setRoundRadius((int) borderRadius.getValue());
}
}

8
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java

@ -2,7 +2,7 @@ package com.fr.van.chart.designer.component.label;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -10,7 +10,7 @@ import javax.swing.JPanel;
/**
* Created by mengao on 2017/8/13.
*/
public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
public class GaugeLabelContentPane extends VanChartLabelContentPane {
public GaugeLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
@ -24,6 +24,10 @@ public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichTe
return contentPane;
}
protected boolean supportRichEditor() {
return false;
}
protected boolean hasTextStylePane() {
return false;
}

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java

@ -17,6 +17,10 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
super(null, showOnPane);
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);

22
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java

@ -1,6 +1,10 @@
package com.fr.van.chart.designer.component.tooltip;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -36,4 +40,22 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane
new Component[]{getRichTextPercentFormatPane(), null}
};
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
}

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java

@ -64,11 +64,14 @@ public class VanChartLabelPane extends AbstractVanChartScrollPane<Chart> {
return;
}
ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr();
// labelPane中颜色选择器会触发listener.doChange(),导致style界面update两次,
// 为了避免递归updateBean时,remove与add不匹配,调整一下labelPane.update()的位置
AttrLabel attrLabel = labelPane.update();
DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection();
if(attr != null) {
attrList.remove(attr);
}
AttrLabel attrLabel = labelPane.update();
if (attrLabel != null) {
attrList.addDataSeriesCondition(attrLabel);
}

29
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -36,6 +36,8 @@ import java.awt.Component;
public class VanChartPlotLabelDetailPane extends BasicPane {
private static final long serialVersionUID = -22438250307946275L;
private static final int HORIZONTAL_INDEX = 0;
private BasicBeanPane<AttrTooltipContent> dataLabelContentPane;
private UIButtonGroup<Integer> position;
@ -51,6 +53,9 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
private JPanel positionPane;
private Integer[] oldPositionValues;
private JPanel borderPaneWithTitle;
private JPanel backgroundPaneWithTitle;
private VanChartStylePane parent;
private Plot plot;
@ -125,8 +130,9 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
private JPanel createLabelBorderPane() {
borderPane = new VanChartBorderWithShapePane();
borderPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane);
return borderPaneWithTitle;
}
private JPanel createLabelBackgroundPane() {
@ -142,7 +148,9 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
}
};
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane);
backgroundPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane);
return backgroundPaneWithTitle;
}
protected double[] getLabelStyleRowSize(double p) {
@ -227,6 +235,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"),
});
orientation.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
checkOrientation();
}
});
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Text_Orientation"), orientation);
}
@ -309,6 +323,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE);
checkPositionEnabled();
}
private void checkOrientation() {
if (orientation != null && borderPaneWithTitle != null && backgroundPaneWithTitle != null) {
boolean horizontal = orientation.getSelectedIndex() == HORIZONTAL_INDEX;
borderPaneWithTitle.setVisible(horizontal);
backgroundPaneWithTitle.setVisible(horizontal);
}
}
private void checkPositionEnabled() {
tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE);
}
@ -344,6 +368,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
}
checkAllUse();
checkOrientation();
}

23
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java

@ -1,15 +1,17 @@
package com.fr.van.chart.funnel.designer.style;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -59,10 +61,29 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane {
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
return attrTooltipContent;
}

5
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java

@ -16,6 +16,11 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt
public VanChartFunnelRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane);
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);

22
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.funnel.designer.style;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -9,6 +11,7 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckB
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -58,10 +61,29 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.getSeriesFormat().setEnable(true);
attrTooltipContent.getValueFormat().setEnable(true);
return attrTooltipContent;

8
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java

@ -3,7 +3,7 @@ package com.fr.van.chart.gantt.designer.style.label;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
@ -16,7 +16,7 @@ import java.awt.Component;
/**
* Created by hufan on 2017/1/13.
*/
public class VanChartGanttLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
public class VanChartGanttLabelContentPane extends VanChartLabelContentPane {
private VanChartFormatPaneWithCheckBox processesFormatPane;
private VanChartDateFormatPaneWithCheckBox startTimeFormatPane;
@ -57,6 +57,10 @@ public class VanChartGanttLabelContentPane extends VanChartLabelContentPaneWitho
};
}
protected boolean supportRichEditor() {
return false;
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{processesFormatPane, null},

3
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat;
@ -136,6 +137,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent){
setRichTextAttr(new AttrTooltipRichText());
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
Map<String, String> params = getRichTextAttr().getParams();

8
designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java

@ -1,10 +1,7 @@
package com.fr.van.chart.map.designer;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.Border;
/**
* Created by Mitisky on 16/5/20.
@ -19,9 +16,4 @@ public class VanMapAreaPointAndLineGroupPane extends VanChartGroupPane {
public VanMapAreaPointAndLineGroupPane(final JPanel areaPane, final JPanel pointPane, final JPanel linePane){
super(new String[]{AREA_MAP_STRING, POINT_MAP_STRING, LINE_MAP_STRING}, new JPanel[]{areaPane, pointPane, linePane});
}
@Override
protected Border getButtonGroupBorder () {
return BorderFactory.createEmptyBorder(0,8,0,18);
}
}

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -45,6 +45,8 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
AttrTooltipContent content = new AttrTooltipContent();
content.setCategoryFormat(new AttrTooltipAreaNameFormat());
content.setValueFormat(new AttrTooltipMapValueFormat());
content.setRichTextCategoryFormat(new AttrTooltipAreaNameFormat());
content.setRichTextValueFormat(new AttrTooltipMapValueFormat());
return content;
}
}

4
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java

@ -23,6 +23,10 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont
return new double[]{p,p,p,p,p,p};
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java

@ -45,6 +45,8 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane {
AttrTooltipContent content = new AttrTooltipContent();
content.setCategoryFormat(new AttrTooltipAreaNameFormat());
content.setValueFormat(new AttrTooltipMapValueFormat());
content.setRichTextCategoryFormat(new AttrTooltipAreaNameFormat());
content.setRichTextValueFormat(new AttrTooltipMapValueFormat());
return content;
}
}

2
designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java

@ -43,6 +43,8 @@ public class VanChartLineMapTooltipContentPane extends VanChartTooltipContentPan
AttrTooltipContent content = new AttrTooltipContent();
content.setCategoryFormat(new AttrTooltipStartAndEndNameFormat());
content.setValueFormat(new AttrTooltipValueFormat());
content.setRichTextCategoryFormat(new AttrTooltipStartAndEndNameFormat());
content.setRichTextValueFormat(new AttrTooltipValueFormat());
return content;
}

1
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java

@ -38,6 +38,7 @@ public class VanChartMultiPieLabelContentPane extends VanChartLabelContentPane {
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent content = new AttrTooltipContent();
content.setCategoryFormat(new AttrTooltipMultiLevelNameFormat());
content.setRichTextCategoryFormat(new AttrTooltipMultiLevelNameFormat());
return content;
}
}

1
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java

@ -39,6 +39,7 @@ public class VanChartMultiPieTooltipContentPane extends VanChartTooltipContentPa
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent content = new AttrTooltipContent();
content.setCategoryFormat(new AttrTooltipMultiLevelNameFormat());
content.setRichTextCategoryFormat(new AttrTooltipMultiLevelNameFormat());
return content;
}

4
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java

@ -19,6 +19,10 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo
super(null, showOnPane);
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);

4
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java

@ -41,6 +41,10 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
}
protected boolean supportRichEditor() {
return false;
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p};
}

10
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.scatter;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -107,21 +108,24 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
super.populateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextXFormatPane, richTextYFormatPane, richTextSizeFormatPane
getRichTextSeriesNameFormatPane(),
richTextXFormatPane,
richTextYFormatPane,
richTextSizeFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextSeriesFormat(),
scatterAttrTooltipContent.getRichTextXFormat(),
scatterAttrTooltipContent.getRichTextYFormat(),
scatterAttrTooltipContent.getRichTextSizeFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}

8
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureLabelContentPane.java

@ -4,7 +4,7 @@ package com.fr.van.chart.structure.desinger.style;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
@ -17,7 +17,7 @@ import java.awt.Component;
/**
* Created by shine on 2017/2/15.
*/
public class VanChartStructureLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
public class VanChartStructureLabelContentPane extends VanChartLabelContentPane {
public VanChartStructureLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
@ -54,6 +54,10 @@ public class VanChartStructureLabelContentPane extends VanChartLabelContentPaneW
setPercentFormatPane(percentFormatPane);
}
protected boolean supportRichEditor() {
return false;
}
@Override
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();

4
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java

@ -38,6 +38,10 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
}
protected boolean supportRichEditor() {
return false;
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p};
}

22
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java

@ -3,6 +3,8 @@ package com.fr.van.chart.structure.desinger.style;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -13,6 +15,7 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckB
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -87,10 +90,29 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP
setRichTextPercentFormatPane(richTextPercentFormatPane);
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
getRichTextSeriesNameFormatPane(),
getRichTextValueFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
@Override
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.setCategoryFormat(new AttrTooltipMultiLevelNameFormat());
attrTooltipContent.setRichTextCategoryFormat(new AttrTooltipMultiLevelNameFormat());
return attrTooltipContent;
}
}

4
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java

@ -51,6 +51,10 @@ public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordClou
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
}
protected boolean supportRichEditor() {
return false;
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p};
}

1
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java

@ -81,6 +81,7 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
return attrTooltipContent;
}
}

19
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -41,8 +41,8 @@
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var dimensionIds = [];
var getDimensionIds = function (params) {
var result = [];
var paramGroup = params.split("-");
for (var i = 0, len = paramGroup.length; i < len; i++) {
@ -51,9 +51,14 @@
param[key] = value;
dimensionIds.push(param);
result.push(param);
}
return result;
}
var dimensionIds = getDimensionIds(params);
var rich_editor = BI.createWidget({
type: "bi.design.chart.common.editor",
element: "body",
@ -86,8 +91,12 @@
}
});
Pool.dispatch = function(){
rich_editor.setValue({content: Pool.data.getContent(), isAuto: Pool.data.isAuto()});
Pool.dispatch = function () {
rich_editor.setValue({
content: Pool.data.getContent(),
isAuto: Pool.data.isAuto(),
dimensionIds: getDimensionIds(Pool.data.getParams())
});
}
Pool.update = function () {

19
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -107,6 +107,16 @@
_cleanHtml: function (value) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var dimensionIds = this.model.dimensionIds;
var dataIdMap = {};
for (var i = 0, len = dimensionIds.length; i < len; i++) {
var dimensionId = dimensionIds[i];
var key = BI.keys(dimensionId)[0];
dataIdMap[key] = dimensionId[key];
}
var result = BI.replaceAll(value, "<p></p>", "");
// 去掉image的src属性,因为数据太大了
result = value.replaceAll("<img.*?>", function (imageStr) {
@ -117,6 +127,10 @@
return;
}
str += " " + key + "=\"" + value + "\"";
if (key === "alt" && dataIdMap[value.trim()]) {
str += " " + "data-id" + "=\"" + dataIdMap[value.trim()] + "\"";
}
});
return str + " />";
@ -156,6 +170,9 @@
this.store.changeIsAuto(obj.isAuto);
this.fontStyleGroup.setValue(obj.isAuto);
}
if (BI.contains(keys, "dimensionIds")) {
this.store.changeDimensionIds(obj.dimensionIds);
}
},
_formatContent: function (content) {
@ -215,7 +232,7 @@
content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE),
origin = content;
if (isAuto) {
content = this._switchToAutoStyle();
// content = this._switchToAutoStyle();
this.setFocus();
} else if (editorService.isRichTextEqual(content, this.options.placeholder)) {
content = "";

4
designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js

@ -42,6 +42,10 @@
this.model.isAuto = isAuto;
},
changeDimensionIds: function (dimensionIds) {
this.model.dimensionIds = dimensionIds;
},
setEditorBlurState: function (isBlur) {
this.model.isEditorBlur = isBlur;
}

9
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

@ -16,13 +16,16 @@
this.addParam(this.model.param, editorService.encode);
this.combo.hideView();
// this._restorePosition();
},
items: function () {
this.adapter.populate(this.model.items);
}
},
render: function () {
var self = this;
var adapter = BI.createWidget({
this.adapter = BI.createWidget({
type: "bi.button_group",
items: this.model.items,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
@ -47,7 +50,7 @@
bgap: 10,
items: [{
type: "bi.searcher",
adapter: adapter,
adapter: this.adapter,
width: 210,
height: 24,
listeners: [{
@ -56,7 +59,7 @@
self.store.changeParam(this.getValue()[0]);
}
}]
}, adapter]
}, this.adapter]
};
return {

2
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js

@ -21,7 +21,7 @@
return {
type: "bi.design.chart.common.editor.search",
text: key,
value: dId[key]
value: key
};
});
}

3
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -15,6 +15,7 @@ import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
@ -111,7 +112,7 @@ public class SelectionModel {
if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) {
XCreator parentContainer = (XCreator) comp.getParent();
if (parentContainer != null) {
comp = parentContainer.isDedicateContainer() ? parentContainer : comp;
comp = parentContainer.isDedicateContainer() || comp instanceof XCardSwitchButton ? parentContainer : comp;
}
}
if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) {

21
designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java

@ -1,5 +1,8 @@
package com.fr.design.form.util;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.FormDesigner;
@ -8,6 +11,7 @@ import com.fr.design.mainframe.template.info.ComponentCreateOperate;
import com.fr.design.mainframe.template.info.ComponentDeleteOperate;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WFitLayout;
import java.awt.Container;
public class FormDesignerUtils {
@ -46,4 +50,21 @@ public class FormDesignerUtils {
jTemplate.getProcessInfo().updateTemplateOperationInfo(new ComponentDeleteOperate(widget));
}
/**
* 判断当前UI组件是否在绝对画布块中
*
* @param xCreator
* @return
*/
public static boolean isInAbsoluteLayout(XCreator xCreator) {
Container parent = xCreator.getParent();
while (parent != null) {
if (parent instanceof XWAbsoluteLayout && !(parent instanceof XWAbsoluteBodyLayout)) {
return true;
}
parent = parent.getParent();
}
return false;
}
}

18
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter {
// 获取焦点,以便获取热键
designer.requestFocus();
}
if (e.getButton() == MouseEvent.BUTTON1) {
if (e.getButton() == MouseEvent.BUTTON1 && !beyondValidArea(e)) {
Direction dir = selectionModel.getDirectionAt(e);
if (!DesignerMode.isAuthorityEditing()) {
@ -177,13 +177,10 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.isDrawLineMode()) {
designer.updateDrawLineMode(e);
} else {
int relativeX = Math.max(0, e.getX());
int relativeY = Math.max(0, e.getY());
if (selectionModel.hasSelectionComponent()
&& selectionModel.getSelection().getRelativeBounds().contains(
designer.getHorizontalScaleValue() + relativeX,
designer.getVerticalScaleValue() + relativeY)) {
designer.getHorizontalScaleValue() + e.getX(),
designer.getVerticalScaleValue() + e.getY())) {
lastPressEvent = e;
lastXCreator = selectionModel.getSelection().getSelectedCreator();
} else {
@ -197,6 +194,15 @@ public class EditingMouseListener extends MouseInputAdapter {
e.translatePoint(oldX - e.getX(), oldY - e.getY());
}
private boolean beyondValidArea(MouseEvent e) {
if (e.getX() < 0 || e.getY() < 0 ||
e.getX() > designer.getRootComponent().getWidth() ||
e.getY() > (designer.getRootComponent().getHeight() + designer.getParaHeight())) {
return true;
}
return false;
}
private void offsetEventPoint(MouseEvent e){
int x = designer.getRelativeX(e.getX());
int y = designer.getRelativeY(e.getY());

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

@ -619,8 +619,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (paraComponent != null && paraComponent.acceptType(XWParameterLayout.class)) {
return true;
} else {
if (this.getSelectionModel().getSelection().getSelectedCreator().getParent() != null
&& ((XLayoutContainer) this.getSelectionModel().getSelection().getSelectedCreator().getParent()).acceptType(XWAbsoluteLayout.class)) {
XCreator creator = this.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null && creator.getParent() != null
&& ((XLayoutContainer) creator.getParent()).acceptType(XWAbsoluteLayout.class)) {
return true;
}
}
@ -1337,6 +1338,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以上移一层吗?
public boolean isCurrentComponentMovableUp() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
if (null == creator) {
return false;
}
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;
@ -1347,6 +1351,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以下移一层吗?
public boolean isCurrentComponentMovableDown() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
if (null == creator) {
return false;
}
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;

2
designer-form/src/main/java/com/fr/design/mainframe/TopXCreators.java

@ -30,7 +30,7 @@ public class TopXCreators extends JComponent {
setBackground(null);
setOpaque(false);
designer.addDesignerEditListener(e -> {
if (e.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
if (e.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || e.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
refresh();
}
});

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
@ -58,7 +59,8 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
frFontPane = new FRFontPane();
// 字体大小是浮点数,因为涉及很多字体计算,不太好修改,为了完整显示字体,将FRFontPane中的fontSizeComboBox拉长一点
frFontPane = new FRFontPane(LayoutConstants.VGAP_MEDIUM);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p};

14
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -24,6 +24,7 @@ import com.fr.design.mainframe.mobile.ui.MobileCollapsedStylePane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.BorderFactory;
@ -201,9 +202,20 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle();
this.mobileCollapsedStyleEditor.setStyle(style);
fix(style);
this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork());
}
/**
* 根据组件当前位置修正下属性
*
* @param style
*/
private void fix(MobileCollapsedStyle style) {
style.setCollapsedWork(style.isCollapsedWork() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
}
@Override
public void update() {
ChartMobileAttrProvider mobileAttr = ((BaseChartEditor)xCreator.toData()).getMobileAttr();
@ -219,7 +231,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) {
((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style);
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
}
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}

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

@ -176,9 +176,19 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated());
this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle());
fix(elementCaseEditor.getMobileCollapsedStyle());
this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork());
}
/**
* 根据组件当前位置修正下属性
*
* @param style
*/
private void fix(MobileCollapsedStyle style) {
style.setCollapsedWork(style.isCollapsedWork() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
}
@Override
public void update() {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
@ -207,7 +217,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
}
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) {
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style);
}
}

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

@ -67,25 +67,28 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{label, templateStyleEditor}, {new UILabel()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_LARGE);
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding(designer)) {
JPanel innerAdvancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
if (!shouldHidePadding(designer)) {
marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
if (FormDesignerUtils.isAppRelayout(designer)) {
mobileBookMarkUsePane = new MobileBookMarkUsePane();
innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER);
}
mobileTabCommonSettingPane = new MobileTabCommonSettingPane();
innerAdvancePane.add(mobileTabCommonSettingPane, BorderLayout.SOUTH);
innerAdvancePane.add(marginPane, BorderLayout.NORTH);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane);
mobileTabCommonSettingPane = new MobileTabCommonSettingPane(false);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
//高级
holder.add(advancePane, BorderLayout.CENTER);
innerAdvancePane.add(marginPane, BorderLayout.NORTH);
//布局
holder.add(layoutPane, BorderLayout.SOUTH);
} else {
mobileTabCommonSettingPane = new MobileTabCommonSettingPane(true);
}
innerAdvancePane.add(mobileTabCommonSettingPane, BorderLayout.SOUTH);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane);
//高级
holder.add(advancePane, BorderLayout.CENTER);
this.add(holder, BorderLayout.NORTH);
}

9
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

@ -36,11 +36,11 @@ public class MobileTabCommonSettingPane extends BasicPane {
private NewColorSelectBox initDotColorBox;
private NewColorSelectBox selectDotColorBox;
public MobileTabCommonSettingPane() {
initComponent();
public MobileTabCommonSettingPane(boolean isTopComponent) {
initComponent(isTopComponent);
}
private void initComponent() {
private void initComponent(boolean isTopComponent) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.showTabTitleCheck = new UICheckBox(
@ -126,6 +126,9 @@ public class MobileTabCommonSettingPane extends BasicPane {
);
final JPanel tableConfigJPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
if (isTopComponent) {
tableConfigJPanel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
}
tableConfigJPanel.add(tabBaseConfigPanel, BorderLayout.NORTH);
tableConfigJPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER);
this.add(tableConfigJPanel, BorderLayout.CENTER);

10
designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java

@ -3,6 +3,7 @@
*/
package com.fr.design.actions.cell.style;
import com.fr.stable.os.OperatingSystem;
import java.awt.Dimension;
import javax.swing.ComboBoxModel;
@ -49,6 +50,7 @@ public class ReportFontNameAction extends AbstractStyleAction {
public void setFontName(String fontName) {
Object object = this.getValue(UIComboBox.class.getName());
boolean find = false;
if (object != null && object instanceof UIComboBox) {
UIComboBox comboBox = (UIComboBox) object;
ComboBoxModel comboBoxModel = comboBox.getModel();
@ -60,9 +62,17 @@ public class ReportFontNameAction extends AbstractStyleAction {
comboBox.removeActionListener(this);
comboBox.setSelectedIndex(i);
comboBox.addActionListener(this);
find = true;
break;
}
}
// linux设计器下面 找不到默认就是第一个字体
boolean access = OperatingSystem.isLinux() && !find && comboBoxModel.getSize() > 0;
if (access) {
comboBox.removeActionListener(this);
comboBox.setSelectedIndex(0);
comboBox.addActionListener(this);
}
}
}

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

@ -496,7 +496,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
sheetIcon.paintIcon(this, g2d, (int) textX + charWidth, 2);
g2d.setPaint(getForeground());
g2d.drawString(sheetName, (int) textX + charWidth + 14, textAscent);
// REPORT-40495 之前的g2d.drawString(),在windows下默认宋体时,无法绘制韩文字符,而GraphHelper的drawString中对韩文做了额外处理,可以绘制韩文字符
GraphHelper.drawString(g2d, sheetName, (int) textX + charWidth + 14, textAscent);
}
/**

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -61,7 +61,7 @@ public class StylePane extends UIComboBoxPane<Style> {
@Override
protected List<FurtherBasicBeanPane<? extends Style>> initPaneList() {
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Style>>();
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<>();
paneList.add(customStylePane = new CustomStylePane());
paneList.add(predefinedStylePane = new PredefinedStylePane());
return paneList;

2
designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java

@ -135,7 +135,7 @@ public class ECBlockPane extends PolyElementCasePane {
private void addInsertFloatMenuDef(MenuDef menuDef) {
// 悬浮元素菜单
MenuDef subMenuDef = new MenuDef(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
MenuDef subMenuDef = new MenuDef(KeySetUtils.INSERT_FLOAT.getMenuName());
subMenuDef.setIconPath("/com/fr/design/images/m_insert/float.png");
menuDef.addShortCut(subMenuDef);
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this);

53
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -22,6 +22,7 @@ import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -251,15 +252,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
dataPane.setListener(dataListener);
groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
double[] rowSize = {P}, columnSize = {60, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
condition = new DSColumnConditionAction();
if (tc != null) {
condition.setEditingComponent(tc);
}
//丢掉icon,修改按钮名称为编辑
condition.setSmallIcon(null);
condition.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
conditionUIButton = new UIButton(condition);
Component[][] components = new Component[][]{
new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)}
@ -273,12 +274,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public String getIconPath() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic");
return Toolkit.i18nText("Fine-Design_Report_Basic");
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Basic");
return Toolkit.i18nText("FR-Designer_Basic");
}
@ -441,12 +442,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public String getIconPath() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced");
return Toolkit.i18nText("Fine-Design_Report_Advanced");
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced");
return Toolkit.i18nText("Fine-Design_Report_Advanced");
}
@ -570,19 +571,19 @@ public class CellDSColumnEditor extends CellQuickEditor {
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable")));
extendableDirectionPane.add(heCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable")));
//补充空白数据
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
useMultiNumCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill_Blank_Data"));
useMultiNumCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Fill_Blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1);
//数据倍数
UILabel multipleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Multiple"));
UILabel multipleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Column_Multiple"));
multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{
multipleLabel, multiNumSpinner
@ -659,17 +660,17 @@ public class CellDSColumnEditor extends CellQuickEditor {
IOUtils.readIcon("/com/fr/design/images/expand/asc.png"),
IOUtils.readIcon("/com/fr/design/images/expand/des.png")
};
String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Original"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Ascending"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Descending")};
String[] nameArray = {Toolkit.i18nText("Fine-Design_Report_Sort_Original"), Toolkit.i18nText("Fine-Design_Report_Sort_Ascending"), Toolkit.i18nText("Fine-Design_Report_Sort_Descending")};
sortTypePane = new UIButtonGroup(iconArray);
sortTypePane.setAllToolTips(nameArray);
sortTypePane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ExpandD_Sort_After_Expand"));
sortTypePane.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_ExpandD_Sort_After_Expand"));
cardLayout = new CardLayout();
centerPane = new JPanel(cardLayout);
formulaField = new JFormulaField(DEFAULT_VALUE);
centerPane.add(new JPanel(), "none");
centerPane.add(formulaField, "content");
UILabel sortLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"));
UILabel sortLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"));
sortLabel.setPreferredSize(LABEL_DIMENSION);
sortTypePane.addChangeListener(new ChangeListener() {
@Override
@ -849,15 +850,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
public ResultSetFilterConfigPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel filterLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter"));
UILabel filterLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter"));
//结果集筛选下拉框
rsComboBox = new UIComboBox(new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Undefined"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Top_N"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Bottom_N"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Odd"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Even"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify")
Toolkit.i18nText("Fine-Design_Report_Undefined"),
Toolkit.i18nText("Fine-Design_Report_Bind_Column_Top_N"),
Toolkit.i18nText("Fine-Design_Report_Bind_Column_Bottom_N"),
Toolkit.i18nText("Fine-Design_Report_Odd"),
Toolkit.i18nText("Fine-Design_Report_Even"),
Toolkit.i18nText("Fine-Design_Report_Specify")
});
rsComboBox.addActionListener(actionListener);
//配置展示CardLayout
@ -881,20 +882,20 @@ public class CellDSColumnEditor extends CellQuickEditor {
//奇数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), ODD.name());
MultilineLabel oddTip = new MultilineLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_DS_Filter_Odd_Tip"));
MultilineLabel oddTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Odd_Tip"));
oddTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(oddTip, ODD.name());
//偶数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), EVEN.name());
MultilineLabel evenTip = new MultilineLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_DS_Filter_Even_Tip"));
MultilineLabel evenTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Even_Tip"));
evenTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(evenTip, EVEN.name());
//输入框占用右半边,提示信息占一行
serialTextField = new UITextField(16);
setCardPane.add(serialTextField, SPECIFY.name());
MultilineLabel specifyTip = new MultilineLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_DS_Filter_Specify_Tip"));
MultilineLabel specifyTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Specify_Tip"));
specifyTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(specifyTip, SPECIFY.name());
contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{
@ -1072,7 +1073,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
textFieldPane.add(formulaTextField, BorderLayout.CENTER);
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Formula") + "...");
formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "...");
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height));
formulaButton.addActionListener(formulaButtonActionListener);
@ -1157,7 +1158,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public CustomValuePane() {
this.setLayout(new BorderLayout());
UILabel customValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"));
UILabel customValueLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Display_Value"));
customValueLabel.setPreferredSize(LABEL_DIMENSION);
formulaField = new JFormulaField(DEFAULT_VALUE);
this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{

Loading…
Cancel
Save