Browse Source

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

research/11.0
pengda 5 years ago
parent
commit
ecf7fd0cce
  1. 2
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 292
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 52
      designer-base/src/main/java/com/fr/design/beans/BasicBeanPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/beans/FurtherBasicBeanPane.java
  5. 3
      designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java
  6. 2
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  7. 6
      designer-base/src/main/java/com/fr/design/dialog/BasicDialog.java
  8. 17
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  9. 3
      designer-base/src/main/java/com/fr/design/dialog/DialogActionAdapter.java
  10. 11
      designer-base/src/main/java/com/fr/design/dialog/DialogActionListener.java
  11. 8
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  12. 3
      designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java
  13. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java
  14. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java
  15. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  16. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java
  17. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  18. 4
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  19. 8
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  20. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  21. 3
      designer-base/src/main/java/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
  22. 1
      designer-base/src/main/java/com/fr/design/gui/style/NumberDragBar.java
  23. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java
  24. 10
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java
  25. 17
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java
  26. 23
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java
  27. 457
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  28. 145
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  29. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java
  30. 17
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java
  31. 38
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  32. 5
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java
  33. 7
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java
  34. 9
      designer-base/src/main/java/com/fr/design/icon/BorderIcon.java
  35. 2
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  36. 2
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  37. 5
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  38. 82
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  39. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  40. 23
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  41. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  42. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  43. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java
  44. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java
  45. 4
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  46. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  47. 1
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  48. 1
      designer-base/src/main/java/com/fr/design/update/actions/FileDownloader.java
  49. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  50. 9
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  51. 5
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  52. 5
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  53. 303
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  54. 45
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  55. 139
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  56. 101
      designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java
  57. 91
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java
  58. 66
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java
  59. 28
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  60. 27
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java
  61. 97
      designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java
  62. 112
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  63. 2
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  64. 161
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java
  65. 38
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java
  66. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java
  67. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java
  68. 39
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java
  69. 44
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java
  70. 53
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java
  71. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java
  72. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java
  73. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java
  74. 34
      designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java
  75. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java
  76. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java
  77. 35
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java
  78. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java
  79. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java
  80. 37
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  81. 27
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java
  82. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java
  83. 31
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java
  84. 26
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java
  85. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java
  86. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java
  87. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java
  88. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java
  89. 6
      designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java
  90. 8
      designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java
  91. 8
      designer-chart/src/main/java/com/fr/design/chart/report/MapMoreTableIndexPane.java
  92. 8
      designer-chart/src/main/java/com/fr/design/chart/report/MapTableDataSinglePane.java
  93. 3
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java
  94. 30
      designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java
  95. 25
      designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java
  96. 21
      designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java
  97. 20
      designer-chart/src/main/java/com/fr/design/chartx/WordCloudChartDataPane.java
  98. 3
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java
  99. 86
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java
  100. 91
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureDataSetFieldsPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -5,6 +5,7 @@
package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.common.annotations.Open;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.*;
import com.fr.design.gui.core.WidgetOption;
@ -34,6 +35,7 @@ import java.util.Set;
* @since : 8.0
* 用于设计器扩展的管理类
*/
@Open
public class ExtraDesignClassManager extends AbstractExtraClassManager implements ExtraDesignClassManagerProvider {
private static ExtraDesignClassManager classManager = new ExtraDesignClassManager();

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

@ -1,6 +1,6 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
@ -18,12 +18,14 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
import com.fr.design.gui.ilable.ActionLabel;
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.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
@ -36,22 +38,39 @@ import com.fr.general.IOUtils;
import com.fr.general.Inter;
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.StringUtils;
import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JDialog;
import javax.swing.Timer;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -59,9 +78,15 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
/**
* 选项对话框
@ -148,9 +173,17 @@ public class PreferencePane extends BasicPane {
private UICheckBox saveCommitCheckBox;
private UICheckBox useIntervalCheckBox;
private IntegerEditor saveIntervalEditor;
private UICheckBox gcEnableCheckBox;
private UIButton gcButton;
private UILabel remindVcsLabel;
private JDialog gcDialog;
private UILabel gcMessage = new UILabel();
private JPanel gcDialogDownPane = new JPanel();
private JPanel gcProgressBarPanel = new JPanel();
private JProgressBar gcProgressBar;
private Timer gcProgressTimer;
private UIButton gcOkButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
public PreferencePane() {
this.initComponents();
@ -230,6 +263,10 @@ public class PreferencePane extends BasicPane {
saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(60);
useIntervalCheckBox = new UICheckBox();
//gc面板
JPanel gcControlPane = createGcControlPane();
JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel);
@ -262,6 +299,42 @@ public class PreferencePane extends BasicPane {
vcsPane.add(enableVcsPanel);
vcsPane.add(intervalPanel);
vcsPane.add(saveCommitCheckBox);
vcsPane.add(gcControlPane);
}
/**
* 模创建板版本gc 配置操作面板
*
* @return 面板
*/
private JPanel createGcControlPane() {
//gc面板
JPanel gcControlPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
JPanel gcButtonPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 40, 0));
gcEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_Storage_Optimization"));
gcButton = initGcButton();
gcButtonPane.add(gcButton);
gcControlPane.add(gcEnableCheckBox);
gcControlPane.add(gcButtonPane);
gcButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
tryGc();
}
});
gcEnableCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
gcButton.setEnabled(gcEnableCheckBox.isSelected());
}
});
//集群下禁用
if (FineClusterConfig.getInstance().isCluster()) {
gcEnableCheckBox.setEnabled(false);
gcButton.setEnabled(false);
}
return gcControlPane;
}
private void createFunctionPane(JPanel generalPane) {
@ -629,7 +702,8 @@ public class PreferencePane extends BasicPane {
saveIntervalEditor.setValue(vcsConfigManager.getSaveInterval());
saveCommitCheckBox.setSelected(vcsConfigManager.isSaveCommit());
useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval());
gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable());
gcButton.setEnabled(gcEnableCheckBox.isSelected());
supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef());
isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited());
@ -726,6 +800,18 @@ public class PreferencePane extends BasicPane {
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());
vcsConfigManager.setSaveCommit(this.saveCommitCheckBox.isSelected());
vcsConfigManager.setUseInterval(this.useIntervalCheckBox.isSelected());
Configurations.update(new Worker() {
@Override
public void run() {
GcConfig.getInstance().setGcEnable(gcEnableCheckBox.isSelected());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{GcConfig.class};
}
});
if (this.autoPushUpdateCheckBox != null) {
designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected());
}
@ -762,7 +848,6 @@ public class PreferencePane extends BasicPane {
}
// 如果语言设置改变了,则显示重启对话框
public void showRestartDialog() {
if (!languageChanged) {
@ -797,4 +882,203 @@ public class PreferencePane extends BasicPane {
public BasicDialog showWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, this.getPreferredSize().height + OFFSET_HEIGHT));
}
private void tryGc() {
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
private long size = 0;
@Override
protected Boolean doInBackground() {
size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc();
return true;
}
@Override
protected void done() {
try {
get();
} catch (ExecutionException e) {
updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Need_Update_Remote_Server_Jar"));
return;
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size));
gcDialogDownPane.revalidate();
gcDialogDownPane.repaint();
gcDialogDownPane.add(gcOkButton);
}
};
worker.execute();
initGcDialog();
gcOkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
gcDialog.dispose();
}
});
gcDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
stopGcProgressTimer();
worker.cancel(true);
}
});
gcDialog.setVisible(true);
gcDialog.dispose();
}
/**
* gc 后更新进度条面板信息
*
* @param message
*/
private void updateGcDialogPanelInfo(String message) {
stopGcProgressTimer();
gcMessage.setText(message);
if (null != gcProgressBar) {
gcProgressBarPanel.remove(gcProgressBar);
}
if (null != gcDialog) {
gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"));
}
}
/**
* 初始化 gc 对话框
*/
private void initGcDialog() {
gcDialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(PreferencePane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Clean_Progress") + "...", true);
gcDialog.setSize(new Dimension(340, 140));
JPanel jp = new JPanel();
//中上
JPanel gcUpPane = new JPanel();
gcUpPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
gcUpPane.add(new UILabel(UIManager.getIcon("OptionPane.informationIcon")));
gcProgressBarPanel = createProgressBarPane();
gcUpPane.add(gcProgressBarPanel);
//中下
gcDialogDownPane = new JPanel();
gcDialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(gcUpPane);
jp.add(gcDialogDownPane);
gcDialog.add(jp);
gcDialog.setResizable(false);
gcDialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(PreferencePane.this));
}
/**
* gc 进度条面板
*
* @return
*/
private JPanel createProgressBarPane() {
JPanel jp = new JPanel();
VerticalFlowLayout layout = new VerticalFlowLayout();
layout.setAlignLeft(true);
jp.setLayout(layout);
//提示
gcMessage = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Cleaning"));
// 创建一个进度条
gcProgressBar = createGcProgressBar(0, 30, 240, 15, Color.GREEN);
gcProgressTimer = createGcProgressTimer(500, gcProgressBar);
gcProgressTimer.start();
jp.add(gcMessage);
jp.add(gcProgressBar);
return jp;
}
/**
* 创建 gc 进度条
*
* @param min 最小值
* @param max 最大值
* @param width 宽度
* @param height 高度
* @param color 填充的图片颜色
* @return
*/
private JProgressBar createGcProgressBar(int min, int max, int width, int height, Color color) {
// 创建一个进度条
JProgressBar progressBar = new JProgressBar(min, max);
UIProgressBarUI progressBarUI = new UIProgressBarUI();
progressBar.setUI(progressBarUI);
//颜色(进度条里的小方块)
progressBar.setForeground(color);
progressBar.setOpaque(false);
progressBar.setPreferredSize(new Dimension(width, height));
return progressBar;
}
/**
* @param delay 每隔 delay 毫秒更新进度
* @param progressBar 要更新的进度条
* @return
*/
private Timer createGcProgressTimer(int delay, final JProgressBar progressBar) {
if (null == progressBar) {
return null;
}
// 模拟延时操作进度, 每隔 delay / 1000 秒更新进度
Timer timer = new Timer(delay, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int currentProgress = progressBar.getValue() + 1;
if (currentProgress > progressBar.getMaximum()) {
currentProgress = progressBar.getMinimum();
}
progressBar.setValue(currentProgress);
}
});
return timer;
}
/**
* 停止进度条模拟计时器
*/
private void stopGcProgressTimer() {
if (null == gcProgressTimer) {
return;
}
gcProgressTimer.stop();
}
/**
* 将字节转换成 KB or MB or GB 保留两位小数
*
* @param size
* @return
*/
private String fileSizeConvert(long size) {
DecimalFormat df = new DecimalFormat("0.00");
double n = 1024d;
if (size > Math.pow(n, 3)) {
return df.format(size / Math.pow(n, 3)) + "GB";
}
if (size > Math.pow(n, 2)) {
return df.format(size / Math.pow(n, 2)) + "MB";
}
return new StringBuilder().append(df.format(size / n)).append("KB").toString();
}
/**
* 立即清理的Button
*
* @return
*/
private UIButton initGcButton() {
UIButton gcButton = new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Clean"));
gcButton.setPreferredSize(new Dimension(100, 15));
gcButton.setRoundBorder(true, Constants.LEFT);
return gcButton;
}
}

52
designer-base/src/main/java/com/fr/design/beans/BasicBeanPane.java

@ -1,41 +1,35 @@
package com.fr.design.beans;
import com.fr.common.annotations.Open;
import com.fr.design.dialog.BasicPane;
/**
* Update Pane
*/
@Open
public abstract class BasicBeanPane<T> extends BasicPane {
/**
* 展示数据
* @param ob 待展示的对象
*/
public abstract void populateBean(T ob);
/**
* Populate.
*/
public abstract void populateBean(T ob);
/**
* 保存数据
* @return 待保存的对象
*/
public abstract T updateBean();
/**
* Update.
*/
public abstract T updateBean();
/**
* 保存数据
* @param ob 待保存的对象
*/
public void updateBean(T ob) {
public void updateBean(T ob) {
}
}
/**
* 更新权限工具栏面板
*/
public void populateAuthority() {
}
/**
* 仅用来处理图表设计器的地图面板
* @param mapType 地图类型
*/
public void dealWidthMap(String mapType){
}
/**
* 更新权限工具栏面板
*/
public void populateAuthority() {
}
}

6
designer-base/src/main/java/com/fr/design/beans/FurtherBasicBeanPane.java

@ -1,11 +1,9 @@
package com.fr.design.beans;
import com.fr.common.annotations.Open;
import com.fr.stable.StringUtils;
/**
* @author zhou
* @since 2012-5-30下午12:12:42
*/
@Open
public abstract class FurtherBasicBeanPane<T> extends BasicBeanPane<T> {
/**
* 是否是指定类型

3
designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java

@ -1,10 +1,13 @@
package com.fr.design.condition;
import com.fr.common.annotations.Open;
/**
* @author richie
* @date 2015-03-26
* @since 8.0
*/
@Open
public abstract class ConditionAttrSingleConditionPane<T> extends SingleConditionPane<T> {
protected HighLightConditionAction hightLighAttrUpdateAction = null;
private ConditionAttributesPane conditionAttributesPane;

2
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -1,6 +1,7 @@
package com.fr.design.condition;
import com.fr.common.annotations.Open;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.itoolbar.UIToolbar;
@ -17,6 +18,7 @@ import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator;
@Open
public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
private static final int MIN_HEIGHT = 60;
protected CellHighlightAddMenuDef menuDef;

6
designer-base/src/main/java/com/fr/design/dialog/BasicDialog.java

@ -1,10 +1,10 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
import java.awt.*;
/*
* @author _denny
*/
@Open
public abstract class BasicDialog extends UIDialog {
public static final Dimension SMALL = new Dimension(340, 180);
public static final Dimension MEDIUM = new Dimension(600, 400);

17
designer-base/src/main/java/com/fr/design/dialog/BasicPane.java

@ -1,24 +1,17 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Window;
/*
* _denny: 这里的BasicPane通常会有populate & update方法
* 记得populate 一定要在对应的dialog setVisible之前populate
*/
import java.awt.*;
@Open
public abstract class BasicPane extends JPanel {
/**

3
designer-base/src/main/java/com/fr/design/dialog/DialogActionAdapter.java

@ -1,5 +1,8 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
@Open
public abstract class DialogActionAdapter implements DialogActionListener {
@Override
public void doOk() {}

11
designer-base/src/main/java/com/fr/design/dialog/DialogActionListener.java

@ -1,8 +1,11 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
@Open
public interface DialogActionListener {
public void doOk();
public void doCancel();
void doOk();
void doCancel();
}

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

@ -25,13 +25,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
/**
* Created with IntelliJ IDEA.
* User: 小灰灰
* Date: 13-7-16
* Time: 下午2:17
* To change this template use File | Settings | File Templates.
*/
public abstract class UIDialog extends JDialog {
public static final String OK_BUTTON = "basic_ok";
public static final String CANCEL_BUTTON = "basic_cancel";

3
designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java

@ -1,7 +1,6 @@
package com.fr.design.gui.chart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.stable.core.PropertyChangeListener;
import javax.swing.JComponent;
@ -18,7 +17,5 @@ public abstract class MiddleChartComponent extends JComponent {
public abstract void reset();
public abstract ChartProvider getEditingChart();
public abstract void addStopEditingListener(PropertyChangeListener list);
}

6
designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java

@ -296,7 +296,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX};
double[] y = {-1, getHeight(), getHeight(), -1, -1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7);
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND));
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length);
generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]);
@ -345,9 +345,9 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) {
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND));
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
} else {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
}

6
designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java

@ -321,9 +321,9 @@ public class UIBasicButtonUI extends MetalButtonUI {
//harry: 画带有高光的按钮。
private void drawHighLightButton(Graphics2D g2, Color color1, Color color2, int w, int h) {
GradientPaint buttonPaint = new GradientPaint(0, 0, color1, 0, h - 1, color2);
GradientPaint buttonHighLightPaint = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.6f), 0, h / 2, new Color(1.0f, 1.0f, 1.0f, 0.2f));
GradientPaint buttonHighLightLinePaint = new GradientPaint(1, 1, new Color(1.0f, 1.0f, 1.0f, 0.8f), 0, h / 2, new Color(1.0f, 1.0f, 1.0f, 0.4f));
GradientPaint buttonPaint = new GradientPaint(0, 0, color1, 0, h - 1f, color2);
GradientPaint buttonHighLightPaint = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.6f), 0, h / 2f, new Color(1.0f, 1.0f, 1.0f, 0.2f));
GradientPaint buttonHighLightLinePaint = new GradientPaint(1, 1, new Color(1.0f, 1.0f, 1.0f, 0.8f), 0, h / 2f, new Color(1.0f, 1.0f, 1.0f, 0.4f));
g2.setPaint(buttonPaint);
g2.fillRoundRect(0, 0, w - 1, h - 1, 3, 3);
g2.setPaint(buttonHighLightLinePaint);//按钮内侧高光线(内发光,0%阻塞)

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java

@ -251,7 +251,7 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(borderStroke);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1f, getHeight() - 1f, UIConstants.ARC, UIConstants.ARC);
g2d.setColor(borderColor);
g2d.draw(shape);
}

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java

@ -232,7 +232,7 @@ public class UISliderButton extends JButton implements UIObserver {
protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(borderStroke);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1f, getHeight() - 1f, UIConstants.ARC, UIConstants.ARC);
g2d.setColor(borderColor);
g2d.draw(shape);
}

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java

@ -176,7 +176,7 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp;
if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE);
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE);
} else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB);
}else{

4
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java

@ -1326,9 +1326,9 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
newModel.addChangeListener(modelListener);
scrollbar.repaint();
scrollbar.revalidate();
} else if ("orientation" == propertyName) {
} else if (StringUtils.equals("orientation", propertyName)) {
updateButtonDirections();
} else if ("componentOrientation" == propertyName) {
} else if (StringUtils.equals("componentOrientation", propertyName)) {
updateButtonDirections();
InputMap inputMap = getInputMap(JComponent.WHEN_FOCUSED);
SwingUtilities.replaceUIInputMap(scrollbar, JComponent.WHEN_FOCUSED, inputMap);

8
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -9,9 +9,11 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.utils.MathUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -109,7 +111,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
}
value = value < minValue ? minValue : value;
value = value > maxValue ? maxValue : value;
if (value == this.value) {
if (CommonUtils.equals(value, this.value)) {
return;
}
this.value = value;
@ -132,7 +134,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
value = value < minValue ? minValue : value;
value = value > maxValue ? maxValue : value;
if (value == this.value) {
if (CommonUtils.equals(value, this.value)) {
return;
}
this.value = value;
@ -371,4 +373,4 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
// jf.setSize(400, 400);
// jf.setVisible(true);
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -244,7 +244,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
FineLoggerFactory.getLogger().error(ee.getMessage(), ee);
}
}
if (getRowCount() < 1 || selectedRow.length < 0) {
if (getRowCount() < 1) {
return;
}

3
designer-base/src/main/java/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java

@ -153,6 +153,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
try {
Thread.sleep(3);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
if (currentPanel != panel) {
@ -202,7 +203,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
}
@Override
public int getSelectedIndex() {
public synchronized int getSelectedIndex() {
return selectedIndex;
}

1
designer-base/src/main/java/com/fr/design/gui/style/NumberDragBar.java

@ -127,6 +127,7 @@ public class NumberDragBar extends JComponent {
revalidate();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.toString());
Thread.currentThread().interrupt();
}
}
});

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java

@ -366,7 +366,9 @@ public class RSyntaxDocument extends RDocument implements Iterable<Token>,
*/
public boolean getShouldIndentNextLine(int line) {
Token t = getTokenListForLine(line);
t = t.getLastNonCommentNonWhitespaceToken();
if (t != null) {
t = t.getLastNonCommentNonWhitespaceToken();
}
return tokenMaker.getShouldIndentNextLineAfter(t);
}

10
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java

@ -3016,11 +3016,6 @@ private boolean fractionalFontMetricsEnabled;
return he;
}
private final boolean equal(LinkGeneratorResult e1,
LinkGeneratorResult e2) {
return e1.getSourceOffset()==e2.getSourceOffset();
}
@Override
public void mouseClicked(MouseEvent e) {
if (getHyperlinksEnabled() && isScanningForLinks &&
@ -3080,8 +3075,7 @@ private boolean fractionalFontMetricsEnabled;
isLinkAtOffset(RSyntaxTextArea.this, offs);
if (newResult!=null) {
// Repaint if we're at a new link now.
if (linkGeneratorResult==null ||
!equal(newResult, linkGeneratorResult)) {
if (linkGeneratorResult==null || newResult.getSourceOffset() != linkGeneratorResult.getSourceOffset()) {
repaint();
}
linkGeneratorResult = newResult;
@ -3120,4 +3114,4 @@ private boolean fractionalFontMetricsEnabled;
}
}
}

17
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Style.java

@ -9,6 +9,7 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import com.fr.log.FineLoggerFactory;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
@ -123,15 +124,15 @@ public class Style implements Cloneable {
Style clone = null;
try {
clone = (Style)super.clone();
clone.foreground = foreground;
clone.background = background;
clone.font = font;
clone.underline = underline;
clone.fontMetrics = fontMetrics;
} catch (CloneNotSupportedException cnse) { // Never happens
cnse.printStackTrace();
return null;
FineLoggerFactory.getLogger().error(cnse.getMessage(), cnse);
clone = null;
}
clone.foreground = foreground;
clone.background = background;
clone.font = font;
clone.underline = underline;
clone.fontMetrics = fontMetrics;
return clone;
}
@ -193,4 +194,4 @@ public class Style implements Cloneable {
}
}
}

23
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java

@ -9,6 +9,7 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import com.fr.log.FineLoggerFactory;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
@ -121,17 +122,17 @@ public class SyntaxScheme implements Cloneable, TokenTypes {
public Object clone() {
SyntaxScheme shcs = null;
try {
shcs = (SyntaxScheme)super.clone();
} catch (CloneNotSupportedException cnse) { // Never happens
cnse.printStackTrace();
return null;
}
shcs.styles = new Style[styles.length];
for (int i=0; i<styles.length; i++) {
Style s = styles[i];
if (s!=null) {
shcs.styles[i] = (Style)s.clone();
shcs = (SyntaxScheme) super.clone();
shcs.styles = new Style[styles.length];
for (int i = 0; i < styles.length; i++) {
Style s = styles[i];
if (s != null) {
shcs.styles[i] = (Style) s.clone();
}
}
} catch (CloneNotSupportedException cnse) { // Never happens
FineLoggerFactory.getLogger().error(cnse.getMessage(), cnse);
shcs = null;
}
return shcs;
}
@ -712,4 +713,4 @@ public class SyntaxScheme implements Cloneable, TokenTypes {
}
}
}

457
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java

@ -3,30 +3,43 @@
*
* SyntaxView.java - The View object used by RSyntaxTextArea when word wrap is
* disabled.
*
*
* This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details.
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.event.*;
import javax.swing.text.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
* The <code>javax.swing.text.View</code> object used by {@link RSyntaxTextArea}
* when word wrap is disabled. It implements syntax highlighting for
* programming languages using the colors and font styles specified by the
* <code>RSyntaxTextArea</code>.<p>
*
* <p>
* You don't really have to do anything to use this class, as
* {@link RSyntaxTextAreaUI} automatically sets the text area's view to be
* an instance of this class if word wrap is disabled.<p>
*
* <p>
* The tokens that specify how to paint the syntax-highlighted text are gleaned
* from the text area's {@link RSyntaxDocument}.
*
@ -34,7 +47,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
* @version 0.3
*/
public class SyntaxView extends View implements TabExpander,
TokenOrientedView, RSTAView {
TokenOrientedView, RSTAView {
/**
* The default font used by the text area. If this changes we need to
@ -70,7 +83,7 @@ public class SyntaxView extends View implements TabExpander,
private int ascent;
private int clipStart;
private int clipEnd;
/**
* Temporary token used when we need to "modify" tokens for rendering
* purposes. Since tokens returned from RSyntaxDocuments are treated as
@ -95,7 +108,7 @@ public class SyntaxView extends View implements TabExpander,
* of the element this view represents, looking for the line
* that is the longest. The <em>longLine</em> variable is updated to
* represent the longest line contained. The <em>font</em> variable
* is updated to indicate the font used to calculate the
* is updated to indicate the font used to calculate the
* longest line.
*/
void calculateLongestLine() {
@ -105,7 +118,7 @@ public class SyntaxView extends View implements TabExpander,
tabSize = getTabSize() * metrics.charWidth(' ');
Element lines = getElement();
int n = lines.getElementCount();
for (int i=0; i<n; i++) {
for (int i = 0; i < n; i++) {
Element line = lines.getElement(i);
float w = getLineWidth(i);
if (w > longLineWidth) {
@ -121,8 +134,8 @@ public class SyntaxView extends View implements TabExpander,
* in a location that this view is responsible for.
*
* @param changes the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @see View#changedUpdate
*/
@Override
@ -135,22 +148,21 @@ public class SyntaxView extends View implements TabExpander,
* Repaint the given line range.
*
* @param line0 The starting line number to repaint. This must
* be a valid line number in the model.
* be a valid line number in the model.
* @param line1 The ending line number to repaint. This must
* be a valid line number in the model.
* @param a The region allocated for the view to render into.
* @param host The component hosting the view (used to call repaint).
* be a valid line number in the model.
* @param a The region allocated for the view to render into.
* @param host The component hosting the view (used to call repaint).
*/
protected void damageLineRange(int line0, int line1, Shape a,
Component host) {
Component host) {
if (a != null) {
Rectangle area0 = lineToRect(a, line0);
Rectangle area1 = lineToRect(a, line1);
if ((area0 != null) && (area1 != null)) {
Rectangle dmg = area0.union(area1); // damage.
host.repaint(dmg.x, dmg.y, dmg.width, dmg.height);
}
else
} else
host.repaint();
}
}
@ -163,19 +175,19 @@ public class SyntaxView extends View implements TabExpander,
* off.
*
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @return The x-coordinate representing the end of the painted text.
*/
private float drawLine(TokenPainter painter, Token token, Graphics2D g,
float x, float y) {
float x, float y) {
float nextX = x; // The x-value at the end of our text.
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
while (token != null && token.isPaintable() && nextX < clipEnd) {
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
token = token.getNextToken();
}
@ -198,29 +210,29 @@ public class SyntaxView extends View implements TabExpander,
* language. Tokens are checked for being in a selected region, and are
* rendered appropriately if they are.
*
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param selStart The start of the selection.
* @param selEnd The end of the selection.
* @param selEnd The end of the selection.
* @return The x-coordinate representing the end of the painted text.
*/
private float drawLineWithSelection(TokenPainter painter, Token token,
Graphics2D g, float x, float y, int selStart, int selEnd) {
Graphics2D g, float x, float y, int selStart, int selEnd) {
float nextX = x; // The x-value at the end of our text.
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
while (token != null && token.isPaintable() && nextX < clipEnd) {
// Selection starts in this token
if (token.containsPosition(selStart)) {
if (selStart>token.getOffset()) {
if (selStart > token.getOffset()) {
tempToken.copyFrom(token);
tempToken.textCount = selStart - tempToken.getOffset();
nextX = painter.paint(tempToken,g,nextX,y,host, this, clipStart);
nextX = painter.paint(tempToken, g, nextX, y, host, this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selStart);
// Clone required since token and tempToken must be
@ -229,21 +241,20 @@ public class SyntaxView extends View implements TabExpander,
}
int tokenLen = token.length();
int selCount = Math.min(tokenLen, selEnd-token.getOffset());
if (selCount==tokenLen) {
nextX = painter.paintSelected(token, g, nextX,y, host,
this, clipStart);
}
else {
int selCount = Math.min(tokenLen, selEnd - token.getOffset());
if (selCount == tokenLen) {
nextX = painter.paintSelected(token, g, nextX, y, host,
this, clipStart);
} else {
tempToken.copyFrom(token);
tempToken.textCount = selCount;
nextX = painter.paintSelected(tempToken, g, nextX,y, host,
nextX = painter.paintSelected(tempToken, g, nextX, y, host,
this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(token.getOffset() + selCount);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this,
clipStart);
nextX = painter.paint(token, g, nextX, y, host, this,
clipStart);
}
}
@ -252,24 +263,24 @@ public class SyntaxView extends View implements TabExpander,
else if (token.containsPosition(selEnd)) {
tempToken.copyFrom(token);
tempToken.textCount = selEnd - tempToken.getOffset();
nextX = painter.paintSelected(tempToken, g, nextX,y, host, this,
nextX = painter.paintSelected(tempToken, g, nextX, y, host, this,
clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selEnd);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
// This token is entirely selected
else if (token.getOffset()>=selStart &&
token.getEndOffset()<=selEnd) {
nextX = painter.paintSelected(token, g, nextX,y, host, this,
else if (token.getOffset() >= selStart &&
token.getEndOffset() <= selEnd) {
nextX = painter.paintSelected(token, g, nextX, y, host, this,
clipStart);
}
// This token is entirely unselected
else {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
token = token.getNextToken();
@ -293,42 +304,42 @@ public class SyntaxView extends View implements TabExpander,
/**
* Calculates the width of the line represented by the given element.
*
* @param line The line for which to get the length.
* @param line The line for which to get the length.
* @param lineNumber The line number of the specified line in the document.
* @return The width of the line.
*/
private float getLineWidth(int lineNumber) {
Token tokenList = ((RSyntaxDocument)getDocument()).
getTokenListForLine(lineNumber);
Token tokenList = ((RSyntaxDocument) getDocument()).
getTokenListForLine(lineNumber);
return RSyntaxUtilities.getTokenListWidth(tokenList,
(RSyntaxTextArea)getContainer(),
this);
(RSyntaxTextArea) getContainer(),
this);
}
/**
* Provides a way to determine the next visually represented model
* Provides a way to determine the next visually represented model
* location that one might place a caret. Some views may not be visible,
* they might not be in the same order found in the model, or they just
* might not allow access to some of the locations in the model.
*
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard.
* This may be SwingConstants.WEST, SwingConstants.EAST,
* SwingConstants.NORTH, or SwingConstants.SOUTH.
* be thought of as the arrow keys typically found on a keyboard.
* This may be SwingConstants.WEST, SwingConstants.EAST,
* SwingConstants.NORTH, or SwingConstants.SOUTH.
* @return the location within the model that best represents the next
* location visual position.
* @exception BadLocationException
* @exception IllegalArgumentException for an invalid direction
* location visual position.
* @throws BadLocationException
* @throws IllegalArgumentException for an invalid direction
*/
@Override
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
throws BadLocationException {
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
throws BadLocationException {
return RSyntaxUtilities.getNextVisualPositionFrom(pos, b, a,
direction, biasRet, this);
direction, biasRet, this);
}
@ -337,11 +348,11 @@ public class SyntaxView extends View implements TabExpander,
* axis.
*
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into >= 0.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @exception IllegalArgumentException for an invalid axis
* @return the span the view would like to be rendered into >= 0.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @throws IllegalArgumentException for an invalid axis
*/
@Override
public float getPreferredSpan(int axis) {
@ -357,13 +368,13 @@ public class SyntaxView extends View implements TabExpander,
// We update lineHeight here as when this method is first
// called, lineHeight isn't initialized. If we don't do it
// here, we get no vertical scrollbar (as lineHeight==0).
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
// return getElement().getElementCount() * lineHeight;
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
@ -378,7 +389,7 @@ return visibleLineCount * lineHeight;
*/
private final int getRhsCorrection() {
int rhsCorrection = 10;
if (host!=null) {
if (host != null) {
rhsCorrection = host.getRightHandSideCorrection();
}
return rhsCorrection;
@ -391,8 +402,8 @@ return visibleLineCount * lineHeight;
* @return The tab size.
*/
private int getTabSize() {
Integer i = (Integer)getDocument().getProperty(
PlainDocument.tabSizeAttribute);
Integer i = (Integer) getDocument().getProperty(
PlainDocument.tabSizeAttribute);
int size = (i != null) ? i.intValue() : 5;
return size;
}
@ -407,26 +418,25 @@ return visibleLineCount * lineHeight;
*
* @param offset The offset in question.
* @return A token list for the physical (and in this view, logical) line
* before this one. If <code>offset</code> is in the first line in
* the document, <code>null</code> is returned.
* before this one. If <code>offset</code> is in the first line in
* the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineAbove(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm==null) {
line--;
if (line>=0) {
return document.getTokenListForLine(line);
}
}
else {
line = fm.getVisibleLineAbove(line);
if (line>=0) {
return document.getTokenListForLine(line);
}
}
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm == null) {
line--;
if (line >= 0) {
return document.getTokenListForLine(line);
}
} else {
line = fm.getVisibleLineAbove(line);
if (line >= 0) {
return document.getTokenListForLine(line);
}
}
// int line = map.getElementIndex(offset) - 1;
// if (line>=0)
// return document.getTokenListForLine(line);
@ -443,26 +453,25 @@ else {
*
* @param offset The offset in question.
* @return A token list for the physical (and in this view, logical) line
* after this one. If <code>offset</code> is in the last physical
* line in the document, <code>null</code> is returned.
* after this one. If <code>offset</code> is in the last physical
* line in the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineBelow(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int lineCount = map.getElementCount();
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line<lineCount-1) {
return document.getTokenListForLine(line+1);
}
}
else {
FoldManager fm = host.getFoldManager();
line = fm.getVisibleLineBelow(line);
if (line>=0 && line<lineCount) {
return document.getTokenListForLine(line);
}
}
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line < lineCount - 1) {
return document.getTokenListForLine(line + 1);
}
} else {
FoldManager fm = host.getFoldManager();
line = fm.getVisibleLineBelow(line);
if (line >= 0 && line < lineCount) {
return document.getTokenListForLine(line);
}
}
// int line = map.getElementIndex(offset);
// int lineCount = map.getElementCount();
// if (line<lineCount-1)
@ -476,8 +485,8 @@ else {
* in a location that this view is responsible for.
*
* @param changes The change information from the associated document.
* @param a The current allocation of the view.
* @param f The factory to use to rebuild if the view has children.
* @param a The current allocation of the view.
* @param f The factory to use to rebuild if the view has children.
*/
@Override
public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
@ -488,9 +497,9 @@ else {
/**
* Determine the rectangle that represents the given line.
*
* @param a The region allocated for the view to render into
* @param a The region allocated for the view to render into
* @param line The line number to find the region of. This must
* be a valid line number in the model.
* be a valid line number in the model.
*/
protected Rectangle lineToRect(Shape a, int line) {
Rectangle r = null;
@ -500,14 +509,14 @@ else {
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
if (host.isCodeFoldingEnabled()) {
FoldManager fm = host.getFoldManager();
int hiddenCount = fm.getHiddenLineCountAbove(line);
line -= hiddenCount;
}
r = new Rectangle(alloc.x, alloc.y + line*lineHeight,
alloc.width, lineHeight);
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null && host.isCodeFoldingEnabled()) {
FoldManager fm = host.getFoldManager();
int hiddenCount = fm.getHiddenLineCountAbove(line);
line -= hiddenCount;
}
r = new Rectangle(alloc.x, alloc.y + line * lineHeight,
alloc.width, lineHeight);
}
return r;
}
@ -518,19 +527,19 @@ if (host.isCodeFoldingEnabled()) {
* to the coordinate space of the view mapped to it.
*
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param a the allocated region to render into
* @return the bounding box of the given position
* @exception BadLocationException if the given position does not
* represent a valid location in the associated document
* @throws BadLocationException if the given position does not
* represent a valid location in the associated document
* @see View#modelToView
*/
@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException {
throws BadLocationException {
// line coordinates
Element map = getElement();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int lineIndex = map.getElementIndex(pos);
Token tokenList = doc.getTokenListForLine(lineIndex);
Rectangle lineArea = lineToRect(a, lineIndex);
@ -542,8 +551,8 @@ if (host.isCodeFoldingEnabled()) {
// We use this method instead as it returns the actual bounding box,
// not just the x-coordinate.
lineArea = tokenList.listOffsetToView(
(RSyntaxTextArea)getContainer(), this, pos,
tabBase, lineArea);
(RSyntaxTextArea) getContainer(), this, pos,
tabBase, lineArea);
return lineArea;
@ -554,7 +563,7 @@ if (host.isCodeFoldingEnabled()) {
* Provides a mapping, for a given region, from the document model
* coordinate space to the view coordinate space. The specified region is
* created as a union of the first and last character positions.<p>
*
* <p>
* This is implemented to subtract the width of the second character, as
* this view's <code>modelToView</code> actually returns the width of the
* character instead of "1" or "0" like the View implementations in
@ -565,34 +574,34 @@ if (host.isCodeFoldingEnabled()) {
*
* @param p0 the position of the first character (>=0)
* @param b0 The bias of the first character position, toward the previous
* character or the next character represented by the offset, in
* case the position is a boundary of two views; <code>b0</code>
* will have one of these values:
* <ul>
* <li> <code>Position.Bias.Forward</code>
* <li> <code>Position.Bias.Backward</code>
* </ul>
* character or the next character represented by the offset, in
* case the position is a boundary of two views; <code>b0</code>
* will have one of these values:
* <ul>
* <li> <code>Position.Bias.Forward</code>
* <li> <code>Position.Bias.Backward</code>
* </ul>
* @param p1 the position of the last character (>=0)
* @param b1 the bias for the second character position, defined
* one of the legal values shown above
* @param a the area of the view, which encompasses the requested region
* one of the legal values shown above
* @param a the area of the view, which encompasses the requested region
* @return the bounding box which is a union of the region specified
* by the first and last character positions
* @exception BadLocationException if the given position does
* not represent a valid location in the associated document
* @exception IllegalArgumentException if <code>b0</code> or
* <code>b1</code> are not one of the
* legal <code>Position.Bias</code> values listed above
* by the first and last character positions
* @throws BadLocationException if the given position does
* not represent a valid location in the associated document
* @throws IllegalArgumentException if <code>b0</code> or
* <code>b1</code> are not one of the
* legal <code>Position.Bias</code> values listed above
* @see View#viewToModel
*/
@Override
public Shape modelToView(int p0, Position.Bias b0,
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
Shape s0 = modelToView(p0, a, b0);
Shape s1;
if (p1 ==getEndOffset()) {
if (p1 == getEndOffset()) {
try {
s1 = modelToView(p1, a, b1);
} catch (BadLocationException ble) {
@ -600,21 +609,20 @@ if (host.isCodeFoldingEnabled()) {
}
if (s1 == null) {
// Assume extends left to right.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
s1 = new Rectangle(alloc.x + alloc.width - 1, alloc.y,
1, alloc.height);
1, alloc.height);
}
}
else {
} else {
s1 = modelToView(p1, a, b1);
}
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle)s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle)s1 : s1.getBounds();
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle) s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle) s1 : s1.getBounds();
if (r0.y != r1.y) {
// If it spans lines, force it to be the width of the view.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
r0.x = alloc.x;
r0.width = alloc.width;
}
@ -627,7 +635,7 @@ if (host.isCodeFoldingEnabled()) {
// this, one character too many is highlighted thanks to our
// modelToView() implementation returning the actual width of the
// character requested!
if (p1>p0) r0.width -= r1.width;
if (p1 > p0) r0.width -= r1.width;
return r0;
@ -639,15 +647,15 @@ if (host.isCodeFoldingEnabled()) {
* This implementation does not support things like centering so it
* ignores the tabOffset argument.
*
* @param x the current position >= 0
* @param x the current position >= 0
* @param tabOffset the position within the text stream
* that the tab occurred at >= 0.
* that the tab occurred at >= 0.
* @return the tab stop, measured in points >= 0
*/
public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0)
return x;
int ntabs = (((int)x) - tabBase) / tabSize;
int ntabs = (((int) x) - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize);
}
@ -662,12 +670,12 @@ if (host.isCodeFoldingEnabled()) {
@Override
public void paint(Graphics g, Shape a) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Rectangle alloc = a.getBounds();
tabBase = alloc.x;
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Rectangle clip = g.getClipBounds();
// An attempt to speed things up for files with long lines. Note that
@ -695,52 +703,51 @@ if (host.isCodeFoldingEnabled()) {
boolean useSelectedTextColor = host.getUseSelectedTextColor();
RSyntaxTextAreaHighlighter h =
(RSyntaxTextAreaHighlighter)host.getHighlighter();
(RSyntaxTextAreaHighlighter) host.getHighlighter();
Graphics2D g2d = (Graphics2D)g;
Graphics2D g2d = (Graphics2D) g;
Token token;
//System.err.println("Painting lines: " + linesAbove + " to " + (endLine-1));
TokenPainter painter = host.getTokenPainter();
int line = linesAbove;
//int count = 0;
while (y<clip.y+clip.height+ascent && line<lineCount) {
while (y < clip.y + clip.height + ascent && line < lineCount) {
Fold fold = fm.getFoldForLine(line);
Element lineElement = map.getElement(line);
int startOffset = lineElement.getStartOffset();
//int endOffset = (line==lineCount ? lineElement.getEndOffset()-1 :
// lineElement.getEndOffset()-1);
int endOffset = lineElement.getEndOffset()-1; // Why always "-1"?
int endOffset = lineElement.getEndOffset() - 1; // Why always "-1"?
h.paintLayeredHighlights(g2d, startOffset, endOffset,
a, host, this);
a, host, this);
// Paint a line of text.
token = document.getTokenListForLine(line);
if (!useSelectedTextColor || selStart==selEnd ||
(startOffset>=selEnd || endOffset<selStart)) {
drawLine(painter, token, g2d, x,y);
}
else {
if (!useSelectedTextColor || selStart == selEnd ||
(startOffset >= selEnd || endOffset < selStart)) {
drawLine(painter, token, g2d, x, y);
} else {
//System.out.println("Drawing line with selection: " + line);
drawLineWithSelection(painter,token,g2d, x,y, selStart, selEnd);
drawLineWithSelection(painter, token, g2d, x, y, selStart, selEnd);
}
if (fold!=null && fold.isCollapsed()) {
if (fold != null && fold.isCollapsed()) {
// Visible indicator of collapsed lines
Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
if (c!=null) {
if (c != null) {
g.setColor(c);
g.drawLine(x,y+lineHeight-ascent-1,
alloc.width,y+lineHeight-ascent-1);
g.drawLine(x, y + lineHeight - ascent - 1,
alloc.width, y + lineHeight - ascent - 1);
}
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
do {
int hiddenLineCount = fold.getLineCount();
if (hiddenLineCount==0) {
if (hiddenLineCount == 0) {
// Fold parser identified a zero-line fold region.
// This is really a bug, but we'll be graceful here
// and avoid an infinite loop.
@ -748,7 +755,7 @@ if (host.isCodeFoldingEnabled()) {
}
line += hiddenLineCount;
fold = fm.getFoldForLine(line);
} while (fold!=null && fold.isCollapsed());
} while (fold != null && fold.isCollapsed());
}
@ -767,7 +774,7 @@ if (host.isCodeFoldingEnabled()) {
* If the passed-in line is longer than the current longest line, then
* the longest line is updated.
*
* @param line The line to test against the current longest.
* @param line The line to test against the current longest.
* @param lineNumber The line number of the passed-in line.
* @return <code>true</code> iff the current longest line was updated.
*/
@ -787,8 +794,8 @@ if (host.isCodeFoldingEnabled()) {
* in a location that this view is responsible for.
*
* @param changes the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
*/
@Override
public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
@ -806,9 +813,9 @@ if (host.isCodeFoldingEnabled()) {
/**
* Repaint the region of change covered by the given document
* event. Damages the line that begins the range to cover
* the case when the insert/remove is only on one line.
* If lines are added or removed, damages the whole
* view. The longest line is checked to see if it has
* the case when the insert/remove is only on one line.
* If lines are added or removed, damages the whole
* view. The longest line is checked to see if it has
* changed.
*/
protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f) {
@ -818,13 +825,13 @@ if (host.isCodeFoldingEnabled()) {
DocumentEvent.ElementChange ec = changes.getChange(elem);
Element[] added = (ec != null) ? ec.getChildrenAdded() : null;
Element[] removed = (ec != null) ? ec.getChildrenRemoved() : null;
if (((added != null) && (added.length > 0)) ||
((removed != null) && (removed.length > 0))) {
if (((added != null) && (added.length > 0)) ||
((removed != null) && (removed.length > 0))) {
// lines were added or removed...
if (added != null) {
int addedAt = ec.getIndex(); // FIXME: Is this correct?????
for (int i = 0; i < added.length; i++)
possiblyUpdateLongLine(added[i], addedAt+i);
possiblyUpdateLongLine(added[i], addedAt + i);
}
if (removed != null) {
for (int i = 0; i < removed.length; i++) {
@ -841,14 +848,12 @@ if (host.isCodeFoldingEnabled()) {
// This occurs when syntax highlighting only changes on lines
// (i.e. beginning a multiline comment).
else if (changes.getType()==DocumentEvent.EventType.CHANGE) {
else if (changes.getType() == DocumentEvent.EventType.CHANGE) {
//System.err.println("Updating the damage due to a CHANGE event...");
int startLine = changes.getOffset();
int endLine = changes.getLength();
damageLineRange(startLine,endLine, a, host);
}
else {
damageLineRange(startLine, endLine, a, host);
} else {
Element map = getElement();
int line = map.getElementIndex(changes.getOffset());
damageLineRange(line, line, a, host);
@ -861,20 +866,18 @@ if (host.isCodeFoldingEnabled()) {
// because it has gotten longer.
longLineWidth = getLineWidth(line);
preferenceChanged(null, true, false);
}
else {
} else {
// If long line gets updated, update the status bars too.
if (possiblyUpdateLongLine(e, line))
preferenceChanged(null, true, false);
}
}
else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
} else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
if (map.getElement(line) == longLine) {
// removed from longest line... recalc
longLineWidth = -1; // Must do this!
calculateLongestLine();
preferenceChanged(null, true, false);
}
}
}
}
}
@ -884,7 +887,7 @@ if (host.isCodeFoldingEnabled()) {
* Checks to see if the font metrics and longest line are up-to-date.
*/
private void updateMetrics() {
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Font f = host.getFont();
if (font != f) {
// The font changed, we need to recalculate the longest line!
@ -900,9 +903,9 @@ if (host.isCodeFoldingEnabled()) {
*
* @param fx the X coordinate >= 0
* @param fy the Y coordinate >= 0
* @param a the allocated region to render into
* @param a the allocated region to render into
* @return the location within the model that best represents the
* given point in the view >= 0
* given point in the view >= 0
*/
@Override
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) {
@ -910,7 +913,7 @@ if (host.isCodeFoldingEnabled()) {
bias[0] = Position.Bias.Forward;
Rectangle alloc = a.getBounds();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int x = (int) fx;
int y = (int) fy;
@ -936,9 +939,9 @@ if (host.isCodeFoldingEnabled()) {
Element map = doc.getDefaultRootElement();
int lineIndex = Math.abs((y - alloc.y) / lineHeight);//metrics.getHeight() );
FoldManager fm = host.getFoldManager();
FoldManager fm = host.getFoldManager();
//System.out.print("--- " + lineIndex);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
//System.out.println(" => " + lineIndex);
if (lineIndex >= map.getElementCount()) {
return host.getLastVisibleOffset();
@ -950,7 +953,7 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
if (x < alloc.x)
return line.getStartOffset();
// If the point is to the right of the line...
// If the point is to the right of the line...
else if (x > alloc.x + alloc.width)
return line.getEndOffset() - 1;
@ -960,14 +963,14 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
Token tokenList = doc.getTokenListForLine(lineIndex);
tabBase = alloc.x;
int offs = tokenList.getListOffset(
(RSyntaxTextArea)getContainer(),
this, tabBase, x);
return offs!=-1 ? offs : p0;
(RSyntaxTextArea) getContainer(),
this, tabBase, x);
return offs != -1 ? offs : p0;
}
} // End of else.
}
}
/**
@ -981,11 +984,13 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
FoldManager fm = host.getFoldManager();
if (!fm.isLineHidden(line)) {
line -= fm.getHiddenLineCountAbove(line);
return alloc.y + line*lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null) {
FoldManager fm = host.getFoldManager();
if (!fm.isLineHidden(line)) {
line -= fm.getHiddenLineCountAbove(line);
return alloc.y + line * lineHeight;
}
}
}
@ -998,7 +1003,7 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
* {@inheritDoc}
*/
public int yForLineContaining(Rectangle alloc, int offs)
throws BadLocationException {
throws BadLocationException {
Element map = getElement();
int line = map.getElementIndex(offs);
return yForLine(alloc, line);

145
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java

@ -3,21 +3,39 @@
*
* WrappedSyntaxView.java - Test implementation of WrappedSyntaxView that
* is also aware of RSyntaxTextArea's different fonts per token type.
*
*
* This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details.
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.text.*;
import javax.swing.text.Position.Bias;
import javax.swing.event.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenUtils.TokenSubList;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
import com.fr.stable.CommonUtils;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.BoxView;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.LayeredHighlighter;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.Position.Bias;
import javax.swing.text.Segment;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
@ -27,17 +45,17 @@ import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
* @version 0.2
*/
public class WrappedSyntaxView extends BoxView implements TabExpander,
RSTAView {
RSTAView {
boolean widthChanging;
int tabBase;
int tabSize;
/**
* This is reused to keep from allocating/deallocating.
*/
private Segment s, drawSeg;
/**
* Another variable initialized once to keep from allocating/deallocating.
*/
@ -93,7 +111,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
int p = p0;
RSyntaxTextArea textArea = (RSyntaxTextArea)getContainer();
float currentWidth = getWidth();
if (currentWidth==Integer.MAX_VALUE)
if (CommonUtils.equals(currentWidth, Integer.MAX_VALUE))
currentWidth = getPreferredSpan(X_AXIS);
// Make sure width>0; this is a huge hack to fix a bug where
// loading text into an RTextArea before it is visible if word wrap
@ -128,7 +146,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
//System.err.println("------ ending calculateBreakPosition() --------");
// return p;
return p + 1;
return p + 1;
}
//private int getBreakLocation(Token t, FontMetrics fm, int x0, int x,
@ -229,7 +247,7 @@ return p + 1;
x = painter.paint(token, g, x,y, host, this);
token = token.getNextToken();
}
if (token!=null && token.isPaintable() && token.getOffset()<p) {
int tokenOffset = token.getOffset();
tempToken.set(drawSeg.array, tokenOffset-start, p-1-start,
@ -242,7 +260,7 @@ return p + 1;
p0 = (p==p0) ? p1 : p;
y += fontHeight;
} // End of while (token!=null && token.isPaintable()).
// NOTE: We should re-use code from Token (paintBackground()) here,
@ -271,8 +289,8 @@ return p + 1;
* @param selEnd The end of the selection.
*/
protected void drawViewWithSelection(TokenPainter painter, Graphics2D g,
Rectangle r, View view, int fontHeight, int y, int selStart,
int selEnd) {
Rectangle r, View view, int fontHeight, int y, int selStart,
int selEnd) {
float x = r.x;
@ -371,7 +389,7 @@ return p + 1;
int tokenOffset = token.getOffset();
Token orig = token;
token = new TokenImpl(drawSeg, tokenOffset-start, p-1-start,
tokenOffset, token.getType());
tokenOffset, token.getType());
// Selection starts in this token
if (token.containsPosition(selStart)) {
@ -432,7 +450,7 @@ return p + 1;
p0 = (p==p0) ? p1 : p;
y += fontHeight;
} // End of while (token!=null && token.isPaintable()).
// NOTE: We should re-use code from Token (paintBackground()) here,
@ -449,7 +467,7 @@ return p + 1;
/**
* Fetches the allocation for the given child view.<p>
* Overridden to account for code folding.
*
*
* @param index The index of the child, >= 0 && < getViewCount().
* @param a The allocation to this view
* @return The allocation to the child; or <code>null</code> if
@ -476,7 +494,7 @@ return p + 1;
/**
* Fetches the allocation for the given child view to render into.<p>
* Overridden to account for lines hidden by collapsed folded regions.
*
*
* @param line The index of the child, >= 0 && < getViewCount()
* @param a The allocation to this view
* @return The allocation to the child
@ -515,7 +533,7 @@ return p + 1;
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @see View#getMaximumSpan
*/
@ -541,7 +559,7 @@ return p + 1;
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @see View#getMinimumSpan
*/
@ -567,7 +585,7 @@ return p + 1;
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @see View#getPreferredSpan
*/
@ -605,7 +623,7 @@ return p + 1;
*/
protected int getTabSize() {
Integer i = (Integer) getDocument().
getProperty(PlainDocument.tabSizeAttribute);
getProperty(PlainDocument.tabSizeAttribute);
int size = (i != null) ? i.intValue() : 5;
return size;
}
@ -643,7 +661,7 @@ return p + 1;
/**
* Gives notification that something was inserted into the
* Gives notification that something was inserted into the
* document in a location that this view is responsible for.
* This is implemented to simply update the children.
*
@ -655,8 +673,8 @@ return p + 1;
@Override
public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
updateChildren(changes, a);
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
int pos = changes.getOffset();
View v = getViewAtPosition(pos, alloc);
if (v != null)
@ -669,7 +687,7 @@ return p + 1;
* This is called by the <code>setParent</code> method.
* Subclasses can re-implement this to initialize their
* child views in a different manner. The default
* implementation creates a child view for each
* implementation creates a child view for each
* child element.
*
* @param f the view factory
@ -765,8 +783,8 @@ return p + 1;
*/
@Override
public Shape modelToView(int p0, Position.Bias b0,
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
Shape s0 = modelToView(p0, a, b0);
Shape s1;
@ -779,9 +797,9 @@ return p + 1;
if (s1 == null) {
// Assume extends left to right.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
a.getBounds();
s1 = new Rectangle(alloc.x + alloc.width - 1, alloc.y,
1, alloc.height);
1, alloc.height);
}
}
else {
@ -789,11 +807,11 @@ return p + 1;
}
Rectangle r0 = s0.getBounds();
Rectangle r1 = (s1 instanceof Rectangle) ? (Rectangle) s1 :
s1.getBounds();
s1.getBounds();
if (r0.y != r1.y) {
// If it spans lines, force it to be the width of the view.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
a.getBounds();
r0.x = alloc.x;
r0.width = alloc.width;
}
@ -840,7 +858,7 @@ return p + 1;
public void paint(Graphics g, Shape a) {
Rectangle alloc = (a instanceof Rectangle) ?
(Rectangle)a : a.getBounds();
(Rectangle)a : a.getBounds();
tabBase = alloc.x;
Graphics2D g2d = (Graphics2D)g;
@ -904,7 +922,7 @@ return p + 1;
/**
* Gives notification that something was removed from the
* Gives notification that something was removed from the
* document in a location that this view is responsible for.
* This is implemented to simply update the children.
*
@ -918,12 +936,12 @@ return p + 1;
updateChildren(changes, a);
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
int pos = changes.getOffset();
View v = getViewAtPosition(pos, alloc);
if (v != null)
v.removeUpdate(changes, alloc, f);
v.removeUpdate(changes, alloc, f);
}
@ -972,7 +990,7 @@ return p + 1;
/**
* Update the child views in response to a
* Update the child views in response to a
* document event.
*/
void updateChildren(DocumentEvent e, Shape a) {
@ -1044,8 +1062,8 @@ return p + 1;
// Code folding may have hidden the last line. If so, return the last
// visible offset instead of the last offset.
if (host.isCodeFoldingEnabled() && v==getView(getViewCount()-1) &&
offs==v.getEndOffset()-1) {
if (v != null && host.isCodeFoldingEnabled() && v == getView(getViewCount() - 1) &&
offs == v.getEndOffset() - 1) {
offs = host.getLastVisibleOffset();
}
@ -1068,7 +1086,7 @@ return p + 1;
* {@inheritDoc}
*/
public int yForLineContaining(Rectangle alloc, int offs)
throws BadLocationException {
throws BadLocationException {
if (isAllocationValid()) {
// TODO: make cached Y_AXIS offsets valid even with folding enabled
// to speed this back up!
@ -1091,8 +1109,8 @@ return p + 1;
/**
* Simple view of a line that wraps if it doesn't
* fit within the horizontal space allocated.
* This class tries to be lightweight by carrying little
* state of it's own and sharing the state of the outer class
* This class tries to be lightweight by carrying little
* state of it's own and sharing the state of the outer class
* with it's siblings.
*/
class WrappedLine extends View {
@ -1136,10 +1154,10 @@ return p + 1;
//System.err.println("... ... ... break position p==" + p);
p0 = (p == p0) ? ++p : p; // this is the fix of #4410243
// we check on situation when
// width is too small and
// break position is calculated
// incorrectly.
// we check on situation when
// width is too small and
// break position is calculated
// incorrectly.
//System.err.println("... ... ... new p0==" + p0);
}
/*
@ -1161,7 +1179,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
* @param axis may be either X_AXIS or Y_AXIS
* @return the span the view would like to be rendered into.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @see View#getPreferredSpan
*/
@ -1170,7 +1188,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
switch (axis) {
case View.X_AXIS:
float width = getWidth();
if (width == Integer.MAX_VALUE) {
if (CommonUtils.equals(width, Integer.MAX_VALUE)) {
// We have been initially set to MAX_VALUE, but we don't
// want this as our preferred.
return 100f;
@ -1212,7 +1230,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
*/
@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException {
throws BadLocationException {
//System.err.println("--- begin modelToView ---");
Rectangle alloc = a.getBounds();
@ -1222,7 +1240,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
int p0 = getStartOffset();
int p1 = getEndOffset();
int testP = (b == Position.Bias.Forward) ? pos :
Math.max(p0, pos - 1);
Math.max(p0, pos - 1);
// Get the token list for this line so we don't have to keep
// recomputing it if this logical line spans multiple physical
@ -1242,9 +1260,9 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
if ((pos >= p0) && (testP<p)) {//pos < p)) {
// it's in this line
alloc = RSyntaxUtilities.getLineWidthUpTo(
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
//System.err.println("--- end modelToView ---");
return alloc;
}
@ -1253,9 +1271,9 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
// Wants end.
if (pos > p0) {
alloc = RSyntaxUtilities.getLineWidthUpTo(
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
}
//System.err.println("--- end modelToView ---");
return alloc;
@ -1351,14 +1369,9 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
// Start at alloc.x since this chunk starts
// at the beginning of a physical line.
if (tlist == null) {
p0 = (p == p0) ? p1 : p;
alloc.y += alloc.height;
continue;
}
int n = tlist.getListOffset(textArea,
WrappedSyntaxView.this,
alloc.x, x);
WrappedSyntaxView.this,
alloc.x, x);
// NOTE: We needed to add the max() with
// p0 as getTokenListForLine returns -1
@ -1384,7 +1397,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
}
private void handleDocumentEvent(DocumentEvent e, Shape a,
ViewFactory f) {
ViewFactory f) {
int n = calculateLineCount();
if (this.nlines != n) {
this.nlines = n;

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java

@ -149,7 +149,7 @@ public class HtmlFoldParser implements FoldParser {
}
// ?> or %>
else if (t.startsWith(LANG_END[language])) {
else if (currentFold != null && t.startsWith(LANG_END[language])) {
int phpEnd = t.getEndOffset() - 1;
currentFold.setEndOffset(phpEnd);
Fold parentFold = currentFold.getParent();
@ -400,4 +400,4 @@ public class HtmlFoldParser implements FoldParser {
}
}
}

17
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java

@ -10,12 +10,13 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea.modes;
import java.io.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.Token;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenImpl;
import java.io.IOException;
import java.util.Stack;
import javax.swing.text.Segment;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.*;
/**
* Scanner for makefiles.<p>
@ -762,8 +763,8 @@ public final void yybegin(int newState) {
{ addToken(Token.LITERAL_CHAR);
}
case 25: break;
case 12:
{ if (!varDepths.empty() && varDepths.peek()==Boolean.TRUE) {
case 12:
{ if (!varDepths.empty() && Boolean.TRUE.equals(varDepths.peek())) {
varDepths.pop();
if (varDepths.empty()) {
addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL);
@ -771,8 +772,8 @@ public final void yybegin(int newState) {
}
}
case 26: break;
case 11:
{ if (!varDepths.empty() && varDepths.peek()==Boolean.FALSE) {
case 11:
{ if (!varDepths.empty() && Boolean.FALSE.equals(varDepths.peek())) {
varDepths.pop();
if (varDepths.empty()) {
addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL);
@ -864,4 +865,4 @@ public final void yybegin(int newState) {
}
}
}

38
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java

@ -723,37 +723,13 @@ int currentCaretY; // Used to know when to rehighlight current line.
// If we're wrapping lines we need to check the actual y-coordinate
// of the caret, not just the line number, since a single logical
// line can span multiple physical lines.
if (getLineWrap()) {
try {
Rectangle temp = modelToView(dot);
if (temp!=null) {
currentCaretY = temp.y;
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Should never happen.
try {
Rectangle temp = modelToView(dot);
if (temp != null) {
currentCaretY = temp.y;
}
}
// No line wrap - we can simply check the line number (quicker).
else {
// Document doc = getDocument();
// if (doc!=null) {
// Element map = doc.getDefaultRootElement();
// int caretLine = map.getElementIndex(dot);
// Rectangle alloc = ((RTextAreaUI)getUI()).
// getVisibleEditorRect();
// if (alloc!=null)
// currentCaretY = alloc.y + caretLine*lineHeight;
// }
// Modified for code folding requirements
try {
Rectangle temp = modelToView(dot);
if (temp!=null) {
currentCaretY = temp.y;
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Should never happen.
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Should never happen.
}
// Repaint current line (to fill in entire highlight), and old line
@ -1211,4 +1187,4 @@ try {
}
}
}

5
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/SearchEngine.java

@ -25,6 +25,7 @@ import javax.swing.text.Caret;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import org.jetbrains.annotations.NotNull;
/**
@ -174,6 +175,7 @@ public class SearchEngine {
* @param forward Whether we're searching forward or backward.
* @return The character sequence.
*/
@NotNull
private static CharSequence getFindInCharSequence(RTextArea textArea,
int start, boolean forward) {
RDocument doc = (RDocument)textArea.getDocument();
@ -752,7 +754,6 @@ public class SearchEngine {
int start = makeMarkAndDotEqual(textArea, forward);
CharSequence findIn = getFindInCharSequence(textArea, start, forward);
if (findIn==null) return new SearchResult();
int markAllCount = 0;
if (context.getMarkAll()) {
@ -1014,4 +1015,4 @@ public class SearchEngine {
}
}
}

7
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java

@ -103,6 +103,9 @@ public class VolatileImageBackgroundPainterStrategy
} finally {
tracker.removeImage(i, 1);
}
if(bgImage == null) {
continue;
}
bgImage.getGraphics().drawImage(i, 0,0, null);
tracker.addImage(bgImage, 0);
try {
@ -114,7 +117,7 @@ public class VolatileImageBackgroundPainterStrategy
} finally {
tracker.removeImage(bgImage, 0);
}
} while (bgImage.contentsLost());
} while (bgImage != null && bgImage.contentsLost());
} // End of if (master!=null).
else {
bgImage = null;
@ -137,4 +140,4 @@ public class VolatileImageBackgroundPainterStrategy
}
}
}

9
designer-base/src/main/java/com/fr/design/icon/BorderIcon.java

@ -1,5 +1,6 @@
package com.fr.design.icon;
import com.fr.stable.AssistUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
@ -43,13 +44,13 @@ public class BorderIcon implements Icon {
if (lineStyle == Constants.LINE_MEDIUM
|| lineStyle == Constants.LINE_THICK) {
lineStyle = Constants.LINE_MEDIUM;
if (x1 == x2) {
if (x1 == y1) {
if (AssistUtils.equals(x1, x2)) {
if (AssistUtils.equals(x1, y1)) {
GraphHelper.drawLine(g, x1, y1 - 1, x2, y2 + 1, lineStyle);
} else {
GraphHelper.drawLine(g, x1, y1, x2, y2 + 1, lineStyle);
}
} else if (y1 == y2) {
} else if (AssistUtils.equals(y1, y2)) {
GraphHelper.drawLine(g, x1, y1, x2 + 1, y2, lineStyle);
}
} else if (lineStyle == Constants.LINE_THIN
@ -57,7 +58,7 @@ public class BorderIcon implements Icon {
GraphHelper.drawLine(g, x1, y1, x2, y2, lineStyle);
} else {
lineStyle = Constants.LINE_DOT;
if (y1 == x2 && x2 == y2) {
if (AssistUtils.equals(y1, x2) && AssistUtils.equals(x2, y2)) {
GraphHelper.drawLine(g, x1, y1, x2 + 1, y2, lineStyle);
} else {
GraphHelper.drawLine(g, x1, y1, x2, y2, lineStyle);

2
designer-base/src/main/java/com/fr/design/icon/LockIcon.java

@ -35,7 +35,7 @@ public class LockIcon extends ImageIcon {
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
}

2
designer-base/src/main/java/com/fr/design/icon/WarningIcon.java

@ -37,7 +37,7 @@ public class WarningIcon extends ImageIcon {
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
}

5
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -3,6 +3,7 @@ package com.fr.design.layout;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
@ -562,9 +563,9 @@ public class FRGUIPaneFactory {
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j;
if (x == i) {
if (AssistUtils.equals(x, i)) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
} else if (x == j) {
} else if (AssistUtils.equals(x, j)) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
}
return w;

82
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -1,6 +1,9 @@
package com.fr.design.layout;
import com.fr.stable.AssistUtils;
import com.fr.general.GeneralUtils;
import com.fr.stable.CommonUtils;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Container;
@ -12,8 +15,6 @@ import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.ListIterator;
import com.fr.general.GeneralUtils;
/**
* <p>TableLayout is a layout manager that is more powerful than GridBagLayout
@ -322,7 +323,6 @@ public class TableLayout implements LayoutManager2, Serializable {
public static final double MINIMUM = -3.0;
//******************************************************************************
//** Constructors ***
//******************************************************************************
@ -399,17 +399,17 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure rows and columns are valid
for (int counter = 0; counter < crSpec[C].length; counter++)
if ((crSpec[C][counter] < 0.0) &&
(crSpec[C][counter] != FILL) &&
(crSpec[C][counter] != PREFERRED) &&
(crSpec[C][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[C][counter], FILL) &&
!AssistUtils.equals(crSpec[C][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[C][counter], MINIMUM)) {
crSpec[C][counter] = 0.0;
}
for (int counter = 0; counter < crSpec[R].length; counter++)
if ((crSpec[R][counter] < 0.0) &&
(crSpec[R][counter] != FILL) &&
(crSpec[R][counter] != PREFERRED) &&
(crSpec[R][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[R][counter], FILL) &&
!AssistUtils.equals(crSpec[R][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[R][counter], MINIMUM)) {
crSpec[R][counter] = 0.0;
}
@ -556,9 +556,9 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure rows are valid
for (int counter = 0; counter < crSpec[z].length; counter++)
if ((crSpec[z][counter] < 0.0) &&
(crSpec[z][counter] != FILL) &&
(crSpec[z][counter] != PREFERRED) &&
(crSpec[z][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[z][counter], FILL) &&
!AssistUtils.equals(crSpec[z][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
crSpec[z][counter] = 0.0;
}
@ -641,9 +641,9 @@ public class TableLayout implements LayoutManager2, Serializable {
protected void setCr(int z, int i, double size) {
// Make sure size is valid
if ((size < 0.0) &&
(size != FILL) &&
(size != PREFERRED) &&
(size != MINIMUM)) {
!AssistUtils.equals(size, FILL) &&
!AssistUtils.equals(size, PREFERRED) &&
!AssistUtils.equals(size, MINIMUM)) {
size = 0.0;
}
@ -853,9 +853,9 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure row size is valid
if ((size < 0.0) &&
(size != FILL) &&
(size != PREFERRED) &&
(size != MINIMUM)) {
(!CommonUtils.equals(size, FILL)) &&
(!CommonUtils.equals(size, PREFERRED)) &&
(!CommonUtils.equals(size, MINIMUM))) {
size = 0.0;
}
@ -1177,7 +1177,7 @@ public class TableLayout implements LayoutManager2, Serializable {
int numCr = crSpec[z].length;
for (int counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] >= 1.0) || (crSpec[z][counter] == 0.0)) {
if ((crSpec[z][counter] >= 1.0) || CommonUtils.equals(crSpec[z][counter], 0.0)) {
crSize[z][counter] = (int) (crSpec[z][counter] + 0.5);
availableSize -= crSize[z][counter];
}
@ -1229,7 +1229,7 @@ public class TableLayout implements LayoutManager2, Serializable {
int numCr = crSpec[z].length;
for (int counter = 0; counter < numCr; counter++)
if (crSpec[z][counter] == FILL)
if (CommonUtils.equals(crSpec[z][counter], FILL))
numFillSize++;
// If numFillSize is zero, the if statement below will always evaluate to
@ -1241,7 +1241,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Assign "fill" cells equal amounts of the remaining space
for (int counter = 0; counter < numCr; counter++)
if (crSpec[z][counter] == FILL) {
if (CommonUtils.equals(crSpec[z][counter], FILL)) {
crSize[z][counter] = availableSize / numFillSize;
slackSize -= crSize[z][counter];
}
@ -1249,7 +1249,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Assign one pixel of slack to each FILL cr, starting at the last one,
// until all slack has been consumed
for (int counter = numCr - 1; (counter >= 0) && (slackSize > 0); counter--) {
if (crSpec[z][counter] == FILL) {
if (CommonUtils.equals(crSpec[z][counter], FILL)) {
crSize[z][counter]++;
slackSize--;
}
@ -1299,7 +1299,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Address every cr
for (int counter = 0; counter < numCr; counter++)
// Is the current cr a preferred/minimum (based on typeOfSize) size
if (crSpec[z][counter] == typeOfSize) {
if (CommonUtils.equals(crSpec[z][counter], typeOfSize)) {
// Assume a maximum width of zero
int maxSize = 0;
@ -1319,7 +1319,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// the current component occupies
if ((entry.cr1[z] <= counter) && (entry.cr2[z] >= counter)) {
// Setup size and number of adjustable crs
Dimension p = (typeOfSize == PREFERRED) ?
Dimension p = CommonUtils.equals(typeOfSize, PREFERRED) ?
entry.component.getPreferredSize() :
entry.component.getMinimumSize();
@ -1328,23 +1328,23 @@ public class TableLayout implements LayoutManager2, Serializable {
int numAdjustable = 0;
// Calculate for preferred size
if (typeOfSize == PREFERRED)
if (CommonUtils.equals(typeOfSize, PREFERRED))
// Consider all crs this component occupies
for (int entryCr = entry.cr1[z];
entryCr <= entry.cr2[z]; entryCr++) {
// Subtract absolute, relative, and minumum cr
// sizes, which have already been calculated
if ((crSpec[z][entryCr] >= 0.0) ||
(crSpec[z][entryCr] == MINIMUM)) {
CommonUtils.equals(crSpec[z][entryCr], MINIMUM)) {
size -= crSize[z][entryCr];
}
// Count preferred/min width columns
else if (crSpec[z][entryCr] == PREFERRED)
else if (CommonUtils.equals(crSpec[z][entryCr], PREFERRED))
numAdjustable++;
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (crSpec[z][entryCr] == FILL)
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (CommonUtils.equals(crSpec[z][entryCr], FILL))
continue nextComponent;
}
// Calculate for minimum size
@ -1357,14 +1357,14 @@ public class TableLayout implements LayoutManager2, Serializable {
if (crSpec[z][entryCr] >= 0.0)
size -= crSize[z][entryCr];
// Count preferred/min width columns
else if ((crSpec[z][entryCr] == PREFERRED) ||
(crSpec[z][entryCr] == MINIMUM)) {
else if (CommonUtils.equals(crSpec[z][entryCr], PREFERRED) ||
CommonUtils.equals(crSpec[z][entryCr], MINIMUM)) {
numAdjustable++;
}
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (crSpec[z][entryCr] == FILL)
else if (CommonUtils.equals(crSpec[z][entryCr], FILL))
continue nextComponent;
}
@ -1692,7 +1692,7 @@ public class TableLayout implements LayoutManager2, Serializable {
Dimension prefMinSize[] = new Dimension[numEntry];
for (int i = 0; i < numEntry; i++)
prefMinSize[i] = (typeOfSize == PREFERRED) ?
prefMinSize[i] = CommonUtils.equals(typeOfSize, PREFERRED) ?
entryList[i].component.getPreferredSize() :
entryList[i].component.getMinimumSize();
@ -1807,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable {
for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++)
if (crSpec[z][counter] >= 1.0)
scalableSize -= crSpec[z][counter];
else if ((crSpec[z][counter] == PREFERRED) ||
(crSpec[z][counter] == MINIMUM)) {
else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
scalableSize -= crPrefMin[counter];
}
@ -1824,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable {
// Add scaled size to relativeWidth
relativeSize += crSpec[z][counter];
// Cr is fill
else if ((crSpec[z][counter] == FILL) && (fillSizeRatio != 0.0))
else if (AssistUtils.equals(crSpec[z][counter], FILL) && !AssistUtils.equals(fillSizeRatio, 0.0))
// Add fill size to relativeWidth
relativeSize += fillSizeRatio;
}
// Determine the total scaled size as estimated by this component
if (relativeSize == 0)
if (AssistUtils.equals(relativeSize, 0))
temp = 0;
else
temp = (int) (scalableSize / relativeSize + 0.5);
@ -1851,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable {
if (crSpec[z][counter] >= 1.0)
totalSize += (int) (crSpec[z][counter] + 0.5);
// Is the current cr a preferred/minimum size
else if ((crSpec[z][counter] == PREFERRED) ||
(crSpec[z][counter] == MINIMUM)) {
else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
// Add preferred/minimum width
totalSize += crPrefMin[counter];
}

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

@ -1091,6 +1091,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
thread.join();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("Map Thread Error");
Thread.currentThread().interrupt();
}
DesignerEnvManager.getEnvManager().setLastOpenFile(

23
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.background.ColorBackground;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private MobileStyleCustomDefinePane customBeanPane;
private Class<? extends MobileStyle> mobileStyleClazz;
private NewColorSelectBox colorSelectBox;
private Color titleColor = new Color(47, 142, 241);
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
Class<? extends MobileStyle> mobileStyleClazz) {
@ -35,7 +37,9 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
@Override
public void populateBean(MobileStyle ob) {
this.customBeanPane.populateBean(ob);
colorSelectBox.setSelectObject(ob.getBackground());
if(ob.getBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor());
}
}
@Override
@ -43,7 +47,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
MobileStyle mobileStyle = Reflect.on(mobileStyleClazz).create().get();
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
mobileStyle.setBackground(colorSelectBox.getSelectObject());
mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject()));
return mobileStyle;
}
@ -67,8 +71,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
JPanel mobileStylePreviewPane = this.customBeanPane.createPreviewPane();
if(mobileStylePreviewPane != null) {
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, new Color(0x2f8ef100)));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"));
previewPane.setBorder(titledBorder);
previewPane.setPreferredSize(new Dimension(500, 83));
previewPane.add(mobileStylePreviewPane, BorderLayout.CENTER);
@ -82,8 +85,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
backgroundPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
backgroundPane.setPreferredSize(new Dimension(500, 65));
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, Color.BLUE));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute"));
backgroundPane.setBorder(titledBorder);
UILabel colorSelectLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Widget_Background"), UILabel.RIGHT);
@ -104,12 +106,17 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private void createCustomPane() {
JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, Color.BLUE));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set"));
configPane.setBorder(titledBorder);
configPane.add(this.customBeanPane, BorderLayout.CENTER);
this.add(configPane, BorderLayout.CENTER);
}
private TitledBorder createTitledBorder(String title) {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(title, titleColor);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12));
return titledBorder;
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -20,6 +20,7 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem;
import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.Icon;
import javax.swing.border.EmptyBorder;
@ -146,6 +147,9 @@ public class VcsHelper implements JTemplateActionListener {
if (needDeleteVersion(oldEntity)) {
operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion());
}
if (GcConfig.getInstance().isGcEnable()) {
operator.gc();
}
}
}).start();

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
@ -67,7 +68,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
}
double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) {
if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
}
return editor;

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.ui;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import javax.swing.JPanel;
import javax.swing.JTable;
@ -34,7 +35,7 @@ public class FileVersionCellRender implements TableCellRenderer {
editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND);
double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) {
if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
}
return editor;

7
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java

@ -19,12 +19,11 @@ public class VcsLabel extends ActionLabel {
}
public void paintComponent(Graphics g) {
if (ui != null) {
Graphics scratchGraphics = (g == null) ? null : g.create();
if (ui != null && g != null) {
Graphics scratchGraphics = g.create();
try {
ui.update(scratchGraphics, this);
}
finally {
} finally {
scratchGraphics.dispose();
}
}

4
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -113,8 +113,8 @@ public class WatermarkPane extends BasicPane {
formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true);
horizontalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner = new UnsignedIntUISpinner(100, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UnsignedIntUISpinner(50, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));

3
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -29,6 +29,7 @@ import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils;
/**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
@ -217,7 +218,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* @return 同上
*/
public boolean isOriginalPlace() {
return startLabel.getValue() == min && endLabel.getValue() == max;
return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max);
}
/**

1
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -74,6 +74,7 @@ public class ColorPicker extends JDialog implements ActionListener
Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
colorPickerPanel.captureScreen();
}

1
designer-base/src/main/java/com/fr/design/update/actions/FileDownloader.java

@ -65,6 +65,7 @@ public abstract class FileDownloader extends SwingWorker<Boolean, DownloadItem>
success = get();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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

@ -385,6 +385,7 @@ public class UpdateMainDialog extends UIDialog {
showDownLoadInfo();
} catch (InterruptedException e) {
stopLoading();
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
stopLoading();
} finally {

9
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -31,6 +31,7 @@ import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable;
import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
@ -890,10 +891,10 @@ public final class GUICoreUtils {
* @return 同上
*/
public static boolean isTheSameRect(Rectangle oneRect, Rectangle otherRect) {
return oneRect.getX() == otherRect.getX()
&& oneRect.getY() == otherRect.getY()
&& oneRect.getWidth() == otherRect.getWidth()
&& oneRect.getHeight() == otherRect.getHeight();
return AssistUtils.equals(oneRect.getX(), otherRect.getX())
&& AssistUtils.equals(oneRect.getY(), otherRect.getY())
&& AssistUtils.equals(oneRect.getWidth(), otherRect.getWidth())
&& AssistUtils.equals(oneRect.getHeight(), otherRect.getHeight());
}
/**

5
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -9,6 +9,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.NumberEditor;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -226,7 +227,7 @@ public class NumberEditorValidatePane extends JPanel {
}
allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) {
if (AssistUtils.equals(e.getMaxValue(),Double.MAX_VALUE)) {
setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(Double.MAX_VALUE);
maxValueSpinner.setEnabled(false);
@ -236,7 +237,7 @@ public class NumberEditorValidatePane extends JPanel {
maxValueSpinner.setValue(e.getMaxValue());
}
if (e.getMinValue() == -Double.MAX_VALUE) {
if (AssistUtils.equals(e.getMinValue(),-Double.MAX_VALUE)) {
setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(-Double.MAX_VALUE);
minValueSpinner.setEnabled(false);

5
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -633,9 +633,6 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
for (int i = 0; i < len; i++) {
currentColumnNames[i] = new ColumnName(colNames[i]);
}
if (currentColumnNames == null) {
currentColumnNames = new ColumnName[0];
}
return currentColumnNames;
}
@ -701,7 +698,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
} else {
dmlConfigComboBox.setSelectedIndex(0);
}
jobs = new NameSubmitJob[dmlConfig == null ? 0 : dmlConfig.getSubmitJobCount()];
jobs = new NameSubmitJob[dmlConfig.getSubmitJobCount()];
for (int i = 0; i < jobs.length; i++) {
jobs[i] = dmlConfig.getSubmitJob(i);
}

303
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -1,13 +1,15 @@
package com.fr.design;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chart.fun.ChartTypeProvider;
import com.fr.chartx.attr.ChartProvider;
import com.fr.common.annotations.Compatible;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.chart.gui.ChartWidgetOption;
import com.fr.design.chartinterface.AreaIndependentChartInterface;
import com.fr.design.chartinterface.BarIndependentChartInterface;
@ -38,10 +40,13 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.extended.chart.AbstractChart;
import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
@ -111,9 +116,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager();
private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces =
new LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>>();
private static LinkedHashMap<String, CloseableContainedMap<String, ChartTypeUIProvider, LinkedHashMap>> chartTypeInterfaces =
new LinkedHashMap<String, CloseableContainedMap<String, ChartTypeUIProvider, LinkedHashMap>>();
private static Map<String, String> idAndPriorityMap = new HashMap<String, String>();
@ -156,18 +161,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public static WidgetOption[] initWidgetOption() {
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length];
int index = 0;
for (ChartInternationalNameContentBean bean : typeName) {
String plotID = bean.getChartID();
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) {
for (String chartID : chartIDs) {
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(chartID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(chartID)) {
continue;
}
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
String name = ChartTypeInterfaceManager.getInstance().getName(chartID);
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID);
Icon icon = IOUtils.readIcon(iconPath);
child[index] = new ChartWidgetOption(InterProviderFactory.getProvider().getLocText(bean.getName()), icon, ChartEditor.class, plotID);
child[index] = new ChartWidgetOption(name, icon, ChartEditor.class, chartID);
index++;
}
@ -218,18 +223,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface());
addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface());
}
private static void addChartTypeInterface(String priority, String plotID, IndependentChartUIProvider provider) {
private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) {
if (chartTypeInterfaces != null) {
if (!chartTypeInterfaces.containsKey(priority)) {
//新建一个具体图表列表
CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList
= new CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>(LinkedHashMap.class);
CloseableContainedMap<String, ChartTypeUIProvider, LinkedHashMap> chartUIList
= new CloseableContainedMap<String, ChartTypeUIProvider, LinkedHashMap>(LinkedHashMap.class);
chartUIList.put(plotID, provider);
chartTypeInterfaces.put(priority, chartUIList);
} else {
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority);
if (!chartUIList.containsKey(plotID)) {
chartUIList.put(plotID, provider);
}
@ -238,7 +243,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
}
private IndependentChartUIProvider getChartTypeInterface(String plotID) {
private ChartTypeUIProvider getChartTypeInterface(String plotID) {
if (idAndPriorityMap.containsKey(plotID)) {
String priority = idAndPriorityMap.get(plotID);
if (chartTypeInterfaces.containsKey(priority)) {
@ -267,66 +272,35 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Iterator<Map.Entry<String, IndependentChartUIProvider>> iterator = chartUIList.entrySet().iterator();
Iterator<Map.Entry<String, ChartTypeUIProvider>> iterator = chartUIList.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, IndependentChartUIProvider> entry = iterator.next();
String plotID = entry.getKey();
AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) {
continue;
}
pane.setPlotID(plotID);
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends ChartProvider>>());
try {
Map.Entry<String, ChartTypeUIProvider> entry = iterator.next();
String plotID = entry.getKey();
AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) {
continue;
}
pane.reLayout(plotID);
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends ChartProvider>>());
}
allChartTypePane.get(priority).put(plotID, pane);
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
allChartTypePane.get(priority).put(plotID, pane);
}
}
}
private String getChartName(String plotID, IndependentChartUIProvider provider) {
String name = provider.getPlotTypeTitle4PopupWindow();
if (StringUtils.isEmpty(name)) {
name = ChartTypeManager.getInstance().getChartName(plotID);
}
return name;
}
@Compatible
public String getTitle4PopupWindow(String plotID) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getPlotTypeTitle4PopupWindow();
}
return StringUtils.EMPTY;
}
/**
* 获取指定图表的标题
*/
public String getTitle4PopupWindow(String priority, String plotID) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return getChartName(plotID, provider);
}
//兼容老的插件
if (chartTypeInterfaces != null) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String defaultPriority = (String) entry.getKey();
if (chartTypeInterfaces.get(defaultPriority).containsKey(plotID)) {
return getChartName(plotID, chartTypeInterfaces.get(defaultPriority).get(plotID));
}
}
}
return StringUtils.EMPTY;
return getName(plotID);
}
private List<Integer> getPriorityInOrder() {
@ -346,16 +320,153 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public String getIconPath(String plotID) {
if (chartTypeInterfaces != null) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getIconPath();
}
}
return StringUtils.EMPTY;
}
public String[] getDemoImagePath(String chartID) {
if (chartTypeInterfaces != null) {
ChartTypeUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
String[] result = null;
try {
result = provider.getDemoImagePath();
} catch (Throwable e) {
//do nothing
}
return ArrayUtils.isEmpty(result) ? getCompatibleDemoImagePath(chartID) : result;
}
}
return new String[0];
}
private String[] getCompatibleDemoImagePath(String chartID) {
String[] result = null;
try {
//AbstractIndependentChartsProvider
ChartTypeProvider chartTypeProvider = Reflect.on(ChartTypeManager.getInstanceWithCheck()).call("getChartType", chartID).get();
result = new String[]{
Reflect.on(chartTypeProvider).call("getChartImagePath").get()
};
if (ArrayUtils.isNotEmpty(result)) {
return result;
}
} catch (Exception e) {
//do nothing
}
try {
//兼容 图表类型选择界面会调到这边
ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID);
result = new String[charts.length];
for (int i = 0; i < charts.length; i++) {
//Chart && AbstractChart
ChartProvider chart = charts[i];
if (!(chart instanceof AbstractChart)) {//扩展图表
chart = Reflect.on(chart).field("subChart").get();
}
result[i] = Reflect.on(chart).call("demoImagePath").get();
}
} catch (Exception e) {
//do nothing
}
return new String[0];
}
public String[] getSubName(String chartID) {
if (chartTypeInterfaces != null) {
ChartTypeUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
String[] subNames = null;
try {
subNames = provider.getSubName();
} catch (Throwable throwable) {
//do nothing
}
return ArrayUtils.isEmpty(subNames) ? getCompatibleSubName(chartID, provider) : subNames;
}
}
return new String[0];
}
//兼容
private String[] getCompatibleSubName(String chartID, ChartTypeUIProvider provider) {
ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID);
if (chartProviders.length == 1) {
return new String[]{getName(chartID)};
}
String[] result = new String[chartProviders.length];
for (int i = 0; i < chartProviders.length; i++) {
if (chartProviders[i] instanceof Chart) {
//Chart && AbstractChart
result[i] = ((Chart) chartProviders[i]).getChartName();
}
}
return result;
}
public String getName(String chartID) {
if (chartTypeInterfaces != null) {
ChartTypeUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
String name = null;
try {
name = provider.getName();
} catch (Throwable throwable) {
//do nothing
}
return StringUtils.isEmpty(name) ? getCompatibleName(chartID, provider) : name;
}
}
return StringUtils.EMPTY;
}
//兼容
private static String getCompatibleName(String chartID, ChartTypeUIProvider provider) {
String result = null;
try {
//AbstractIndependentChartsProvider
ChartTypeProvider chartTypeProvider = Reflect.on(ChartTypeManager.getInstanceWithCheck()).call("getChartType", chartID).get();
result = Reflect.on(chartTypeProvider).call("getChartName").get();//国际化的key
result = InterProviderFactory.getProvider().getLocText(result);
if (StringUtils.isNotEmpty(result)) {
return result;
}
} catch (Exception e) {
//do nothing
}
try {
ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID)[0];
if (chartProvider instanceof Chart) {
//AbstractExtendedChartUIProvider
result = ((Chart) chartProvider).getChartName();
}
if (StringUtils.isNotEmpty(result) && !"Charts".equals(result)) {
return result;
}
} catch (Exception e) {
//do nothing
}
return provider.getPlotTypePane().title4PopupWindow();
}
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartDataPane(listener);
}
@ -363,20 +474,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return new ChartDataPane(listener);
}
/**
* 获取对应ID的图表数量
*
*/
private int getChartSize(String key) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)) {
return chartTypeInterfaces.get(key).size();
}
return 0;
}
public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getAttrPaneArray(listener);
}
@ -387,7 +486,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getTableDataSourcePane(plot, parent);
}
@ -397,7 +496,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getReportDataSourcePane(plot, parent);
}
@ -405,17 +504,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null;
}
private boolean plotInChart(String plotID, String priority) {
return chartTypeInterfaces != null
&& chartTypeInterfaces.containsKey(priority)
&& chartTypeInterfaces.get(priority).containsKey(plotID);
}
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getPlotConditionPane(plot);
}
@ -425,7 +516,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getPlotSeriesPane(parent, plot);
}
@ -441,7 +532,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
*/
public boolean isUseDefaultPane(String plotID) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.isUseDefaultPane();
}
@ -452,7 +543,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public boolean needChartChangePane(ChartProvider chart) {
if (chart != null) {
String chartID = chart.getID();
IndependentChartUIProvider provider = getChartTypeInterface(chartID);
ChartTypeUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
return provider.needChartChangePane();
}
@ -467,7 +558,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (isIndependentChartUIProvider(injection)) {
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID");
IndependentChartUIProvider instance = (IndependentChartUIProvider) injection.getObject();
ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject();
addChartTypeInterface(priority, plotID, instance);
}
}
@ -487,7 +578,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (chartTypeInterfaces != null) {
if (chartTypeInterfaces.containsKey(priority)) {
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority);
chartUIList.remove(plotID);
}
}
@ -495,13 +586,13 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private boolean isIndependentChartUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && IndependentChartUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof IndependentChartUIProvider;
return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider;
}
public ChartEditPane getChartEditPane(String plotID) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartEditPane(plotID);
}
@ -509,7 +600,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
public ChartsConfigPane getChartConfigPane(String plotID) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartConfigPane(plotID);
}

45
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -3,14 +3,13 @@ package com.fr.design.chart;
* the Pane of the Chart
*/
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
@ -28,29 +27,7 @@ import java.awt.Component;
public class ChartTypePane extends ChartCommonWizardPane {
private static final long serialVersionUID = -1175602484968520546L;
private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames();
private ChartProvider[][] charts4Icon = null;
{
charts4Icon = new ChartProvider[this.typeName.length][];
for (int i = 0; i < this.typeName.length; i++) {
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getChartID());
int rowChartsCount = rowCharts.length;
charts4Icon[i] = new ChartProvider[rowChartsCount];
for (int j = 0; j < rowChartsCount; j++) {
try {
charts4Icon[i][j] = (ChartProvider) rowCharts[j].clone();
//todo@shinerefactor 老图表也是提供一张图片 这边就不用setTitle(null) 然后实时去画
// charts4Icon[i][j].setTitle(null);
// if(charts4Icon[i][j].getPlot() != null){
// charts4Icon[i][j].getPlot().setLegend(null);
// }
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}
private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs();
private JList mainTypeList = null;
private JList iconViewList = null;
@ -61,8 +38,8 @@ public class ChartTypePane extends ChartCommonWizardPane {
DefaultListModel defaultListModel = new DefaultListModel();
mainTypeList = new JList(defaultListModel);
for (int i = 0; i < typeName.length; i++) {
defaultListModel.insertElementAt(InterProviderFactory.getProvider().getLocText(typeName[i].getName()), i);
for (int i = 0; i < chartIDs.length; i++) {
defaultListModel.insertElementAt(ChartTypeInterfaceManager.getInstance().getName(chartIDs[i]), i);
}
mainTypeList.addListSelectionListener(listSelectionListener);
@ -115,11 +92,15 @@ public class ChartTypePane extends ChartCommonWizardPane {
protected ListSelectionListener listSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
int main_index = mainTypeList.getSelectedIndex();
ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
String id = ChartTypePane.this.chartIDs[main_index];
String[] demoImagePath = ChartTypeInterfaceManager.getInstance().getDemoImagePath(id);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id);
ChartTypePane.this.iconListModel.clear();
for (int i = 0; i < sub_charts.length; i++) {
String ImagePath = sub_charts[i].demoImagePath();
String chartName = sub_charts[i].getChartName();
for (int i = 0, len = demoImagePath.length; i < len; i++) {
String ImagePath = demoImagePath[i];
String chartName = subName[i];
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName));
}
iconViewList.setSelectedIndex(0);
@ -143,7 +124,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
ChartProvider chart4Update = cc.getSelectedChartProvider();
if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID();
String plotID = this.chartIDs[mainTypeList.getSelectedIndex()];
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try {
chart4Update = (ChartProvider) chart.clone();

139
designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java

@ -0,0 +1,139 @@
package com.fr.design.chart.fun;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.injectable.SpecialLevel;
import com.fr.stable.fun.Level;
/**
* Created by eason on 14/12/29.
*
* @since 8.0
* 自定义 图表类型 界面接口
*/
public interface ChartTypeUIProvider extends Level {
String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
int CURRENT_API_LEVEL = 3;
/**
* 图表 类型定义界面类型就是属性表的第一个界面
* 可以返回null 代表没有 图表类型切换界面
*
* @return 图表的类型定义界面类型
*/
AbstractChartTypePane getPlotTypePane();
/**
* 图表 数据配置界面 即属性表的第二个界面
* 可以返回null 代表没有数据配置界面
*/
ChartDataPane getChartDataPane(AttributeChangeListener listener);
/**
* 图表 属性界面数组 其他样式界面数组
* 可以返回空数组 代表没有其他样式界面
*
* @return 属性界面
*/
AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener);
/**
* 图表 名称
* eg:柱形图
*
* @return 图表 名称
*/
String getName();
/**
* 图表 名称
* 柱形图 堆积柱形图
*
* @return 图表 名称
*/
String[] getSubName();
/**
* 图表 demo图片路径
* 400*225
* 1.图表选择界面的图的路径 原样渲染
* 2.图表属性第一个界面 类型界面 缩放渲染
*
* @return demo图片路径
*/
String[] getDemoImagePath();
/**
* 小图标路径
* 表单 工具栏 图表小图标
* 16*16
*
* @return 图标路径
*/
String getIconPath();
//todo:把下面这些接口删除
@Deprecated
boolean needChartChangePane();
/**
* 数据集数据源的界面
*
* @return 数据集数据源的界面
*/
@Deprecated
AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent);
/**
* 单元格数据源的界面
*
* @return 单元格数据源的界面
*/
@Deprecated
AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent);
/**
* 条件属性界面
*
* @return 条件属性界面
*/
@Deprecated
ConditionAttributesPane getPlotConditionPane(Plot plot);
/**
* 系列界面
*
* @return 系列界面
*/
@Deprecated
BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot);
/**
* 是否使用默认的界面为了避免界面来回切换
*
* @return 是否使用默认的界面
*/
@Deprecated
boolean isUseDefaultPane();
@Deprecated
ChartEditPane getChartEditPane(String plotID);
@Deprecated
ChartsConfigPane getChartConfigPane(String plotID);
}

101
designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -1,102 +1,11 @@
package com.fr.design.chart.fun;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.injectable.SpecialLevel;
import com.fr.stable.fun.Level;
import com.fr.common.annotations.Compatible;
/**
* Created by eason on 14/12/29.
*
* @since 8.0
* 自定义图表类型设设计界面接口
* Created by shine on 2019/09/05.
*/
public interface IndependentChartUIProvider extends Level {
String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
@Compatible
public interface IndependentChartUIProvider extends ChartTypeUIProvider {
int CURRENT_API_LEVEL = 3;
boolean needChartChangePane();
/**
* 图表的类型定义界面类型就是属性表的第一个界面
*
* @return 图表的类型定义界面类型
*/
AbstractChartTypePane getPlotTypePane();
/**
* 数据集数据源的界面
*
* @return 数据集数据源的界面
*/
AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent);
/**
* 单元格数据源的界面
*
* @return 单元格数据源的界面
*/
AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent);
/**
* 条件属性界面
*
* @return 条件属性界面
*/
ConditionAttributesPane getPlotConditionPane(Plot plot);
/**
* 系列界面
*
* @return 系列界面
*/
BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot);
/**
* 图表的属性界面数组
*
* @return 属性界面
*/
AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener);
ChartDataPane getChartDataPane(AttributeChangeListener listener);
/**
* 是否使用默认的界面为了避免界面来回切换
*
* @return 是否使用默认的界面
*/
boolean isUseDefaultPane();
/**
* 图标路径
*
* @return 图标路径
*/
String getIconPath();
/**
* plot面板的标题
*/
String getPlotTypeTitle4PopupWindow();
ChartEditPane getChartEditPane(String plotID);
ChartsConfigPane getChartConfigPane(String plotID);
}
}

91
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java

@ -0,0 +1,91 @@
package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.chartx.impl.AbstractDataPane;
import com.fr.design.chartx.impl.AbstractOtherPane;
import com.fr.design.chartx.impl.DefaultTypePane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by shine on 2019/09/03.
*/
public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider {
@Override
public AbstractChartTypePane getPlotTypePane() {
return new DefaultTypePane();
}
@Override
public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener);
@Override
public abstract AbstractOtherPane[] getAttrPaneArray(AttributeChangeListener listener);
@Override
public String[] getSubName() {
return new String[]{getName()};
}
@Override
public int currentAPILevel() {
return CURRENT_API_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public boolean needChartChangePane() {
return false;
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
@Override
public boolean isUseDefaultPane() {
return false;
}
@Override
public ChartEditPane getChartEditPane(String plotID) {
return new ChartEditPane();
}
@Override
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
return null;
}
@Override
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
return null;
}
@Override
public ChartsConfigPane getChartConfigPane(String plotID) {
return null;
}
}

66
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java

@ -1,66 +0,0 @@
package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
* Created by eason on 15/4/23.
*/
@Deprecated
public abstract class AbstractIndependentChartUI implements IndependentChartUIProvider {
@Override
public int currentAPILevel() {
return -1;
}
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
return new AbstractChartAttrPane[0];
}
public ChartDataPane getChartDataPane(AttributeChangeListener listener){
return new ChartDataPane(listener);
}
/**
* 是否使用默认的界面为了避免界面来回切换
* @return 是否使用默认的界面
*/
public boolean isUseDefaultPane(){
return true;
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return getPlotSeriesPane();
}
public BasicBeanPane<Plot> getPlotSeriesPane(){
return null;
}
public boolean equals(Object obj) {
return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass());
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane();
}
public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
public ChartsConfigPane getChartConfigPane(String plotID){return null;}
}

28
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -2,7 +2,7 @@ package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
@ -17,7 +17,7 @@ import com.fr.stable.StableUtils;
/**
* Created by Mitisky on 16/3/7.
*/
public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider {
public abstract class AbstractIndependentChartUIWithAPILevel implements ChartTypeUIProvider {
//这个不能改,是做兼容用的
//2016.10.14-11.24号的8.0jar因为改了这个为3,不会提示5.26号之前的插件更新
private static final int OLD_PLUGIN_LEVEL = -2;
@ -37,6 +37,22 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
return new ChartDataPane(listener);
}
//todo@bjornrefactor 适配旧版本图表后 删掉下面两个方法
@Override
public String getName() {
return null;
}
@Override
public String[] getSubName() {
return new String[0];
}
@Override
public String[] getDemoImagePath() {
return new String[0];
}
/**
* 是否使用默认的界面为了避免界面来回切换
* @return 是否使用默认的界面
@ -66,14 +82,6 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
return new DataSeriesConditionPane();
}
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return getPlotTypePane().title4PopupWindow();
}
public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
public ChartsConfigPane getChartConfigPane(String plotID){return null;}

27
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java

@ -3,7 +3,7 @@ package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
@ -26,8 +26,19 @@ import com.fr.stable.fun.mark.API;
* 用户使用第三方图表需要继承的面板抽象类
*/
@API(level = IndependentChartUIProvider.CURRENT_API_LEVEL)
public abstract class AbstractIndependentChartsUI extends AbstractProvider implements IndependentChartUIProvider {
@Deprecated
@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL)
public abstract class AbstractIndependentChartsUI extends AbstractProvider implements ChartTypeUIProvider {
@Override
public String getName() {
return null;
}
@Override
public String[] getSubName() {
return new String[0];
}
public String mark4Provider() {
return getClass().getName();
@ -96,16 +107,6 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple
return "com/fr/design/images/form/toolbar/ChartF-Column.png";
}
@Override
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return getPlotTypePane().title4PopupWindow();
}
@Override
public ChartEditPane getChartEditPane(String plotID) {
return new ChartsEditPane();

97
designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java

@ -1,97 +0,0 @@
package com.fr.design.chart.gui;
import java.util.HashMap;
import java.util.Map;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.chart.chartglyph.ChartGlyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.chart.chartglyph.RangeAxisGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.AlertValueActiveGlyph;
import com.fr.design.chart.gui.active.CategoryAxisActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.chart.gui.active.DataLabelActiveGlyph;
import com.fr.design.chart.gui.active.DataSeriesActiveGlyph;
import com.fr.design.chart.gui.active.DataSheetActiveGlyph;
import com.fr.design.chart.gui.active.DateAxisActiveGlyph;
import com.fr.design.chart.gui.active.LegendActiveGlyph;
import com.fr.design.chart.gui.active.PlotActiveGlyph;
import com.fr.design.chart.gui.active.RadarAxisActiveGlyph;
import com.fr.design.chart.gui.active.RangeAxisActiveGlyph;
import com.fr.design.chart.gui.active.TextActiveGlyph;
import com.fr.design.chart.gui.active.TrendLineActiveGlyph;
import com.fr.design.chart.gui.active.ValueAxisActiveGlyph;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-23
* Time : 上午9:08
*/
public class ActiveGlyphFactory {
private static Map<String, Class> glyphMap = new HashMap<String, Class>();
static {
glyphMap.put(DataSeries.class.getName(), DataSeriesActiveGlyph.class);
glyphMap.put(RadarAxisGlyph.class.getName(), RadarAxisActiveGlyph.class);
glyphMap.put(RangeAxisGlyph.class.getName(), RangeAxisActiveGlyph.class);
glyphMap.put(TitleGlyph.class.getName(), TextActiveGlyph.class);
glyphMap.put(DateAxisGlyph.class.getName(), DateAxisActiveGlyph.class);
glyphMap.put(ValueAxisGlyph.class.getName(), ValueAxisActiveGlyph.class);
glyphMap.put(CategoryAxisGlyph.class.getName(), CategoryAxisActiveGlyph.class);
glyphMap.put(ChartGlyph.class.getName(), ChartActiveGlyph.class);
glyphMap.put(DataSheetGlyph.class.getName(), DataSheetActiveGlyph.class);
glyphMap.put(LegendGlyph.class.getName(), LegendActiveGlyph.class);
glyphMap.put(TextGlyph.class.getName(), DataLabelActiveGlyph.class);
glyphMap.put(TrendLineGlyph.class.getName(), TrendLineActiveGlyph.class);
glyphMap.put(ChartAlertValueGlyph.class.getName(), AlertValueActiveGlyph.class);
}
private ActiveGlyphFactory() {
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph) {
return createActiveGlyph(chartComponent, glyph, null);
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph, Glyph parentGlyph) {
if (glyph == null) {
return null;
}
String clsName = glyph.getClass().getName();
Class cls = glyphMap.get(clsName);
Class parameterCls = glyph.getClass();
if (cls == null) {
if (clsName.endsWith("PlotGlyph")) {
cls = PlotActiveGlyph.class;
parameterCls = PlotGlyph.class;
} else if (clsName.endsWith("DataSeries4Area")) {
cls = DataSeriesActiveGlyph.class;
parameterCls = DataSeries.class;
} else {
cls = ChartActiveGlyph.class;
parameterCls = ChartGlyph.class;
}
}
try {
Class[] argsClass = new Class[]{ChartComponent.class, parameterCls, Glyph.class};
return (ActiveGlyph) cls.getConstructor(argsClass).newInstance(new Object[]{chartComponent, glyph, parentGlyph});
} catch (Exception e) {
return null;
}
}
}

112
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -2,36 +2,26 @@ package com.fr.design.chart.gui;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.script.Calculator;
import com.fr.stable.core.PropertyChangeListener;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.util.ArrayList;
import java.util.List;
@ -45,21 +35,10 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private static final long serialVersionUID = 744164838619052097L;
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design;
private Chart editingChart;
private BaseChartGlyph chartGlyph;
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
private final int[] resizeCursors = new int[]{
Cursor.NW_RESIZE_CURSOR, Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR,
Cursor.E_RESIZE_CURSOR, Cursor.W_RESIZE_CURSOR,
Cursor.SE_RESIZE_CURSOR, Cursor.S_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR
};
private boolean supportEdit = true;
public ChartComponent() {
super();
@ -111,16 +90,9 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
public void reset() {
fireStopEditing();
this.editingChart = null;
this.chartGlyph = null;
this.activeGlyph = null;
this.point = null;
this.chartHeight = this.chartWidth = -1;
this.editingChart = this.chartCollection4Design.getSelectedChart();
refreshChartGlyph();
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
repaint();
}
@ -162,14 +134,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount();
}
public ChartProvider getEditingChart() {
return editingChart;
}
public BaseChartGlyph getChartGlyph() {
return chartGlyph;
}
public void paintComponent(Graphics g) { //
super.paintComponent(g);
@ -192,12 +156,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//画图
drawChartGlyph(g2d);
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.paint4ActiveGlyph(g2d, chartGlyph);
}
drawChart(g2d);
g2d.translate(-ChartConstants.PREGAP4BOUNDS/2, -ChartConstants.PREGAP4BOUNDS/2);
if (lastHint == null) {
@ -212,24 +171,10 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
*/
private void refreshChartGlyph() {
Dimension d = getBounds().getSize();
this.editingChart = this.chartCollection4Design.getSelectedChart();// kunsnat: 切换选中时 同步切换Plot
if (editingChart != null) {
this.chartGlyph = editingChart.createGlyph(editingChart.defaultChartData());
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
}
this.chartWidth = d.width - ChartConstants.PREGAP4BOUNDS;
this.chartHeight = d.height - ChartConstants.PREGAP4BOUNDS;
}
private ActiveGlyph getActiveGlyph() {
if (point == null) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph);
} else {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
return this.activeGlyph;
}
/**
* 鼠标点击
* @param event 鼠标事件
@ -243,16 +188,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mousePressed(MouseEvent e) {
point = new Point(e.getX(),e.getY());
if (!ArrayUtils.contains(resizeCursors, this.getCursor().getType())) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
if (this.activeGlyph == null) {
return;
}
repaint();
}
@ -291,47 +227,23 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mouseMoved(MouseEvent e) {
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.onMouseMove(e);
}
}
public AxisGlyph getActiveAxisGlyph() {
return (AxisGlyph) activeGlyph.getGlyph();
}
public Axis getActiveAxis() {
AxisGlyph axisGlyph = getActiveAxisGlyph();
if (editingChart.getPlot() != null) {
return editingChart.getPlot().getAxis(axisGlyph.getAxisType());
}
return null;
}
private boolean needRefreshChartGlyph() {
return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
return chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
}
public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
} else {
chartGlyph.setBounds(new Rectangle2D.Double(0, 0, chartWidth, chartHeight));
}
private void drawChart(Graphics2D g2d) {
if (chartCollection4Design != null) {
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
BaseChartPainter painter = chartCollection4Design.createResultChartPainter(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight);
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
g2d.drawImage(chartImage, 0, 0, null);
painter.paint(g2d, chartWidth, chartHeight, resolution, null);
}
}

2
designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java

@ -37,7 +37,7 @@ public class ChartWidgetOption extends WidgetOption {
Class<? extends ChartEditor> clz = widgetClass();
try {
ChartEditor widget = clz.newInstance();
widget.setChartCollection(BaseChartGetter.createChartCollection(this.chartID));
widget.resetChangeChartCollection(BaseChartGetter.createChartCollection(this.chartID));
return widget;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

161
designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java

@ -1,161 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ActiveGlyphFactory;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:51
* 选中的Glyph
*/
public abstract class ActiveGlyph {
protected Glyph parentGlyph;
protected ChartComponent chartComponent;
public ActiveGlyph(ChartComponent chartComponent, Glyph parentGlyph) {
this.chartComponent = chartComponent;
this.parentGlyph = parentGlyph;
}
public abstract Glyph getGlyph();
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.getGlyph().draw(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
/**
* 属性表中, 通过点击 展开到对应的界面.
*/
public abstract void goRightPane();
/**
* 画的偏移的
* @return 偏移的
*/
public Point2D offset4Paint() {
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX(),
this.parentGlyph.getShape().getBounds().getY()
);
}
public void paint4ActiveGlyph(Graphics2D g2d, BaseChartGlyph chartGlyph) {
if(this.parentGlyph == null) {
return;
}
Paint oldPaint = g2d.getPaint();
Composite oldComposite = g2d.getComposite();
g2d.setPaint(Color.WHITE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2d.fill(chartGlyph.getShape());
drawAllGlyph(g2d, ScreenResolution.getScreenResolution());
g2d.setPaint(oldPaint);
g2d.setComposite(oldComposite);
}
protected void drawSelectedBounds4Active(Graphics2D g2d) {
if (this.getGlyph() != null) {
Shape shape = this.getGlyph().getShape();
if (shape != null) {
g2d.draw(shape);
}
}
}
/**
*当前的ActiveGlyph是否包含坐标mouseX, mouseY
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 包含则返回true
*/
public boolean contains(int mouseX, int mouseY) {
if (getGlyph() == null || getGlyph().getShape() == null){
return false;
}
Point2D offset = this.offset4Paint();
/*
* alex:因为Line2D.contains(x, y)必然返回false
* 所以用intersect一个区域,这个区域大小用4 * 4的,区域大一些,就灵敏一些
*/
return getGlyph().getShape().intersects(mouseX - offset.getX() - 2, mouseY - offset.getY() - 2, 4, 4);
}
/**
* 在当前选中的ActiveGlyph中,仅仅在其Children中找与mouseX, mouseY匹配的ActiveGlyph
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 当前ativeGlyph
*/
public ActiveGlyph findActionGlyphFromChildren(int mouseX, int mouseY) {
Glyph currentGlyph = getGlyph();
// 报错应对.
if (currentGlyph == null) {
return null;
}
java.util.Iterator selectableChildren = currentGlyph.selectableChildren();
ActiveGlyph resAG = null;
while (selectableChildren.hasNext() && resAG == null) {
ActiveGlyph childActiveGlyph = ActiveGlyphFactory.createActiveGlyph(chartComponent, selectableChildren.next(), currentGlyph);
// 如果childActiveGlyph不为null,找一下其子辈有没有符合条件
if (childActiveGlyph != null) {
resAG = childActiveGlyph.findActionGlyphFromChildren(mouseX, mouseY);
}
// 如果childActiveGlyph的子辈没有符合条件的,就看一下这个childGlyph是否符合条件
if (resAG == null && childActiveGlyph != null && childActiveGlyph.contains(mouseX, mouseY)) {
resAG = childActiveGlyph;
}
}
// 如果当前ActiveGlyph的所有子辈都没有与mouseX, mouseY相匹配的,看一下它自己是否匹配
if (resAG == null) {
if (this.contains(mouseX, mouseY)) {
resAG = this;
}
}
return resAG;
}
/**
* 拖拽
* @param e 事件
*/
public void onMouseDragged(MouseEvent e) {
}
/**
* 移动事件
* @param e 事件
*/
public void onMouseMove(MouseEvent e) {
}
}

38
designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java

@ -1,38 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class AlertValueActiveGlyph extends ActiveGlyph{
ChartAlertValueGlyph alertValueGlyph;
public AlertValueActiveGlyph(ChartComponent chartComponent,ChartAlertValueGlyph alertLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.alertValueGlyph = alertLine;
}
public Point2D offset4Paint() {
Rectangle2D valueAxisBoudns = this.alertValueGlyph.getValueAxisGlyph().getBounds();
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX() + valueAxisBoudns.getX(),
this.parentGlyph.getShape().getBounds().getY() + valueAxisBoudns.getY()
);
}
@Override
public Glyph getGlyph() {
return this.alertValueGlyph;
}
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAxisStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:00
*/
public abstract class AxisActiveGlyph extends ActiveGlyph {
protected AxisGlyph axis;
public AxisActiveGlyph(ChartComponent chartComponent, AxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.axis = axis;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.axis.drawWithOutAlert(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
public void goRightPane() {
new SetAxisStyleAction(chartComponent).showAxisStylePane();
}
/**
* 返回 对应的属性Axis
*/
public Glyph getGlyph() {
return this.axis;
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:01
*/
public class CategoryAxisActiveGlyph extends AxisActiveGlyph {
public CategoryAxisActiveGlyph(ChartComponent chartComponent, CategoryAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

39
designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java

@ -1,39 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetChartStyleAciton;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:54
*/
public class ChartActiveGlyph extends ActiveGlyph {
private BaseChartGlyph glyphChart;
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart) {
this(chartComponent, chart, null);
}
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.glyphChart = chart;
}
public Glyph getGlyph() {
return this.glyphChart;
}
public Point2D offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetChartStyleAciton(chartComponent).showChartStylePane();
}
}

44
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java

@ -1,44 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataLabelStyleAction;
public class DataLabelActiveGlyph extends ActiveGlyph{
private TextGlyph dataLabel;
public DataLabelActiveGlyph(ChartComponent chartComponent, TextGlyph dataLabel, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataLabel = dataLabel;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
ArrayList<TextGlyph> allDataPointLableGlyph = new ArrayList<TextGlyph>();
PlotGlyph plotGlyph = (PlotGlyph)(this.parentGlyph);
plotGlyph.getAllDataPointGlyph(allDataPointLableGlyph);
for(int index = 0; index < allDataPointLableGlyph.size(); index++){
allDataPointLableGlyph.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public Glyph getGlyph() {
return this.dataLabel;
}
@Override
public void goRightPane() {
new SetDataLabelStyleAction(chartComponent).showDataLabelStylePane();
}
}

53
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java

@ -1,53 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:59
*/
public class DataSeriesActiveGlyph extends ActiveGlyph {
private DataSeries series;
public DataSeriesActiveGlyph(ChartComponent chartComponent, DataSeries series, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.series = series;
}
public Glyph getGlyph() {
return this.series;
}
/**
* 界面条状
*/
public void goRightPane() {
if(chartComponent.getEditingChart() == null) {
return;
}
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE);
}
@Override
public void drawAllGlyph(Graphics2D g2d, int resolution) {
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
if(this.parentGlyph != null && this.parentGlyph instanceof PlotGlyph){
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
plotGlyph.drawShape4Series(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataSheetAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class DataSheetActiveGlyph extends ActiveGlyph {
private DataSheetGlyph dataSheetGlyph;
public DataSheetActiveGlyph(ChartComponent chartComponent, DataSheetGlyph dataSheetGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataSheetGlyph = dataSheetGlyph;
}
public Glyph getGlyph() {
return this.dataSheetGlyph;
}
public void goRightPane() {
new SetDataSheetAction(chartComponent).showDataSheetStylePane();
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class DateAxisActiveGlyph extends AxisActiveGlyph {
public DateAxisActiveGlyph(ChartComponent chartComponent, DateAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetLegendStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:58
*/
public class LegendActiveGlyph extends ActiveGlyph {
private LegendGlyph legendGlyph;
public LegendActiveGlyph(ChartComponent chartComponent, LegendGlyph legendGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.legendGlyph = legendGlyph;
}
public Glyph getGlyph() {
return this.legendGlyph;
}
public void goRightPane() {
new SetLegendStyleAction(chartComponent).showLegendStylePane();
}
}

34
designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java

@ -1,34 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetPlotStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:55
*/
public class PlotActiveGlyph extends ActiveGlyph {
private PlotGlyph plotGlyph;
public PlotActiveGlyph(ChartComponent chartComponent, PlotGlyph plotGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.plotGlyph = plotGlyph;
}
public Glyph getGlyph() {
return this.plotGlyph;
}
public void goRightPane() {
new SetPlotStyleAction(chartComponent).showPlotPane();
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class RadarAxisActiveGlyph extends AxisActiveGlyph {
public RadarAxisActiveGlyph(ChartComponent chartComponent, RadarAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class RangeAxisActiveGlyph extends AxisActiveGlyph {
public RangeAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

35
designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java

@ -1,35 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetTitleStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class TextActiveGlyph extends ActiveGlyph {
private TitleGlyph titleGlyph;
public TextActiveGlyph(ChartComponent chartComponent, TitleGlyph titleGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.titleGlyph = titleGlyph;
}
public Glyph getGlyph() {
return this.titleGlyph;
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetTitleStyleAction(chartComponent).showTitlePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class TrendLineActiveGlyph extends ActiveGlyph{
private TrendLineGlyph trendLine;
public TrendLineActiveGlyph(ChartComponent chartComponent,TrendLineGlyph trendLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.trendLine = trendLine;
}
@Override
public Glyph getGlyph() {
return this.trendLine;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
List<TrendLineGlyph> list = new ArrayList<TrendLineGlyph>();
plotGlyph.getAllTrendLineGlyph(list);
for(int index = 0; index < list.size(); index++){
list.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class ValueAxisActiveGlyph extends AxisActiveGlyph {
public ValueAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

37
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java

@ -1,37 +0,0 @@
package com.fr.design.chart.gui.active.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.actions.UpdateAction;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:05
*/
public abstract class ChartComponentAction extends UpdateAction {
protected ChartComponent chartComponent;
public ChartComponentAction(ChartComponent chartComponent) {
this.chartComponent = chartComponent;
}
public void reset() {
chartComponent.reset();
}
public void repaint() {
chartComponent.repaint();
}
public ChartCollection getChartCollection() {
return chartComponent.getChartCollection();
}
public AxisGlyph getActiveAxisGlyph() {
return chartComponent.getActiveAxisGlyph();
}
}

27
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java

@ -1,27 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetAnalysisLineStyleAction extends ChartComponentAction{
public SetAnalysisLineStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Analysis_Line"));
}
@Override
public void actionPerformed(ActionEvent e) {
showAnalysisLineStylePane();
}
public void showAnalysisLineStylePane(){
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
import com.fr.stable.StringUtils;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:10
*/
public class SetAxisStyleAction extends ChartComponentAction {
public SetAxisStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Axis_Format"));
}
public void actionPerformed(ActionEvent e) {
showAxisStylePane();
}
public void showAxisStylePane() {
String axisType = getActiveAxisGlyph() == null ? StringUtils.EMPTY : getActiveAxisGlyph().getAxisType();
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType);
}
}

31
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java

@ -1,31 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:00
*/
public class SetChartStyleAciton extends ChartComponentAction {
public SetChartStyleAciton(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pattern"));
}
public void actionPerformed(ActionEvent e) {
showChartStylePane();
}
public void showChartStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE);
}
}

26
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java

@ -1,26 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetDataLabelStyleAction extends ChartComponentAction{
public SetDataLabelStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Label"));
}
@Override
public void actionPerformed(ActionEvent e) {
showDataLabelStylePane();
}
public void showDataLabelStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:49
*/
public class SetDataSheetAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetDataSheetAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Sheet"));
}
public void actionPerformed(ActionEvent e) {
showDataSheetStylePane();
}
public void showDataSheetStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:56
*/
public class SetLegendStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 3253190503195130478L;
public SetLegendStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Legend_Sytle"));
}
public void actionPerformed(ActionEvent e) {
showLegendStylePane();
}
public void showLegendStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:58
*/
public class SetPlotStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 2894127568015714372L;
public SetPlotStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Plot"));
}
public void actionPerformed(ActionEvent e) {
showPlotPane();
}
public void showPlotPane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:52
*/
public class SetTitleStyleAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetTitleStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Title_Style"));
}
public void actionPerformed(ActionEvent e) {
showTitlePane();
}
public void showTitlePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE);
}
}

6
designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java

@ -182,11 +182,7 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapRepo
String addressName = addressNamePane.updateBean();
if (addressName != null && !StringUtils.isBlank(addressName)) {
if (StableUtils.canBeFormula(addressName)) {
reportDefinition.setAddressName(addressName);
} else {
reportDefinition.setAddressName(addressName);
}
reportDefinition.setAddressName(addressName);
}
List values = seriesPane.updateBean();
if (values != null && !values.isEmpty()) {

8
designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java

@ -341,12 +341,8 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane<GisMapTable
titleValuePane.stopCellEditing();
}
});
if (value != null && StringUtils.isNotEmpty(value.toString())) {
box.setSelectedItem(value);
} else {
box.setSelectedItem(value);
}
box.setSelectedItem(value);
this.editorComponent = box;
}

8
designer-chart/src/main/java/com/fr/design/chart/report/MapMoreTableIndexPane.java

@ -179,12 +179,8 @@ public class MapMoreTableIndexPane extends BasicBeanPane<MapSingleLayerTableDefi
tabPane.stopCellEditing();
}
});
if (value != null && StringUtils.isNotEmpty(value.toString())) {
box.setSelectedItem(value);
} else {
box.setSelectedItem(value);
}
box.setSelectedItem(value);
editorComponent = box;
}

8
designer-chart/src/main/java/com/fr/design/chart/report/MapTableDataSinglePane.java

@ -254,12 +254,8 @@ public class MapTableDataSinglePane extends FurtherBasicBeanPane<MapSingleLayerT
titleValuePane.stopCellEditing();
}
});
if (value != null && StringUtils.isNotEmpty(value.toString())) {
box.setSelectedItem(value);
} else {
box.setSelectedItem(value);
}
box.setSelectedItem(value);
this.editorComponent = box;
}

3
designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java

@ -348,9 +348,6 @@ public class UIGroupExtensionPane extends BasicPane {
boolean isSelected,
boolean cellHasFocus) {
JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (!hasEditOperation(list)) {
return c;
}
Border border = null;
c.setBorder(border);
UILabel editLabel = new UILabel(UIConstants.EDIT_ICON);

30
designer-chart/src/main/java/com/fr/design/chartx/MultiCategoryChartDataPane.java → designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java

@ -1,24 +1,30 @@
package com.fr.design.chartx;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import javax.swing.JPanel;
/**
* Created by shine on 2019/5/22.
* Created by shine on 2019/09/06.
*/
public class MultiCategoryChartDataPane extends AbstractChartDataPane<AbstractDataDefinition> {
public abstract class AbstractVanSingleDataPane extends AbstractChartDataPane<AbstractDataDefinition> {
private SingleDataPane singleDataPane;
public MultiCategoryChartDataPane(AttributeChangeListener listener) {
public AbstractVanSingleDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected JPanel createContentPane() {
singleDataPane = createSingleDataPane();
return singleDataPane;
}
protected abstract SingleDataPane createSingleDataPane();
@Override
protected void populate(AbstractDataDefinition dataDefinition) {
singleDataPane.populateBean(dataDefinition);
@ -28,16 +34,4 @@ public class MultiCategoryChartDataPane extends AbstractChartDataPane<AbstractDa
protected AbstractDataDefinition update() {
return singleDataPane.updateBean();
}
@Override
protected JPanel createContentPane() {
singleDataPane = createSingleDataPane();
return singleDataPane;
}
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
}

25
designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java

@ -1,6 +1,9 @@
package com.fr.design.chartx;
import com.fr.chartx.data.GanttChartDataDefinition;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.van.chart.map.designer.VanChartGroupPane;
@ -11,13 +14,23 @@ import javax.swing.JPanel;
*/
public class GanttChartDataPane extends AbstractChartDataPane<GanttChartDataDefinition> {
private MultiCategoryChartDataPane dataPane;
private MultiCategoryChartDataPane linkPane;
private AbstractVanSingleDataPane dataPane;
private AbstractVanSingleDataPane linkPane;
@Override
protected JPanel createContentPane() {
dataPane = new MultiCategoryChartDataPane(listener);
linkPane = new MultiCategoryChartDataPane(listener);
dataPane = new AbstractVanSingleDataPane(listener) {
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
};
linkPane = new AbstractVanSingleDataPane(listener) {
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
};
return new VanChartGroupPane(new String[]{"data", "link"}, new JPanel[]{dataPane, linkPane}) {
};
}
@ -27,13 +40,13 @@ public class GanttChartDataPane extends AbstractChartDataPane<GanttChartDataDefi
}
@Override
protected void populate(GanttChartDataDefinition ganttChartDataDefinition) {
public void populate(GanttChartDataDefinition ganttChartDataDefinition) {
dataPane.populate(ganttChartDataDefinition.getDataDefinition());
linkPane.populate(ganttChartDataDefinition.getLinkDefinition());
}
@Override
protected GanttChartDataDefinition update() {
public GanttChartDataDefinition update() {
return null;
}
}

21
designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java

@ -1,21 +0,0 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiPieDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* Created by shine on 2019/6/18.
*/
public class MultiPieChartDataPane extends MultiCategoryChartDataPane {
public MultiPieChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane());
}
}

20
designer-chart/src/main/java/com/fr/design/chartx/WordCloudChartDataPane.java

@ -1,20 +0,0 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.WordCloudCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.WordCloudDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* Created by shine on 2019/5/22.
*/
public class WordCloudChartDataPane extends MultiCategoryChartDataPane {
public WordCloudChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane());
}
}

3
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java

@ -7,6 +7,7 @@ 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.ChartDataPane;
import com.fr.stable.AssistUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -59,7 +60,7 @@ public abstract class AbstractMultiComponentPaneWithUISpinner<T extends JCompone
@Override
public void setTextFieldValue(double value) {
//如果为0,则没有改变值
if (value == 0) {
if (AssistUtils.equals(value,0)) {
return;
}
super.setTextFieldValue(value);

86
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java

@ -0,0 +1,86 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.StructureColumnFieldCollection;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-02
*/
public class StructureCellDataFieldsPane extends AbstractCellDataFieldsPane<StructureColumnFieldCollection> {
private TinyFormulaPane nodeName;
private TinyFormulaPane nodeId;
private TinyFormulaPane parentId;
private UITextField seriesName;
private TinyFormulaPane nodeValue;
@Override
protected void initComponents() {
seriesName = new UITextField();
nodeName = new TinyFormulaPane();
nodeId = new TinyFormulaPane();
parentId = new TinyFormulaPane();
nodeValue = new TinyFormulaPane();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Node_Name"),
"id",
Toolkit.i18nText("Fine-Design_Chart_Parent_ID"),
Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value"),
};
}
@Override
protected TinyFormulaPane[] formulaPanes() {
return new TinyFormulaPane[]{
nodeName,
nodeId,
parentId,
nodeValue
};
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
nodeName,
nodeId,
parentId,
nodeValue,
nodeValue,
};
}
@Override
public void populateBean(StructureColumnFieldCollection ob) {
seriesName.setText(ob.getSeriesName());
populateField(nodeName, ob.getNodeName());
populateField(nodeId, ob.getNodeId());
populateField(parentId, ob.getParentId());
populateField(nodeValue, ob.getNodeValue());
}
@Override
public StructureColumnFieldCollection updateBean() {
StructureColumnFieldCollection result = new StructureColumnFieldCollection();
result.setSeriesName(seriesName.getText());
updateField(nodeName, result.getNodeName());
updateField(nodeId, result.getNodeId());
updateField(parentId, result.getParentId());
updateField(nodeValue, result.getNodeValue());
return result;
}
}

91
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureDataSetFieldsPane.java

@ -0,0 +1,91 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.StructureColumnFieldCollection;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-02
*/
public class StructureDataSetFieldsPane extends AbstractDataSetFieldsPane<StructureColumnFieldCollection> {
private UIComboBox nodeName;
private UIComboBox nodeId;
private UIComboBox parentId;
private UITextField seriesName;
private UIComboBox nodeValue;
private CalculateComboBox calculateCombox;
@Override
protected void initComponents() {
nodeName = new UIComboBox();
nodeId = new UIComboBox();
parentId = new UIComboBox();
seriesName = new UITextField();
nodeValue = new UIComboBox();
calculateCombox = new CalculateComboBox();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Node_Name"),
"id",
Toolkit.i18nText("Fine-Design_Chart_Parent_ID"),
Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value"),
Toolkit.i18nText("Fine-Design_Chart_Summary_Method")
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
return new UIComboBox[]{
nodeName,
nodeId,
parentId,
nodeValue
};
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
nodeName,
nodeId,
parentId,
nodeValue,
nodeValue,
calculateCombox
};
}
@Override
public void populateBean(StructureColumnFieldCollection ob) {
seriesName.setText(ob.getSeriesName());
populateField(nodeName, ob.getNodeName());
populateField(nodeId, ob.getNodeId());
populateField(parentId, ob.getParentId());
populateFunctionField(nodeValue, calculateCombox, ob.getNodeValue());
}
@Override
public StructureColumnFieldCollection updateBean() {
StructureColumnFieldCollection result = new StructureColumnFieldCollection();
result.setSeriesName(seriesName.getText());
updateField(nodeName, result.getNodeName());
updateField(nodeId, result.getNodeId());
updateField(parentId, result.getParentId());
updateFunctionField(nodeValue, calculateCombox, result.getNodeValue());
return result;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save