Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~fly.li/design into feature/x

feature/x
fly.li 3 years ago
parent
commit
7c11a48610
  1. 70
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  2. 45
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  5. 5
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  6. 7
      designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java
  7. 4
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  9. 10
      designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java
  10. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java
  11. 47
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  12. 29
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  13. 40
      designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java
  14. 16
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  15. 5
      designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg
  16. 5
      designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg
  17. 0
      designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png
  18. BIN
      designer-base/src/main/resources/com/fr/design/images/sort/sequence.png
  19. BIN
      designer-base/src/main/resources/com/fr/design/images/transparent_background.png
  20. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  21. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  22. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  23. 12
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java
  24. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  25. 26
      designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java
  26. 13
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  27. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  28. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  29. BIN
      designer-form/src/main/resources/com/fr/design/form/images/loading.png
  30. 5
      designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java
  31. 87
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  32. 6
      designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java
  33. 19
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  34. 3
      designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  35. 109
      designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  36. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/AbstractCellAttrPane.java
  37. 20
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  38. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  39. 11
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  40. 40
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java
  41. 40
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java
  42. 59
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java
  43. 19
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java
  44. 37
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java
  45. 39
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java
  46. 151
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java
  47. 153
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java
  48. 113
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  49. 276
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  50. 101
      designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java
  51. 32
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java
  52. 160
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java
  53. 64
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java
  54. 37
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java
  55. 42
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java
  56. 23
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java
  57. 125
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  58. 81
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java
  59. 274
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  60. 61
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java
  61. 367
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

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

@ -4,11 +4,19 @@ import com.fr.base.CellBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.general.IOUtils;
import com.fr.report.cell.TemplateCellElement;
import javax.swing.JPanel;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
/**
* @author Starryi
@ -16,6 +24,11 @@ import java.awt.GridLayout;
* Created by Starryi on 2021/9/3
*/
public class CellRectangleStylePreviewPane extends JPanel {
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
private static final int ROW_COUNT = 2;
private static final int COLUMN_COUNT = 2;
@ -24,7 +37,12 @@ public class CellRectangleStylePreviewPane extends JPanel {
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT];
public CellRectangleStylePreviewPane(boolean supportInnerBorder) {
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
setLayout(new GridLayout(2, 2));
setOpaque(false);
setBackground(null);
for (int r = 0; r < ROW_COUNT; r++) {
for (int c = 0; c < COLUMN_COUNT; c++) {
@ -101,4 +119,56 @@ public class CellRectangleStylePreviewPane extends JPanel {
return new Dimension(width, height);
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.clearRect(0, 0, getWidth(), getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
paintTransparentBackground((Graphics2D) g, cellElementGrid[0][0].getStyle());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
super.paint(g);
}
private void paintTransparentBackground(Graphics2D g2d, Style style) {
float alpha = computeTransparentBackgroundAlpha(style);
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth;
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight;
float maxScale = Math.max(scaleWidth, scaleHeight);
if (maxScale <= 1) {
scaleWidth = scaleHeight = 1;
} else {
scaleHeight = scaleWidth = maxScale;
}
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null);
g2d.setComposite(oldComposite);
}
private float computeTextColorBrightness(Style style) {
Color fontColor = style.getFRFont().getForeground();
return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F;
}
private float computeTransparentBackgroundAlpha(Style style) {
float textBrightness = computeTextColorBrightness(style);
float alpha = 1.0F;
if (textBrightness < 50) {
alpha = 0.2F;
} else if (textBrightness < 160){
alpha = 0.5F;
}
return alpha;
}
}

45
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -30,15 +30,10 @@ import java.util.List;
public class CellStylePreviewPane extends JPanel {
public static final int MINIMUM_HEIGHT = 40;
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public CellStylePreviewPane() {
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
setPreferredSize(new Dimension(0, 0));
}
@ -60,53 +55,15 @@ public class CellStylePreviewPane extends JPanel {
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g.clearRect(0, 0, getWidth(), getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
paintTransparentBackground(g2d, style);
paintCellStyle(g2d, style);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
private void paintTransparentBackground(Graphics2D g2d, Style style) {
float alpha = computeTransparentBackgroundAlpha(style);
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth;
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight;
float maxScale = Math.max(scaleWidth, scaleHeight);
if (maxScale <= 1) {
scaleWidth = scaleHeight = 1;
} else {
scaleHeight = scaleWidth = maxScale;
}
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null);
g2d.setComposite(oldComposite);
}
private float computeTextColorBrightness(Style style) {
Color fontColor = style.getFRFont().getForeground();
return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F;
}
private float computeTransparentBackgroundAlpha(Style style) {
float textBrightness = computeTextColorBrightness(style);
float alpha = 1.0F;
if (textBrightness < 50) {
alpha = 0.2F;
} else if (textBrightness < 160){
alpha = 0.5F;
}
return alpha;
}
private void paintCellStyle(Graphics2D g2d, Style style) {
int resolution = ScreenResolution.getScreenResolution();
@ -156,7 +113,7 @@ public class CellStylePreviewPane extends JPanel {
final int textLineHeight = metrics.getHeight();
final double textLineSpacing = PT.pt2pix(style.getLineSpacing(), resolution);
List textLineList = BaseUtils.getLineTextList(paintText, style, rfont, height, width, resolution);
List<?> textLineList = BaseUtils.getLineTextList(paintText, style, rfont, height, width, resolution);
double textLinesHeight = textLineList.size() * textLineHeight + Math.max(0, textLineList.size() - 1) * textLineSpacing;

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -715,8 +715,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
if (useGlobal(getTableData(), strategyConfig)) {
//使用全局配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true);
} else if (getTableData().isShare()) {
//使用共享数据集兼容配置
} else if (strategyConfig == null && getTableData().isShare()) {
//没有配置时,使用共享数据集兼容配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true);
}
}

3
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -269,7 +269,8 @@ public class PluginUtils {
jo.put("vendor", pluginContext.getVendor());
jo.put("price", pluginContext.getPrice());
jo.put("requiredJarTime", pluginContext.getRequiredJarTime());
jo.put("active", pluginContext.isActive());
// 前端需求的active实际上是插件的运行状态,通过isRunning()获取
jo.put("active", pluginContext.isRunning());
jo.put("hidden", pluginContext.isHidden());
jo.put("free", pluginContext.isFree());
jo.put("licDamaged", pluginContext.isLicDamaged());

5
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -290,6 +290,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
initTextPane();
initTipsPane();
initVariableTreeAndDescriptionArea();
refocusInWindow();
}
public void refocusInWindow() {
SwingUtilities.invokeLater(() -> formulaTextArea.requestFocusInWindow());
}
private void initVariableTreeAndDescriptionArea() {

7
designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java

@ -56,6 +56,13 @@ public class TableSearchTreeComboBox extends FRTreeComboBox {
return super.pathToString(path);
}
@Override
public void setSelectedItemString(String _name) {
super.setSelectedItemString(_name);
// 会因为连续两次选中的值一致,导致未触发编辑框联动
this.getEditor().setItem(_name);
}
/**
* 执行模糊搜索
*/

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

@ -4,6 +4,7 @@ package com.fr.design.gui.style;
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.constants.LayoutConstants;
@ -17,6 +18,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.IOUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
@ -238,7 +240,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
public Style update(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
}
if (backgroundPane.currentPane.isBackgroundChange()) {

4
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -11,9 +11,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.utils.LoadingUtils;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.HashMap;
@ -35,7 +37,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
private static final long serialVersionUID = 1L;
private JTemplate<?, ?> component;
private TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane();
private JPanel loadingPane = LoadingUtils.createLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane();
private ForbiddenPane forbiddenPane = new ForbiddenPane();

10
designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java

@ -2,11 +2,14 @@ package com.fr.design.mainframe.share;
import com.fr.design.DesignerEnvManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.locale.impl.ShowOnlineWidgetMark;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.form.share.constants.ComponentPath;
import com.fr.form.share.group.filter.ReuFilter;
import com.fr.design.DesignerCloudURLManager;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.workspace.WorkContext;
/**
@ -23,7 +26,12 @@ public class ComponentShareUtil {
* @return
*/
public static boolean needSwitch2OnlineTab() {
return DesignerCloudURLManager.getInstance().isConnected() && !hasTouched() && isCurrentTplNewCreate();
return DesignerCloudURLManager.getInstance().isConnected() && !hasTouched() && isCurrentTplNewCreate() && isShowOnlineWidgetRepoPane();
}
public static boolean isShowOnlineWidgetRepoPane() {
LocaleMark<Boolean> localeMark = LocaleCenter.getMark(ShowOnlineWidgetMark.class);
return localeMark.getValue();
}
/**

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

@ -11,9 +11,11 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
@ -24,6 +26,7 @@ import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.io.Serializable;
import java.util.List;
@ -112,32 +115,40 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button;
private static final Icon selectedMarkIcon = IOUtils.readIcon("/com/fr/design/form/images/marked.png");
private final CellRectangleStylePreviewPane previewArea;
private boolean selected = false;
public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) {
super();
setLayout(new BorderLayout(5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
button = new UIRadioButton();
button.setBorder(BorderFactory.createEmptyBorder());
previewArea = new CellRectangleStylePreviewPane(supportInnerBorder);
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);
this.selected = isSelected;
previewArea.setPlainText(value.getName());
previewArea.setStyle(value.getStyle(), value.getCellBorderStyle());
int preferredWidth = list.getWidth() - 15 - button.getPreferredSize().width;
int preferredWidth = list.getWidth() - 15;
preferredWidth = Math.max(0, preferredWidth);
int preferredHeight = 0;
previewArea.setPreferredSize(new Dimension(preferredWidth, preferredHeight));
return this;
}
@Override
public void paint(Graphics g) {
super.paint(g);
if (selected) {
selectedMarkIcon.paintIcon(this, g, getWidth() - selectedMarkIcon.getIconWidth(), 5);
}
}
}
}

47
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -102,20 +102,8 @@ public class CellStyleListEditPane extends JListControlPane {
@Override
protected JNameEdList createJNameList() {
JNameEdList nameEdList = super.createJNameList();
nameEdList.setCellEditor(new DefaultListCellEditor(new UITextField()) {
@Override
public Component getListCellEditorComponent(JList list, Object value, boolean isSelected, int index) {
ListModelElement element = (ListModelElement) getModel().getElementAt(index);
if (element != null) {
NameObject selectNameObject = (NameObject) element.wrapper;
ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject());
if (!cellStyle.isRemovable()) {
return null;
}
}
return super.getListCellEditorComponent(list, value, isSelected, index);
}
});
nameEdList.setCellEditor(new UnEditableListCellEditor(new UITextField()));
nameEdList.setCellRenderer(new NoIconNameableListCellRenderer());
return nameEdList;
}
@ -294,4 +282,35 @@ public class CellStyleListEditPane extends JListControlPane {
return ((ThemedCellStyle) ob).isUse4Default();
}
}
private class NoIconNameableListCellRenderer extends NameableListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (component instanceof NameableListCellRenderer) {
((NameableListCellRenderer) component).setIcon(null);
((NameableListCellRenderer) component).setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
}
return component;
}
}
private class UnEditableListCellEditor extends DefaultListCellEditor {
public UnEditableListCellEditor(UITextField textField) {
super(textField);
}
@Override
public Component getListCellEditorComponent(JList list, Object value, boolean isSelected, int index) {
ListModelElement element = (ListModelElement) getModel().getElementAt(index);
if (element != null) {
NameObject selectNameObject = (NameObject) element.wrapper;
ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject());
if (!cellStyle.isRemovable()) {
return null;
}
}
return super.getListCellEditorComponent(list, value, isSelected, index);
}
}
}

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

@ -136,13 +136,11 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(0, 10));
JPanel jPanel = new JPanel();
jPanel.setLayout(new BorderLayout(0, 4));
this.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewArea = new CellRectangleStylePreviewPane(true);
previewArea.setPreferredSize(new Dimension(215, 48));
previewArea.setPreferredSize(new Dimension(207, 48));
previewPane.setBorder(BorderFactory.createCompoundBorder(
BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview")),
BorderFactory.createEmptyBorder(4, 4, 4, 4)));
@ -150,8 +148,12 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
this.add(previewPane, BorderLayout.NORTH);
this.add(jPanel, BorderLayout.CENTER);
jPanel.add(tabPane, BorderLayout.NORTH);
JPanel settingsPane = new JPanel();
this.add(settingsPane, BorderLayout.CENTER);
settingsPane.setLayout(new BorderLayout(0, 4));
settingsPane.add(tabPane, BorderLayout.NORTH);
JPanel attrListenerPane = new AbstractAttrNoScrollPane() {
@Override
@ -176,18 +178,27 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
fireAttrChangeListener();
}
});
BasicScrollPane basicScrollPane = new AttrScrollPane() {
return new EmptyBorderAttrScrollPane() {
@Override
protected JPanel createContentPane() {
return centerPane;
}
};
return basicScrollPane;
}
};
jPanel.add(attrListenerPane, BorderLayout.CENTER);
settingsPane.add(attrListenerPane, BorderLayout.CENTER);
}
@Override
public void updateBean(ThemedCellStyle ob) {}
private static abstract class EmptyBorderAttrScrollPane extends AttrScrollPane {
@Override
protected void layoutContentPane() {
super.layoutContentPane();
leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java → designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java

@ -1,35 +1,29 @@
package com.fr.design.mainframe;
package com.fr.design.utils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/4/9
*/
public class OpenLoadingPane extends JPanel {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png"));
public class LoadingUtils {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.png"));
private static final Color TIP_COLOR = new Color(108, 174, 235);
private static final int Y_GAP = 50;
private static final int X_GAP = 10;
private UILabel loadingLabel;
private UILabel tipLabel;
public OpenLoadingPane() {
setLayout(new LayoutManager() {
public static JPanel createLoadingPane() {
JPanel jPanel = new JPanel();
UILabel loadingLabel = new UILabel(LOADING_ICON);
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
jPanel.setLayout(new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
}
@ -64,12 +58,10 @@ public class OpenLoadingPane extends JPanel {
public void addLayoutComponent(String name, Component comp) {
}
});
setBackground(Color.WHITE);
loadingLabel = new UILabel(LOADING_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
add(loadingLabel);
add(tipLabel);
jPanel.setBackground(Color.WHITE);
jPanel.add(loadingLabel);
jPanel.add(tipLabel);
return jPanel;
}
}

16
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -17,6 +17,7 @@ public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
private static final Color CELL_ELEMENT_FONT_FOREGROUND = Color.WHITE;
private static Color currentStoryBack = null;
@ -31,13 +32,24 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
style = adjustCellElement(style);
cellElement.setStyle(style);
}
}
public static Style adjustCellElement(Style style) {
if (DesignModeContext.isDuchampMode()) {
style = style.deriveFRFont(style.getFRFont().applyForeground(CELL_ELEMENT_FONT_FOREGROUND));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
}
return style;
}
public static Color adjustCellElementFontForeground(Color color) {
return DesignModeContext.isDuchampMode() ? CELL_ELEMENT_FONT_FOREGROUND : color;
}
public static void adjustFloatElement(FloatElement floatElement) {

5
designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.5 0.5H1.45833V1H1.5V1.5H0.5V0.5ZM2.375 0.5H3.29167V1.5H2.375V0.5ZM4.20833 0.5H5.125V1.5H4.20833V0.5ZM6.04167 0.5H6.95833V1.5H6.04167V0.5ZM7.875 0.5H8.79167V1.5H7.875V0.5ZM9.70833 0.5H10.625V1.5H9.70833V0.5ZM11.5417 0.5H12.5V1.5H11.5V1H11.5417V0.5ZM0.5 3.5V2.5H1.5V3.5H0.5ZM12.5 2.5V3.5H11.5V2.5H12.5ZM0.5 5.5V4.5H1.5V5.5H0.5ZM12.5 4.5V5.5H11.5V4.5H12.5ZM0.5 7.5V6.5H1.5V7.5H0.5ZM12.5 6.5V7.5H11.5V6.5H12.5ZM0.5 8.5H1.5V9H1.45833V9.5H0.5V8.5ZM3.29167 9.5H2.375V8.5H3.29167V9.5ZM5.125 9.5H4.20833V8.5H5.125V9.5ZM6.95833 9.5H6.04167V8.5H6.95833V9.5ZM8.79167 9.5H7.875V8.5H8.79167V9.5ZM10.625 9.5H9.70833V8.5H10.625V9.5ZM12.5 8.5V9.5H11.5417V9H11.5V8.5H12.5Z" fill="#C2C2C2"/>
<path d="M13.7602 15.0001C13.6857 15.0001 13.6111 15.0001 13.5365 15.0001C13.5351 14.9878 13.5275 14.9838 13.5159 14.9829C13.4597 14.9786 13.407 14.96 13.3549 14.9404C13.171 14.8709 13.0205 14.7576 12.9224 14.5854C12.8273 14.4184 12.7603 14.2374 12.6794 14.0632C12.5792 13.8474 12.4849 13.6289 12.3875 13.4118C12.3159 13.2522 12.243 13.0932 12.1714 12.9336C12.074 12.7165 11.9766 12.4993 11.8808 12.2815C11.8719 12.2612 11.35 12.6864 10.3153 13.5573C10.2385 13.622 10.1238 13.6121 10.0591 13.5353C10.0316 13.5026 10.0165 13.4613 10.0164 13.4186L10.001 7.3649C10.0007 7.26448 10.0819 7.18287 10.1823 7.18262C10.2218 7.18252 10.2603 7.19528 10.2919 7.21898L15.462 11.0966C15.5424 11.1568 15.5587 11.2708 15.4985 11.3512C15.4692 11.3902 15.4254 11.4159 15.377 11.4223C13.9063 11.6183 13.1749 11.723 13.1829 11.7363C13.2803 11.8984 13.3767 12.061 13.4745 12.2229C13.6247 12.4719 13.776 12.7203 13.9265 12.9692C14.0725 13.2107 14.2166 13.4534 14.3643 13.6939C14.4748 13.874 14.5144 14.0685 14.4805 14.275C14.4214 14.635 14.1357 14.9218 13.7808 14.9828C13.7695 14.9847 13.7616 14.9878 13.7602 15.0001Z" fill="#C2C2C2"/>
<path d="M10.1424 7.01206C10.1424 7.05547 10.1424 7.09902 10.1424 7.14242C10.0952 7.14242 10.048 7.14242 10.0008 7.14242C9.98988 6.88542 10.098 7.06584 10.1424 7.01206Z" fill="#C2C2C2"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

5
designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.5 0.5H1.45833V1H1.5V1.5H0.5V0.5ZM2.375 0.5H3.29167V1.5H2.375V0.5ZM4.20833 0.5H5.125V1.5H4.20833V0.5ZM6.04167 0.5H6.95833V1.5H6.04167V0.5ZM7.875 0.5H8.79167V1.5H7.875V0.5ZM9.70833 0.5H10.625V1.5H9.70833V0.5ZM11.5417 0.5H12.5V1.5H11.5V1H11.5417V0.5ZM0.5 3.5V2.5H1.5V3.5H0.5ZM12.5 2.5V3.5H11.5V2.5H12.5ZM0.5 5.5V4.5H1.5V5.5H0.5ZM12.5 4.5V5.5H11.5V4.5H12.5ZM0.5 7.5V6.5H1.5V7.5H0.5ZM12.5 6.5V7.5H11.5V6.5H12.5ZM0.5 8.5H1.5V9H1.45833V9.5H0.5V8.5ZM3.29167 9.5H2.375V8.5H3.29167V9.5ZM5.125 9.5H4.20833V8.5H5.125V9.5ZM6.95833 9.5H6.04167V8.5H6.95833V9.5ZM8.79167 9.5H7.875V8.5H8.79167V9.5ZM10.625 9.5H9.70833V8.5H10.625V9.5ZM12.5 8.5V9.5H11.5417V9H11.5V8.5H12.5Z" fill="#8F8F92"/>
<path d="M13.7602 15.0001C13.6857 15.0001 13.6111 15.0001 13.5365 15.0001C13.5351 14.9878 13.5275 14.9838 13.5159 14.9829C13.4597 14.9786 13.407 14.96 13.3549 14.9404C13.171 14.8709 13.0205 14.7576 12.9224 14.5854C12.8273 14.4184 12.7603 14.2374 12.6794 14.0632C12.5792 13.8474 12.4849 13.6289 12.3875 13.4118C12.3159 13.2522 12.243 13.0932 12.1714 12.9336C12.074 12.7165 11.9766 12.4993 11.8808 12.2815C11.8719 12.2612 11.35 12.6864 10.3153 13.5573C10.2385 13.622 10.1238 13.6121 10.0591 13.5353C10.0316 13.5026 10.0165 13.4613 10.0164 13.4186L10.001 7.3649C10.0007 7.26448 10.0819 7.18287 10.1823 7.18262C10.2218 7.18252 10.2603 7.19528 10.2919 7.21898L15.462 11.0966C15.5424 11.1568 15.5587 11.2708 15.4985 11.3512C15.4692 11.3902 15.4254 11.4159 15.377 11.4223C13.9063 11.6183 13.1749 11.723 13.1829 11.7363C13.2803 11.8984 13.3767 12.061 13.4745 12.2229C13.6247 12.4719 13.776 12.7203 13.9265 12.9692C14.0725 13.2107 14.2166 13.4534 14.3643 13.6939C14.4748 13.874 14.5144 14.0685 14.4805 14.275C14.4214 14.635 14.1357 14.9218 13.7808 14.9828C13.7695 14.9847 13.7616 14.9878 13.7602 15.0001Z" fill="#333334"/>
<path d="M10.1424 7.01206C10.1424 7.05547 10.1424 7.09902 10.1424 7.14242C10.0952 7.14242 10.048 7.14242 10.0008 7.14242C9.98988 6.88542 10.098 7.06584 10.1424 7.01206Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

0
designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png → designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 36 KiB

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

@ -1,13 +1,17 @@
package com.fr.van.chart.designer.component;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class VanChartLabelContentPane extends VanChartTooltipContentPane {
@ -37,6 +41,19 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
return stylePanel;
}
@Override
protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPaneWithAuto(FontAutoType.COLOR) {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
}
public void updateTextAttr(AttrTooltipContent attrTooltipContent) {
if (isInCondition() || !ChartEditContext.supportTheme()) {
super.updateTextAttr(attrTooltipContent);

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

@ -11,7 +11,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrTooltipContent;
@ -22,7 +21,6 @@ import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -41,10 +39,6 @@ import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -53,6 +47,10 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
@ -317,15 +315,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
textAttrPane = new ChartTextAttrPaneWithAuto(FontAutoType.COLOR) {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
textAttrPane = createChartTextAttrPane();
JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton);
@ -338,6 +328,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return stylePanel;
}
protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPane() {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
}
private void initStyleButtonListener() {
styleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

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

@ -25,6 +25,7 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -210,6 +211,16 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
public void doCancel() {
setVisible(false);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
//把一些可能没隐藏的子弹框隐藏 比如 边框-颜色弹框
for (Window window : getOwnedWindows()) {
window.setVisible(false);
}
}
}
}

12
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java

@ -93,13 +93,13 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
ganttDefinition.setEndTime(endTime == null ? StringUtils.EMPTY : String.valueOf(endTime));
Object markTime = markerTimeComboBox.getSelectedItem();
ganttDefinition.setMarkTime(isNoneObject(markTime) ? StringUtils.EMPTY : String.valueOf(markTime));
ganttDefinition.setMarkTime(isNoneObject(markTime) ? null : String.valueOf(markTime));
Object process = processComboBox.getSelectedItem();
ganttDefinition.setProgress(isNoneObject(process) ? StringUtils.EMPTY : String.valueOf(process));
ganttDefinition.setProgress(isNoneObject(process) ? null : String.valueOf(process));
Object taskID = taskIDComboBox.getSelectedItem();
ganttDefinition.setLinkID(isNoneObject(taskID) ? StringUtils.EMPTY : String.valueOf(taskID));
ganttDefinition.setLinkID(isNoneObject(taskID) ? null : String.valueOf(taskID));
}
private boolean isNoneObject(Object markTime) {
@ -117,9 +117,9 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
seriesComboBox.setSelectedItem(ganttDefinition.getSeriesName());
startTimeComboBox.setSelectedItem(ganttDefinition.getStartTime());
endTimeComboBox.setSelectedItem(ganttDefinition.getEndTime());
markerTimeComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getMarkTime()) ? NONE : ganttDefinition.getMarkTime());
processComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getProgress()) ? NONE : ganttDefinition.getProgress());
taskIDComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getLinkID()) ? NONE : ganttDefinition.getLinkID());
markerTimeComboBox.setSelectedItem(ganttDefinition.getMarkTime() == null ? NONE : ganttDefinition.getMarkTime());
processComboBox.setSelectedItem(ganttDefinition.getProgress() == null ? NONE : ganttDefinition.getProgress());
taskIDComboBox.setSelectedItem(ganttDefinition.getLinkID() == null ? NONE : ganttDefinition.getLinkID());
}
}

5
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -188,6 +188,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
XWTitleLayout parent = (XWTitleLayout) this.getParent();
if (parent.getComponentCount() > 1) {
parent.remove(parent.getTitleCreator());
WTitleLayout layout = parent.toData();
Rectangle rec = new Rectangle(layout.getBodyBoundsWidget().getBounds());
//删除标题组件后,容器高度为body高度+标题组件的高度
rec.height += WTitleLayout.TITLE_HEIGHT;
layout.updateChildBounds(rec);
}
}

26
designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java

@ -3,6 +3,8 @@ package com.fr.design.fit.toolbar;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.fit.NewJForm;
import com.fr.design.fit.common.AdaptiveSwitchUtil;
import com.fr.design.fit.common.TemplateTool;
@ -10,9 +12,9 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.LoadingUtils;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileFILE;
@ -23,13 +25,10 @@ import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
@ -46,7 +45,6 @@ public class SwitchAction extends UpdateAction {
private UIButton switchBtn;
private static final Icon SWITCH_ICON = IOUtils.readIcon("/com/fr/design/form/images/icon_switch.png");
private static final String LOADING_ICON_PATH = "/com/fr/design/form/images/loading.png";
private static final MenuKeySet SWITCH_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
@ -132,20 +130,18 @@ public class SwitchAction extends UpdateAction {
* @date: 2020/9/30 15:18
*/
public void showLoadingJPanel() {
JComponent area = TemplateTool.getCurrentEditingNewJForm().getFormDesign().getArea();
JComponent formDesigner = TemplateTool.getCurrentEditingNewJForm().getFormDesign();
NewJForm jForm = TemplateTool.getCurrentEditingNewJForm();
if (jForm != null) {
FormDesigner formDesigner = jForm.getFormDesign();
JComponent area = formDesigner.getArea();
area.remove(formDesigner);
JPanel loadingJPanel = new JPanel(new BorderLayout());
loadingJPanel.setBackground(Color.WHITE);
loadingJPanel.setBounds(formDesigner.getBounds());
JLabel jLabel = new JLabel(new ImageIcon(this.getClass().getResource(LOADING_ICON_PATH)), JLabel.CENTER);
loadingJPanel.add(jLabel, BorderLayout.CENTER);
area.setLayout(null);
area.add(loadingJPanel);
JPanel panel = LoadingUtils.createLoadingPane();
panel.setBounds(formDesigner.getBounds());
area.add(panel);
DesignerContext.getDesignerFrame().setVisible(true);
}
}
/**

13
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -6,13 +6,11 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.ShowOnlineWidgetMark;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ComponentShareUtil;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
@ -190,14 +188,9 @@ public class FormWidgetDetailPane extends FormDockView {
private void initPaneList() {
paneList = new ArrayList<>();
paneList.add(LocalWidgetRepoPane.getInstance());
if (isShowOnlineWidgetRepoPane()) {
if (ComponentShareUtil.isShowOnlineWidgetRepoPane()) {
OnlineWidgetRepoPane.getInstance().refresh();
paneList.add(OnlineWidgetRepoPane.getInstance());
}
}
private boolean isShowOnlineWidgetRepoPane() {
LocaleMark<Boolean> localeMark = LocaleCenter.getMark(ShowOnlineWidgetMark.class);
return localeMark.getValue();
}
}

11
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -221,6 +221,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
}
}
private String createLocalReuFilename() {
String filename = widget.getFileLoca();
if (StringUtils.isEmpty(filename) || !filename.endsWith(".reu")) {
filename = widget.getName() + "." + widget.getUuid() + ".reu";
}
return filename;
}
private void downLoadWidget() {
CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT);
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
@ -242,7 +250,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
protected Boolean doInBackground() {
String filePath;
try {
filePath = DownloadUtils.download(widget.getId(), widget.getName() + "." + widget.getUuid(), process);
String filename = createLocalReuFilename();
filePath = DownloadUtils.download(widget.getId(), filename, process);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -80,7 +80,7 @@ public class DownloadUtils {
long totalSize = entity.getContentLength();
InputStream content = entity.getContent();
filePath = StableUtils.pathJoin(realPath, fileName + ".reu");
filePath = StableUtils.pathJoin(realPath, fileName);
StableUtils.makesureFileExist(new File(filePath));
FileOutputStream writer = new FileOutputStream(filePath);
byte[] data = new byte[PluginConstants.BYTES_NUM];

BIN
designer-form/src/main/resources/com/fr/design/form/images/loading.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

5
designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java

@ -4,6 +4,7 @@ import com.fr.base.Style;
import com.fr.design.actions.cell.style.StyleActionInterface;
import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.event.EventDispatcher;
import com.fr.grid.selection.CellSelection;
@ -15,7 +16,7 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*;
import java.awt.Rectangle;
public class ReportActionUtils {
private ReportActionUtils() {
@ -113,7 +114,7 @@ public class ReportActionUtils {
CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow());
if (editCellElement == null) {
return Style.DEFAULT_STYLE;
return AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
}
//peter:直接返回当前编辑元素的Style

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

@ -22,7 +22,6 @@ import com.fr.design.gui.style.TextFormatPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.sort.celldscolumn.CellDSColumnSortPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
@ -58,19 +57,8 @@ public class DSColumnAdvancedPane extends BasicPane {
}
public DSColumnAdvancedPane(int setting) {
initContentPane(setting);
initScrollPane();
}
private void initScrollPane() {
ScrollPane scrollPane = new ScrollPane(contentPane);
this.add(scrollPane);
}
private void initContentPane(int setting) {
contentPane = new JPanel();
contentPane.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
sortPane = new SortPane();
sortPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order")));
@ -140,7 +128,7 @@ public class DSColumnAdvancedPane extends BasicPane {
TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL};
contentPane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
}
@Override
@ -153,7 +141,7 @@ public class DSColumnAdvancedPane extends BasicPane {
return;
}
sortPane.populateBean(cellElement);
sortPane.populate(cellElement);
valuePane.populate(cellElement);
formatAttrPane.populate(cellElement);
@ -203,7 +191,7 @@ public class DSColumnAdvancedPane extends BasicPane {
return;
}
sortPane.updateBean(cellElement);
sortPane.update(cellElement);
valuePane.update(cellElement);
formatAttrPane.update(cellElement);
@ -239,25 +227,66 @@ public class DSColumnAdvancedPane extends BasicPane {
}
}
private static class ScrollPane extends UIScrollPane {
ScrollPane(Component component) {
super(component);
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
private static class SortPane extends SortFormulaPane {
private CellElement cellElement;
@Override
public Dimension getPreferredSize() {
return new Dimension(DSColumnPane.DEFAULT_DIMENSION.width - 20, DSColumnPane.DEFAULT_DIMENSION.height - 100);
public void formulaAction() {
if (cellElement == null) {
return;
}
Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) {
return;
}
private static class SortPane extends CellDSColumnSortPane {
SortPane() {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(
DesignTableDataManager.getEditingTableDataSource(), ((DSColumn) value).getDSName());
showFormulaDialog(displayNames);
}
void populate(CellElement cellElement) {
if (cellElement == null) {
return;
}
this.cellElement = cellElement;
protected boolean needSortHeaderPane() {
return false;
Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) {
return;
}
DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder();
this.sortOrderComboBox.setSortOrder(new SortOrder(sort));
String sortFormula = dSColumn.getSortFormula();
sortFormulaTextField.setText(sortFormula);
}
public void update(CellElement cellElement) {
if (cellElement == null) {
return;
}
Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) {
return;
}
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setOrder(this.sortOrderComboBox.getSortOrder().getOrder());
//lance:sort formula
String sText = null;
if (!(sortFormulaTextField.getText() == null || sortFormulaTextField.getText().trim().equals("") || sortFormulaTextField.getText().trim().equals("$$$"))) {
sText = new String(sortFormulaTextField.getText());
}
if (!(sText == null || sText.length() < 1)) {
dSColumn.setSortFormula(sText);
} else {
dSColumn.setSortFormula(null);
}
}
}

6
designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java

@ -66,6 +66,10 @@ public abstract class AbstractAttrPane extends AbstractAttrNoScrollPane {
});
}
protected int getMaxHeight(){
return CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
}
/**
* 属性面板的滚动条和内容区域的布局管理类
*/
@ -93,7 +97,7 @@ public abstract class AbstractAttrPane extends AbstractAttrNoScrollPane {
@Override
public void layoutContainer(Container parent) {
maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
maxHeight = getMaxHeight();
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {

19
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -176,6 +176,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private CellSelection formatReferencedCell = null;
private CellSelection cellNeedTOFormat = null;
private FormatBrushAction formatBrushAction;
private boolean repeatSelection = false;
private ActionListener keyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -526,11 +527,17 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
return this.selection.getQuickEditor(this);
}
public boolean isRepeatSelection() {
return repeatSelection;
}
public void setRepeatSelection(boolean repeatSelection) {
this.repeatSelection = repeatSelection;
}
@Override
public void setSelection(Selection selection) {
if (!ComparatorUtils.equals(this.selection, selection)
|| !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())
|| DesignModeContext.isAuthorityEditing()) {
if (isEffectiveSelection(selection)) {
try {
//旧选中内容编辑器释放模板对象
QuickEditor editor = this.selection.getQuickEditorWithoutPopulate(this);
@ -545,6 +552,12 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
}
private boolean isEffectiveSelection(Selection selection) {
return (isRepeatSelection() || !ComparatorUtils.equals(this.selection, selection))
|| !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())
|| DesignModeContext.isAuthorityEditing();
}
public void setOldSelecton(Selection selection) {
this.selection = selection;

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

@ -6,6 +6,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -82,7 +83,7 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro
frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else {
frFont = frFont.applyForeground(Color.black);
frFont = frFont.applyForeground(AdjustWorkBookDefaultStyleUtils.adjustCellElementFontForeground(Color.black));
frFont = frFont.applyUnderline(Constants.LINE_NONE);
}
editCellElement.setStyle(elementStyle.deriveFRFont(frFont));

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

@ -1,7 +1,17 @@
package com.fr.design.mainframe.cell;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.mainframe.CellElementPropertyPane;
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;
/**
* 右侧单元格元素面板抽象类
@ -10,8 +20,26 @@ import com.fr.design.mainframe.AbstractAttrPane;
* @version 2017年7月25日
* @since 9.0
*/
public abstract class AbstractDSCellEditorPane extends AbstractAttrPane {
public abstract class AbstractDSCellEditorPane extends JPanel {
/**
* 滚动条相关配置
*/
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();
/**
* 从面板拿数据保存
@ -23,15 +51,78 @@ public abstract class AbstractDSCellEditorPane extends AbstractAttrPane {
*/
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
*/
protected abstract void release();
protected abstract AttributeChangeListener getAttributeChangeListener();
public void addAttributeChangeListener(){
this.addAttributeChangeListener(getAttributeChangeListener());
}
}

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -53,6 +54,7 @@ public abstract class AbstractCellAttrPane extends AbstractAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) {
cellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
}
this.cellElement = cellElement;
elementCase.addCellElement(this.cellElement);

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

@ -4,6 +4,7 @@ import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.expand.ExpandLeftFatherPane;
import com.fr.design.expand.ExpandUpFatherPane;
import com.fr.design.expand.SortExpandAttrPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -12,7 +13,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.sort.cellexpand.CellExpandSortPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.report.cell.TemplateCellElement;
@ -38,11 +38,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private ExpandUpFatherPane rightFatherPane;
private UICheckBox horizontalExpandableCheckBox;
private UICheckBox verticalExpandableCheckBox;
private SortExpandAttrPane sortAfterExpand;
private JPanel layoutPane;
private JPanel basicPane;
private JPanel seniorPane;
private CellExpandExtraAttrPane extraPane;
private CellExpandSortPane cellExpandSortPane;
/**
@ -62,6 +62,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
rightFatherPane = new ExpandUpFatherPane();
horizontalExpandableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable"));
verticalExpandableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable"));
sortAfterExpand = new SortExpandAttrPane();
initAllNames();
return layoutPane();
}
@ -80,11 +81,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
seniorPane = new JPanel();
basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane());
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(seniorPane, BorderLayout.CENTER);
layoutPane.add(sortUIExpandablePane, BorderLayout.SOUTH);
extraPane = CellExpandExtraAttrPane.getInstance();
@ -121,12 +119,16 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private JPanel seniorPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel expendSort = new UILabel(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"), SwingConstants.LEFT);
JPanel expendSortPane = new JPanel(new BorderLayout());
expendSortPane.add(expendSort, BorderLayout.NORTH);
horizontalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
verticalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{horizontalExpandableCheckBox, null},
new Component[]{verticalExpandableCheckBox, null},
new Component[]{expendSortPane, sortAfterExpand},
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
@ -167,8 +169,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
}
}
sortAfterExpand.populate(cellExpandAttr);
extraPane.populate(cellElement);
cellExpandSortPane.populateBean(cellElement);
}
@ -214,8 +217,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
}
}
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_ExpandD_Sort_After_Expand"))) {
sortAfterExpand.update(cellExpandAttr);
}
extraPane.update(cellElement);
cellExpandSortPane.updateBean(cellElement);
}
/**

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -9,7 +9,9 @@ import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
@ -18,6 +20,7 @@ import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Rectangle;
/**
* @author zhou
@ -112,6 +115,7 @@ public class CellStylePane extends AbstractCellAttrPane {
public void visit(int column, int row, TemplateCellElement cellElement) {
if (cellElement == null) {
cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
elementCase.addCellElement(cellElement);
}
Style style = stylePane.updateBean();

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

@ -38,6 +38,7 @@ import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -151,6 +152,7 @@ public class FormElementCaseDesigner
Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null;
if (grid != null) {
resetGrid(grid);
boolean oldTranslucent = grid.isTranslucent();
boolean oldShowExtraGridLine = grid.isShowExtraGridLine();
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
@ -168,6 +170,15 @@ public class FormElementCaseDesigner
return image;
}
private void resetGrid(Grid grid) {
grid.setResolution(Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION);
grid.updateUI();
grid.setAdsorbHeight(0);
grid.setAdsorbWidth(0);
grid.setVerticalValue(0);
grid.setHorizontalValue(0);
}
/**
* 刷新右侧属性面板
*/

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

@ -1,40 +0,0 @@
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());
if (tableDataWrapper != null) {
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

@ -1,40 +0,0 @@
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

@ -1,59 +0,0 @@
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

@ -1,19 +0,0 @@
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

@ -1,37 +0,0 @@
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

@ -1,39 +0,0 @@
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;
}
}

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

@ -1,151 +0,0 @@
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 {
private static final int SECOND_SORT_LENGTH_REDUCTION = 13;
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 -= SECOND_SORT_LENGTH_REDUCTION;
sortItemPaneRightWidth -= SECOND_SORT_LENGTH_REDUCTION;
}
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;
this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
}
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, AbstractSortPane.PANE_COMPONENT_HEIGHT));
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

@ -1,153 +0,0 @@
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();
}
}

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

@ -1,113 +0,0 @@
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();
if (needSortHeaderPane()) {
sortHeaderPane = new SortHeaderPane(sortPaneWidth, sortPaneRightWidth + 5);
this.add(sortHeaderPane);
}
}
protected abstract void initSortGroupPane();
protected boolean needSortHeaderPane() {
return true;
}
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);
if (needSortHeaderPane()) {
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 > 0) {
defaultHeaderArea = ColumnRow.valueOf(column, row - 1).toString();
} else {
defaultHeaderArea = null;
}
}
public void updateBean(TemplateCellElement cellElement) {
List<SortExpression> sortExpressions = sortGroupPane.updateBean();
CellSortAttr cellSortAttr = getCellSortAttr(cellElement);
cellSortAttr.setSortExpressions(sortExpressions);
if (needSortHeaderPane()) {
SortHeader sortHeader = sortHeaderPane.updateBean();
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;
}
}

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

@ -1,276 +0,0 @@
package com.fr.design.sort.common;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
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.design.ui.util.UIUtil;
import com.fr.general.Background;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.common.CellSortable;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.report.elementcase.TemplateElementCase;
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;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
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.addMouseListener(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 extends MouseAdapter {
SortColumnRowPane columnRowPane;
Map<ColumnRow, Style> disableHeaderCellsStyleMap = new HashMap<>();
java.util.List<TemplateCellElement> tempHeaderCells = new ArrayList<>();
SelectActionListener(SortColumnRowPane columnRowPane) {
this.columnRowPane = columnRowPane;
}
@Override
public void mouseClicked(MouseEvent e) {
ElementCasePane elementCasePane = getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) {
return;
}
prepareSelectHeader(elementCasePane);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
completeSelectHeader(elementCasePane);
}
};
elementCasePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
}
private void prepareSelectHeader(ElementCasePane elementCasePane) {
ashDisableHeaderCellsStyle(elementCasePane.getEditingElementCase());
oldSelection = (CellSelection) elementCasePane.getSelection();
elementCasePane.getGrid().setNotShowingTableSelectPane(false);
elementCasePane.setEditable(false);
elementCasePane.repaint(10);
}
private void completeSelectHeader(ElementCasePane elementCasePane) {
Selection selection = elementCasePane.getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
ColumnRow columnRow = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
elementCasePane.setOldSelecton(oldSelection);
oldSelection.getQuickEditor(elementCasePane);
if (!disableHeaderCellsStyleMap.keySet().contains(columnRow)) {
columnRowPane.setColumnRow(columnRow);
}
restoreDisableHeaderCellsStyle(elementCasePane.getEditingElementCase());
}
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
elementCasePane.getGrid().setNotShowingTableSelectPane(true);
elementCasePane.setEditable(true);
elementCasePane.repaint();
}
private void ashDisableHeaderCellsStyle(TemplateElementCase elementCase) {
disableHeaderCellsStyleMap = new HashMap<>();
tempHeaderCells = new ArrayList<>();
Map<ColumnRow, TemplateCellElement> disableHeaderCellsMap = getDisableHeaderCellsMap(elementCase);
for (ColumnRow headerColumnRow : disableHeaderCellsMap.keySet()) {
TemplateCellElement headerCell = disableHeaderCellsMap.get(headerColumnRow);
if (headerCell == null) {
headerCell = new DefaultTemplateCellElement(headerColumnRow.column, headerColumnRow.row);
elementCase.addCellElement(headerCell);
tempHeaderCells.add(headerCell);
}
Style style = headerCell.getStyle();
disableHeaderCellsStyleMap.put(headerColumnRow, style);
style = style.deriveBackground(ColorBackground.getInstance(Color.gray));
headerCell.setStyle(style);
}
}
private void restoreDisableHeaderCellsStyle(TemplateElementCase elementCase) {
try {
for (ColumnRow headerColumnRow : disableHeaderCellsStyleMap.keySet()) {
TemplateCellElement headerTemplateCellElement
= elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row);
headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow));
}
for (TemplateCellElement templateCellElement : tempHeaderCells) {
elementCase.removeCellElement(templateCellElement);
}
disableHeaderCellsStyleMap = new HashMap<>();
tempHeaderCells = new ArrayList<>();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
}
private Map<ColumnRow, TemplateCellElement> getDisableHeaderCellsMap(TemplateElementCase elementCase) {
Map<ColumnRow, TemplateCellElement> headerCellsMap = new HashMap<>();
Iterator iterator = elementCase.cellIterator();
while (iterator.hasNext()) {
TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next();
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr();
if (cellExpandAttr != null) {
handleDisableHeaderCell(elementCase, cellExpandAttr, headerCellsMap);
}
Object value = templateCellElement.getValue();
if (value instanceof DSColumn) {
handleDisableHeaderCell(elementCase, (DSColumn) value, headerCellsMap);
}
}
return headerCellsMap;
}
private void handleDisableHeaderCell(TemplateElementCase elementCase, CellSortable cellSortable, Map<ColumnRow, TemplateCellElement> headerCellsMap) {
if (cellSortable.getCellSortAttr() != null) {
SortHeader sortHeader = cellSortable.getCellSortAttr().getSortHeader();
if (sortHeader != null) {
String headerArea = sortHeader.getHeaderArea();
if (headerArea != null) {
ColumnRow headerColumnRow = ColumnRow.valueOf(headerArea);
ColumnRow columnRow = columnRowPane.updateBean();
if (!headerColumnRow.equals(columnRow)) {
TemplateCellElement headerCell
= elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row);
headerCellsMap.put(headerColumnRow, headerCell);
}
}
}
}
}
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();
}
}

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

@ -1,101 +0,0 @@
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);
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
}
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

@ -1,32 +0,0 @@
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

@ -1,160 +0,0 @@
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");
}
}

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

@ -1,64 +0,0 @@
package com.fr.design.sort.expressionpane;
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, AbstractSortPane.PANE_COMPONENT_HEIGHT));
Icon icon = IconUtils.readIcon("/com/fr/design/images/control/refresh.png");
button = new UIButton(icon);
button.setBackground(Color.RED);
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(20, 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, ","));
}
}

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

@ -1,37 +0,0 @@
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, 2, 0));
customSequencePane = new CustomSequencePane(rightWidth + 5);
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

@ -1,42 +0,0 @@
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, 2, 0));
tinyFormulaPane = new TinyFormulaPane();
tinyFormulaPane.setPreferredSize(new Dimension(width + 5, 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

@ -1,23 +0,0 @@
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

@ -1,125 +0,0 @@
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, boolean showHeaderArea) {
areaJLayeredPane.populateBean(columnRow, showHeaderArea);
}
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, boolean showHeaderArea) {
if (showHeaderArea) {
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

@ -1,81 +0,0 @@
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;
}
}
}

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

@ -1,274 +0,0 @@
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.log.FineLoggerFactory;
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.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
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;
static Map<String, String> originalSvgTextMap = new HashMap<>();
HeaderSortRulePane() {
initComponents();
initState(true);
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);
initUICheckBoxChange(ascUICheckBox, ascIconButton);
initUICheckBoxChange(desUICheckBox, desIconButton);
initUICheckBoxChange(nosortUICheckBox, nosortIconButton);
}
void initUICheckBoxChange(UICheckBox uiCheckBox, IconButton iconButton) {
uiCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
iconButton.setActiveState(uiCheckBox.isSelected());
}
});
}
void initState(boolean selected) {
ascUICheckBox.setSelected(selected);
desUICheckBox.setSelected(selected);
nosortUICheckBox.setSelected(selected);
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;
boolean activeState;
UILabel borderUiLabel;
IconButton(String iconTemplatePath) {
this.iconTemplatePath = iconTemplatePath;
initComponents();
}
public boolean isActiveState() {
return activeState;
}
public void setActiveState(boolean activeState) {
if (activeState) {
borderUiLabel.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
colorButton.setVisible(true);
} else {
borderUiLabel.setBorder(null);
colorButton.setVisible(false);
}
this.activeState = activeState;
}
void initComponents() {
jLayeredPane = new JLayeredPane();
iconLabel = getIconLabel(iconTemplatePath);
borderUiLabel = new UILabel();
borderUiLabel.setSize(16, 16);
borderUiLabel.setOpaque(true);
borderUiLabel.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(borderUiLabel, 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 {
String originalSvgText = getOriginalSvgText(iconPath);
String svgText = originalSvgText.replaceAll("\\{fillColor\\}", shiftColor(color));
InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes(StandardCharsets.UTF_8));
TranscoderInput input = new TranscoderInput(svgInputStream);
bufferedImage = SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input).getImage();
SVGIcon svgIcon = new SVGIcon(bufferedImage);
return svgIcon;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
String getOriginalSvgText(String iconPath) throws Exception {
String originalSvgText = originalSvgTextMap.get(iconPath);
if (originalSvgText == null) {
InputStream inputStream = IOUtils.getResourceAsStream(iconPath, HeaderSortRulePane.class);
originalSvgText = getSvgText(inputStream);
originalSvgTextMap.put(iconPath, originalSvgText);
}
return originalSvgText;
}
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(sortItems == null);
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);
}
}

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

@ -1,61 +0,0 @@
package com.fr.design.sort.header;
import com.fr.design.sort.common.SortColumnRowPane;
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;
boolean showHeaderArea = false;
ColumnRow columnRow = null;
SortHeader.SortItem[] sortItems = null;
String headerArea = defaultHeaderArea;
if (sortHeader != null) {
headerArea = sortHeader.getHeaderArea();
sortItems = sortHeader.getSortItems();
showHeaderArea = SortColumnRowPane.isAvailableColumnRow(ColumnRow.valueOf(headerArea));
}
columnRow = ColumnRow.valueOf(headerArea);
headerAreaPane.populateBean(columnRow, showHeaderArea);
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;
}
}

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

@ -11,7 +11,6 @@ import com.fr.design.dscolumn.DSColumnAdvancedPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane;
import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
@ -32,7 +31,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
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.widget.FRWidgetFactory;
import com.fr.general.IOUtils;
@ -223,6 +221,62 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
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
public String getIconPath() {
@ -243,13 +297,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public void populate() {
this.removeAttributeChangeListener();
dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement);
if (tc != null) {
condition.setEditingComponent(tc);
}
this.addAttributeChangeListener();
}
@Override
@ -266,7 +318,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
@Override
protected JPanel createContentPane() {
initComponents();
double[] columnSize = {F};
double[] rowSize = {P, P, P};
Component[][] components = new Component[][]{
@ -279,43 +331,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
};
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();
}
};
}
}
class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane {
/*pane begin*/
/**
* 排列顺序
*/
private ResultSetSortConfigPane sortPane;
/**
* 结果集筛选
*/
@ -348,13 +373,88 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 补充空白数据数目面板 可隐藏
*/
private JPanel multiPane;
private CellDSColumnSortPane cellDSColumnSortPane;
/*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() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.createScrollPane();
}
@ -369,10 +469,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
@Override
public void update() {
if (cellElement != null) {
sortPane.update(cellElement);
valuePane.update(cellElement);
formatAttrPane.update(cellElement);
filterPane.update(cellElement);
@ -380,14 +480,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
updateExtendConfig();
//更新补充空白设置
updateMultipleConfig();
cellDSColumnSortPane.updateBean(cellElement);
}
}
@Override
public void populate() {
if (cellElement != null) {
this.removeAttributeChangeListener();
disableListener();
sortPane.populate(cellElement);
valuePane.populate(cellElement);
formatAttrPane.populate(cellElement);
filterPane.populate(cellElement);
@ -424,11 +524,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
}
if (cellDSColumnSortPane != null) {
cellDSColumnSortPane.populateBean(cellElement);
}
this.checkButtonEnabled();
this.addAttributeChangeListener();
enableListener();
}
}
@ -437,17 +534,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
@Override
protected AttributeChangeListener getAttributeChangeListener() {
return new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
fireTargetModified();
}
};
}
/**
* 更新单元格扩展属性
*/
@ -492,8 +578,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
@Override
protected JPanel createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序
sortPane = new ResultSetSortConfigPane();
//结果筛选
filterPane = new ResultSetFilterConfigPane();
@ -527,7 +616,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane);
enableListener();
Component[][] components = new Component[][]{
{sortPane},
{filterPane},
{valuePane},
{formatAttrPane},
@ -538,15 +630,32 @@ public class CellDSColumnEditor extends CellQuickEditor {
double[] rowSize = new double[components.length];
Arrays.fill(rowSize, P);
double[] columnSize = {F};
JPanel advancePropertyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
contentPane.add(advancePropertyPane, BorderLayout.NORTH);
UIExpandablePane sortUIExpandablePane =
new UIExpandablePane(Toolkit.i18nText("Fine-Design_Sort_Data_Column_Sort"),
223, 24, cellDSColumnSortPane = new CellDSColumnSortPane());
contentPane.add(sortUIExpandablePane, BorderLayout.CENTER);
return contentPane;
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
}
public void enableListener() {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
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() {
if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true);
@ -557,6 +666,136 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
/**
* 单元格元素>数据集>高级设置>结果排序设置面板
*
* @see com.fr.design.expand.SortExpandAttrPane
* @see DSColumnAdvancedPane.SortPane
*/
public class ResultSetSortConfigPane extends JPanel {
private static final String DEFAULT_VALUE = "=";
private JPanel contentPane;
private UIButtonGroup sortTypePane;
private JFormulaField formulaField;
private CardLayout cardLayout;
private JPanel centerPane;
public ResultSetSortConfigPane() {
this.setLayout(new BorderLayout());
Icon[] iconArray = {
IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
IOUtils.readIcon("/com/fr/design/images/expand/asc.png"),
IOUtils.readIcon("/com/fr/design/images/expand/des.png")
};
String[] nameArray = {Toolkit.i18nText("Fine-Design_Report_Sort_Original"), Toolkit.i18nText("Fine-Design_Report_Sort_Ascending"), Toolkit.i18nText("Fine-Design_Report_Sort_Descending")};
sortTypePane = new UIButtonGroup(iconArray);
sortTypePane.setAllToolTips(nameArray);
sortTypePane.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_ExpandD_Sort_After_Expand"));
cardLayout = new CardLayout();
centerPane = new JPanel(cardLayout);
formulaField = new JFormulaField(DEFAULT_VALUE);
centerPane.add(new JPanel(), "none");
centerPane.add(formulaField, "content");
UILabel sortLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Sort_Sort_Order"));
sortLabel.setPreferredSize(LABEL_DIMENSION);
sortTypePane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean noContent = sortTypePane.getSelectedIndex() == 0;
cardLayout.show(centerPane, noContent ? "none" : "content");
if (noContent) {
centerPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
} else {
centerPane.setPreferredSize(new Dimension(165, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
}
}
});
Component[][] components = new Component[][]{
new Component[]{sortLabel, sortTypePane},
new Component[]{null, centerPane}
};
double[] rowSize = {P, P}, columnSize = {P, F};
contentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.add(contentPane, BorderLayout.CENTER);
}
/**
* 刷新面板信息
*
* @param cellElement 单元格
*/
public void populate(TemplateCellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value instanceof DSColumn) {
this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder();
this.sortTypePane.setSelectedIndex(sort);
boolean noContent = sortTypePane.getSelectedIndex() == 0;
cardLayout.show(centerPane, noContent ? "none" : "content");
if (noContent) {
centerPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
} else {
centerPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
}
String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) {
this.formulaField.populate(sortFormula);
} else {
this.formulaField.populate(DEFAULT_VALUE);
}
}
}
}
/**
* 保存面板配置信息
*
* @param cellElement 单元格
*/
public void update(CellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText());
}
}
}
/**
* 添加事件监听器
*
* @param formulaChangeListener 公式输入框改动事件监听器
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void addListener(UIObserverListener formulaChangeListener, ChangeListener changeListener) {
formulaField.addListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener);
}
/**
* 去除事件监听器
*
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void removeListener(ChangeListener changeListener) {
formulaField.removeListener();
sortTypePane.removeChangeListener(changeListener);
}
}
/**
* 单元格元素>数据集>高级设置>结果集筛选设置面板
*

Loading…
Cancel
Save