Browse Source

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

fbp/release
Kobi 2 months ago
parent
commit
afc912a6c6
  1. 37
      designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java
  2. 5
      designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java
  3. 30
      designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java
  4. 2
      designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java
  5. 2
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  6. 7
      designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java
  7. 47
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  8. 12
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  9. 16
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  10. 21
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  11. 17
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java
  12. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java
  13. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java
  14. 26
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  15. 4
      designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java
  16. 26
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  17. 3
      designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java
  18. 11
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  19. 135
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  20. 10
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  21. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  22. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  23. 5
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java
  24. 5
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  25. 16
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  26. 19
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  27. 4
      designer-base/src/main/java/com/fr/design/javascript/EmailPane.java
  28. 2
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  29. 3
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  30. 2
      designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java
  31. 4
      designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java
  32. 21
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  33. 27
      designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java
  34. 16
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  35. 18
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  36. 44
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  37. 20
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java
  38. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java
  39. 9
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java
  40. 45
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  41. 19
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java
  42. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  43. 18
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  44. 20
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  45. 16
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  46. 11
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  47. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  48. 21
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  49. 6
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java
  50. 14
      designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java
  51. 13
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  52. 2
      designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java
  53. 21
      designer-base/src/main/java/com/fr/design/style/AlphaPane.java
  54. 14
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  55. 19
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  56. 3
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  57. 4
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  58. 14
      designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java
  59. 5
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java
  60. 1
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties
  61. 21
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  62. 46
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java
  63. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  64. 29
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  65. 114
      designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java
  66. 23
      designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java
  67. 47
      designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java
  68. 77
      designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java
  69. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java
  70. 110
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java
  71. 36
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java
  72. 32
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java
  73. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java
  74. 11
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java
  75. 32
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java
  76. 27
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java
  77. 42
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java
  78. 20
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java
  79. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java
  80. 14
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  81. 23
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java
  82. 2
      designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java
  83. 23
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  84. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java
  85. 10
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java

37
designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java

@ -0,0 +1,37 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatComboBoxUI;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
/**
* {@link com.fr.design.gui.icombocheckbox.UIComboCheckBox} UI 样式
*
* @author lemon
* @since 12.0
* Created on 2024/09/27
*/
public class FineComboCheckBoxUI extends FlatComboBoxUI {
public FineComboCheckBoxUI() {
super();
}
/**
* 创建UI
*/
public static ComponentUI createUI(JComponent c) {
return new FineComboCheckBoxUI();
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
c.setBackground(UIManager.getColor("ComboCheckBox.background"));
c.setBorder(UIManager.getBorder("ComboCheckBox.border"));
}
}

5
designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java

@ -50,6 +50,11 @@ public class FineSliderUI extends FlatSliderUI {
defaultLabelHeight = FineUIUtils.getAndScaleInt("Slider.labelHeight", DEFAULT_LABEL_HEIGHT); defaultLabelHeight = FineUIUtils.getAndScaleInt("Slider.labelHeight", DEFAULT_LABEL_HEIGHT);
} }
@Override
protected Color getTrackColor() {
return trackColor;
}
@Override @Override
protected void calculateLabelRect() { protected void calculateLabelRect() {

30
designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java

@ -1,12 +1,22 @@
package com.fine.theme.utils; package com.fine.theme.utils;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.FormatField;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.Color;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.flex;
@ -62,4 +72,24 @@ public class FineComponentsFactory {
flex(), cell(confirmButton), cell(cancelButton)).getComponent(); flex(), cell(confirmButton), cell(cancelButton)).getComponent();
} }
/**
* 创建示例文本圆角边框&浅灰背景
*
* @return 示例文本Label
*/
public static UILabel createSampleLabel() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption");
Border interBorder = new UIRoundedBorder(labelColor, 0, 4);
Border border = BorderFactory.createTitledBorder(interBorder, Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"),
TitledBorder.ABOVE_TOP, 0, null, labelColor);
UILabel sampleLabel = new UILabel(FormatField.getInstance().getFormatValue());
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(BorderFactory.createCompoundBorder(border, new ScaledEmptyBorder(2, 0, 8, 0)));
FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP);
return sampleLabel;
}
} }

2
designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java

@ -6,6 +6,8 @@ import com.fine.swing.ui.layout.Row;
import com.fine.swing.ui.layout.Spacer; import com.fine.swing.ui.layout.Spacer;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.collections.combination.Pair; import com.fr.stable.collections.combination.Pair;

2
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -41,6 +41,7 @@ public interface FineUIStyle {
String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_TOOL_BAR = "popupMenuToolBar";
String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu";
String TRANSPARENT_TEXT_FIELD = "transparentTextField"; String TRANSPARENT_TEXT_FIELD = "transparentTextField";
String OFFET_LEFT_TEXT_FIELD = "offsetLeftText";
String TRANSPARENT_BACKGROUND = "transparentBackground"; String TRANSPARENT_BACKGROUND = "transparentBackground";
String PURE_LIST = "pureList"; String PURE_LIST = "pureList";
String NO_BORDER_LIST = "noBorderList"; String NO_BORDER_LIST = "noBorderList";
@ -51,6 +52,7 @@ public interface FineUIStyle {
String DEFAULT_TABLE = "defaultTable"; String DEFAULT_TABLE = "defaultTable";
String WHITE_BUTTON = "whiteButton"; String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton"; String ORIGINAL_BUTTON = "originalButton";
String PLAIN_ARROW_BUTTON = "plainArrowButton";
String GRAY_BUTTON = "grayButton"; String GRAY_BUTTON = "grayButton";
String DETAIL_LABEL = "detailLabel"; String DETAIL_LABEL = "detailLabel";
String WIDGET_EVENT_LABEL = "widgetEventLabel"; String WIDGET_EVENT_LABEL = "widgetEventLabel";

7
designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java

@ -4,14 +4,14 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.FRContext; import com.fanruan.entity.template.TemplateListBean;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -153,8 +153,7 @@ public class LocalePane extends BasicPane {
} }
private void initCustomProperties() throws Exception { private void initCustomProperties() throws Exception {
FileNode[] fileNodes = TemplateRepository.getInstance().list(new TemplateListBean(ProjectConstants.LOCALE_NAME));
FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME);
if (ArrayUtils.getLength(fileNodes) == 0) { if (ArrayUtils.getLength(fileNodes) == 0) {
return; return;
} }

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

@ -35,7 +35,6 @@ import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
@ -55,7 +54,6 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.ReportConfigManager; import com.fr.report.ReportConfigManager;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.guava.collect.BiMap; import com.fr.third.guava.collect.BiMap;
import com.fr.third.guava.collect.HashBiMap; import com.fr.third.guava.collect.HashBiMap;
@ -63,38 +61,18 @@ import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.transaction.WorkerAdaptor; import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.vcs.VcsTaskBean;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsConfig;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.git.config.GcConfig;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.BoxLayout; import javax.swing.*;
import javax.swing.ButtonGroup;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.KeyStroke;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -110,12 +88,9 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -541,7 +516,7 @@ public class PreferencePane extends BasicPane {
new SwingWorker<Boolean, Void>() { new SwingWorker<Boolean, Void>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); return VcsRepository.getInstance().isSupport();
} }
@Override @Override
protected void done() { protected void done() {
@ -1175,12 +1150,12 @@ public class PreferencePane extends BasicPane {
if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { if (useVcsAutoCleanScheduleCheckBox.isEnabled()) {
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { if (useVcsAutoCleanScheduleCheckBox.isSelected()) {
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!");
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean(
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME,
getDay(autoCleanIntervalComboBox.getSelectedIndex()), getDay(autoCleanIntervalComboBox.getSelectedIndex()),
VcsAutoCleanSchedule.class); VcsAutoCleanSchedule.class));
} else { } else {
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); VcsRepository.getInstance().stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME);
} }
} }
} }
@ -1238,7 +1213,7 @@ public class PreferencePane extends BasicPane {
@Override @Override
protected Boolean doInBackground() { protected Boolean doInBackground() {
size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(); size = VcsRepository.getInstance().immediatelyGc();
return true; return true;
} }

12
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -1,5 +1,7 @@
package com.fr.design.actions.file.export; package com.fr.design.actions.file.export;
import com.fanruan.entity.template.TemplateExportBean;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -18,12 +20,8 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.third.jodd.io.FileNameUtil; import com.fr.third.jodd.io.FileNameUtil;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.TemplateExportOperator;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Map; import java.util.Map;
@ -215,9 +213,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
path = path.substring(ProjectConstants.REPORTLETS_NAME.length()); path = path.substring(ProjectConstants.REPORTLETS_NAME.length());
} }
byte[] contents = byte[] contents = TemplateRepository.getInstance().export(new TemplateExportBean().setKey(exportKey()).setType(exportType()).setPath(path).setParas(para));
WorkContext.getCurrent().get(TemplateExportOperator.class)
.export(exportKey(), exportType(), null, path, para);
outputStream.write(contents); outputStream.write(contents);
} }

16
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,10 +1,8 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; import com.fine.theme.icon.LazyIcon;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fr.config.remote.RemoteConfigEvent; import com.fr.config.remote.RemoteConfigEvent;
import com.fine.theme.icon.LazyIcon;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
@ -34,14 +32,12 @@ import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.database.DataBaseTypeOperator; import com.fr.workspace.server.repository.WorkplaceConstants;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingWorker; import java.awt.*;
import java.awt.Window;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -86,7 +82,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
SwingWorker<List<String>, Void> getSupportedTypesWorker = new SwingWorker<List<String>, Void>() { SwingWorker<List<String>, Void> getSupportedTypesWorker = new SwingWorker<List<String>, Void>() {
@Override @Override
protected List<String> doInBackground() { protected List<String> doInBackground() {
return WorkContext.getCurrent().get(DataBaseTypeOperator.class).getSupportedDatabaseTypes(); return WorkplaceConstants.getSupportedDatabaseTypes();
} }
@Override @Override
@ -181,7 +177,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
JNDIDatabaseConnection.class, DatabaseConnectionPane.JNDI.class JNDIDatabaseConnection.class, DatabaseConnectionPane.JNDI.class
); );
NameableCreator[] creators; NameableCreator[] creators;
if (WorkContext.getCurrent().get(DataBaseTypeOperator.class).limitDatabaseType()) { if (WorkplaceConstants.isLimitDatabaseType()) {
// 不支持JNDI,屏蔽接口 // 不支持JNDI,屏蔽接口
creators = new NameableCreator[]{jdbc}; creators = new NameableCreator[]{jdbc};
} else { } else {

21
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fanruan.datasource.driver.bean.DriverLoaderBean;
import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
@ -361,7 +362,7 @@ public class JDBCDefPane extends JPanel {
private void initMap() { private void initMap() {
Map<String, DriverLoader> driverLoaders = null; Map<String, DriverLoader> driverLoaders = null;
try { try {
driverLoaders = ConnectionRepository.getInstance().getDriverLoaders(); driverLoaders = toDriverLoaders(ConnectionRepository.getInstance().getDriverLoaders());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
driverLoaders = new HashMap<>(); driverLoaders = new HashMap<>();
@ -370,6 +371,24 @@ public class JDBCDefPane extends JPanel {
nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders);
} }
private Map<String, DriverLoader> toDriverLoaders(Map<String, DriverLoaderBean> driverLoaders) {
Map<String, DriverLoader> map = new HashMap<>();
for (Map.Entry<String, DriverLoaderBean> entry : driverLoaders.entrySet()) {
map.put(entry.getKey(), createDriverLoader(entry.getValue()));
}
return map;
}
private DriverLoader createDriverLoader(DriverLoaderBean value) {
DriverLoader driverLoader = new DriverLoader();
driverLoader.setName(value.getName());
driverLoader.setDriverClass(value.getDriverClass());
driverLoader.setDriverJarFiles(value.getDriverJarFiles());
driverLoader.setLoadingStrategy(value.getLoadingStrategy());
driverLoader.setDriverList(value.getDriverList());
return driverLoader;
}
private HashBiMap<String, String> getDriverLoaderAndRepresent(Map<String, DriverLoader> driverLoaders) { private HashBiMap<String, String> getDriverLoaderAndRepresent(Map<String, DriverLoader> driverLoaders) {
HashBiMap<String, String> driverHashBiMap = HashBiMap.create(); HashBiMap<String, String> driverHashBiMap = HashBiMap.create();
if (WorkContext.getCurrent().isWarDeploy()) { if (WorkContext.getCurrent().isWarDeploy()) {

17
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java

@ -1,7 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting; package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.DesensitizationTableData;
@ -14,7 +13,6 @@ import com.fr.design.data.datapane.preview.desensitization.view.rule.Desensitiza
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -39,7 +37,6 @@ import javax.swing.UIManager;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -57,6 +54,8 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 处理TableDataDesensitizationTablePane中TableEditPane的Model * 处理TableDataDesensitizationTablePane中TableEditPane的Model
* *
@ -367,12 +366,6 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
} }
}); });
setBoxStyle();
}
private void setBoxStyle() {
this.rolesCheckBox.setBorder(new FineRoundBorder());
FineUIStyle.setStyle(this.rolesCheckBox.getEditor(), FineUIStyle.TRANSPARENT_TEXT_FIELD);
} }
@Override @Override
@ -433,7 +426,9 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
protected void setLayoutAndAddComponents() { protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getLabel(), BorderLayout.EAST); JPanel pane = getClickPane();
pane.setOpaque(false);
this.add(pane, BorderLayout.CENTER);
} }
@Override @Override
@ -457,7 +452,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
// 规则状态 // 规则状态
this.ruleStatusLabel = new UILabel(); this.ruleStatusLabel = new UILabel();
this.ruleStatusLabel.setOpaque(true); this.ruleStatusLabel.setOpaque(true);
FineUIStyle.setStyle(ruleStatusLabel, FineUIStyle.LABEL_WARNING_TIP); setStyle(ruleStatusLabel, FineUIStyle.LABEL_WARNING_TIP);
} }
/** /**

12
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java

@ -1,6 +1,5 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting; package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationItem; import com.fr.data.desensitize.base.TableDataDesensitizationItem;
import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.DesensitizationRuleManager;
@ -11,13 +10,10 @@ import com.fr.design.data.tabledata.tabledatapane.loading.TipsPane;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import javax.swing.JPanel; import javax.swing.*;
import javax.swing.SwingWorker; import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -91,7 +87,7 @@ public class TableDataDesensitizationTablePane extends JPanel {
// 获取当前数据集的所有列名 // 获取当前数据集的所有列名
columnNames.addAll(TableDataPreviewDesensitizeManager.getInstance().getColumnNamesByTableData(tableData)); columnNames.addAll(TableDataPreviewDesensitizeManager.getInstance().getColumnNamesByTableData(tableData));
// 获取当前所有用户组 // 获取当前所有用户组
roleMap.putAll(WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization()); roleMap.putAll(RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization());
// 获取当前最新的所有规则 // 获取当前最新的所有规则
latestRules.putAll(DesensitizationRuleManager.getInstance().getAllRules()); latestRules.putAll(DesensitizationRuleManager.getInstance().getAllRules());
return null; return null;

11
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java

@ -6,6 +6,7 @@ import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.datacenters.tabledata.filter.DCFilter; import com.fr.datacenters.tabledata.filter.DCFilter;
import com.fr.datacenters.tabledata.parameter.DCParameter; import com.fr.datacenters.tabledata.parameter.DCParameter;
import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -135,6 +136,16 @@ public class DCTableDataJSBridge {
}).setVisible(true); }).setVisible(true);
} }
/**
* 当前所有数据集名称
*/
@JSBridge
public void getDatasetNames(final JsFunction callback) {
JxUIPane.DEFAULT_EXECUTOR.submit(() ->
callback.invoke(window, EmbedJson.encode(
DesignTableDataManager.getAllDSNames(DesignTableDataManager.getEditingTableDataSource()))));
}
/** /**
* 解析公式参数 * 解析公式参数
*/ */

26
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -1,6 +1,7 @@
package com.fr.design.file; package com.fr.design.file;
import com.fanruan.repository.TemplateRepository;
import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Layouts;
import com.fine.swing.ui.layout.Row; import com.fine.swing.ui.layout.Row;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
@ -11,8 +12,8 @@ import com.fr.base.vcs.DesignerMode;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.file.LocateAction; import com.fr.design.actions.file.LocateAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.actions.template.NewWorkBookToolButtonAction; import com.fr.design.actions.template.NewWorkBookToolButtonAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
@ -37,20 +38,9 @@ import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.collections.combination.Pair; import com.fr.stable.collections.combination.Pair;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator; import javax.swing.*;
import java.awt.*;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -66,9 +56,7 @@ import static com.fine.theme.utils.FineUIScale.scale;
import static com.fine.theme.utils.FineUIStyle.BUTTON_TAB_ACTION; import static com.fine.theme.utils.FineUIStyle.BUTTON_TAB_ACTION;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.*;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
/** /**
* 模版Tab组件 * 模版Tab组件
@ -413,7 +401,7 @@ public class MultiTemplateTabPane extends Row {
// 只有是环境内的文件,才执行释放锁 // 只有是环境内的文件,才执行释放锁
if (file != null && file.isEnvFile()) { if (file != null && file.isEnvFile()) {
// release lock // release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); TemplateRepository.getInstance().close(file.getPath());
} }
} }
} }

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

@ -1,6 +1,6 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.FRContext; import com.fanruan.repository.TemplateRepository;
import com.fr.design.border.FineBorderFactory; import com.fr.design.border.FineBorderFactory;
import com.fr.design.gui.itree.filetree.TemplateDirTree; import com.fr.design.gui.itree.filetree.TemplateDirTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -74,7 +74,7 @@ public class TemplateDirTreePane extends JPanel {
* 刷新 * 刷新
*/ */
public void refreshDockingView() { public void refreshDockingView() {
templateDirTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getFileNodes().getSupportedTypes())); templateDirTree.setFileNodeFilter(new IOFileNodeFilter(TemplateRepository.getInstance().getSupportedTypes()));
templateDirTree.refreshEnv(); templateDirTree.refreshEnv();
} }

26
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.file; package com.fr.design.file;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cache.DesignCacheManager; import com.fr.design.cache.DesignCacheManager;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -11,10 +12,10 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.lock.LockInfoDialog;
import com.fr.design.lock.LockInfoUtils; import com.fr.design.lock.LockInfoUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.lock.LockInfoDialog;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateSearchRemindPane; import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateSearchRemindPane;
@ -27,25 +28,20 @@ import com.fr.form.fit.web.editpreview.FileLockStateObservable;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.base.UserInfo;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.base.UserInfo;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import org.jetbrains.annotations.Nullable;
import java.util.UUID; import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -60,14 +56,10 @@ import java.util.Objects;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fr.workspace.server.repository.template.TemplateRepository;
import com.fr.workspace.server.vcs.VcsOperator;
import org.jetbrains.annotations.Nullable;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -408,7 +400,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (nodeFILE.exists()) { if (nodeFILE.exists()) {
if (!VcsHelper.getInstance().isLegacyMode()) { if (!VcsHelper.getInstance().isLegacyMode()) {
try { try {
WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); VcsRepository.getInstance().recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName());
} }

3
designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java

@ -2,8 +2,7 @@ package com.fr.design.file.impl;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator; import com.fanruan.repository.TemplateRepository;
import com.fr.workspace.server.repository.template.TemplateRepository;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;

11
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -31,6 +31,10 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.row;
public class UICheckListPopup extends UIPopupMenu { public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
private List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>(); private List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>();
@ -120,15 +124,12 @@ public class UICheckListPopup extends UIPopupMenu {
} }
private void addOneCheckValue(Object checkValue) { private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkPane = new JPanel(new BorderLayout());
checkPane.setPreferredSize(FineUIScale.scale(new Dimension(144, CHECKBOX_HEIGHT)));
final JCheckBox temp = createCheckbox(); final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString()); final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setPreferredSize(FineUIScale.scale(new Dimension(100, 20)));
checkPane.setBackground(Color.WHITE); checkPane.setBackground(Color.WHITE);
checkPane.add(temp); checkPane.add(row(fix(4), cell(temp), cell(label)).getComponent());
checkPane.add(label);
if (labelNeedToolTips) { if (labelNeedToolTips) {
// 设置每项Label的tooltips为其省略前的内容 // 设置每项Label的tooltips为其省略前的内容
label.setToolTipText(checkValue.toString()); label.setToolTipText(checkValue.toString());

135
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -2,19 +2,20 @@ package com.fr.design.gui.icombocheckbox;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.HoverAware; import com.fr.design.event.HoverAware;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComboBox;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -36,6 +37,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.fine.theme.utils.FineUIStyle.OFFET_LEFT_TEXT_FIELD;
import static com.fine.theme.utils.FineUIStyle.PLAIN_ARROW_BUTTON;
import static com.fine.theme.utils.FineUIStyle.TRANSPARENT_TEXT_FIELD;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 设计器下拉复选框组件 * 设计器下拉复选框组件
* 支持全选半选 * 支持全选半选
@ -43,10 +49,10 @@ import java.util.Map;
* 可以省略显示 * 可以省略显示
* *
* @author * @author
* @since * @since Created on
* Created on
*/ */
public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver, HoverAware { public class UIComboCheckBox extends JComboBox implements UIObserver, GlobalNameObserver, HoverAware {
private static final String UI_CLASS_ID = "ComboCheckBoxUI";
//下拉框的值 //下拉框的值
private Object[] values; private Object[] values;
//已经选中的值 //已经选中的值
@ -55,8 +61,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
private UICheckListPopup popup; private UICheckListPopup popup;
private UITextField editor; private UITextField editor;
private final JPanel clickPane = new JPanel(new BorderLayout());
private UIButton arrowButton; private UIButton arrowButton;
private UILabel label;
//选中的值之间显示的分隔符 //选中的值之间显示的分隔符
private String valueSperator; private String valueSperator;
private static final String DEFAULT_VALUE_SPERATOR = ","; private static final String DEFAULT_VALUE_SPERATOR = ",";
@ -71,6 +77,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private String placeHolder = StringUtils.EMPTY; private String placeHolder = StringUtils.EMPTY;
private boolean rollOver; private boolean rollOver;
private boolean popupVisible = false;
public UIComboCheckBox(Object[] value) { public UIComboCheckBox(Object[] value) {
this(value, DEFAULT_VALUE_SPERATOR, true); this(value, DEFAULT_VALUE_SPERATOR, true);
@ -123,19 +130,22 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
private void initComponent() { private void initComponent() {
this.popup = new UICheckListPopup(values, supportSelectAll); this.popup = new UICheckListPopup(values, supportSelectAll) {
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
size.width = UIComboCheckBox.this.getWidth();
return size;
}
};
this.popup.setBorder(new FineRoundBorder());
this.popup.addActionListener(new PopupAction()); this.popup.addActionListener(new PopupAction());
this.editor = createEditor(); initClickPane();
this.arrowButton = createArrowButton();
this.label = new UILabel(getIcon());
label.setPreferredSize(FineUIScale.scale(new Dimension(24, 24)));
setLayoutAndAddComponents(); setLayoutAndAddComponents();
setText(); setText();
addPopupListener(this); addPopupListener(this);
setBackground(Color.WHITE);
setOpaque(true);
} }
/** /**
@ -152,8 +162,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
return popup; return popup;
} }
public UITextField getEditor() { public JPanel getClickPane() {
return editor; return clickPane;
} }
public String getPlaceHolder() { public String getPlaceHolder() {
@ -164,31 +174,37 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
this.placeHolder = placeHolder; this.placeHolder = placeHolder;
} }
public UIButton getArrowButton() { private void initClickPane() {
return arrowButton; editor = new TextField();
} editor.setEditable(false);
setStyle(editor, OFFET_LEFT_TEXT_FIELD);
public UILabel getLabel() { arrowButton = new UIButton(getIcon());
return label; setStyle(arrowButton, PLAIN_ARROW_BUTTON);
}
private UIButton createArrowButton() { clickPane.add(editor, BorderLayout.CENTER);
final UIButton arrowBtn = new UIButton(); clickPane.add(arrowButton, BorderLayout.EAST);
arrowBtn.setNormalPainted(false);
arrowBtn.setPreferredSize(FineUIScale.scale(new Dimension(20, 5)));
arrowBtn.setIcon(getIcon());
arrowBtn.setExtraPainted(false);
addPopupListener(arrowBtn);
return arrowBtn; addPopupListener(editor);
addPopupListener(arrowButton);
addHoverStatusListener(editor);
addHoverStatusListener(arrowButton);
} }
private UITextField createEditor() { protected void addHoverStatusListener(JComponent component) {
UITextField editor = new TextField(); component.addMouseListener(new MouseAdapter() {
editor.setEditable(false); @Override
addPopupListener(editor); public void mouseEntered(MouseEvent e) {
rollOver = true;
repaint();
}
return editor; @Override
public void mouseExited(MouseEvent e) {
rollOver = popup.isVisible();
repaint();
}
});
} }
/** /**
@ -202,18 +218,6 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
togglePopup(); togglePopup();
} }
@Override
public void mouseEntered(MouseEvent e) {
rollOver = true;
repaint();
}
@Override
public void mouseExited(MouseEvent e) {
rollOver = false;
repaint();
}
}); });
} }
@ -240,7 +244,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
@Override @Override
public boolean isHovered() { public boolean isHovered() {
return rollOver || this.popup.isShowing(); return rollOver;
} }
private class PopupAction implements ActionListener { private class PopupAction implements ActionListener {
@ -258,12 +262,34 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private void togglePopup() { private void togglePopup() {
if (this.arrowButton.isEnabled()) { if (this.arrowButton.isEnabled()) {
popup.setBorder(new FineRoundBorder()); if (popupVisible) {
popup.setPreferredSize(new Dimension(getWidth(), this.popup.getPreferredSize().height)); hidePopup();
popup.show(this, 0, getHeight()); } else {
showPopup();
}
} }
} }
/**
* 展示 popup
*/
public void showPopup() {
this.popup.show(this, 0, getHeight());
arrowButton.setIcon(new LazyIcon("up_arrow"));
arrowButton.repaint();
popupVisible = true;
}
/**
* 隐藏 popup
*/
public void hidePopup() {
popup.setVisible(false);
arrowButton.setIcon(new LazyIcon("down_arrow"));
arrowButton.repaint();
popupVisible = false;
}
/** /**
* 清除文本框 * 清除文本框
*/ */
@ -301,6 +327,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
/** /**
* 为为添加placeholder * 为为添加placeholder
*
* @param editor * @param editor
*/ */
protected void setEditorPlaceHolder(UITextField editor) { protected void setEditorPlaceHolder(UITextField editor) {
@ -335,7 +362,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
for (int i = 1; i <= chars.length; i++) { for (int i = 1; i <= chars.length; i++) {
//如果原文本+省略号长度超过文本框 //如果原文本+省略号长度超过文本框
if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getPreferredSize().getWidth()) { if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getWidth()) {
//从第i-1的位置截断再拼上省略号 //从第i-1的位置截断再拼上省略号
omitText = text.substring(0, i - 2) + OMIT_TEXT; omitText = text.substring(0, i - 2) + OMIT_TEXT;
break; break;
@ -466,8 +493,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
} }
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
/** /**
* 简单的测试demo * 简单的测试demo
*
* @param args * @param args
*/ */
public static void main(String args[]) { public static void main(String args[]) {

10
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fanruan.entity.template.TemplateListBean;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -11,13 +12,12 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.template.TemplateRepository;
import javax.swing.JTree; import javax.swing.*;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.Component; import java.awt.*;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -188,7 +188,7 @@ public class EnvFileTree extends RefreshableJTree {
FileNode[] resFns = null; FileNode[] resFns = null;
try { try {
resFns = WorkContext.getCurrent() == null ? new FileNode[0] : FRContext.getFileNodes().list(filePath); resFns = WorkContext.getCurrent() == null ? new FileNode[0] : TemplateRepository.getInstance().list(new TemplateListBean(filePath));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

3
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -1,8 +1,7 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;

3
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java

@ -1,6 +1,5 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
@ -10,7 +9,7 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.ExtraReportClassManager; import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider; import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;

5
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java

@ -1,11 +1,10 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager; import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.workspace.server.entity.template.TemplateListBean; import com.fanruan.entity.template.TemplateListBean;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;

5
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -1,6 +1,5 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
@ -13,8 +12,8 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.collections.CollectionUtils; import com.fr.stable.collections.CollectionUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.server.entity.template.TemplateListBean; import com.fanruan.entity.template.TemplateListBean;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import javax.swing.text.Position; import javax.swing.text.Position;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;

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

@ -1,9 +1,9 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
@ -12,8 +12,6 @@ import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.TextFontComboBox;
@ -28,13 +26,10 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.math.RoundingMode; import java.math.RoundingMode;
import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.text.Format; import java.text.Format;
@ -161,14 +156,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
} }
private void initSampleLabel() { private void initSampleLabel() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); sampleLabel = FineComponentsFactory.createSampleLabel();
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, labelColor);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue());
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(border);
FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP);
} }

19
designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java

@ -1,15 +1,13 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents; import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -22,17 +20,11 @@ import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -112,14 +104,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
} }
private void initPreviewLabel4GeneralFormat() { private void initPreviewLabel4GeneralFormat() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); previewLabel = FineComponentsFactory.createSampleLabel();
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 0, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.ABOVE_TOP, 0, null, labelColor);
previewLabel = new UILabel(FormatField.getInstance().getFormatValue());
previewLabel.setHorizontalAlignment(UILabel.CENTER);
previewLabel.setBorder(border);
FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP);
} }
protected void initLayout() { protected void initLayout() {

4
designer-base/src/main/java/com/fr/design/javascript/EmailPane.java

@ -1,8 +1,6 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fr.base.email.EmailCenter;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fr.config.EmailServerConfig;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -13,7 +11,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.config.ConfigRepository; import com.fanruan.repository.ConfigRepository;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;

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

@ -762,7 +762,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private JPanel createTipsPane() { private JPanel createTipsPane() {
JPanel tipsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel tipsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
tipsPane.setLayout(new BorderLayout(4, 4)); tipsPane.setLayout(new BorderLayout(4, 4));
tipsPane.setBorder(BorderFactory.createEmptyBorder(30, 2, 0, 0)); tipsPane.setBorder(new ScaledEmptyBorder(30, 2, 0, 0));
JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
searchPane.setLayout(new BorderLayout(4, 4)); searchPane.setLayout(new BorderLayout(4, 4));
keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface")); keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface"));

3
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -30,6 +30,7 @@ import java.util.List;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.theme.utils.FineUIScale.scale;
public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> { public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
private static final int BOTTOM_BORDER = 12; private static final int BOTTOM_BORDER = 12;
@ -73,7 +74,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5), cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5),
cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5) cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5)
).getComponent()); ).getComponent());
topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, 150)); topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, scale(150)));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(topPane, BorderLayout.NORTH); this.add(topPane, BorderLayout.NORTH);

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

@ -370,7 +370,7 @@ public class TableLayoutHelper {
JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize); JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] column = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; double[] column = {LayoutConstants.HORIZONTAL_GAP, f};
double[] row = {p, p}; double[] row = {p, p};
StringBuilder resultText = new StringBuilder(); StringBuilder resultText = new StringBuilder();
for (String text : title) { for (String text : title) {

4
designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java

@ -1,12 +1,12 @@
package com.fr.design.lock; package com.fr.design.lock;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.lock.LockInfoOperator;
import com.fr.stable.collections.CollectionUtils; import com.fr.stable.collections.CollectionUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -31,7 +31,7 @@ public class TemplateLockInfoReSave {
return; return;
} }
String[] paths = templates.stream().map(JTemplate::getPath).toArray(String[]::new); String[] paths = templates.stream().map(JTemplate::getPath).toArray(String[]::new);
String[] lockedPath = WorkContext.getCurrent().get(LockInfoOperator.class).lockTemplates(paths); String[] lockedPath = TemplateRepository.getInstance().lockTemplates(paths);
FineLoggerFactory.getLogger().warn("template lock failed:{}", String.join(";", lockedPath)); FineLoggerFactory.getLogger().warn("template lock failed:{}", String.join(";", lockedPath));
} }
}; };

21
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fanruan.repository.TemplateRepository;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
@ -52,14 +53,12 @@ import com.fr.event.Event;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.lock.LockInfoOperator;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -67,22 +66,10 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.report.lock.LockInfoOperator; import javax.swing.*;
import com.fr.workspace.server.repository.template.TemplateRepository;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -252,7 +239,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath());
boolean success = WorkContext.getCurrent().get(LockInfoOperator.class).unLockTpl(path); boolean success = TemplateRepository.getInstance().unLockTpl(path);
if (success) { if (success) {
FileNode fileNode = TemplateTreePane.getInstance().getFileNode(); FileNode fileNode = TemplateTreePane.getInstance().getFileNode();
refreshRightToolBarBy(fileNode); refreshRightToolBarBy(fileNode);

27
designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fanruan.repository.TemplateRepository;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.DesignSizeI18nManager;
@ -8,25 +9,10 @@ import com.fr.design.mainframe.guide.base.GuideView;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.lock.LockInfoOperator; import com.fr.workspace.base.UserInfo;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.ImageIcon; import java.awt.*;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -125,7 +111,8 @@ public class ForbiddenPane extends JPanel {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
return WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(template.getEditingFILE().getPath()); UserInfo info = TemplateRepository.getInstance().showLockInfo(template.getEditingFILE().getPath());
return info.getTplLocked();
} }
@Override @Override

16
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fanruan.datasource.web.bean.ConnectionAuthorityConfigBean; import com.fanruan.datasource.web.bean.ConnectionAuthorityConfigBean;
import com.fanruan.product.ProductConstants; import com.fanruan.product.ProductConstants;
import com.fanruan.repository.TemplateRepository;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.TRL; import com.fr.base.TRL;
@ -100,18 +101,11 @@ import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID; import com.fr.stable.core.UUID;
import com.fr.widgettheme.designer.WidgetThemeDisplayAction; import com.fr.widgettheme.designer.WidgetThemeDisplayAction;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import com.fr.workspace.server.repository.WorkplaceConstants;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.template.TemplateRepository;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout; import java.awt.*;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
@ -937,12 +931,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 目标本地文件 // 目标本地文件
!editingFILE.isEnvFile() || !editingFILE.isEnvFile() ||
// 目标远程文件 // 目标远程文件
WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); TemplateRepository.getInstance().saveAs(editingFILE.getPath());
if (lockedTarget) { if (lockedTarget) {
boolean saved = saveNewFile(editingFILE, oldName); boolean saved = saveNewFile(editingFILE, oldName);
// 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉
if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) {
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); TemplateRepository.getInstance().close(sourceFile.getPath());
} }
return saved; return saved;
} else { } else {

18
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -1,29 +1,23 @@
package com.fr.design.mainframe.authority; package com.fr.design.mainframe.authority;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.user.UserAuthority; import com.fr.workspace.server.authority.user.UserAuthority;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
@ -31,6 +25,7 @@ public class JTemplateAuthorityChecker {
JTemplate<?, ?> jTemplate; JTemplate<?, ?> jTemplate;
Set<String> authConnectionNames; Set<String> authConnectionNames;
Set<String> authDatasetNames; Set<String> authDatasetNames;
Set<String> templateDatasetNames;
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>(); Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>();
Set<String> authFailConnectionNames = new HashSet<>(); Set<String> authFailConnectionNames = new HashSet<>();
Set<String> authFailDatasetNames = new HashSet<>(); Set<String> authFailDatasetNames = new HashSet<>();
@ -45,7 +40,12 @@ public class JTemplateAuthorityChecker {
} }
private void initAuthNames() { private void initAuthNames() {
// 无需获取所有数据集和数据连接了,当前只能获取自己有权限的 // 无需获取所有服务器数据集和数据连接了,因为当前只能获取自己有权限的,只要拿一下模板数据集就行
templateDatasetNames = new HashSet<>();
Iterator<String> tableDataNameIterator = jTemplate.getTarget().getTableDataNameIterator();
while (tableDataNameIterator.hasNext()) {
templateDatasetNames.add(tableDataNameIterator.next());
}
Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName());
if (authNamesMap != null) { if (authNamesMap != null) {
//有权限的数据连接名称 //有权限的数据连接名称
@ -87,6 +87,8 @@ public class JTemplateAuthorityChecker {
} }
} }
} }
// 排除模板数据集的部分
authFailDatasetNames.removeAll(templateDatasetNames);
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s));
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
} }

44
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -1,32 +1,22 @@
package com.fr.design.mainframe.check; package com.fr.design.mainframe.check;
import com.fanruan.repository.TemplateRepository;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.check.TemplateChecker;
import javax.swing.BoxLayout; import javax.swing.*;
import javax.swing.JDialog; import java.awt.*;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -34,14 +24,9 @@ import java.awt.event.WindowEvent;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.*;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class CheckButton extends UIButton { public class CheckButton extends UIButton {
@ -174,16 +159,15 @@ public class CheckButton extends UIButton {
private Set<String> check(JTemplate jtemplate) { private Set<String> check(JTemplate jtemplate) {
String path = jtemplate.getEditingFILE().getEnvFullName(); String path = jtemplate.getEditingFILE().getEnvFullName();
Set<String> fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler<Void>() { Set<String> fontSet = null;
try {
@Override fontSet = TemplateRepository.getInstance().checkFont(path);
public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { } catch (Exception e) {
imageLabel.setIcon(new LazyIcon("error", 20)); imageLabel.setIcon(new LazyIcon("error", 20));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>"); message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>");
okButton.setEnabled(true); okButton.setEnabled(true);
return null; return null;
} }
}).checkFont(path);
return fontSet; return fontSet;
} }

20
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java

@ -9,12 +9,12 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.vcs.VcsBean;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult; import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import javax.swing.SwingUtilities; import javax.swing.*;
import javax.swing.SwingWorker;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -108,7 +108,7 @@ public class VcsOperatorWorker {
VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper(); VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper();
startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> { startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> {
String fileName = vcsEntity.getFilename(); String fileName = vcsEntity.getFilename();
VcsTaskResult result = operator.restoreVersion(fileName); VcsTaskResult result = VcsRepository.getInstance().restoreVersion(fileName);
if (!result.isSuccess()) { if (!result.isSuccess()) {
wrapper.addFailedEntity(vcsEntity); wrapper.addFailedEntity(vcsEntity);
} }
@ -129,9 +129,9 @@ public class VcsOperatorWorker {
String fileName = vcsEntity.getFilename(); String fileName = vcsEntity.getFilename();
VcsTaskResult result; VcsTaskResult result;
if (all) { if (all) {
result = operator.deleteVersionForRecycle(fileName); result = VcsRepository.getInstance().deleteVersionForRecycle(fileName);
} else { } else {
result = operator.deleteVersion(fileName, vcsEntity.getVersion(), VcsEntity.CommitType.TYPE_DEFAULT); result = VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, vcsEntity.getVersion(), 0, VcsEntity.CommitType.TYPE_DEFAULT)));
} }
if (!result.isSuccess()) { if (!result.isSuccess()) {
wrapper.addFailedEntity(vcsEntity); wrapper.addFailedEntity(vcsEntity);
@ -148,7 +148,7 @@ public class VcsOperatorWorker {
*/ */
public void doDelete(VcsEntity entity, VcsTableOperatorListener listener) { public void doDelete(VcsEntity entity, VcsTableOperatorListener listener) {
String fileName = entity.getFilename(); String fileName = entity.getFilename();
start4Single(entity, (vcsEntity, operator) -> operator.deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener); start4Single(entity, (vcsEntity, operator) -> VcsRepository.getInstance().deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener);
} }
/** /**
@ -160,7 +160,9 @@ public class VcsOperatorWorker {
String fileName = entity.getFilename(); String fileName = entity.getFilename();
int version = entity.getVersion(); int version = entity.getVersion();
VcsEntity.CommitType commitType = entity.getCommitType(); VcsEntity.CommitType commitType = entity.getCommitType();
start4Single(entity, (vcsEntity, operator) -> operator.deleteVersion(fileName, version, commitType), fileName + everyFailedStr, listener); start4Single(entity, (vcsEntity, operator) ->
VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, version, 0, commitType))),
fileName + everyFailedStr, listener);
} }
@ -171,7 +173,7 @@ public class VcsOperatorWorker {
*/ */
public void updateEntityAnnotation(VcsEntity entity, VcsTableOperatorListener listener) { public void updateEntityAnnotation(VcsEntity entity, VcsTableOperatorListener listener) {
start4Single(entity, (vcsEntity, operator) -> { start4Single(entity, (vcsEntity, operator) -> {
operator.updateVersion(entity); VcsRepository.getInstance().updateVersion(new VcsBean(entity));
return new VcsTaskResult(true); return new VcsTaskResult(true);
}, everyFailedStr, listener); }, everyFailedStr, listener);
} }

8
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java

@ -3,9 +3,9 @@ package com.fr.design.mainframe.vcs;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor; import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsTaskBean;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsConfig;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule;
@ -39,10 +39,10 @@ public class VcsRecycleSettingHelper {
VcsConfig.getInstance().setV2CleanRecycleInterval(day); VcsConfig.getInstance().setV2CleanRecycleInterval(day);
} }
}); });
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean(
VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME, VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME,
1, 1,
VcsAutoRecycleSchedule.class); VcsAutoRecycleSchedule.class));
} }
}); });
} }

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

@ -1,14 +1,13 @@
package com.fr.design.mainframe.vcs.common; package com.fr.design.mainframe.vcs.common;
import com.fr.io.FineEncryptUtils; import com.fanruan.repository.TemplateRepository;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.io.FineEncryptUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.resource.WorkResourceOutputStream; import com.fr.workspace.resource.WorkResourceOutputStream;
import com.fr.workspace.server.lock.TplOperator;
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -43,9 +42,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE {
return null; return null;
} }
InputStream in = new ByteArrayInputStream( InputStream in = new ByteArrayInputStream(
WorkContext.getCurrent().get(TplOperator.class).readAndLockFile( TemplateRepository.getInstance().open( StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1)))
StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1))
)
); );
return envPath.endsWith(".cpt") || envPath.endsWith(".frm") return envPath.endsWith(".cpt") || envPath.endsWith(".frm")

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

@ -24,19 +24,19 @@ import com.fr.plugin.manage.PluginManager;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.entity.vcs.VcsBean;
import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator; 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 com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.Color; import java.awt.*;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -84,7 +84,7 @@ public class VcsHelper implements JTemplateActionListener {
// 开了设计器启动页面时一开始取不到VcsOperator,通过下面的切换环境事件再取,这边判断下 // 开了设计器启动页面时一开始取不到VcsOperator,通过下面的切换环境事件再取,这边判断下
if (op != null) { if (op != null) {
try { try {
legacyMode = op.isLegacyMode(); legacyMode = VcsRepository.getInstance().isLegacyMode();
root = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot(); root = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot();
} catch (Exception e) { } catch (Exception e) {
legacyMode = true; legacyMode = true;
@ -96,7 +96,7 @@ public class VcsHelper implements JTemplateActionListener {
@Override @Override
protected void on(Event event) { protected void on(Event event) {
try { try {
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); legacyMode = VcsRepository.getInstance().isLegacyMode();
FineLoggerFactory.getLogger().info("[VcsHelper] legacyMode:{}", legacyMode); FineLoggerFactory.getLogger().info("[VcsHelper] legacyMode:{}", legacyMode);
} catch (Exception e) { } catch (Exception e) {
//保险起见走老逻辑 //保险起见走老逻辑
@ -217,22 +217,22 @@ public class VcsHelper implements JTemplateActionListener {
public void run() { public void run() {
String fileName = getEditingFilename(); String fileName = getEditingFilename();
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null));
boolean replace = needDeleteVersion(entity); boolean replace = needDeleteVersion(entity);
int latestFileVersion = 0; int latestFileVersion = 0;
if (entity != null) { if (entity != null) {
latestFileVersion = entity.getVersion(); latestFileVersion = entity.getVersion();
} }
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace));
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
List<VcsEntity> updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); List<VcsEntity> updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)));
SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList));
} else { } else {
operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace).setUseVersion(true));
} }
if (GcConfig.getInstance().isGcEnable()) { if (GcConfig.getInstance().isGcEnable()) {
operator.gc(); VcsRepository.getInstance().gc();
} }
} }
@ -252,21 +252,20 @@ public class VcsHelper implements JTemplateActionListener {
moveVcs.execute(new Runnable() { moveVcs.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY);
List<VcsEntity> oldVcsEntities = operator.getVersions(oldPath); List<VcsEntity> oldVcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(oldPath));
String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY);
for (VcsEntity oldVcsEntity : oldVcsEntities) { for (VcsEntity oldVcsEntity : oldVcsEntities) {
if (!VcsHelper.getInstance().isLegacyMode()) { if (!VcsHelper.getInstance().isLegacyMode()) {
operator.renameVersion(oldVcsEntity, replaceName); VcsRepository.getInstance().renameVersion(new VcsBean(oldVcsEntity, replaceName));
} else { } else {
operator.saveVersion(oldVcsEntity.getUsername(), replaceName, oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(oldVcsEntity.getUsername(), oldVcsEntity.getCommitMsg(), replaceName, null, null, oldVcsEntity.getVersion())).setUseVersion(true));
operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, oldPath, null, null, oldVcsEntity.getVersion())));
} }
} }
FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName); FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName);
if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) { if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) {
operator.gc(); VcsRepository.getInstance().gc();
} }
} }
}); });
@ -314,7 +313,7 @@ public class VcsHelper implements JTemplateActionListener {
public void fireAutoSaveVcs(final JTemplate jt) { public void fireAutoSaveVcs(final JTemplate jt) {
String fileName = getEditingFilename(); String fileName = getEditingFilename();
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null));
boolean replace = needDeleteVersion(entity); boolean replace = needDeleteVersion(entity);
int latestFileVersion = 0; int latestFileVersion = 0;
if (entity != null) { if (entity != null) {
@ -327,22 +326,22 @@ public class VcsHelper implements JTemplateActionListener {
private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) { private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) {
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace));
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
List<VcsEntity> updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); List<VcsEntity> updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)));
SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList));
} else { } else {
autoSave(jt, getCurrentUsername(), fileName, latestFileVersion + 1, replace, operator); autoSave(jt, getCurrentUsername(), fileName, latestFileVersion + 1, replace, operator);
} }
if (GcConfig.getInstance().isGcEnable()) { if (GcConfig.getInstance().isGcEnable()) {
operator.gc(); VcsRepository.getInstance().gc();
} }
} }
private void autoSave(JTemplate jt, String currentUsername, String fileName, int nowVersion, boolean replace, VcsOperator operator) { private void autoSave(JTemplate jt, String currentUsername, String fileName, int nowVersion, boolean replace, VcsOperator operator) {
try { try {
if (JTemplate.isValid(jt) && !jt.isALLSaved()) { if (JTemplate.isValid(jt) && !jt.isALLSaved()) {
operator.autoSave(currentUsername, fileName, StringUtils.EMPTY, nowVersion, jt.exportData(), replace); VcsRepository.getInstance().autoSave(new VcsBean(new VcsEntity(currentUsername, StringUtils.EMPTY, fileName, null, null, nowVersion), replace, jt.exportData()));
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());

19
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java

@ -18,14 +18,12 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsBean;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import javax.swing.JPanel;
import java.awt.BorderLayout; import javax.swing.*;
import java.awt.Component; import java.awt.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -118,11 +116,12 @@ public class EditFileVersionDialog extends UIDialog {
*/ */
public void doOK() { public void doOK() {
entity.setCommitMsg(msgTestArea.getText()); entity.setCommitMsg(msgTestArea.getText());
WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity); VcsRepository.getInstance().updateVersion(new VcsBean(entity));
setVisible(false); setVisible(false);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable table = FileVersionTable.getInstance(); FileVersionTable table = FileVersionTable.getInstance();
table.updateModel(table.getSelectedRow(), WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", StringUtils.EMPTY)));
table.updateModel(table.getSelectedRow(), VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", StringUtils.EMPTY))));
} }
public UITextArea getMsgTestArea() { public UITextArea getMsgTestArea() {

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

@ -13,6 +13,7 @@ import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.AbstractCellEditor; import javax.swing.AbstractCellEditor;
@ -43,10 +44,10 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
return editor; return editor;
} else if (row == 0) { } else if (row == 0) {
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
fileOfVersion = vcsOperator.getFileOfCurrent(path.replaceFirst("/", "")); fileOfVersion = VcsRepository.getInstance().getFileOfCurrent(path.replaceFirst("/", ""));
} else { } else {
renderAndEditor.update((VcsEntity) value); renderAndEditor.update((VcsEntity) value);
fileOfVersion = vcsOperator.getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion(), StringUtils.EMPTY);
} }

18
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.vcs.ui; package com.fr.design.mainframe.vcs.ui;
import com.fr.analysis.cloud.DateUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.editor.editor.DateEditor; import com.fr.design.editor.editor.DateEditor;
import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.date.UIDatePicker;
@ -11,18 +10,11 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.repository.vcs.VcsRepository;
import javax.swing.AbstractAction; import javax.swing.*;
import javax.swing.BorderFactory; import java.awt.*;
import javax.swing.Box;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Calendar; import java.util.Calendar;
@ -70,7 +62,7 @@ public class FileVersionDialog extends UIDialog {
Date editorDate = dateEditor.getValue(); Date editorDate = dateEditor.getValue();
Date start = editorDate == null ? new Date(0) : editorDate; Date start = editorDate == null ? new Date(0) : editorDate;
Date end = editorDate == null ? getLastHour() : new Date(start.getTime() + DELAY); Date end = editorDate == null ? getLastHour() : new Date(start.getTime() + DELAY);
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText()); List<VcsEntity> vcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(fileName, start, end, textField.getText()));
FileVersionTable.getInstance().updateModel(1, vcsEntities); FileVersionTable.getInstance().updateModel(1, vcsEntities);
} }

20
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java

@ -10,19 +10,16 @@ import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsBean;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import javax.swing.Box; import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Style; import javax.swing.text.Style;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -65,7 +62,7 @@ public class FileVersionRowPanel extends JPanel {
if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername()); vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername());
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); VcsRepository.getInstance().rollbackTo(new VcsBean(vcsEntity));
FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename());
} }
} }
@ -79,14 +76,15 @@ public class FileVersionRowPanel extends JPanel {
if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
try { try {
WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, vcsEntity.getFilename(), null, null, vcsEntity.getVersion())));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
FileVersionTable table = (FileVersionTable) (FileVersionRowPanel.this.getParent()); FileVersionTable table = (FileVersionTable) (FileVersionRowPanel.this.getParent());
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
try { try {
table.updateModel(table.getSelectedRow() - 1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); table.updateModel(table.getSelectedRow() - 1,
VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", ""))));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }

16
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java

@ -20,14 +20,11 @@ import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.repository.vcs.VcsRepository;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.Box; import java.awt.*;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -134,7 +131,8 @@ public class FileVersionsPanel extends BasicPane {
} }
titleLabel.setText(filename); titleLabel.setText(filename);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
FileVersionTable.getInstance().updateModel(1, VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", ""))));
} }
public void showFileVersionsPane() { public void showFileVersionsPane() {

11
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java

@ -11,20 +11,17 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.TableEntity; import com.fr.design.mainframe.vcs.TableEntity;
import com.fr.design.mainframe.vcs.TableValueOperator; import com.fr.design.mainframe.vcs.TableValueOperator;
import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.VcsProcessFailedWrapper; import com.fr.design.mainframe.vcs.VcsProcessFailedWrapper;
import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableEntity;
import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.design.mainframe.vcs.VcsTableOperatorListener;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -101,7 +98,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
@Override @Override
protected List<VcsTableEntity> getTableList() { protected List<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getRecycleEntities(); List<VcsEntity> entityList = VcsRepository.getInstance().getRecycleEntities();
List<VcsTableEntity> tableEntities = new ArrayList<>(); List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) { for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity)); tableEntities.add(new VcsTableEntity(entity));

13
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableEntity;
import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.design.mainframe.vcs.VcsTableOperatorListener;
import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper; import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper;
@ -17,15 +16,9 @@ import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
@ -211,7 +204,7 @@ public class VcsCenterPane extends VcsNewPane {
@Override @Override
protected List<VcsTableEntity> getTableList() { protected List<VcsTableEntity> getTableList() {
List<VcsEntity> entities = WorkContext.getCurrent().get(VcsOperator.class).getEveryVersion(); List<VcsEntity> entities = VcsRepository.getInstance().getEveryVersion();
List<VcsTableEntity> tableEntities = new ArrayList<>(); List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entities) { for (VcsEntity entity : entities) {
tableEntities.add(new VcsTableEntity(entity)); tableEntities.add(new VcsTableEntity(entity));

21
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.vcs.ui; package com.fr.design.mainframe.vcs.ui;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MultiTemplateTabPane; import com.fr.design.file.MultiTemplateTabPane;
@ -18,8 +17,6 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.report.InconsistentLockException; import com.fr.report.InconsistentLockException;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -27,16 +24,13 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.resource.WorkResource; import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.entity.vcs.VcsBean;
import com.fr.workspace.server.entity.vcs.VcsQuery;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult; import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -196,7 +190,7 @@ public class VcsNewPane extends RecyclePane {
//step1.设置还原的用户名 //step1.设置还原的用户名
entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); entity.setUsername(VcsHelper.getInstance().getCurrentUsername());
//step2.rollback到指定版本 //step2.rollback到指定版本
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(entity); VcsRepository.getInstance().rollbackTo(new VcsBean(entity));
//最里面的文件系统的write会吞异常,这边就一直默认成功吧,日志里会体现失败的情况 //最里面的文件系统的write会吞异常,这边就一直默认成功吧,日志里会体现失败的情况
return new VcsTaskResult(true); return new VcsTaskResult(true);
} }
@ -294,8 +288,7 @@ public class VcsNewPane extends RecyclePane {
@Override @Override
protected String doInBackground() throws Exception { protected String doInBackground() throws Exception {
//step1.将指定版本的历史文件读取出来,加上前缀放到cache中 //step1.将指定版本的历史文件读取出来,加上前缀放到cache中
VcsOperator vcsOperator = WorkContext.getCurrent().get(VcsOperator.class); String fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion(
String fileOfVersion = vcsOperator.getFileOfFileVersion(
entity.getFilename(), entity.getFilename(),
entity.getVersion(), entity.getVersion(),
Toolkit.i18nText("Fine-Design_Vcs_Prefix", entity.getVersion())); Toolkit.i18nText("Fine-Design_Vcs_Prefix", entity.getVersion()));
@ -320,7 +313,7 @@ public class VcsNewPane extends RecyclePane {
@Override @Override
protected List<VcsTableEntity> getTableList() { protected List<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath)); List<VcsEntity> entityList = VcsRepository.getInstance().getVersions(new VcsQuery(VcsFileUtils.dealWithFilePath(filePath)));
List<VcsTableEntity> tableEntities = new ArrayList<>(); List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) { for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity)); tableEntities.add(new VcsTableEntity(entity));

6
designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java

@ -12,7 +12,7 @@ import com.fr.report.DesignAuthority;
import com.fr.report.constant.RoleType; import com.fr.report.constant.RoleType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.AuthorityOperator; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,7 +41,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
// 远程设计获取全部设计成员的权限列表 // 远程设计获取全部设计成员的权限列表
DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); DesignAuthority[] authorities = RemoteAuthorityRepository.getInstance().getAllAuthorities();
List<DesignAuthority> userAuthorities = new ArrayList<DesignAuthority>(); List<DesignAuthority> userAuthorities = new ArrayList<DesignAuthority>();
List<DesignAuthority> customAuthorities = new ArrayList<DesignAuthority>(); List<DesignAuthority> customAuthorities = new ArrayList<DesignAuthority>();
if (authorities != null) { if (authorities != null) {
@ -75,7 +75,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
boolean success = false; boolean success = false;
try { try {
success = WorkContext.getCurrent().get(AuthorityOperator.class).updateAuthorities(authorities); success = RemoteAuthorityRepository.getInstance().updateAuthorities(authorities);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

14
designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java

@ -1,21 +1,15 @@
package com.fr.design.remote.ui; package com.fr.design.remote.ui;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.border.UITitledBorder;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddedMemberListCellRender;
import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.cell.AddedCustomRoleListCellRender; import com.fr.design.remote.ui.list.cell.AddedCustomRoleListCellRender;
import com.fr.design.remote.ui.list.cell.AddingCustomRoleListCellRender; import com.fr.design.remote.ui.list.cell.AddingCustomRoleListCellRender;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.RemoteDesignMember; import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.util.Collection; import java.util.Collection;
@ -64,11 +58,11 @@ public class CustomRoleManagerPane extends AbstractManagerPane {
@Override @Override
protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord){ protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord){
return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord); return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, 1, 50);
} }
@Override @Override
protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord, int pageNum, int count){ protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord, int pageNum, int count){
return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord, pageNum, count); return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, pageNum, count);
} }
} }

13
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -1,20 +1,15 @@
package com.fr.design.remote.ui; package com.fr.design.remote.ui;
import com.fr.design.border.UITitledBorder;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddedMemberListCellRender;
import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.cell.AddedUserListCellRender; import com.fr.design.remote.ui.list.cell.AddedUserListCellRender;
import com.fr.design.remote.ui.list.cell.AddingUserListCellRender; import com.fr.design.remote.ui.list.cell.AddingUserListCellRender;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.RemoteDesignMember; import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.util.Collection; import java.util.Collection;
@ -63,11 +58,11 @@ public class UserManagerPane extends AbstractManagerPane {
@Override @Override
protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord){ protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord){
return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord); return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, 1, 50);
} }
@Override @Override
protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord, int pageNum, int count){ protected Collection<RemoteDesignMember> getMembers(String userName, String keyWord, int pageNum, int count){
return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord, pageNum, count); return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, pageNum, count);
} }
} }

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

@ -1 +1 @@
package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } package com.fr.design.roleAuthority; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, RemoteAuthorityRepository.getInstance().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } }

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

@ -1,9 +1,7 @@
package com.fr.design.style; package com.fr.design.style;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSlider; import javax.swing.JSlider;
@ -14,6 +12,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
@ -46,18 +45,11 @@ public class AlphaPane extends JPanel {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
// 透明选项 // 透明选项
JPanel alphaPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE);
alphaPane.setBorder(BorderFactory.createEmptyBorder());
this.add(alphaPane, BorderLayout.CENTER);
alphaPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha") + ":"));
alphaPane.add(alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE));
alphaSlider.setPreferredSize(new Dimension(80, 20));
valueSpinner = new UIBasicSpinner(new SpinnerListModel(values)); valueSpinner = new UIBasicSpinner(new SpinnerListModel(values));
alphaPane.add(valueSpinner); JPanel alphaPane = FineLayoutBuilder.createHorizontalLayout(10, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")),
alphaSlider, valueSpinner);
JFormattedTextField field = GUICoreUtils.getSpinnerTextField(valueSpinner); JFormattedTextField field = GUICoreUtils.getSpinnerTextField(valueSpinner);
field.setText(checkFormat(START_VALUE)); field.setText(checkFormat(START_VALUE));
if (field != null) { if (field != null) {
@ -65,9 +57,8 @@ public class AlphaPane extends JPanel {
field.setHorizontalAlignment(UITextField.LEFT); field.setHorizontalAlignment(UITextField.LEFT);
field.getDocument().addDocumentListener(textListener); field.getDocument().addDocumentListener(textListener);
} }
valueSpinner.setPreferredSize(new Dimension(60, 18));
alphaSlider.addChangeListener(changeListener); alphaSlider.addChangeListener(changeListener);
this.add(alphaPane, BorderLayout.CENTER);
} }
DocumentListener textListener = new DocumentListener() { DocumentListener textListener = new DocumentListener() {

14
designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java

@ -1,5 +1,7 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fanruan.product.ProductConstants;
import com.fanruan.repository.TemplateRepository;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
@ -15,13 +17,11 @@ import com.fr.file.filter.ChooseFileFilter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fanruan.product.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.SwingWorker; import javax.swing.*;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -141,7 +141,7 @@ public class TemplateUtils {
OutputStream out = null; OutputStream out = null;
try { try {
// 加锁 // 加锁
boolean saveAsLock = WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath()); boolean saveAsLock = TemplateRepository.getInstance().saveAs(file.getPath());
if (!saveAsLock) { if (!saveAsLock) {
// 加锁失败时,直接返回 // 加锁失败时,直接返回
throw new RuntimeException("[RemoteDesign] back up template file failed"); throw new RuntimeException("[RemoteDesign] back up template file failed");
@ -155,7 +155,7 @@ public class TemplateUtils {
} }
} finally { } finally {
// 解锁 // 解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); TemplateRepository.getInstance().close(file.getPath());
} }
} }
return true; return true;
@ -182,12 +182,12 @@ public class TemplateUtils {
//判断一下要保存的副本文件是否已打开 //判断一下要保存的副本文件是否已打开
int index = HistoryTemplateListCache.getInstance().contains(file); int index = HistoryTemplateListCache.getInstance().contains(file);
if (index != -1) { if (index != -1) {
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); TemplateRepository.getInstance().close(file.getPath());
needCloseTemplate.add(HistoryTemplateListCache.getInstance().getHistoryList().get(index)); needCloseTemplate.add(HistoryTemplateListCache.getInstance().getHistoryList().get(index));
} }
if (JTemplate.isValid(template)) { if (JTemplate.isValid(template)) {
//给要关闭的模板解锁 //给要关闭的模板解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); TemplateRepository.getInstance().close(template.getPath());
needCloseTemplate.add(template); needCloseTemplate.add(template);
} }
return needCloseTemplate; return needCloseTemplate;

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

@ -6,6 +6,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.Icon; import com.fr.base.Icon;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.design.border.FineBorderFactory; import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -419,7 +420,7 @@ public class CustomIconPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon")); UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"));
browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button")); browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button"));
nameTextField = new UITextField(20); nameTextField = new UITextField();
nameTextField.setPreferredSize(FineUIScale.createScaleDimension(172, 24)); nameTextField.setPreferredSize(FineUIScale.createScaleDimension(172, 24));
browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this))); browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)));
@ -446,16 +447,14 @@ public class CustomIconPane extends BasicPane {
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(FineUIScale.createScaleDimension(50, 50)); showImageLabel.setPreferredSize(FineUIScale.createScaleDimension(50, 50));
JPanel centerPane = column(10, JPanel centerPane = column(LayoutConstants.VERTICAL_GAP,
row( row(40,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")).weight(1.2), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")),
cell(nameTextField).weight(3) cell(nameTextField)
), ),
row( row(40,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")).weight(1.2), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")),
row( row(cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1)).weight(1)
cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1)
).weight(3)
) )
).getComponent(); ).getComponent();
this.add(centerPane, BorderLayout.WEST); this.add(centerPane, BorderLayout.WEST);

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

@ -22,7 +22,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.DefaultCompletionFilter; import com.fr.design.gui.itextfield.DefaultCompletionFilter;
@ -55,7 +54,7 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;

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

@ -23,9 +23,9 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.entity.WorkResourceTempRenameStream; import com.fr.workspace.server.entity.WorkResourceTempRenameStream;
import com.fr.workspace.server.entity.template.TemplateListBean; import com.fanruan.entity.template.TemplateListBean;
import com.fr.workspace.server.repository.system.WorkspaceSystemInfo; import com.fr.workspace.server.repository.system.WorkspaceSystemInfo;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import javax.swing.*; import javax.swing.*;
import java.io.InputStream; import java.io.InputStream;

14
designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java

@ -1,6 +1,7 @@
package com.fr.nx.app.designer.transform.ui; package com.fr.nx.app.designer.transform.ui;
import com.fr.base.FRContext; import com.fanruan.entity.template.TemplateListBean;
import com.fanruan.repository.TemplateRepository;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer;
@ -10,13 +11,12 @@ import com.fr.design.remote.ui.tree.FileAuthorityTree;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.nx.app.designer.transform.BatchTransformUtil; import com.fr.nx.app.designer.transform.BatchTransformUtil;
import com.fr.stable.StringUtils;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.AlphaComposite; import java.awt.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@ -166,10 +166,8 @@ public class TransformFileTree extends FileAuthorityTree {
for (String temp : this.filter.getSupportedTypes()) { for (String temp : this.filter.getSupportedTypes()) {
supportTypes.add(FileExtension.parse(temp)); supportTypes.add(FileExtension.parse(temp));
} }
FileNode[] fileNodes = FRContext.getFileNodes().list( TemplateListBean bean = new TemplateListBean(path, StringUtils.EMPTY, supportTypes.toArray(new FileExtension[supportTypes.size()]), false, true, false);
path, FileNode[] fileNodes = TemplateRepository.getInstance().list(bean);
supportTypes.toArray(new FileExtension[supportTypes.size()])
);
return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList); return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList);
} }

5
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java

@ -5,6 +5,7 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.frpane.UIPercentDragPane; import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
@ -67,7 +68,7 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
* 控件背景和透明度配置面板 * 控件背景和透明度配置面板
*/ */
protected NewColorSelectBox widgetBgColorSelectBox; protected NewColorSelectBox widgetBgColorSelectBox;
protected UIPercentDragPane widgetBgAlphaDragPane; protected UINumberDragPaneWithPercent widgetBgAlphaDragPane;
/** /**
* 图标颜色 * 图标颜色
*/ */
@ -130,7 +131,7 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
widgetBgAlphaDragPane = new UIPercentDragPane(); widgetBgAlphaDragPane = new UINumberDragPaneWithPercent(0, 100, 1);
initLineBox(); initLineBox();
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);

1
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -5,6 +5,7 @@ CheckBoxUI=com.fine.theme.light.ui.FineCheckBoxUI
CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI
ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI
ComboCheckBoxUI=com.fine.theme.light.ui.FineComboCheckBoxUI
DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI
CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI

21
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -147,6 +147,7 @@ tooltip.normal=#3F506A
tooltip.disabled=#A3ADBD tooltip.disabled=#A3ADBD
hover.deep=#e2fbe6 hover.deep=#e2fbe6
fill.deep=#F6F9FE fill.deep=#F6F9FE
track.normal=#DADEE7
#---- Button ---- #---- Button ----
@ -324,6 +325,10 @@ ComboBox.comboHeight = 24
ComboBox.selectBox.button.height = 22 ComboBox.selectBox.button.height = 22
ComboBox.renderInset = 0,6,0,6 ComboBox.renderInset = 0,6,0,6
#---- ComboCheckBox ----
ComboCheckBox.background = $fill.normal
ComboCheckBox.border = com.fine.theme.light.ui.FineRoundBorder
#---- Component ---- #---- Component ----
Component.focusWidth = 0 Component.focusWidth = 0
@ -727,7 +732,7 @@ Slider.trackWidth = 2
Slider.thumbSize = 12,12 Slider.thumbSize = 12,12
Slider.focusWidth=0 Slider.focusWidth=0
Slider.trackValueColor=$brand.normal Slider.trackValueColor=$brand.normal
Slider.trackColor=$border.divider Slider.trackColor=$track.normal
Slider.thumbColor=$fill.normal Slider.thumbColor=$fill.normal
Slider.thumbBorderColor=$border.divider Slider.thumbBorderColor=$border.divider
Slider.tickColor = @disabledForeground Slider.tickColor = @disabledForeground
@ -1276,6 +1281,15 @@ chart.selectedBorderColor = #2576EF
borderWidth : 0; \ borderWidth : 0; \
disabledBackground : fade($Button.background,0%); disabledBackground : fade($Button.background,0%);
[style]Button.plainArrowButton=\
background : fade($Button.background,0%); \
margin: 4,4,4,4; \
borderWidth : 0; \
disabledBackground : fade($Button.background,0%); \
hoverBackground : null; \
selectedBackground : null; \
pressedBackground : null
[style]CombinationButton.primary = \ [style]CombinationButton.primary = \
background : @BrandColor; \ background : @BrandColor; \
arc : 3 arc : 3
@ -1328,6 +1342,11 @@ chart.selectedBorderColor = #2576EF
[style]TextField.transparentTextField=\ [style]TextField.transparentTextField=\
background: fade(@background, 0%); \ background: fade(@background, 0%); \
border: null; border: null;
[style]TextField.offsetLeftText=\
background: fade(@background, 0%); \
border: 0,6,0,0;
[style]PopupMenu.dropdownPopupMenu=\ [style]PopupMenu.dropdownPopupMenu=\
background: fade(@background, 0%); \ background: fade(@background, 0%); \
borderInsets: 0,0,0,0; borderInsets: 0,0,0,0;

46
designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java

@ -0,0 +1,46 @@
package com.fr.design.gui.storybook.components;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.StoryBoard;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ArrayUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex;
public class ComboCheckBoxStoryBoard extends StoryBoard {
public ComboCheckBoxStoryBoard() {
super("下拉多选框");
add(
cell(new UILabel("普通状态")).with(this::h3),
cell(getComboCheckBox(ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4"))),
cell(new UILabel("长文字状态")).with(this::h3),
cell(getComboCheckBox(ArrayUtils.toArray("测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1",
"测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2",
"测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3",
"测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4"))),
flex()
);
}
private UIComboCheckBox getComboCheckBox(Object[] array) {
return new UIComboCheckBox(array, true) {
protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = getClickPane();
pane.setOpaque(false);
this.add(pane, BorderLayout.CENTER);
}
};
}
}

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

@ -24,7 +24,7 @@ import java.awt.Graphics2D;
* 图表的缩略图Icon, 在选择图表类型界面 用到. * 图表的缩略图Icon, 在选择图表类型界面 用到.
*/ */
public class ChartIcon implements Icon, XMLable { public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = FineUIScale.scale(215); private static final int WIDTH = FineUIScale.scale(210);
private static final int HEIGHT = FineUIScale.scale(100); private static final int HEIGHT = FineUIScale.scale(100);

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

@ -7,6 +7,7 @@ import com.fine.swing.ui.layout.Column;
import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
@ -24,7 +25,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JLayer; import javax.swing.JLayer;
@ -74,6 +74,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
JLayer<UIScrollPane> typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList); JLayer<UIScrollPane> typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList);
iconViewList = new JList(); iconViewList = new JList();
iconViewList.setBorder(null);
iconListModel = new DefaultListModel(); iconListModel = new DefaultListModel();
iconViewList.setModel(iconListModel); iconViewList.setModel(iconListModel);
@ -104,20 +105,20 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
ChartIcon chartIcon = (ChartIcon) value; ChartIcon chartIcon = (ChartIcon) value;
UILabel centerImg = new UILabel(chartIcon); UILabel centerImg = new UILabel(chartIcon);
UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER); UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER);
Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") :
Column component = column( FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor");
fix(5), Color fillColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE);
cell(centerImg), cell(text),
fix(5)
).getComponent();
Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor")
: FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor");
UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5); UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5);
component.setBorder(BorderFactory.createCompoundBorder( Column component = column(
new ScaledEmptyBorder(0, 10, 10, 0), roundedBorder)); fix(5), cell(centerImg), cell(text), fix(5)
component.setBackground(Color.WHITE); ).with(it -> {
return component; it.setOpaque(true);
it.setBorder(roundedBorder);
it.setBackground(fillColor);
}).getComponent();
JPanel pane = FineLayoutBuilder.asBorderLayoutWrapped(component);
pane.setBorder(new ScaledEmptyBorder(0, 10, 10, 0));
return pane;
} }
return this; return this;
} }

114
designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java

@ -1,5 +1,6 @@
package com.fr.design.chart.axis; package com.fr.design.chart.axis;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartAlertValue; import com.fr.chart.chartattr.ChartAlertValue;
@ -13,25 +14,31 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.AlphaPane; import com.fr.design.style.AlphaPane;
import com.fr.design.style.FRFontPane; import com.fr.design.style.FRFontPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import javax.swing.*; import javax.swing.ButtonGroup;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle;
/** /**
* 图表 坐标轴 警戒线值 编辑界面. (默认 位置居左居右) * 图表 坐标轴 警戒线值 编辑界面. (默认 位置居左居右)
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -55,30 +62,14 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
public ChartAlertValuePane() { public ChartAlertValuePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); // 警戒线
this.add(pane, BorderLayout.CENTER);
JPanel alertLinePane =FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
pane.add(alertLinePane);
alertLinePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting")));
JPanel valuePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
alertLinePane.add(valuePane);
valuePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value") + ":"));
textField = new UITextField(); textField = new UITextField();
textField.setColumns(4);
valuePane.add(textField);
textField.addMouseListener(new MouseAdapter() { textField.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
showFormulaPane(); showFormulaPane();
} }
}); });
textField.addKeyListener(new KeyAdapter() { textField.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
e.consume(); e.consume();
@ -86,34 +77,29 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
} }
}); });
JPanel lineStylePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
alertLinePane.add(lineStylePane);
lineStylePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style") + ":"));
lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
lineStylePane.add(lineCombo);
JPanel lineColorPane =FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
alertLinePane.add(lineColorPane);
lineColorPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color") + ":"));
colorBox = new ColorSelectBox(80); colorBox = new ColorSelectBox(80);
lineColorPane.add(colorBox);
alphaPane = new AlphaPane(); alphaPane = new AlphaPane();
alertLinePane.add(alphaPane);
JPanel alertLinePane = column(10,
JPanel tipPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); row(
pane.add(tipPane); cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value"))).weight(1),
cell(textField).weight(4)
tipPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip") + ":", null)); ),
row(
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style"))).weight(1),
tipPane.add(centerPane); cell(lineCombo).weight(4)
),
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color"))).weight(1),
cell(colorBox).weight(4)
),
cell(alphaPane)
).getComponent();
// 提示文字
fontNameBox = new UIComboBox(); fontNameBox = new UIComboBox();
fontNameBox.setPreferredSize(new Dimension(80,20));
fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内 fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内
String[] names = DesignUtils.getAvailableFontFamilyNames4Report(); String[] names = DesignUtils.getAvailableFontFamilyNames4Report();
for(int i = 0; i < names.length; i++) { for(int i = 0; i < names.length; i++) {
@ -121,25 +107,31 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
} }
fontSizeBox = new UIComboBox(); fontSizeBox = new UIComboBox();
fontSizeBox.setPreferredSize(new Dimension(80,20));
Integer[] sizes = FRFontPane.Font_Sizes; Integer[] sizes = FRFontPane.Font_Sizes;
for(int i = 0; i < sizes.length; i++) { for(int i = 0; i < sizes.length; i++) {
fontSizeBox.addItem(sizes[i]); fontSizeBox.addItem(sizes[i]);
} }
leftButton = new UIRadioButton(getLeftName());
double t = TableLayout.FILL; rightButton = new UIRadioButton(getRightName());
double[] rowSize = {t, t, t, t, t}; Component[][] components = {
double[] columnSize = {0.1, 0.2, 0.5, 0.2}; {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") ), contentField = new UITextField()},
Component[][] components= { {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font")), fontNameBox},
{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") + ":"), contentField = new UITextField(3)}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") ), fontSizeBox},
{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font") + ":"), fontNameBox}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),
{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") + ":"), fontSizeBox}, FineLayoutBuilder.createHorizontalLayout(10, leftButton, rightButton)},
{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout") + ": "), leftButton = new UIRadioButton(getLeftName())},
{null, null, rightButton = new UIRadioButton(getRightName())},
}; };
JPanel tablePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
centerPane.add(tablePane); JPanel tipPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 4});
JPanel pane = column(10,
cell(wrapComponentWithTitle(alertLinePane,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting")
)),
cell(wrapComponentWithTitle(tipPane,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip")))
).getComponent();
this.add(pane, BorderLayout.CENTER);
ButtonGroup bg = new ButtonGroup(); ButtonGroup bg = new ButtonGroup();
bg.add(leftButton); bg.add(leftButton);

23
designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java

@ -1,5 +1,7 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
@ -7,18 +9,17 @@ import com.fr.chart.chartdata.GisMapReportDefinition;
import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.GisMapTableDefinition;
import com.fr.chart.chartdata.TopDefinition; import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.DataContentsPane; import com.fr.design.mainframe.chart.gui.data.DataContentsPane;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -102,17 +103,13 @@ public class GisMapDataPane extends DataContentsPane{
contentPane.add(dataFromPane = new UIComboBoxPane<Chart>() { contentPane.add(dataFromPane = new UIComboBoxPane<Chart>() {
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE,6)); this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p,f };
double[] rowSize = { p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source") + ":"), jcb}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")), jcb},
} ; } ;
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); JPanel northPane = FineLayoutBuilder.commonLeftRightLayout(components);
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
@ -134,7 +131,7 @@ public class GisMapDataPane extends DataContentsPane{
} }
}, BorderLayout.CENTER); }, BorderLayout.CENTER);
dataFromPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); dataFromPane.setBorder(new ScaledEmptyBorder(10 ,0, 0, 0));
return contentPane; return contentPane;
} }

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

@ -1,12 +1,12 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.BaseSeriesDefinition;
import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.GisMapReportDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -17,25 +17,26 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
/** /**
* 属性表gis地图单元格数据源设置界面 * 属性表gis地图单元格数据源设置界面
* *
@ -55,37 +56,25 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapRepo
} }
private void initCom() { private void initCom() {
this.setLayout(new BorderLayout(0, 0)); this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
addressType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); addressType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")});
lnglatOrder = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); lnglatOrder = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")});
addressPane = new DefaultTinyFormulaPane(); addressPane = new DefaultTinyFormulaPane();
addressNamePane = new DefaultTinyFormulaPane(); addressNamePane = new DefaultTinyFormulaPane();
double p = TableLayout.PREFERRED; orderPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3},
double f = TableLayout.FILL; new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), lnglatOrder);
double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p, p};
orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) {
@Override
public Dimension getPreferredSize() {
if (this.isVisible()) {
return super.getPreferredSize();
} else {
return new Dimension(0, 0);
}
}
};
orderPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), BorderLayout.WEST);
orderPane.add(lnglatOrder, BorderLayout.CENTER);
orderPane.setVisible(false); orderPane.setVisible(false);
lnglatOrder.setSelectedIndex(0); lnglatOrder.setSelectedIndex(0);
addressType.setSelectedIndex(0); addressType.setSelectedIndex(0);
Component[][] components = new Component[][]{ JPanel northPane = column(10,
new Component[]{addressType, addressPane}, row(10,
new Component[]{orderPane, null}, cell(addressType).weight(1), cell(addressPane).weight(1)
new Component[]{new UILabel(" " +com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name")+":", SwingConstants.RIGHT), addressNamePane}, ),
}; cell(orderPane),
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name"))).weight(1.2), cell(addressNamePane).weight(3)
)
).getComponent();
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);

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

@ -1,10 +1,10 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.GisMapTableDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.constants.LayoutConstants;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
@ -16,17 +16,20 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -34,6 +37,10 @@ import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
/** /**
* 属性表gis地图数据集数据源定义面板 * 属性表gis地图数据集数据源定义面板
* @author eason * @author eason
@ -54,26 +61,20 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane<GisMapTable
private JPanel orderPane; private JPanel orderPane;
public GisMapTableDataContentPane() { public GisMapTableDataContentPane() {
this.setLayout(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Select_Dataset"), SwingConstants.LEFT);
JPanel northPane = new JPanel();
this.add(northPane, BorderLayout.NORTH);
northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); fromTableData = new DatabaseTableDataPane(label) {
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Select_Dataset") + ":", SwingConstants.LEFT);
northPane.add(fromTableData = new DatabaseTableDataPane(label) {
@Override @Override
protected void userEvent() { protected void userEvent() {
refresh2ComboBox(); refresh2ComboBox();
} }
}); };
fromTableData.setPreferredSize(new Dimension(218, 20)); JPanel northPane = FineLayoutBuilder.asBorderLayoutWrapped(fromTableData);
northPane.add(fromTableData); this.add(northPane, BorderLayout.NORTH);
addressType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); addressType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")});
lnglatOrder = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); lnglatOrder = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")});
addressType.addChangeListener(new ChangeListener() { addressType.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -82,22 +83,8 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane<GisMapTable
}); });
addressBox = new UIComboBox(); addressBox = new UIComboBox();
addressNameBox = new UIComboBox(); addressNameBox = new UIComboBox();
double p = TableLayout.PREFERRED; orderPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3},
double f = TableLayout.FILL; new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), lnglatOrder);
double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p, p};
orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM,0)){
@Override
public Dimension getPreferredSize() {
if(this.isVisible()){
return super.getPreferredSize();
}else{
return new Dimension(0,0);
}
}
};
orderPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), BorderLayout.WEST);
orderPane.add(lnglatOrder, BorderLayout.CENTER);
orderPane.setVisible(false); orderPane.setVisible(false);
lnglatOrder.setSelectedIndex(0); lnglatOrder.setSelectedIndex(0);
addressType.setSelectedIndex(0); addressType.setSelectedIndex(0);
@ -105,17 +92,19 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane<GisMapTable
addressNameBox.removeAllItems(); addressNameBox.removeAllItems();
addressNameBox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); addressNameBox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
Component[][] components = new Component[][]{ JPanel centerPane = column(10,
new Component[]{addressType, addressBox}, row(10,
new Component[]{orderPane,null}, cell(addressType).weight(1), cell(addressBox).weight(0.5)
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name") + ":", SwingConstants.RIGHT), addressNameBox}, ),
}; cell(orderPane),
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name"))).weight(1.2),
cell(addressNameBox).weight(3)
)
).getComponent();
JPanel pane = new JPanel(); JPanel pane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
this.add(pane, BorderLayout.CENTER); this.add(pane, BorderLayout.CENTER);
pane.setLayout(new BorderLayout());
pane.add(centerPane, BorderLayout.NORTH); pane.add(centerPane, BorderLayout.NORTH);
String[] titles = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Title"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region_Value")}; String[] titles = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Title"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region_Value")};

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Style; import com.fr.base.Style;
@ -407,11 +408,11 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isAutoRefresh, null}, new Component[]{isAutoRefresh, null},
new Component[]{GUICoreUtils.createFlowPane(new Component[]{ new Component[]{FineLayoutBuilder.createHorizontalLayout(10,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")),
autoRefreshTime, autoRefreshTime,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Seconds")) new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Seconds"))
}, 1)}, )},
new Component[]{new UILabel("<html><font size='2' face='Microsoft Yahei' color='red'>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Support_Img_And_Cell") + "</font></html>"), null}, new Component[]{new UILabel("<html><font size='2' face='Microsoft Yahei' color='red'>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Support_Img_And_Cell") + "</font></html>"), null},
}; };
autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Fine-Design_Chart_Data_Check"}, components, rowSize, columnSize); autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Fine-Design_Chart_Data_Check"}, components, rowSize, columnSize);

110
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java

@ -1,12 +1,14 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fine.swing.ui.layout.Row;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -16,14 +18,16 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.NumberDragBar; import com.fr.design.gui.style.NumberDragBar;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.*; import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -155,33 +159,26 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
} }
private JPanel getWrapShowWayPane() { private JPanel getWrapShowWayPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f};
double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay},
new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose},
new Component[]{null, orientationSpinner, orientationBar, null}, new Component[]{null, createorientionRow()},
new Component[]{null, textAttrPane, null, null}, new Component[]{textAttrPane, null, null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1.2, 3});
} }
private JPanel getIntervalShowWayPane() { private Row createorientionRow() {
return FineLayoutBuilder.createHorizontalLayout(10, new double[]{1, 1.5}, orientationSpinner, orientationBar);
double p = TableLayout.PREFERRED; }
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
private JPanel getIntervalShowWayPane() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getCombox()}, new Component[]{getCombox()},
new Component[]{getTowChoose()}, new Component[]{getTowChoose()},
new Component[]{getOther()} new Component[]{getOther()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1});
} }
private JPanel getTowChoose() { private JPanel getTowChoose() {
@ -192,46 +189,30 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
custom.setSelected(false); custom.setSelected(false);
customLabelSamleTime.setVisible(true); customLabelSamleTime.setVisible(true);
customLabelSamleTime.setEnabled(false); customLabelSamleTime.setEnabled(false);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, f};
double[] rowSize = {p, p};
JPanel customPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ JPanel customPane = FineLayoutBuilder.createHorizontalLayout(10, custom, customLabelSamleTime);
new Component[]{custom, customLabelSamleTime, null},
}, new double[]{p}, new double[]{p, p, f});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, auto,}, new Component[]{auto,},
new Component[]{null, customPane} new Component[]{customPane}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1});
} }
private JPanel getCombox() { private JPanel getCombox() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f};
double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return FineLayoutBuilder.commonLeftRightLayout(components);
} }
private JPanel getOther() { private JPanel getOther() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose},
new Component[]{null, orientationSpinner, orientationBar, null}, new Component[]{null, createorientionRow()},
new Component[]{null, textAttrPane, null, null}, new Component[]{textAttrPane, null, null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3});
} }
private void checkShowWay() { private void checkShowWay() {
@ -246,18 +227,13 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
} else { } else {
labelPane = getWrapShowWayPane(); labelPane = getWrapShowWayPane();
} }
double p = TableLayout.PREFERRED; labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
double f = TableLayout.FILL; showWayPane = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane);
double[] row = {p, p};
double[] col = {f};
showWayPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col);
this.add(showWayPane, BorderLayout.CENTER); this.add(showWayPane, BorderLayout.CENTER);
this.validate(); this.validate();
} }
private void checkOrientationField() { private void checkOrientationField() {
if (labelOrientationChoose.getSelectedIndex() != 2) { if (labelOrientationChoose.getSelectedIndex() != 2) {
orientationBar.setVisible(false); orientationBar.setVisible(false);
@ -283,23 +259,17 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
customLabelSamleTime.registerChangeListener(this.observerListener); customLabelSamleTime.registerChangeListener(this.observerListener);
orientationSpinner.registerChangeListener(this.observerListener); orientationSpinner.registerChangeListener(this.observerListener);
labelOrientationChoose.registerChangeListener(this.observerListener); labelOrientationChoose.registerChangeListener(this.observerListener);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f};
double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelSampleChoose, customLabelSamleTime}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")),
new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, FineLayoutBuilder.createHorizontalLayout(10,labelSampleChoose, customLabelSamleTime)},
new Component[]{null,orientationSpinner, orientationBar, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose},
new Component[]{null,textAttrPane, null, null}, new Component[]{null, createorientionRow()},
new Component[]{textAttrPane, null},
}; };
labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); labelPane = FineLayoutBuilder.commonLeftRightLayout(components);
labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
double[] row = {p,p}; return FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane);
double[] col = {f};
return TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col);
} }
private void checkCustomSampleField() { private void checkCustomSampleField() {

36
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java

@ -1,25 +1,23 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Title; import com.fr.chart.chartattr.Title;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.DefaultTinyFormulaPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -46,36 +44,26 @@ public class ChartAxisTitlePane extends BasicPane{
axisTitleContentPane = new DefaultTinyFormulaPane(); axisTitleContentPane = new DefaultTinyFormulaPane();
axisTitleAttrPane = new ChartTextAttrPane(); axisTitleAttrPane = new ChartTextAttrPane();
axisTitleAttrPane.populate(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 9)); axisTitleAttrPane.populate(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 9));
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), titleAlignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup();
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
Integer[] alignment = new Integer[] { Constants.LEFT, Constants.CENTER, Constants.RIGHT };
titleAlignmentPane = new UIButtonGroup<Integer>(alignmentIconArray, alignment);
titleAlignmentPane.setSelectedItem(Constants.CENTER); titleAlignmentPane.setSelectedItem(Constants.CENTER);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f };
double[] rowSize = { p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,axisTitleContentPane}, new Component[]{axisTitleContentPane},
new Component[]{null,axisTitleAttrPane}, new Component[]{axisTitleAttrPane},
new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style"))}, new Component[]{FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3},
new Component[]{null,titleAlignmentPane,}, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), titleAlignmentPane)},
}; };
titlePane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); titlePane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1});
titlePane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
isAxisTitleVisable.addActionListener(new ActionListener() { isAxisTitleVisable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkTitleUse(); checkTitleUse();
} }
}); });
double[] row = {p,p};
double[] col = {f};
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isAxisTitleVisable, titlePane);
new Component[]{isAxisTitleVisable}, new Component[]{titlePane}}, row, col);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }

32
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java

@ -1,23 +1,24 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.AttrContents; import com.fr.chart.base.AttrContents;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.DataSeriesCondition; import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -49,31 +50,18 @@ public class ChartDataPointLabel4GisPane extends ChartDatapointLabelPane{
initFormatListener(); initFormatListener();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p,p,p,p,p,p};
JPanel delimiterPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM));
delimiterPane.add(new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), BorderLayout.WEST);
delimiterPane.add(divideComoBox, BorderLayout.CENTER);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isAddress, null}, new Component[]{isAddress, null},
new Component[]{isAddressName, null}, new Component[]{isAddressName, null},
new Component[]{isAddressTittle, null}, new Component[]{isAddressTittle, null},
new Component[]{isDatapointValue, valueFormatButton}, new Component[]{isDatapointValue, valueFormatButton},
new Component[]{delimiterPane, null}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), divideComoBox},
new Component[]{textFontPane, null} new Component[]{textFontPane, null}
}; };
labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); labelPane = FineLayoutBuilder.commonLeftRightLayout(components);
labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
double[] row = {p,p}; JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane);
double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f};
JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER) ; this.add(panel, BorderLayout.CENTER) ;

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

@ -1,5 +1,7 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Style; import com.fr.base.Style;
@ -180,11 +182,8 @@ public class ChartDatapointLabelPane extends BasicPane{
components[6] = new Component[]{textFontPane,null}; components[6] = new Component[]{textFontPane,null};
labelPane = TableLayoutHelper.createTableLayoutPane(components,rowSize2,columnSize); labelPane = TableLayoutHelper.createTableLayoutPane(components,rowSize2,columnSize);
} }
labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
double[] row = {p,p}; panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane );
double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f};
panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER) ; this.add(panel,BorderLayout.CENTER) ;

11
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java

@ -6,6 +6,7 @@ import com.fr.design.chart.ChartPlotFactory;
import com.fr.design.chart.axis.AxisStyleObject; import com.fr.design.chart.axis.AxisStyleObject;
import com.fr.design.chart.axis.ChartStyleAxisPane; import com.fr.design.chart.axis.ChartStyleAxisPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; import com.fr.design.mainframe.chart.gui.style.ThirdTabPane;
@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -28,6 +30,15 @@ public class ChartAxisPane extends ThirdTabPane<Chart> implements AutoSelectedPa
super(plot, parent); super(plot, parent);
} }
@Override
protected void initLayout() {
this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
if (!paneList.isEmpty()) {
this.add(tabPane, BorderLayout.NORTH);
}
this.add(centerPane, BorderLayout.CENTER);
}
@Override @Override
protected List<NamePane> initPaneList(Plot plot, AbstractAttrNoScrollPane parent) { protected List<NamePane> initPaneList(Plot plot, AbstractAttrNoScrollPane parent) {
List<NamePane> paneList = new ArrayList<NamePane>(); List<NamePane> paneList = new ArrayList<NamePane>();

32
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.style.axis; package com.fr.design.mainframe.chart.gui.style.axis;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.AxisUnitType; import com.fr.chart.base.AxisUnitType;
@ -10,13 +11,11 @@ import com.fr.chart.chartattr.NumberAxis;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.ChartSwingUtils;
import com.fr.design.chart.axis.MinMaxValuePane; import com.fr.design.chart.axis.MinMaxValuePane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartAxisLabelPane; import com.fr.design.mainframe.chart.gui.style.ChartAxisLabelPane;
@ -34,7 +33,6 @@ import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -153,15 +151,11 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
//构造数据定义界面 //构造数据定义界面
private JPanel createDataDefinePane(){ private JPanel createDataDefinePane(){
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN,p,f};
double[] rowSize = { p, p};
Component[][] component = new Component[][]{ Component[][] component = new Component[][]{
new Component[]{null,initMinMaxValue(),null}, new Component[]{initMinMaxValue(),null},
new Component[]{null, addLogarithmicPane2ValuePane(), addLogText()}, new Component[]{addLogarithmicPane2ValuePane(), addLogText()},
}; };
return TableLayoutHelper.createTableLayoutPane(component, rowSize, columnSize); return FineLayoutBuilder.compatibleTableLayout(10, component, new double[]{1, 1});
} }
// 返回最大最小值界面. 雷达轴 有切换按钮. // 返回最大最小值界面. 雷达轴 有切换按钮.
@ -175,15 +169,13 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
// 返回对数相关界面. 百分比 没有此界面. // 返回对数相关界面. 百分比 没有此界面.
protected JPanel addLogarithmicPane2ValuePane() { protected JPanel addLogarithmicPane2ValuePane() {
JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic"));
labelLogPane.add(logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic")+":"));
labelLogPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base")));
logBaseField = new UITextField(4); logBaseField = new UITextField(4);
logBaseField.setText("10"); logBaseField.setText("10");
logBaseField.setPreferredSize(new Dimension(55, 20)); JPanel labelLogPane = FineLayoutBuilder.createHorizontalLayout(10, logBox,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base")));
logBox.addActionListener(new ActionListener() { logBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkLogUse(); checkLogUse();
} }
@ -195,13 +187,7 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
} }
private JPanel addLogText() { private JPanel addLogText() {
JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); return FineLayoutBuilder.createHorizontalLayout(10, logBaseField);
if(logBaseField != null) {
labelLogPane.add(logBaseField);
}
return labelLogPane;
} }
protected JPanel getAxisTitlePane(){ protected JPanel getAxisTitlePane(){

27
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java

@ -1,15 +1,14 @@
package com.fr.design.mainframe.chart.gui.style.legend; package com.fr.design.mainframe.chart.gui.style.legend;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Legend; import com.fr.chart.chartattr.Legend;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane;
import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane;
@ -18,8 +17,11 @@ import com.fr.design.dialog.BasicScrollPane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -70,24 +72,17 @@ public class ChartLegendPane extends BasicScrollPane<Chart>{
location.setAllToolTips(textArray); location.setAllToolTips(textArray);
backgroundPane = new ChartBackgroundNoImagePane(); backgroundPane = new ChartBackgroundNoImagePane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f };
double[] rowSize = { p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,textAttrPane}, new Component[]{textAttrPane},
new Component[]{new JSeparator(),null}, new Component[]{new JSeparator(),null},
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),location} , new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),location} ,
new Component[]{new JSeparator(),null}, new Component[]{new JSeparator(),null},
new Component[]{borderPane,null}, new Component[]{borderPane,null},
new Component[]{backgroundPane,null} new Component[]{backgroundPane,null}
}; };
legendPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); legendPane = FineLayoutBuilder.commonLeftRightLayout(components);
double[] col = {f}; legendPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
double[] row = {p, p}; JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLegendVisible, legendPane);
JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{isLegendVisible},new Component[]{legendPane},},row,col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
isLegendVisible.addActionListener(new ActionListener() { isLegendVisible.addActionListener(new ActionListener() {

42
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java

@ -1,30 +1,27 @@
package com.fr.design.mainframe.chart.gui.style.title; package com.fr.design.mainframe.chart.gui.style.title;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Title; import com.fr.chart.chartattr.Title;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.DefaultTinyFormulaPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane;
import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -57,16 +54,12 @@ public class ChartTitlePane extends BasicScrollPane<Chart> {
isTitleVisable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); isTitleVisable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible"));
titlePane = createTitlePane(); titlePane = createTitlePane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isTitleVisable}, new Component[]{isTitleVisable},
new Component[]{titlePane} new Component[]{titlePane}
} ; } ;
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1});
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
@ -83,10 +76,6 @@ public class ChartTitlePane extends BasicScrollPane<Chart> {
backgroundPane = new ChartBackgroundNoImagePane(); backgroundPane = new ChartBackgroundNoImagePane();
chartDefaultAttrPane = createDefaultAttrPane(); chartDefaultAttrPane = createDefaultAttrPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{chartDefaultAttrPane,null}, new Component[]{chartDefaultAttrPane,null},
new Component[]{new JSeparator(),null}, new Component[]{new JSeparator(),null},
@ -94,29 +83,22 @@ public class ChartTitlePane extends BasicScrollPane<Chart> {
new Component[]{backgroundPane,null} new Component[]{backgroundPane,null}
} ; } ;
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 0});
} }
private JPanel createDefaultAttrPane(){ private JPanel createDefaultAttrPane(){
titleContent = new DefaultTinyFormulaPane(); titleContent = new DefaultTinyFormulaPane();
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), alignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup();
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
alignmentPane = new UIButtonGroup<Integer>(alignmentIconArray, alignment);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, f};
double[] rowSize = {p, p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,titleContent,null}, new Component[]{titleContent,null},
new Component[]{null,textAttrPane,null}, new Component[]{textAttrPane,null},
new Component[]{null,new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style") + ":"),alignmentPane} , new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), alignmentPane} ,
} ; } ;
JPanel attrPane = FineLayoutBuilder.commonLeftRightLayout(components);
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); attrPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
return attrPane;
} }
// 检查标题界面是否可用. // 检查标题界面是否可用.

20
designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java

@ -5,13 +5,13 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.data.TableDataSource;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor; import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.main.WidgetGatherAdapter;
import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.ShareEmbeddedConverter;
import com.fr.form.share.bean.ComponentReuBean; import com.fr.form.share.bean.ComponentReuBean;
import com.fr.form.share.editor.DefaultSharableEditor; import com.fr.form.share.editor.DefaultSharableEditor;
import com.fr.form.share.editor.PlainSharableEditor; import com.fr.form.share.editor.PlainSharableEditor;
@ -21,11 +21,14 @@ import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.IOFileAttrMark; import com.fr.stable.fun.IOFileAttrMark;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.tabledata.PreviewSourceBean;
import com.fr.workspace.server.entity.tabledata.TableDataBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -112,8 +115,7 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
//内置数据集 //内置数据集
if (tpl != null) { if (tpl != null) {
ShareEmbeddedConverter embeddedConverter = WorkContext.getCurrent().get(ShareEmbeddedConverter.class); Map<String, TableData> map = convertToEmbeddedTableData(tpl, paraMap);
Map<String, TableData> map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap);
Iterator<Map.Entry<String, TableData>> iterator = map.entrySet().iterator(); Iterator<Map.Entry<String, TableData>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<String, TableData> entry = iterator.next(); Map.Entry<String, TableData> entry = iterator.next();
@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
return tpl; return tpl;
} }
private Map<String, TableData> convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception {
PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]);
List<TableDataBean> beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean);
Map<String, TableData> ans = new HashMap<>();
for (TableDataBean tableDataBean : beanList) {
ans.put(tableDataBean.getName(), tableDataBean.getTableData());
}
return ans;
}
@NotNull @NotNull
protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) { protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) {

25
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

@ -5,7 +5,6 @@ import com.fr.design.editor.editor.DateEditor;
import com.fr.design.editor.editor.DoubleEditor; import com.fr.design.editor.editor.DoubleEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.widget.editors.DataBindingEditor; import com.fr.design.mainframe.widget.editors.DataBindingEditor;
@ -19,6 +18,9 @@ import com.fr.form.ui.concept.data.ValueInitializer;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
@ -34,20 +36,31 @@ import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP;
public class FormWidgetValuePane extends JPanel { public class FormWidgetValuePane extends JPanel {
private UIButtonGroup widgetValueHead; private UIButtonGroup widgetValueHead;
private Editor[] editor; private Editor[] editor;
private ReactiveCardPane customPane; private JPanel customPane;
private CardLayout cardLayout;
public FormWidgetValuePane(Object o, boolean onlyServer) { public FormWidgetValuePane(Object o, boolean onlyServer) {
DataControl widget = (DataControl) o; DataControl widget = (DataControl) o;
editor = createWidgetValueEditor(widget, onlyServer); editor = createWidgetValueEditor(widget, onlyServer);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
customPane = ReactiveCardPane.create(); cardLayout = new CardLayout();
customPane = new JPanel(cardLayout) {
@Override
public Dimension getPreferredSize() {
for (Component comp : getComponents()) {
if (comp.isVisible()) {
return comp.getPreferredSize();
}
}
return new Dimension(0, 0);
}
};
final String[] tabTitles = new String[editor.length]; final String[] tabTitles = new String[editor.length];
for (int i = 0; i < editor.length; i++) { for (int i = 0; i < editor.length; i++) {
Editor currentEditor = editor[i]; Editor currentEditor = editor[i];
customPane.addSupplier(editor[i].getName(), () -> currentEditor); customPane.add(currentEditor, editor[i].getName());
tabTitles[i] = editor[i].getName(); tabTitles[i] = editor[i].getName();
} }
customPane.select(editor[0].getName()).populate();
widgetValueHead = new UIButtonGroup(tabTitles); widgetValueHead = new UIButtonGroup(tabTitles);
UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"));
this.add(column(VERTICAL_GAP, this.add(column(VERTICAL_GAP,
@ -69,7 +82,7 @@ public class FormWidgetValuePane extends JPanel {
index = 0; index = 0;
widgetValueHead.setSelectedIndex(index); widgetValueHead.setSelectedIndex(index);
} }
customPane.select(editor[index].getName()).populate(); cardLayout.show(customPane, editor[index].getName());
} }

14
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -11,6 +11,7 @@ import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental; import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.config.ConfigProviderFactory; import com.fanruan.config.ConfigProviderFactory;
import com.fanruan.config.LocalConfigSource;
import com.fanruan.config.realm.ConfigRealm; import com.fanruan.config.realm.ConfigRealm;
import com.fanruan.dao.context.DBContextProvider; import com.fanruan.dao.context.DBContextProvider;
import com.fanruan.dao.context.DBContextStarter; import com.fanruan.dao.context.DBContextStarter;
@ -26,6 +27,7 @@ import com.fanruan.kv.factory.KVStoreFactory;
import com.fanruan.kv.manager.CarinaKVManager; import com.fanruan.kv.manager.CarinaKVManager;
import com.fanruan.kv.store.KVStore; import com.fanruan.kv.store.KVStore;
import com.fanruan.kv.store.KVStoreHolder; import com.fanruan.kv.store.KVStoreHolder;
import com.fanruan.repository.LocalConfigSourceShell;
import com.fanruan.workplace.http.RepositoryManager; import com.fanruan.workplace.http.RepositoryManager;
import com.fr.cbb.dialect.security.InsecurityElementFactory; import com.fr.cbb.dialect.security.InsecurityElementFactory;
import com.fr.cluster.ClusterBridge; import com.fr.cluster.ClusterBridge;
@ -64,12 +66,12 @@ import com.fr.intelli.record.Focus;
import com.fr.intelli.record.FocusInterceptor; import com.fr.intelli.record.FocusInterceptor;
import com.fr.intelli.record.PerformancePoint; import com.fr.intelli.record.PerformancePoint;
import com.fr.intelli.record.PerformancePointInterceptor; import com.fr.intelli.record.PerformancePointInterceptor;
import com.fr.invoke.Reflect;
import com.fr.io.base.ResourcePaths; import com.fr.io.base.ResourcePaths;
import com.fr.io.repository.ResourceRepository; import com.fr.io.repository.ResourceRepository;
import com.fr.io.repository.ResourceRepositoryWrapper; import com.fr.io.repository.ResourceRepositoryWrapper;
import com.fr.io.utils.ResourceIOUtils; import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.record.analyzer.AnalyzerConfiguration; import com.fr.record.analyzer.AnalyzerConfiguration;
import com.fr.record.analyzer.AnalyzerMutableGroup; import com.fr.record.analyzer.AnalyzerMutableGroup;
import com.fr.record.analyzer.DBMetrics; import com.fr.record.analyzer.DBMetrics;
@ -81,7 +83,6 @@ import com.fr.security.encryption.SystemEncryptionManager;
import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.core.EncryptionScaffold;
import com.fr.security.encryption.provider.SecuritySeedProvider; import com.fr.security.encryption.provider.SecuritySeedProvider;
import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey; import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.db.DBContext; import com.fr.stable.db.DBContext;
import com.fr.stable.db.properties.FineMicroServicesDBProperties; import com.fr.stable.db.properties.FineMicroServicesDBProperties;
@ -102,8 +103,6 @@ import com.fr.transaction.HibernateTransactor;
import com.fr.transaction.RemoteTransactor; import com.fr.transaction.RemoteTransactor;
import com.fr.transaction.TransactorFactory; import com.fr.transaction.TransactorFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fanruan.config.LocalConfigSource;
import com.fr.workspace.server.repository.config.LocalConfigSourceShell;
import java.net.URI; import java.net.URI;
import java.sql.Connection; import java.sql.Connection;
@ -247,9 +246,14 @@ public class DesignEnvComponent {
*/ */
private void startLogger() { private void startLogger() {
// 获取本地的日志级别配置 // 获取本地的日志级别配置
Log4jConfigFactory.getInstance().setRootLevel(Log4jConfig.getInstance().getRootLevel()); Level localLogPreferLevel = Log4jConfig.getInstance().getRootLevel();
// 刷新到本地配置
Log4jConfigFactory.getInstance().setRootLevel(localLogPreferLevel);
URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY); URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY);
FRLogger.getLogger().config(uri); FRLogger.getLogger().config(uri);
// 刷新到carina的配置,防止 portal service 启动的时候覆盖了
// 配置对象都是默认都文件读取的,设计器本地启动的阶段反射修改一下
Reflect.on(Carina.properties(LoggerProperties.class)).set("level", localLogPreferLevel.name());
// 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下 // 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下
listenConfig(); listenConfig();
} }

23
designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

@ -1,5 +1,6 @@
package com.fanruan.boot.init; package com.fanruan.boot.init;
import com.fanruan.boot.RepositorySourceRegister;
import com.fanruan.carina.Carina; import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.FineComponent;
@ -7,18 +8,14 @@ import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental; import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup; import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.repository.TemplateRepository;
import com.fanruan.workplace.conetxt.CompatiblePool; import com.fanruan.workplace.conetxt.CompatiblePool;
import com.fanruan.workplace.http.HttpConstants; import com.fanruan.workplace.http.HttpConstants;
import com.fanruan.workplace.http.RepositoryManager; import com.fanruan.workplace.http.RepositoryManager;
import com.fanruan.workplace.http.WorkspaceHeartBeatShell; import com.fanruan.workplace.http.WorkspaceHeartBeatShell;
import com.fanruan.workplace.http.exception.DefaultRemoteExceptionHandler; import com.fanruan.workplace.http.exception.DefaultRemoteExceptionHandler;
import com.fr.report.UnLockedHandler;
import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler;
import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler;
import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler;
import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler;
import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler;
import com.fanruan.workplace.http.exception.RemoteExceptionConvert; import com.fanruan.workplace.http.exception.RemoteExceptionConvert;
import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fanruan.workplace.standard.ServerInfo; import com.fanruan.workplace.standard.ServerInfo;
import com.fanruan.workplace.standard.ServerInfoOperator; import com.fanruan.workplace.standard.ServerInfoOperator;
import com.fr.base.io.FileAssistUtils; import com.fr.base.io.FileAssistUtils;
@ -31,13 +28,13 @@ import com.fr.design.env.HttpWorkspaceConnector;
import com.fr.env.operator.CommonOperatorImpl; import com.fr.env.operator.CommonOperatorImpl;
import com.fr.esd.core.remote.ESDConfigEventOperator; import com.fr.esd.core.remote.ESDConfigEventOperator;
import com.fr.esd.core.remote.ESDConfigEventOperatorImpl; import com.fr.esd.core.remote.ESDConfigEventOperatorImpl;
import com.fr.file.ConnectionOperator;
import com.fr.file.TableDataOperator; import com.fr.file.TableDataOperator;
import com.fr.file.TableDataOperatorImpl; import com.fr.file.TableDataOperatorImpl;
import com.fr.file.filetree.FileNodes; import com.fr.file.filetree.FileNodes;
import com.fr.file.filetree.LocalFileNodes; import com.fr.file.filetree.LocalFileNodes;
import com.fr.general.build.BuildInfoOperator; import com.fr.general.build.BuildInfoOperator;
import com.fr.general.build.impl.BuildInfoOperatorImpl; import com.fr.general.build.impl.BuildInfoOperatorImpl;
import com.fr.report.UnLockedHandler;
import com.fr.security.encryption.storage.StorageEncryptors; import com.fr.security.encryption.storage.StorageEncryptors;
import com.fr.security.encryption.storage.StorageTransfer; import com.fr.security.encryption.storage.StorageTransfer;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -50,6 +47,11 @@ import com.fr.workspace.engine.FineWorkspaceFactory;
import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat; import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat;
import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat; import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat;
import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler;
import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler;
import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler;
import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler;
import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler;
import com.fr.workspace.engine.exception.RemoteDriverUnExistHandler; import com.fr.workspace.engine.exception.RemoteDriverUnExistHandler;
import com.fr.workspace.engine.exception.RemoteProcedureErrorHandler; import com.fr.workspace.engine.exception.RemoteProcedureErrorHandler;
import com.fr.workspace.engine.resource.FineWorkResource; import com.fr.workspace.engine.resource.FineWorkResource;
@ -58,17 +60,14 @@ import com.fr.workspace.pool.WorkRPCRegister;
import com.fr.workspace.pool.WorkRPCType; import com.fr.workspace.pool.WorkRPCType;
import com.fr.workspace.resource.WorkResource; import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fanruan.repository.ConfigRepository;
import com.fr.workspace.server.repository.config.ConfigRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.plugin.PluginRepository; import com.fr.workspace.server.repository.plugin.PluginRepository;
import com.fr.workspace.server.repository.resource.PublicResourceRepository; import com.fr.workspace.server.repository.resource.PublicResourceRepository;
import com.fr.workspace.server.repository.resource.WorkResourceRepository; import com.fr.workspace.server.repository.resource.WorkResourceRepository;
import com.fr.workspace.server.repository.system.SystemInfoRepository; import com.fr.workspace.server.repository.system.SystemInfoRepository;
import com.fr.workspace.server.repository.tabledata.TableDataRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import com.fr.workspace.server.repository.template.TemplateRepository;
import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.repository.widget.ShareRepository; import com.fr.workspace.server.repository.widget.ShareRepository;
@ -94,6 +93,7 @@ public class DesignWorkContextComponent {
public void prepare() { public void prepare() {
supplementalExtra(); supplementalExtra();
supplementalCommon(); supplementalCommon();
RepositorySourceRegister.registerRepositorySource();
} }
@ -177,7 +177,6 @@ public class DesignWorkContextComponent {
WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()), WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()), WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()),
WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()), WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(ConnectionOperator.class, CompatibleConnectionOperator.getInstance()),
WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl()) WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl())
); );
} }

2
designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java

@ -1,7 +1,7 @@
package com.fanruan.config; package com.fanruan.config;
import com.fr.base.email.EmailCenter; import com.fr.base.email.EmailCenter;
import com.fr.workspace.server.repository.config.BaseConfigSource; import com.fanruan.repository.BaseConfigSource;
/** /**
* 本地配置资源 * 本地配置资源

23
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
@ -12,14 +11,12 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fanruan.entity.template.TemplateListBean;
import com.fanruan.repository.TemplateRepository;
import java.util.List; import java.util.List;
@ -83,12 +80,8 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return lessModelList; return lessModelList;
} }
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY, AlphaFineConstants.FILE_EXTENSIONS, true, false, false);
@Override fileNodes = TemplateRepository.getInstance().list(bean);
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true);
}
}).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false);
isContainCpt = true; isContainCpt = true;
isContainFrm = true; isContainFrm = true;
doSearch(this.searchText); doSearch(this.searchText);
@ -161,12 +154,8 @@ public class FileSearchManager implements AlphaFineSearchProvider {
*/ */
private void doFileContentSearch(String searchText) { private void doFileContentSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, searchText, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false, false);
@Override FileNode[] fileNodes = TemplateRepository.getInstance().filterFiles(bean);
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true);
}
}).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false);
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {
FileModel model = new FileModel(node.getName(), node.getEnvPath()); FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) {

7
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java

@ -292,12 +292,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
protected void setLayoutAndAddComponents() { protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UITextField editor = getEditor(); this.add(getClickPane(), BorderLayout.CENTER);
UIButton arrowButton = getArrowButton();
setStyle(editor, TRANSPARENT_TEXT_FIELD);
setStyle(arrowButton, PLAIN_BUTTON);
this.add(editor, BorderLayout.CENTER);
this.add(arrowButton, BorderLayout.EAST);
} }
@Override @Override

10
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java

@ -1,12 +1,10 @@
package com.fr.design.mainframe.cell.settingpane.desensitization.model; package com.fr.design.mainframe.cell.settingpane.desensitization.model;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.data.desensitize.rule.DesensitizationRuleManager;
import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRule;
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import javax.swing.SwingWorker; import javax.swing.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -26,8 +24,8 @@ public class UpdateDataWorker extends SwingWorker<Map<String, Object>, Void> {
@Override @Override
protected Map<String, Object> doInBackground() { protected Map<String, Object> doInBackground() {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, String> allRoles = WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization(); Map<String, String> allRoles = RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization();
Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> allRules = DesensitizationRuleManager.getInstance().getAllRules(); Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> allRules = RemoteAuthorityRepository.getInstance().getAllRoles().getSourceRuleMap();
result.put(ROLE_KEY, allRoles); result.put(ROLE_KEY, allRoles);
result.put(RULE_KEY, allRules); result.put(RULE_KEY, allRules);

Loading…
Cancel
Save