Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~kerry/design_10.0 into feature/x

feature/x
kerry 3 years ago
parent
commit
6d6f5362bd
  1. 15
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 5
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 30
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java
  5. 6
      designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java
  6. 29
      designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java
  7. 12
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  8. 11
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  9. 6
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  10. 3
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  11. 217
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  12. 42
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
  13. 22
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  14. 41
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java
  15. 27
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogEventConverter.java
  16. 38
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java
  17. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  18. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java
  19. BIN
      designer-base/src/main/resources/com/fr/design/images/sort/add.png
  20. 19
      designer-base/src/main/resources/com/fr/design/images/sort/asc.svg
  21. 17
      designer-base/src/main/resources/com/fr/design/images/sort/des.svg
  22. BIN
      designer-base/src/main/resources/com/fr/design/images/sort/down_arrow.png
  23. BIN
      designer-base/src/main/resources/com/fr/design/images/sort/left_arrow.png
  24. 41
      designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg
  25. 33
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java
  26. 54
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  27. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  28. 109
      designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  29. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  30. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java
  31. 47
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  32. 27
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  33. 3
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java
  34. 1
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java
  35. 11
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  36. 3
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java
  37. 38
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java
  38. 40
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java
  39. 59
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java
  40. 19
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java
  41. 37
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java
  42. 39
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java
  43. 148
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java
  44. 153
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java
  45. 103
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  46. 173
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  47. 100
      designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java
  48. 32
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java
  49. 160
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java
  50. 66
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java
  51. 39
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java
  52. 42
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java
  53. 23
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java
  54. 125
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  55. 81
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java
  56. 234
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  57. 59
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java
  58. 227
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  59. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

15
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -53,7 +53,8 @@ import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.apache.log4j.FileAppender; import com.fr.third.apache.logging.log4j.core.appender.FileAppender;
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout;
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.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
@ -324,18 +325,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!new File(fileName).exists()) { if (!new File(fileName).exists()) {
StableUtils.makesureFileExist(new File(fileName)); StableUtils.makesureFileExist(new File(fileName));
} }
LogHandler handler = new LogHandler<FileAppender>() { LogHandler<FileAppender> handler = new LogHandler<FileAppender>() {
final FileAppender appender = new FileAppender( final FileAppender appender = FileAppender.newBuilder().
new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"), setName(FileAppender.class.getSimpleName()).
fileName setLayout(PatternLayout.newBuilder().withPattern("%d{HH:mm:ss} %t %p [%c] %m%n").build()).
); withFileName(fileName).build();
@Override @Override
public FileAppender getHandler() { public FileAppender getHandler() {
return appender; return appender;
} }
}; };
handler.getHandler().start();
FineLoggerFactory.getLogger().addLogAppender(handler); FineLoggerFactory.getLogger().addLogAppender(handler);
} catch (SecurityException e) { } catch (SecurityException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

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

@ -29,7 +29,6 @@ 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.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
@ -45,14 +44,12 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.logging.log4j.Level;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; 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.sun.javafx.tk.FileChooserType;
import javafx.stage.FileChooser;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;

30
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -23,27 +23,31 @@ public class CellRectangleStylePreviewPane extends JPanel {
private final int[][] borderSourceFlags = new int[ROW_COUNT][COLUMN_COUNT]; private final int[][] borderSourceFlags = new int[ROW_COUNT][COLUMN_COUNT];
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT]; private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT];
public CellRectangleStylePreviewPane() { public CellRectangleStylePreviewPane(boolean supportInnerBorder) {
setLayout(new GridLayout(2, 2)); setLayout(new GridLayout(2, 2));
for (int r = 0; r < ROW_COUNT; r++) { for (int r = 0; r < ROW_COUNT; r++) {
for (int c = 0; c < COLUMN_COUNT; c++) { for (int c = 0; c < COLUMN_COUNT; c++) {
CellStylePreviewPane pane = new CellStylePreviewPane(); CellStylePreviewPane pane = new CellStylePreviewPane();
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
if (r != 0) { if (supportInnerBorder) {
flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER; flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
} if (r != 0) {
if (r != ROW_COUNT - 1) { flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; }
} if (r != ROW_COUNT - 1) {
if (c != 0) { flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; }
} if (c != 0) {
if (c != COLUMN_COUNT - 1) { flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; }
if (c != COLUMN_COUNT - 1) {
flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
} }
pane.setStyle(cellElement.getStyle()); pane.setStyle(cellElement.getStyle());
add(pane); add(pane);

7
designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java

@ -0,0 +1,7 @@
package com.fr.design.event;
import java.awt.*;
public interface ComponentChangeListener {
void initListener(Container changedComponent);
}

6
designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java

@ -0,0 +1,6 @@
package com.fr.design.event;
public interface ComponentChangeObserver {
void registerChangeListener(ComponentChangeListener uiChangeableListener);
}

29
designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java

@ -60,11 +60,14 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PluginView plugin = controlPane.getSelectedPlugin(); PluginView plugin = controlPane.getSelectedPlugin();
if (plugin != null) { if (plugin != null) {
boolean isActive = plugin.isActive(); PluginContext pluginContext = getPluginContextByView(plugin);
PluginMarker pluginMarker = PluginMarker.create(plugin.getID(), plugin.getVersion()); if (pluginContext == null) {
final String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled"); return;
if (isActive) { }
PluginManager.getController().forbid(pluginMarker, new PluginTaskCallback() { boolean running = pluginContext.isRunning();
final String modifyMessage = running ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled");
if (running) {
PluginManager.getController().forbidPersistently(pluginContext.getMarker(), new PluginTaskCallback() {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
@ -75,7 +78,7 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
} }
}); });
} else { } else {
PluginManager.getController().enable(pluginMarker, new PluginTaskCallback() { PluginManager.getController().enablePersistently(pluginContext.getMarker(), new PluginTaskCallback() {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
@ -145,13 +148,25 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
} }
private void changeTextForButton(PluginView plugin) { private void changeTextForButton(PluginView plugin) {
if (plugin.isActive()) { PluginContext pluginContext = getPluginContextByView(plugin);
if (pluginContext == null) {
return;
}
if (pluginContext.isRunning()) {
disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Disable")); disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Disable"));
} else { } else {
disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Active")); disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Active"));
} }
} }
private PluginContext getPluginContextByView(PluginView pluginView) {
if (pluginView != null) {
PluginMarker pluginMarker = PluginMarker.create(pluginView.getID(), pluginView.getVersion());
return PluginManager.getContext(pluginMarker);
}
return null;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Installed"; return "Installed";

12
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -99,9 +99,9 @@ public class PluginOperateUtils {
public void run() { public void run() {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker); PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean active = plugin.isActive(); boolean isRunning = plugin.isRunning();
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback);
if (active) { if (isRunning) {
PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder);
if (forbidReminder != null && forbidReminder.getContent() != null) { if (forbidReminder != null && forbidReminder.getContent() != null) {
// 禁用前提示 // 禁用前提示
@ -113,14 +113,14 @@ public class PluginOperateUtils {
JOptionPane.WARNING_MESSAGE JOptionPane.WARNING_MESSAGE
); );
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); PluginManager.getController().forbidPersistently(pluginMarker, modifyStatusCallback);
} }
} else { } else {
// 正常禁用 // 正常禁用
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); PluginManager.getController().forbidPersistently(pluginMarker, modifyStatusCallback);
} }
} else { } else {
PluginManager.getController().enable(pluginMarker, modifyStatusCallback); PluginManager.getController().enablePersistently(pluginMarker, modifyStatusCallback);
} }
} }
}); });

11
designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -3,6 +3,8 @@ package com.fr.design.gui.frpane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
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.ComponentChangeListener;
import com.fr.design.event.ComponentChangeObserver;
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.stable.StringUtils; import com.fr.stable.StringUtils;
@ -103,6 +105,15 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
} }
}); });
} }
if(tmpComp instanceof ComponentChangeObserver){
ComponentChangeObserver uiChangeableObserver = ((ComponentChangeObserver)tmpComp);
uiChangeableObserver.registerChangeListener(new ComponentChangeListener() {
@Override
public void initListener(Container changedComponent) {
AbstractAttrNoScrollPane.this.initListener(changedComponent);
}
});
}
} }
} }

6
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -58,7 +58,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
super(locText, b); super(locText, b);
setUI(new UICheckBoxUI()); setUI(new UICheckBoxUI());
initListener(); initListener();
this.markMnemonic=markMnemonic; this.markMnemonic = markMnemonic;
} }
public UICheckBox(String text, Icon icon) { public UICheckBox(String text, Icon icon) {
@ -100,6 +100,10 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
} }
public void removeChangeListener() {
uiObserverListener = null;
}
@Override @Override
public void setGlobalName(String name) { public void setGlobalName(String name) {
checkboxName = name; checkboxName = name;

3
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -223,6 +223,9 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
} else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) { } else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle()); this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor()); this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor());
} else {
this.currentLineCombo.setSelectedLineStyle(Constants.LINE_NONE);
this.currentLineColorPane.setSelectObject(Color.BLACK);
} }
} }

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

@ -7,7 +7,6 @@ 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.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; 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;
@ -18,21 +17,18 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
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.BorderFactory;
import javax.swing.JComponent;
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.UIManager; import javax.swing.UIManager;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@ -43,7 +39,6 @@ import java.awt.event.ItemListener;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.Format; import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
/** /**
* @author Starryi * @author Starryi
@ -68,69 +63,45 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME}; private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME};
private Format format; protected UIComboBox typeComboBox;
protected TextFontComboBox<String> textField;
private UIComboBox typeComboBox; protected UICheckBox roundingBox;
private TextFontComboBox textField; protected UILabel previewLabel;
private UILabel sampleLabel;
private JPanel contentPane;
private JPanel txtCenterPane;
private JPanel centerPane;
private JPanel optionPane;
private UICheckBox roundingBox;
private JPanel formatFontPane;
private boolean isRightFormat; private boolean isRightFormat;
private boolean isDate = false; private boolean isDate = false;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
/**
* Constructor.
*/
public TextFormatPane() { public TextFormatPane() {
this.initComponents(TYPES);
}
protected UIComboBox getTypeComboBox() { initFormatTypesComboBox();
return typeComboBox; initTextFontComboBox4GeneralFormats();
initRoundingCheckBox4PercentFormat();
initPreviewLabel4GeneralFormat();
initLayout();
setTextFieldVisible(false);
setRoundingBoxVisible(false);
setPreviewLabelVisible(false);
} }
protected void initComponents(Integer[] types) { private void initFormatTypesComboBox() {
this.setLayout(new BorderLayout(0, 4)); typeComboBox = new UIComboBox(TextFormatPane.TYPES);
initSampleLabel(); typeComboBox.setRenderer(createComBoxRender());
contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 65);
}
};
typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener); typeComboBox.addItemListener(itemListener);
typeComboBox.setGlobalName("typeComboBox"); typeComboBox.setGlobalName("typeComboBox");
contentPane.add(sampleLabel, BorderLayout.NORTH); typeComboBox.setPreferredSize(new Dimension(155,20));
}
txtCenterPane = new JPanel(new BorderLayout()); private void initTextFontComboBox4GeneralFormats() {
textField = new TextFontComboBox(); textField = new TextFontComboBox<>();
textField.addItemListener(textFieldItemListener); textField.addItemListener(textFieldItemListener);
textField.setEditable(true); textField.setEditable(true);
textField.setGlobalName("textField"); textField.setGlobalName("textField");
txtCenterPane.add(textField, BorderLayout.NORTH); }
contentPane.add(txtCenterPane, BorderLayout.CENTER);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0));
centerPane.add(contentPane, "show");
typeComboBox.setPreferredSize(new Dimension(155,20));
JPanel typePane = new JPanel(new BorderLayout());
typePane.add(typeComboBox, BorderLayout.CENTER);
typePane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
JPanel option = new JPanel(new BorderLayout()); private void initRoundingCheckBox4PercentFormat() {
option.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"), SwingConstants.LEFT), BorderLayout.WEST);
roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up")); roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up"));
roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0));
roundingBox.addItemListener(new ItemListener() { roundingBox.addItemListener(new ItemListener() {
@ -139,54 +110,13 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
} }
}); });
roundingBox.setGlobalName("roundingBox"); roundingBox.setGlobalName("roundingBox");
option.add(roundingBox, BorderLayout.CENTER);
optionPane = new JPanel(new CardLayout());
optionPane.add(new JPanel(), "hide");
optionPane.setPreferredSize(new Dimension(0, 0));
optionPane.add(option, "show");
Component[][] components = getComponent(centerPane, typePane);
this.add(createContentPane(components), BorderLayout.CENTER);
} }
protected JPanel createContentPane (Component[][] components) { private void initPreviewLabel4GeneralFormat() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = new double[components.length];
Arrays.fill(rowSize, p);
double[] columnSize = {p, f};
int[][] rowCount = new int[components.length][2];
Arrays.fill(rowCount, new int[] {1, 1});
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
}
protected Component[][] getComponent (JPanel centerPane, JPanel typePane) {
return new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null},
new Component[]{optionPane, null},
};
}
protected UIComboBoxRenderer createComBoxRender() {
return new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Integer) {
label.setText(" " + FormatField.getInstance().getName((Integer) value));
}
return label;
}
};
}
private void initSampleLabel() {
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR); Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { previewLabel = new UILabel(FormatField.getInstance().getFormatValue()) {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
@ -198,12 +128,65 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
g.setColor(UIConstants.LINE_COLOR); g.setColor(UIConstants.LINE_COLOR);
FontMetrics cellFM = g.getFontMetrics(); FontMetrics cellFM = g.getFontMetrics();
int textWidth = cellFM.stringWidth(getText()); int textWidth = cellFM.stringWidth(getText());
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); GraphHelper.drawString(g, getText(), (width - textWidth) / 2F, 26);
g.setColor(original); g.setColor(original);
} }
}; };
sampleLabel.setHorizontalAlignment(UILabel.CENTER); previewLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(border); previewLabel.setBorder(border);
}
protected void initLayout() {
JPanel labeledFormatTypeComboBoxPane = new JPanel(new BorderLayout(20, 0));
labeledFormatTypeComboBoxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format")), BorderLayout.WEST);
labeledFormatTypeComboBoxPane.add(typeComboBox, BorderLayout.CENTER);
JPanel labeledRoundingCheckboxPane = new JPanel(new BorderLayout(0, 0));
labeledRoundingCheckboxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option")), BorderLayout.WEST);
labeledRoundingCheckboxPane.add(roundingBox, BorderLayout.CENTER);
addComponents(4, new JComponent[] { labeledFormatTypeComboBoxPane, textField, labeledRoundingCheckboxPane, previewLabel});
}
protected void setTextFieldVisible(boolean visible) {
textField.setVisible(visible);
}
protected void setRoundingBoxVisible(boolean visible) {
roundingBox.getParent().setVisible(visible);
}
protected void setPreviewLabelVisible(boolean visible) {
previewLabel.setVisible(visible);
}
protected void addComponents(int gap, JComponent[] components) {
JPanel container = this;
container.setLayout(new BorderLayout(0, gap));
for (JComponent component: components) {
if (component != null) {
container.add(component, BorderLayout.NORTH);
JPanel nextContainer = new JPanel(new BorderLayout(0, gap));
container.add(nextContainer, BorderLayout.CENTER);
container = nextContainer;
}
}
if (container.getComponentCount() == 0) {
container.getParent().remove(container);
}
}
protected UIComboBoxRenderer createComBoxRender() {
return new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Integer) {
label.setText(" " + FormatField.getInstance().getName((Integer) value));
}
return label;
}
};
} }
@ -231,8 +214,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
* Populate * Populate
*/ */
public void populateBean(Format format) { public void populateBean(Format format) {
this.format = format;
if (format == null) { if (format == null) {
this.typeComboBox.setSelectedIndex(FormatContents.NULL); this.typeComboBox.setSelectedIndex(FormatContents.NULL);
} else { } else {
@ -325,17 +306,17 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
* Refresh preview label. * Refresh preview label.
*/ */
private void refreshPreviewLabel() { private void refreshPreviewLabel() {
this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); this.previewLabel.setText(FormatField.getInstance().getFormatValue());
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); this.previewLabel.setForeground(UIManager.getColor("Label.foreground"));
try { try {
isRightFormat = true; isRightFormat = true;
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return; return;
} }
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem()))); this.previewLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem())));
} catch (Exception e) { } catch (Exception e) {
this.sampleLabel.setForeground(Color.red); this.previewLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage()); this.previewLabel.setText(e.getMessage());
isRightFormat = false; isRightFormat = false;
} }
} }
@ -354,28 +335,16 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
int contents = getFormatContents(); int contents = getFormatContents();
String[] items = FormatField.getInstance().getFormatArray(contents, false);
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) { if (!isTextOrNull()) {
centerPane.setPreferredSize(new Dimension(0, 0));
cardLayout.show(centerPane, "hide");
} else {
textField.removeAllItems(); textField.removeAllItems();
String[] items = FormatField.getInstance().getFormatArray(contents, false);
textField.setItemArray(items); textField.setItemArray(items);
textField.setSelectedIndex(0); textField.setSelectedIndex(0);
centerPane.setPreferredSize(new Dimension(270, 65));
cardLayout.show(centerPane, "show");
}
CardLayout optionLayout = ((CardLayout) optionPane.getLayout());
if (getFormatContents() == FormatContents.PERCENT) {
optionPane.setPreferredSize(new Dimension(100, 20));
optionLayout.show(optionPane, "show");
} else {
optionPane.setPreferredSize(new Dimension(0, 0));
optionLayout.show(optionPane, "hide");
roundingBox.setSelected(false);
} }
setTextFieldVisible(!isTextOrNull());
setPreviewLabelVisible(!isTextOrNull());
setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT);
} }
} }

42
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java

@ -1,41 +1,41 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.log4j.AppenderSkeleton; import com.fr.third.apache.logging.log4j.core.Filter;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.logging.log4j.core.Layout;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.apache.logging.log4j.core.appender.AbstractAppender;
import com.fr.third.apache.logging.log4j.core.config.Property;
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* Created by Administrator on 2017/7/18 0018. * Created by Administrator on 2017/7/18 0018.
*/ */
public class DesignerLogAppender extends AppenderSkeleton { public class DesignerLogAppender extends AbstractAppender {
public DesignerLogAppender() { protected DesignerLogAppender(String name, Filter filter,
this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"); Layout<? extends Serializable> layout,
boolean ignoreExceptions,
Property[] properties) {
super(name, filter, layout, ignoreExceptions, properties);
} }
protected void append(LoggingEvent event) { public static DesignerLogAppender createDesignerLogAppender() {
this.subAppend(event); return new DesignerLogAppender(DesignerLogAppender.class.getSimpleName(), null, PatternLayout.newBuilder().withPattern("%d{HH:mm:ss} %t %p [%c] %m%n %throwable{0}").build(), false, Property.EMPTY_ARRAY);
} }
public boolean requiresLayout() { @Override
return true; public void append(LogEvent event) {
this.subAppend(event);
} }
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
}
public void subAppend(LoggingEvent event) { public void subAppend(LogEvent event) {
synchronized (DesignerLogHandler.getInstance()) { synchronized (DesignerLogHandler.getInstance()) {
Level level = event.getLevel(); Level level = event.getLevel();
String msg = this.layout.format(event); String msg = (String) this.toSerializable(event);
DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date()); DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date());
} }
} }

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

@ -9,10 +9,9 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.logging.log4j.core.LogEvent;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.ActionMap; import javax.swing.ActionMap;
import javax.swing.InputMap; import javax.swing.InputMap;
@ -128,7 +127,7 @@ public class DesignerLogHandler {
JPopupMenu jPopupMenu = new JPopupMenu(); JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt(); int logLevelInt = Log4jConfig.getInstance().getRootLevel().intLevel();
if (logLevelInt <= DesignerLogger.INFO_INT) { if (logLevelInt <= DesignerLogger.INFO_INT) {
jPopupMenu.add(showInfo); jPopupMenu.add(showInfo);
jPopupMenu.add(showError); jPopupMenu.add(showError);
@ -240,23 +239,22 @@ public class DesignerLogHandler {
return resultPane; return resultPane;
} }
public void printStackTrace(LoggingEvent event) { public void printStackTrace(LogEvent event) {
int intLevel = event.getLevel().toInt(); int intLevel = event.getLevel().intLevel();
Date date = new Date(event.getTimeStamp()); Date date = new Date(event.getTimeMillis());
ThrowableInformation information = event.getThrowableInformation();
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) { if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getMessage().getFormattedMessage(), intLevel, date, event.getThrown());
} else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) { } else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getMessage().getFormattedMessage(), intLevel, date, event.getThrown());
} else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) { } else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); printMessage(event.getMessage().getFormattedMessage(), intLevel, date, event.getThrown());
} }
} }
public void printStackTrace(String message, Level level, Date date) { public void printStackTrace(String message, Level level, Date date) {
int intLevel = level.toInt(); int intLevel = level.intLevel();
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) { if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(message, intLevel, date); printMessage(message, intLevel, date);
} else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) { } else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {

41
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java

@ -1,26 +1,25 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation;
/** /**
* 设计器日志记录 * 设计器日志记录
*/ */
public class DesignerLogger { public class DesignerLogger {
public static final int INFO_INT = Level.INFO.toInt(); public static final int INFO_INT = Level.INFO.intLevel();
public static final int ERROR_INT = Level.ERROR.toInt(); public static final int ERROR_INT = Level.ERROR.intLevel();
public static final int WARN_INT = Level.WARN.toInt(); public static final int WARN_INT = Level.WARN.intLevel();
/** /**
* 记录LoggingEvent对象 * 记录LoggingEvent对象
* *
* @param event * @param event
*/ */
public static void log(LoggingEvent event) { public static void log(LogEvent event) {
if (event == null) { if (event == null) {
return; return;
} }
@ -30,29 +29,27 @@ public class DesignerLogger {
public enum LogParser { public enum LogParser {
DEFAULT(-1) { DEFAULT(-1) {
@Override @Override
public void log(LoggingEvent event) { public void log(LogEvent event) {
} }
}, },
INFO(Level.INFO.toInt()) { INFO(Level.INFO.intLevel()) {
@Override @Override
public void log(LoggingEvent event) { public void log(LogEvent event) {
FineLoggerFactory.getLogger().info(event.getRenderedMessage()); FineLoggerFactory.getLogger().info(event.getMessage().getFormattedMessage());
} }
}, },
WARN(Level.WARN.toInt()) { WARN(Level.WARN.intLevel()) {
@Override @Override
public void log(LoggingEvent event) { public void log(LogEvent event) {
ThrowableInformation information = event.getThrowableInformation(); FineLoggerFactory.getLogger().warn(event.getMessage().getFormattedMessage(), event.getThrown());
FineLoggerFactory.getLogger().warn(event.getRenderedMessage(), information == null ? null : information.getThrowable());
} }
}, },
ERROR(Level.ERROR.toInt()) { ERROR(Level.ERROR.intLevel()) {
@Override @Override
public void log(LoggingEvent event) { public void log(LogEvent event) {
ThrowableInformation information = event.getThrowableInformation(); FineLoggerFactory.getLogger().error(event.getMessage().getFormattedMessage(), event.getThrown());
FineLoggerFactory.getLogger().error(event.getRenderedMessage(), information == null ? null : information.getThrowable());
} }
}; };
private int level; private int level;
@ -65,8 +62,8 @@ public class DesignerLogger {
return level; return level;
} }
public static LogParser parse(LoggingEvent event) { public static LogParser parse(LogEvent event) {
int intLevel = event.getLevel().toInt(); int intLevel = event.getLevel().intLevel();
for (LogParser logParser : values()) { for (LogParser logParser : values()) {
if (logParser.getLevel() == intLevel) { if (logParser.getLevel() == intLevel) {
return logParser; return logParser;
@ -76,7 +73,7 @@ public class DesignerLogger {
} }
public void log(LoggingEvent event) { public void log(LogEvent event) {
} }
} }
} }

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

@ -0,0 +1,27 @@
package com.fr.design.mainframe.loghandler;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.apache.logging.log4j.core.impl.Log4jLogEvent;
import com.fr.third.apache.logging.log4j.message.SimpleMessage;
/**
* 兼容log4j1和2之间logEvent之间的转换
*
* @author hades
* @version 11.0
* Created by hades on 2021/12/9
*/
public class LogEventConverter {
public static LogEvent convert(LoggingEvent loggingEvent) {
SimpleMessage message = new SimpleMessage(loggingEvent.getRenderedMessage());
return Log4jLogEvent.newBuilder().
setMessage(message).
setLevel(Level.getLevel(loggingEvent.getLevel().toString())).
build();
}
}

38
designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java

@ -4,7 +4,6 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.cell.CellRectangleStylePreviewPane;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -36,14 +35,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
private final JList<ThemedCellStyle> styleList; private final JList<ThemedCellStyle> styleList;
private ChangeListener changeListener; private ChangeListener changeListener;
public ThemedCellStyleListPane() { public ThemedCellStyleListPane(boolean supportInnerBorder) {
this(false);
}
public ThemedCellStyleListPane(boolean supportCellRange) {
defaultListModel = new DefaultListModel<>(); defaultListModel = new DefaultListModel<>();
styleList = new JList<>(defaultListModel); styleList = new JList<>(defaultListModel);
styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); styleList.setCellRenderer(new RadioButtonListCellRangeRenderer(supportInnerBorder));
styleList.setOpaque(false); styleList.setOpaque(false);
styleList.setBackground(null); styleList.setBackground(null);
styleList.addListSelectionListener(new ListSelectionListener() { styleList.addListSelectionListener(new ListSelectionListener() {
@ -115,43 +110,18 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
styleList.setModel(defaultListModel); styleList.setModel(defaultListModel);
} }
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button;
private final CellStylePreviewPane previewArea;
public RadioButtonListCellRenderer() {
super();
setLayout(new BorderLayout(20, 0));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setPreferredSize(new Dimension(getPreferredSize().width, 40));
button = new UIRadioButton();
previewArea = new CellStylePreviewPane();
add(button, BorderLayout.WEST);
add(previewArea, BorderLayout.CENTER);
}
@Override
public Component getListCellRendererComponent(JList<? extends ThemedCellStyle> list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) {
button.setSelected(isSelected);
previewArea.setPaintText(value.getName());
previewArea.setStyle(value.getStyle());
return this;
}
}
private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable { private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button; private final UIRadioButton button;
private final CellRectangleStylePreviewPane previewArea; private final CellRectangleStylePreviewPane previewArea;
public RadioButtonListCellRangeRenderer() { public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) {
super(); super();
setLayout(new BorderLayout(5, 0)); setLayout(new BorderLayout(5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
button = new UIRadioButton(); button = new UIRadioButton();
button.setBorder(BorderFactory.createEmptyBorder()); button.setBorder(BorderFactory.createEmptyBorder());
previewArea = new CellRectangleStylePreviewPane(); previewArea = new CellRectangleStylePreviewPane(supportInnerBorder);
add(button, BorderLayout.WEST); add(button, BorderLayout.WEST);
add(previewArea, BorderLayout.CENTER); add(previewArea, BorderLayout.CENTER);
} }

2
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -116,7 +116,7 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
jPanel.setLayout(new BorderLayout(0, 4)); jPanel.setLayout(new BorderLayout(0, 4));
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewArea = new CellRectangleStylePreviewPane(); previewArea = new CellRectangleStylePreviewPane(true);
previewArea.setPreferredSize(new Dimension(223, 60)); previewArea.setPreferredSize(new Dimension(223, 60));
previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview")));
previewPane.add(previewArea, BorderLayout.CENTER); previewPane.add(previewArea, BorderLayout.CENTER);

2
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java

@ -139,7 +139,7 @@ public class ColorListPane extends JPanel implements UIObserver {
return true; return true;
} }
private static class ColorButton extends AbstractSelectBox<Color> { public static class ColorButton extends AbstractSelectBox<Color> {
private Color color; private Color color;
private NewColorSelectPane colorPane; private NewColorSelectPane colorPane;
private ChangeListener changeListener; private ChangeListener changeListener;

BIN
designer-base/src/main/resources/com/fr/design/images/sort/add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

19
designer-base/src/main/resources/com/fr/design/images/sort/asc.svg

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>升序备份</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="画板" transform="translate(-641.000000, -632.000000)">
<g id="升序备份" transform="translate(641.000000, 632.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<g id="编组-2" transform="translate(1.000000, 2.000000)" fill="#{fillColor}">
<rect id="矩形" x="10.5" y="1" width="1" height="11"></rect>
<path d="M11.16,0.213333333 L13.76,3.68 C13.8262742,3.76836556 13.8083656,3.89372583 13.72,3.96 C13.6853808,3.98596443 13.643274,4 13.6,4 L8.4,4 C8.28954305,4 8.2,3.91045695 8.2,3.8 C8.2,3.75672596 8.21403557,3.71461923 8.24,3.68 L10.84,0.213333333 C10.9062742,0.124967773 11.0316344,0.107059163 11.12,0.173333333 C11.1351611,0.184704183 11.1486292,0.1981722 11.16,0.213333333 Z" id="三角形"></path>
<rect id="矩形" x="0" y="4" width="7" height="1"></rect>
<rect id="矩形备份-3" x="0" y="0.5" width="6" height="1"></rect>
<rect id="矩形备份" x="0" y="7.5" width="8" height="1"></rect>
<rect id="矩形备份-2" x="0" y="11" width="9" height="1"></rect>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

17
designer-base/src/main/resources/com/fr/design/images/sort/des.svg

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>降序</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="画板" transform="translate(-641.000000, -662.000000)">
<g id="降序" transform="translate(641.000000, 662.000000)">
<rect id="矩形" transform="translate(8.000000, 8.000000) scale(1, -1) translate(-8.000000, -8.000000) " x="0" y="0" width="16" height="16"></rect>
<rect id="矩形" fill="#{fillColor}" transform="translate(12.000000, 7.500000) scale(1, -1) translate(-12.000000, -7.500000) " x="11.5" y="2" width="1" height="11"></rect>
<path d="M12.16,10.2133333 L14.76,13.68 C14.8262742,13.7683656 14.8083656,13.8937258 14.72,13.96 C14.6853808,13.9859644 14.643274,14 14.6,14 L9.4,14 C9.28954305,14 9.2,13.9104569 9.2,13.8 C9.2,13.756726 9.21403557,13.7146192 9.24,13.68 L11.84,10.2133333 C11.9062742,10.1249678 12.0316344,10.1070592 12.12,10.1733333 C12.1351611,10.1847042 12.1486292,10.1981722 12.16,10.2133333 Z" id="三角形" fill="#{fillColor}" transform="translate(12.000000, 12.000000) scale(1, -1) translate(-12.000000, -12.000000) "></path>
<rect id="矩形" fill="#{fillColor}" transform="translate(4.500000, 9.500000) scale(1, -1) translate(-4.500000, -9.500000) " x="1" y="9" width="7" height="1"></rect>
<rect id="矩形备份-3" fill="#{fillColor}" transform="translate(4.000000, 13.000000) scale(1, -1) translate(-4.000000, -13.000000) " x="1" y="12.5" width="6" height="1"></rect>
<rect id="矩形备份" fill="#{fillColor}" transform="translate(5.000000, 6.000000) scale(1, -1) translate(-5.000000, -6.000000) " x="1" y="5.5" width="8" height="1"></rect>
<rect id="矩形备份-2" fill="#{fillColor}" transform="translate(5.500000, 2.500000) scale(1, -1) translate(-5.500000, -2.500000) " x="1" y="2" width="9" height="1"></rect>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/sort/down_arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

BIN
designer-base/src/main/resources/com/fr/design/images/sort/left_arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

41
designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>不排序</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="画板" transform="translate(-641.000000, -692.000000)">
<g id="不排序" transform="translate(641.000000, 692.000000)">
<rect id="矩形" transform="translate(8.000000, 8.000000) scale(1, -1) translate(-8.000000, -8.000000) "
x="0" y="0" width="16" height="16"></rect>
<g id="编组-5" transform="translate(9.000000, 8.000000)" fill="#{fillColor}">
<rect id="矩形"
transform="translate(3.000000, 2.500000) scale(1, -1) translate(-3.000000, -2.500000) "
x="2.5" y="0" width="1" height="5"></rect>
<path d="M3.16,2.21333333 L5.76,5.68 C5.82627417,5.76836556 5.80836556,5.89372583 5.72,5.96 C5.68538077,5.98596443 5.64327404,6 5.6,6 L0.4,6 C0.28954305,6 0.2,5.91045695 0.2,5.8 C0.2,5.75672596 0.214035574,5.71461923 0.24,5.68 L2.84,2.21333333 C2.90627417,2.12496777 3.03163444,2.10705916 3.12,2.17333333 C3.13516113,2.18470418 3.14862915,2.1981722 3.16,2.21333333 Z"
id="三角形"
transform="translate(3.000000, 4.000000) scale(1, -1) translate(-3.000000, -4.000000) "></path>
</g>
<g id="编组-5"
transform="translate(12.000000, 4.000000) scale(1, -1) translate(-12.000000, -4.000000) translate(9.000000, 1.000000)"
fill="#{fillColor}">
<rect id="矩形"
transform="translate(3.000000, 2.500000) scale(1, -1) translate(-3.000000, -2.500000) "
x="2.5" y="0" width="1" height="5"></rect>
<path d="M3.16,2.21333333 L5.76,5.68 C5.82627417,5.76836556 5.80836556,5.89372583 5.72,5.96 C5.68538077,5.98596443 5.64327404,6 5.6,6 L0.4,6 C0.28954305,6 0.2,5.91045695 0.2,5.8 C0.2,5.75672596 0.214035574,5.71461923 0.24,5.68 L2.84,2.21333333 C2.90627417,2.12496777 3.03163444,2.10705916 3.12,2.17333333 C3.13516113,2.18470418 3.14862915,2.1981722 3.16,2.21333333 Z"
id="三角形"
transform="translate(3.000000, 4.000000) scale(1, -1) translate(-3.000000, -4.000000) "></path>
</g>
<rect id="矩形" fill="#{fillColor}"
transform="translate(4.500000, 9.500000) scale(1, -1) translate(-4.500000, -9.500000) " x="1"
y="9" width="7" height="1"></rect>
<rect id="矩形备份-3" fill="#{fillColor}" x="1" y="12.5" width="6" height="1"></rect>
<rect id="矩形备份" fill="#{fillColor}"
transform="translate(4.500000, 6.000000) scale(1, -1) translate(-4.500000, -6.000000) " x="1"
y="5.5" width="7" height="1"></rect>
<rect id="矩形备份-2" fill="#{fillColor}"
transform="translate(4.000000, 2.500000) scale(1, -1) translate(-4.000000, -2.500000) " x="1"
y="2" width="6" height="1"></rect>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

33
designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java

@ -10,22 +10,27 @@ import java.awt.RenderingHints;
* created by Harrison on 2020/04/21 * created by Harrison on 2020/04/21
**/ **/
public class PlaceholderTextArea extends UITextArea { public class PlaceholderTextArea extends UITextArea {
private String placeholder; private String placeholder;
public PlaceholderTextArea() { public PlaceholderTextArea() {
} }
public PlaceholderTextArea(String s, String placeholder) { public PlaceholderTextArea(String s, String placeholder) {
super(s); super(s);
this.placeholder = placeholder; this.placeholder = placeholder;
} }
public PlaceholderTextArea(int i, int j, String placeholder) {
super(i, j);
this.placeholder = placeholder;
}
public void setPlaceholder(String placeholder) { public void setPlaceholder(String placeholder) {
this.placeholder = placeholder; this.placeholder = placeholder;
} }
@Override @Override
protected void paintComponent(final Graphics pG) { protected void paintComponent(final Graphics pG) {
super.paintComponent(pG); super.paintComponent(pG);
@ -37,6 +42,16 @@ public class PlaceholderTextArea extends UITextArea {
RenderingHints.KEY_ANTIALIASING, RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON); RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(getDisabledTextColor()); g.setColor(getDisabledTextColor());
g.drawString(placeholder, getInsets().left, pG.getFontMetrics() drawPlaceholder(pG);
.getMaxAscent() + getInsets().top + 1); }
}}
private void drawPlaceholder(Graphics g) {
int x = getInsets().left;
int y = g.getFontMetrics().getMaxAscent() + getInsets().top + 1;
for (String line : placeholder.split("\n")) {
g.drawString(line, x, y);
y += g.getFontMetrics().getHeight();
}
}
}

54
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -2,6 +2,7 @@ package com.fr.design.dscolumn;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.data.util.SortOrder; import com.fr.data.util.SortOrder;
import com.fr.design.border.UITitledBorder;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -9,7 +10,6 @@ import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.SortFormulaPane; import com.fr.design.formula.SortFormulaPane;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
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;
@ -20,14 +20,12 @@ import com.fr.design.gui.style.TextFormatPane;
import com.fr.design.layout.FRGUIPaneFactory; 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.style.FormatPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -59,18 +57,19 @@ public class DSColumnAdvancedPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
sortPane = new SortPane(); sortPane = new SortPane();
sortPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"), null)); sortPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order")));
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
selectCountPane = new SelectCountPane(); selectCountPane = new SelectCountPane();
selectCountPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter"), null)); selectCountPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Results_Filter")));
} }
valuePane = new ValuePane(); valuePane = new ValuePane();
valuePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Custom_Data_Appearance"), null)); valuePane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Custom_Data_Appearance")));
formatAttrPane = new FormatAttrPane(); formatAttrPane = new FormatAttrPane();
JPanel titleBorderedFormatPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"));
titleBorderedFormatPane.add(formatAttrPane, BorderLayout.NORTH);
JPanel extendablePane = null; JPanel extendablePane = null;
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
@ -109,7 +108,7 @@ public class DSColumnAdvancedPane extends BasicPane {
{sortPane}, {sortPane},
{selectCountPane}, {selectCountPane},
{valuePane}, {valuePane},
{formatAttrPane}, {titleBorderedFormatPane},
{extendablePane}, {extendablePane},
{multiNumPane} {multiNumPane}
}; };
@ -117,7 +116,7 @@ public class DSColumnAdvancedPane extends BasicPane {
components = new Component[][]{ components = new Component[][]{
{sortPane}, {sortPane},
{valuePane}, {valuePane},
{formatAttrPane} {titleBorderedFormatPane}
}; };
} }
@ -538,40 +537,31 @@ public class DSColumnAdvancedPane extends BasicPane {
} }
} }
public class FormatAttrPane extends AbstractAttrNoScrollPane { public static class FormatAttrPane extends TextFormatPane {
private TextFormatPane formatPane;
@Override protected void initLayout() {
protected JPanel createContentPane() { JPanel settingPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 4, 0);
this.formatPane = new TextFormatPane(); settingPane.add(typeComboBox);
return this.formatPane; settingPane.add(textField);
} settingPane.add(roundingBox);
@Override addComponents(4, new JComponent[] { settingPane, previewLabel});
public Dimension getPreferredSize() {
if (formatPane == null) {
return super.getPreferredSize();
}
return formatPane.getPreferredSize();
} }
protected void initContentPane() { @Override
leftContentPane = createContentPane(); protected void setRoundingBoxVisible(boolean visible) {
if (leftContentPane != null) { roundingBox.setVisible(visible);
leftContentPane.setBorder(BorderFactory.createEmptyBorder());
this.add(leftContentPane, BorderLayout.CENTER);
}
} }
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
if (cellElement != null && formatPane != null) { if (cellElement != null) {
formatPane.populateBean(cellElement.getStyle()); populateBean(cellElement.getStyle());
} }
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null && formatPane != null) { if (cellElement != null) {
cellElement.setStyle(formatPane.update(cellElement.getStyle())); cellElement.setStyle(update(cellElement.getStyle()));
} }
} }
} }

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

@ -220,7 +220,7 @@ public class DesignerAppUtils {
Multimap<String, PluginMarkerAdapter> stringPluginMarkerAdapterMultimap = popPluginInfoMap(key); Multimap<String, PluginMarkerAdapter> stringPluginMarkerAdapterMultimap = popPluginInfoMap(key);
Collection<PluginMarkerAdapter> disablePlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); Collection<PluginMarkerAdapter> disablePlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN);
for (PluginMarkerAdapter disablePlugin : disablePlugins) { for (PluginMarkerAdapter disablePlugin : disablePlugins) {
PluginManager.getController().enable(disablePlugin, new ModifyStatusCallback(false)); PluginManager.getController().enablePersistently(disablePlugin, new ModifyStatusCallback(false));
} }
Collection<PluginMarkerAdapter> uninstallPlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN); Collection<PluginMarkerAdapter> uninstallPlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN);

109
designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java

@ -1,17 +1,7 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.quickeditor.cellquick.layout.CellElementBarLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
/** /**
* 右侧单元格元素面板抽象类 * 右侧单元格元素面板抽象类
@ -20,26 +10,8 @@ import java.awt.event.MouseWheelListener;
* @version 2017年7月25日 * @version 2017年7月25日
* @since 9.0 * @since 9.0
*/ */
public abstract class AbstractDSCellEditorPane extends JPanel { public abstract class AbstractDSCellEditorPane extends AbstractAttrPane {
/**
* 滚动条相关配置
*/
private static final int MAXVALUE = 100;
private static final int TITLE_HEIGHT = 95;
private static final int CONTENT_PANE_WIDTH_GAP = 3;
private static final int SCROLLBAR_WIDTH = 7;
private static final int MOUSE_WHEEL_SPEED = 5;
private int maxHeight = 280;
private JPanel leftContentPane;
private UIScrollBar scrollBar;
protected abstract JPanel createContentPane();
public abstract String getIconPath();
public abstract String title4PopupWindow();
/** /**
* 从面板拿数据保存 * 从面板拿数据保存
@ -51,78 +23,15 @@ public abstract class AbstractDSCellEditorPane extends JPanel {
*/ */
public abstract void populate(); public abstract void populate();
protected void createScrollPane() {
leftContentPane = this.createContentPane();
this.prepareScrollBar();
leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 10, 0, 0, this.getBackground()));
this.setLayout(new CellElementBarLayout(leftContentPane) {
@Override
public void layoutContainer(Container parent) {
maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
int beginY;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {
int preferredHeight = leftContentPane.getPreferredSize().height;
int value = scrollBar.getValue();
beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount());
}
int width = parent.getWidth();
int height = parent.getHeight();
if (leftContentPane.getPreferredSize().height > maxHeight) {
leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height + beginY);
scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height);
} else {
leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height);
}
}
});
this.add(scrollBar);
this.add(leftContentPane);
}
private void prepareScrollBar() {
scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) {
@Override
public int getVisibleAmount() {
int preferredHeight = leftContentPane.getPreferredSize().height;
int e = MAXVALUE * (maxHeight) / preferredHeight;
setVisibleAmount(e);
return e;
}
@Override
public int getMaximum() {
return MAXVALUE;
}
};
scrollBar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
doLayout();
}
});
this.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int value = scrollBar.getValue();
value += MOUSE_WHEEL_SPEED * e.getWheelRotation();
scrollBar.setValue(value);
doLayout();
}
});
scrollBar.setPreferredSize(new Dimension(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, this.getHeight()));
scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP);
scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground()));
}
/** /**
* 释放tc * 释放tc
*/ */
protected abstract void release(); protected abstract void release();
protected abstract AttributeChangeListener getAttributeChangeListener();
public void addAttributeChangeListener(){
this.addAttributeChangeListener(getAttributeChangeListener());
}
} }

7
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -13,6 +13,7 @@ import com.fr.design.i18n.Toolkit;
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.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.sort.cellexpand.CellExpandSortPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
@ -43,6 +44,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private JPanel basicPane; private JPanel basicPane;
private JPanel seniorPane; private JPanel seniorPane;
private CellExpandExtraAttrPane extraPane; private CellExpandExtraAttrPane extraPane;
private CellExpandSortPane cellExpandSortPane;
/** /**
@ -81,8 +83,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
seniorPane = new JPanel(); seniorPane = new JPanel();
basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane()); basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane());
seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 223, 24, seniorPane()); seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 223, 24, seniorPane());
JPanel sortUIExpandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"),
223, 24, cellExpandSortPane = new CellExpandSortPane(this));
layoutPane.add(basicPane, BorderLayout.NORTH); layoutPane.add(basicPane, BorderLayout.NORTH);
layoutPane.add(seniorPane, BorderLayout.CENTER); layoutPane.add(seniorPane, BorderLayout.CENTER);
layoutPane.add(sortUIExpandablePane, BorderLayout.SOUTH);
extraPane = CellExpandExtraAttrPane.getInstance(); extraPane = CellExpandExtraAttrPane.getInstance();
@ -172,6 +177,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
sortAfterExpand.populate(cellExpandAttr); sortAfterExpand.populate(cellExpandAttr);
extraPane.populate(cellElement); extraPane.populate(cellElement);
cellExpandSortPane.populateBean(cellElement);
} }
@ -222,6 +228,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
} }
extraPane.update(cellElement); extraPane.update(cellElement);
cellExpandSortPane.updateBean(cellElement);
} }
/** /**

7
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java

@ -16,11 +16,8 @@ import com.fr.design.mainframe.theme.ThemedCellStyleListPane;
*/ */
public class NameStyleListPane extends ThemedCellStyleListPane { public class NameStyleListPane extends ThemedCellStyleListPane {
public NameStyleListPane() { public NameStyleListPane(boolean supportInnerBorder) {
} super(supportInnerBorder);
public NameStyleListPane(boolean supportCellRange) {
super(supportCellRange);
} }
public void populateNameStyle(NameStyle style) { public void populateNameStyle(NameStyle style) {

47
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -4,6 +4,13 @@ import com.fr.base.io.IOFile;
import com.fr.base.io.XMLReadHelper; import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.logging.log4j.core.Filter;
import com.fr.third.apache.logging.log4j.core.Layout;
import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.apache.logging.log4j.core.appender.AbstractAppender;
import com.fr.third.apache.logging.log4j.core.config.Property;
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout;
import com.fr.web.session.SessionLocalManager; import com.fr.web.session.SessionLocalManager;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -12,22 +19,20 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.stable.web.SessionProvider; import com.fr.stable.web.SessionProvider;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.apache.log4j.AppenderSkeleton;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.web.core.SessionPoolManager; import com.fr.web.core.SessionPoolManager;
import com.fr.web.core.TemplateSessionIDInfo; import com.fr.web.core.TemplateSessionIDInfo;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.Serializable;
/** /**
* 收集设计器报错信息的appender. * 收集设计器报错信息的appender.
* <p> * <p>
* Created by Administrator on 2017/7/24 0024. * Created by Administrator on 2017/7/24 0024.
*/ */
public class ErrorInfoLogAppender extends AppenderSkeleton { public class ErrorInfoLogAppender extends AbstractAppender {
private static final int ERROR_LEN = 8; private static final int ERROR_LEN = 8;
private static final int ERROR_STACK_TRACE = 15; private static final int ERROR_STACK_TRACE = 15;
@ -38,16 +43,23 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
private String uuid; private String uuid;
private String activekey; private String activekey;
public ErrorInfoLogAppender() { protected ErrorInfoLogAppender(String name, Filter filter,
this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"); Layout<? extends Serializable> layout,
boolean ignoreExceptions,
Property[] properties) {
super(name, filter, layout, ignoreExceptions, properties);
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
this.username = envManager.getDesignerLoginUsername(); this.username = envManager.getDesignerLoginUsername();
this.uuid = envManager.getUUID(); this.uuid = envManager.getUUID();
this.activekey = envManager.getActivationKey(); this.activekey = envManager.getActivationKey();
} }
protected void append(LoggingEvent event) { public static ErrorInfoLogAppender createErrorLogAppender() {
return new ErrorInfoLogAppender(ErrorInfoLogAppender.class.getSimpleName(), null, PatternLayout.newBuilder().withPattern("%d{HH:mm:ss} %t %p [%c] %m%n %throwable{0}").build(), false, Property.EMPTY_ARRAY);
}
@Override
public void append(LogEvent event) {
this.subAppend(event); this.subAppend(event);
} }
@ -55,19 +67,12 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
return true; return true;
} }
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
}
public void subAppend(LoggingEvent event) { public void subAppend(LogEvent event) {
Level level = event.getLevel(); Level level = event.getLevel();
// 只分析上传记录error以上的. // 只分析上传记录error以上的.
if (level.isGreaterOrEqual(Level.ERROR)) { if (level.isMoreSpecificThan(Level.ERROR)) {
String msg = this.layout.format(event); String msg = (String) this.toSerializable(event);
// 这个id并不是一定会有的, 有就记录下, 说明是预览模板出的错. // 这个id并不是一定会有的, 有就记录下, 说明是预览模板出的错.
String templateid = readTemplateID(); String templateid = readTemplateID();
String logid = readLogID(msg); String logid = readLogID(msg);
@ -80,13 +85,13 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
} }
} }
private String readStackTrace(LoggingEvent event) { private String readStackTrace(LogEvent event) {
String[] s = event.getThrowableStrRep(); StackTraceElement[] s = event.getThrown() == null ? null : event.getThrown().getStackTrace();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (s != null) { if (s != null) {
int len = Math.min(s.length, ERROR_STACK_TRACE); int len = Math.min(s.length, ERROR_STACK_TRACE);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
sb.append(s[i]).append("\n"); sb.append(s[i].toString()).append("\n");
} }
} }
return sb.toString(); return sb.toString();

27
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -44,30 +44,35 @@ public class ErrorInfoUploader {
//单次发送的错误信息最大条数 //单次发送的错误信息最大条数
private static final int MAX_ITEMS = 200; private static final int MAX_ITEMS = 200;
private static LogHandler<ErrorInfoLogAppender> logHandler;
static { static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override @Override
public void envChanged() { public void envChanged() {
FineLoggerFactory.getLogger().addLogAppender(new LogHandler<ErrorInfoLogAppender>() { if (logHandler != null) {
private ErrorInfoLogAppender errorInfoLogAppender = new ErrorInfoLogAppender(); logHandler.getHandler().stop();
FineLoggerFactory.getLogger().removeLogAppender(logHandler);
@Override logHandler.getHandler().start();
public ErrorInfoLogAppender getHandler() { FineLoggerFactory.getLogger().addLogAppender(logHandler);
return errorInfoLogAppender; }
}
});
} }
}); });
} }
private ErrorInfoUploader() { private ErrorInfoUploader() {
FineLoggerFactory.getLogger().addLogAppender(new LogHandler<ErrorInfoLogAppender>() { logHandler = new LogHandler<ErrorInfoLogAppender>() {
private final ErrorInfoLogAppender errorInfoLogAppender = ErrorInfoLogAppender.createErrorLogAppender();
@Override @Override
public ErrorInfoLogAppender getHandler() { public ErrorInfoLogAppender getHandler() {
return new ErrorInfoLogAppender(); return errorInfoLogAppender;
} }
}); };
logHandler.getHandler().start();
FineLoggerFactory.getLogger().addLogAppender(logHandler);
} }
public static ErrorInfoUploader getInstance() { public static ErrorInfoUploader getInstance() {

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

@ -15,6 +15,8 @@ import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.engineio.client.transports.Polling;
import io.socket.engineio.client.transports.WebSocket;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@ -45,6 +47,7 @@ public abstract class AbstractSocketConfig {
public IO.Options createOptions() { public IO.Options createOptions() {
IO.Options options = new IO.Options(); IO.Options options = new IO.Options();
options.path = WebSocketConfig.getInstance().getSocketContext(); options.path = WebSocketConfig.getInstance().getSocketContext();
options.transports = new String[]{WebSocket.NAME, Polling.NAME};;
try { try {
if (ComparatorUtils.equals(currentProtocol, HTTPS)) { if (ComparatorUtils.equals(currentProtocol, HTTPS)) {
options.sslContext = getSSLContext(); options.sslContext = getSSLContext();

1
designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java

@ -29,7 +29,6 @@ public class ContainerSocketConfig extends AbstractSocketConfig {
@Override @Override
public IO.Options createOptions() { public IO.Options createOptions() {
IO.Options options = super.createOptions(); IO.Options options = super.createOptions();
options.transports = new String[]{WebSocket.NAME, Polling.NAME};
options.path = String.format("/%s%s", FRContext.getCommonOperator().getAppName(), WebSocketConstants.WEBSOCKET_PATH); options.path = String.format("/%s%s", FRContext.getCommonOperator().getAppName(), WebSocketConstants.WEBSOCKET_PATH);
return options; return options;
} }

11
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -11,6 +11,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogger; import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.mainframe.loghandler.LogEventConverter;
import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.design.mainframe.toast.ToastMsgDialog; import com.fr.design.mainframe.toast.ToastMsgDialog;
@ -23,6 +24,7 @@ import com.fr.serialization.SerializerHelper;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.logging.log4j.core.LogEvent;
import com.fr.third.org.apache.http.client.config.RequestConfig; import com.fr.third.org.apache.http.client.config.RequestConfig;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
import com.fr.third.org.apache.http.client.methods.HttpGet; import com.fr.third.org.apache.http.client.methods.HttpGet;
@ -148,7 +150,14 @@ public class DesignerSocketIO {
public void call(Object... objects) { public void call(Object... objects) {
if (ArrayUtils.isNotEmpty(objects)) { if (ArrayUtils.isNotEmpty(objects)) {
try { try {
LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); Object obj = SerializerHelper.deserialize((byte[]) objects[0]);
// 兼容下老版本服务器
LogEvent event;
if (obj instanceof LoggingEvent) {
event = LogEventConverter.convert((LoggingEvent) obj);
} else {
event = (LogEvent) obj;
}
DesignerLogger.log(event); DesignerLogger.log(event);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

3
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -541,7 +541,8 @@ public class ReportStylePane extends BasicPane {
UITabbedPane mainTabbedPane = new UITabbedPane(); UITabbedPane mainTabbedPane = new UITabbedPane();
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
nameStyleListPane = new NameStyleListPane(); nameStyleListPane = new NameStyleListPane(false);
nameStyleListPane.addChangeListener(this);
nameStyleListPane.setBorder(BorderFactory.createEmptyBorder()); nameStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane); UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0)); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));

38
designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java

@ -0,0 +1,38 @@
package com.fr.design.sort.celldscolumn;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.sort.common.AbstractSortGroupPane;
import com.fr.design.sort.common.AbstractSortItemPane;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.sortexpression.SortExpression;
public class CellDSColumnSortGroupPane extends AbstractSortGroupPane {
DSColumn dsColumn;
public CellDSColumnSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) {
super(sortGroupPaneWidth, sortGroupPaneRightWidth);
}
public void populateDsColumn( DSColumn dsColumn){
this.dsColumn = dsColumn;
}
@Override
protected AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression) {
CellDSColumnSortItemPane cellDSColumnSortItemPane = new CellDSColumnSortItemPane( sortItemPaneWidth, sortItemPaneRightWidth);
java.util.Map<String, TableDataWrapper> tableDataWrapperMap =
DesignTableDataManager.getAllEditingDataSet(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget());
TableDataWrapper tableDataWrapper = tableDataWrapperMap.get(dsColumn.getDSName());
java.util.List<String> columnNameList = tableDataWrapper.calculateColumnNameList();
String[] columnNames = new String[columnNameList.size()];
columnNameList.toArray(columnNames);
cellDSColumnSortItemPane.sortAreaUiComboBox.removeAllItems();
for (String columnName : columnNames) {
cellDSColumnSortItemPane.sortAreaUiComboBox.addItem(columnName);
}
cellDSColumnSortItemPane.populateBean(sortExpression);
return cellDSColumnSortItemPane;
}
}

40
designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java

@ -0,0 +1,40 @@
package com.fr.design.sort.celldscolumn;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.sort.common.AbstractSortItemPane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.report.core.sort.sortexpression.SortExpression;
import javax.swing.*;
import java.awt.*;
public class CellDSColumnSortItemPane extends AbstractSortItemPane {
UIComboBox sortAreaUiComboBox;
public CellDSColumnSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) {
super(sortItemPaneWidth, sortItemPaneRightWidth);
}
@Override
public void initMainSortAreaPane(JPanel sortAreaPane) {
sortAreaUiComboBox = new UIComboBox(new String[0]);
sortAreaUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
sortAreaPane.add(sortAreaUiComboBox);
}
public void populateBean(SortExpression sortExpression) {
sortAreaUiComboBox.setSelectedItem(sortExpression.getSortArea());
super.populateBean(sortExpression);
}
public SortExpression updateBean() {
SortExpression sortExpression = super.updateBean();
if (sortExpression != null) {
sortExpression.setSortArea(sortAreaUiComboBox.getSelectedItem().toString());
}
return sortExpression;
}
}

59
designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java

@ -0,0 +1,59 @@
package com.fr.design.sort.celldscolumn;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.common.CellSortAttr;
import javax.swing.*;
public class CellDSColumnSortPane extends AbstractSortPane {
public CellDSColumnSortPane() {
super(220, 150);
//this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
}
@Override
protected void initSortGroupPane() {
sortGroupPane = new CellDSColumnSortGroupPane(sortPaneWidth, sortPaneRightWidth);
this.add(sortGroupPane);
}
@Override
protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) {
if (cellElement.getValue() instanceof DSColumn) {
DSColumn dsColumn = ((DSColumn) cellElement.getValue());
if (dsColumn.getCellSortAttr() == null) {
dsColumn.setCellSortAttr(new CellSortAttr());
}
return dsColumn.getCellSortAttr();
}
return null;
}
protected void populateSortArea(TemplateCellElement cellElement) {
super.populateSortArea(cellElement);
if (cellElement.getValue() instanceof DSColumn) {
DSColumn dsColumn = ((DSColumn) cellElement.getValue());
TableDataColumn tableDataColumn = dsColumn.getColumn();
if (tableDataColumn instanceof TableDataColumn) {
selfSortArea = TableDataColumn.getColumnName(tableDataColumn);
}
}
}
public void populateBean(TemplateCellElement cellElement) {
if (cellElement.getValue() instanceof DSColumn) {
DSColumn dsColumn = ((DSColumn) cellElement.getValue());
if (sortGroupPane != null) {
((CellDSColumnSortGroupPane) sortGroupPane).populateDsColumn(dsColumn);
}
}
super.populateBean(cellElement);
}
}

19
designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java

@ -0,0 +1,19 @@
package com.fr.design.sort.cellexpand;
import com.fr.design.sort.common.AbstractSortGroupPane;
import com.fr.design.sort.common.AbstractSortItemPane;
import com.fr.report.core.sort.sortexpression.SortExpression;
public class CellExpandSortGroupPane extends AbstractSortGroupPane {
public CellExpandSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) {
super(sortGroupPaneWidth, sortGroupPaneRightWidth);
}
@Override
protected AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression) {
AbstractSortItemPane abstractSortItemPane = new CellExpandSortItemPane( sortItemPaneWidth, sortItemPaneRightWidth);
abstractSortItemPane.populateBean(sortExpression);
return abstractSortItemPane;
}
}

37
designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java

@ -0,0 +1,37 @@
package com.fr.design.sort.cellexpand;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.design.sort.common.AbstractSortItemPane;
import com.fr.report.core.sort.sortexpression.SortExpression;
import com.fr.stable.ColumnRow;
import javax.swing.*;
public class CellExpandSortItemPane extends AbstractSortItemPane {
SortColumnRowPane columnRowPane;
public CellExpandSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) {
super(sortItemPaneWidth, sortItemPaneRightWidth);
}
@Override
public void initMainSortAreaPane(JPanel sortAreaPane) {
columnRowPane = new SortColumnRowPane(sortItemPaneRightWidth + 4, AbstractSortPane.PANE_COMPONENT_HEIGHT);
sortAreaPane.add(columnRowPane);
}
public void populateBean(SortExpression sortExpression) {
columnRowPane.populateBean(ColumnRow.valueOf(sortExpression.getSortArea()));
super.populateBean(sortExpression);
}
public SortExpression updateBean() {
SortExpression sortExpression = super.updateBean();
if (sortExpression != null) {
ColumnRow columnRow = columnRowPane.updateBean();
sortExpression.setSortArea(columnRow == null ? null : columnRow.toString());
}
return sortExpression;
}
}

39
designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java

@ -0,0 +1,39 @@
package com.fr.design.sort.cellexpand;
import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.core.sort.common.CellSortAttr;
import javax.swing.*;
public class CellExpandSortPane extends AbstractSortPane {
CellExpandAttrPane cellExpandAttrPane;
public CellExpandSortPane(CellExpandAttrPane cellExpandAttrPane) {
super(227, 155);
this.cellExpandAttrPane = cellExpandAttrPane;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
}
@Override
protected void initSortGroupPane() {
sortGroupPane = new CellExpandSortGroupPane(sortPaneWidth, sortPaneRightWidth);
this.add(sortGroupPane);
}
@Override
protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr != null) {
if (cellExpandAttr.getCellSortAttr() == null) {
cellExpandAttr.setCellSortAttr(new CellSortAttr());
}
return cellExpandAttr.getCellSortAttr();
}
return null;
}
}

148
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java

@ -0,0 +1,148 @@
package com.fr.design.sort.common;
import com.fr.base.svg.IconUtils;
import com.fr.design.event.ComponentChangeListener;
import com.fr.design.event.ComponentChangeObserver;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.report.core.sort.sortexpression.CellSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractSortGroupPane extends JPanel implements ComponentChangeObserver {
protected int sortGroupPaneWidth;
protected int sortGroupPaneRightWidth;
List<SortExpression> sortExpressions;
List<JPanel> sortItemPanes = new ArrayList<>();
AddSortItemBar addSortItemBar;
JPanel sortItemListPane;
UIButton uiButton;
String selfSortArea;
ComponentChangeListener componentChangeListener;
public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) {
this.sortGroupPaneRightWidth = sortGroupPaneRightWidth;
this.sortGroupPaneWidth = sortGroupPaneWidth;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
initComponents();
}
private void initComponents() {
addSortItemBar = new AddSortItemBar(this);
sortItemListPane = new JPanel();
sortItemListPane.setLayout(new BoxLayout(sortItemListPane, BoxLayout.Y_AXIS));
this.add(sortItemListPane);
this.add(addSortItemBar);
}
public void populateBean(List<SortExpression> sortExpressions, String selfSortArea) {
this.sortItemListPane.removeAll();
this.selfSortArea = selfSortArea;
this.sortExpressions = sortExpressions;
this.sortItemPanes = new ArrayList<>();
for (int i = 0; i < sortExpressions.size(); i++) {
addSortItem(sortExpressions.get(i), i == 0);
}
refresh();
}
protected abstract AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression);
public List<SortExpression> updateBean() {
List<SortExpression> sortExpressions = new ArrayList<>();
for (JPanel sortItemPane : sortItemPanes) {
SortExpression sortExpression = null;
AbstractSortItemPane abstractSortItemPane = null;
if (sortItemPane instanceof AbstractSortItemPane) {
abstractSortItemPane = (AbstractSortItemPane) sortItemPane;
} else if (sortItemPane instanceof SortUIExpandablePane) {
abstractSortItemPane = (AbstractSortItemPane) ((SortUIExpandablePane) sortItemPane).getContentPane();
}
if (abstractSortItemPane != null) {
sortExpression = abstractSortItemPane.updateBean();
}
if (sortExpression != null) {
sortExpressions.add(sortExpression);
}
}
return sortExpressions;
}
public void removeSortItem(int no) {
if (no < sortExpressions.size()) {
sortItemListPane.remove(sortItemPanes.get(no));
sortExpressions.remove(no);
sortItemPanes.remove(no);
refresh();
}
}
public void registerChangeListener(ComponentChangeListener componentChangeListener) {
this.componentChangeListener = componentChangeListener;
}
public void addSortItem(SortExpression sortExpression, boolean mainSort) {
int sortItemPaneWidth = sortGroupPaneWidth;
int sortItemPaneRightWidth = sortGroupPaneRightWidth;
if (!mainSort) {
sortItemPaneWidth -= 12;
sortItemPaneRightWidth -= 12;
}
if (sortExpression == null) {
sortExpression = new CellSortExpression(selfSortArea);
sortExpressions.add(sortExpression);
}
AbstractSortItemPane abstractSortItemPane =
refreshSortItemPane(sortItemPaneWidth, sortItemPaneRightWidth, sortExpression);
JPanel sortItemPane = abstractSortItemPane;
if (!mainSort) {
sortItemPane = new SortUIExpandablePane(abstractSortItemPane, this);
}
sortItemListPane.add(sortItemPane);
sortItemPanes.add(sortItemPane);
if (componentChangeListener != null) {
componentChangeListener.initListener(sortItemPane);
}
refresh();
}
protected void refresh() {
validate();
repaint();
revalidate();
}
class AddSortItemBar extends JPanel {
AbstractSortGroupPane sortGroupPane;
AddSortItemBar(AbstractSortGroupPane sortGroupPane) {
init();
this.sortGroupPane = sortGroupPane;
}
void init() {
uiButton = new UIButton(Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort"),
IconUtils.readIcon("/com/fr/design/images/sort/add.png"));
uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, 20));
this.add(uiButton);
uiButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
sortGroupPane.addSortItem(null, false);
}
});
}
}
}

153
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java

@ -0,0 +1,153 @@
package com.fr.design.sort.common;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.expressionpane.CellSortExpressionPane;
import com.fr.design.sort.expressionpane.CustomSequenceSortExpressionPane;
import com.fr.design.sort.expressionpane.FormulaSortExpressionPane;
import com.fr.design.sort.expressionpane.SortExpressionPane;
import com.fr.report.core.sort.sortexpression.SortExpression;
import com.fr.report.core.sort.common.SortRule;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractSortItemPane extends JPanel {
protected int sortItemPaneWidth;
protected int sortItemPaneRightWidth;
List<SortExpressionPane> sortExpressionPanes = new ArrayList<>();
SortExpressionPane currentSortExpressionPane = null;
JPanel sortBasisPanel = null;
UIComboBox sortRuleUiComboBox;
UIComboBox sortBasisUiComboBox;
JPanel sortAreaPane;
JPanel sortRulePane;
public AbstractSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) {
this.sortItemPaneWidth = sortItemPaneWidth;
this.sortItemPaneRightWidth = sortItemPaneRightWidth;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
registerSortExpressionPanes();
initComponents();
}
private void initComponents() {
initSortAreaPane();
initSortBasisPanel();
initSortRulePane();
}
private void registerSortExpressionPanes() {
sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth));
sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth));
sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth));
}
void initSortAreaPane() {
sortAreaPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP));
sortAreaPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Area"), SwingConstants.LEFT));
sortAreaPane.add(AbstractSortPane.createIntervalUILabel());
initMainSortAreaPane(sortAreaPane);
this.add(sortAreaPane);
}
public abstract void initMainSortAreaPane(JPanel sortAreaPane);
void initSortRulePane() {
sortRulePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP));
sortRuleUiComboBox = new UIComboBox(new String[]{SortRule.ASC.getDescription(),
SortRule.DES.getDescription(), SortRule.NO_SORT.getDescription()});
sortRuleUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
sortRulePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Rule"), SwingConstants.LEFT));
sortRulePane.add(AbstractSortPane.createIntervalUILabel());
sortRulePane.add(sortRuleUiComboBox);
this.add(sortRulePane);
}
void initSortBasisPanel() {
sortBasisPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP));
sortBasisUiComboBox = new UIComboBox(getSortNames());
sortBasisUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
sortBasisUiComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()) != currentSortExpressionPane) {
if (currentSortExpressionPane != null) {
currentSortExpressionPane.setVisible(false);
}
currentSortExpressionPane = sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex());
refreshCurrentSortExpressionPane();
}
}
});
sortBasisPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Basis"), SwingConstants.LEFT));
sortBasisPanel.add(AbstractSortPane.createIntervalUILabel());
sortBasisPanel.add(sortBasisUiComboBox);
this.add(sortBasisPanel);
for (SortExpressionPane sortExpressionPane : sortExpressionPanes) {
this.add(sortExpressionPane);
sortExpressionPane.setVisible(false);
}
}
private void refreshCurrentSortExpressionPane() {
currentSortExpressionPane.setVisible(true);
sortAreaPane.setVisible(currentSortExpressionPane.needSortArea());
sortRulePane.setVisible(currentSortExpressionPane.needSortRule());
}
private String[] getSortNames() {
String[] sortNames = new String[sortExpressionPanes.size()];
for (int i = 0; i < sortExpressionPanes.size(); i++) {
sortNames[i] = sortExpressionPanes.get(i).getSortName();
}
return sortNames;
}
public void populateBean(SortExpression sortExpression) {
if (sortExpression.getSortRule() == SortRule.ASC) {
sortRuleUiComboBox.setSelectedIndex(0);
} else if (sortExpression.getSortRule() == SortRule.DES) {
sortRuleUiComboBox.setSelectedIndex(1);
} else if (sortExpression.getSortRule() == SortRule.NO_SORT) {
sortRuleUiComboBox.setSelectedIndex(2);
}
for (int i = 0; i < sortExpressionPanes.size(); i++) {
if (StringUtils.equals(sortExpression.getSortName(), sortExpressionPanes.get(i).getSortName())) {
if (currentSortExpressionPane != null) {
currentSortExpressionPane.setVisible(false);
}
currentSortExpressionPane = sortExpressionPanes.get(i);
currentSortExpressionPane.populateBean(sortExpression);
sortBasisUiComboBox.setSelectedIndex(i);
refreshCurrentSortExpressionPane();
break;
}
}
refresh();
}
public SortExpression updateBean() {
SortExpression sortExpression = currentSortExpressionPane.updateBean();
if (sortExpression != null) {
String sortRule = sortRuleUiComboBox.getSelectedItem().toString();
if (StringUtils.isNotBlank(sortRule)) {
sortExpression.setSortRule(SortRule.parse(sortRule));
}
}
return sortExpression;
}
protected void refresh() {
validate();
repaint();
revalidate();
}
}

103
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java

@ -0,0 +1,103 @@
package com.fr.design.sort.common;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.sort.header.SortHeaderPane;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.core.sort.common.CellSortAttr;
import com.fr.report.core.sort.sortexpression.CellSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.stable.ColumnRow;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractSortPane extends JPanel {
protected int sortPaneWidth;
protected int sortPaneRightWidth;
public static final int PANE_COMPONENT_HEIGHT = 20;
public static final int PANE_COMPONENT_V_GAP = 4;
public static final int PANE_COMPONENT_H_GAP = 14;
protected AbstractSortGroupPane sortGroupPane;
protected SortHeaderPane sortHeaderPane;
protected String selfSortArea;
protected String defaultHeaderArea;
public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) {
this.sortPaneWidth = sortPaneWidth;
this.sortPaneRightWidth = sortPaneRightWidth;
initComponents();
}
private void initComponents() {
initSortGroupPane();
sortHeaderPane = new SortHeaderPane(sortPaneWidth, sortPaneRightWidth + 5);
this.add(sortHeaderPane);
}
protected abstract void initSortGroupPane();
protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement);
public void populateBean(TemplateCellElement cellElement) {
populateSortArea(cellElement);
List<SortExpression> sortExpressions = null;
CellSortAttr cellSortAttr = getCellSortAttr(cellElement);
if (cellSortAttr != null) {
sortExpressions = cellSortAttr.getSortExpressions();
}
if (sortExpressions == null || sortExpressions.size() == 0) {
sortExpressions = new ArrayList<>();
sortExpressions.add(new CellSortExpression(selfSortArea));
}
sortGroupPane.populateBean(sortExpressions, selfSortArea);
SortHeader sortHeader = null;
if (cellSortAttr != null) {
sortHeader = cellSortAttr.getSortHeader();
}
sortHeaderPane.populateBean(sortHeader, defaultHeaderArea);
refresh();
}
protected void populateSortArea(TemplateCellElement cellElement) {
int row = cellElement.getRow();
int column = cellElement.getColumn();
selfSortArea = ColumnRow.valueOf(column, row).toString();
if (row > 1) {
defaultHeaderArea = ColumnRow.valueOf(column, row - 1).toString();
} else {
defaultHeaderArea = null;
}
}
public void updateBean(TemplateCellElement cellElement) {
List<SortExpression> sortExpressions = sortGroupPane.updateBean();
SortHeader sortHeader = sortHeaderPane.updateBean();
CellSortAttr cellSortAttr = getCellSortAttr(cellElement);
cellSortAttr.setSortExpressions(sortExpressions);
if (sortHeader != null) {
sortHeader.setSortArea(selfSortArea);
}
cellSortAttr.setSortHeader(sortHeader);
}
protected void refresh() {
validate();
repaint();
revalidate();
}
public static UILabel createIntervalUILabel() {
return createIntervalUILabel(PANE_COMPONENT_H_GAP);
}
public static UILabel createIntervalUILabel(int vGap) {
UILabel uiLabel = new UILabel();
uiLabel.setPreferredSize(new Dimension(vGap, 10));
return uiLabel;
}
}

173
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -0,0 +1,173 @@
package com.fr.design.sort.common;
import com.fr.base.svg.IconUtils;
import com.fr.design.designer.TargetComponent;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ColumnRow;
import com.fr.stable.EssentialUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SortColumnRowPane extends JPanel implements UIObserver {
int paneWidth;
int paneHeight;
int jTextFieldWidth;
JTextField colJTextField;
JTextField rowJTextField;
UIButton selectButton;
private boolean isAlreadyAddListener = false;
private CellSelection oldSelection;
private SelectionListener gridSelectionChangeListener;
UIObserverListener uiObserverListener;
public SortColumnRowPane(int paneWidth, int paneHeight) {
this.paneWidth = paneWidth;
this.paneHeight = paneHeight;
initComponents();
}
private void initComponents() {
initSize();
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
intUILabel();
initTextField();
initSelectButton();
this.setSize(new Dimension(paneWidth, paneHeight));
}
void initSize() {
jTextFieldWidth = (paneWidth - 40) / 2;
}
void intUILabel() {
UILabel uiLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png"));
this.add(uiLabel);
}
public static boolean isAvailableColumnRow(ColumnRow columnRow) {
return columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1;
}
void initTextField() {
colJTextField = new JTextField();
colJTextField.setEditable(false);
rowJTextField = new JTextField();
rowJTextField.setEditable(false);
colJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight));
rowJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight));
this.add(colJTextField);
this.add(rowJTextField);
}
void initSelectButton() {
selectButton = new UIButton(IconUtils.readIcon("/com/fr/design/images/buttonicon/select.png"));
selectButton.addActionListener(new SelectActionListener(this));
this.add(selectButton);
}
public void populateBean(ColumnRow columnRow) {
if (SortColumnRowPane.isAvailableColumnRow(columnRow)) {
colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1));
rowJTextField.setText(String.valueOf(columnRow.row + 1));
} else {
colJTextField.setText(StringUtils.EMPTY);
rowJTextField.setText(StringUtils.EMPTY);
}
refresh();
}
public void setColumnRow(ColumnRow columnRow){
populateBean(columnRow);
uiObserverListener.doChange();
}
public ColumnRow updateBean() {
if (StringUtils.isNotBlank(colJTextField.getText()) && StringUtils.isNotBlank(rowJTextField.getText())) {
return ColumnRow.valueOf(colJTextField.getText() + rowJTextField.getText());
}
return null;
}
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
class SelectActionListener implements ActionListener {
SortColumnRowPane columnRowPane;
SelectActionListener(SortColumnRowPane columnRowPane) {
this.columnRowPane = columnRowPane;
}
@Override
public void actionPerformed(ActionEvent e) {
ElementCasePane elementCasePane = getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) {
return;
}
oldSelection = (CellSelection) elementCasePane.getSelection();
elementCasePane.getGrid().setNotShowingTableSelectPane(false);
elementCasePane.setEditable(false);
elementCasePane.repaint(10);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
Selection selection = elementCasePane.getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
elementCasePane.setOldSelecton(oldSelection);
columnRowPane.setColumnRow(cr);
}
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
elementCasePane.getGrid().setNotShowingTableSelectPane(true);
elementCasePane.setEditable(true);
elementCasePane.repaint();
}
};
elementCasePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
}
}
private ElementCasePane getCurrentElementCase() {
try {
TargetComponent targetComponent
= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (targetComponent instanceof ElementCasePane) {
return (ElementCasePane) targetComponent;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
protected void refresh() {
validate();
repaint();
revalidate();
}
}

100
designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java

@ -0,0 +1,100 @@
package com.fr.design.sort.common;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class SortUIExpandablePane extends JPanel {
private static final long serialVersionUID = 1L;
private HeaderPane headerPane;
private AbstractSortItemPane contentPane;
private AbstractSortGroupPane sortGroupPane;
private JPanel wrapPane;
public JPanel getContentPane() {
return contentPane;
}
public SortUIExpandablePane(AbstractSortItemPane contentPane, AbstractSortGroupPane sortGroupPane) {
super();
this.sortGroupPane = sortGroupPane;
this.contentPane = contentPane;
initComponents();
wrapPane.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
wrapPane.setBackground(Color.WHITE);
}
private void initComponents() {
wrapPane = new JPanel();
wrapPane.setLayout(new BorderLayout());
headerPane = new HeaderPane(sortGroupPane);
headerPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
setContentPanelShow(!contentPane.isVisible());
}
});
headerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray));
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
wrapPane.add(headerPane, BorderLayout.NORTH);
wrapPane.add(contentPane, BorderLayout.CENTER);
setContentPanelShow(true);
this.add(wrapPane);
}
private void setContentPanelShow(Boolean show) {
contentPane.setVisible(show);
headerPane.setShow(show);
}
class HeaderPane extends JPanel {
UILabel iconUiLabel;
UILabel closeButton;
AbstractSortGroupPane sortGroupPane;
HeaderPane(AbstractSortGroupPane sortGroupPane) {
this.sortGroupPane = sortGroupPane;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
initComponents();
}
private void initComponents() {
iconUiLabel = new UILabel();
this.add(iconUiLabel);
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
this.add(uiLabel);
this.add(AbstractSortPane.createIntervalUILabel(114));
closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png"));
this.add(closeButton);
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
sortGroupPane.removeSortItem(1);
}
});
this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth + 7, AbstractSortPane.PANE_COMPONENT_HEIGHT));
}
public void setShow(boolean show) {
if (show) {
iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/down_arrow.png"));
} else {
iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/left_arrow.png"));
}
}
}
}

32
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java

@ -0,0 +1,32 @@
package com.fr.design.sort.expressionpane;
import com.fr.design.i18n.Toolkit;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CellSortExpression;
import java.awt.*;
public class CellSortExpressionPane extends SortExpressionPane<CellSortExpression> {
public CellSortExpressionPane(int with) {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
}
@Override
public String getSortName() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Cell");
}
@Override
public void populateBean(CellSortExpression cellSortExpression) {
}
@Override
public CellSortExpression updateBean() {
return new CellSortExpression();
}
}

160
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java

@ -0,0 +1,160 @@
package com.fr.design.sort.expressionpane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.UIList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
import java.util.ArrayList;
import java.util.List;
public class CustomSequenceEditPane extends BasicPane {
java.util.List<String> customSequence;
JPanel referenceSequencePanel;
JPanel editSequencePanel;
JTextArea jTextArea;
CustomSequenceEditPane(java.util.List<String> customSequence) {
this.customSequence = customSequence;
initComponents();
}
void initComponents() {
this.setLayout(new BorderLayout());
initReferenceSequencePanel();
initEditSequencePanel();
}
void initReferenceSequencePanel() {
referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Reference_Sequence"));
referenceSequencePanel.add(uiLabel);
UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList());
uiScrollPane.setPreferredSize(new Dimension(200, 300));
referenceSequencePanel.add(uiScrollPane);
referenceSequencePanel.setPreferredSize(new Dimension(200, 400));
this.add(referenceSequencePanel, BorderLayout.WEST);
}
private UIList getReferenceSequenceList() {
UIList uiList = new UIList(getReferenceSequenceModel());
new CustomSequenceEditDragSource(uiList, DnDConstants.ACTION_MOVE);
return uiList;
}
private String[] getReferenceSequenceModel() {
List<List<String>> customSequences = CustomSequenceSortExpression.getReferenceCustomSequences();
String[] listModel = new String[customSequences.size()];
for (int i = 0; i < customSequences.size(); i++) {
listModel[i] = CustomSequenceSortExpression.customSequenceToString(customSequences.get(i), ",");
}
return listModel;
}
void initEditSequencePanel() {
editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Input_Sequence"));
editSequencePanel.add(uiLabel);
UILabel uiLabel2 = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements"));
uiLabel2.setForeground(Color.lightGray);
editSequencePanel.add(uiLabel2);
jTextArea = getTextArea();
UIScrollPane uiScrollPane = new UIScrollPane(jTextArea);
uiScrollPane.setPreferredSize(new Dimension(475, 300));
editSequencePanel.add(uiScrollPane);
this.add(editSequencePanel, BorderLayout.CENTER);
}
JTextArea getTextArea() {
PlaceholderTextArea placeholderTextArea = new PlaceholderTextArea(10, 10, getPlaceholderText());
new CustomSequenceEditDropTarget(placeholderTextArea, CustomSequenceSortExpression.getReferenceCustomSequences());
placeholderTextArea.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, "\n"));
return placeholderTextArea;
}
String getPlaceholderText() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements_Such_As") + "\n");
stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_One") + "\n");
stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_Two") + "\n");
stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_Three") + "\n");
return stringBuilder.toString();
}
@Override
protected String title4PopupWindow() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Custom_Sequence");
}
class CustomSequenceEditDragSource extends DragSourceAdapter implements DragGestureListener {
private DragSource source;
public CustomSequenceEditDragSource(UIList uiList, int actions) {
source = new DragSource();
source.createDefaultDragGestureRecognizer(uiList, actions, this);
}
public void dragGestureRecognized(DragGestureEvent dge) {
Component comp = dge.getComponent();
if (comp instanceof UIList) {
UIList uiList = (UIList) comp;
source.startDrag(dge, DragSource.DefaultLinkDrop, new SerializableTransferable(uiList.getSelectedIndex()), this);
}
}
}
class CustomSequenceEditDropTarget extends DropTargetAdapter {
java.util.List<java.util.List<String>> customSequences = new ArrayList<>();
public CustomSequenceEditDropTarget(PlaceholderTextArea jPanel, java.util.List<java.util.List<String>> customSequences) {
new DropTarget(jPanel, this);
this.customSequences = customSequences;
}
@Override
public void drop(DropTargetDropEvent dtde) {
try {
Transferable transferable = dtde.getTransferable();
DataFlavor[] dataFlavors = transferable.getTransferDataFlavors();
if (dataFlavors.length == 1) {
Integer index = (Integer) transferable.getTransferData(dataFlavors[0]);
String text = "";
java.util.List<String> customSequence = customSequences.get(index);
for (int i = 0; i < customSequence.size(); i++) {
text += customSequence.get(i) + "\n";
}
JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent();
jTextArea.setText(text);
}
} catch (Exception e) {
}
}
}
public List<String> updateBean() {
return CustomSequenceSortExpression.stringToCustomSequence(jTextArea.getText(), "\n");
}
}

66
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java

@ -0,0 +1,66 @@
package com.fr.design.sort.expressionpane;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
public class CustomSequencePane extends JPanel {
protected UITextField textField;
protected UIButton button;
List<String> customSequence;
public CustomSequencePane(int width) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
this.initComponents(width);
}
protected void initComponents(int width) {
textField = new UITextField();
textField.setEditable(false);
textField.setPreferredSize(new Dimension(width - 20, 20));
Icon icon = IconUtils.readIcon("/com/fr/design/images/control/refresh.png");
button = new UIButton(icon);
button.setBackground(Color.RED);
button.setPreferredSize(new Dimension(24, 20));
button.setOpaque(false);
button.setCursor(new Cursor(Cursor.HAND_CURSOR));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
CustomSequenceEditPane customSequenceEditPane = new CustomSequenceEditPane(customSequence);
customSequenceEditPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
customSequence = customSequenceEditPane.updateBean();
textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ","));
}
}, new Dimension(700, 400)).setVisible(true);
}
});
button.setPreferredSize(new Dimension(24, AbstractSortPane.PANE_COMPONENT_HEIGHT));
this.add(textField);
this.add(button);
}
public List<String> updateBean() {
return customSequence;
}
public void populateBean(List<String> customSequence) {
this.customSequence = customSequence;
textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ","));
}
}

39
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java

@ -0,0 +1,39 @@
package com.fr.design.sort.expressionpane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*;
import java.awt.*;
import java.util.List;
public class CustomSequenceSortExpressionPane extends SortExpressionPane<CustomSequenceSortExpression> {
CustomSequencePane customSequencePane;
public CustomSequenceSortExpressionPane(int width, int rightWidth) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
customSequencePane = new CustomSequencePane(rightWidth);
customSequencePane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT));
customSequencePane.setBorder(BorderFactory.createEmptyBorder(0,0,0,3));
this.add(customSequencePane);
}
@Override
public String getSortName() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Custom_Sequence");
}
@Override
public void populateBean(CustomSequenceSortExpression customSequenceSortExpression) {
List<String> customSequence = customSequenceSortExpression.getCustomSequence();
customSequencePane.populateBean(customSequence);
}
@Override
public CustomSequenceSortExpression updateBean() {
List<String> customSequence = customSequencePane.updateBean();
return new CustomSequenceSortExpression(customSequence);
}
}

42
designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java

@ -0,0 +1,42 @@
package com.fr.design.sort.expressionpane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import java.awt.*;
public class FormulaSortExpressionPane extends SortExpressionPane<FormulaSortExpression> {
TinyFormulaPane tinyFormulaPane;
public FormulaSortExpressionPane(int width) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 1));
tinyFormulaPane = new TinyFormulaPane();
tinyFormulaPane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT));
this.add(tinyFormulaPane);
}
@Override
public String getSortName() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Formula");
}
@Override
public void populateBean(FormulaSortExpression formulaSortExpression) {
String formula = formulaSortExpression.getFormula();
tinyFormulaPane.getUITextField().setText(formula);
}
@Override
public FormulaSortExpression updateBean() {
String formula = tinyFormulaPane.getUITextField().getText();
return new FormulaSortExpression(formula);
}
public boolean needSortArea() {
return false;
}
}

23
designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java

@ -0,0 +1,23 @@
package com.fr.design.sort.expressionpane;
import com.fr.report.core.sort.sortexpression.SortExpression;
import javax.swing.*;
public abstract class SortExpressionPane<T extends SortExpression> extends JPanel {
public abstract String getSortName();
public abstract void populateBean(T sortExpression);
public abstract T updateBean();
public boolean needSortArea() {
return true;
}
public boolean needSortRule() {
return true;
}
}

125
designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java

@ -0,0 +1,125 @@
package com.fr.design.sort.header;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.stable.ColumnRow;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class HeaderAreaPane extends JPanel {
protected int headerAreaPaneWidth;
protected int headerAreaPaneRightWidth;
AreaJLayeredPane areaJLayeredPane;
HeaderAreaPane(int headerAreaPaneWidth, int headerAreaPaneRightWidth) {
this.headerAreaPaneWidth = headerAreaPaneWidth;
this.headerAreaPaneRightWidth = headerAreaPaneRightWidth;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
initComponents();
}
void initComponents() {
initUILabel();
initLayeredPane();
}
void initUILabel() {
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Area"), SwingConstants.LEFT);
this.add(uiLabel);
this.add(AbstractSortPane.createIntervalUILabel());
}
void initLayeredPane() {
areaJLayeredPane = new AreaJLayeredPane();
this.add(areaJLayeredPane);
}
public void populateBean(ColumnRow columnRow) {
areaJLayeredPane.populateBean(columnRow);
}
public ColumnRow updateBean() {
return areaJLayeredPane.updateBean();
}
class AreaJLayeredPane extends JPanel {
SortColumnRowPane columnRowPane;
JLayeredPane jLayeredPane;
UIComboBox uiComboBox;
AreaJLayeredPane() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
initComponents();
}
private void initComponents() {
initUIComboBox();
initJLayeredPane();
}
void initUIComboBox() {
uiComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_None"), Toolkit.i18nText("Fine-Design_Basic_Custom")});
uiComboBox.setSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
uiComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1);
}
});
}
void setSortColumnRowPaneShow(boolean show) {
if (show) {
jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER);
jLayeredPane.setLayer(uiComboBox, JLayeredPane.MODAL_LAYER);
} else {
jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER);
jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER);
}
refresh();
}
void initJLayeredPane() {
jLayeredPane = new JLayeredPane();
columnRowPane = new SortColumnRowPane(headerAreaPaneRightWidth - 18, AbstractSortPane.PANE_COMPONENT_HEIGHT);
jLayeredPane.setPreferredSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
jLayeredPane.add(columnRowPane, JLayeredPane.MODAL_LAYER);
jLayeredPane.add(uiComboBox, JLayeredPane.POPUP_LAYER);
this.add(jLayeredPane);
}
public void populateBean(ColumnRow columnRow) {
if (SortColumnRowPane.isAvailableColumnRow(columnRow)) {
uiComboBox.setSelectedIndex(1);
} else {
uiComboBox.setSelectedIndex(0);
}
columnRowPane.populateBean(columnRow);
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1);
}
public ColumnRow updateBean() {
if (uiComboBox.getSelectedIndex() == 0) {
return null;
} else {
return columnRowPane.updateBean();
}
}
public void refresh() {
validate();
repaint();
revalidate();
}
}
}

81
designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java

@ -0,0 +1,81 @@
package com.fr.design.sort.header;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.report.core.sort.header.SortHeader;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
public class HeaderSettingPane extends JPanel {
protected int headerSettingPaneWidth;
protected int headerSettingPaneRightWidth;
HeaderSortRulePane headerSortRulePane;
UICheckBox uiCheckBox;
HeaderSettingPane(int headerSettingPaneWidth, int headerSettingPaneRightWidth) {
this.headerSettingPaneWidth = headerSettingPaneWidth;
this.headerSettingPaneRightWidth = headerSettingPaneRightWidth;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
initComponents();
}
void initComponents() {
initUILabel();
initHeaderSortRulePane();
}
void initUILabel() {
JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Setting"));
UILabel emptyUILabel = new UILabel();
emptyUILabel.setPreferredSize(new Dimension(10, 10));
uiCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Sort_Allow_User_Click_Sort_Order"));
uiCheckBox.setPreferredSize(new Dimension(headerSettingPaneRightWidth - 10, AbstractSortPane.PANE_COMPONENT_HEIGHT));
uiCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
headerSortRulePane.setVisible(uiCheckBox.isSelected());
}
});
jPanel.add(uiLabel);
jPanel.add(emptyUILabel);
jPanel.add(uiCheckBox);
this.add(jPanel);
}
void initHeaderSortRulePane() {
headerSortRulePane = new HeaderSortRulePane();
this.add(headerSortRulePane);
headerSortRulePane.setVisible(false);
}
protected void refresh() {
validate();
repaint();
revalidate();
}
public void populateBean(SortHeader.SortItem[] sortItems) {
if (sortItems == null) {
uiCheckBox.setSelected(false);
} else {
uiCheckBox.setSelected(true);
}
headerSortRulePane.populateBean(sortItems);
}
public SortHeader.SortItem[] updateBean() {
if (uiCheckBox.isSelected()) {
return headerSortRulePane.updateBean();
} else {
return null;
}
}
}

234
designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java

@ -0,0 +1,234 @@
package com.fr.design.sort.header;
import com.fr.base.svg.SVGIcon;
import com.fr.base.svg.SVGTranscoder;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.theme.edit.ui.ColorListPane;
import com.fr.general.IOUtils;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.report.core.sort.common.SortRule;
import org.apache.batik.transcoder.TranscoderInput;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
public class HeaderSortRulePane extends JPanel {
private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg";
private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg";
private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg";
IconButton ascIconButton;
IconButton desIconButton;
IconButton nosortIconButton;
UICheckBox ascUICheckBox;
UICheckBox desUICheckBox;
UICheckBox nosortUICheckBox;
HeaderSortRulePane() {
initComponents();
initState();
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15));
}
void initComponents() {
this.setLayout(new BorderLayout());
initUILabel();
initSortRuleItem();
this.setPreferredSize(new Dimension(160, 160));
}
void initUILabel() {
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Sort_Basis"), SwingConstants.LEFT);
this.add(uiLabel, BorderLayout.NORTH);
}
void initSortRuleItem() {
Component[][] components = new Component[][]{
new Component[]{ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()), ascIconButton = new IconButton(ASC_ICON_TEMPLATE_PATH)},
new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)},
new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)},
};
double[] rowSize = {24, 24, 24};
double[] columnSize = {80, 30};
JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0);
this.add(sortRuleItem, BorderLayout.CENTER);
}
void initState() {
ascUICheckBox.setSelected(false);
desUICheckBox.setSelected(false);
nosortUICheckBox.setSelected(false);
ascIconButton.refreshIconLabelColor(new Color(33, 33, 34));
desIconButton.refreshIconLabelColor(new Color(33, 33, 34));
nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34));
}
class IconButton extends JPanel implements UIObserver {
JLayeredPane jLayeredPane;
String iconTemplatePath;
UILabel iconLabel;
ColorListPane.ColorButton colorButton;
Color color;
BufferedImage bufferedImage;
UIObserverListener uiObserverListener;
IconButton(String iconTemplatePath) {
this.iconTemplatePath = iconTemplatePath;
initComponents();
}
void initComponents() {
jLayeredPane = new JLayeredPane();
iconLabel = getIconLabel(iconTemplatePath);
UILabel emptyUiLabel = new UILabel();
emptyUiLabel.setSize(16, 16);
emptyUiLabel.setOpaque(true);
emptyUiLabel.setBackground(Color.WHITE);
iconLabel.setSize(16, 16);
colorButton = new ColorListPane.ColorButton(Color.CYAN);
colorButton.setSize(16, 16);
colorButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
color = colorButton.getSelectObject();
refreshIconLabelColor(color);
uiObserverListener.doChange();
}
});
jLayeredPane.setPreferredSize(new Dimension(16, 16));
jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER);
jLayeredPane.add(emptyUiLabel, JLayeredPane.MODAL_LAYER);
jLayeredPane.add(colorButton, JLayeredPane.PALETTE_LAYER);
this.add(jLayeredPane);
}
void refreshIconLabelColor(Color color) {
Icon icon = getIcon(iconTemplatePath, color);
refreshIconLabel(icon);
}
void refreshIconLabel(Icon icon) {
if (icon != null) {
iconLabel.removeAll();
iconLabel.setIcon(icon);
iconLabel.repaint();
}
}
UILabel getIconLabel(String iconPath) {
return getIconLabel(iconPath, new Color(33, 33, 34));
}
UILabel getIconLabel(String iconPath, Color color) {
Icon svgIcon = getIcon(iconPath, color);
return new UILabel(svgIcon);
}
Icon getIcon(String iconPath, Color color) {
try {
InputStream inputStream = IOUtils.getResourceAsStream(iconPath, HeaderSortRulePane.class);
String svgText = getSvgText(inputStream);
svgText = svgText.replaceAll("\\{fillColor\\}", shiftColor(color));
InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes());
TranscoderInput input = new TranscoderInput(svgInputStream);
bufferedImage = SVGTranscoder.createImage(1.0, input).getImage();
SVGIcon svgIcon = new SVGIcon(bufferedImage);
return svgIcon;
} catch (Exception e) {
}
return null;
}
String shiftColor(Color color) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(shiftValue(color.getRed()));
stringBuilder.append(shiftValue(color.getGreen()));
stringBuilder.append(shiftValue(color.getBlue()));
return stringBuilder.toString();
}
String shiftValue(int value) {
int resultValue = (int) ((((float) value) / 255) * 99);
if (resultValue < 10) {
return "0" + resultValue;
} else {
return "" + resultValue;
}
}
private String getSvgText(InputStream inputStream) throws Exception {
StringBuffer stringBuffer = new StringBuffer();
byte[] b = new byte[1024];
for (int n; (n = inputStream.read(b)) != -1; ) {
stringBuffer.append(new String(b, 0, n));
}
return stringBuffer.toString();
}
@Override
public void registerChangeListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = uiObserverListener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
}
public void populateBean(SortHeader.SortItem[] sortItems) {
initState();
if (sortItems != null) {
for (SortHeader.SortItem sortItem : sortItems) {
SortRule sortRule = sortItem.getSortRule();
BufferedImage bufferedImage = sortItem.getBufferedImage();
Icon icon = null;
if (bufferedImage != null) {
icon = new SVGIcon(bufferedImage);
}
if (sortRule == SortRule.ASC) {
ascIconButton.refreshIconLabel(icon);
ascUICheckBox.setSelected(true);
} else if (sortRule == SortRule.DES) {
desIconButton.refreshIconLabel(icon);
desUICheckBox.setSelected(true);
} else if (sortRule == SortRule.NO_SORT) {
nosortIconButton.refreshIconLabel(icon);
nosortUICheckBox.setSelected(true);
}
}
}
}
public SortHeader.SortItem[] updateBean() {
java.util.List<SortHeader.SortItem> items = new ArrayList<>();
if (ascUICheckBox.isSelected()) {
items.add(new SortHeader.SortItem(SortRule.ASC, ascIconButton.bufferedImage));
}
if (desUICheckBox.isSelected()) {
items.add(new SortHeader.SortItem(SortRule.DES, desIconButton.bufferedImage));
}
if (nosortUICheckBox.isSelected()) {
items.add(new SortHeader.SortItem(SortRule.NO_SORT, nosortIconButton.bufferedImage));
}
SortHeader.SortItem[] resultItems = new SortHeader.SortItem[items.size()];
return items.toArray(resultItems);
}
}

59
designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

@ -0,0 +1,59 @@
package com.fr.design.sort.header;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.stable.ColumnRow;
import javax.swing.*;
public class SortHeaderPane extends JPanel {
int sortHeaderPaneWidth;
int sortHeaderPaneRightWidth;
SortHeader sortHeader;
HeaderAreaPane headerAreaPane;
HeaderSettingPane headerSettingPane;
public SortHeaderPane(int sortHeaderPaneWidth, int sortHeaderPaneRightWidth) {
this.sortHeaderPaneWidth = sortHeaderPaneWidth;
this.sortHeaderPaneRightWidth = sortHeaderPaneRightWidth;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
initHeaderArea();
initHeaderSetting();
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
void initHeaderArea() {
this.headerAreaPane = new HeaderAreaPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth);
this.add(headerAreaPane);
}
void initHeaderSetting() {
this.headerSettingPane = new HeaderSettingPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth);
this.add(headerSettingPane);
}
public void populateBean(SortHeader sortHeader, String defaultHeaderArea) {
this.sortHeader = sortHeader;
ColumnRow columnRow = null;
SortHeader.SortItem[] sortItems = null;
String headerArea = defaultHeaderArea;
if (sortHeader != null) {
headerArea = sortHeader.getHeaderArea();
sortItems = sortHeader.getSortItems();
}
columnRow = ColumnRow.valueOf(headerArea);
headerAreaPane.populateBean(columnRow);
headerSettingPane.populateBean(sortItems);
}
public SortHeader updateBean() {
ColumnRow columnRow = headerAreaPane.updateBean();
SortHeader.SortItem[] items = headerSettingPane.updateBean();
String headerArea = null;
if (columnRow != null) {
headerArea = columnRow.toString();
}
SortHeader sortHeader = new SortHeader(headerArea, null, items);
return sortHeader;
}
}

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

@ -11,6 +11,7 @@ import com.fr.design.dscolumn.DSColumnAdvancedPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane;
import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
@ -31,6 +32,7 @@ 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.cell.AbstractDSCellEditorPane; import com.fr.design.mainframe.cell.AbstractDSCellEditorPane;
import com.fr.design.sort.celldscolumn.CellDSColumnSortPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -221,62 +223,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
private UIButton conditionUIButton; private UIButton conditionUIButton;
/**
* 分组设置监听器
*/
private ItemListener groupListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e == null) {
//分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存
groupPane.update();
fireTargetModified();
return;
}
if (e.getStateChange() == ItemEvent.DESELECTED) {
groupPane.update();
fireTargetModified();
}
}
};
/**
* 数据集列设置监听器
*/
private ItemListener dataListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
dataPane.update(cellElement);
fireTargetModified();
}
}
};
DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane();
dataPane.setListener(dataListener);
groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {60, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
condition = new DSColumnConditionAction();
if (tc != null) {
condition.setEditingComponent(tc);
}
//丢掉icon,修改按钮名称为编辑
condition.setSmallIcon(UIConstants.EMPTY_ICON);
condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
conditionUIButton = new UIButton(condition);
Component[][] components = new Component[][]{
new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)}
};
conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.createScrollPane();
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@Override @Override
public String getIconPath() { public String getIconPath() {
@ -297,11 +243,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
this.removeAttributeChangeListener();
dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc); dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement); groupPane.populate(cellElement);
if (tc != null) { if (tc != null) {
condition.setEditingComponent(tc); condition.setEditingComponent(tc);
} }
this.addAttributeChangeListener();
} }
@Override @Override
@ -318,7 +266,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
initComponents();
double[] columnSize = {F}; double[] columnSize = {F};
double[] rowSize = {P, P, P}; double[] rowSize = {P, P, P};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -331,6 +279,37 @@ public class CellDSColumnEditor extends CellQuickEditor {
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
} }
private void initComponents(){
dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane();
double[] rowSize = {P}, columnSize = {60, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
condition = new DSColumnConditionAction();
if (tc != null) {
condition.setEditingComponent(tc);
}
//丢掉icon,修改按钮名称为编辑
condition.setSmallIcon(UIConstants.EMPTY_ICON);
condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
conditionUIButton = new UIButton(condition);
Component[][] components = new Component[][]{
new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)}
};
conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@Override
protected AttributeChangeListener getAttributeChangeListener() {
return new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
fireTargetModified();
}
};
}
} }
@ -373,88 +352,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 补充空白数据数目面板 可隐藏 * 补充空白数据数目面板 可隐藏
*/ */
private JPanel multiPane; private JPanel multiPane;
/*pane end*/
/*listeners begin*/
private UIObserverListener sortPaneFormulaChangeListener = new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener sortTypeBtnGroupChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener filterPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener customValuePaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
};
private AttributeChangeListener formatChangeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
formatAttrPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ChangeListener veCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ActionListener useMultiNumCheckBoxChangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private ChangeListener multiNumSpinnerChangeListener = new ChangeListener() { private CellDSColumnSortPane cellDSColumnSortPane;
@Override /*pane end*/
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() { public DSColumnAdvancedEditorPane() {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.createScrollPane();
} }
@ -469,6 +373,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
@Override @Override
public void update() { public void update() {
if (cellElement != null) { if (cellElement != null) {
@ -480,13 +385,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
updateExtendConfig(); updateExtendConfig();
//更新补充空白设置 //更新补充空白设置
updateMultipleConfig(); updateMultipleConfig();
cellDSColumnSortPane.updateBean(cellElement);
} }
} }
@Override @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
disableListener(); this.removeAttributeChangeListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
formatAttrPane.populate(cellElement); formatAttrPane.populate(cellElement);
@ -524,8 +430,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
useMultiNumCheckBox.setSelected(true); useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
} }
if (cellDSColumnSortPane != null) {
cellDSColumnSortPane.populateBean(cellElement);
}
this.checkButtonEnabled(); this.checkButtonEnabled();
enableListener(); this.addAttributeChangeListener();
} }
} }
@ -534,6 +443,17 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
@Override
protected AttributeChangeListener getAttributeChangeListener() {
return new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
fireTargetModified();
}
};
}
/** /**
* 更新单元格扩展属性 * 更新单元格扩展属性
*/ */
@ -578,6 +498,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout());
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序 //结果集排序
@ -616,8 +537,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane); multiNumPane.add(multiPane);
enableListener();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
@ -630,32 +549,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
double[] rowSize = new double[components.length]; double[] rowSize = new double[components.length];
Arrays.fill(rowSize, P); Arrays.fill(rowSize, P);
double[] columnSize = {F}; double[] columnSize = {F};
JPanel advancePropertyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); contentPane.add(advancePropertyPane, BorderLayout.NORTH);
} UIExpandablePane sortUIExpandablePane =
new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"),
public void enableListener() { 223, 24, cellDSColumnSortPane = new CellDSColumnSortPane());
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener); contentPane.add(sortUIExpandablePane, BorderLayout.CENTER);
valuePane.addListener(customValuePaneChangeListener); return contentPane;
formatAttrPane.addAttributeChangeListener(formatChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener);
} }
public void disableListener() {
sortPane.removeListener(sortTypeBtnGroupChangeListener);
filterPane.removeListener();
valuePane.removeListener();
heCheckBox.removeChangeListener(heCheckBoxChangeListener);
veCheckBox.removeChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener);
}
private void checkButtonEnabled() { private void checkButtonEnabled() {
if (useMultiNumCheckBox.isSelected()) { if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true); multiNumSpinner.setEnabled(true);

4
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -191,18 +191,20 @@ public class DesignerActivator extends Activator implements Prepare {
private void loadLogAppender() { private void loadLogAppender() {
logHandler = new LogHandler<DesignerLogAppender>() { logHandler = new LogHandler<DesignerLogAppender>() {
final DesignerLogAppender logAppender = new DesignerLogAppender(); final DesignerLogAppender logAppender = DesignerLogAppender.createDesignerLogAppender();
@Override @Override
public DesignerLogAppender getHandler() { public DesignerLogAppender getHandler() {
return logAppender; return logAppender;
} }
}; };
logHandler.getHandler().start();
FineLoggerFactory.getLogger().addLogAppender(logHandler); FineLoggerFactory.getLogger().addLogAppender(logHandler);
} }
private void unloadLogAppender() { private void unloadLogAppender() {
if (logHandler != null) { if (logHandler != null) {
logHandler.getHandler().stop();
FineLoggerFactory.getLogger().removeLogAppender(logHandler); FineLoggerFactory.getLogger().removeLogAppender(logHandler);
} }
} }

Loading…
Cancel
Save