From ba343eb2b487f9c3c278fffd5c8efb35b0f4cb00 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 31 Mar 2020 11:52:46 +0800 Subject: [PATCH 01/88] =?UTF-8?q?REPORT-29003=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/env/DesignerWorkspaceGenerator.java | 4 ++-- .../src/main/java/com/fr/start/DesignerSuperListener.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java index ccbd5170cc..288f6baa30 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java @@ -23,6 +23,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; /** * 根据配置生成运行环境 @@ -55,7 +56,7 @@ public class DesignerWorkspaceGenerator { WorkspaceClient client = null; try { client = future.get(WAIT_FREQ, TimeUnit.SECONDS); - } catch (Exception e) { + } catch (TimeoutException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); RemoteHandler.handle(config); } @@ -92,7 +93,6 @@ public class DesignerWorkspaceGenerator { } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - } else { } } } diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java index ebf135d26d..f6fa3c9376 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -81,6 +81,9 @@ public class DesignerSuperListener { if (ComparatorUtils.equals(ReportState.ACTIVE.getValue(), msg)) { startFrameListener(); } + if (ComparatorUtils.equals(DesignerProcessType.INSTANCE.obtain(), msg)) { + frameReport(); + } } } }); @@ -90,6 +93,7 @@ public class DesignerSuperListener { onceFuture = service.schedule(new Runnable() { @Override public void run() { + cancel = true; ProcessEventPipe pipe = process.getPipe(); pipe.fire(FineProcessEngineEvent.READY); if (StringUtils.isNotEmpty(pipe.info())) { From 6b3a7dc6ff8d59481246333d2eb49a48f08eaf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 31 Mar 2020 17:30:33 +0800 Subject: [PATCH 02/88] =?UTF-8?q?CHART-11709=09=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=85=8D=E8=89=B2=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/style/AbstractPopBox.java | 33 ++- .../background/gradient/FixedGradientBar.java | 4 +- .../background/gradient/GradientBar.java | 111 ++++---- .../design/style/color/ColorSelectDialog.java | 7 +- .../design/style/color/ColorSelectPane.java | 15 +- .../chartx/component/button/ColorButton.java | 174 +++++++++++++ .../combobox/ColorSchemeComboBox.java | 205 +++++++++++++++ .../chart/gui/style/ChartColorAdjustPane.java | 238 ++++++++++++++++++ .../design/module/ChartPreFillStylePane.java | 19 +- .../chart/area/VanChartAreaSeriesPane.java | 7 +- .../bubble/VanChartBubbleSeriesPane.java | 3 +- .../column/VanChartColumnSeriesPane.java | 1 - .../style/VanChartCustomSeriesPane.java | 5 +- .../component/VanChartBeautyPane.java | 16 +- .../component/VanChartFillStylePane.java | 194 +++++++++++++- .../VanChartAbstractPlotSeriesPane.java | 27 +- .../style/VanChartFunnelSeriesPane.java | 1 - .../style/series/VanChartGanttSeriesPane.java | 6 + .../chart/gauge/VanChartGaugeSeriesPane.java | 9 +- .../style/VanChartHeatMapSeriesPane.java | 5 +- .../chart/line/VanChartLineSeriesPane.java | 6 + .../van/chart/map/VanChartMapSeriesPane.java | 51 +++- .../style/VanChartMultiPieSeriesPane.java | 7 +- .../van/chart/pie/VanChartPieSeriesPane.java | 1 - .../chart/radar/VanChartRadarSeriesPane.java | 5 +- .../scatter/VanChartScatterSeriesPane.java | 1 - .../style/VanChartStructureSeriesPane.java | 7 +- .../style/VanChartWordCloudSeriesPane.java | 7 +- 28 files changed, 1026 insertions(+), 139 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java index 83768079ce..4df9b75144 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java @@ -5,15 +5,22 @@ import com.fr.design.style.background.BackgroundJComponent; import com.fr.design.style.background.gradient.GradientBackgroundPane; import com.fr.general.Background; -import javax.swing.*; +import javax.swing.JPanel; +import javax.swing.JWindow; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.awt.AWTEvent; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.Window; import java.awt.event.AWTEventListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; /** * @author kunsnat E-mail:kunsnat@gmail.com @@ -50,7 +57,7 @@ public abstract class AbstractPopBox extends JPanel { } }; - private void showPopupMenu() { + protected void showPopupMenu() { if (selectPopupWindow != null && selectPopupWindow.isVisible()) { hidePopupMenu(); return; @@ -98,12 +105,16 @@ public abstract class AbstractPopBox extends JPanel { private void mouseClick(MouseEvent evt) { Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY()); Dimension popBoxD = AbstractPopBox.this.getSize(); - Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); - Dimension popMenuD = this.getControlWindow().getSize(); - Point popMenuP = this.getControlWindow().getLocation(); - Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); - Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); - if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { + try { + Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); + Dimension popMenuD = this.getControlWindow().getSize(); + Point popMenuP = this.getControlWindow().getLocation(); + Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); + Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); + if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { + this.hidePopupMenu(); + } + } catch (Exception ignore){ this.hidePopupMenu(); } } diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java index 33df00bc59..8c502114bf 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java @@ -1,6 +1,6 @@ package com.fr.design.style.background.gradient; -import com.fr.design.style.background.gradient.GradientBar; +import java.awt.Color; /** * 这个bar不能拖拽滑动 @@ -8,6 +8,8 @@ import com.fr.design.style.background.gradient.GradientBar; public class FixedGradientBar extends GradientBar { private static final long serialVersionUID = 2787525421995954889L; + public static final Color NEW_CHARACTER = new Color(99, 178, 238); + public FixedGradientBar(int minvalue, int maxvalue) { super(minvalue, maxvalue); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index b197a3d396..dcb381e819 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -1,40 +1,38 @@ package com.fr.design.style.background.gradient; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.LinearGradientPaint; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.swing.JComponent; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - import com.fr.design.DesignerEnvManager; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.color.ColorCell; -import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; import com.fr.stable.AssistUtils; +import javax.swing.JComponent; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.LinearGradientPaint; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.geom.Point2D; + /** * TODO:面板缩放的功能没有考虑(就是尾值过大,导致超过界面显示的情况),原来的那个实现完全是个BUG。要缩放的情况也比较少,就干脆以后弄吧 */ -public class GradientBar extends JComponent implements UIObserver,ColorSelectable{ +public class GradientBar extends JComponent implements UIObserver, ColorSelectable { /** * @@ -54,12 +52,12 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl private UINumberField endLabel; private ChangeListener changeListener = null; - private UIObserverListener uiObserverListener; - + private List uiObserverListener; + private static final int MOUSE_OFFSET = 4; - + private static final int MAX_VERTICAL = 45; - + // 选中的颜色 private Color color; @@ -89,6 +87,11 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl iniListener(); } + public void updateColor(Color begin, Color end) { + p1.setColorInner(begin); + p2.setColorInner(end); + } + protected void addMouseClickListener() { this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { @@ -142,14 +145,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } private void iniListener() { + uiObserverListener = new ArrayList<>(); if (shouldResponseChangeListener()) { this.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if (uiObserverListener == null) { - return; + for (UIObserverListener observerListener : uiObserverListener) { + observerListener.doChange(); } - uiObserverListener.doChange(); } }); } @@ -199,14 +202,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl * 状态改变 */ public void stateChanged() { - if (changeListener != null) { + if (changeListener != null) { changeListener.stateChanged(null); } } /** * 增加监听 - * + * * @param changeListener 监听 */ public void addChangeListener(ChangeListener changeListener) { @@ -215,14 +218,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl /** * 如果左右两个按钮还在初始位置,就为true - * @return 同上 + * + * @return 同上 */ public boolean isOriginalPlace() { return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max); } /** - * * @return */ public double getStartValue() { @@ -230,7 +233,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } /** - * * @return */ public double getEndValue() { @@ -238,7 +240,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } /** - * * @param startValue */ public void setStartValue(double startValue) { @@ -246,7 +247,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } /** - * * @param endValue */ public void setEndValue(double endValue) { @@ -254,7 +254,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } /** - * * @return */ public SelectColorPointBtn getSelectColorPointBtnP1() { @@ -262,7 +261,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } /** - * * @return */ public SelectColorPointBtn getSelectColorPointBtnP2() { @@ -276,7 +274,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl * */ public void registerChangeListener(UIObserverListener listener) { - uiObserverListener = listener; + uiObserverListener.add(listener); } @Override @@ -288,22 +286,23 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl return true; } - @Override - public void setColor(Color color) { - this.color = color; - } - - @Override - public Color getColor() { - return this.color; - } - - /** - * 选中颜色 - * @param ColorCell 颜色单元格 - */ - @Override - public void colorSetted(ColorCell colorCell) { - - } + @Override + public void setColor(Color color) { + this.color = color; + } + + @Override + public Color getColor() { + return this.color; + } + + /** + * 选中颜色 + * + * @param ColorCell 颜色单元格 + */ + @Override + public void colorSetted(ColorCell colorCell) { + + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java index b717ea67e7..33eb6dbf15 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.JPanel; +import java.io.Serializable; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dialog; @@ -13,7 +14,6 @@ import java.awt.FlowLayout; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.Serializable; /** @@ -136,8 +136,13 @@ public class ColorSelectDialog extends MiddleChartDialog{ * void */ public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){ + showDialog(owner,pane,initialColor,selectePane,false); + } + + public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane, boolean alwaysOnTop){ ColorTracker okListener = new ColorTracker(pane); ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane); + dialog.setAlwaysOnTop(alwaysOnTop); dialog.setModal(true); dialog.show(); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java index bb902fa930..c82eac0c0d 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java @@ -11,16 +11,21 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.util.ArrayList; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; /** * The pane used to select color @@ -196,6 +201,6 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable @Override public void customButtonPressed() { pane = new ColorSelectDetailPane(Color.WHITE); - ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); + ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this, true); } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java b/designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java new file mode 100644 index 0000000000..dd908505db --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java @@ -0,0 +1,174 @@ +package com.fr.design.chartx.component.button; + +import com.fr.base.BaseUtils; +import com.fr.base.background.ColorBackground; +import com.fr.design.style.AbstractSelectBox; +import com.fr.design.style.color.ColorSelectPane; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-03-06 + */ +public class ColorButton extends AbstractSelectBox { + + private static final double DEL_WIDTH = 7; + + public static final int WIDTH = 18; + + private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png"); + + private Color color; + + private boolean isMoveOn = false; + + private ColorSelectPane colorPane; + + private boolean lastButton; + + private ChangeListener changeListener; + + public ColorButton(Color color) { + this.color = color; + addMouseListener(getMouseListener()); + } + + public Dimension getPreferredSize() { + return new Dimension(WIDTH, WIDTH); + } + + private void paintDeleteButton(Graphics g2d) { + Rectangle2D bounds = this.getBounds(); + + int x = (int) (bounds.getWidth() - DEL_WIDTH); + int y = 1; + + g2d.drawImage(closeIcon, x, y, closeIcon.getWidth(), closeIcon.getHeight(), null); + } + + public void setLastButton(boolean lastButton) { + this.lastButton = lastButton; + } + + @Override + public void paint(Graphics g) { + this.setSize(WIDTH, WIDTH); + Graphics2D g2d = (Graphics2D) g; + g2d.setPaint(color); + Rectangle2D rec = new Rectangle2D.Double(0, 0, WIDTH + 1, WIDTH + 1); + g2d.fill(rec); + + if (isMoveOn && !lastButton) { + paintDeleteButton(g); + } + } + + protected void deleteButton() { + + } + + + private void checkMoveOn(boolean moveOn) { + this.isMoveOn = moveOn; + repaint(); + } + + protected MouseListener getMouseListener() { + return new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + mouseClick(e); + } + + public void mouseEntered(MouseEvent e) { + checkMoveOn(true); + } + + public void mouseExited(MouseEvent e) { + checkMoveOn(false); + } + }; + } + + + public void mouseClick(MouseEvent e) { + if (!lastButton) { + Rectangle2D bounds = this.getBounds(); + if (bounds == null) { + return; + } + if (e.getX() >= bounds.getWidth() - DEL_WIDTH && e.getY() <= DEL_WIDTH) { + deleteButton(); + hidePopupMenu(); + return; + } + } + //打开颜色选择面板 + showPopupMenu(); + } + + public JPanel initWindowPane(double preferredWidth) { + // 下拉的时候重新生成面板,刷新最近使用颜色 + colorPane = new ColorSelectPane(false) { + @Override + public void setVisible(boolean b) { + super.setVisible(b); + } + }; + colorPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + hidePopupMenu(); + color = ((ColorSelectPane) e.getSource()).getColor(); + fireDisplayComponent(ColorBackground.getInstance(color)); + ColorButton.this.stateChanged(); + } + }); + return colorPane; + } + + public void stateChanged() { + if (changeListener != null) { + changeListener.stateChanged(null); + } + } + + public void addChangeListener(ChangeListener changeListener) { + this.changeListener = changeListener; + } + + + /** + * 获取当前选中的颜色 + * + * @return 当前选中的颜色 + */ + public Color getSelectObject() { + return this.color; + } + + /** + * 设置选中的颜色 + * + * @param color 颜色 + */ + public void setSelectObject(Color color) { + this.color = color; + colorPane.setColor(color); + + fireDisplayComponent(ColorBackground.getInstance(color)); + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java new file mode 100644 index 0000000000..8f8d69a222 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -0,0 +1,205 @@ +package com.fr.design.chartx.component.combobox; + +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.i18n.Toolkit; +import com.fr.general.GeneralUtils; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JLabel; +import javax.swing.JList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.LinearGradientPaint; +import java.awt.geom.Rectangle2D; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-03-05 + * 一个带颜色展示的配色选择下拉框 + */ +public class ColorSchemeComboBox extends UIComboBox { + + private Map colorSchemes; + + public ColorSchemeComboBox() { + this(null); + } + + public ColorSchemeComboBox(Map colorSchemes) { + //通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。 + if (colorSchemes == null) { + colorSchemes = getColorSchemesFromConfig(); + } + this.colorSchemes = colorSchemes; + + this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray())); + + this.setRenderer(new ColorSchemeCellRenderer()); + } + + private Map getColorSchemesFromConfig() { + Map colorSchemes = new LinkedHashMap<>(); + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); + + //所有的样式名称 + Iterator names = config.names(); + + //添加默认的方案和第一个方案 + String defaultName = config.getCurrentStyle(); + ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); + Object firstName = names.next(); + ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); + if (defaultStyle == null) { + defaultStyle = firstStyle; + } + colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle)); + colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle)); + + //添加其他的配色方案 + while (names.hasNext()) { + Object key = names.next(); + ChartColorMatching colorMatching = (ChartColorMatching) config.getPreStyle(key); + colorSchemes.put(colorMatching.getId(), colorMatchingToColorInfo(colorMatching)); + } + + //添加自定义组合色和自定义渐变色 + colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Combination_Color"), null); + colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Gradient"), null); + + return colorSchemes; + } + + public ColorInfo getSelectColorInfo() { + String selectedItem = (String) getSelectedItem(); + return colorSchemes.get(selectedItem); + } + + private ColorInfo colorMatchingToColorInfo(ChartColorMatching colorMatching) { + ColorInfo colorInfo = new ColorInfo(); + colorInfo.setGradient(colorMatching.getGradient()); + colorInfo.setColors(colorMatching.getColorList()); + return colorInfo; + } + + + public class ColorInfo { + + private List colors; + + private boolean gradient; + + public List getColors() { + return colors; + } + + public void setColors(List colors) { + this.colors = colors; + } + + public boolean isGradient() { + return gradient; + } + + public void setGradient(boolean gradient) { + this.gradient = gradient; + } + } + + /** + * CellRenderer. + */ + class ColorSchemeCellRenderer extends UIComboBoxRenderer { + + private String schemeName = Toolkit.i18nText("Fine-Design_Report_Default"); + + //左边距 + private static final double X = 4d; + + //上边距 + private static final double Y = 4d; + + private static final String BLANK_SPACE = " "; + + private static final int HEIGHT = 20; + + @Override + public Dimension getPreferredSize() { + Dimension preferredSize = super.getPreferredSize(); + preferredSize.setSize(super.getPreferredSize().getWidth(), HEIGHT); + return preferredSize; + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public Component getListCellRendererComponent( + JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + this.schemeName = GeneralUtils.objectToString(value); + ColorInfo colorInfo = colorSchemes.get(schemeName); + if (colorInfo == null) { + comp.setText(BLANK_SPACE + schemeName); + } else { + FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); + double width = (HEIGHT - 2 * Y) * 5; + String fill = BLANK_SPACE; + while (fontMetrics.stringWidth(fill) < width + 3 * X) { + fill += BLANK_SPACE; + } + comp.setText(fill + schemeName); + } + comp.setToolTipText(schemeName); + return comp; + } + + public void paint(Graphics g) { + super.paint(g); + + Graphics2D g2d = (Graphics2D) g; + + ColorInfo colorInfo = colorSchemes.get(schemeName); + if (colorInfo != null) { + if (colorInfo.isGradient()) { + drawGradient(g2d, colorInfo.getColors()); + } else { + drawCombineColor(g2d, colorInfo.getColors()); + } + } + } + + private void drawGradient(Graphics2D g2d, List colors) { + //上下留4px,宽度等于5倍高 + double height = HEIGHT - 2 * Y; + double width = height * 5; + LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()])); + g2d.setPaint(linearGradientPaint); + Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height); + g2d.fill(rec); + } + + private void drawCombineColor(Graphics2D g2d, List colors) { + int size = colors.size() > 5 ? 5 : colors.size(); + double height = HEIGHT - 2 * Y; + double width = height * 5 / size; + for (int i = 0; i < size; i++) { + g2d.setPaint(colors.get(i)); + Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height); + g2d.fill(rec); + } + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java new file mode 100644 index 0000000000..5578f49c63 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java @@ -0,0 +1,238 @@ +package com.fr.design.mainframe.chart.gui.style; + +import com.fr.base.BaseUtils; +import com.fr.base.background.ColorBackground; +import com.fr.design.chartx.component.button.ColorButton; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.style.AbstractSelectBox; +import com.fr.design.style.color.ColorSelectPane; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.util.ArrayList; +import java.util.List; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +/** + * 配色方案选择组合色之后,可以调整颜色的组件 + * + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-03-25 + */ +public class ChartColorAdjustPane extends JPanel implements UIObserver { + + public static final Color[] defaultColors = { + new Color(99, 178, 238), + new Color(118, 218, 145), + new Color(248, 203, 127), + new Color(248, 149, 136), + new Color(124, 214, 207), + new Color(145, 146, 171), + new Color(120, 152, 225), + new Color(239, 166, 102), + new Color(237, 221, 134), + new Color(153, 135, 206), + }; + + private static final int COUNT_OF_ROW = 8; + + private static final int MAX_BUTTON = 40; + + private List colorButtons = new ArrayList<>(); + + private List uiObserverListener; + + private ChangeListener changeListener; + + + + + public ChartColorAdjustPane() { + this(defaultColors); + } + + public ChartColorAdjustPane(Color[] colors) { + iniListener(); + createColorButton(colors); + createContentPane(); + } + + public void updateColor() { + updateColor(defaultColors); + } + + public void updateColor(Color[] colors) { + createColorButton(colors); + relayout(); + } + + public Color[] getColors() { + int size = colorButtons.size(); + Color[] colors = new Color[size]; + for (int i = 0; i < size; i++) { + colors[i] = colorButtons.get(i).getSelectObject(); + } + return colors; + } + + private void relayout() { + this.removeAll(); + createContentPane(); + this.validate(); + this.repaint(); + } + + private void createContentPane() { + VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0); + layout.setAlignLeft(true); + this.setLayout(layout); + + for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) { + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + int count = i + COUNT_OF_ROW > colorButtons.size() ? colorButtons.size() : i + COUNT_OF_ROW; + for (int j = i; j < count; j++) { + colorButtons.get(j).setLastButton(false); + panel.add(colorButtons.get(j)); + } + if (i + COUNT_OF_ROW > colorButtons.size()) { + panel.add(new AddColorButton()); + this.add(panel); + } else if (i + COUNT_OF_ROW == colorButtons.size() && colorButtons.size() != MAX_BUTTON) { + this.add(panel); + this.add(new AddColorButton()); + } else { + this.add(panel); + } + } + if (colorButtons.size() == 1) { + colorButtons.get(0).setLastButton(true); + } + } + + private void createColorButton(Color[] colors) { + colorButtons.clear(); + for (Color color : colors) { + colorButtons.add(createColorButton(color)); + } + } + + private ColorButton createColorButton(Color color) { + ColorButton colorButton = new ColorButton(color) { + @Override + protected void deleteButton() { + colorButtons.remove(this); + stateChanged(); + relayout(); + } + }; + + colorButton.addChangeListener(changeListener); + return colorButton; + } + + private void iniListener() { + uiObserverListener = new ArrayList<>(); + if (shouldResponseChangeListener()) { + this.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + for (UIObserverListener observerListener : uiObserverListener) { + observerListener.doChange(); + } + } + }); + } + } + + public void stateChanged() { + if (changeListener != null) { + changeListener.stateChanged(null); + } + } + + public void addChangeListener(ChangeListener changeListener) { + this.changeListener = changeListener; + } + + public void registerChangeListener(UIObserverListener listener) { + uiObserverListener.add(listener); + } + + public boolean shouldResponseChangeListener() { + return true; + } + + + private class AddColorButton extends AbstractSelectBox { + + BufferedImage image = BaseUtils.readImageWithCache("/com/fr/design/images/buttonicon/add.png"); + + public AddColorButton() { + addMouseListener(getMouseListener()); + } + + @Override + public void paint(Graphics g) { + this.setSize(ColorButton.WIDTH, ColorButton.WIDTH); + Graphics2D g2d = (Graphics2D) g; + g2d.setPaint(Color.WHITE); + Rectangle2D rec = new Rectangle2D.Double(0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1); + g2d.fill(rec); + g2d.drawImage(image, 0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1, null); + } + + public Dimension getPreferredSize() { + return new Dimension(ColorButton.WIDTH, ColorButton.WIDTH); + } + + protected MouseListener getMouseListener() { + return new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + showPopupMenu(); + } + }; + } + + public JPanel initWindowPane(double preferredWidth) { + // 下拉的时候重新生成面板,刷新最近使用颜色 + ColorSelectPane colorPane = new ColorSelectPane(false) { + public void setVisible(boolean b) { + super.setVisible(b); + } + }; + colorPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + hidePopupMenu(); + Color color = ((ColorSelectPane) e.getSource()).getColor(); + fireDisplayComponent(ColorBackground.getInstance(color)); + colorButtons.add(createColorButton(color)); + ChartColorAdjustPane.this.stateChanged(); + relayout(); + } + }); + return colorPane; + } + + public Color getSelectObject() { + return null; + } + + public void setSelectObject(Color color) { + + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java index 66a103e657..de85cfcdba 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java @@ -7,11 +7,12 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.chart.gui.style.ChartAccColorPane; +import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; import com.fr.design.style.background.gradient.FixedGradientBar; - import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -20,8 +21,6 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; /** @@ -37,7 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { private UIButton accButton; private UIButton gradientButton; - private ChartAccColorPane colorAcc; + private ChartColorAdjustPane colorAdjustPane; private FixedGradientBar colorGradient; public ChartPreFillStylePane() { @@ -53,13 +52,13 @@ public class ChartPreFillStylePane extends BasicBeanPane { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); - buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Acc_Set"))); + buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color"))); buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color"))); customPane.add(buttonPane, BorderLayout.NORTH); changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); - changeColorSetPane.add(colorAcc = new ChartAccColorPane(), "acc"); + changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); cardLayout.show(changeColorSetPane, "acc"); customPane.add(changeColorSetPane, BorderLayout.CENTER); @@ -68,7 +67,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { customPane.setPreferredSize(new Dimension(200, 200)); colorGradient.setPreferredSize(new Dimension(120, 30)); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); - colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); + colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER); double p = TableLayout.PREFERRED; double[] columnSize = {p, p}; @@ -131,7 +130,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { cardLayout.show(changeColorSetPane, "acc"); if (colorList.size() > 0) { - colorAcc.populateBean(colorList.toArray(new Color[colorList.size()])); + colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()])); } } } @@ -152,7 +151,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { } else { chartColorMatching.setGradient(false); - Color[] colors = colorAcc.updateBean(); + Color[] colors = colorAdjustPane.getColors(); for(Color color : colors) { colorList.add(color); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java index 45beccc7ef..d3b511b1f2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java @@ -6,6 +6,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.line.VanChartLineSeriesPane; import javax.swing.JPanel; @@ -27,7 +28,6 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createAreaFillColorPane()}, @@ -44,4 +44,9 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { protected Class getStackAndAxisPaneClass() { return VanChartCustomStackAndAxisConditionPane.class; } + + //风格 + protected VanChartBeautyPane createStylePane() { + return new VanChartBeautyPane(); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java index 44077c0ba7..0bb6ede075 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java @@ -37,14 +37,13 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createBubblePane()}, new Component[]{createStackedAndAxisPane()}, new Component[]{null} }; if (!((VanChartBubblePlot) plot).isForceBubble()) { - components[3] = new Component[]{createLargeDataModelPane()}; + components[2] = new Component[]{createLargeDataModelPane()}; } contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index 12c42408f1..fd870048cb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -53,7 +53,6 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { double[] columnSize = {f}; double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})}, new Component[]{createBorderPane()}, new Component[]{createStackedAndAxisPane()}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java index 425258a5bf..2cd3d74e1f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java @@ -4,7 +4,6 @@ import com.fr.chart.chartattr.Chart; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot; @@ -24,7 +23,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane { private JPanel seriesPane; protected VanChartCustomPlotSeriesTabPane plotSeriesPane; - private ChartFillStylePane fillStylePane;//配色 + private VanChartFillStylePane fillStylePane;//配色 private VanChartBeautyPane stylePane;//风格 @@ -81,7 +80,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane { }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); + panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5)); return panel; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java index f6642bd710..db41e8a480 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java @@ -29,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), styleBox}, } ; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -37,17 +37,17 @@ public class VanChartBeautyPane extends BasicBeanPane { } protected String[] getNameArray(){ - return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), - Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") + return new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), + Toolkit.i18nText("Fine-Design_Chart_Off") }; } @Override public void populateBean(Integer ob) { int finalIndex; switch (ob){ - case ChartConstants.STYLE_NONE: finalIndex = 0; break; - case ChartConstants.STYLE_SHADE: finalIndex = 1; break; - default: finalIndex = 0; + case ChartConstants.STYLE_NONE: finalIndex = 1; break; + case ChartConstants.STYLE_SHADE: finalIndex = 0; break; + default: finalIndex = 1; } styleBox.setSelectedIndex(finalIndex); } @@ -57,8 +57,8 @@ public class VanChartBeautyPane extends BasicBeanPane { int index = styleBox.getSelectedIndex(); int style; switch (index){ - case 0: style = ChartConstants.STYLE_NONE; break; - case 1: style = ChartConstants.STYLE_SHADE; break; + case 0: style = ChartConstants.STYLE_SHADE; break; + case 1: style = ChartConstants.STYLE_NONE; break; default: style = ChartConstants.STYLE_NONE; } return style; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index e395f26e94..ae8d1135e1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -1,42 +1,212 @@ package com.fr.van.chart.designer.component; +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; +import com.fr.base.Utils; +import com.fr.chart.base.AttrFillStyle; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.ChartUtils; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.component.combobox.ColorSchemeComboBox; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; - +import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; +import com.fr.design.style.background.gradient.FixedGradientBar; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * Created by mengao on 2017/8/17. */ -public class VanChartFillStylePane extends ChartFillStylePane { +public class VanChartFillStylePane extends BasicBeanPane { + + + protected ColorSchemeComboBox styleSelectBox; + protected JPanel customPane; + protected JPanel changeColorSetPane; + protected FixedGradientBar colorGradient; + + protected CardLayout cardLayout; + + protected ChartColorAdjustPane colorAdjustPane; + + private Color[] gradientColors; + private Color[] accColors; + + private boolean gradientSelect = false; + + public VanChartFillStylePane() { + this.setLayout(new BorderLayout()); + + styleSelectBox = new ColorSchemeComboBox(); + customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + + changeColorSetPane = new JPanel(cardLayout = new CardLayout()); + changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); + gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER}; + changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); + accColors = ChartColorAdjustPane.defaultColors; + cardLayout.show(changeColorSetPane, "acc"); + customPane.add(changeColorSetPane, BorderLayout.CENTER); + initListener(); + initLayout(); + } + + private void initListener() { + colorAdjustPane.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + accColors = colorAdjustPane.getColors(); + if (styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 2) { + styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 2); + } + VanChartFillStylePane.this.revalidate(); + } + }); + colorGradient.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner(); + gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner(); + if (styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { + styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 1); + } + } + }); + styleSelectBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); + if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 2) { + colorAdjustPane.updateColor(accColors); + cardLayout.show(changeColorSetPane, "acc"); + gradientSelect = false; + } else if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 1) { + colorGradient.updateColor(gradientColors[0], gradientColors[1]); + changeColorSetPane.add(colorGradient, "gradient"); + cardLayout.show(changeColorSetPane, "gradient"); + gradientSelect = true; + } else if (selectColorInfo.isGradient()) { + colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1)); + changeColorSetPane.add(colorGradient, "gradient"); + cardLayout.show(changeColorSetPane, "gradient"); + gradientSelect = true; + } else { + colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{})); + cardLayout.show(changeColorSetPane, "acc"); + gradientSelect = false; + } + VanChartFillStylePane.this.revalidate(); + } + }); + } + + protected void initLayout() { + this.setLayout(new BorderLayout()); + this.add(getContentPane(), BorderLayout.CENTER); + } @Override - protected JPanel getContentPane () { + public Dimension getPreferredSize() { + if (gradientSelect) { + return new Dimension(225, 80); + } + return super.getPreferredSize(); + } + + protected JPanel getContentPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match")),styleSelectBox}, - new Component[]{null,customPane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox}, + new Component[]{null, customPane}, }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); - panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,0)); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); return panel; } + @Override - public Dimension getPreferredSize() { - if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { - return new Dimension(styleSelectBox.getPreferredSize().width, 30); + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"); + } + + @Override + public void populateBean(AttrFillStyle condition) { + String fillStyleName = condition == null ? "" : condition.getFillStyleName(); + if (StringUtils.isBlank(fillStyleName)) {//兼容处理 + if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { + styleSelectBox.setSelectedIndex(0);//默认 + } else { + int colorStyle = condition.getColorStyle(); + if (colorStyle == ChartConstants.COLOR_GRADIENT) { + gradientColors[0] = condition.getColorIndex(0); + gradientColors[1] = condition.getColorIndex(1); + styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 1); + } else { + int colorSize = condition.getColorSize(); + accColors = new Color[colorSize]; + for (int i = 0; i < colorSize; i++) { + accColors[i] = condition.getColorIndex(i); + } + styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 2); + } + } + } else { + styleSelectBox.setSelectedItem(fillStyleName); } - return super.getPreferredSize(); + } + + @Override + public AttrFillStyle updateBean() { + AttrFillStyle condition = new AttrFillStyle(); + condition.clearColors(); + + //自定义组合色 + if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 2) { + condition.setColorStyle(ChartConstants.COLOR_ACC); + for (int i = 0, length = accColors.length; i < length; i++) { + condition.addFillColor(accColors[i]); + } + //自定义渐变色 + } else if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 1) { + condition.setColorStyle(ChartConstants.COLOR_GRADIENT); + Color start = gradientColors[0]; + Color end = gradientColors[1]; + condition.addFillColor(start); + condition.addFillColor(end); + } else if (styleSelectBox.getSelectedIndex() == 0) { + condition.setColorStyle(ChartConstants.COLOR_DEFAULT); + } else { + ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); + Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem()); + if (preStyle instanceof ChartColorMatching) { + AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); + def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); + return def; + } else { + condition.setColorStyle(ChartConstants.COLOR_DEFAULT); + } + condition.setCustomFillStyle(true); + } + + return condition; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 9b912ee9f7..2bcdda7895 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -10,8 +10,8 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -23,7 +23,6 @@ import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.van.chart.custom.style.VanChartCustomStylePane; -import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartBeautyPane; @@ -62,6 +61,8 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP private VanChartBorderPane borderPane;//边框 + protected VanChartFillStylePane vanChartFillStylePane;//配色 + private UINumberDragPane transparent;//不透明度 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 @@ -86,18 +87,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } JPanel panel = new JPanel(new BorderLayout()); - if (fillStylePane != null) { - panel.add(fillStylePane, BorderLayout.NORTH); + JPanel colorPane = getColorPane(); + if(colorPane != null) { + panel.add(colorPane, BorderLayout.NORTH); } panel.add(getContentInPlotType(), BorderLayout.CENTER); return panel; } - @Override /** * 返回 填充界面. */ - protected ChartFillStylePane getFillStylePane() { + protected VanChartFillStylePane getVanChartFillStylePane() { //如果是自定義組合圖,則不創建填充界面 return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane(); } @@ -111,9 +112,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP protected JPanel getColorPane() { JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); + vanChartFillStylePane = getVanChartFillStylePane(); + if (vanChartFillStylePane != null) { + panel.add(vanChartFillStylePane, BorderLayout.NORTH); + } setColorPaneContent(panel); JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); return panel.getComponentCount() == 0 ? null : colorPane; } @@ -266,7 +271,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkoutMapType(plot); - super.populateBean(plot);//配色 + if(vanChartFillStylePane != null) { //配色 + vanChartFillStylePane.populateBean(plot.getPlotFillStyle()); + } if (stylePane != null) {//风格 stylePane.populateBean(plot.getPlotStyle()); @@ -323,7 +330,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //更新之前先更新界面的map类型属性 checkoutMapType(plot); - super.updateBean(plot);//配色 + if(vanChartFillStylePane != null) {//配色 + plot.setPlotFillStyle(vanChartFillStylePane.updateBean()); + } if (stylePane != null) {//风格 plot.setPlotStyle(stylePane.updateBean()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index 8a02cd5f44..9df55249ad 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -31,7 +31,6 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { double[] columnSize = {f}; double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createFunnelStylePane()}, new Component[]{createBorderPane()}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java index 8b96c36940..c17d97692c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java @@ -13,6 +13,7 @@ import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.gantt.VanChartGanttPlot; import com.fr.stable.CoreConstants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; @@ -121,4 +122,9 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { } } + + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index c4ce90edc7..858fb0ae72 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -13,8 +14,6 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; -import com.fr.design.i18n.Toolkit; - import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabelDetail; @@ -22,6 +21,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -306,4 +306,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { colorPickerPane.updateBean(detailStyle.getHotAreaColor()); } } + + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index f4c7bd4769..7c4fa4ad4a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -9,10 +9,9 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; - import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartFillStylePane; import com.fr.van.chart.map.VanChartMapSeriesPane; import javax.swing.JPanel; @@ -41,7 +40,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { /** * 返回 填充界面. */ - protected ChartFillStylePane getFillStylePane() { + protected VanChartFillStylePane getVanChartFillStylePane() { return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java index aea7ace9e5..8300cac6ba 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -38,4 +39,9 @@ public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane { return contentPane; } + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } + } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index fd00a87c87..b24e8fc33d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -6,6 +6,7 @@ import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -36,6 +37,7 @@ import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.line.VanChartCurvePane; import com.fr.van.chart.map.line.VanChartLineMapEffectPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -157,6 +159,35 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } } + @Override + protected JPanel getContentPane(boolean custom) { + JPanel panel = new JPanel(new BorderLayout()); + mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); + if(mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { + vanChartFillStylePane = getVanChartFillStylePane(); + panel.add(vanChartFillStylePane, BorderLayout.NORTH); + } + panel.add(getContentInPlotType(), BorderLayout.CENTER); + return panel; + } + + //获取颜色面板 + private JPanel getColorPane(MapType paneType) { + JPanel panel = new JPanel(new BorderLayout()); + stylePane = createStylePane(); + mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); + if(mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { + vanChartFillStylePane = getVanChartFillStylePane(); + if (vanChartFillStylePane != null) { + panel.add(vanChartFillStylePane, BorderLayout.NORTH); + } + } + setColorPaneContent(panel, paneType); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); + return panel.getComponentCount() == 0 ? null : colorPane; + } + /** * 在每个不同类型Plot, 得到不同类型的属性. 比如: 柱形的风格, 折线的线型曲线. */ @@ -176,10 +207,17 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } //设置色彩面板内容 - protected void setColorPaneContent(JPanel panel) { - panel.add(createNullValueColorPane(), BorderLayout.CENTER); - panel.add(createAlphaPane(), BorderLayout.SOUTH); - + protected void setColorPaneContent(JPanel panel, MapType paneType) { + switch (paneType) { + case AREA: + panel.add(createNullValueColorPane(), BorderLayout.CENTER); + panel.add(createAlphaPane(), BorderLayout.SOUTH); + break; + case POINT: + panel.add(createPointAlphaPane(), BorderLayout.CENTER); + default: + return; + } } @@ -192,7 +230,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, + new Component[]{getColorPane(MapType.AREA)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, }; @@ -213,7 +251,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), createPointAlphaPane())}, + new Component[]{getColorPane(MapType.POINT)}, new Component[]{createMarkerComPane()}, //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLargeDataModelPane()}, @@ -232,6 +270,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { curvePane = new VanChartCurvePane(); Component[][] components = new Component[][]{ + new Component[]{getColorPane(MapType.LINE)}, new Component[]{createCurvePane()}, //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLineMapLargeDataModelPane()}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java index df967518b7..4fa61802de 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java @@ -7,9 +7,9 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.pie.VanChartPieSeriesPane; import javax.swing.JPanel; @@ -90,4 +90,9 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0); } } + + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 2169c4a20c..a6a1a5e28a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -41,7 +41,6 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { double[] columnSize = {f}; double[] rowSize = {p,p,p,p,p,p}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createSeriesStylePane(rowSize, new double[]{f, e})}, new Component[]{createBorderPane()}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java index 6838969229..5500cf9a32 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java @@ -43,7 +43,6 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane { private Component[][] getPaneComponents() { if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) { return new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createRadarTypePane()}, new Component[]{createBorderPane()}, }; @@ -59,7 +58,9 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane { //设置色彩面板内容 protected void setColorPaneContent (JPanel panel) { - panel.add(createAlphaPane(), BorderLayout.CENTER); + if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) { + panel.add(createAlphaPane(), BorderLayout.CENTER); + } } private JPanel createRadarTypePane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index a85725a8e7..c6d7f8af6c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -35,7 +35,6 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{getColorPane()}, new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createStackedAndAxisPane()}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java index b9e5427112..ee2cda46a6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java @@ -10,10 +10,10 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.style.color.ColorSelectBox; - import com.fr.plugin.chart.base.AttrNode; import com.fr.plugin.chart.structure.VanChartStructurePlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -142,4 +142,9 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane } } } + + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java index d5ab61b950..884e96b330 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java @@ -15,10 +15,10 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; - import com.fr.plugin.chart.wordcloud.CloudShapeType; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -228,4 +228,9 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane } } } + + @Override + protected VanChartBeautyPane createStylePane() { + return null; + } } From 011f0098d85b87f23b76b76d5d722206a88645c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 31 Mar 2020 17:41:27 +0800 Subject: [PATCH 03/88] CHART-11709 --- .../mainframe/chart/gui/style/ChartColorAdjustPane.java | 6 +++--- .../van/chart/designer/component/VanChartFillStylePane.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java index 5578f49c63..52bde97a6d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java @@ -34,7 +34,7 @@ import java.awt.image.BufferedImage; */ public class ChartColorAdjustPane extends JPanel implements UIObserver { - public static final Color[] defaultColors = { + public static final Color[] DEFAULT_COLORS = { new Color(99, 178, 238), new Color(118, 218, 145), new Color(248, 203, 127), @@ -61,7 +61,7 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { public ChartColorAdjustPane() { - this(defaultColors); + this(DEFAULT_COLORS); } public ChartColorAdjustPane(Color[] colors) { @@ -71,7 +71,7 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { } public void updateColor() { - updateColor(defaultColors); + updateColor(DEFAULT_COLORS); } public void updateColor(Color[] colors) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index ae8d1135e1..95c8011c0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -58,7 +58,7 @@ public class VanChartFillStylePane extends BasicBeanPane { changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER}; changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); - accColors = ChartColorAdjustPane.defaultColors; + accColors = ChartColorAdjustPane.DEFAULT_COLORS; cardLayout.show(changeColorSetPane, "acc"); customPane.add(changeColorSetPane, BorderLayout.CENTER); initListener(); From d2713dced7d238913526a90fab781f1c40f5955e Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 31 Mar 2020 18:08:12 +0800 Subject: [PATCH 04/88] =?UTF-8?q?REPORT-28351=20=E5=BC=BA=E8=BD=AC?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/template/info/JWorkBookProcessInfo.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java index eec7773282..85266b7cd8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java @@ -5,6 +5,7 @@ import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; import com.fr.report.cellcase.CellCase; import com.fr.report.poly.PolyWorkSheet; +import com.fr.report.report.Report; import com.fr.report.worksheet.WorkSheet; import java.util.Iterator; @@ -61,8 +62,12 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { int blockCount = 0; if (!template.isElementCaseBook()) { // 如果是聚合报表 for (int i = 0; i < template.getReportCount(); i++) { - PolyWorkSheet r = (PolyWorkSheet) template.getReport(i); - blockCount += r.getBlockCount(); + Report report = template.getReport(i); + // 考虑多个sheet下 包含WorkSheet的情况 需要判断下 + if (report instanceof PolyWorkSheet) { + PolyWorkSheet r = (PolyWorkSheet) report; + blockCount += r.getBlockCount(); + } } } return blockCount; From 3f3c67455862e0aa4dfc1a8dfd997a45edcb0903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 1 Apr 2020 10:33:55 +0800 Subject: [PATCH 05/88] =?UTF-8?q?CHART-11709=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combobox/ColorSchemeComboBox.java | 48 ++++++- .../component/VanChartFillStylePane.java | 130 +++++++++++------- 2 files changed, 121 insertions(+), 57 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java index 8f8d69a222..ae076b8f37 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -93,6 +93,43 @@ public class ColorSchemeComboBox extends UIComboBox { return colorInfo; } + public SelectType getSelectType() { + int selectedIndex = this.getSelectedIndex(); + int itemCount = this.getItemCount(); + if (selectedIndex == itemCount - 1) { + return SelectType.GRADATION_COLOR; + } + if (selectedIndex == itemCount - 2) { + return SelectType.COMBINATION_COLOR; + } + if (selectedIndex == 0) { + return SelectType.DEFAULT; + } + return SelectType.NORMAL; + } + + public void setSelectType(SelectType selectType) { + int itemCount = this.getItemCount(); + switch (selectType) { + case DEFAULT: + setSelectedIndex(0); + break; + case GRADATION_COLOR: + setSelectedIndex(itemCount - 1); + break; + case COMBINATION_COLOR: + setSelectedIndex(itemCount - 2); + break; + } + } + + public enum SelectType { + DEFAULT, + COMBINATION_COLOR, + GRADATION_COLOR, + NORMAL + } + public class ColorInfo { @@ -134,6 +171,8 @@ public class ColorSchemeComboBox extends UIComboBox { private static final int HEIGHT = 20; + private static final int MAX_COUNT = 5; + @Override public Dimension getPreferredSize() { Dimension preferredSize = super.getPreferredSize(); @@ -155,8 +194,9 @@ public class ColorSchemeComboBox extends UIComboBox { comp.setText(BLANK_SPACE + schemeName); } else { FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); - double width = (HEIGHT - 2 * Y) * 5; + double width = (HEIGHT - 2 * Y) * MAX_COUNT; String fill = BLANK_SPACE; + //图形和文字之间留的宽度大于3倍的X while (fontMetrics.stringWidth(fill) < width + 3 * X) { fill += BLANK_SPACE; } @@ -184,7 +224,7 @@ public class ColorSchemeComboBox extends UIComboBox { private void drawGradient(Graphics2D g2d, List colors) { //上下留4px,宽度等于5倍高 double height = HEIGHT - 2 * Y; - double width = height * 5; + double width = height * MAX_COUNT; LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()])); g2d.setPaint(linearGradientPaint); Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height); @@ -192,9 +232,9 @@ public class ColorSchemeComboBox extends UIComboBox { } private void drawCombineColor(Graphics2D g2d, List colors) { - int size = colors.size() > 5 ? 5 : colors.size(); + int size = Math.min(colors.size(), MAX_COUNT); double height = HEIGHT - 2 * Y; - double width = height * 5 / size; + double width = height * MAX_COUNT / size; for (int i = 0; i < size; i++) { g2d.setPaint(colors.get(i)); Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index 95c8011c0c..154ed5557e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -70,8 +70,8 @@ public class VanChartFillStylePane extends BasicBeanPane { @Override public void doChange() { accColors = colorAdjustPane.getColors(); - if (styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 2) { - styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 2); + if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) { + styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR); } VanChartFillStylePane.this.revalidate(); } @@ -81,33 +81,37 @@ public class VanChartFillStylePane extends BasicBeanPane { public void doChange() { gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner(); gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner(); - if (styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { - styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 1); + if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) { + styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR); } } }); styleSelectBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); - if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 2) { - colorAdjustPane.updateColor(accColors); - cardLayout.show(changeColorSetPane, "acc"); - gradientSelect = false; - } else if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 1) { - colorGradient.updateColor(gradientColors[0], gradientColors[1]); - changeColorSetPane.add(colorGradient, "gradient"); - cardLayout.show(changeColorSetPane, "gradient"); - gradientSelect = true; - } else if (selectColorInfo.isGradient()) { - colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1)); - changeColorSetPane.add(colorGradient, "gradient"); - cardLayout.show(changeColorSetPane, "gradient"); - gradientSelect = true; - } else { - colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{})); - cardLayout.show(changeColorSetPane, "acc"); - gradientSelect = false; + switch (styleSelectBox.getSelectType()) { + case COMBINATION_COLOR: + colorAdjustPane.updateColor(accColors); + cardLayout.show(changeColorSetPane, "acc"); + gradientSelect = false; + break; + case GRADATION_COLOR: + colorGradient.updateColor(gradientColors[0], gradientColors[1]); + cardLayout.show(changeColorSetPane, "gradient"); + gradientSelect = true; + break; + default: + ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); + if (selectColorInfo.isGradient()) { + colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1)); + cardLayout.show(changeColorSetPane, "gradient"); + gradientSelect = true; + } else { + colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{})); + cardLayout.show(changeColorSetPane, "acc"); + gradientSelect = false; + } + break; } VanChartFillStylePane.this.revalidate(); } @@ -153,20 +157,20 @@ public class VanChartFillStylePane extends BasicBeanPane { String fillStyleName = condition == null ? "" : condition.getFillStyleName(); if (StringUtils.isBlank(fillStyleName)) {//兼容处理 if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { - styleSelectBox.setSelectedIndex(0);//默认 + styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认 } else { int colorStyle = condition.getColorStyle(); if (colorStyle == ChartConstants.COLOR_GRADIENT) { gradientColors[0] = condition.getColorIndex(0); gradientColors[1] = condition.getColorIndex(1); - styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 1); + styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR); } else { int colorSize = condition.getColorSize(); accColors = new Color[colorSize]; for (int i = 0; i < colorSize; i++) { accColors[i] = condition.getColorIndex(i); } - styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount() - 2); + styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR); } } } else { @@ -176,37 +180,57 @@ public class VanChartFillStylePane extends BasicBeanPane { @Override public AttrFillStyle updateBean() { + switch (styleSelectBox.getSelectType()) { + case COMBINATION_COLOR: + return updateCombinationColor(); + case GRADATION_COLOR: + return updateGradationColor(); + case DEFAULT: + return updateDefaultColor(); + default: + return updateNormalColor(); + } + } + + private AttrFillStyle updateCombinationColor() { AttrFillStyle condition = new AttrFillStyle(); condition.clearColors(); - - //自定义组合色 - if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 2) { - condition.setColorStyle(ChartConstants.COLOR_ACC); - for (int i = 0, length = accColors.length; i < length; i++) { - condition.addFillColor(accColors[i]); - } - //自定义渐变色 - } else if (styleSelectBox.getSelectedIndex() == styleSelectBox.getItemCount() - 1) { - condition.setColorStyle(ChartConstants.COLOR_GRADIENT); - Color start = gradientColors[0]; - Color end = gradientColors[1]; - condition.addFillColor(start); - condition.addFillColor(end); - } else if (styleSelectBox.getSelectedIndex() == 0) { - condition.setColorStyle(ChartConstants.COLOR_DEFAULT); - } else { - ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); - Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem()); - if (preStyle instanceof ChartColorMatching) { - AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); - def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); - return def; - } else { - condition.setColorStyle(ChartConstants.COLOR_DEFAULT); - } - condition.setCustomFillStyle(true); + condition.setColorStyle(ChartConstants.COLOR_ACC); + for (int i = 0, length = accColors.length; i < length; i++) { + condition.addFillColor(accColors[i]); } + condition.setCustomFillStyle(true); + return condition; + } + private AttrFillStyle updateGradationColor() { + AttrFillStyle condition = new AttrFillStyle(); + condition.clearColors(); + condition.setColorStyle(ChartConstants.COLOR_GRADIENT); + Color start = gradientColors[0]; + Color end = gradientColors[1]; + condition.addFillColor(start); + condition.addFillColor(end); + condition.setCustomFillStyle(true); return condition; } + + private AttrFillStyle updateDefaultColor() { + AttrFillStyle condition = new AttrFillStyle(); + condition.clearColors(); + condition.setColorStyle(ChartConstants.COLOR_DEFAULT); + return condition; + } + + private AttrFillStyle updateNormalColor() { + ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); + Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem()); + if (preStyle instanceof ChartColorMatching) { + AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); + def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); + return def; + } else { + return updateDefaultColor(); + } + } } From 746ca6e969cceace13b8eef3511b281d6c5fe84b Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 1 Apr 2020 15:52:53 +0800 Subject: [PATCH 06/88] =?UTF-8?q?REPORT-28907=20=E5=90=8C=E6=AD=A5fire=20&?= =?UTF-8?q?&=20REPORT-28351=20=E5=BC=BA=E8=BD=AC=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0release=20&&=20MOBILE-26199=20?= =?UTF-8?q?=E6=8F=90=E4=BE=9Btab=E6=A0=87=E9=A2=98=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/MobileTemplateStyleProvider.java | 25 +++++++++++ .../AbstractMobileTemplateStyleProvider.java | 25 +++++++++++ .../accessibles/MobileTemplateStylePane.java | 43 +++++++++++++++++-- .../main/java/com/fr/exit/DesignerExiter.java | 2 +- .../template/info/JWorkBookProcessInfo.java | 9 +++- 5 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java new file mode 100644 index 0000000000..770e65a9ee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.stable.fun.mark.Mutable; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +public interface MobileTemplateStyleProvider extends Mutable { + + String XML_TAG = "MobileTemplateStyleProvider"; + + int CURRENT_LEVEL = 1; + + Class classFroMobileTemplateStyle(); + + + Class> classFroMobileTemplateStyleAppearance(); + + String displayName(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java new file mode 100644 index 0000000000..54c947c57a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.MobileTemplateStyleProvider; +import com.fr.design.fun.MobileWidgetStyleProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL) +public abstract class AbstractMobileTemplateStyleProvider extends AbstractProvider implements MobileTemplateStyleProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 76434545ed..9c52673d7f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -1,11 +1,14 @@ package com.fr.design.mainframe.widget.accessibles; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.MobileTemplateStyleProvider; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyleType; +import com.fr.invoke.Reflect; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -18,9 +21,12 @@ import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; public class MobileTemplateStylePane extends AbstractTemplateStylePane { private static final List STYLE_LIST = new ArrayList(); @@ -36,6 +42,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane> map = new HashMap<>(); private JPanel right; private CardLayout card; + private Set> extraStyle = new HashSet<>(); public MobileTemplateStylePane(WCardTagLayout tagLayout){ init(tagLayout); } @@ -52,6 +59,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane list = getMobileTemplateStyleProvider(); + for (MobileTemplateStyleProvider provider : list) { + String displayName = provider.displayName(); + Class> clazz = provider.classFroMobileTemplateStyleAppearance(); + BasicBeanPane styleBasicBeanPane = Reflect.on(clazz).create().get(); + listModel.addElement(displayName); + map.put(displayName, styleBasicBeanPane); + right.add(displayName, styleBasicBeanPane); + extraStyle.add(provider.classFroMobileTemplateStyle()); + } + } + public static ListCellRenderer render = new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -97,16 +119,31 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane getMobileTemplateStyleProvider() { + List list = new ArrayList<>(); + Set sets = ExtraDesignClassManager.getInstance().getArray(MobileTemplateStyleProvider.XML_TAG); + list.addAll(sets); + return Collections.unmodifiableList(list); + } } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index e7189511a1..b9067a22ee 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -22,7 +22,7 @@ public class DesignerExiter { public void execute() { beforeExit(); if (FineProcessContext.getParentPipe() != null) { - FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY); } System.exit(0); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java index eec7773282..85266b7cd8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java @@ -5,6 +5,7 @@ import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; import com.fr.report.cellcase.CellCase; import com.fr.report.poly.PolyWorkSheet; +import com.fr.report.report.Report; import com.fr.report.worksheet.WorkSheet; import java.util.Iterator; @@ -61,8 +62,12 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { int blockCount = 0; if (!template.isElementCaseBook()) { // 如果是聚合报表 for (int i = 0; i < template.getReportCount(); i++) { - PolyWorkSheet r = (PolyWorkSheet) template.getReport(i); - blockCount += r.getBlockCount(); + Report report = template.getReport(i); + // 考虑多个sheet下 包含WorkSheet的情况 需要判断下 + if (report instanceof PolyWorkSheet) { + PolyWorkSheet r = (PolyWorkSheet) report; + blockCount += r.getBlockCount(); + } } } return blockCount; From 3c9245c79cacfc11baaae5c40aa59a5666bbaf69 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 1 Apr 2020 20:01:28 +0800 Subject: [PATCH 07/88] =?UTF-8?q?CHART-12817=20=E4=BF=AE=E6=94=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=AD=96=E7=95=A5=E6=96=87=E6=A1=88=E5=92=8C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index f4e1127f24..d67fdc3748 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -81,7 +82,7 @@ public class VanChartPlotLegendPane extends BasicPane { } protected void initComponents(){ - isLegendVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); + isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); legendPane = createLegendPane(); double p = TableLayout.PREFERRED; @@ -121,9 +122,9 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitleStylePane(),null} , - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } @@ -146,16 +147,16 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitleStylePane(),null} , - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } protected JPanel createTitlePositionPane(double[] row, double[] col){ - String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Right_Top")}; + String[] textArray = {Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), + Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), Toolkit.i18nText("Fine-Design_Chart_Right_Top")}; Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP}; Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), @@ -167,13 +168,13 @@ public class VanChartPlotLegendPane extends BasicPane { location = new UIButtonGroup(iconArray, valueArray); location.setAllToolTips(textArray); - customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); + customFloatPositionButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); UIComponentUtils.setLineWrap(customFloatPositionButton); customFloatPositionButton.setEventBannded(true); Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{null,customFloatPositionButton} }; @@ -182,7 +183,7 @@ public class VanChartPlotLegendPane extends BasicPane { initPositionListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } private void initPositionListener(){ @@ -230,18 +231,17 @@ public class VanChartPlotLegendPane extends BasicPane { protected JPanel createTitleStylePane(){ textAttrPane = new ChartTextAttrPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); } protected JPanel createDisplayStrategy(){ //区域显示策略 恢复用注释。开始删除。 maxProportion = new UISpinner(0, 100, 1, 30); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); + limitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); + limitSizeTitle = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); - - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); @@ -262,7 +262,7 @@ public class VanChartPlotLegendPane extends BasicPane { } private JPanel createHighlightPane(){ - highlightButton = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -271,7 +271,7 @@ public class VanChartPlotLegendPane extends BasicPane { double[] rowSize = {p,p}; Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); } @@ -295,8 +295,7 @@ public class VanChartPlotLegendPane extends BasicPane { //区域显示策略 恢复用注释。删除下面方法。 //检查最大显示占比是否可用 private void checkMaxProPortionUse() { - maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); + maxProportionPane.setVisible(limitSize.getSelectedIndex() == 1 && limitSize.isEnabled()); } protected void checkBoxUse() { @@ -328,7 +327,7 @@ public class VanChartPlotLegendPane extends BasicPane { } legend.setFloating(customFloatPositionButton.isSelected()); //区域显示策略 恢复用注释。下面2行删除。 - legend.setLimitSize(limitSize.getSelectedIndex() == 0); + legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); //区域显示策略 恢复用注释。取消注释。 //legend.setLimitAttribute(limitPane.updateBean()); @@ -352,7 +351,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); //区域显示策略 恢复用注释。下面2行删除。 - limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); + limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); From b9ec2f32cfc099e916808e9d2ac053ed5a3f7d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Thu, 2 Apr 2020 14:39:04 +0800 Subject: [PATCH 08/88] =?UTF-8?q?CHART-13213=20=E5=9C=B0=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E5=8C=B9=E9=85=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/MapAreaMatchPane.java | 1 + .../chartx/component/MatchAreaTable.java | 28 +++++-------- .../chartx/component/MatchResultTable.java | 39 +++++++++++++++++-- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index 41202061cd..a3e610460b 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -118,6 +118,7 @@ public class MapAreaMatchPane extends BasicBeanPane { matchAreaTable.setItems(treeNodeAndItems.getSecond()); matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY); + matchResultTable.setItems(treeNodeAndItems.getSecond()); DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY); matchResultTable.setModel(model); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java index 9c16b4663d..9dd13e77fb 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -1,6 +1,5 @@ package com.fr.design.chartx.component; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; @@ -63,6 +62,16 @@ public class MatchAreaTable extends JTable { this.areaNameIndex = areaNameIndex; } + @Override + public boolean isCellEditable(int row, int column) { + //第一列不可编辑 + int col = convertColumnIndexToModel(column); + if (col == 0) { + return false; + } + return true; + } + public void setModel(TableModel dataModel) { super.setModel(dataModel); @@ -70,7 +79,6 @@ public class MatchAreaTable extends JTable { items = new HashSet<>(); } TableColumnModel columnModel = getColumnModel(); - columnModel.getColumn(0).setCellEditor(new UILabelEditor()); columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor()); columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor()); } @@ -131,20 +139,4 @@ public class MatchAreaTable extends JTable { return comboBox.getSelectedItem(); } } - - public static class UILabelEditor extends AbstractCellEditor implements TableCellEditor { - - UILabel uiLabel; - - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, - int row, int column) { - uiLabel = new UILabel(GeneralUtils.objectToString(value)); - return uiLabel; - } - - public Object getCellEditorValue() { - return uiLabel.getText(); - } - } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java index 8a85c84a47..5f03a75516 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java @@ -3,8 +3,10 @@ package com.fr.design.chartx.component; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.stable.StringUtils; @@ -18,7 +20,9 @@ import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import java.util.Vector; +import java.awt.Color; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -32,6 +36,8 @@ public class MatchResultTable extends JTable { private MatchAreaTable matchAreaTable; + private Set items; + public MatchResultTable(Object[][] data, Object[] header) { super(data, header); this.getTableHeader().setReorderingAllowed(false); @@ -41,12 +47,26 @@ public class MatchResultTable extends JTable { this.matchAreaTable = matchAreaTable; } + public void setItems(Set items) { + this.items = items; + } + + @Override + public boolean isCellEditable(int row, int column) { + //第一列和第二列不可编辑 + int col = convertColumnIndexToModel(column); + if (col == 0 || col == 1) { + return false; + } + return true; + } + + public void setModel(TableModel dataModel) { super.setModel(dataModel); TableColumnModel columnModel = getColumnModel(); - columnModel.getColumn(0).setCellEditor(new MatchAreaTable.UILabelEditor()); - columnModel.getColumn(1).setCellEditor(new MatchAreaTable.UILabelEditor()); + columnModel.getColumn(1).setCellRenderer(new UILabelEditorAndRender()); columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender()); columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender()); columnModel.getColumn(2).setMaxWidth(20); @@ -56,7 +76,6 @@ public class MatchResultTable extends JTable { int rowCount = this.getRowCount(); for (int i = 0; i < rowCount; i++) { if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) { - getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); this.setValueAt(result, i, 1); return; } @@ -143,4 +162,18 @@ public class MatchResultTable extends JTable { } } + public class UILabelEditorAndRender implements TableCellRenderer { + + UILabel uiLabel; + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + uiLabel = new UILabel(GeneralUtils.objectToString(value)); + if (!items.contains(value)) { + uiLabel.setForeground(Color.GRAY); + uiLabel.setText(value + Toolkit.i18nText("Fine-Design_Chart_Lost_Data")); + } + return uiLabel; + } + } + } From afa34b3338efec97e6d4afaf07539028b15c3cfc Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 15:02:34 +0800 Subject: [PATCH 09/88] =?UTF-8?q?CHART-12817=20=E5=9B=BE=E4=BE=8B=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8E=92=E5=88=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/HeatMapRangeLegendPane.java | 9 +- .../style/VanChartPlotLegendPane.java | 112 ++++++++++++++---- .../style/VanChartRangeLegendPane.java | 42 ++++--- 3 files changed, 112 insertions(+), 51 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index db0d5c8641..60c535ceb9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; @@ -38,8 +39,8 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { @Override protected UIButtonGroup createLegendTypeButton(){ return new UIButtonGroup(new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") + Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), + Toolkit.i18nText("Fine-Design_Chart_Legend_Section") }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); } @@ -53,7 +54,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { return new Component[][]{ new Component[]{minMaxValuePane, null}, - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, + new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, new Component[]{null, legendGradientBar} }; } @@ -64,7 +65,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { @Override protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.parent) { + return new SectionLegendPane(this.getLegendPaneParent()) { @Override protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { return new SectionIntervalConfigPaneWithOutNum(parent); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index d67fdc3748..51faecff10 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -16,6 +16,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; +import com.fr.plugin.chart.type.ArrangeType; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; @@ -45,32 +46,31 @@ public class VanChartPlotLegendPane extends BasicPane { private static final int HEIGHT = 100; private static final int GAP = 20; - protected UICheckBox isLegendVisible; + private UICheckBox isLegendVisible; + private JPanel legendPane; - protected JPanel legendPane; - - protected ChartTextAttrPane textAttrPane; - protected VanChartBorderWithRadiusPane borderPane; - protected VanChartBackgroundWithOutImagePane backgroundPane; - protected UIButtonGroup location; - protected UIToggleButton customFloatPositionButton; - protected VanChartFloatPositionPane customFloatPositionPane; + private ChartTextAttrPane textAttrPane; + private VanChartBorderWithRadiusPane borderPane; + private VanChartBackgroundWithOutImagePane backgroundPane; + private UIButtonGroup location; + private UIToggleButton customFloatPositionButton; + private UIButtonGroup arrangeButton; + private JPanel arrangePane; + private VanChartFloatPositionPane customFloatPositionPane; //区域显示策略 恢复用注释。下面4行删除。 - protected UIButtonGroup limitSize; - protected UISpinner maxProportion; + private UIButtonGroup limitSize; + private UISpinner maxProportion; private UILabel limitSizeTitle; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; //高亮显示的按钮 - protected UIButtonGroup highlightButton; - protected JPanel highlightPane; - - - protected VanChartStylePane parent; + private UIButtonGroup highlightButton; + private JPanel highlightPane; + private VanChartStylePane parent; public VanChartPlotLegendPane() { initComponents(); @@ -81,7 +81,27 @@ public class VanChartPlotLegendPane extends BasicPane { initComponents(); } - protected void initComponents(){ + public JPanel getHighlightPane() { + return highlightPane; + } + + public VanChartStylePane getLegendPaneParent() { + return parent; + } + + public JPanel getArrangePane() { + return arrangePane; + } + + public UIButtonGroup getLegendLocation() { + return location; + } + + public UIToggleButton getCustomFloatPositionButton() { + return customFloatPositionButton; + } + + private void initComponents() { isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); legendPane = createLegendPane(); @@ -101,7 +121,7 @@ public class VanChartPlotLegendPane extends BasicPane { addLegendListener(); } - protected void addLegendListener(){ + private void addLegendListener() { isLegendVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkBoxUse(); @@ -154,11 +174,19 @@ public class VanChartPlotLegendPane extends BasicPane { return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - protected JPanel createTitlePositionPane(double[] row, double[] col){ - String[] textArray = {Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), - Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), Toolkit.i18nText("Fine-Design_Chart_Right_Top")}; + private JPanel createTitlePositionPane(double[] row, double[] col) { + String[] textArray = { + Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), + Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), + Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), + Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), + Toolkit.i18nText("Fine-Design_Chart_Right_Top") + }; + Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP}; - Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"), + + Icon[] iconArray = { + BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"), @@ -179,19 +207,42 @@ public class VanChartPlotLegendPane extends BasicPane { }; customFloatPositionPane = new VanChartFloatPositionPane(); + arrangePane = createArrangePane(); initPositionListener(); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); + JPanel positionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(positionPane, BorderLayout.NORTH); + panel.add(arrangePane, BorderLayout.CENTER); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } + private JPanel createArrangePane() { + arrangeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Arrange_Flow"), Toolkit.i18nText("Fine-Design_Chart_Arrange_Aligned")}, + new ArrangeType[]{ArrangeType.FLOW, ArrangeType.ALIGNED}); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), arrangeButton} + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); + } + private void initPositionListener(){ location.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { customFloatPositionButton.setSelected(false); + checkArrangePaneVisible(); checkDisplayStrategyUse(); } }); @@ -201,6 +252,7 @@ public class VanChartPlotLegendPane extends BasicPane { public void mouseClicked(MouseEvent e) { if(!customFloatPositionButton.isSelected()){ customFloatPositionButton.setSelected(true); + checkArrangePaneVisible(); checkDisplayStrategyUse(); } } @@ -229,12 +281,12 @@ public class VanChartPlotLegendPane extends BasicPane { }); } - protected JPanel createTitleStylePane(){ + private JPanel createTitleStylePane() { textAttrPane = new ChartTextAttrPane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); } - protected JPanel createDisplayStrategy(){ + private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 maxProportion = new UISpinner(0, 100, 1, 30); limitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -278,10 +330,18 @@ public class VanChartPlotLegendPane extends BasicPane { protected void checkAllUse() { checkBoxUse(); + checkArrangePaneVisible(); checkDisplayStrategyUse(); this.repaint(); } + protected void checkArrangePaneVisible() { + boolean visible = !getCustomFloatPositionButton().isSelected() + && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + + arrangePane.setVisible(visible); + } + //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { //区域显示策略 恢复用注释。下面2行删除。 @@ -326,6 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); + legend.setArrange(arrangeButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); @@ -350,6 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); + arrangeButton.setSelectedItem(legend.getArrange()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 2e7ae32781..cb708963bb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; @@ -49,10 +50,10 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { ordinaryLegendPane = new JPanel(); //渐变色图例面板 gradualLegendPane = createGradualLegendPane(); - gradualLegendPane.setParentPane(parent); + gradualLegendPane.setParentPane(this.getLegendPaneParent()); //区域段图例面板 sectionLegendPane = createSectionLegendPane(); - sectionLegendPane.setParentPane(parent); + sectionLegendPane.setParentPane(this.getLegendPaneParent()); JPanel panel = new JPanel(new CardLayout()){ @Override @@ -79,7 +80,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { } protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.parent); + return new SectionLegendPane(this.getLegendPaneParent()); } private JPanel createTableLayoutPaneWithTitle(String title, Component component) { @@ -88,9 +89,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { protected UIButtonGroup createLegendTypeButton(){ return new UIButtonGroup(new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") + Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), + Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), + Toolkit.i18nText("Fine-Design_Chart_Legend_Section") }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); } @@ -104,7 +105,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { initLegendTypeButtonListener(); - JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Form"),legendTypeButton); + JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton); legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); rangeLegendPane = createRangeLegendPane(); @@ -129,6 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override public void actionPerformed(ActionEvent e) { checkCardPane(); + checkArrangePaneVisible(); } }); } @@ -138,33 +140,29 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); } - @Override - protected void addLegendListener(){ - isLegendVisible.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkBoxUse(); - } - }); - } - @Override protected void checkAllUse() { checkBoxUse(); + checkArrangePaneVisible(); checkDisplayStrategyUse(); checkCardPane(); this.repaint(); } - @Override - protected void checkBoxUse() { - isLegendVisible.setEnabled(true); - legendPane.setVisible(isLegendVisible.isSelected()); + protected void checkArrangePaneVisible() { + boolean visible = legendTypeButton.getSelectedItem() != LegendType.GRADUAL + && !getCustomFloatPositionButton().isSelected() + && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + + getArrangePane().setVisible(visible); } private void checkHighlightVisible(){ - if(this.highlightPane != null){ + JPanel highlightPane = this.getHighlightPane(); + + if (highlightPane != null) { LegendType legendType = legendTypeButton.getSelectedItem(); - this.highlightPane.setVisible(legendType != LegendType.GRADUAL); + highlightPane.setVisible(legendType != LegendType.GRADUAL); } } From d0bc79e59e6e325bfa280cc0a9965d1b0d0bd1ce Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 2 Apr 2020 17:04:21 +0800 Subject: [PATCH 10/88] =?UTF-8?q?feat:CHART-12905=20=E5=88=A0=E9=99=A4phan?= =?UTF-8?q?tom=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/ChartDesignerActivator.java | 26 +++++++------------ .../fr/design/chart/gui/ChartComponent.java | 9 ++----- .../design/mainframe/chart/ChartEditPane.java | 6 ----- 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index c3213c10ba..c5bfdc8390 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -4,7 +4,6 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartHyperlinkGroup; @@ -16,42 +15,37 @@ import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; -import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; -import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.map.server.ChartMapEditorAction; /** * Created by juhaoyu on 2018/6/27. */ public class ChartDesignerActivator extends Activator implements Prepare { - + @Override public void start() { - + StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); - + DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); - + DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); - + DesignModuleFactory.registerChartDialogClass(ChartDialog.class); - + DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); - + ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction()); ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction()); - + ActionFactory.registerChartCollection(ChartCollection.class); - + DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); - - DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); - DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ChartTypeInterfaceManager.addPluginChangedListener(); } @@ -63,6 +57,6 @@ public class ChartDesignerActivator extends Activator implements Prepare { @Override public void stop() { - + } } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index ca1f4f1400..c8fafe9cdb 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -31,7 +31,7 @@ import java.awt.event.MouseMotionListener; * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 */ -public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, CallbackEvent{ +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener{ private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; @@ -257,12 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - painter.paint(g2d, chartWidth, chartHeight, resolution, null, this); + painter.paint(g2d, chartWidth, chartHeight, resolution, null); } } - - @Override - public void callback() { - this.repaint(); - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index af65408931..0089785ce2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -115,12 +115,6 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare if (!ComparatorUtils.equals(collection, lastCollection)) { - VanChart vanChart = collection.getSelectedChartProvider(VanChart.class); - if (vanChart != null) { - //此处画图 - vanChart.demoImgEvent(true); - } - try { lastCollection = collection.clone(); } catch (CloneNotSupportedException e) { From e108f4d28ba58ea8318b89bfe567bcaa0487792b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 17:16:45 +0800 Subject: [PATCH 11/88] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 44 +++++++++---------- .../style/VanChartRangeLegendPane.java | 11 ++--- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 51faecff10..acfc7811e1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -16,7 +16,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; -import com.fr.plugin.chart.type.ArrangeType; +import com.fr.plugin.chart.type.LayoutType; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; @@ -54,8 +54,8 @@ public class VanChartPlotLegendPane extends BasicPane { private VanChartBackgroundWithOutImagePane backgroundPane; private UIButtonGroup location; private UIToggleButton customFloatPositionButton; - private UIButtonGroup arrangeButton; - private JPanel arrangePane; + private UIButtonGroup layoutButton; + private JPanel layoutPane; private VanChartFloatPositionPane customFloatPositionPane; //区域显示策略 恢复用注释。下面4行删除。 @@ -89,10 +89,6 @@ public class VanChartPlotLegendPane extends BasicPane { return parent; } - public JPanel getArrangePane() { - return arrangePane; - } - public UIButtonGroup getLegendLocation() { return location; } @@ -207,7 +203,7 @@ public class VanChartPlotLegendPane extends BasicPane { }; customFloatPositionPane = new VanChartFloatPositionPane(); - arrangePane = createArrangePane(); + layoutPane = createLayoutPane(); initPositionListener(); @@ -215,14 +211,15 @@ public class VanChartPlotLegendPane extends BasicPane { JPanel panel = new JPanel(new BorderLayout()); panel.add(positionPane, BorderLayout.NORTH); - panel.add(arrangePane, BorderLayout.CENTER); + panel.add(layoutPane, BorderLayout.CENTER); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } - private JPanel createArrangePane() { - arrangeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Arrange_Flow"), Toolkit.i18nText("Fine-Design_Chart_Arrange_Aligned")}, - new ArrangeType[]{ArrangeType.FLOW, ArrangeType.ALIGNED}); + private JPanel createLayoutPane() { + layoutButton = new UIButtonGroup<>( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Layout_Flow"), Toolkit.i18nText("Fine-Design_Chart_Layout_Aligned")}, + new LayoutType[]{LayoutType.FLOW, LayoutType.ALIGNED}); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -230,7 +227,7 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), arrangeButton} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), layoutButton} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); @@ -242,7 +239,7 @@ public class VanChartPlotLegendPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { customFloatPositionButton.setSelected(false); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); } }); @@ -252,7 +249,7 @@ public class VanChartPlotLegendPane extends BasicPane { public void mouseClicked(MouseEvent e) { if(!customFloatPositionButton.isSelected()){ customFloatPositionButton.setSelected(true); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); } } @@ -330,16 +327,19 @@ public class VanChartPlotLegendPane extends BasicPane { protected void checkAllUse() { checkBoxUse(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); this.repaint(); } - protected void checkArrangePaneVisible() { - boolean visible = !getCustomFloatPositionButton().isSelected() - && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + protected void checkLayoutPaneVisible() { + layoutPane.setVisible(isVisibleLayoutPane()); + } + + protected boolean isVisibleLayoutPane() { + int locationIndex = getLegendLocation().getSelectedIndex(); - arrangePane.setVisible(visible); + return !getCustomFloatPositionButton().isSelected() && (locationIndex == 0 || locationIndex == 1); } //检查显示策略界面是否可用 @@ -386,7 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); - legend.setArrange(arrangeButton.getSelectedItem()); + legend.setLayout(layoutButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); @@ -411,7 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); - arrangeButton.setSelectedItem(legend.getArrange()); + layoutButton.setSelectedItem(legend.getLayout()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index cb708963bb..25ef2a15b2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -130,7 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override public void actionPerformed(ActionEvent e) { checkCardPane(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); } }); } @@ -143,18 +143,15 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override protected void checkAllUse() { checkBoxUse(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); checkCardPane(); this.repaint(); } - protected void checkArrangePaneVisible() { - boolean visible = legendTypeButton.getSelectedItem() != LegendType.GRADUAL - && !getCustomFloatPositionButton().isSelected() - && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + protected boolean isVisibleLayoutPane() { - getArrangePane().setVisible(visible); + return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL; } private void checkHighlightVisible(){ From f2300031de0940d63f0af5315f1cf09e644c1d4b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 17:39:04 +0800 Subject: [PATCH 12/88] =?UTF-8?q?=E6=B6=88=E9=99=A4=E9=AD=94=E6=9C=AF?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/style/VanChartPlotLegendPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index acfc7811e1..faa112952d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -337,9 +337,13 @@ public class VanChartPlotLegendPane extends BasicPane { } protected boolean isVisibleLayoutPane() { - int locationIndex = getLegendLocation().getSelectedIndex(); + if (customFloatPositionButton.isSelected()) { + return false; + } + + int locationIntValue = getLegendLocation().getSelectedItem(); - return !getCustomFloatPositionButton().isSelected() && (locationIndex == 0 || locationIndex == 1); + return locationIntValue == Constants.TOP || locationIntValue == Constants.BOTTOM; } //检查显示策略界面是否可用 From 6c59a624a80e90a82d8b9d6be89d8e3f2f0d2df7 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 3 Apr 2020 09:54:05 +0800 Subject: [PATCH 13/88] =?UTF-8?q?REPORT-26941=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=8F=9C=E5=8D=95-=E9=80=89=E9=A1=B9=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=BA=9F=E5=BC=83=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 3fc03f438f..8f88cdeff0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -149,9 +149,6 @@ public class PreferencePane extends BasicPane { private UIColorButton paginationLineColorTBButton; - private UICheckBox supportCellEditorDefCheckBox; - private UICheckBox isDragPermitedCheckBox; - private UITextField logExportDirectoryField; private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; @@ -199,7 +196,6 @@ public class PreferencePane extends BasicPane { createFunctionPane(generalPane); createEditPane(generalPane); - createGuiOfGridPane(generalPane); createColorSettingPane(generalPane); createVcsSettingPane(generalPane); @@ -447,18 +443,6 @@ public class PreferencePane extends BasicPane { } - private void createGuiOfGridPane(JPanel generalPane) { - // GridPane - JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Grid")); - generalPane.add(guiOfGridPane); - - supportCellEditorDefCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Cell_Editor_Definition")); - guiOfGridPane.add(supportCellEditorDefCheckBox); - - isDragPermitedCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Is_Drag_Permited")); - guiOfGridPane.add(isDragPermitedCheckBox); - } - private void createColorSettingPane(JPanel generalPane) { // Color Setting Pane JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors")); @@ -696,9 +680,6 @@ public class PreferencePane extends BasicPane { useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval()); gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); gcButton.setEnabled(gcEnableCheckBox.isSelected()); - supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); - - isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited()); gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); @@ -768,12 +749,8 @@ public class PreferencePane extends BasicPane { designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected()); - designerEnvManager.setSupportCellEditorDef(supportCellEditorDefCheckBox.isSelected()); - designerEnvManager.setAutoCompleteShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : shortCutLabel.getText()); - designerEnvManager.setDragPermited(isDragPermitedCheckBox.isSelected()); - designerEnvManager.setGridLineColor(gridLineColorTBButton.getColor()); designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); From fc7c0f090cf1e38d7b5b2c8a51c273bd62d064b1 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 3 Apr 2020 13:23:20 +0800 Subject: [PATCH 14/88] =?UTF-8?q?CHART-12817=20=E5=85=BC=E5=AE=B9=E6=97=A7?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E4=B8=AD=E7=9A=84=E5=8C=BA=E5=9F=9F=E9=99=90?= =?UTF-8?q?=E5=88=B6=E4=B8=8D=E9=99=90=E5=88=B6=E4=B8=BA=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/VanChartPlotLegendPane.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index faa112952d..5a9d8ebda8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -59,9 +59,8 @@ public class VanChartPlotLegendPane extends BasicPane { private VanChartFloatPositionPane customFloatPositionPane; //区域显示策略 恢复用注释。下面4行删除。 - private UIButtonGroup limitSize; + private UIButtonGroup customSize; private UISpinner maxProportion; - private UILabel limitSizeTitle; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -286,17 +285,16 @@ public class VanChartPlotLegendPane extends BasicPane { private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 maxProportion = new UISpinner(0, 100, 1, 30); - limitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); - limitSizeTitle = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); + customSize = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), customSize); maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); panel.add(maxProportionPane, BorderLayout.CENTER); - limitSize.addActionListener(new ActionListener() { + customSize.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { checkMaxProPortionUse(); @@ -349,7 +347,7 @@ public class VanChartPlotLegendPane extends BasicPane { //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { //区域显示策略 恢复用注释。下面2行删除。 - limitSize.setEnabled(!customFloatPositionButton.isSelected()); + customSize.setEnabled(!customFloatPositionButton.isSelected()); checkMaxProPortionUse(); //区域显示策略 恢复用注释。取消注释。 // GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); @@ -359,7 +357,7 @@ public class VanChartPlotLegendPane extends BasicPane { //区域显示策略 恢复用注释。删除下面方法。 //检查最大显示占比是否可用 private void checkMaxProPortionUse() { - maxProportionPane.setVisible(limitSize.getSelectedIndex() == 1 && limitSize.isEnabled()); + maxProportionPane.setVisible(customSize.getSelectedIndex() == 1 && customSize.isEnabled()); } protected void checkBoxUse() { @@ -392,7 +390,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setFloating(customFloatPositionButton.isSelected()); legend.setLayout(layoutButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 - legend.setLimitSize(limitSize.getSelectedIndex() == 1); + legend.setCustomSize(customSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); //区域显示策略 恢复用注释。取消注释。 //legend.setLimitAttribute(limitPane.updateBean()); @@ -417,7 +415,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); layoutButton.setSelectedItem(legend.getLayout()); //区域显示策略 恢复用注释。下面2行删除。 - limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); + customSize.setSelectedIndex(legend.isCustomSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); From 74f3b0957a4df47b3795b57f3cbdec80e034915c Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Fri, 3 Apr 2020 14:54:12 +0800 Subject: [PATCH 15/88] =?UTF-8?q?REPORT-28697=20=E8=BE=B9=E6=A1=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E9=80=8F=E6=98=8E=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/style/BorderPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/style/BorderPane.java index aa1185f5de..442f301894 100644 --- a/designer-base/src/main/java/com/fr/design/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/style/BorderPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; @@ -69,7 +70,7 @@ public class BorderPane extends BasicPane { private JToggleButton rightToggleButton; private LineComboBox currentLineCombo; - private ColorSelectBox currentLineColorPane; + private NewColorSelectBox currentLineColorPane; private UIButton insidebutton; @@ -88,7 +89,7 @@ public class BorderPane extends BasicPane { verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER); rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); - this.currentLineColorPane = new ColorSelectBox(100); + this.currentLineColorPane = new NewColorSelectBox(100); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); From 74ebe8ddc471fc213c3c4bc5534a376e4b150702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 3 Apr 2020 16:05:30 +0800 Subject: [PATCH 16/88] =?UTF-8?q?CHART-13272=20=E5=9F=8B=E7=82=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5&&=E6=B5=8B=E8=AF=95=E5=9B=BE=E8=A1=A8=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/info/ChartInfo.java | 45 +++++++++++++++++-- .../chart/info/ChartInfoCollector.java | 39 +++++++++++----- .../design/mainframe/chart/ChartEditPane.java | 4 +- .../type/AbstractVanChartTypePane.java | 2 +- .../mainframe/FormCreatorDropTarget.java | 17 +++++-- 5 files changed, 87 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java index 9d305ef1da..69e2c08029 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java @@ -30,6 +30,7 @@ public class ChartInfo extends AbstractPointInfo { private static final String XML_CHART_CONSUMING_MAP = "chartConsumingMap"; private static final String ATTR_TEST_TEMPLATE = "testTemplate"; + private static final String ATTR_TEST_CHART = "testChart"; private static final String ATTR_DAY_COUNT = "day_count"; private static final String ATTR_USERNAME = "username"; private static final String ATTR_UUID = "uuid"; @@ -44,6 +45,11 @@ public class ChartInfo extends AbstractPointInfo { private static final String ATTR_CHART_PROPERTY_END_TIME = "chartPropertyEndTime"; private static final String ATTR_JAR_TIME = "jarTime"; private static final String ATTR_VERSION = "version"; + private static final String ATTR_USER_ID = "userId"; + private static final String ATTR_FIRST_CHART_TYPE = "firstChartType"; + private static final String ATTR_OVER_CHART_TYPE_COUNT = "overChartTypeCount"; + private static final String ATTR_IS_NEW = "isNew"; + private static final String ATTR_IS_REUSE = "isReuse"; private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数 @@ -57,6 +63,8 @@ public class ChartInfo extends AbstractPointInfo { private boolean testTemplate; + private boolean testChart; + private ChartInfo() { } @@ -64,6 +72,7 @@ public class ChartInfo extends AbstractPointInfo { this.chartId = chartId; this.templateId = templateId; this.book = book; + this.testChart = true; } public String getChartId() { @@ -91,13 +100,17 @@ public class ChartInfo extends AbstractPointInfo { @Override public boolean isTestTemplate() { - return testTemplate; + return testTemplate || testChart; } public void setTestTemplate(boolean testTemplate) { this.testTemplate = testTemplate; } + public void setTestChart(boolean testChart) { + this.testChart = testChart; + } + static ChartInfo newInstanceByRead(XMLableReader reader) { ChartInfo chartInfo = new ChartInfo(); reader.readXMLObject(chartInfo); @@ -105,13 +118,14 @@ public class ChartInfo extends AbstractPointInfo { } public static ChartInfo newInstance(String chartId, String chartType) { - return newInstance(chartId, chartType, null); + return newInstance(chartId, chartType, null, false, false); } - public static ChartInfo newInstance(String chartId, String chartType, String createTime) { + public static ChartInfo newInstance(String chartId, String chartType, String createTime, boolean isNew, boolean isReuse) { HashMap chartConsumingMap = new HashMap<>(); String username = MarketConfig.getInstance().getBbsUsername(); + String userId = String.valueOf(MarketConfig.getInstance().getBbsUid()); String uuid = DesignerEnvManager.getEnvManager().getUUID(); String activityKey = DesignerEnvManager.getEnvManager().getActivationKey(); @@ -138,6 +152,11 @@ public class ChartInfo extends AbstractPointInfo { chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); chartConsumingMap.put(ATTR_JAR_TIME, jarTime); chartConsumingMap.put(ATTR_VERSION, version); + chartConsumingMap.put(ATTR_USER_ID, userId); + chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType); + chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, "0"); + chartConsumingMap.put(ATTR_IS_NEW, String.valueOf(isNew)); + chartConsumingMap.put(ATTR_IS_REUSE, String.valueOf(isReuse)); ChartInfo chartInfo = new ChartInfo(chartId, templateId, book); chartInfo.chartConsumingMap = chartConsumingMap; @@ -158,6 +177,7 @@ public class ChartInfo extends AbstractPointInfo { writer.attr(ATTR_DAY_COUNT, this.idleDayCount); } writer.attr(ATTR_TEST_TEMPLATE, this.testTemplate); + writer.attr(ATTR_TEST_CHART, this.testChart); writer.startTAG(XML_CHART_CONSUMING_MAP); writer.attr(ATTR_USERNAME, chartConsumingMap.get(ATTR_USERNAME)); writer.attr(ATTR_UUID, chartConsumingMap.get(ATTR_UUID)); @@ -170,6 +190,11 @@ public class ChartInfo extends AbstractPointInfo { writer.attr(ATTR_CHART_PROPERTY_END_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME)); writer.attr(ATTR_JAR_TIME, chartConsumingMap.get(ATTR_JAR_TIME)); writer.attr(ATTR_VERSION, chartConsumingMap.get(ATTR_VERSION)); + writer.attr(ATTR_USER_ID, chartConsumingMap.get(ATTR_USER_ID)); + writer.attr(ATTR_FIRST_CHART_TYPE, chartConsumingMap.get(ATTR_FIRST_CHART_TYPE)); + writer.attr(ATTR_OVER_CHART_TYPE_COUNT, chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT)); + writer.attr(ATTR_IS_NEW, chartConsumingMap.get(ATTR_IS_NEW)); + writer.attr(ATTR_IS_REUSE, chartConsumingMap.get(ATTR_IS_REUSE)); writer.end(); writer.end(); } @@ -182,6 +207,7 @@ public class ChartInfo extends AbstractPointInfo { chartId = reader.getAttrAsString(ATTR_CHART_ID, StringUtils.EMPTY); templateId = reader.getAttrAsString(ATTR_TEMPLATE_ID, StringUtils.EMPTY); testTemplate = reader.getAttrAsBoolean(ATTR_TEST_TEMPLATE, true); + testChart = reader.getAttrAsBoolean(ATTR_TEST_CHART, false); } else { String name = reader.getTagName(); if (XML_CHART_CONSUMING_MAP.equals(name)) { @@ -198,6 +224,11 @@ public class ChartInfo extends AbstractPointInfo { chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_END_TIME, StringUtils.EMPTY)); chartConsumingMap.put(ATTR_JAR_TIME, reader.getAttrAsString(ATTR_JAR_TIME, StringUtils.EMPTY)); chartConsumingMap.put(ATTR_VERSION, reader.getAttrAsString(ATTR_VERSION, "8.0")); + chartConsumingMap.put(ATTR_USER_ID, reader.getAttrAsString(ATTR_USER_ID, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, reader.getAttrAsString(ATTR_FIRST_CHART_TYPE, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, reader.getAttrAsString(ATTR_OVER_CHART_TYPE_COUNT, "0")); + chartConsumingMap.put(ATTR_IS_NEW, reader.getAttrAsString(ATTR_IS_NEW, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_IS_REUSE, reader.getAttrAsString(ATTR_IS_REUSE, StringUtils.EMPTY)); } } } @@ -231,8 +262,16 @@ public class ChartInfo extends AbstractPointInfo { chartConsumingMap.put(ATTR_CHART_TYPE, chartType); chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, ""); chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); + String count = chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT); + count = StringUtils.isEmpty(count) ? "1" : String.valueOf(Integer.parseInt(count) + 1); + chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, count); } + public void updateFirstType(String chartType) { + chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType); + } + + @Override public ChartInfo clone() { ChartInfo chartInfo = new ChartInfo(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index d622c688a5..b1aec50363 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java @@ -53,21 +53,25 @@ public class ChartInfoCollector extends AbstractPointCollector { } public void collection(ChartProvider chartProvider, String createTime) { + collection(chartProvider, createTime, false); + } + + public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) { if (chartProvider instanceof VanChart) { VanChart vanChart = (VanChart) chartProvider; - collection(vanChart.getUuid(), vanChart.getID(), createTime); + collection(vanChart.getUuid(), vanChart.getID(), createTime, isReuse); } } /** * 新建图表,保存状态 */ - public void collection(String chartId, String chartType, String createTime) { + public void collection(String chartId, String chartType, String createTime, boolean isReuse) { if (!shouldCollectInfo()) { return; } - ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime); + ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime, true, isReuse); chartInfoCacheMap.put(chartId, chartInfo); } @@ -85,7 +89,7 @@ public class ChartInfoCollector extends AbstractPointCollector { if (!shouldCollectInfo()) { return; } - ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); + ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType, null); //更新编辑时间 chartInfo.updatePropertyTime(); @@ -94,22 +98,22 @@ public class ChartInfoCollector extends AbstractPointCollector { chartInfo.resetIdleDayCount(); } - public void updateChartTypeTime(ChartProvider chartProvider) { + public void updateChartTypeTime(ChartProvider chartProvider, String oldType) { if (chartProvider instanceof VanChart) { VanChart vanChart = (VanChart) chartProvider; - updateChartTypeTime(vanChart.getUuid(), vanChart.getID()); + updateChartTypeTime(vanChart.getUuid(), vanChart.getID(), oldType); } } /** * 图表类型变化,更新类型和类型确认时间 */ - public void updateChartTypeTime(String chartId, String chartType) { + public void updateChartTypeTime(String chartId, String chartType, String oldType) { if (!shouldCollectInfo()) { return; } - ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); + ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType, oldType); //更新类型确认时间和类型 chartInfo.updateChartType(chartType); @@ -118,7 +122,7 @@ public class ChartInfoCollector extends AbstractPointCollector { chartInfo.resetIdleDayCount(); } - private ChartInfo getOrCreateChartInfo(String chartId, String chartType) { + private ChartInfo getOrCreateChartInfo(String chartId, String chartType, String oldType) { //缓存中有从缓存中拿 if (chartInfoCacheMap.containsKey(chartId)) { return chartInfoCacheMap.get(chartId); @@ -129,12 +133,27 @@ public class ChartInfoCollector extends AbstractPointCollector { chartInfoCacheMap.put(chartId, chartInfo); return chartInfo; } - //都有的话创建一个并加入到缓存中 + //都没有的话创建一个并加入到缓存中 ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType); + if (StringUtils.isNotEmpty(oldType)) { + chartInfo.updateFirstType(oldType); + } chartInfoCacheMap.put(chartId, chartInfo); return chartInfo; } + public void checkTestChart(ChartProvider chartProvider) { + if (chartProvider instanceof VanChart) { + checkTestChart((VanChart) chartProvider); + } + } + + public void checkTestChart(VanChart vanChart) { + boolean testChart = vanChart.isTestChart(); + ChartInfo chartInfo = chartInfoCacheMap.get(vanChart.getUuid()); + chartInfo.setTestChart(testChart); + } + /** * 保存模板的时候将该模板中的图表埋点信息保存 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 0089785ce2..83e194c71d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -6,7 +6,6 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; @@ -20,9 +19,9 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; @@ -116,6 +115,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare if (!ComparatorUtils.equals(collection, lastCollection)) { try { + ChartInfoCollector.getInstance().checkTestChart(collection.getSelectedChartProvider(ChartProvider.class)); lastCollection = collection.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("error in clone ChartEditPane"); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 36f34c9953..e9395ccb56 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -111,7 +111,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane chartCollections = widget.getChartCollections(); + for (BaseChartCollection baseChartCollection : chartCollections) { + ChartCollection chartCollection = (ChartCollection) baseChartCollection; + for (int i = 0, size = chartCollection.getChartCount(); i < size; i++) { + ChartProvider chart = chartCollection.getChart(i, ChartProvider.class); + //是否是共享的复用组件 + boolean isReuse = StringUtils.isNotEmpty(this.addingModel.getXCreator().getShareId()); + ChartInfoCollector.getInstance().collection(chart, null, isReuse); + ChartInfoCollector.getInstance().checkTestChart(chart); + } } } } From b9708f302f734fdacf9c4bd9818bb30b0bd9764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 3 Apr 2020 17:02:27 +0800 Subject: [PATCH 17/88] =?UTF-8?q?CHART-13272=20=E5=8A=A0=E5=85=A5=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=94=B6=E9=9B=86=E5=9F=8B=E7=82=B9=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/info/ChartInfoCollector.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index b1aec50363..bfc5a0d357 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java @@ -149,6 +149,9 @@ public class ChartInfoCollector extends AbstractPointCollector { } public void checkTestChart(VanChart vanChart) { + if (!shouldCollectInfo()) { + return; + } boolean testChart = vanChart.isTestChart(); ChartInfo chartInfo = chartInfoCacheMap.get(vanChart.getUuid()); chartInfo.setTestChart(testChart); From 61d948b24c129af1c9847adebd8e4e2406614c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 7 Apr 2020 13:49:07 +0800 Subject: [PATCH 18/88] =?UTF-8?q?CHART-13222=20=E8=8B=B1=E6=96=87=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8B=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/data/table/SeriesTypeUseComboxPane.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java index 804ca541ba..4e78591ad1 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java @@ -9,10 +9,12 @@ import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.constants.LayoutConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.gui.UIComponentUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -59,11 +61,16 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { this.add(cardPane, BorderLayout.CENTER); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); - panel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10)); + panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); this.add(panel, BorderLayout.SOUTH); } + protected UIComboBox createComboBox() { + UIComboBox uiComboBox = new UIComboBox(); + UIComponentUtils.setPreferedWidth(uiComboBox, 100); + return uiComboBox; + } /** * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 * @param hasUse 是否使用 From 4646b8e6e19cec3297cc9024e5c4b8dff8a1b598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 7 Apr 2020 16:22:58 +0800 Subject: [PATCH 19/88] =?UTF-8?q?CHART-13274=20&&=20CHART-13285=20?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=85=8D=E8=89=B2=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/combobox/ColorSchemeComboBox.java | 4 ++++ .../chart/gui/style/ChartColorAdjustPane.java | 15 ++++++--------- .../designer/component/VanChartFillStylePane.java | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java index ae076b8f37..9fcbeb2b69 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -14,6 +14,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; @@ -130,6 +131,9 @@ public class ColorSchemeComboBox extends UIComboBox { NORMAL } + public Set getItems() { + return colorSchemes.keySet(); + } public class ColorInfo { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java index 52bde97a6d..b053a5eb9b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java @@ -58,8 +58,6 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { private ChangeListener changeListener; - - public ChartColorAdjustPane() { this(DEFAULT_COLORS); } @@ -70,10 +68,6 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { createContentPane(); } - public void updateColor() { - updateColor(DEFAULT_COLORS); - } - public void updateColor(Color[] colors) { createColorButton(colors); relayout(); @@ -124,8 +118,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { private void createColorButton(Color[] colors) { colorButtons.clear(); - for (Color color : colors) { - colorButtons.add(createColorButton(color)); + int size = Math.min(colors.length, MAX_BUTTON); + for (int i = 0; i < size; i++) { + colorButtons.add(createColorButton(colors[i])); } } @@ -219,7 +214,9 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver { hidePopupMenu(); Color color = ((ColorSelectPane) e.getSource()).getColor(); fireDisplayComponent(ColorBackground.getInstance(color)); - colorButtons.add(createColorButton(color)); + if(colorButtons.size() < MAX_BUTTON) { + colorButtons.add(createColorButton(color)); + } ChartColorAdjustPane.this.stateChanged(); relayout(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index 154ed5557e..c662627965 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -155,7 +155,7 @@ public class VanChartFillStylePane extends BasicBeanPane { @Override public void populateBean(AttrFillStyle condition) { String fillStyleName = condition == null ? "" : condition.getFillStyleName(); - if (StringUtils.isBlank(fillStyleName)) {//兼容处理 + if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {//兼容处理 if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认 } else { From 305e063fd6e153f258a122ffaf866a9ba47a39dd Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 7 Apr 2020 11:55:00 +0800 Subject: [PATCH 20/88] =?UTF-8?q?MOBILE-26026=20=E8=81=94=E6=8E=92?= =?UTF-8?q?=E6=8C=89=E9=92=AETab=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设计器端联排按钮Tab样式配置界面 允许Tab标题栏样式配置界面不显示预览面板 --- .../ui/MobileTemplateStyleDefinePane.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index feb19463da..0f7c3ed15b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -63,14 +63,16 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Wed, 8 Apr 2020 14:21:12 +0800 Subject: [PATCH 21/88] =?UTF-8?q?MOBILE-26026=20=E8=81=94=E6=8E=92?= =?UTF-8?q?=E6=8C=89=E9=92=AETab=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设计器端联排按钮Tab样式配置界面 允许Tab标题栏样式配置界面不显示或重写内置的背景和字体设置 --- .../ui/MobileTemplateStyleDefinePane.java | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index 0f7c3ed15b..7c07aee6fc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -113,18 +113,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Wed, 8 Apr 2020 14:22:30 +0800 Subject: [PATCH 22/88] =?UTF-8?q?MOBILE-26026=20=E8=81=94=E6=8E=92?= =?UTF-8?q?=E6=8C=89=E9=92=AETab=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设计器端联排按钮Tab样式配置界面 --- .../mobile/ui/UniteStyleDefinePane.java | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java new file mode 100644 index 0000000000..722d5f91c5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java @@ -0,0 +1,232 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UnsignedIntUISpinner; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.MobileTabFontConfPane; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; +import com.fr.general.cardtag.mobile.UniteStyle; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; + +public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane { + private static final int SPLIT_LINE_WIDTH = 520; + private static final int SPLIT_LINE_HEIGHT = 20; + + private static final int TOGGLE_BUTTON_WIDTH = 20; + private static final int LABEL_WIDTH = 75; + private static final int LINE_COMPONENT_WIDTH = 157; + private static final int LINE_COMPONENT_HEIGHT = 20; + + private UnsignedIntUISpinner paddingLeftSpinner; + private UnsignedIntUISpinner paddingRightSpinner; + + private ColorSelectBox initialBackgroundColorBox; + private ColorSelectBox selectedBackgroundColorBox; + + private LineComboBox borderWidthComboBox; + private ColorSelectBox borderColorBox; + private UnsignedIntUISpinner borderRadiusSpinner; + + private MobileTabFontConfPane tabFontConfPane; + private UIColorButton selectedFontColorButton; + + public UniteStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + @Override + protected void createBuiltinConfPane(JPanel centerPane) { + // ignore builtin conf pane + } + + @Override + protected void createExtraConfPane(JPanel centerPane) { + UITitleSplitLine paddingSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Padding"), SPLIT_LINE_WIDTH); + paddingSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT)); + centerPane.add(paddingSplit); + centerPane.add(this.createPaddingConfPane()); + + UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Background"), SPLIT_LINE_WIDTH); + backgroundSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT)); + centerPane.add(backgroundSplit); + centerPane.add(this.createBackgroundColorConfPanel()); + + UITitleSplitLine borderSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), SPLIT_LINE_WIDTH); + borderSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT)); + centerPane.add(borderSplit); + centerPane.add(this.createBorderConfPanel()); + + UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), SPLIT_LINE_WIDTH); + fontSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT)); + centerPane.add(fontSplit); + centerPane.add(this.createFontConfPanel()); + } + + private JPanel createPaddingConfPane() { + + this.paddingLeftSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_LEFT); + this.paddingLeftSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT)); + this.paddingRightSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_RIGHT); + this.paddingRightSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT)); + + UILabel paddingLeftLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":", SwingConstants.RIGHT); + paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + UILabel paddingRightLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Right") + ":", SwingConstants.RIGHT); + paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + + JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{ + paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner + }}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + paddingPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20)); + + return paddingPanel; + } + + private JPanel createBackgroundColorConfPanel() { + this.initialBackgroundColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH); + this.initialBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); + this.selectedBackgroundColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH); + this.selectedBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); + + UILabel initialBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill") + ":", SwingConstants.RIGHT); + initialBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + UILabel selectedBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill") + ":", SwingConstants.RIGHT); + selectedBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + + JPanel backgroundColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ + new Component[]{ initialBackgroundColorLabel, initialBackgroundColorBox }, + new Component[]{ selectedBackgroundColorLabel, selectedBackgroundColorBox } + }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + backgroundColorPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20)); + + return backgroundColorPanel; + } + + private JPanel createBorderConfPanel() { + this.borderWidthComboBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + this.borderWidthComboBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); + this.borderColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH); + this.borderColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); + this.borderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_BORDER_RADIUS); + this.borderRadiusSpinner.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); + + UILabel borderSizeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style") + ":", SwingConstants.RIGHT); + borderSizeLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + UILabel borderColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors") + ":", SwingConstants.RIGHT); + borderColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + UILabel borderRadiusLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius") + ":", SwingConstants.RIGHT); + borderRadiusLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + + JPanel borderPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ + new Component[]{ borderSizeLabel, borderWidthComboBox}, + new Component[]{ borderColorLabel, borderColorBox }, + new Component[]{ borderRadiusLabel, borderRadiusSpinner } + }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + borderPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20)); + + return borderPanel; + } + + private JPanel createFontConfPanel() { + this.tabFontConfPane = new MobileTabFontConfPane(); + this.selectedFontColorButton = new UIColorButton(); + this.selectedFontColorButton.setPreferredSize(new Dimension(TOGGLE_BUTTON_WIDTH, LINE_COMPONENT_HEIGHT)); + JPanel selectedFontColorPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + selectedFontColorPanel.add(this.selectedFontColorButton); + + UILabel initialFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char") + ":", SwingConstants.RIGHT); + initialFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + UILabel selectedFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char") + ":", SwingConstants.RIGHT); + selectedFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT)); + + JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ + new Component[]{ initialFontLabel, tabFontConfPane }, + new Component[]{ selectedFontLabel, selectedFontColorPanel } + }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + fontPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20)); + + return fontPanel; + } + + @Override + protected void initDefaultConfig() { + this.paddingLeftSpinner.setValue(UniteStyle.DEFAULT_PADDING_LEFT); + this.paddingRightSpinner.setValue(UniteStyle.DEFAULT_PADDING_RIGHT); + + this.initialBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_INITIAL_BACKGROUND_COLOR); + this.selectedBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_SELECTED_BACKGROUND_COLOR); + + this.borderWidthComboBox.setSelectedLineStyle(UniteStyle.DEFAULT_BORDER_LINE.getLineStyle()); + this.borderColorBox.setSelectObject(UniteStyle.DEFAULT_BORDER_LINE.getColor()); + this.borderRadiusSpinner.setValue(UniteStyle.DEFAULT_BORDER_RADIUS); + + this.tabFontConfPane.populate(UniteStyle.DEFAULT_TAB_FONT.getFont()); + this.selectedFontColorButton.setColor(UniteStyle.DEFAULT_TAB_FONT.getSelectColor()); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return null; + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new UniteStyle(); + } + + @Override + public void populateSubStyle(MobileTemplateStyle ob) { + UniteStyle style = (UniteStyle) ob; + this.paddingLeftSpinner.setValue(style.getPaddingLeft()); + this.paddingRightSpinner.setValue(style.getPaddingRight()); + + this.initialBackgroundColorBox.setSelectObject(style.getInitialColor()); + this.selectedBackgroundColorBox.setSelectObject(style.getSelectColor()); + + this.borderWidthComboBox.setSelectedLineStyle(style.getBorderWidth()); + this.borderColorBox.setSelectObject(style.getBorderColor()); + this.borderRadiusSpinner.setValue(style.getBorderRadius()); + + this.tabFontConfPane.populate(style.getTabFontConfig().getFont()); + this.selectedFontColorButton.setColor(style.getTabFontConfig().getSelectColor()); + } + + @Override + public MobileTemplateStyle updateSubStyle() { + UniteStyle style = new UniteStyle(); + style.setPaddingLeft((int) this.paddingLeftSpinner.getValue()); + style.setPaddingRight((int) this.paddingRightSpinner.getValue()); + + style.setInitialColor(this.initialBackgroundColorBox.getSelectObject()); + style.setSelectColor(this.selectedBackgroundColorBox.getSelectObject()); + + style.setBorderWidth(this.borderWidthComboBox.getSelectedLineStyle()); + style.setBorderColor(this.borderColorBox.getSelectObject()); + style.setBorderRadius((int) this.borderRadiusSpinner.getValue()); + + TabFontConfig config = new TabFontConfig(); + config.setFont(this.tabFontConfPane.update()); + config.setSelectColor(this.selectedFontColorButton.getColor()); + style.setTabFontConfig(config); + + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} From 15110f30db634069f40c675791f632d6eb2b6fbb Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 8 Apr 2020 14:25:05 +0800 Subject: [PATCH 23/88] =?UTF-8?q?MOBILE-26026=20=E8=81=94=E6=8E=92?= =?UTF-8?q?=E6=8C=89=E9=92=AETab=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将设计器端联排按钮Tab样式配置界面加入到设计器内置的Tab标题栏样式组中 --- .../mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java | 2 ++ .../mainframe/widget/accessibles/MobileTemplateStylePane.java | 1 + 2 files changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java index dab5a03ba7..16cfe4995d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -7,6 +7,7 @@ import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.SliderStyle; import com.fr.general.cardtag.mobile.UpMenuStyle; +import com.fr.general.cardtag.mobile.UniteStyle; import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import java.util.HashMap; @@ -20,6 +21,7 @@ public class TemplateStyleDefinePaneFactory { defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class)); defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class)); defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class)); + defineMap.put(UniteStyle.STYLE_NAME, new StyleDefinePaneUI(UniteStyleDefinePane.class)); } public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 9c52673d7f..38f70de814 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -35,6 +35,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane Date: Thu, 9 Apr 2020 14:19:04 +0800 Subject: [PATCH 24/88] bugfix --- .../design/widget/ui/designer/mobile/ElementCaseDefinePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java index 31c29d72e5..723616280c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java @@ -107,9 +107,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox}, createComponents(), - new Component[] {heightRestrictCheckBox, null}, new Component[] {allowFullCheckBox, null}, new Component[] {functionalWhenUnactivatedCheckBox, null}, + new Component[] {heightRestrictCheckBox, null}, new Component[] {maxHeightLabel, maxHeightSpinner} }; double f = TableLayout.FILL; From fd15016024ee9bf2a25b5b35946e97458d5f98c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Thu, 9 Apr 2020 15:28:33 +0800 Subject: [PATCH 25/88] =?UTF-8?q?CHART-12791=20=E5=8E=BB=E6=8E=89=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E4=B8=AD=E7=9A=84=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/info/ChartInfoCollector.java | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index bfc5a0d357..5b76b197c3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java @@ -7,7 +7,6 @@ import com.fr.design.mainframe.template.info.TemplateInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -57,36 +56,29 @@ public class ChartInfoCollector extends AbstractPointCollector { } public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) { - if (chartProvider instanceof VanChart) { - VanChart vanChart = (VanChart) chartProvider; - collection(vanChart.getUuid(), vanChart.getID(), createTime, isReuse); - } + collection(chartProvider.getChartUuid(), chartProvider.getID(), createTime, isReuse); } /** * 新建图表,保存状态 */ public void collection(String chartId, String chartType, String createTime, boolean isReuse) { - if (!shouldCollectInfo()) { + if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) { return; } - ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime, true, isReuse); chartInfoCacheMap.put(chartId, chartInfo); } public void updateChartPropertyTime(ChartProvider chartProvider) { - if (chartProvider instanceof VanChart) { - VanChart vanChart = (VanChart) chartProvider; - updateChartPropertyTime(vanChart.getUuid(), vanChart.getID()); - } + updateChartPropertyTime(chartProvider.getChartUuid(), chartProvider.getID()); } /** * 图表编辑,更新编辑时间 */ public void updateChartPropertyTime(String chartId, String chartType) { - if (!shouldCollectInfo()) { + if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) { return; } ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType, null); @@ -99,17 +91,14 @@ public class ChartInfoCollector extends AbstractPointCollector { } public void updateChartTypeTime(ChartProvider chartProvider, String oldType) { - if (chartProvider instanceof VanChart) { - VanChart vanChart = (VanChart) chartProvider; - updateChartTypeTime(vanChart.getUuid(), vanChart.getID(), oldType); - } + updateChartTypeTime(chartProvider.getChartUuid(), chartProvider.getID(), oldType); } /** * 图表类型变化,更新类型和类型确认时间 */ public void updateChartTypeTime(String chartId, String chartType, String oldType) { - if (!shouldCollectInfo()) { + if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) { return; } @@ -143,18 +132,14 @@ public class ChartInfoCollector extends AbstractPointCollector { } public void checkTestChart(ChartProvider chartProvider) { - if (chartProvider instanceof VanChart) { - checkTestChart((VanChart) chartProvider); - } - } - - public void checkTestChart(VanChart vanChart) { if (!shouldCollectInfo()) { return; } - boolean testChart = vanChart.isTestChart(); - ChartInfo chartInfo = chartInfoCacheMap.get(vanChart.getUuid()); - chartInfo.setTestChart(testChart); + ChartInfo chartInfo = chartInfoCacheMap.get(chartProvider.getChartUuid()); + if (chartInfo != null) { + boolean testChart = chartProvider.isTestChart(); + chartInfo.setTestChart(testChart); + } } /** From 50d3d79a18a4f21f38001c5f81db30eb1e6833e2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 9 Apr 2020 16:39:01 +0800 Subject: [PATCH 26/88] =?UTF-8?q?MOBILE-26390=20=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=A0=B7=E5=BC=8F=E8=AE=BE=E7=BD=AE=E4=BA=86?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=EF=BC=8C=E5=AE=9E=E9=99=85=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 区分线型和线宽 --- .../SidebarMobileBookMarkStyleCustomDefinePane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java index 79bab33dfc..66358a30e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java @@ -145,7 +145,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane Date: Thu, 9 Apr 2020 17:29:26 +0800 Subject: [PATCH 27/88] REPORT-29539 && REPORT-29457 --- .../src/main/java/com/fr/design/EnvChangeEntrance.java | 4 ++++ .../src/main/java/com/fr/design/i18n/DesignI18nImpl.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 81e62239b4..f16cdd5047 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -404,6 +404,10 @@ public class EnvChangeEntrance { * 处理异常 */ public void dealEvnExceptionWhenStartDesigner() { + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } final EnvListPane envListPane = new EnvListPane(); envListPane.populateEnvManager(currentEnvName); BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java index 176d6ec3c1..6e4fa7d3b0 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java @@ -1,5 +1,6 @@ package com.fr.design.i18n; +import com.fr.design.DesignerEnvManager; import com.fr.general.GeneralContext; import com.fr.general.log.MessageFormatter; import com.fr.locale.DesignI18nProvider; @@ -29,7 +30,7 @@ public class DesignI18nImpl implements DesignI18nProvider { @Override public String i18nText(String key) { - return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key); + return localeManager.getLocalBundle(DesignerEnvManager.getEnvManager().getLanguage()).getText(localeManager, key); } @Override From daadcdc0fe30b1a0ee70ea3c15e429dc5344d8b0 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 9 Apr 2020 23:11:39 +0800 Subject: [PATCH 28/88] =?UTF-8?q?MOBILE-26026=20=E8=81=94=E6=8E=92?= =?UTF-8?q?=E6=8C=89=E9=92=AETab=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设计器端区分线型和线宽 --- .../fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java index 722d5f91c5..2f269b028d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java @@ -196,7 +196,7 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane { this.initialBackgroundColorBox.setSelectObject(style.getInitialColor()); this.selectedBackgroundColorBox.setSelectObject(style.getSelectColor()); - this.borderWidthComboBox.setSelectedLineStyle(style.getBorderWidth()); + this.borderWidthComboBox.setSelectedLineStyle(style.getBorderLineStyle()); this.borderColorBox.setSelectObject(style.getBorderColor()); this.borderRadiusSpinner.setValue(style.getBorderRadius()); @@ -213,7 +213,7 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane { style.setInitialColor(this.initialBackgroundColorBox.getSelectObject()); style.setSelectColor(this.selectedBackgroundColorBox.getSelectObject()); - style.setBorderWidth(this.borderWidthComboBox.getSelectedLineStyle()); + style.setBorderLineStyle(this.borderWidthComboBox.getSelectedLineStyle()); style.setBorderColor(this.borderColorBox.getSelectObject()); style.setBorderRadius((int) this.borderRadiusSpinner.getValue()); From 1ad716365b7decd75dc0c971a61be6fcc4050f61 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 10 Apr 2020 10:07:02 +0800 Subject: [PATCH 29/88] =?UTF-8?q?REPORT-28415=2010.0=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=B8=86=E8=BD=AF=E6=9C=8D=E5=8A=A1=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/help/AboutPane.java | 10 +-- .../fr/design/extra/PluginOperateUtils.java | 22 +++-- .../java/com/fr/design/extra/PluginUtils.java | 86 +++++++++++-------- .../mainframe/InformationCollector.java | 3 + .../fr/design/mainframe/bbs/BBSConstants.java | 2 +- .../errorinfo/ErrorInfoUploader.java | 23 +++-- 6 files changed, 91 insertions(+), 55 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index b8acba9fe2..3ede159504 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -72,11 +72,11 @@ public class AboutPane extends JPanel { addPhoneAndQQPane(contentPane); // 官网 - JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); + JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); // 支持邮箱 - String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); - JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail)); + String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL); + JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireConf("support.email." + GeneralContext.getLocale(), defaultEmail)); contentPane.add(urlActionPane); contentPane.add(emailPane); @@ -96,7 +96,7 @@ public class AboutPane extends JPanel { if (GeneralContext.getLocale().equals(Locale.US)) { return; } - boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); + boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireConf("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); contentPane.add(boxCenterAlignmentPane); // 繁体版不显示QQ if (GeneralContext.getLocale().equals(Locale.TAIWAN)) { @@ -176,7 +176,7 @@ public class AboutPane extends JPanel { private String getCopyRight() { return append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_CopyRight"), COPYRIGHT_LABEL, - ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); + ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireConf("company.name", ProductConstants.COMPANY_NAME)); } private String getBuildTitle() { diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index 4b0edb979f..801b4e369a 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -1,10 +1,10 @@ package com.fr.design.extra; import com.fr.config.MarketConfig; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback; -import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.extra.exe.callback.UninstallPluginCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; @@ -13,6 +13,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; +import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; @@ -25,9 +26,9 @@ import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; import com.fr.stable.StringUtils; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; +import javax.swing.*; import java.io.File; +import java.net.HttpURLConnection; import java.util.List; @@ -110,13 +111,18 @@ public class PluginOperateUtils { public static String getRecommendPlugins() { String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); JSONArray resultArray = JSONArray.create(); + if (StringUtils.isBlank(plistUrl)) { + return resultArray.toString(); + } try { HttpClient httpClient = new HttpClient(plistUrl); - String result = httpClient.getResponseText(); - JSONArray jsonArray = new JSONArray(result); - resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { + String result = httpClient.getResponseText(); + JSONArray jsonArray = new JSONArray(result); + resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); + } + } catch (JSONException e) { + FineLoggerFactory.getLogger().info(e.getMessage(), e); } return resultArray.toString(); } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java index d1997684f6..bec02a200e 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java @@ -2,6 +2,7 @@ package com.fr.design.extra; import com.fr.base.TemplateUtils; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; @@ -12,8 +13,8 @@ import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginMarker; -import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginBaseErrorCode; +import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.manage.PluginManager; import com.fr.plugin.view.PluginView; import com.fr.stable.EncodeConstants; @@ -21,11 +22,12 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import javax.swing.JOptionPane; +import javax.swing.*; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URLDecoder; import java.text.SimpleDateFormat; @@ -38,7 +40,7 @@ import java.util.Map; * Created by ibm on 2017/5/25. */ public class PluginUtils { - + private static final String ERROR_CODE_I18N_PREFIX = "FR-Plugin_Error_"; public static final String FR_VERSION = "fr_version"; @@ -46,8 +48,7 @@ public class PluginUtils { public static PluginMarker createPluginMarker(String pluginInfo) { //todo 判空 String[] plugin = pluginInfo.split("_"); - PluginMarker pluginMarker = PluginMarker.create(plugin[0], plugin[1]); - return pluginMarker; + return PluginMarker.create(plugin[0], plugin[1]); } public static JSONObject getLatestPluginInfo(String pluginID) throws Exception { @@ -90,7 +91,11 @@ public class PluginUtils { InputStream reader = null; FileOutputStream writer = null; try { - HttpClient httpClient = new HttpClient(getDownloadPath(id)); + String downloadPath = getDownloadPath(id); + if (StringUtils.isBlank(downloadPath)) { + throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error")); + } + HttpClient httpClient = new HttpClient(downloadPath); if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { int totalSize = httpClient.getContentLength(); reader = httpClient.getResponseStream(); @@ -108,12 +113,12 @@ public class PluginUtils { p.process(totalBytesRead / (double) totalSize); } } else { - throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error")); + throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error")); } } catch (PluginVerifyException e) { FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); return false; - } catch (Exception e) { + } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; } finally { @@ -122,7 +127,7 @@ public class PluginUtils { return true; } - private static void closeStream(InputStream reader, FileOutputStream writer){ + private static void closeStream(InputStream reader, FileOutputStream writer) { try { if (null != reader) { reader.close(); @@ -136,18 +141,26 @@ public class PluginUtils { } } - private static String getDownloadPath(String id) throws Exception { - HashMap map = new HashMap(); - map.put("id", id); - HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.script.download")+ "?" + FR_VERSION + "=" + ProductConstants.VERSION); + private static String getDownloadPath(String id) { + String url = CloudCenter.getInstance().acquireUrlByKind("shop.script.download"); + if (StringUtils.isBlank(url)) { + return StringUtils.EMPTY; + } + HttpClient httpClient = new HttpClient(url + "?" + FR_VERSION + "=" + ProductConstants.VERSION); httpClient.asGet(); - String resText = httpClient.getResponseText(); - JSONObject resultJSONObject = new JSONObject(resText); - String scriptUrl = resultJSONObject.optString("result"); - String charSet = EncodeConstants.ENCODING_UTF_8; - scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet); - - return scriptUrl; + if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { + String resText = httpClient.getResponseText(); + JSONObject resultJSONObject = new JSONObject(resText); + String scriptUrl = resultJSONObject.optString("result"); + String charSet = EncodeConstants.ENCODING_UTF_8; + try { + scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet); + } catch (UnsupportedEncodingException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return scriptUrl; + } + return StringUtils.EMPTY; } public static boolean isPluginMatch(PluginView pluginView, String text) { @@ -194,22 +207,22 @@ public class PluginUtils { return StringUtils.EMPTY; } } - + public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) { - if(errorCode == PluginErrorCode.None){ + if (errorCode == PluginErrorCode.None) { return ""; } - + return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode)); } - + private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) { - - return errorCode.getDescription(); + + return errorCode.getDescription(); } - + public static PluginMarker getInstalledPluginMarkerByID(String pluginID) { - + PluginContext context = PluginManager.getContext(pluginID); if (context != null) { return context.getMarker(); @@ -219,29 +232,30 @@ public class PluginUtils { /** * 在不同设计器版本下展示不同插件 + * * @return 插件 */ - public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) throws Exception{ - JSONArray resultJSONArray = JSONArray.create(); - for(int i = 0; i < oriJSONArray.length(); i++){ + public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) { + JSONArray resultJSONArray = JSONArray.create(); + for (int i = 0; i < oriJSONArray.length(); i++) { JSONObject jo = oriJSONArray.getJSONObject(i); String envVersion = jo.optString("envversion"); - if(isCompatibleCurrentEnv(envVersion)){ + if (isCompatibleCurrentEnv(envVersion)) { resultJSONArray.put(jo); } } return resultJSONArray; } - private static boolean isCompatibleCurrentEnv(String envVersion){ + private static boolean isCompatibleCurrentEnv(String envVersion) { return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); } - public static JSONArray transferStorePluginToJson(PluginContext [] pluginContexts){ + public static JSONArray transferStorePluginToJson(PluginContext[] pluginContexts) { JSONArray ja = JSONArray.create(); try { - for(PluginContext pluginContext : pluginContexts){ + for (PluginContext pluginContext : pluginContexts) { JSONObject jo = JSONObject.create(); jo.put("id", pluginContext.getID()); jo.put("name", pluginContext.getName()); @@ -265,7 +279,7 @@ public class PluginUtils { jo.put("switchedReason", pluginContext.getSwitchedReason()); ja.put(jo); } - }catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return ja; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index b4b43cafd9..b0e8066578 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -198,6 +198,9 @@ public class InformationCollector implements XMLReadable, XMLWriter { } JSONObject content = getJSONContentAsByte(); String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); + if (StringUtils.isBlank(url)) { + return; + } boolean success = false; try { HashMap para = new HashMap<>(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java index 5e12f224f9..ea99f70e4d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java @@ -64,7 +64,7 @@ public class BBSConstants { } private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { - String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue); + String guest = CloudCenter.getInstance().acquireConf(key, defaultValue); if (StringUtils.isNotEmpty(guest)) { return guest.split("\\|"); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java index e22e1059ed..81da862123 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java @@ -17,6 +17,7 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import java.io.File; import java.io.FileInputStream; @@ -100,7 +101,10 @@ public class ErrorInfoUploader { private void downloadSolution(File localCacheZip) { try { - String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution"); + String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download"); + if (StringUtils.isBlank(downloadURL)) { + return; + } downloadURL = String.format("%s?token=%s", downloadURL, SiteCenterToken.generateToken()); InputStream in = HttpToolbox.post(downloadURL, new HashMap(), HttpResponseType.STREAM); StableUtils.makesureFileExist(localCacheZip); @@ -119,7 +123,10 @@ public class ErrorInfoUploader { private boolean needUpdate(File localCacheZip) { if (localCacheZip.exists()) { // 判断本地文件大小. - String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/solution/cache/check"); + String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check"); + if (StringUtils.isBlank(checkURL)) { + return false; + } checkURL = String.format("%s?token=%s", checkURL, SiteCenterToken.generateToken()); try { JSONObject res = new JSONObject(HttpToolbox.get(checkURL)); @@ -143,6 +150,9 @@ public class ErrorInfoUploader { } File[] files = folder.listFiles(); + if (files == null) { + return; + } if (ArrayUtils.getLength(files) > MAX_ERROR_SIZE) { CommonIOUtils.deleteFile(folder); return; @@ -166,9 +176,12 @@ public class ErrorInfoUploader { } jsonArray.put(new JSONObject(content)); tempFiles.add(file); - if( jsonArray.length() == MAX_ITEMS || count == files.length){ + if (jsonArray.length() == MAX_ITEMS || count == files.length) { String url = CloudCenter.getInstance().acquireUrlByKind("design.error"); - if(sendErrorInfo(url, jsonArray)){ + if (StringUtils.isBlank(url)) { + return; + } + if (sendErrorInfo(url, jsonArray)) { deleteFiles(tempFiles); } jsonArray = new JSONArray(); @@ -182,7 +195,7 @@ public class ErrorInfoUploader { } private void deleteFiles(List files) { - for(File file : files) { + for (File file : files) { CommonIOUtils.deleteFile(file); } } From ef24b120a9e7d6d41d3db1788105411a4bc52b37 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 23 Mar 2020 10:59:47 +0800 Subject: [PATCH 30/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20ui=20=E7=95=8C=E9=9D=A2=201=E3=80=81=20?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=BB=84=E4=BB=B6=E5=BA=93=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=202=E3=80=81=20=E5=B0=8F=E5=9C=86=E7=82=B9=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 22 +- .../fun/ComponentLibraryPaneProcessor.java | 31 ++ ...AbstractComponentLibraryPaneProcessor.java | 25 ++ .../com/fr/design/gui/imenu/UIMenuItem.java | 75 +--- .../com/fr/design/gui/imenu/UIMenuItemUI.java | 81 ++++ .../mainframe/toolbar/ToolBarMenuDock.java | 20 +- .../main/java/com/fr/design/menu/MenuDef.java | 35 +- .../com/fr/design/menu/SnapChatMenuDef.java | 161 +++++++ .../fr/design/menu/SnapChatMenuItemUI.java | 31 ++ .../com/fr/design/menu/SnapChatMenuUI.java | 29 ++ .../fr/design/menu/SnapChatUpdateAction.java | 74 ++++ .../java/com/fr/design/menu/SnapChatUtil.java | 33 ++ .../com/fr/design/notification/SnapChat.java | 28 ++ .../design/notification/SnapChatAllTypes.java | 38 ++ .../design/notification/SnapChatConfig.java | 88 ++++ .../fr/design/notification/SnapChatKey.java | 9 + .../mainframe/FormWidgetDetailPane.java | 391 ++--------------- .../component/ComponentLibraryManager.java | 23 + .../pane/ComponentLibraryPaneCreator.java | 68 +++ .../ComponentLibraryPaneProcessorImpl.java | 412 ++++++++++++++++++ 20 files changed, 1229 insertions(+), 445 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChat.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 77c779ce3e..9cb45918c1 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -18,6 +18,7 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; +import com.fr.design.notification.SnapChatConfig; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; @@ -161,6 +162,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * alphafine */ private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); + + /** + * 阅后即焚的配置项 + */ + private SnapChatConfig snapChatConfig = SnapChatConfig.getInstance(); private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); @@ -1562,11 +1568,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { readVcsAttr(reader); } else if (DesignerPort.XML_TAG.equals(name)) { readDesignerPort(reader); + }else if (name.equals(SnapChatConfig.XML_TAG)) { + readSnapChatConfig(reader); } else { readLayout(reader, name); } } } + + private void readSnapChatConfig(XMLableReader reader) { + reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance()); + } private void readAlphaFineAttr(XMLableReader reader) { reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance()); @@ -1783,9 +1795,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writeDesignerPushUpdateAttr(writer); writeVcsAttr(writer); writeDesignerPort(writer); + writeSnapChatConfig(writer); writer.end(); } - + + private void writeSnapChatConfig(XMLPrintWriter writer) { + + if (this.snapChatConfig != null) { + this.snapChatConfig.writeXML(writer); + } + } + private void writeAlphaFineAttr(XMLPrintWriter writer) { if (this.alphaFineConfigManager != null) { this.alphaFineConfigManager.writeXML(writer); diff --git a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java new file mode 100644 index 0000000000..88385a11b1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.DockingView; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JPanel; + +/** + * created by Harrison on 2020/03/16 + **/ +public interface ComponentLibraryPaneProcessor extends Immutable { + + String XML_TAG = "ParameterExpandablePaneUIProvider"; + + int CURRENT_LEVEL = 1; + + UIScrollPane createShowPanel(boolean isEdit); + + JPanel createMenuNorthPane(); + + UIComboBox createMenuComBox(); + + void parentView(DockingView dockingView); + + void parentPane(JPanel panel); + + void complete(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java new file mode 100644 index 0000000000..f376ad7887 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; +import com.fr.stable.fun.mark.Layer; + +/** + * created by Harrison on 2020/03/16 + **/ +@API(level = ComponentLibraryPaneProcessor.CURRENT_LEVEL) +public abstract class AbstractComponentLibraryPaneProcessor extends AbstractProvider implements ComponentLibraryPaneProcessor { + + @Override + public int currentAPILevel() { + + return ComponentLibraryPaneProcessor.CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + + return Layer.DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java index 37f1fe0528..3230dbda21 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java @@ -1,15 +1,11 @@ package com.fr.design.gui.imenu; -import java.awt.*; - -import javax.swing.*; -import javax.swing.plaf.basic.BasicMenuItemUI; - import com.fr.design.constants.UIConstants; -import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUIPaintUtils; -import sun.swing.SwingUtilities2; + +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.JMenuItem; public class UIMenuItem extends JMenuItem{ public UIMenuItem() { @@ -42,66 +38,5 @@ public class UIMenuItem extends JMenuItem{ public String getText() { return StringUtils.BLANK + super.getText(); } - - private class UIMenuItemUI extends BasicMenuItemUI { - @Override - protected void paintBackground(Graphics g, JMenuItem menuItem,Color bgColor) { - if(menuItem.getIcon() == null) { - super.paintBackground(g, menuItem, bgColor); - return; - } - ButtonModel model = menuItem.getModel(); - Color oldColor = g.getColor(); - int menuWidth = menuItem.getWidth(); - int menuHeight = menuItem.getHeight(); - - g.setColor(UIConstants.NORMAL_BACKGROUND); - g.fillRect(0, 0, menuWidth, menuHeight); - if(menuItem.isOpaque()) { - if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) { - GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); - } else { - GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); - } - g.setColor(oldColor); - } - else if (model.isArmed() || (menuItem instanceof JMenu && - model.isSelected())) { - GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); - g.setColor(oldColor); - } - } - - protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { - ButtonModel model = menuItem.getModel(); - FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g); - int mnemIndex = menuItem.getDisplayedMnemonicIndex(); - - if(!model.isEnabled()) { - // *** paint the text disabled - if ( UIManager.get("MenuItem.disabledForeground") instanceof Color ) { - g.setColor( UIManager.getColor("MenuItem.disabledForeground") ); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x, textRect.y + fm.getAscent()); - } else { - g.setColor(menuItem.getBackground().brighter()); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, - -1, textRect.x, textRect.y + fm.getAscent()); - g.setColor(menuItem.getBackground().darker()); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x - 1, textRect.y + - fm.getAscent() - 1); - } - } else { - // *** paint the text normally - if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) { - g.setColor(Color.WHITE); // Uses protected field. - } - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x, textRect.y + fm.getAscent()); - } - } - - } - + } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java new file mode 100644 index 0000000000..0d883abfbf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java @@ -0,0 +1,81 @@ +package com.fr.design.gui.imenu; + +import com.fr.design.constants.UIConstants; +import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.Constants; +import sun.swing.SwingUtilities2; + +import javax.swing.ButtonModel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.UIManager; +import javax.swing.plaf.basic.BasicMenuItemUI; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +public class UIMenuItemUI extends BasicMenuItemUI { + + @Override + protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { + if (menuItem.getIcon() == null) { + super.paintBackground(g, menuItem, bgColor); + return; + } + ButtonModel model = menuItem.getModel(); + Color oldColor = g.getColor(); + int menuWidth = menuItem.getWidth(); + int menuHeight = menuItem.getHeight(); + + g.setColor(UIConstants.NORMAL_BACKGROUND); + g.fillRect(0, 0, menuWidth, menuHeight); + if (menuItem.isOpaque()) { + if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { + GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + } else { + GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); + } + g.setColor(oldColor); + } else if (model.isArmed() || (menuItem instanceof JMenu && + model.isSelected())) { + GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + g.setColor(oldColor); + } + } + + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + ButtonModel model = menuItem.getModel(); + FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g); + int mnemIndex = menuItem.getDisplayedMnemonicIndex(); + + if (!model.isEnabled()) { + // *** paint the text disabled + if (UIManager.get("MenuItem.disabledForeground") instanceof Color) { + g.setColor(UIManager.getColor("MenuItem.disabledForeground")); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + } else { + g.setColor(menuItem.getBackground().brighter()); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + g.setColor(menuItem.getBackground().darker()); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x - 1, textRect.y + + fm.getAscent() - 1); + } + } else { + // *** paint the text normally + if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { + g.setColor(Color.WHITE); // Uses protected field. + } + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index cdafa8c410..bc4b85ced8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -12,7 +12,6 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.BugAction; import com.fr.design.actions.community.CenterAction; -import com.fr.design.actions.community.CusDemandAction; import com.fr.design.actions.community.FacebookFansAction; import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.QuestionAction; @@ -53,7 +52,9 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; +import com.fr.design.menu.SnapChatMenuDef; import com.fr.design.menu.ToolBarDef; +import com.fr.design.notification.SnapChatAllTypes; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -563,15 +564,24 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); shortCuts.add(new QuestionAction()); shortCuts.add(new TechSolutionAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new BugAction()); shortCuts.add(new NeedAction()); - shortCuts.add(new CusDemandAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); LocaleCenter.buildAction(new LocaleAction() { @@ -594,7 +604,11 @@ public abstract class ToolBarMenuDock { } public MenuDef createCommunityMenuDef() { - MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C'); + + MenuDef menuDef = new SnapChatMenuDef( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), + 'C', + SnapChatAllTypes.Menu.BBS); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); for (ShortCut shortCut : otherCommunityShortCuts) { menuDef.addShortCut(shortCut); diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index c18749c12c..f495e03f13 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -38,8 +38,8 @@ public class MenuDef extends ShortCut { protected UIMenu createdJMenu; protected UIButton createdButton; protected JPopupMenu popupMenu; - private boolean hasScrollSubMenu; - private boolean isHeadMenu; + protected boolean hasScrollSubMenu; + protected boolean isHeadMenu; private String anchor; @@ -187,18 +187,13 @@ public class MenuDef extends ShortCut { */ public UIMenu createJMenu() { if (createdJMenu == null) { - if (hasScrollSubMenu) { - createdJMenu = new UIScrollMenu(this.getName()); - } else if (isHeadMenu){ - createdJMenu = new UIHeadMenu(this.getName()); - } else { - createdJMenu = new UIMenu(this.getName()); - } + createdJMenu = createJMenu0(); createdJMenu.setMnemonic(this.getMnemonic()); if (this.iconPath != null) { createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); } - createdJMenu.addMenuListener(menuDefListener); + MenuListener menuListener = createMenuListener(); + createdJMenu.addMenuListener(menuListener); ContainerListener listener = getContainerListener(); if (listener != null) { createdJMenu.getPopupMenu().addContainerListener(listener); @@ -207,7 +202,20 @@ public class MenuDef extends ShortCut { return createdJMenu; } - + + protected UIMenu createJMenu0() { + + UIMenu createdJMenu; + if (hasScrollSubMenu) { + createdJMenu = new UIScrollMenu(this.getName()); + } else if (isHeadMenu){ + createdJMenu = new UIHeadMenu(this.getName()); + } else { + createdJMenu = new UIMenu(this.getName()); + } + return createdJMenu; + } + protected ContainerListener getContainerListener() { return null; } @@ -377,6 +385,11 @@ public class MenuDef extends ShortCut { public void intoJToolBar(JToolBar toolBar) { toolBar.add(this.createUIButton()); } + + protected MenuListener createMenuListener() { + + return menuDefListener; + } private MenuListener menuDefListener = new MenuListener() { diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java new file mode 100644 index 0000000000..473c17f251 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -0,0 +1,161 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenu; +import com.fr.design.gui.imenu.UIScrollMenu; +import com.fr.design.notification.SnapChat; +import com.fr.design.notification.SnapChatConfig; +import com.fr.design.notification.SnapChatKey; + +import javax.swing.JMenu; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; + +/** + * created by Harrison on 2020/03/16 + **/ +public class SnapChatMenuDef extends MenuDef implements SnapChat { + + private SnapChatKey uniqueKey; + private SnapChatMenuUI menuUI = new SnapChatMenuUI(this); + + public SnapChatMenuDef(String name, SnapChatKey uniqueKey) { + super(name); + this.uniqueKey = uniqueKey; + } + + public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) { + super(rePaint); + this.uniqueKey = uniqueKey; + } + + public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) { + super(name, mnemonic); + this.uniqueKey = uniqueKey; + } + + @Override + public boolean hasRead() { + + String calcKey = calcKey(); + return SnapChatConfig.getInstance().hasRead(calcKey); + } + + @Override + public void markRead() { + + String calcKey = calcKey(); + SnapChatConfig.getInstance().markRead(calcKey); + } + + @Override + public SnapChatKey key() { + + return this.uniqueKey; + } + + @Override + protected MenuListener createMenuListener() { + + return new SnapChatMenuListener(); + } + + private String calcKey() { + + return key().calc(); + } + + @Override + protected UIMenu createJMenu0() { + + UIMenu createdJMenu; + if (hasScrollSubMenu) { + createdJMenu = new SnapChatUIScrollMenu(this.getName()); + } else if (isHeadMenu){ + createdJMenu = new SnapChatUIHeadMenu(this.getName()); + } else { + createdJMenu = new SnapChatUIMenu(this.getName()); + } + return createdJMenu; + } + + private class SnapChatMenuListener implements MenuListener { + + @Override + public void menuSelected(MenuEvent e) { + + markRead(); + Object source = e.getSource(); + if (!(source instanceof JMenu)) { + return; + } + updateMenu(); + } + + @Override + public void menuDeselected(MenuEvent e) { + + } + + @Override + public void menuCanceled(MenuEvent e) { + + } + } + + private class SnapChatUIScrollMenu extends UIScrollMenu { + + public SnapChatUIScrollMenu(String s) { + super(s); + } + + @Override + public void updateUI() { + setUI(menuUI); + } + } + + private class SnapChatUIMenu extends UIMenu { + + public SnapChatUIMenu(String name) { + + super(name); + } + + @Override + public void updateUI() { + + setUI(menuUI); + } + } + + private class SnapChatUIHeadMenu extends UIMenu { + + public SnapChatUIHeadMenu(String name) { + + super(name); + } + + @Override + public void updateUI() { + + setUI(menuUI); + } + } + + public static void main(String[] args) { + + BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.green); + Ellipse2D.Double shape = + new Ellipse2D.Double(2, 2, 1, 1); + g2d.fill(shape); + g2d.draw(shape); + System.out.println(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java new file mode 100644 index 0000000000..c9ab8532d2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java @@ -0,0 +1,31 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenuItemUI; + +import javax.swing.JMenuItem; +import java.awt.Graphics; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +class SnapChatMenuItemUI extends UIMenuItemUI { + + private final SnapChatUpdateAction snapChatUpdateAction; + + public SnapChatMenuItemUI(SnapChatUpdateAction snapChatUpdateAction) { + + this.snapChatUpdateAction = snapChatUpdateAction; + } + + @Override + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + + super.paintText(g, menuItem, textRect, text); + + if (!snapChatUpdateAction.hasRead()) { + SnapChatUtil.paintSnapChat(g, textRect); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java new file mode 100644 index 0000000000..47bc3c6634 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java @@ -0,0 +1,29 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenuUI; + +import javax.swing.JMenuItem; +import java.awt.Graphics; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatMenuUI extends UIMenuUI { + + private SnapChatMenuDef menuDef; + + public SnapChatMenuUI(SnapChatMenuDef menuDef) { + this.menuDef = menuDef; + } + + @Override + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + + super.paintText(g, menuItem, textRect, text); + + if (!menuDef.hasRead()) { + SnapChatUtil.paintSnapChat(g, textRect); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java new file mode 100644 index 0000000000..fe1088ea82 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -0,0 +1,74 @@ +package com.fr.design.menu; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.notification.SnapChat; +import com.fr.design.notification.SnapChatConfig; +import com.fr.design.notification.SnapChatKey; + +import java.awt.event.ActionEvent; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatUpdateAction extends UpdateAction implements SnapChat { + + private SnapChatKey uniqueKey; + + public SnapChatUpdateAction(SnapChatKey uniqueKey) { + this.uniqueKey = uniqueKey; + } + + @Override + public void actionPerformed(ActionEvent e) { + + markRead(); + actionPerformed0(e); + } + + protected void actionPerformed0(ActionEvent e) { + + } + + @Override + public boolean hasRead() { + + String calcKey = calcKey(); + return SnapChatConfig.getInstance().hasRead(calcKey); + } + + @Override + public void markRead() { + + String calcKey = calcKey(); + SnapChatConfig.getInstance().markRead(calcKey); + } + + @Override + public SnapChatKey key() { + + return this.uniqueKey; + } + + private String calcKey() { + + return key().calc(); + } + + @Override + public UIMenuItem createMenuItem() { + + Object object = this.getValue(UIMenuItem.class.getName()); + if (object == null && !(object instanceof UIMenuItem)) { + UIMenuItem menuItem = new UIMenuItem(this); + // 设置名字用作单元测 + menuItem.setName(getName()); + menuItem.setUI(new SnapChatMenuItemUI(this)); + object = menuItem; + + this.putValue(UIMenuItem.class.getName(), object); + } + return (UIMenuItem) object; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java new file mode 100644 index 0000000000..6eb648055a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java @@ -0,0 +1,33 @@ +package com.fr.design.menu; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.Ellipse2D; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatUtil { + + public static void paintSnapChat(Graphics g, Rectangle textRect) { + + Color oldColor = g.getColor(); + + double x = textRect.getWidth(); + x += textRect.getX(); + x += 2; + + double y = textRect.getY(); + + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.red); + Ellipse2D.Double shape = + new Ellipse2D.Double(x, y, 4, 4); + g2d.fill(shape); + g2d.draw(shape); + + g2d.setColor(oldColor); + } +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java new file mode 100644 index 0000000000..8dd6f8aa28 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java @@ -0,0 +1,28 @@ +package com.fr.design.notification; + +/** + * 阅后即焚的消息提醒 + * + * created by Harrison on 2020/03/16 + **/ +public interface SnapChat { + + /** + * 已读 + * + * @return 是否为已读 + */ + boolean hasRead(); + + /** + * 标记为已读 + */ + void markRead(); + + /** + * 独一无二的标志 + * + * @return 字符标志 + */ + SnapChatKey key(); +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java new file mode 100644 index 0000000000..6aeb384df5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java @@ -0,0 +1,38 @@ +package com.fr.design.notification; + +import com.fr.stable.CommonUtils; + +/** + * created by Harrison on 2020/03/16 + **/ +public abstract class SnapChatAllTypes { + + public enum Menu implements SnapChatKey { + + /** + * 社区按钮 + */ + BBS("BBS"); + + private static final String SIGN = "0001"; + + private String key; + + Menu(String key) { + this.key = key; + } + + public String getKey() { + return key; + } + + @Override + public String calc() { + + return CommonUtils.join( + new String[]{SIGN, getKey()}, "-" + ); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java new file mode 100644 index 0000000000..c9cc177640 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -0,0 +1,88 @@ +package com.fr.design.notification; + +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; + +import java.util.HashMap; +import java.util.Map; + +/** + * created by Harrison on 2020/03/16 + **/ +@SuppressWarnings("unchecked") +public class SnapChatConfig implements XMLable { + + public static final String XML_TAG = "SnapChatConfig"; + + /** + * 已经阅读过的属性 + */ + private Map markReadMap = new HashMap<>(8); + + private static final SnapChatConfig INSTANCE = new SnapChatConfig(); + + public static SnapChatConfig getInstance() { + return INSTANCE; + } + + public Boolean hasRead(String key) { + + Map map = markReadMap; + Boolean val = map.get(key); + return val == null ? Boolean.FALSE : val; + } + + public void markRead(String key) { + + markReadMap.put(key, Boolean.TRUE); + } + + @Override + public void readXML(XMLableReader reader) { + + String tagName = reader.getTagName(); + if ("MarkReadMap".equals(tagName)) { + readMarkReadMapXML(reader); + } + } + + @Override + public void writeXML(XMLPrintWriter writer) { + + writer.startTAG(XML_TAG); + writeMarkReadMapXML(writer); + writer.end(); + } + + private void readMarkReadMapXML(XMLableReader reader) { + + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader reader) { + String tmpVal = reader.getElementValue(); + Boolean markRead = Boolean.valueOf(tmpVal); + markReadMap.put(reader.getAttrAsString("key", ""), markRead); + } + }); + } + + /** + * 写入map + */ + private void writeMarkReadMapXML(XMLPrintWriter writer) { + + writer.startTAG("MarkReadMap"); + for (Map.Entry item : markReadMap.entrySet()) { + writer.startTAG("item").attr("key", item.getKey()).textNode(item.getValue().toString()).end(); + } + writer.end(); + } + + @Override + public Object clone() throws CloneNotSupportedException { + + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java new file mode 100644 index 0000000000..fa316db350 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java @@ -0,0 +1,9 @@ +package com.fr.design.notification; + +/** + * created by Harrison on 2020/03/16 + **/ +public interface SnapChatKey { + + String calc(); +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index c32abb2ffc..7d00e367c1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,42 +1,19 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.fun.ComponentLibraryPaneProcessor; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; -import com.fr.general.CloudCenter; -import com.fr.log.FineLoggerFactory; -import com.fr.share.ShareConstants; -import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; +import com.fr.design.mainframe.component.pane.ComponentLibraryPaneCreator; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginListenerRegistration; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; /** * Created with IntelliJ IDEA. @@ -45,19 +22,6 @@ import java.net.URISyntaxException; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ - private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; - - private UIScrollPane downPane; - private JPanel reuWidgetPanel; - private UIComboBox comboBox; - private SharableWidgetBindInfo[] elCaseBindInfoList; - private UIButton deleteButton; - private JPanel editPanel; - private JPanel resetPanel; - private JPanel menutPanelNorthPane; - private SwingWorker sw; - //组件面板是否可以编辑 - private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -68,6 +32,7 @@ public class FormWidgetDetailPane extends FormDockView{ private FormWidgetDetailPane(){ setLayout(FRGUIPaneFactory.createBorderLayout()); + listenPluginComponentPane(); } @@ -89,350 +54,56 @@ public class FormWidgetDetailPane extends FormDockView{ public Icon getViewIcon() { return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png"); } - + /** * 初始化 */ + @Override public void refreshDockingView(){ + FormDesigner designer = this.getEditingFormDesigner(); removeAll(); if(designer == null){ clearDockingView(); return; } - reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - reuWidgetPanel.setBorder(null); - if (elCaseBindInfoList == null) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - return null; - } - }; - sw.execute(); - } - initReuWidgetPanel(); - initMenuPanel(); - - add(reuWidgetPanel, BorderLayout.CENTER); - - } - - /** - * 初始化组件共享和复用面板 - */ - private void initReuWidgetPanel() { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); - downPane.setBorder(null); - reuWidgetPanel.add(downPane); - } - - /** - * 初始化菜单栏面板 - */ - private void initMenuPanel() { - JPanel menutPanel = new JPanel(); - menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); - - menutPanelNorthPane = new JPanel(new BorderLayout()); - UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), - LOCAL_WIDGET_LABEL_WIDTH); - menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); - menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - - menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH); - comboBox = new UIComboBox(getFormCategories()); - comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height)); - initComboBoxSelectedListener(); - menutPanel.add(comboBox, BorderLayout.CENTER); - reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); - - } - - /** - * 创建菜单栏按钮面板 - */ - private JPanel initEditButtonPane() { - editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - - editPanel.add(createRefreshButton()); - editPanel.add(createDownloadButton()); - editPanel.add(createInstallButton()); - editPanel.add(createDeleteButton()); - - return editPanel; + + initComponentPane(); } - - /** - * 创建取消删除面板 - */ - private JPanel initResetButtonPane() { - resetPanel = new JPanel(); - UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); - resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - resetButton.setBackground(Color.white); - resetButton.setForeground(new Color(0x333334)); - resetButton.addActionListener(new ActionListener() { + + private void listenPluginComponentPane() { + + PluginFilter filter = new PluginFilter() { @Override - public void actionPerformed(ActionEvent e) { - refreshDownPanel(false); - replaceButtonPanel(false); - reuWidgetPanel.remove(deleteButton); + public boolean accept(PluginContext context) { + return context.contain(ComponentLibraryPaneProcessor.XML_TAG); } - }); - - deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); - deleteButton.setBackground(Color.white); - deleteButton.setForeground(new Color(0xeb1d1f)); - deleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (ShareLoader.getLoader().removeModulesFromList()) { - refreshShareMoudule(); - reuWidgetPanel.remove(deleteButton); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); - refreshDownPanel(false); - replaceButtonPanel(false); - refreshComboxData(); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); - } - - } - }); - JPanel deletePane = new JPanel(new BorderLayout()); - deletePane.add(deleteButton, BorderLayout.CENTER); - deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - - resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - resetPanel.add(resetButton, BorderLayout.CENTER); - resetPanel.add(deletePane, BorderLayout.WEST); - - refreshDownPanel(true); - - return resetPanel; - - } - - - private void initComboBoxSelectedListener() { - comboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - ShareLoader.getLoader().resetRemovedModuleList(); - int filterIndex = comboBox.getSelectedIndex(); - if (filterIndex == 0) { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - } else { - String filterName = comboBox.getSelectedItem().toString(); - elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); - } - refreshDownPanel(isEdit); - - } - }); - } - - /** - * 创建工具条按钮 - */ - private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { - UIButton toolButton = new UIButton(); - toolButton.setIcon(icon); - toolButton.setToolTipText(toolTip); - toolButton.set4ToolbarButton(); - toolButton.addActionListener(actionListener); - return toolButton; - - } - - /** - * 创建刷新按钮 - */ - private UIButton createRefreshButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - ShareLoader.getLoader().refreshModule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshComboxData(); - refreshDownPanel(false); - return null; - } - }; - sw.execute(); - } - } - ); - } - - private void refreshComboxData() { - comboBox.setSelectedIndex(0); - comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); - } - - /** - * 创建下载模板的按钮 - */ - private UIButton createDownloadButton() { - UIButton downloadButton = new UIButton(); - downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - downloadButton.set4ToolbarButton(); - downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); - downloadButton.addActionListener(new ActionListener() { + }; + PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() { @Override - public void actionPerformed(ActionEvent e) { - String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FineLoggerFactory.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); - } - } - }); - return downloadButton; - } - - /** - * 创建安装模板的按钮 - */ - private UIButton createInstallButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - } - } - } - ); - } - - /** - * 创建删除模板的按钮 - */ - private UIButton createDeleteButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - } - } - ); - } - - private void replaceButtonPanel(boolean isEdit) { - this.isEdit = isEdit; - if (isEdit) { - menutPanelNorthPane.remove(editPanel); - menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); - } else { - menutPanelNorthPane.remove(resetPanel); - menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - ShareLoader.getLoader().resetRemovedModuleList(); - } - } - - private void installFromDiskZipFile(File chosenFile) { - if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { - try { - if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - refreshComboxData(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - } - } catch (IOException e) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - FineLoggerFactory.getLogger().error(e.getMessage(), e); + public void on(PluginEvent event) { + refreshDockingView(); } - } + }, filter); } - - private void refreshShareMoudule() { - try { - ShareLoader.getLoader().refreshModule(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - /** - * 获取报表块组件分类 - */ - public String[] getFormCategories() { - return ArrayUtils.addAll(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); - } - - public void refreshDownPanel(boolean isEdit) { - reuWidgetPanel.remove(downPane); - downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); - downPane.setBorder(null); - reuWidgetPanel.add(downPane); - repaintContainer(); - - } - - public void repaintContainer() { - validate(); - repaint(); - revalidate(); + + private void initComponentPane() { + + ComponentLibraryPaneCreator creator = ComponentLibraryPaneCreator.getNew(); + JPanel componentLibraryPane = creator.create(this); + add(componentLibraryPane, BorderLayout.CENTER); } /** * 清除数据 */ public void clearDockingView() { + JScrollPane psp = new JScrollPane(); psp.setBorder(null); this.add(psp, BorderLayout.CENTER); } - - /** * 定位 * @return 位置 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java b/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java new file mode 100644 index 0000000000..7cd5e6e825 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe.component; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.design.mainframe.component.pane.ComponentLibraryPaneProcessorImpl; + +/** + * created by Harrison on 2020/03/16 + **/ +public class ComponentLibraryManager { + + private static ComponentLibraryPaneProcessor DEFAULT = new ComponentLibraryPaneProcessorImpl(); + + public static ComponentLibraryPaneProcessor selectPaneProcessor() { + + ComponentLibraryPaneProcessor right = ExtraDesignClassManager.getInstance().getSingle(ComponentLibraryPaneProcessor.XML_TAG); + + if (right == null || DEFAULT.layerIndex() > right.layerIndex()) { + right = DEFAULT; + } + return right; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java new file mode 100644 index 0000000000..97425fdb4f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.component.pane; + +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DockingView; +import com.fr.design.mainframe.component.ComponentLibraryManager; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * created by Harrison on 2020/03/22 + **/ +public class ComponentLibraryPaneCreator { + + private ComponentLibraryPaneProcessor processor; + + public ComponentLibraryPaneCreator() { + + processor = ComponentLibraryManager.selectPaneProcessor(); + } + + public static ComponentLibraryPaneCreator getNew() { + + return new ComponentLibraryPaneCreator(); + } + + public JPanel create(DockingView dockingView) { + + JPanel componentLibPanel = createComponentLibPanel(); + processor.parentView(dockingView); + processor.parentPane(componentLibPanel); + + JPanel menuPanel = createMenuPanel(); + componentLibPanel.add(menuPanel, BorderLayout.NORTH); + + UIScrollPane showPane = processor.createShowPanel(false); + componentLibPanel.add(showPane); + return componentLibPanel; + } + + private JPanel createComponentLibPanel() { + + JPanel reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); + return reuWidgetPanel; + } + + /** + * 初始化菜单栏面板 + */ + private JPanel createMenuPanel() { + + JPanel menuPanel = new JPanel(); + menuPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); + + JPanel menuPanelNorthPane = processor.createMenuNorthPane(); + menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + + UIComboBox menuPanelComboBox = processor.createMenuComBox(); + menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + return menuPanel; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java new file mode 100644 index 0000000000..18148ce0d6 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java @@ -0,0 +1,412 @@ +package com.fr.design.mainframe.component.pane; + +import com.fr.base.BaseUtils; +import com.fr.design.fun.impl.AbstractComponentLibraryPaneProcessor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DockingView; +import com.fr.design.mainframe.ShareWidgetPane; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.SharableWidgetBindInfo; +import com.fr.general.CloudCenter; +import com.fr.log.FineLoggerFactory; +import com.fr.share.ShareConstants; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingWorker; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +/** + * created by Harrison on 2020/03/16 + **/ +public class ComponentLibraryPaneProcessorImpl extends AbstractComponentLibraryPaneProcessor { + + private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; + + private DockingView parentView; + + private SwingWorker sw; + + private JPanel componentLibPane; + private UIScrollPane showPane; + + private UIComboBox menuPanelComboBox; + private JPanel menuPanelNorthPane; + private SharableWidgetBindInfo[] bindInfoArray; + + private UIButton deleteButton; + private JPanel editPanel; + private JPanel resetPanel; + /** + * 组件面板是否可以编辑 + */ + private boolean isEdit; + + public ComponentLibraryPaneProcessorImpl() { + + } + + @Override + public void parentView(DockingView dockingView) { + + parentView = dockingView; + if (bindInfoArray == null) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshShowPanel(false); + return null; + } + }; + sw.execute(); + } + } + + @Override + public void parentPane(JPanel panel) { + this.componentLibPane = panel; + } + + @Override + public void complete() { + + } + + /** + * 初始化组件共享和复用面板 + */ + @Override + public UIScrollPane createShowPanel(boolean isEdit) { + + showPane = new UIScrollPane( + new ShareWidgetPane(bindInfoArray, isEdit) + ); + showPane.setBorder(null); + return showPane; + } + + + @Override + public UIComboBox createMenuComBox() { + + menuPanelComboBox = new UIComboBox(getFormCategories()); + menuPanelComboBox.setPreferredSize(new Dimension(240, menuPanelComboBox.getPreferredSize().height)); + addComboBoxListener(); + return menuPanelComboBox; + } + + private void addComboBoxListener() { + + menuPanelComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); + int filterIndex = menuPanelComboBox.getSelectedIndex(); + if (filterIndex == 0) { + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = menuPanelComboBox.getSelectedItem().toString(); + bindInfoArray = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } + refreshShowPanel(isEdit); + } + }); + } + + @Override + public JPanel createMenuNorthPane() { + + menuPanelNorthPane = new JPanel(new BorderLayout()); + UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), + LOCAL_WIDGET_LABEL_WIDTH); + menuPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); + menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + menuPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + return menuPanelNorthPane; + + } + + /** + * 创建菜单栏按钮面板 + */ + protected JPanel initEditButtonPane() { + + editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + editPanel.add(createRefreshButton()); + editPanel.add(createDownloadButton()); + editPanel.add(createInstallButton()); + editPanel.add(createDeleteButton()); + + return editPanel; + } + + /** + * 创建取消删除面板 + */ + protected JPanel initResetButtonPane() { + + resetPanel = new JPanel(); + UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.setBackground(Color.white); + resetButton.setForeground(new Color(0x333334)); + resetButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshShowPanel(false); + replaceButtonPanel(false); + componentLibPane.remove(deleteButton); + } + }); + + deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); + deleteButton.setBackground(Color.white); + deleteButton.setForeground(new Color(0xeb1d1f)); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ShareLoader.getLoader().removeModulesFromList()) { + refreshShareModule(); + componentLibPane.remove(deleteButton); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); + refreshShowPanel(false); + replaceButtonPanel(false); + refreshComboBoxData(); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); + } + + } + }); + JPanel deletePane = new JPanel(new BorderLayout()); + deletePane.add(deleteButton, BorderLayout.CENTER); + deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + resetPanel.add(deletePane, BorderLayout.WEST); + + refreshShowPanel(true); + + return resetPanel; + + } + + + /** + * 创建工具条按钮 + */ + protected UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { + + UIButton toolButton = new UIButton(); + toolButton.setIcon(icon); + toolButton.setToolTipText(toolTip); + toolButton.set4ToolbarButton(); + toolButton.addActionListener(actionListener); + return toolButton; + + } + + /** + * 创建刷新按钮 + */ + protected UIButton createRefreshButton() { + + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboBoxData(); + refreshShowPanel(false); + return null; + } + }; + sw.execute(); + } + } + ); + } + + /** + * 创建下载模板的按钮 + */ + protected UIButton createDownloadButton() { + UIButton downloadButton = new UIButton(); + downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + downloadButton.set4ToolbarButton(); + downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); + downloadButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FineLoggerFactory.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); + } + } + }); + return downloadButton; + } + + /** + * 创建安装模板的按钮 + */ + protected UIButton createInstallButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + } + ); + } + + /** + * 创建删除模板的按钮 + */ + protected UIButton createDeleteButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + } + } + ); + } + + /** + * 获取报表块组件分类 + */ + protected String[] getFormCategories() { + + return ArrayUtils.addAll(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); + } + + protected void refreshShowPanel(boolean isEdit) { + + componentLibPane.remove(showPane); + showPane = createShowPanel(isEdit); + componentLibPane.add(showPane); + repaint(); + } + + private void refreshComboBoxData() { + + menuPanelComboBox.setSelectedIndex(0); + menuPanelComboBox.setModel(new DefaultComboBoxModel(getFormCategories())); + } + + private void replaceButtonPanel(boolean isEdit) { + + this.isEdit = isEdit; + if (isEdit) { + menuPanelNorthPane.remove(editPanel); + menuPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menuPanelNorthPane.remove(resetPanel); + menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); + } + } + + private void installFromDiskZipFile(File chosenFile) { + + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareModule(); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshShowPanel(false); + refreshComboBoxData(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + private void refreshShareModule() { + try { + ShareLoader.getLoader().refreshModule(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + public void repaint() { + + parentView.validate(); + parentView.repaint(); + parentView.revalidate(); + } + +} From 7704b05efdb0be05d6f5a24a3659fdd630b2b421 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 23 Mar 2020 14:12:58 +0800 Subject: [PATCH 31/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=201=E3=80=81=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=202=E3=80=81=E5=88=A4=E7=A9=BA=203=E3=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/ComponentLibraryPaneProcessor.java | 28 ++++++++++++++++++- .../design/notification/SnapChatConfig.java | 7 +++-- .../pane/ComponentLibraryPaneCreator.java | 8 ++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java index 88385a11b1..7b484b156d 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java @@ -8,24 +8,50 @@ import com.fr.stable.fun.mark.Immutable; import javax.swing.JPanel; /** + * 组件库面板处理器 + * * created by Harrison on 2020/03/16 **/ public interface ComponentLibraryPaneProcessor extends Immutable { - String XML_TAG = "ParameterExpandablePaneUIProvider"; + String XML_TAG = "ComponentLibraryPaneProcessor"; int CURRENT_LEVEL = 1; + /** + * 创建展示面板 + * + * @param isEdit 是否可以编辑 + * @return 展示面板 + */ UIScrollPane createShowPanel(boolean isEdit); + /** + * 创建菜单的上部面板 + * + * @return 面板 + */ JPanel createMenuNorthPane(); + /** + * 创建复选框 + * + * @return 复选框 + */ UIComboBox createMenuComBox(); void parentView(DockingView dockingView); + /** + * 父面板 + * + * @param panel 面板 + */ void parentPane(JPanel panel); + /** + * 创建完成 + */ void complete(); } diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index c9cc177640..04170e3be8 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -1,5 +1,6 @@ package com.fr.design.notification; +import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLable; @@ -63,7 +64,7 @@ public class SnapChatConfig implements XMLable { public void readXML(XMLableReader reader) { String tmpVal = reader.getElementValue(); Boolean markRead = Boolean.valueOf(tmpVal); - markReadMap.put(reader.getAttrAsString("key", ""), markRead); + markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); } }); } @@ -82,7 +83,7 @@ public class SnapChatConfig implements XMLable { @Override public Object clone() throws CloneNotSupportedException { - - return null; + + return super.clone(); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java index 97425fdb4f..8cb5d15334 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java @@ -59,10 +59,14 @@ public class ComponentLibraryPaneCreator { menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); JPanel menuPanelNorthPane = processor.createMenuNorthPane(); - menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + if (menuPanelNorthPane != null) { + menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + } UIComboBox menuPanelComboBox = processor.createMenuComBox(); - menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + if (menuPanelComboBox != null) { + menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + } return menuPanel; } } From b01c14e44b86de43098bd1f4d6eefe2034730a99 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 14:23:15 +0800 Subject: [PATCH 32/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=201=E3=80=81=E6=8A=BD=E5=87=BA=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=9B=B4=E9=80=9A=E7=94=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=9D=A5=E6=B7=BB=E5=8A=A0=E9=9D=A2=E6=9D=BF=202=E3=80=81?= =?UTF-8?q?=E4=B8=BA=E5=85=B1=E4=BA=AB=E5=8A=A0=E8=BD=BD=E5=99=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8F=92=E4=BB=B6=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 25 ++ .../AbstractPropertyItemPaneProvider.java | 31 ++ .../mainframe/EastRegionContainerPane.java | 139 +++++- .../com/fr/design/mainframe/PaneHolder.java | 17 + .../fr/design/mainframe/PropertyItemBean.java | 68 +++ .../fr/design/menu/SnapChatUpdateAction.java | 8 +- .../mainframe/FormWidgetDetailPane.java | 392 +++++++++++++++-- .../java/com/fr/design/mainframe/JForm.java | 61 ++- .../component/ComponentLibraryManager.java | 23 - .../pane/ComponentLibraryPaneCreator.java | 72 --- .../ComponentLibraryPaneProcessorImpl.java | 412 ------------------ 11 files changed, 697 insertions(+), 551 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java new file mode 100644 index 0000000000..2dbead9ed6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun; + +import com.fr.design.mainframe.PaneHolder; +import com.fr.design.mainframe.PropertyItemBean; +import com.fr.stable.fun.mark.Mutable; +import org.jetbrains.annotations.Nullable; + +/** + * created by Harrison on 2020/03/23 + **/ +public interface PropertyItemPaneProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "PropertyItemPaneProvider"; + + String key(); + + PropertyItemBean getItem(); + + @Nullable + PaneHolder getPaneHolder(Class clazz); + + String replaceKey(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java new file mode 100644 index 0000000000..44e4abd4d1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java @@ -0,0 +1,31 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.PropertyItemPaneProvider; +import com.fr.design.mainframe.PaneHolder; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * created by Harrison on 2020/03/23 + **/ +@API(level = PropertyItemPaneProvider.CURRENT_LEVEL) +public abstract class AbstractPropertyItemPaneProvider extends AbstractProvider implements PropertyItemPaneProvider { + + @Override + public PaneHolder getPaneHolder(Class clazz) { + + if (sign().equals(clazz)) { + return getPathHolder0(); + } + return null; + } + + protected abstract PaneHolder getPathHolder0(); + + protected abstract Class sign(); + + @Override + public int currentAPILevel() { + return PropertyItemPaneProvider.CURRENT_LEVEL; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 07191d536d..790c0eb39f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -3,7 +3,9 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; +import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; @@ -12,12 +14,38 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; - +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginRuntime; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -26,6 +54,7 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.HashSet; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -101,9 +130,95 @@ public class EastRegionContainerPane extends UIEastResizableContainer { defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); + + initPluginPane(); + listenPlugin(); } - + + private void listenPlugin() { + + PluginFilter filter = new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PropertyItemPaneProvider.XML_TAG); + } + }; + PluginListenerRegistration.getInstance().listen( + PluginEventType.AfterRun, + new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } + }, filter); + PluginListenerRegistration.getInstance().listen( + PluginEventType.BeforeStop, + new PluginEventListener(10) { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + + } + updateAllPropertyPane(); + } + }, filter); + } + + private void removePropertyItem(PropertyItemPaneProvider provider) { + + propertyItemMap.remove(provider.key()); + String replaceKey = provider.replaceKey(); + PropertyItem replaceItem = propertyItemMap.get(replaceKey); + if (replaceItem != null) { + replaceItem.setReplace(false); + } + } + + private void initPluginPane() { + + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + } + + private void addPropertyItem(PropertyItemPaneProvider provider) { + + String key = provider.key(); + PropertyItemBean itemBean = provider.getItem(); + PropertyItem propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + UIButton button = propertyItem.getButton(); + List buttonListeners = itemBean.getButtonListeners(); + for (ActionListener buttonListener : buttonListeners) { + button.addActionListener(buttonListener); + } + propertyItemMap.put(key, propertyItem); + + String replaceKey = provider.replaceKey(); + PropertyItem replaceItem = propertyItemMap.get(replaceKey); + if (replaceItem != null) { + replaceItem.setReplace(true); + } + + } + private void initPropertyItemList() { + propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), @@ -360,6 +475,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceConfiguredRolesPane(JComponent pane) { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } + + public void replaceKeyPane(String key, JComponent pane) { + + propertyItemMap.get(key).replaceContentPane(pane); + } public JComponent getConfiguredRolesPane() { return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); @@ -511,6 +631,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private PopupDialog popupDialog; // 弹出框 private boolean isPoppedOut = false; // 是否弹出 private boolean isVisible = true; // 是否可见 + private boolean replace = false; // 是否被替代 private boolean isEnabled = true; // 是否可用 private Set visibleModes; private Set enableModes; @@ -563,13 +684,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public boolean isVisible() { - return isVisible; + // 取决于可见且未替代 + return isVisible && !replace; } public void setVisible(boolean isVisible) { this.isVisible = isVisible; } - + + public void setReplace(boolean replace) { + + this.replace = replace; + } + public boolean isEnabled() { return isEnabled; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java b/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java new file mode 100644 index 0000000000..aef5e0b137 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe; + +import javax.swing.JPanel; + +/** + * created by Harrison on 2020/03/23 + **/ +public interface PaneHolder { + + /** + * 得到 Pane + * + * @param arg 参数 + * @return 面板 + */ + JPanel getInstance(T arg); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java new file mode 100644 index 0000000000..f6a250defc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe; + +import java.awt.event.ActionListener; +import java.util.List; + +/** + * created by Harrison on 2020/03/23 + **/ +public class PropertyItemBean { + + private String name; + private String title; + private String btnIconName; + private EastRegionContainerPane.PropertyMode[] visibleModes; + private EastRegionContainerPane.PropertyMode[] enableModes; + private List buttonListeners; + + public PropertyItemBean() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBtnIconName() { + return btnIconName; + } + + public void setBtnIconName(String btnIconName) { + this.btnIconName = btnIconName; + } + + public EastRegionContainerPane.PropertyMode[] getVisibleModes() { + return visibleModes; + } + + public void setVisibleModes(EastRegionContainerPane.PropertyMode[] visibleModes) { + this.visibleModes = visibleModes; + } + + public EastRegionContainerPane.PropertyMode[] getEnableModes() { + return enableModes; + } + + public void setEnableModes(EastRegionContainerPane.PropertyMode[] enableModes) { + this.enableModes = enableModes; + } + + public List getButtonListeners() { + return buttonListeners; + } + + public void setButtonListeners(List buttonListeners) { + this.buttonListeners = buttonListeners; + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java index fe1088ea82..4829545468 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -11,7 +11,7 @@ import java.awt.event.ActionEvent; /** * created by Harrison on 2020/03/22 **/ -public class SnapChatUpdateAction extends UpdateAction implements SnapChat { +public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat { private SnapChatKey uniqueKey; @@ -20,15 +20,13 @@ public class SnapChatUpdateAction extends UpdateAction implements SnapChat { } @Override - public void actionPerformed(ActionEvent e) { + public final void actionPerformed(ActionEvent e) { markRead(); actionPerformed0(e); } - protected void actionPerformed0(ActionEvent e) { - - } + protected abstract void actionPerformed0(ActionEvent e); @Override public boolean hasRead() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 7d00e367c1..f49f2859b2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,19 +1,43 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.base.FRContext; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.component.pane.ComponentLibraryPaneCreator; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; -import com.fr.plugin.observer.PluginListenerRegistration; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.SharableWidgetBindInfo; +import com.fr.general.CloudCenter; +import com.fr.log.FineLoggerFactory; +import com.fr.share.ShareConstants; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.SwingWorker; +import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; /** * Created with IntelliJ IDEA. @@ -22,6 +46,19 @@ import java.awt.BorderLayout; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ + private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; + + private UIScrollPane downPane; + private JPanel reuWidgetPanel; + private UIComboBox comboBox; + private SharableWidgetBindInfo[] elCaseBindInfoList; + private UIButton deleteButton; + private JPanel editPanel; + private JPanel resetPanel; + private JPanel menutPanelNorthPane; + private SwingWorker sw; + //组件面板是否可以编辑 + private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -32,7 +69,6 @@ public class FormWidgetDetailPane extends FormDockView{ private FormWidgetDetailPane(){ setLayout(FRGUIPaneFactory.createBorderLayout()); - listenPluginComponentPane(); } @@ -54,56 +90,350 @@ public class FormWidgetDetailPane extends FormDockView{ public Icon getViewIcon() { return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png"); } - + /** * 初始化 */ - @Override public void refreshDockingView(){ - FormDesigner designer = this.getEditingFormDesigner(); removeAll(); if(designer == null){ clearDockingView(); return; } - - initComponentPane(); + reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); + if (elCaseBindInfoList == null) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); + } + initReuWidgetPanel(); + initMenuPanel(); + + add(reuWidgetPanel, BorderLayout.CENTER); + + } + + /** + * 初始化组件共享和复用面板 + */ + private void initReuWidgetPanel() { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); + downPane.setBorder(null); + reuWidgetPanel.add(downPane); + } + + /** + * 初始化菜单栏面板 + */ + private void initMenuPanel() { + JPanel menutPanel = new JPanel(); + menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); + + menutPanelNorthPane = new JPanel(new BorderLayout()); + UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), + LOCAL_WIDGET_LABEL_WIDTH); + menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + + menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH); + comboBox = new UIComboBox(getFormCategories()); + comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height)); + initComboBoxSelectedListener(); + menutPanel.add(comboBox, BorderLayout.CENTER); + reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); + + } + + /** + * 创建菜单栏按钮面板 + */ + private JPanel initEditButtonPane() { + editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + editPanel.add(createRefreshButton()); + editPanel.add(createDownloadButton()); + editPanel.add(createInstallButton()); + editPanel.add(createDeleteButton()); + + return editPanel; } - - private void listenPluginComponentPane() { - - PluginFilter filter = new PluginFilter() { + + /** + * 创建取消删除面板 + */ + private JPanel initResetButtonPane() { + resetPanel = new JPanel(); + UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.setBackground(Color.white); + resetButton.setForeground(new Color(0x333334)); + resetButton.addActionListener(new ActionListener() { @Override - public boolean accept(PluginContext context) { - return context.contain(ComponentLibraryPaneProcessor.XML_TAG); + public void actionPerformed(ActionEvent e) { + refreshDownPanel(false); + replaceButtonPanel(false); + reuWidgetPanel.remove(deleteButton); } - }; - PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() { + }); + + deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); + deleteButton.setBackground(Color.white); + deleteButton.setForeground(new Color(0xeb1d1f)); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ShareLoader.getLoader().removeModulesFromList()) { + refreshShareMoudule(); + reuWidgetPanel.remove(deleteButton); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); + refreshDownPanel(false); + replaceButtonPanel(false); + refreshComboxData(); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); + } + + } + }); + JPanel deletePane = new JPanel(new BorderLayout()); + deletePane.add(deleteButton, BorderLayout.CENTER); + deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + resetPanel.add(deletePane, BorderLayout.WEST); + + refreshDownPanel(true); + + return resetPanel; + + } + + + private void initComboBoxSelectedListener() { + comboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); + int filterIndex = comboBox.getSelectedIndex(); + if (filterIndex == 0) { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = comboBox.getSelectedItem().toString(); + elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } + refreshDownPanel(isEdit); + + } + }); + } + + /** + * 创建工具条按钮 + */ + private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { + UIButton toolButton = new UIButton(); + toolButton.setIcon(icon); + toolButton.setToolTipText(toolTip); + toolButton.set4ToolbarButton(); + toolButton.addActionListener(actionListener); + return toolButton; + + } + + /** + * 创建刷新按钮 + */ + private UIButton createRefreshButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboxData(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); + } + } + ); + } + + private void refreshComboxData() { + comboBox.setSelectedIndex(0); + comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); + } + + /** + * 创建下载模板的按钮 + */ + private UIButton createDownloadButton() { + UIButton downloadButton = new UIButton(); + downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + downloadButton.set4ToolbarButton(); + downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); + downloadButton.addActionListener(new ActionListener() { @Override - public void on(PluginEvent event) { - refreshDockingView(); + public void actionPerformed(ActionEvent e) { + String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FRContext.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); + } + } + }); + return downloadButton; + } + + /** + * 创建安装模板的按钮 + */ + private UIButton createInstallButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + } + ); + } + + /** + * 创建删除模板的按钮 + */ + private UIButton createDeleteButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + } + } + ); + } + + private void replaceButtonPanel(boolean isEdit) { + this.isEdit = isEdit; + if (isEdit) { + menutPanelNorthPane.remove(editPanel); + menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menutPanelNorthPane.remove(resetPanel); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); + } + } + + private void installFromDiskZipFile(File chosenFile) { + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + refreshComboxData(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - }, filter); + } } - - private void initComponentPane() { - - ComponentLibraryPaneCreator creator = ComponentLibraryPaneCreator.getNew(); - JPanel componentLibraryPane = creator.create(this); - add(componentLibraryPane, BorderLayout.CENTER); + + private void refreshShareMoudule() { + try { + ShareLoader.getLoader().refreshModule(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + /** + * 获取报表块组件分类 + */ + public String[] getFormCategories() { + return ArrayUtils.addAll(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); + } + + public void refreshDownPanel(boolean isEdit) { + reuWidgetPanel.remove(downPane); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); + downPane.setBorder(null); + reuWidgetPanel.add(downPane); + repaintContainer(); + + } + + public void repaintContainer() { + validate(); + repaint(); + revalidate(); } /** * 清除数据 */ public void clearDockingView() { - JScrollPane psp = new JScrollPane(); psp.setBorder(null); this.add(psp, BorderLayout.CENTER); } + + /** * 定位 * @return 位置 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index cee0d5b90d..98c95a38bf 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -7,6 +7,7 @@ import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; @@ -31,6 +32,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.fun.PreviewProvider; +import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ilable.UILabel; @@ -67,6 +69,14 @@ import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.page.PaperSettingProvider; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginRuntime; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.worksheet.FormElementCase; @@ -93,6 +103,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Set; public class JForm extends JTemplate implements BaseJForm
{ private static final String FORM_CARD = "FORM"; @@ -118,12 +129,58 @@ public class JForm extends JTemplate implements BaseJForm providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } + } + }, filter); + } + + private void initPluginPane() { + + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } } - + + private void addPane(PropertyItemPaneProvider provider) { + + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); + if (holder != null) { + JPanel panel = holder.getInstance(formDesign); + EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); + } + } + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -768,7 +825,7 @@ public class JForm extends JTemplate implements BaseJForm right.layerIndex()) { - right = DEFAULT; - } - return right; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java deleted file mode 100644 index 8cb5d15334..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fr.design.mainframe.component.pane; - -import com.fr.design.fun.ComponentLibraryPaneProcessor; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DockingView; -import com.fr.design.mainframe.component.ComponentLibraryManager; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; - -/** - * created by Harrison on 2020/03/22 - **/ -public class ComponentLibraryPaneCreator { - - private ComponentLibraryPaneProcessor processor; - - public ComponentLibraryPaneCreator() { - - processor = ComponentLibraryManager.selectPaneProcessor(); - } - - public static ComponentLibraryPaneCreator getNew() { - - return new ComponentLibraryPaneCreator(); - } - - public JPanel create(DockingView dockingView) { - - JPanel componentLibPanel = createComponentLibPanel(); - processor.parentView(dockingView); - processor.parentPane(componentLibPanel); - - JPanel menuPanel = createMenuPanel(); - componentLibPanel.add(menuPanel, BorderLayout.NORTH); - - UIScrollPane showPane = processor.createShowPanel(false); - componentLibPanel.add(showPane); - return componentLibPanel; - } - - private JPanel createComponentLibPanel() { - - JPanel reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - reuWidgetPanel.setBorder(null); - return reuWidgetPanel; - } - - /** - * 初始化菜单栏面板 - */ - private JPanel createMenuPanel() { - - JPanel menuPanel = new JPanel(); - menuPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); - - JPanel menuPanelNorthPane = processor.createMenuNorthPane(); - if (menuPanelNorthPane != null) { - menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); - } - - UIComboBox menuPanelComboBox = processor.createMenuComBox(); - if (menuPanelComboBox != null) { - menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); - } - return menuPanel; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java deleted file mode 100644 index 18148ce0d6..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java +++ /dev/null @@ -1,412 +0,0 @@ -package com.fr.design.mainframe.component.pane; - -import com.fr.base.BaseUtils; -import com.fr.design.fun.impl.AbstractComponentLibraryPaneProcessor; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DockingView; -import com.fr.design.mainframe.ShareWidgetPane; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; -import com.fr.general.CloudCenter; -import com.fr.log.FineLoggerFactory; -import com.fr.share.ShareConstants; -import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; - -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * created by Harrison on 2020/03/16 - **/ -public class ComponentLibraryPaneProcessorImpl extends AbstractComponentLibraryPaneProcessor { - - private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; - - private DockingView parentView; - - private SwingWorker sw; - - private JPanel componentLibPane; - private UIScrollPane showPane; - - private UIComboBox menuPanelComboBox; - private JPanel menuPanelNorthPane; - private SharableWidgetBindInfo[] bindInfoArray; - - private UIButton deleteButton; - private JPanel editPanel; - private JPanel resetPanel; - /** - * 组件面板是否可以编辑 - */ - private boolean isEdit; - - public ComponentLibraryPaneProcessorImpl() { - - } - - @Override - public void parentView(DockingView dockingView) { - - parentView = dockingView; - if (bindInfoArray == null) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshShowPanel(false); - return null; - } - }; - sw.execute(); - } - } - - @Override - public void parentPane(JPanel panel) { - this.componentLibPane = panel; - } - - @Override - public void complete() { - - } - - /** - * 初始化组件共享和复用面板 - */ - @Override - public UIScrollPane createShowPanel(boolean isEdit) { - - showPane = new UIScrollPane( - new ShareWidgetPane(bindInfoArray, isEdit) - ); - showPane.setBorder(null); - return showPane; - } - - - @Override - public UIComboBox createMenuComBox() { - - menuPanelComboBox = new UIComboBox(getFormCategories()); - menuPanelComboBox.setPreferredSize(new Dimension(240, menuPanelComboBox.getPreferredSize().height)); - addComboBoxListener(); - return menuPanelComboBox; - } - - private void addComboBoxListener() { - - menuPanelComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - ShareLoader.getLoader().resetRemovedModuleList(); - int filterIndex = menuPanelComboBox.getSelectedIndex(); - if (filterIndex == 0) { - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - } else { - String filterName = menuPanelComboBox.getSelectedItem().toString(); - bindInfoArray = ShareLoader.getLoader().getFilterBindInfoList(filterName); - } - refreshShowPanel(isEdit); - } - }); - } - - @Override - public JPanel createMenuNorthPane() { - - menuPanelNorthPane = new JPanel(new BorderLayout()); - UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), - LOCAL_WIDGET_LABEL_WIDTH); - menuPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); - menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - menuPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - return menuPanelNorthPane; - - } - - /** - * 创建菜单栏按钮面板 - */ - protected JPanel initEditButtonPane() { - - editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - - editPanel.add(createRefreshButton()); - editPanel.add(createDownloadButton()); - editPanel.add(createInstallButton()); - editPanel.add(createDeleteButton()); - - return editPanel; - } - - /** - * 创建取消删除面板 - */ - protected JPanel initResetButtonPane() { - - resetPanel = new JPanel(); - UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); - resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - resetButton.setBackground(Color.white); - resetButton.setForeground(new Color(0x333334)); - resetButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - refreshShowPanel(false); - replaceButtonPanel(false); - componentLibPane.remove(deleteButton); - } - }); - - deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); - deleteButton.setBackground(Color.white); - deleteButton.setForeground(new Color(0xeb1d1f)); - deleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (ShareLoader.getLoader().removeModulesFromList()) { - refreshShareModule(); - componentLibPane.remove(deleteButton); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); - refreshShowPanel(false); - replaceButtonPanel(false); - refreshComboBoxData(); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); - } - - } - }); - JPanel deletePane = new JPanel(new BorderLayout()); - deletePane.add(deleteButton, BorderLayout.CENTER); - deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - - resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - resetPanel.add(resetButton, BorderLayout.CENTER); - resetPanel.add(deletePane, BorderLayout.WEST); - - refreshShowPanel(true); - - return resetPanel; - - } - - - /** - * 创建工具条按钮 - */ - protected UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { - - UIButton toolButton = new UIButton(); - toolButton.setIcon(icon); - toolButton.setToolTipText(toolTip); - toolButton.set4ToolbarButton(); - toolButton.addActionListener(actionListener); - return toolButton; - - } - - /** - * 创建刷新按钮 - */ - protected UIButton createRefreshButton() { - - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - ShareLoader.getLoader().refreshModule(); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshComboBoxData(); - refreshShowPanel(false); - return null; - } - }; - sw.execute(); - } - } - ); - } - - /** - * 创建下载模板的按钮 - */ - protected UIButton createDownloadButton() { - UIButton downloadButton = new UIButton(); - downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - downloadButton.set4ToolbarButton(); - downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); - downloadButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FineLoggerFactory.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); - } - } - }); - return downloadButton; - } - - /** - * 创建安装模板的按钮 - */ - protected UIButton createInstallButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - } - } - } - ); - } - - /** - * 创建删除模板的按钮 - */ - protected UIButton createDeleteButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - } - } - ); - } - - /** - * 获取报表块组件分类 - */ - protected String[] getFormCategories() { - - return ArrayUtils.addAll(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); - } - - protected void refreshShowPanel(boolean isEdit) { - - componentLibPane.remove(showPane); - showPane = createShowPanel(isEdit); - componentLibPane.add(showPane); - repaint(); - } - - private void refreshComboBoxData() { - - menuPanelComboBox.setSelectedIndex(0); - menuPanelComboBox.setModel(new DefaultComboBoxModel(getFormCategories())); - } - - private void replaceButtonPanel(boolean isEdit) { - - this.isEdit = isEdit; - if (isEdit) { - menuPanelNorthPane.remove(editPanel); - menuPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); - } else { - menuPanelNorthPane.remove(resetPanel); - menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - ShareLoader.getLoader().resetRemovedModuleList(); - } - } - - private void installFromDiskZipFile(File chosenFile) { - - if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { - try { - if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { - refreshShareModule(); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshShowPanel(false); - refreshComboBoxData(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - } - } catch (IOException e) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - - private void refreshShareModule() { - try { - ShareLoader.getLoader().refreshModule(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - public void repaint() { - - parentView.validate(); - parentView.repaint(); - parentView.revalidate(); - } - -} From bfa9fe39768a2d9f9fcf7ec73fd9bf670bcb3307 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 14:38:48 +0800 Subject: [PATCH 33/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=88=A0=E6=8E=89=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 21 ++++++++++++++++ ...AbstractComponentLibraryPaneProcessor.java | 25 ------------------- .../mainframe/EastRegionContainerPane.java | 6 +++++ 3 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java index 2dbead9ed6..2c5c3f2d48 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -14,12 +14,33 @@ public interface PropertyItemPaneProvider extends Mutable { String XML_TAG = "PropertyItemPaneProvider"; + /** + * 独一无二的标志 + * + * @return 标志 + */ String key(); + /** + * 配置属性 + * + * @return 熟悉 + */ PropertyItemBean getItem(); + /** + * 面板持有者 + * + * @param clazz 类型 + * @return 持有者 + */ @Nullable PaneHolder getPaneHolder(Class clazz); + /** + * 想要替代的类型 + * + * @return 替代类型 + */ String replaceKey(); } diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java deleted file mode 100644 index f376ad7887..0000000000 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.ComponentLibraryPaneProcessor; -import com.fr.stable.fun.impl.AbstractProvider; -import com.fr.stable.fun.mark.API; -import com.fr.stable.fun.mark.Layer; - -/** - * created by Harrison on 2020/03/16 - **/ -@API(level = ComponentLibraryPaneProcessor.CURRENT_LEVEL) -public abstract class AbstractComponentLibraryPaneProcessor extends AbstractProvider implements ComponentLibraryPaneProcessor { - - @Override - public int currentAPILevel() { - - return ComponentLibraryPaneProcessor.CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - - return Layer.DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 790c0eb39f..0c23e8658f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -178,6 +178,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.remove(provider.key()); String replaceKey = provider.replaceKey(); + if (replaceKey == null) { + return; + } PropertyItem replaceItem = propertyItemMap.get(replaceKey); if (replaceItem != null) { replaceItem.setReplace(false); @@ -210,6 +213,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.put(key, propertyItem); String replaceKey = provider.replaceKey(); + if (replaceKey == null) { + return; + } PropertyItem replaceItem = propertyItemMap.get(replaceKey); if (replaceItem != null) { replaceItem.setReplace(true); From 57223cd5b6fc83a11c8a17895548f91a94f3277d Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 25 Mar 2020 14:43:34 +0800 Subject: [PATCH 34/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=B8=8A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 4 +++ .../mainframe/EastRegionContainerPane.java | 36 ++++++++++++++----- .../fr/design/mainframe/PropertyItemBean.java | 10 ++++++ .../design/notification/SnapChatConfig.java | 12 +++---- .../java/com/fr/design/mainframe/JForm.java | 2 +- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java index 2c5c3f2d48..4e5112d8cc 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -14,6 +14,10 @@ public interface PropertyItemPaneProvider extends Mutable { String XML_TAG = "PropertyItemPaneProvider"; + int FIRST = 100; + + int LAST = -100; + /** * 独一无二的标志 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0c23e8658f..d73f36a7a8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -145,7 +145,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { }; PluginListenerRegistration.getInstance().listen( PluginEventType.AfterRun, - new PluginEventListener() { + new PluginEventListener(PropertyItemPaneProvider.FIRST) { @Override public void on(PluginEvent event) { PluginContext context = event.getContext(); @@ -159,7 +159,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, - new PluginEventListener(10) { + new PluginEventListener(PropertyItemPaneProvider.FIRST) { @Override public void on(PluginEvent event) { PluginContext context = event.getContext(); @@ -200,11 +200,22 @@ public class EastRegionContainerPane extends UIEastResizableContainer { String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); - PropertyItem propertyItem = new PropertyItem(itemBean.getName(), - itemBean.getTitle(), - itemBean.getBtnIconName(), - itemBean.getVisibleModes(), - itemBean.getEnableModes()); + String btnIconBaseDir = itemBean.getBtnIconBaseDir(); + PropertyItem propertyItem; + if (StringUtils.isEmpty(btnIconBaseDir)) { + propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + } else{ + propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + btnIconBaseDir, + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); for (ActionListener buttonListener : buttonListeners) { @@ -648,14 +659,21 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String ICON_SUFFIX_DISABLED = "_disabled.png"; private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private String btnIconName; + private String iconBaseDir; private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private final Color selectedBtnBackground = new Color(0xF5F5F7); private Color originBtnBackground; - + + public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { + this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); + } + + public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this.name = name; this.title = title; this.btnIconName = btnIconName; + this.iconBaseDir = iconBaseDir; initButton(); initPropertyPanel(); initModes(visibleModes, enableModes); @@ -793,7 +811,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - return ICON_BASE_DIR + btnIconName + iconSuffix; + return iconBaseDir + btnIconName + iconSuffix; } public void resetButtonIcon() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java index f6a250defc..ee54364ba5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java @@ -11,6 +11,7 @@ public class PropertyItemBean { private String name; private String title; private String btnIconName; + private String btnIconBaseDir; private EastRegionContainerPane.PropertyMode[] visibleModes; private EastRegionContainerPane.PropertyMode[] enableModes; private List buttonListeners; @@ -42,6 +43,15 @@ public class PropertyItemBean { this.btnIconName = btnIconName; } + public String getBtnIconBaseDir() { + + return btnIconBaseDir; + } + + public void setBtnIconBaseDir(String btnIconBaseDir) { + this.btnIconBaseDir = btnIconBaseDir; + } + public EastRegionContainerPane.PropertyMode[] getVisibleModes() { return visibleModes; } diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index 04170e3be8..ed6b7a6d8f 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -43,9 +43,12 @@ public class SnapChatConfig implements XMLable { @Override public void readXML(XMLableReader reader) { - String tagName = reader.getTagName(); - if ("MarkReadMap".equals(tagName)) { - readMarkReadMapXML(reader); + if (reader.isChildNode()) { + if ("item".equals(reader.getTagName())) { + String tmpVal = reader.getElementValue(); + Boolean markRead = Boolean.valueOf(tmpVal); + markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); + } } } @@ -62,9 +65,6 @@ public class SnapChatConfig implements XMLable { reader.readXMLObject(new XMLReadable() { @Override public void readXML(XMLableReader reader) { - String tmpVal = reader.getElementValue(); - Boolean markRead = Boolean.valueOf(tmpVal); - markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); } }); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 98c95a38bf..e95a7962c2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -150,7 +150,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Wed, 25 Mar 2020 14:55:58 +0800 Subject: [PATCH 35/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=A4=84=E7=90=86=E4=B8=8B=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=20npe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index d73f36a7a8..9276bd5c62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -200,21 +200,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); - String btnIconBaseDir = itemBean.getBtnIconBaseDir(); - PropertyItem propertyItem; - if (StringUtils.isEmpty(btnIconBaseDir)) { - propertyItem = new PropertyItem(itemBean.getName(), - itemBean.getTitle(), - itemBean.getBtnIconName(), - itemBean.getVisibleModes(), - itemBean.getEnableModes()); - } else{ - propertyItem = new PropertyItem(itemBean.getName(), + PropertyItem propertyItem = new PropertyItem(itemBean.getName(), itemBean.getTitle(), itemBean.getBtnIconName(), - btnIconBaseDir, itemBean.getVisibleModes(), itemBean.getEnableModes()); + String btnIconBaseDir = itemBean.getBtnIconBaseDir(); + if (StringUtils.isNotEmpty(btnIconBaseDir)) { + propertyItem.setIconBaseDir(btnIconBaseDir); } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); @@ -730,7 +723,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.isEnabled = isEnabled; button.setEnabled(isEnabled); } - + + public void setIconBaseDir(String iconBaseDir) { + this.iconBaseDir = iconBaseDir; + } + + private String getIconBaseDir() { + + return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir; + } + private void initPropertyPanel() { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); @@ -811,7 +813,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - return iconBaseDir + btnIconName + iconSuffix; + + return getIconBaseDir() + btnIconName + iconSuffix; } public void resetButtonIcon() { From fa49b621244fae2e3cac8e2ddb813f8247630be6 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 26 Mar 2020 15:33:40 +0800 Subject: [PATCH 36/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=9B=BE=E7=89=87=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=85=88=E5=8A=A0=E8=BD=BD=E8=BF=9B=E5=8E=BB=E3=80=82=20set=20?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=B0=B1=E6=99=9A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/EastRegionContainerPane.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 9276bd5c62..cf8f4f74d4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -203,12 +203,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { PropertyItem propertyItem = new PropertyItem(itemBean.getName(), itemBean.getTitle(), itemBean.getBtnIconName(), + itemBean.getBtnIconBaseDir(), itemBean.getVisibleModes(), itemBean.getEnableModes()); - String btnIconBaseDir = itemBean.getBtnIconBaseDir(); - if (StringUtils.isNotEmpty(btnIconBaseDir)) { - propertyItem.setIconBaseDir(btnIconBaseDir); - } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); for (ActionListener buttonListener : buttonListeners) { From 897c9cbd2e6d05117175cf2e56077425162ce01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 10 Apr 2020 11:04:31 +0800 Subject: [PATCH 37/88] =?UTF-8?q?CHART-13390=20&&=20CHART-13384=20?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combobox/ColorSchemeComboBox.java | 12 ++++++++---- .../component/VanChartFillStylePane.java | 19 ++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java index 9fcbeb2b69..4358a728dd 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -177,6 +177,8 @@ public class ColorSchemeComboBox extends UIComboBox { private static final int MAX_COUNT = 5; + private static final int BLANK = 1; + @Override public Dimension getPreferredSize() { Dimension preferredSize = super.getPreferredSize(); @@ -198,7 +200,8 @@ public class ColorSchemeComboBox extends UIComboBox { comp.setText(BLANK_SPACE + schemeName); } else { FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); - double width = (HEIGHT - 2 * Y) * MAX_COUNT; + //宽度是5倍的高加上4倍的留白 + double width = (HEIGHT - 2 * Y) * MAX_COUNT + BLANK * (MAX_COUNT - 1); String fill = BLANK_SPACE; //图形和文字之间留的宽度大于3倍的X while (fontMetrics.stringWidth(fill) < width + 3 * X) { @@ -228,7 +231,7 @@ public class ColorSchemeComboBox extends UIComboBox { private void drawGradient(Graphics2D g2d, List colors) { //上下留4px,宽度等于5倍高 double height = HEIGHT - 2 * Y; - double width = height * MAX_COUNT; + double width = height * MAX_COUNT + BLANK * (MAX_COUNT - 1); LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()])); g2d.setPaint(linearGradientPaint); Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height); @@ -238,10 +241,11 @@ public class ColorSchemeComboBox extends UIComboBox { private void drawCombineColor(Graphics2D g2d, List colors) { int size = Math.min(colors.size(), MAX_COUNT); double height = HEIGHT - 2 * Y; - double width = height * MAX_COUNT / size; + //加上1px留白 + double width = ((height + BLANK) * MAX_COUNT - size) / size; for (int i = 0; i < size; i++) { g2d.setPaint(colors.get(i)); - Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height); + Rectangle2D rec = new Rectangle2D.Double(X + (width + BLANK) * i, Y, width, height); g2d.fill(rec); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index c662627965..63c24a221b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -52,7 +52,15 @@ public class VanChartFillStylePane extends BasicBeanPane { this.setLayout(new BorderLayout()); styleSelectBox = new ColorSchemeComboBox(); - customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) { + @Override + public Dimension getPreferredSize() { + if (!gradientSelect) { + return colorAdjustPane.getPreferredSize(); + } + return colorGradient.getPreferredSize(); + } + }; changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); @@ -119,18 +127,11 @@ public class VanChartFillStylePane extends BasicBeanPane { } protected void initLayout() { + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); this.setLayout(new BorderLayout()); this.add(getContentPane(), BorderLayout.CENTER); } - @Override - public Dimension getPreferredSize() { - if (gradientSelect) { - return new Dimension(225, 80); - } - return super.getPreferredSize(); - } - protected JPanel getContentPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; From d301796c95693500142510bada12fd843b7656cd Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 18:08:10 +0800 Subject: [PATCH 38/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E8=B0=83=E6=95=B4=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=BF=94=E5=9B=9E=E5=90=88?= =?UTF-8?q?=E9=80=82=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/FormCreatorDropTarget.java | 6 ++++-- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 4 ++-- .../main/java/com/fr/design/mainframe/ShareWidgetPane.java | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 5f64335bed..06cb19d0ae 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -23,8 +23,9 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.SharableEditorProvider; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; +import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -42,6 +43,7 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; +import java.util.Map; /** * 添加模式下鼠标事件处理器。 @@ -101,7 +103,7 @@ public class FormCreatorDropTarget extends DropTarget { if (addingXCreator.isShared()) { String shareId = addingXCreator.getShareId(); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); - SharableWidgetBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); + SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); if (sharableEditor != null && bindInfo != null) { Map tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); //合并数据集之后,可能会有数据集名称变化,做一下联动 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index f49f2859b2..ecb3faa706 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -8,8 +8,8 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; import com.fr.share.ShareConstants; @@ -51,7 +51,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; - private SharableWidgetBindInfo[] elCaseBindInfoList; + private SharableWidgetProvider[] elCaseBindInfoList; private UIButton deleteButton; private JPanel editPanel; private JPanel resetPanel; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java index 32ce586c72..549a4b174e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,7 +1,8 @@ package com.fr.design.mainframe; -import com.fr.form.ui.SharableWidgetBindInfo; + +import com.fr.form.share.SharableWidgetProvider; import javax.swing.*; import java.awt.*; @@ -12,12 +13,12 @@ import java.awt.*; */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(SharableWidgetBindInfo[] elCaseBindInfoList, boolean isEdit) { + public ShareWidgetPane(SharableWidgetProvider[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 if (elCaseBindInfoList != null) { int rowCount = (elCaseBindInfoList.length + 1) / 2; this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); - for (SharableWidgetBindInfo rbModuleInfo : elCaseBindInfoList) { + for (SharableWidgetProvider rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); widgetButton.setElementCaseEdit(isEdit); this.add(widgetButton); From 486e03ae6a459202995890162afe832d932fb1dc Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Apr 2020 11:09:31 +0800 Subject: [PATCH 39/88] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E8=B0=83=E6=95=B4=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=BF=94=E5=9B=9E=E5=90=88?= =?UTF-8?q?=E9=80=82=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ShareWidgetButton.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java index a79ac17a5c..7e7d76d896 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,14 +1,13 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.vcs.DesignerMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.ui.AbstractBorderStyleWidget; -import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.Widget; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; @@ -52,8 +51,9 @@ import java.io.Serializable; * Time: 16:14 */ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { + private static final Dimension TAB_DEFAULT_SIZE = new Dimension(500, 300); - private SharableWidgetBindInfo bindInfo; + private SharableWidgetProvider bindInfo; private MouseEvent lastPressEvent; private JPanel reportPane; private boolean isEdit; @@ -72,7 +72,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot } }; - public ShareWidgetButton(SharableWidgetBindInfo bindInfo) { + public ShareWidgetButton(SharableWidgetProvider bindInfo) { this.bindInfo = bindInfo; this.setPreferredSize(new Dimension(108, 68)); initUI(); @@ -149,11 +149,11 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot }; } - public SharableWidgetBindInfo getBindInfo() { + public SharableWidgetProvider getBindInfo() { return bindInfo; } - public void setBindInfo(SharableWidgetBindInfo bindInfo) { + public void setBindInfo(SharableWidgetProvider bindInfo) { this.bindInfo = bindInfo; } From 8ca6f60ea72b5b9e9ae6f91c05e367c8db80a1ee Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 10 Apr 2020 11:57:37 +0800 Subject: [PATCH 40/88] =?UTF-8?q?REPORT-29457=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E8=AF=BB=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/i18n/DesignI18nImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java index 6e4fa7d3b0..7d57708642 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java @@ -15,6 +15,11 @@ import java.util.Locale; public class DesignI18nImpl implements DesignI18nProvider { + static { + // GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题 + GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage()); + } + private static DesignI18nImpl instance = new DesignI18nImpl(); public static DesignI18nImpl getInstance() { @@ -30,7 +35,7 @@ public class DesignI18nImpl implements DesignI18nProvider { @Override public String i18nText(String key) { - return localeManager.getLocalBundle(DesignerEnvManager.getEnvManager().getLanguage()).getText(localeManager, key); + return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key); } @Override From 00c4744eec30a9d801c59972568d2a1b3bbc47c4 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 10 Apr 2020 17:28:30 +0800 Subject: [PATCH 41/88] MOBILE-26388 && MOBILE-26387 && MOBILE-26189 --- .../designer/creator/XWAbsoluteLayout.java | 12 ------- .../design/mainframe/WidgetPropertyPane.java | 3 +- .../mobile/TabMobileWidgetDefinePane.java | 32 ++++++++++++++----- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 22d702dfd5..56fcf64866 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -13,11 +13,8 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; -import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.layout.FRAbsoluteLayout; -import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EditingMouseListener; @@ -593,13 +590,4 @@ public class XWAbsoluteLayout extends XLayoutContainer { public boolean isSupportShared() { return true; } - - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; - } else { - return super.getWidgetPropertyUIProviders(); - } - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index c96683f319..f7668b30a1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -9,6 +9,7 @@ import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; import com.fr.design.designer.properties.mobile.MobileStylePropertyUI; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -178,7 +179,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper if (selection != null && xCreator != null) { embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if(!designer.getDesignerMode().isFormParameterEditor()) { - if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class)) { + if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator)); } if (xCreator.supportMobileStyle()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index 5cf7f74f78..51d9aa10ae 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -5,6 +5,7 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -14,6 +15,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.form.ui.container.cardlayout.WCardTagLayout; @@ -30,6 +32,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { private AttributeChangeListener changeListener; private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; + private MobileBookMarkUsePane mobileBookMarkUsePane; public TabMobileWidgetDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -62,9 +65,15 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); holder.add(jPanel, BorderLayout.NORTH); if (!shouldHidePadding(designer)) { + JPanel innerAdvancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); - UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane); + if (FormDesignerUtils.isAppRelayout(designer)) { + mobileBookMarkUsePane = new MobileBookMarkUsePane(); + innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.SOUTH); + } + innerAdvancePane.add(marginPane, BorderLayout.CENTER); + UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane); UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane); //高级 holder.add(advancePane, BorderLayout.CENTER); @@ -77,27 +86,34 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { - templateStyleEditor.setValue(((WCardTagLayout) xCreator.toData()).getMobileTemplateStyle()); + WCardTagLayout wCardTagLayout = (WCardTagLayout) xCreator.toData(); + templateStyleEditor.setValue((wCardTagLayout).getMobileTemplateStyle()); // 数据 populate 完成后,再设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 - marginPane.populate((WCardTagLayout) xCreator.toData()); + marginPane.populate(wCardTagLayout); } if (intervalPane != null) { - intervalPane.populate((WCardTagLayout) xCreator.toData()); + intervalPane.populate(wCardTagLayout); + } + if (mobileBookMarkUsePane != null) { + mobileBookMarkUsePane.populate(xCreator); } } @Override public void update() { - ((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); + WCardTagLayout wCardTagLayout = (WCardTagLayout) xCreator.toData(); + (wCardTagLayout).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 if (marginPane != null) { - marginPane.update((WCardTagLayout) xCreator.toData()); + marginPane.update(wCardTagLayout); } if (intervalPane != null) { - intervalPane.update((WCardTagLayout) xCreator.toData()); + intervalPane.update(wCardTagLayout); } - } + if (mobileBookMarkUsePane != null) { + mobileBookMarkUsePane.update(xCreator); + } } } From 3d72ad46378adea54965c2277183b836ce9671cd Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 10 Apr 2020 17:30:01 +0800 Subject: [PATCH 42/88] fix --- .../widget/ui/designer/mobile/TabMobileWidgetDefinePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index 51d9aa10ae..3f3d34eaf7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -115,5 +115,6 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { } if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.update(xCreator); - } } + } + } } From 6894dce984c42ea61cb8f39addeb35dedcc23824 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 10 Apr 2020 18:05:28 +0800 Subject: [PATCH 43/88] =?UTF-8?q?MOBILE-26191=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E5=AE=9A=E4=BD=8D=E9=85=8D=E7=BD=AE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=AD=98=E5=9C=A8=E4=B8=8D=E7=AC=A6=E5=90=88=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 组件高度较小 2. 国际版上内容超出显示范围,不可滚动 --- ...arMobileBookMarkStyleCustomDefinePane.java | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java index 66358a30e9..817f299511 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.AttrScrollPane; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; @@ -34,6 +35,7 @@ import java.awt.*; public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane { private static final long serialVersionUID = 1L; + private static final int COLUMN_HEIGHT = 20; private static final int COLUMN_WIDTH = 160; private UnsignedIntUISpinner buttonWidthSpinner; @@ -73,9 +75,20 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane Date: Mon, 13 Apr 2020 11:21:42 +0800 Subject: [PATCH 44/88] =?UTF-8?q?REPORT-29722=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E6=8F=92=E4=BB=B6=E3=80=91@harrison,?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E7=9A=84=E5=B0=8F=E7=BA=A2=E7=82=B9=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=A3=85=E6=8F=92=E4=BB=B6=E4=B9=9F=E6=9C=89=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E8=8F=9C=E5=8D=95=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E3=80=82=20=E9=BB=98=E8=AE=A4=E6=98=AF=E5=B7=B2=E8=AF=BB?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BA=86=E9=9D=9E=E5=B7=B2=E8=AF=BB=E7=9A=84=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E6=89=8D=E4=BC=9A=E5=B1=95=E7=A4=BA=E6=88=90=E9=9D=9E?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/menu/SnapChatMenuDef.java | 28 ++++++- .../fr/design/menu/SnapChatUpdateAction.java | 9 ++- .../com/fr/design/notification/SnapChat.java | 7 ++ .../design/notification/SnapChatConfig.java | 8 +- .../fr/design/menu/SnapChatMenuDefTest.java | 76 +++++++++++++++++++ 5 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java index 473c17f251..defbf0dbbf 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -42,7 +42,9 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { public boolean hasRead() { String calcKey = calcKey(); - return SnapChatConfig.getInstance().hasRead(calcKey); + Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); + // 默认读过了。 + return val == null ? defaultStatus() : val; } @Override @@ -52,6 +54,30 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { SnapChatConfig.getInstance().markRead(calcKey); } + @Override + public boolean defaultStatus() { + + return true; + } + + @Override + public void addShortCut(ShortCut... shortCuts) { + + if (shortCuts == null) { + return; + } + for (ShortCut shortCut : shortCuts) { + if (shortCut instanceof SnapChatUpdateAction) { + SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; + if (!action.hasRead()) { + String calcKey = calcKey(); + SnapChatConfig.getInstance().resetRead(calcKey); + } + } + } + super.addShortCut(shortCuts); + } + @Override public SnapChatKey key() { diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java index 4829545468..9ade762500 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -32,7 +32,8 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC public boolean hasRead() { String calcKey = calcKey(); - return SnapChatConfig.getInstance().hasRead(calcKey); + Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); + return val == null ? defaultStatus() : val; } @Override @@ -42,6 +43,12 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC SnapChatConfig.getInstance().markRead(calcKey); } + @Override + public boolean defaultStatus() { + + return false; + } + @Override public SnapChatKey key() { diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java index 8dd6f8aa28..4f610c060b 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java @@ -7,6 +7,13 @@ package com.fr.design.notification; **/ public interface SnapChat { + /** + * 默认状态 + * + * @return 默认状态 + */ + boolean defaultStatus(); + /** * 已读 * diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index ed6b7a6d8f..c192d054c6 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -31,8 +31,7 @@ public class SnapChatConfig implements XMLable { public Boolean hasRead(String key) { Map map = markReadMap; - Boolean val = map.get(key); - return val == null ? Boolean.FALSE : val; + return map.get(key); } public void markRead(String key) { @@ -40,6 +39,11 @@ public class SnapChatConfig implements XMLable { markReadMap.put(key, Boolean.TRUE); } + public void resetRead(String key) { + + markReadMap.put(key, Boolean.FALSE); + } + @Override public void readXML(XMLableReader reader) { diff --git a/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java b/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java new file mode 100644 index 0000000000..25671596c6 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java @@ -0,0 +1,76 @@ +package com.fr.design.menu; + +import com.fr.config.dao.DaoContext; +import com.fr.config.dao.impl.LocalClassHelperDao; +import com.fr.config.dao.impl.LocalEntityDao; +import com.fr.config.dao.impl.LocalXmlEntityDao; +import com.fr.design.actions.UpdateAction; +import com.fr.design.notification.SnapChatAllTypes; +import com.fr.design.notification.SnapChatConfig; +import com.fr.stable.xml.XMLableReader; +import com.fr.store.StateHubManager; +import com.fr.store.impl.MemoryLock; +import com.fr.store.impl.MemoryStore; +import com.fr.transaction.Configurations; +import com.fr.transaction.LocalConfigurationHelper; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.api.support.membermodification.MemberMatcher; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.reflect.Whitebox; + +import java.awt.event.ActionEvent; +import java.util.HashMap; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({SnapChatConfig.class, SnapChatUpdateAction.class}) +@PowerMockIgnore({"javax.crypto.*","javax.net.ssl.*","sun.security.ssl.*","com.sun.*"}) +public class SnapChatMenuDefTest { + + @Before + public void before() throws Exception { + + DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); + DaoContext.setClassHelperDao(new LocalClassHelperDao()); + DaoContext.setEntityDao(new LocalEntityDao()); + StateHubManager.setLock(new MemoryLock()); + StateHubManager.setStorage(new MemoryStore()); + Configurations.setHelper(new LocalConfigurationHelper()); + } + + @Test + public void testAddShortCut() throws Exception { + + PowerMock.suppress(MemberMatcher.constructor(UpdateAction.class)); + SnapChatConfig snapChatConfig = EasyMock.partialMockBuilder(SnapChatConfig.class) + .addMockedMethod("readXML") + .createMock(); + Whitebox.setInternalState(snapChatConfig, "markReadMap", new HashMap()); + snapChatConfig.readXML(EasyMock.anyObject(XMLableReader.class)); + EasyMock.expectLastCall().anyTimes(); + EasyMock.replay(snapChatConfig); + + PowerMock.mockStatic(SnapChatConfig.class); + EasyMock.expect(SnapChatConfig.getInstance()).andReturn(snapChatConfig).anyTimes(); + PowerMock.replayAll(); + + SnapChatMenuDef menuDef = new SnapChatMenuDef("test", SnapChatAllTypes.Menu.BBS); + ShortCut action = new SnapChatUpdateAction(SnapChatAllTypes.Menu.BBS) { + @Override + protected void actionPerformed0(ActionEvent e) { + + } + }; + + Assert.assertTrue(menuDef.hasRead()); + + menuDef.addShortCut(action); + Assert.assertFalse(menuDef.hasRead()); + } +} \ No newline at end of file From 2c91ce7fa4e1fe0d5d9bf6449d9ade611cc93cf6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 13 Apr 2020 14:01:57 +0800 Subject: [PATCH 45/88] =?UTF-8?q?MOBILE-26509=20=E8=81=94=E6=8E=92tab?= =?UTF-8?q?=E7=9A=84=E6=A0=87=E9=A2=98=E8=83=8C=E6=99=AF=E8=89=B2=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BA=86"=E9=80=8F=E6=98=8E"=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E5=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=B8=8A=E7=9C=8B=E6=98=AF?= =?UTF-8?q?=E7=99=BD=E8=89=B2=E7=9A=84=EF=BC=8C=E5=BA=94=E8=AF=A5=E6=98=BE?= =?UTF-8?q?=E7=A4=BAtab=E8=83=8C=E6=99=AF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设计文档修改为背景色选择器无透明项 --- .../design/mainframe/mobile/ui/UniteStyleDefinePane.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java index 2f269b028d..527697501a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.widget.MobileTabFontConfPane; import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.style.color.NewColorSelectBox; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.TabFontConfig; @@ -33,8 +34,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane { private UnsignedIntUISpinner paddingLeftSpinner; private UnsignedIntUISpinner paddingRightSpinner; - private ColorSelectBox initialBackgroundColorBox; - private ColorSelectBox selectedBackgroundColorBox; + private NewColorSelectBox initialBackgroundColorBox; + private NewColorSelectBox selectedBackgroundColorBox; private LineComboBox borderWidthComboBox; private ColorSelectBox borderColorBox; @@ -96,9 +97,9 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane { } private JPanel createBackgroundColorConfPanel() { - this.initialBackgroundColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH); + this.initialBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH); this.initialBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); - this.selectedBackgroundColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH); + this.selectedBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH); this.selectedBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT)); UILabel initialBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill") + ":", SwingConstants.RIGHT); From 82d69aa9cbc91db3f9bacde151531a7c7fde922b Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 13 Apr 2020 14:20:15 +0800 Subject: [PATCH 46/88] =?UTF-8?q?MOBILE-26514=20=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E8=AE=BE=E7=BD=AE=E4=BA=86=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E4=BC=9A=E5=AF=BC=E8=87=B4=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 处理ColorSelectBox选择透明后返回空对象的问题 --- .../ui/SidebarMobileBookMarkStyleCustomDefinePane.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java index 817f299511..ae79160bbd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java @@ -358,9 +358,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane Date: Mon, 13 Apr 2020 18:17:30 +0800 Subject: [PATCH 47/88] =?UTF-8?q?KERNEL-3790=20PluginStoreConstants=20?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=A5=BD=E5=83=8F=E4=B8=8D=E5=A4=AA=E5=AF=B9?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E6=80=8E=E4=B9=88=E8=BF=98=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E5=8D=95=E4=BE=8B=E6=96=B9=E6=B3=95=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/WebViewDlgHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java index 3abcfc0a4f..47d1541461 100644 --- a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java +++ b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java @@ -75,7 +75,7 @@ public class WebViewDlgHelper { } return; } - String jar_version = PluginStoreConstants.getInstance().getProps(ENV_VERSION, StringUtils.EMPTY); + String jar_version = PluginStoreConstants.getProps(ENV_VERSION, StringUtils.EMPTY); if (ComparatorUtils.equals(jar_version, ProductConstants.VERSION)) { updateShopScripts(SHOP_SCRIPTS); showPluginDlg(); @@ -297,7 +297,7 @@ public class WebViewDlgHelper { protected Void doInBackground() throws Exception { String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update"); if (url != null) { - String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION")); + String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getProps("VERSION")); JSONObject resultJSONObject = new JSONObject(text); String isLatest = resultJSONObject.optString("result"); if (!ComparatorUtils.equals(isLatest, LATEST)) { From 0cd9cbb974947e035410cd0a485387c844b9e6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 14 Apr 2020 14:11:55 +0800 Subject: [PATCH 48/88] =?UTF-8?q?CHART-13460=20FR=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=BC=BA=E5=A4=B1=E4=B8=8B=E8=BD=BD=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/ChartDesignerActivator.java | 4 +++ .../chart/DownloadOnlineSourcesHelper.java | 28 +++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index c5bfdc8390..f47f421344 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -1,6 +1,7 @@ package com.fr.design.chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.gui.ChartComponent; @@ -17,6 +18,7 @@ import com.fr.module.Activator; import com.fr.module.extension.Prepare; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; +import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.map.server.ChartMapEditorAction; /** @@ -47,6 +49,8 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); + GEOJSONHelper.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + ChartTypeInterfaceManager.addPluginChangedListener(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java index c0fd710680..33dba72f9b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java @@ -6,26 +6,32 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; - import com.fr.general.CloudCenter; +import com.fr.general.IOUtils; import com.fr.general.http.HttpClient; import com.fr.plugin.chart.DownloadSourcesEvent; import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.image.BufferedImage; +import javax.swing.ImageIcon; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Rectangle; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; /** * Created by shine on 2017/8/21. @@ -51,13 +57,6 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { //总共字节数 private double totalBytes = 0; - - private static final double PHANTOM_MB = 96.1 * 1024 * 1024; - - public void addPhantomSiteInfo() { - this.addSiteInfo("plugin.phantomjs", ChartConstants.PHANTOMJS_URL, PHANTOM_MB); - } - private static final double MAP_JSON_MB = 4.5 * 1024 * 1024; public void addMapJSONSiteInfo() { @@ -219,7 +218,6 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { @Override public void downloadSources() { this.addMapJSONSiteInfo(); - this.addPhantomSiteInfo(); this.installOnline(); } From 212bcef93f38d2e69d015862f817e29c7517fc11 Mon Sep 17 00:00:00 2001 From: "Java.Edge" Date: Tue, 14 Apr 2020 16:53:49 +0800 Subject: [PATCH 49/88] EPORT-27996 bugfix --- .../java/com/fr/design/gui/ilist/TableViewList.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 06a4f54800..cccf64e26d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -91,10 +91,10 @@ public class TableViewList extends UIList { if (refreshList != null) { refreshList.cancel(true); } - refreshList = new SwingWorker() { + refreshList = new SwingWorker() { @Override - protected Void doInBackground() throws Exception { + protected DefaultListModel doInBackground() throws Exception { Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); boolean status = false; int count = 3; @@ -106,13 +106,13 @@ public class TableViewList extends UIList { if (!status) { throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); } - TableViewList.this.setModel(processDataInAnotherThread(databaseName, searchFilter, typesFilter)); - return null; + return processDataInAnotherThread(databaseName, searchFilter, typesFilter); } + @Override public void done() { try { - get(); + TableViewList.this.setModel(get()); } catch (Exception e) { if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) { TableViewList.this.setModel(failed); From 39a4c196878f3d7226a1cdeb63fc9a7659084519 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 14 Apr 2020 18:10:38 +0800 Subject: [PATCH 50/88] =?UTF-8?q?REPORT-29669=20=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E7=BD=91=E5=9D=80=E7=AE=A1=E7=90=86=E4=B8=AD=E5=BF=83=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E5=9C=A8=E5=85=B3=E9=97=AD=E5=90=8E=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/extra/exe/GetPluginCategoriesExecutor.java | 3 ++- .../design/extra/exe/GetPluginFromStoreExecutor.java | 4 ++-- .../com/fr/design/extra/exe/SearchOnlineExecutor.java | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java index 0a3b76211d..1d6e8c4836 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java @@ -4,6 +4,7 @@ import com.fr.design.extra.PluginConstants; import com.fr.design.extra.Process; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; +import com.fr.stable.StringUtils; /** * Created by vito on 16/5/16. @@ -28,7 +29,7 @@ public class GetPluginCategoriesExecutor implements Executor { @Override public void run(Process process) { String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category"); - if (url != null) { + if (StringUtils.isNotEmpty(url)) { HttpClient httpClient = new HttpClient(url); result = httpClient.getResponseText(); } else { diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java index 4a1168734e..3bf7b2cb32 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java @@ -52,7 +52,7 @@ public class GetPluginFromStoreExecutor implements Executor { @Override public void run(Process process) { - String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; + String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist"); boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope); if (getRecommend) { result = PluginOperateUtils.getRecommendPlugins(); @@ -61,7 +61,7 @@ public class GetPluginFromStoreExecutor implements Executor { if (StringUtils.isNotBlank(plistUrl)) { StringBuilder url = new StringBuilder(); - url.append(plistUrl); + url.append(plistUrl).append("?"); PluginOperateUtils.dealParams(url, category, seller, fee, scope); try { HttpClient httpClient = new HttpClient(url.toString()); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java b/designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java index fdbd8562f4..1a84519eee 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java @@ -14,8 +14,8 @@ import com.fr.stable.StringUtils; * Created by vito on 16/4/18. */ public class SearchOnlineExecutor implements Executor { - private String result = StringUtils.EMPTY; - private String keyword; + private String result = JSONArray.create().toString(); + private final String keyword; public SearchOnlineExecutor(String keyword) { this.keyword = keyword; @@ -42,7 +42,11 @@ public class SearchOnlineExecutor implements Executor { result = PluginOperateUtils.getRecommendPlugins(); return; } - HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); + String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store"); + if (StringUtils.isEmpty(url)) { + return; + } + HttpClient httpClient = new HttpClient(url + "&keyword=" + keyword); httpClient.asGet(); String responseText = httpClient.getResponseText(); JSONObject jsonObject = new JSONObject(responseText); From 78d85bdeeeb75edf0d77ae057b83536c59db4b04 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 14 Apr 2020 18:23:51 +0800 Subject: [PATCH 51/88] =?UTF-8?q?REPORT-29886=20=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E5=86=99=E6=AD=BB=E6=83=85=E5=86=B5=E6=8E=92=E6=9F=A5=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/JavaEditorPane.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java index 9b5a95a431..a34762a1fd 100644 --- a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java @@ -220,8 +220,8 @@ public class JavaEditorPane extends BasicPane { " }\n" + "\n" + " /**\n" + - " * 获取数据集的列数\n" + - " * @return 数据集的列\n" + + " * Get the number of columns in a dataset\n" + + " * @return Dataset columns\n" + " * @throws TableDataException\n" + " */\n" + " public int getColumnCount() throws TableDataException {\n" + @@ -229,9 +229,9 @@ public class JavaEditorPane extends BasicPane { " }\n" + "\n" + " /**\n" + - " * 获取数据集指定列的列名\n" + - " * @param columnIndex 指定列的索引\n" + - " * @return 指定列的列名\n" + + " * Get the column name of the specified column of the dataset\n" + + " * @param columnIndex The index of the specified column\n" + + " * @return The column name of the specified column\n" + " * @throws TableDataException\n" + " */\n" + " public String getColumnName(int columnIndex) throws TableDataException {\n" + @@ -239,8 +239,8 @@ public class JavaEditorPane extends BasicPane { " }\n" + "\n" + " /**\n" + - " * 获取数据集的行数\n" + - " * @return 数据集数据行数\n" + + " * Get the number of rows in the dataset\n" + + " * @return Dataset rows\n" + " * @throws TableDataException\n" + " */\n" + " public int getRowCount() throws TableDataException {\n" + @@ -248,10 +248,10 @@ public class JavaEditorPane extends BasicPane { " }\n" + "\n" + " /**\n" + - " * 获取数据集指定位置上的值\n" + - " * @param rowIndex 指定的行索引\n" + - " * @param columnIndex 指定的列索引\n" + - " * @return 指定位置的值\n" + + " * Get the value at the specified position in the dataset\n" + + " * @param rowIndex The specified row index\n" + + " * @param columnIndex The specified column index\n" + + " * @return The value of the specified location\n" + " */\n" + " public Object getValueAt(int rowIndex, int columnIndex) {\n" + " return null;\n" + @@ -263,12 +263,12 @@ public class JavaEditorPane extends BasicPane { "import com.fr.script.AbstractFunction;\n" + "\n" + "/**\n" + - " * 自定义函数\n" + + " * Custom function\n" + " */\n" + "public class CustomFun extends AbstractFunction {\n" + " /**\n" + - " * @param args 函数的参数,是经过了算子处理了其中特殊参数的\n" + - " * @return 经过函数处理的值,用于参与最终计算\n" + + " * @param args The parameters of the function are processed by calculator with special parameters\n" + + " * @return The value processed by the function is used to participate in the final calculation\n" + " */\n" + " public Object run(Object[] args) {\n" + " return null;\n" + From 10dd3858cdde8e28497d0926f380212c43dcbaef Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 14 Apr 2020 20:01:39 +0800 Subject: [PATCH 52/88] =?UTF-8?q?KERNEL-3501=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E8=87=AA=E9=80=82=E5=BA=94=E5=90=8E=E7=AB=AF=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=8D=95=E5=85=83=E6=A0=BC=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/unit/ReportLengthUNIT.java | 21 ++++++++ .../unit/ReportLengthUnitProcessor.java | 14 +++++ .../com/fr/design/unit/UnitConvertUtil.java | 42 +++++++++++++++ .../AbstracReportLengthUnitProcessor.java | 19 +++++++ .../unit/impl/AbstractReportLengthUNIT.java | 22 ++++++++ .../design/unit/impl/CMReportLengthUNIT.java | 32 +++++++++++ .../unit/impl/INCHReportLengthUNIT.java | 31 +++++++++++ .../design/unit/impl/MMReportLengthUNIT.java | 31 +++++++++++ .../design/unit/impl/PTReportLengthUNIT.java | 30 +++++++++++ .../FormWidgetDefinePaneFactoryBase.java | 7 ++- .../columnrow/ColumnRowSizingAction.java | 49 +++++------------ .../java/com/fr/design/condition/WHPane.java | 53 +++++-------------- .../grid/AbstractGridHeaderMouseHandler.java | 26 +++------ 13 files changed, 280 insertions(+), 97 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java new file mode 100644 index 0000000000..513232d951 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java @@ -0,0 +1,21 @@ +package com.fr.design.unit; + +import com.fr.stable.fun.mark.Mutable; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUNIT extends Mutable { + String MARK_STRING = "ReportLengthUNIT"; + + int CURRENT_LEVEL = 1; + + String unitText(); + + int unitType(); + + float unit2Value4Scale(UNIT value); + + UNIT float2UNIT(float value); +} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java new file mode 100644 index 0000000000..f496d69dba --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java @@ -0,0 +1,14 @@ +package com.fr.design.unit; + +import com.fr.stable.fun.mark.Immutable; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUnitProcessor extends Immutable { + String MARK_STRING = "ReportLengthUnitProcessor"; + int CURRENT_LEVEL = 1; + + ReportLengthUNIT getReportLengthUNIT(); + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java new file mode 100644 index 0000000000..80d35d83b4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -0,0 +1,42 @@ +package com.fr.design.unit; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.unit.impl.CMReportLengthUNIT; +import com.fr.design.unit.impl.INCHReportLengthUNIT; +import com.fr.design.unit.impl.MMReportLengthUNIT; +import com.fr.design.unit.impl.PTReportLengthUNIT; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-04-09 + */ +public class UnitConvertUtil { + private static List lengthUNITList = new ArrayList(); + + static { + lengthUNITList.add(new CMReportLengthUNIT()); + lengthUNITList.add(new INCHReportLengthUNIT()); + lengthUNITList.add(new PTReportLengthUNIT()); + lengthUNITList.add(new MMReportLengthUNIT()); + } + + private UnitConvertUtil() { + + } + + + public static ReportLengthUNIT parseLengthUNIT(int unitType) { + ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); + if (lengthUnitProcessor != null) { + return lengthUnitProcessor.getReportLengthUNIT(); + } + for (ReportLengthUNIT lengthUNIT : lengthUNITList) { + if (unitType == lengthUNIT.unitType()) { + return lengthUNIT; + } + } + return new MMReportLengthUNIT(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java new file mode 100644 index 0000000000..64242b3b3c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java @@ -0,0 +1,19 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.ReportLengthUnitProcessor; + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstracReportLengthUnitProcessor implements ReportLengthUnitProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java new file mode 100644 index 0000000000..d1947b8f4e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java @@ -0,0 +1,22 @@ +package com.fr.design.unit.impl; + + +import com.fr.design.unit.ReportLengthUNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstractReportLengthUNIT implements ReportLengthUNIT { + + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java new file mode 100644 index 0000000000..e3b550d018 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java @@ -0,0 +1,32 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.CM; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class CMReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); + } + + @Override + public int unitType() { + return Constants.UNIT_CM; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toCMValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new CM(value); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java new file mode 100644 index 0000000000..c919e14e14 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java @@ -0,0 +1,31 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.INCH; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class INCHReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"); + } + + @Override + public int unitType() { + return Constants.UNIT_INCH; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toINCHValue4Scale3(); + } + + @Override + public UNIT float2UNIT(float value) { + return new INCH(value); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java new file mode 100644 index 0000000000..e6f3523ecc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java @@ -0,0 +1,31 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.MM; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class MMReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"); + } + + @Override + public int unitType() { + return Constants.UNIT_MM; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toMMValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new MM(value); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java new file mode 100644 index 0000000000..1ab5bbedfb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java @@ -0,0 +1,30 @@ +package com.fr.design.unit.impl; + +import com.fr.stable.Constants; +import com.fr.stable.unit.PT; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class PTReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"); + } + + @Override + public int unitType() { + return Constants.UNIT_PT; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toPTValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new PT(value); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 9df0a32012..1947e9ec4e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -127,6 +127,11 @@ public class FormWidgetDefinePaneFactoryBase { } + + public static void registerDefinePane(Class widget, Appearance appearance) { + defineMap.put(widget, appearance); + } + public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { if (isExtraXWidget(widget)) { WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); @@ -165,4 +170,4 @@ public class FormWidgetDefinePaneFactoryBase { } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index c9cc9e1b59..b14d1945b7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -10,14 +10,11 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.unit.UnitConvertUtil; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; import com.fr.stable.ArrayUtils; -import com.fr.stable.Constants; -import com.fr.stable.unit.CM; -import com.fr.stable.unit.INCH; -import com.fr.stable.unit.MM; -import com.fr.stable.unit.PT; import com.fr.stable.unit.UNIT; /** @@ -28,7 +25,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected ColumnRowSizingAction(ElementCasePane t, int indexOfColumnOrRow) { super(t, indexOfColumnOrRow); } - + @Override protected boolean executeActionReturnUndoRecordNeededWithCellSelection( CellSelection cs) { @@ -43,7 +40,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction }; UNIT len = getShowLen(report, cs); populateNumberDialog(uPane, len); - + final CellSelection finalCS = cs; uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @@ -52,21 +49,13 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction try { float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - UNIT len; - if (unitType == Constants.UNIT_CM) { - len = new CM(newHeight); - } else if (unitType == Constants.UNIT_INCH) { - len = new INCH(newHeight); - } else if (unitType == Constants.UNIT_PT) { - len = new PT(newHeight); - } else { - len = new MM(newHeight); - } + ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + UNIT len = lengthUNIT.float2UNIT(newHeight); updateAction(report, len, finalCS); } catch (ValueNotChangeException e) { // nothing } - + ePane.fireTargetModified(); } }).setVisible(true); @@ -75,28 +64,16 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - float va; - if (unitType == Constants.UNIT_CM) { - va = unit.toCMValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM")); - } else if (unitType == Constants.UNIT_INCH) { - va = unit.toINCHValue4Scale3(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")); - } else if (unitType == Constants.UNIT_PT) { - va = unit.toPTValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT")); - } else { - va = unit.toMMValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM")); - } - + ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + float va = lengthUNIT.unit2Value4Scale(unit); + uPane.setUnitText(lengthUNIT.unitText()); uPane.populate(va); } - + protected abstract String title4UnitInputPane(); - + protected abstract void updateAction(ElementCase report, UNIT len, CellSelection cs); - + protected abstract UNIT getShowLen(ElementCase report, CellSelection cs); protected abstract UNIT getIndexLen(int index, ElementCase report); diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index dce2d466ad..ed8eea8541 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -3,17 +3,16 @@ package com.fr.design.condition; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.highlight.HighlightAction; -import com.fr.stable.Constants; -import com.fr.stable.unit.*; +import com.fr.stable.unit.UNIT; -import javax.swing.*; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; import java.math.BigDecimal; -import java.text.ParseException; /** * @author richie @@ -45,23 +44,12 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane Date: Wed, 15 Apr 2020 09:06:29 +0800 Subject: [PATCH 53/88] =?UTF-8?q?CHART-13481=20=E5=A4=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E9=AB=98=E4=BA=AE=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/style/VanChartLegendPane.java | 1 + .../chart/designer/style/VanChartPlotLegendPane.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java index facef9208a..8fb3aed22e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartLegendPane.java @@ -68,6 +68,7 @@ public class VanChartLegendPane extends AbstractVanChartScrollPane { if (plot == null) { return; } + legendContent.setPlot(plot); VanChartLegend legend = (VanChartLegend) plot.getLegend(); if (legendContent != null) { legendContent.populateBean(legend); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 5a9d8ebda8..4ab88f6167 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -2,14 +2,15 @@ package com.fr.van.chart.designer.style; import com.fr.base.BaseUtils; import com.fr.base.Style; +import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -18,6 +19,7 @@ import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.type.LayoutType; import com.fr.stable.Constants; +import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; @@ -46,6 +48,8 @@ public class VanChartPlotLegendPane extends BasicPane { private static final int HEIGHT = 100; private static final int GAP = 20; + private Plot plot; + private UICheckBox isLegendVisible; private JPanel legendPane; @@ -80,6 +84,10 @@ public class VanChartPlotLegendPane extends BasicPane { initComponents(); } + public void setPlot(Plot plot) { + this.plot = plot; + } + public JPanel getHighlightPane() { return highlightPane; } @@ -421,6 +429,7 @@ public class VanChartPlotLegendPane extends BasicPane { //limitPane.populateBean(legend.getLimitAttribute()); if(highlightButton != null){ highlightButton.setSelectedItem(legend.isHighlight()); + highlightButton.setEnabled(!PlotFactory.largeDataModel(plot)); } } From 5290d345e872791fbc1c2d0224c172da24d1599b Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 15 Apr 2020 09:18:07 +0800 Subject: [PATCH 54/88] =?UTF-8?q?REPORT-29722=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E6=8F=92=E4=BB=B6=E3=80=91@harrison,?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E7=9A=84=E5=B0=8F=E7=BA=A2=E7=82=B9=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=A3=85=E6=8F=92=E4=BB=B6=E4=B9=9F=E6=9C=89=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86=20=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E4=B9=9F=E8=A6=81=E5=A4=84=E7=90=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/menu/MenuDef.java | 6 ++- .../com/fr/design/menu/SnapChatMenuDef.java | 41 ++++++++++++------- .../fr/design/menu/SnapChatMenuDefTest.java | 30 ++++++++++++++ 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index f495e03f13..10f9944947 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -138,9 +138,13 @@ public class MenuDef extends ShortCut { */ public void addShortCut(ShortCut... shortcut) { for (ShortCut i : shortcut) { - this.shortcutList.add(i); + addShortCut(i); } } + + public void addShortCut(ShortCut shortCut) { + this.shortcutList.add(shortCut); + } public void removeShortCut(ShortCut shortCut) { diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java index defbf0dbbf..2ec3f6c7ee 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -61,23 +61,20 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { } @Override - public void addShortCut(ShortCut... shortCuts) { + public void addShortCut(ShortCut shortCut) { - if (shortCuts == null) { - return; - } - for (ShortCut shortCut : shortCuts) { - if (shortCut instanceof SnapChatUpdateAction) { - SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; - if (!action.hasRead()) { - String calcKey = calcKey(); - SnapChatConfig.getInstance().resetRead(calcKey); - } - } - } - super.addShortCut(shortCuts); + addSnapChatNotification(shortCut); + super.addShortCut(shortCut); } + @Override + public void insertShortCut(int index, ShortCut shortCut) { + + addSnapChatNotification(shortCut); + super.insertShortCut(index, shortCut); + } + + @Override public SnapChatKey key() { @@ -90,6 +87,22 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { return new SnapChatMenuListener(); } + /** + * 添加提醒 + * + * @param shortCut 快捷方式 + */ + private void addSnapChatNotification(ShortCut shortCut) { + + if (shortCut instanceof SnapChatUpdateAction) { + SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; + if (!action.hasRead()) { + String calcKey = calcKey(); + SnapChatConfig.getInstance().resetRead(calcKey); + } + } + } + private String calcKey() { return key().calc(); diff --git a/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java b/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java index 25671596c6..298f51a4cc 100644 --- a/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java +++ b/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java @@ -73,4 +73,34 @@ public class SnapChatMenuDefTest { menuDef.addShortCut(action); Assert.assertFalse(menuDef.hasRead()); } + + @Test + public void testInsertShortCut() throws Exception { + + PowerMock.suppress(MemberMatcher.constructor(UpdateAction.class)); + SnapChatConfig snapChatConfig = EasyMock.partialMockBuilder(SnapChatConfig.class) + .addMockedMethod("readXML") + .createMock(); + Whitebox.setInternalState(snapChatConfig, "markReadMap", new HashMap()); + snapChatConfig.readXML(EasyMock.anyObject(XMLableReader.class)); + EasyMock.expectLastCall().anyTimes(); + EasyMock.replay(snapChatConfig); + + PowerMock.mockStatic(SnapChatConfig.class); + EasyMock.expect(SnapChatConfig.getInstance()).andReturn(snapChatConfig).anyTimes(); + PowerMock.replayAll(); + + SnapChatMenuDef menuDef = new SnapChatMenuDef("test", SnapChatAllTypes.Menu.BBS); + ShortCut action = new SnapChatUpdateAction(SnapChatAllTypes.Menu.BBS) { + @Override + protected void actionPerformed0(ActionEvent e) { + + } + }; + + Assert.assertTrue(menuDef.hasRead()); + + menuDef.insertShortCut(0, action); + Assert.assertFalse(menuDef.hasRead()); + } } \ No newline at end of file From 14a6040285cf6d9e0b9193b17956155b77cd72eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 15 Apr 2020 09:56:54 +0800 Subject: [PATCH 55/88] =?UTF-8?q?CHART-13460=20=E6=89=93=E5=8C=85=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/chart/ChartDesignerActivator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index f47f421344..8ad2e6198f 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -1,7 +1,6 @@ package com.fr.design.chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.gui.ChartComponent; @@ -16,6 +15,7 @@ import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; +import com.fr.plugin.chart.vanchart.export.ImagePainter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.DownloadOnlineSourcesHelper; @@ -49,7 +49,7 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); - GEOJSONHelper.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ChartTypeInterfaceManager.addPluginChangedListener(); } From 8499541ae917e94c20fe342e1c91e24b1cdfec41 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 15 Apr 2020 10:42:02 +0800 Subject: [PATCH 56/88] MOBILE-26530 && MOBILE-26197 --- .../fr/design/designer/creator/XWAbsoluteLayout.java | 12 ++++++++++++ .../ui/designer/mobile/MobileAdvanceDefinePane.java | 12 +++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 56fcf64866..22d702dfd5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -13,8 +13,11 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EditingMouseListener; @@ -590,4 +593,13 @@ public class XWAbsoluteLayout extends XLayoutContainer { public boolean isSupportShared() { return true; } + + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { + return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; + } else { + return super.getWidgetPropertyUIProviders(); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index 587ea53950..34f6a7adf5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -20,6 +20,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.mobile.MobileBookMark; +import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -33,6 +34,7 @@ import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.Iterator; +import java.util.List; /** * @author hades @@ -180,12 +182,16 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); WLayout container = form.getContainer(); WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); - Iterator iterator = wSortLayout.getMobileWidgetIterator(); - while (iterator.hasNext()) { - Widget widget = form.getWidgetByName(iterator.next()); + List list = wSortLayout.getOrderedMobileWidgetList(); + for (String value : list) { + Widget widget = form.getWidgetByName(value); if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) { return true; } + CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); + if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) { + return true; + } } return false; } From f16a9205372dccacca259671f45f909b18c9c0c8 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 15 Apr 2020 11:45:12 +0800 Subject: [PATCH 57/88] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractFormAdaptiveConfigUI.java | 18 +++++++++++++ .../fit/menupane/FormAdaptiveConfigUI.java | 26 +++++++++++++++++++ .../fit/menupane/ReportFitAttrAction.java | 15 +++++++++-- .../unit/ReportLengthUnitProcessor.java | 2 +- .../com/fr/design/unit/UnitConvertUtil.java | 2 +- .../form/FormElementCaseDesigner.java | 8 +++++- 6 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java new file mode 100644 index 0000000000..bf0822104e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java @@ -0,0 +1,18 @@ +package com.fr.design.report.fit.menupane; + + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstractFormAdaptiveConfigUI implements FormAdaptiveConfigUI { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java new file mode 100644 index 0000000000..cd88ec4ece --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java @@ -0,0 +1,26 @@ +package com.fr.design.report.fit.menupane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + + +/** + * Created by kerry on 2020-04-09 + */ +public interface FormAdaptiveConfigUI extends Immutable { + + String MARK_STRING = "FormAdaptiveConfigUI"; + int CURRENT_LEVEL = 1; + + + BasicBeanPane getConfigPane(); + + BufferedImage getElementCaseImage(Dimension size, JComponent elementCasePane); + + +} + diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 29a8a7deb6..ebffc98095 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit.menupane; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -42,6 +43,10 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { + FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (configPane != null) { + return configPane.getConfigPane().getTitle(); + } return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); } @@ -85,7 +90,13 @@ public class ReportFitAttrAction extends JTemplateAction { final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { - final ReportFitAttrPane attrPane = new ReportFitAttrPane(); + BasicBeanPane attrPane = null; + FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (configPane != null) { + attrPane = configPane.getConfigPane(); + }else{ + attrPane = new ReportFitAttrPane(); + } showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } } @@ -102,4 +113,4 @@ public class ReportFitAttrAction extends JTemplateAction { dialog.setVisible(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java index f496d69dba..4adffd28c9 100644 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java @@ -9,6 +9,6 @@ public interface ReportLengthUnitProcessor extends Immutable { String MARK_STRING = "ReportLengthUnitProcessor"; int CURRENT_LEVEL = 1; - ReportLengthUNIT getReportLengthUNIT(); + ReportLengthUNIT getReportLengthUNIT(int unitType); } diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index 80d35d83b4..fee1cccd78 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -30,7 +30,7 @@ public class UnitConvertUtil { public static ReportLengthUNIT parseLengthUNIT(int unitType) { ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); if (lengthUnitProcessor != null) { - return lengthUnitProcessor.getReportLengthUNIT(); + return lengthUnitProcessor.getReportLengthUNIT(unitType); } for (ReportLengthUNIT lengthUNIT : lengthUNITList) { if (unitType == lengthUNIT.unitType()) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 07954c796e..ae4221dcec 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -5,6 +5,7 @@ package com.fr.design.mainframe.form; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.base.mode.DesignModeContext; @@ -25,6 +26,7 @@ import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.present.ConditionAttributesGroupPane; +import com.fr.design.report.fit.menupane.FormAdaptiveConfigUI; import com.fr.design.selection.SelectableElement; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionListener; @@ -123,6 +125,10 @@ public class FormElementCaseDesigner */ @Override public BufferedImage getElementCaseImage(Dimension size) { + FormAdaptiveConfigUI adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (adaptiveConfigUI != null) { + return adaptiveConfigUI.getElementCaseImage(size, this.elementCasePane); + } BufferedImage image = null; try { image = new java.awt.image.BufferedImage(size.width, size.height, @@ -351,4 +357,4 @@ public class FormElementCaseDesigner public FormElementCaseProvider getEditingElementCase() { return this.getEditingElementCasePane().getTarget(); } -} \ No newline at end of file +} From 97a5d34dd1497ef87fb586b95e879074d16f91c3 Mon Sep 17 00:00:00 2001 From: zack Date: Wed, 15 Apr 2020 16:17:44 +0800 Subject: [PATCH 58/88] =?UTF-8?q?REPORT-29773=20=E5=A4=96=E5=8C=85?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=EF=BC=9A=E9=99=84=E4=BB=B6=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E4=B8=8B=E6=8B=89=E6=A0=91?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E7=AC=AC3=E5=B1=82=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BA=86=E5=88=97=E5=BA=8F=E5=8F=B7=EF=BC=8C=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=97=A0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tree/layer/config/LayerDataConfigPane.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java index c67dd08d9e..8925bfdbdd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java @@ -7,6 +7,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.present.dict.TableDataDictPane; import com.fr.form.ui.tree.LayerConfig; import com.fr.form.ui.tree.LayerDependence; +import com.fr.stable.StringUtils; import java.awt.*; import java.util.*; @@ -73,13 +74,20 @@ public class LayerDataConfigPane extends BasicBeanPane { if (wrapper != null) { columnNames = wrapper.calculateColumnNameList(); } else { - columnNames = new ArrayList(); + columnNames = new ArrayList<>(); } - String viewColStr = tableDataDictPane.updateBean().getValueColumnName(); - String modelColStr = tableDataDictPane.updateBean().getKeyColumnName(); - TableDataDictionary dictionary = tableDataDictPane.updateBean(); + TableDataDictionary dataDictionary = tableDataDictPane.updateBean(); + String viewColStr = dataDictionary.getValueColumnName(); + String modelColStr = dataDictionary.getKeyColumnName(); int viewCol = columnNames.indexOf(viewColStr); int modelCol = columnNames.indexOf(modelColStr); + if (StringUtils.EMPTY.equals(viewColStr)) { + viewCol = dataDictionary.getValueColumnIndex(); + } + if (StringUtils.EMPTY.equals(modelColStr)) { + modelCol = dataDictionary.getKeyColumnIndex(); + } + TableDataDictionary dictionary = tableDataDictPane.updateBean(); //将数据设置到当前正在修改的layerData中 this.layerConfig.setDictionary(dictionary); this.layerConfig.setModelColumn(modelCol); From 72308f9db4c7c2932deeb17c4c85c62d239066c3 Mon Sep 17 00:00:00 2001 From: zack Date: Wed, 15 Apr 2020 16:19:42 +0800 Subject: [PATCH 59/88] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frpane/tree/layer/config/LayerDataConfigPane.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java index 8925bfdbdd..3ba2e025fe 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java @@ -76,18 +76,17 @@ public class LayerDataConfigPane extends BasicBeanPane { } else { columnNames = new ArrayList<>(); } - TableDataDictionary dataDictionary = tableDataDictPane.updateBean(); - String viewColStr = dataDictionary.getValueColumnName(); - String modelColStr = dataDictionary.getKeyColumnName(); + TableDataDictionary dictionary = tableDataDictPane.updateBean(); + String viewColStr = dictionary.getValueColumnName(); + String modelColStr = dictionary.getKeyColumnName(); int viewCol = columnNames.indexOf(viewColStr); int modelCol = columnNames.indexOf(modelColStr); if (StringUtils.EMPTY.equals(viewColStr)) { - viewCol = dataDictionary.getValueColumnIndex(); + viewCol = dictionary.getValueColumnIndex(); } if (StringUtils.EMPTY.equals(modelColStr)) { - modelCol = dataDictionary.getKeyColumnIndex(); + modelCol = dictionary.getKeyColumnIndex(); } - TableDataDictionary dictionary = tableDataDictPane.updateBean(); //将数据设置到当前正在修改的layerData中 this.layerConfig.setDictionary(dictionary); this.layerConfig.setModelColumn(modelCol); From 98ed342ae5b55a2cc74d6416470cf338b7902796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 15 Apr 2020 17:03:03 +0800 Subject: [PATCH 60/88] =?UTF-8?q?CHART-13491=20=E4=BF=AE=E6=94=B9=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=9B=BE=E8=A1=A8=E5=B1=9E=E6=80=A7=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/chart/ChartEditPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 83e194c71d..3dc90d3a34 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -22,6 +22,7 @@ import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; @@ -113,7 +114,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare selectedPane.update(collection); if (!ComparatorUtils.equals(collection, lastCollection)) { - + VanChart vanChart = collection.getSelectedChartProvider(VanChart.class); + if (vanChart != null) { + //此处画图 + vanChart.attrChange(); + } try { ChartInfoCollector.getInstance().checkTestChart(collection.getSelectedChartProvider(ChartProvider.class)); lastCollection = collection.clone(); From 6df360e0f55fd1f2786f1130293e93462a8e78bc Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 15 Apr 2020 17:28:13 +0800 Subject: [PATCH 61/88] REPORT-29704 && REPORT-29960 && REPORT-29958 && REPORT-29752 --- .../mainframe/loghandler/LogMessageBar.java | 5 ++- .../com/fr/design/utils/DesignerPort.java | 9 ++++- .../mainframe/SheetAuthorityEditPane.java | 12 +++++-- .../com/fr/start/DesignerJavaRuntime.java | 36 +++++++++++++++++-- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 54bb4addc3..8b3cedeef6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -12,6 +12,9 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class LogMessageBar extends JPanel { + + private static final String LOG_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log"); + private UILabel messageLabel; private int width = 600; private static volatile LogMessageBar THIS; @@ -56,7 +59,7 @@ public class LogMessageBar extends JPanel { if (message == null) { return; } - messageLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log") + " | " + message); + messageLabel.setText(LOG_MARK + " | " + message); repaint(); } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 55dc1f00d9..254cc5e911 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -1,5 +1,6 @@ package com.fr.design.utils; +import com.fr.common.report.ReportState; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; @@ -12,6 +13,9 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; @@ -86,7 +90,10 @@ public class DesignerPort implements XMLReadable, XMLWriter { } public void resetPort() { - + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } TipDialog dialog = new TipDialog(null, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"), diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java index f559c828fc..baa19fd715 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java @@ -8,6 +8,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import com.fr.main.impl.WorkBook; @@ -119,9 +120,14 @@ public class SheetAuthorityEditPane extends AuthorityEditPane { if (StringUtils.isEmpty(name.getText())){ return; } - checkPane.add(populateCheckPane(), BorderLayout.CENTER); - checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); - checkVisibleCheckBoxes(); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + checkPane.add(populateCheckPane(), BorderLayout.CENTER); + checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); + checkVisibleCheckBoxes(); + } + }); } /** diff --git a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java index 5f4f62210e..553a842127 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java @@ -2,15 +2,25 @@ package com.fr.start; import com.fr.design.os.impl.SupportOSImpl; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; +import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; import com.fr.process.engine.core.AbstractJavaRuntime; import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; +import java.io.BufferedReader; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** @@ -32,11 +42,14 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { private static final String LOGO_PATH = StableUtils.pathJoin(BIN_HOME, "logo.png"); private static final String DOCK_OPTIONS = "-Xdock:icon=" + LOGO_PATH; private static final String DOCK_NAME_OPTIONS = "-Xdock:name=" + FineDesigner.class.getSimpleName(); + private static final String WIN_VM_OPTIONS_PATH = StableUtils.pathJoin(BIN_HOME, "designer.vmoptions"); private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m"}; static { try { - IOUtils.copy(DesignerJavaRuntime.class.getResourceAsStream("/com/fr/design/icon/logo.png"), "logo.png", new File(BIN_HOME)); + if (SupportOSImpl.DOCK_ICON.support()) { + IOUtils.copy(DesignerJavaRuntime.class.getResourceAsStream("/com/fr/design/icon/logo.png"), "logo.png", new File(BIN_HOME)); + } } catch (IOException ignore) { } } @@ -82,7 +95,7 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { } private boolean isInstallVersion() { - return !ComparatorUtils.equals(StableUtils.getInstallHome(), DOT); + return !ComparatorUtils.equals(GeneralUtils.readFullBuildNO(), InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build")); } @@ -96,9 +109,28 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { public String[] getJvmOptions() { if (isInstallVersion()) { String[] options = super.getJvmOptions(); + // win下环境变量 存在错误的设置会导致问题 直接读vmoptions + if (SupportOSImpl.VM_OPTIONS_ADAPTER.support()) { + long start = System.currentTimeMillis(); + List optionList = new ArrayList<>(); + try (BufferedReader reader = new BufferedReader(new FileReader(new File(WIN_VM_OPTIONS_PATH)))) { + String option = null; + while ((option = reader.readLine()) != null) { + optionList.add(option.trim()); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return DEBUG_OPTIONS; + } + FineLoggerFactory.getLogger().error("time: " + (System.currentTimeMillis() - start)); + if (!optionList.isEmpty()) { + return optionList.toArray(new String[0]); + } + } if (SupportOSImpl.DOCK_ICON.support()) { options = ArrayUtils.addAll(options, DOCK_OPTIONS, DOCK_NAME_OPTIONS); } + FineLoggerFactory.getLogger().debug("Vm Options: " + Arrays.toString(options)); return options; } else { return DEBUG_OPTIONS; From 7f89921f60607912bf6cd50c65bd77db5b40fe8b Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 15 Apr 2020 17:30:09 +0800 Subject: [PATCH 62/88] =?UTF-8?q?fix=20=E5=8E=BB=E6=8E=89=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/DesignerJavaRuntime.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java index 553a842127..b99f648aed 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java @@ -111,7 +111,6 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { String[] options = super.getJvmOptions(); // win下环境变量 存在错误的设置会导致问题 直接读vmoptions if (SupportOSImpl.VM_OPTIONS_ADAPTER.support()) { - long start = System.currentTimeMillis(); List optionList = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(new File(WIN_VM_OPTIONS_PATH)))) { String option = null; @@ -122,7 +121,6 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { FineLoggerFactory.getLogger().error(e.getMessage(), e); return DEBUG_OPTIONS; } - FineLoggerFactory.getLogger().error("time: " + (System.currentTimeMillis() - start)); if (!optionList.isEmpty()) { return optionList.toArray(new String[0]); } From 8c5a90411bf7be01e666d008270e61bb174ac60d Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 15 Apr 2020 20:09:40 +0800 Subject: [PATCH 63/88] =?UTF-8?q?REPORT-29958=20=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E7=B1=BB=E6=BC=8F=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/os/impl/SupportOSImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index f6c0e30549..5b8d4d2e8d 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -97,6 +97,14 @@ public enum SupportOSImpl implements SupportOS { public boolean support() { return OperatingSystem.isMacos(); } + }, + + + VM_OPTIONS_ADAPTER { + @Override + public boolean support() { + return OperatingSystem.isWindows(); + } } } From 30c9304b7044e0688192c1a42fc07e7e9c4dfbb6 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Thu, 16 Apr 2020 11:55:29 +0800 Subject: [PATCH 64/88] =?UTF-8?q?REPORT-29985=20=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=BD=91=E5=9D=80=E7=AE=A1=E7=90=86=E4=B8=AD=E5=BF=83=E5=BC=80?= =?UTF-8?q?=E5=85=B3-=E5=9B=BA=E5=8C=96=E5=9F=8B=E7=82=B9-=E5=9B=9E?= =?UTF-8?q?=E4=BC=A0=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/messagecollect/solid/SolidCollector.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java index d090b9e8f1..194ca75d93 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java @@ -22,7 +22,6 @@ import java.util.Map; public class SolidCollector { private static final String ATTR_CIPHER_TEXT = "cipherText"; private static final String ATTR_SIGNATURE = "signature"; - private static final String SOLID_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.solid"); private static volatile SolidCollector instance; @@ -44,6 +43,11 @@ public class SolidCollector { if (WorkContext.getCurrent().isLocal()) { return; } + String url = CloudCenter.getInstance().acquireConf("design.solid", "https://cloud.fanruan.com/api/solid/upload"); + if (StringUtils.isEmpty(url)) { + FineLoggerFactory.getLogger().info("failed to get solid content upload url..."); + return; + } FineLoggerFactory.getLogger().info("start to get solid content from server..."); try { String cipherText = requestContent(); @@ -51,7 +55,7 @@ public class SolidCollector { Map params = new HashMap<>(); params.put(ATTR_CIPHER_TEXT, cipherText); params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature())); - HttpToolbox.post(SOLID_UPLOAD_URL, params); + HttpToolbox.post(url, params); deleteSolidFile(); } From cf6471ba0469543c4e756ef32eb8a72670cbe60a Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 16 Apr 2020 12:30:16 +0800 Subject: [PATCH 65/88] =?UTF-8?q?REPORT-29416=20=E5=8A=A9=E8=AE=B0?= =?UTF-8?q?=E7=AC=A6=E6=98=AF=E5=90=A6=E5=9C=A8=E6=96=87=E6=9C=AC=E4=B8=AD?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=EF=BC=8C=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=88=E9=85=8D=E7=BD=AE=E9=9D=A2=E6=9D=BF=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E6=A0=87=E8=AE=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIRadioButton.java | 16 +++ .../design/gui/ibutton/UIRadioButtonUI.java | 121 ++++++++++++++++++ .../fr/design/gui/icheckbox/UICheckBox.java | 18 ++- .../com/fr/design/report/PageSetupPane.java | 8 +- 4 files changed, 156 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java index 1c2aef38a7..7112e5d657 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java @@ -22,6 +22,8 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam private GlobalNameListener globalNameListener = null; private String radioButtonName = StringUtils.EMPTY; + private boolean markMnemonic = true; + public UIRadioButton() { super(); initListener(); @@ -58,6 +60,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam initComponent(); } + public UIRadioButton(String text, boolean selected, boolean markMnemonic) { + super(text, selected); + initListener(); + initComponent(); + this.markMnemonic = markMnemonic; + } + public UIRadioButton(String text, Icon icon) { super(text, icon); initListener(); @@ -70,6 +79,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam initListener(); } + public void setMnemonic(char mnemonic) { + super.setMnemonic(mnemonic); + if (!markMnemonic) { + setDisplayedMnemonicIndex(-1); + } + } + private void initListener() { if (shouldResponseChangeListener()) { this.addItemListener(new ItemListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java index 0e054b6938..811c1c2bdf 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java @@ -5,9 +5,12 @@ import com.fr.design.utils.ThemeUtils; import javax.swing.*; import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicHTML; import javax.swing.plaf.metal.MetalRadioButtonUI; import java.awt.*; import java.awt.event.KeyEvent; +import javax.swing.text.View; +import sun.swing.SwingUtilities2; /** * Created by IntelliJ IDEA. @@ -84,6 +87,124 @@ public class UIRadioButtonUI extends MetalRadioButtonUI { return radioButton; } + // ******************************** + // Paint Methods + // ******************************** + public synchronized void paint(Graphics g, JComponent c) { + + AbstractButton b = (AbstractButton) c; + ButtonModel model = b.getModel(); + + Dimension size = c.getSize(); + + int w = size.width; + int h = size.height; + + Font f = c.getFont(); + g.setFont(f); + FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f); + + Rectangle viewRect = new Rectangle(size); + Rectangle iconRect = new Rectangle(); + Rectangle textRect = new Rectangle(); + + Insets i = c.getInsets(); + viewRect.x += i.left; + viewRect.y += i.top; + viewRect.width -= (i.right + viewRect.x); + viewRect.height -= (i.bottom + viewRect.y); + + Icon altIcon = b.getIcon(); + Icon selectedIcon = null; + Icon disabledIcon = null; + + String text = SwingUtilities.layoutCompoundLabel( + c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(), + b.getVerticalAlignment(), b.getHorizontalAlignment(), + b.getVerticalTextPosition(), b.getHorizontalTextPosition(), + viewRect, iconRect, textRect, b.getIconTextGap()); + + // fill background + if (c.isOpaque()) { + g.setColor(b.getBackground()); + g.fillRect(0, 0, size.width, size.height); + } + + + // Paint the radio button + if (altIcon != null) { + + if (!model.isEnabled()) { + if (model.isSelected()) { + altIcon = b.getDisabledSelectedIcon(); + } else { + altIcon = b.getDisabledIcon(); + } + } else if (model.isPressed() && model.isArmed()) { + altIcon = b.getPressedIcon(); + if (altIcon == null) { + // Use selected icon + altIcon = b.getSelectedIcon(); + } + } else if (model.isSelected()) { + if (b.isRolloverEnabled() && model.isRollover()) { + altIcon = b.getRolloverSelectedIcon(); + if (altIcon == null) { + altIcon = b.getSelectedIcon(); + } + } else { + altIcon = b.getSelectedIcon(); + } + } else if (b.isRolloverEnabled() && model.isRollover()) { + altIcon = b.getRolloverIcon(); + } + + if (altIcon == null) { + altIcon = b.getIcon(); + } + + altIcon.paintIcon(c, g, iconRect.x, iconRect.y); + + } else { + getDefaultIcon().paintIcon(c, g, iconRect.x, iconRect.y); + } + + // Draw the Text + if (text != null) { + View v = (View) c.getClientProperty(BasicHTML.propertyKey); + if (v != null) { + v.paint(g, textRect); + } else { + int mnemIndex = b.getDisplayedMnemonicIndex(); + if (model.isEnabled()) { + // *** paint the text normally + g.setColor(b.getForeground()); + } else { + // *** paint the text disabled + g.setColor(getDisabledTextColor()); + } + if (markMnemonic(text, mnemIndex)) { + SwingUtilities2.drawStringUnderlineCharAt(c, g, text, + mnemIndex, textRect.x, textRect.y + fm.getAscent()); + } else { + SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent()); + } + } + if (b.hasFocus() && b.isFocusPainted() && + textRect.width > 0 && textRect.height > 0) { + paintFocus(g, textRect, size); + } + } + } + + /** + * @param text + * @param mnemIndex 助记符在text中的索引 + * @return true:需要给助记符画一个下划线 + */ + private boolean markMnemonic(String text, int mnemIndex) { + return mnemIndex > 0 && text != null && text.length() > 0 && text.length() > mnemIndex; + } /** * Paints the focus for the radiobutton diff --git a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java index 379274b90b..e294d80220 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java @@ -34,6 +34,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser private UIObserverListener uiObserverListener; private GlobalNameListener globalNameListener = null; private String checkboxName = ""; + private boolean markMnemonic = true; public UICheckBox(String string) { super(string); @@ -53,6 +54,13 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser initListener(); } + public UICheckBox(String locText, boolean b, boolean markMnemonic) { + super(locText, b); + setUI(new UICheckBoxUI()); + initListener(); + this.markMnemonic=markMnemonic; + } + public UICheckBox(String text, Icon icon) { super(text, icon); setUI(new UICheckBoxUI()); @@ -189,14 +197,18 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser if (v != null) { v.paint(g, textRect); } else { - int mnemIndex = b.getDisplayedMnemonicIndex(); + if (model.isEnabled()) { g.setColor(b.getForeground()); } else { g.setColor(getDisabledTextColor()); } - SwingUtilities2.drawStringUnderlineCharAt(c, g, text, - mnemIndex, textRect.x, textRect.y + fm.getAscent()); + if (markMnemonic) { + SwingUtilities2.drawStringUnderlineCharAt(c, g, text, + b.getDisplayedMnemonicIndex(), textRect.x, textRect.y + fm.getAscent()); + } else { + SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent()); + } } } } diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index db9234925e..20beaa5643 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -885,12 +885,12 @@ public class PageSetupPane extends BasicPane { Icon topBottomIcon = BaseUtils.readIcon("/com/fr/base/images/dialog/pagesetup/down.png"); - topBottomRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Top_To_Bottom")); + topBottomRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Top_To_Bottom"),false,false); pageOrderPane.add(FRGUIPaneFactory.createIconRadio_S_Pane(topBottomIcon, topBottomRadioButton)); topBottomRadioButton.setMnemonic('B'); Icon leftRightIcon = BaseUtils.readIcon("/com/fr/base/images/dialog/pagesetup/over.png"); - leftRightRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Left_To_Right")); + leftRightRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Left_To_Right"), false, false); pageOrderPane.add(FRGUIPaneFactory.createIconRadio_S_Pane(leftRightIcon, leftRightRadioButton)); leftRightRadioButton.setMnemonic('R'); @@ -907,9 +907,9 @@ public class PageSetupPane extends BasicPane { defaultPane.add(outcenterOnPagePane); - this.horizonalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Horizontally")); + this.horizonalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Horizontally"), false, false); this.horizonalCenterCheckBox.setMnemonic('H'); - this.verticalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Vertically")); + this.verticalCenterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Vertically"), false, false); this.verticalCenterCheckBox.setMnemonic('V'); centerOnPagePane.add(GUICoreUtils.createFlowPane(horizonalCenterCheckBox, FlowLayout.CENTER)); From 1122c29fdb225d00701b40fe97665354def7e10c Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 16 Apr 2020 16:48:44 +0800 Subject: [PATCH 66/88] =?UTF-8?q?REPORT-29732=20&&=20REPORT-29432=20?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itableeditorpane/UITableModelAdapter.java | 2 +- .../com/fr/design/javascript/JavaScriptImplPane.java | 3 ++- .../widget/accessibles/BaseAccessibleEditor.java | 3 ++- .../java/com/fr/design/parameter/ParameterArrayPane.java | 5 +++-- .../java/com/fr/design/present/dict/FormulaDictPane.java | 7 ++++--- .../src/main/java/com/fr/design/upm/UpmFinder.java | 2 +- .../adapters/layout/FRCardMainBorderLayoutAdapter.java | 5 +++-- .../widget/ui/designer/component/WidgetBoundPane.java | 9 +++++---- .../ui/designer/component/WidgetCardTagBoundPane.java | 5 +++-- .../com/fr/design/cell/editor/DSColumnCellEditor.java | 2 +- .../main/java/com/fr/design/dscolumn/DSColumnPane.java | 2 ++ .../src/main/java/com/fr/design/webattr/WebJsPane.java | 4 ++-- 12 files changed, 29 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java index fc219a30bc..7d04113078 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java @@ -235,7 +235,7 @@ public abstract class UITableModelAdapter extends AbstractTabl public void actionPerformed(ActionEvent e) { int[] selectedRow = table.getSelectedRows(); if (ismultiSelected()) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text")); return; } if (table.getCellEditor() != null) { diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java index 8806d6853c..158c05d1e1 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java @@ -2,6 +2,7 @@ package com.fr.design.javascript; import com.fr.base.Parameter; import com.fr.design.data.tabledata.tabledatapane.OneListTableModel; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; @@ -62,7 +63,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { } if (tempSet.contains(list.get(i).toString())) { list.remove(i); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!"); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!"); parameterChanger(list); return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index 9f73a06d34..e6ddd8138c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import javax.swing.*; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -222,7 +223,7 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor } public static void showMessage(String message, Component editorComponent) { - JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); } diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java index 30cac90eb2..d3efcae4aa 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.parameter; import com.fr.base.Parameter; import com.fr.base.ParameterConfig; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableSelfCreator; @@ -36,14 +37,14 @@ public class ParameterArrayPane extends JListControlPane { String tempName = getEditingName(); if (StringUtils.isEmpty(tempName)) { nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); setIllegalIndex(editingIndex); return; } if (!ComparatorUtils.equals(tempName, selectedName) && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); setIllegalIndex(editingIndex); } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java index ff13846208..2eca81466b 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/FormulaDictPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.FRWidgetFactory; import com.fr.stable.StringUtils; import javax.swing.*; @@ -20,6 +21,7 @@ public class FormulaDictPane extends FurtherBasicBeanPane { private static final int EDITOR_COLUMN = 15; private static final int LEFT_BORDER = 5; + private static final int MAX_WIDTH = 30; private FormulaEditor keyFormulaEditor; private FormulaEditor valueFormulaEditor; @@ -61,10 +63,9 @@ public class FormulaDictPane extends FurtherBasicBeanPane { valueFormulaContainer.add(new JLabel(icon)); valueFormulaContainer.add(valueFormulaEditor); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), UILabel.LEFT), keyFormulaContainer}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), UILabel.LEFT), valueFormulaContainer}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), MAX_WIDTH, UILabel.LEFT), keyFormulaContainer}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), MAX_WIDTH, UILabel.LEFT), valueFormulaContainer}, new Component[]{tag, null} }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 4febad3a99..9a6205cf4a 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -88,7 +88,7 @@ public class UpmFinder { dialog.setVisible(true); } } else { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.setAutoUpdateAfterInit(); dialog.showDialog(); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 1d529743a2..9718d4a6fd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -3,6 +3,7 @@ package com.fr.design.designer.beans.adapters.layout; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.form.layout.FRBorderLayout; import com.fr.general.ComparatorUtils; @@ -47,13 +48,13 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (ComparatorUtils.equals(constraints, BorderLayout.NORTH) || ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) { int containerHeight = container.getHeight(); if (rectangle.height > containerHeight) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); return true; } } else if (ComparatorUtils.equals(constraints, BorderLayout.EAST) || ComparatorUtils.equals(constraints, BorderLayout.WEST)) { int containerWidth = container.getWidth(); if (rectangle.width > containerWidth) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); return true; } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index c9928759bf..ab148f2ae6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -10,6 +10,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; @@ -115,11 +116,11 @@ public class WidgetBoundPane extends BasicPane { PaddingMargin margin = wabs.getMargin(); if (bounds.width != w) { if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); width.setValue(bounds.width); return; } else if (w < minWidth) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Width") + Integer.toString(minWidth)); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Width") + Integer.toString(minWidth)); width.setValue(bounds.width); return; } @@ -136,11 +137,11 @@ public class WidgetBoundPane extends BasicPane { int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling()); if (bounds.height != h) { if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds")); height.setValue(bounds.height); return; } else if (h < minHeight) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Height") + Integer.toString(minHeight)); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Height") + Integer.toString(minHeight)); height.setValue(bounds.height); return; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java index 97bc5aaa3b..22d544c1a6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; @@ -48,13 +49,13 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane { Rectangle rectangle = tabLayout.getBounds(); if(ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){ if(rectangle.height < size){ - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); return; } parentBounds.height = size; }else{ if(rectangle.width < size){ - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); return; } parentBounds.width = size; diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java index a7fb154e05..97efbda442 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java @@ -65,7 +65,7 @@ public class DSColumnCellEditor extends AbstractCellEditor implements DialogActi this.dsColumnPane = new DSColumnPane(); dsColumnPane.putElementcase(grid.getElementCasePane()); dsColumnPane.putCellElement(cellElement); - BasicDialog dsColumnDialog = this.dsColumnPane.showWindow(SwingUtilities.getWindowAncestor(grid)); + BasicDialog dsColumnDialog = this.dsColumnPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(grid), null, DSColumnPane.DEFAULT_DIMENSION); dsColumnDialog.addDialogActionListener(this); diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java index 4b33304cd1..afade5626c 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnPane.java @@ -26,6 +26,8 @@ import java.beans.PropertyChangeListener; */ public class DSColumnPane extends BasicPane { + public static final Dimension DEFAULT_DIMENSION = new Dimension(700, 600); + private TableDataSource tplEC; private UITabbedPane tabbedPane; private DSColumnBasicPane basicPane = null; diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index 7c5c2e6b9a..b2934b10e3 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -129,7 +129,7 @@ public class WebJsPane extends BasicPane { if (url.matches("^[a-zA-z]+://.+js")) { return url; } else { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); return ""; } } @@ -190,7 +190,7 @@ public class WebJsPane extends BasicPane { public void actionPerformed(ActionEvent arg0) { String uri = urlText.getText(); if (!uri.matches("^[a-zA-z]+://.+js")) { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WebJsPane.this), com.fr.design.i18n.Toolkit.i18nText("Add_JS_warning")); return; } InputStream in = null; From 20dc52dc6f6cd18104ad97ef1283b7dffcc865b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Thu, 16 Apr 2020 16:52:04 +0800 Subject: [PATCH 67/88] =?UTF-8?q?CHART-13473=20=20=20=E7=94=BB=E5=9B=BE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chart/ChartDesignerActivator.java | 2 ++ .../java/com/fr/design/chart/gui/ChartComponent.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 8ad2e6198f..65d6abd640 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartHyperlinkGroup; @@ -50,6 +51,7 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); ChartTypeInterfaceManager.addPluginChangedListener(); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index c8fafe9cdb..aa7f9107b2 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -31,7 +31,7 @@ import java.awt.event.MouseMotionListener; * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 */ -public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener{ +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, CallbackEvent{ private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; @@ -257,7 +257,12 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - painter.paint(g2d, chartWidth, chartHeight, resolution, null); + painter.paint(g2d, chartWidth, chartHeight, resolution, null,this); } } + + @Override + public void callback() { + this.repaint(); + } } \ No newline at end of file From 2aae7b867dd86a786fbc0f1014de00c3ef06a0d7 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 16 Apr 2020 16:56:46 +0800 Subject: [PATCH 68/88] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/socketio/DesignerSocketIO.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 63bc3d999b..79061dbab2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.socketio; import com.fr.config.RemoteConfigEvent; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.EnvChangeEntrance; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogger; @@ -146,7 +147,7 @@ public class DesignerSocketIO { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), UIManager.getString("OptionPane.messageDialogTitle"), From 430b3f4706b4ed9fafbcd0655914e4b8c37f089e Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 16 Apr 2020 17:59:40 +0800 Subject: [PATCH 69/88] =?UTF-8?q?REPORT-29576=20=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/BaseDesigner.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 90ac634ce0..1469dd32ec 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -3,6 +3,7 @@ */ package com.fr.start; +import com.fr.common.report.ReportState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.DesignerLaunchStatus; @@ -24,6 +25,9 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.OperatingSystem; import java.awt.Window; @@ -75,6 +79,11 @@ public abstract class BaseDesigner extends ToolBarMenuDock { @Override public void on(Event event, Null param) { EventDispatcher.stopListen(this); + // 启动完成 停止监听 + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } collectUserInformation(); } }); From d0e9ebe0c8d8e9c50db50402f5aacb81a85fe162 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 16 Apr 2020 19:21:10 +0800 Subject: [PATCH 70/88] =?UTF-8?q?REPORT-29536=E3=80=90=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E6=9C=AC=E5=9C=B0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BA=B8=E5=BC=A0=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E7=9A=84custom=E6=AF=94=E5=85=B6=E4=BB=96=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=A4=9A=E5=87=BA=E9=A6=96=E8=A1=8C=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractNativePrintSettingPane.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index 2b22297837..2ff9d41800 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -103,14 +103,14 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); UILabel showDialogCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); - JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[] { + JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[]{ showDialogCheck, showDialogCheckTip}, FlowLayout.LEFT); // 打印需要指定 sheet needSelectSheetCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Need_Select_Sheet_When_Printing")); needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); UILabel needSelectSheetCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View")); - JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[] { + JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[]{ needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT); return createHeaderPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane); @@ -263,7 +263,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { ' ' + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_mm") + ']'; - this.setText(sbuf); + this.setText(" " + sbuf); break; } } @@ -461,8 +461,8 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { extraUpdate(nativePrintAttr); nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); - nativePrintAttr.setPrinterName((String)printerComboBox.getSelectedItem()); - nativePrintAttr.setCopy((int)copySpinner.getValue()); + nativePrintAttr.setPrinterName((String) printerComboBox.getSelectedItem()); + nativePrintAttr.setCopy((int) copySpinner.getValue()); // 页码 if (allPageRadioButton.isSelected()) { @@ -472,7 +472,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { } else if (customPageRadioButton.isSelected()) { nativePrintAttr.setPageType(NativePrintAttr.PageType.SPECIFIED_PAGES); nativePrintAttr.setArea(specifiedAreaField.getText()); - } else if (doublePrintComboBox.getSelectedIndex() == ODD_INDEX){ + } else if (doublePrintComboBox.getSelectedIndex() == ODD_INDEX) { nativePrintAttr.setPageType(NativePrintAttr.PageType.ODD_PAGES); } else { nativePrintAttr.setPageType(NativePrintAttr.PageType.EVEN_PAGES); @@ -494,7 +494,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { nativePrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); nativePrintAttr.setMargin(pageMarginSettingPane.updateBean()); nativePrintAttr.setFitPaperSize(fitPaperSizeCheck.isSelected()); - nativePrintAttr.setScalePercent((int)scalePercentField.getValue()); + nativePrintAttr.setScalePercent((int) scalePercentField.getValue()); } protected void extraUpdate(NativePrintAttr nativePrintAttr) { From 06e18697dc73e6e2c59453e90166693cb334909c Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 16 Apr 2020 19:49:24 +0800 Subject: [PATCH 71/88] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 3 +- .../fun/FormAdaptiveConfigUIProcessor.java | 35 ++++++++++++++++ .../design/fun/ReportLengthUNITProvider.java | 39 ++++++++++++++++++ ...AbstractFormAdaptiveConfigUIProcessor.java | 38 +++++++++++++++++ .../AbstractReportLengthUNITProvider.java | 41 +++++++++++++++++++ .../AbstractFormAdaptiveConfigUI.java | 18 -------- .../fit/menupane/FormAdaptiveConfigUI.java | 26 ------------ .../fit/menupane/ReportFitAttrAction.java | 5 ++- .../com/fr/design/unit/ReportLengthUNIT.java | 21 ---------- .../unit/ReportLengthUnitProcessor.java | 14 ------- .../com/fr/design/unit/UnitConvertUtil.java | 26 ++++++++---- .../AbstracReportLengthUnitProcessor.java | 19 --------- .../unit/impl/AbstractReportLengthUNIT.java | 22 ---------- .../design/unit/impl/CMReportLengthUNIT.java | 4 +- .../unit/impl/INCHReportLengthUNIT.java | 4 +- .../design/unit/impl/MMReportLengthUNIT.java | 4 +- .../design/unit/impl/PTReportLengthUNIT.java | 3 +- .../columnrow/ColumnRowSizingAction.java | 7 ++-- .../java/com/fr/design/condition/WHPane.java | 8 ++-- .../form/FormElementCaseDesigner.java | 7 ++-- .../grid/AbstractGridHeaderMouseHandler.java | 4 +- 21 files changed, 198 insertions(+), 150 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 8f88cdeff0..387082ed05 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -28,6 +28,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; @@ -575,7 +576,7 @@ public class PreferencePane extends BasicPane { pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")}); pageLengthComboBox.setPreferredSize(new Dimension(80, 20)); pageLengthComboBox.setMinimumSize(new Dimension(80, 20)); - reportLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH"), i18nText("Fine-Design_Report_Unit_PT_Duplicate")}); + reportLengthComboBox = new UIComboBox(UnitConvertUtil.getUnitItems()); reportLengthComboBox.setPreferredSize(new Dimension(80, 20)); reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":"); diff --git a/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java new file mode 100644 index 0000000000..a91e202c9f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java @@ -0,0 +1,35 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + + +/** + * Created by kerry on 2020-04-09 + * 临时接口,后续自适应内置后删除 + */ +public interface FormAdaptiveConfigUIProcessor extends Immutable { + + String MARK_STRING = "FormAdaptiveConfigUI"; + int CURRENT_LEVEL = 1; + + /** + * 获取表单自适应配置界面 + * @return 表单自适应配置界面 + */ + BasicBeanPane getConfigPane(); + + /** + * 绘制自适应下报表块在表单界面中显示图片 + * @param size 绘制尺寸 + * @param elementCasePane 报表块内容对象 + * @return 自适应下报表块在表单界面中显示的图片 + */ + BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane); + +} + diff --git a/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java new file mode 100644 index 0000000000..af97950cf8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java @@ -0,0 +1,39 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Mutable; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUNITProvider extends Mutable { + String MARK_STRING = "ReportLengthUNITProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 标尺单位显示字符 + * @return 标尺单位字符 + */ + String unitText(); + + /** + * 标尺单位类型(之前是将int类型的值直接保存在数据库里面的) + * @return 返回标尺单位类型 + */ + int unitType(); + + /** + * UNIT转标尺单位值 + * @param value UNIT + * @return 标尺单位值 + */ + float unit2Value4Scale(UNIT value); + + /** + * 标尺单位值转UNIT + * @param value 标尺单位值 + * @return UNIT + */ + UNIT float2UNIT(float value); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java new file mode 100644 index 0000000000..e573339875 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java @@ -0,0 +1,38 @@ +package com.fr.design.fun.impl; + + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + +/** + * Created by kerry on 2020-04-09 + */ +@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) +public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProvider implements FormAdaptiveConfigUIProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + @Override + public BasicBeanPane getConfigPane() { + return null; + } + + @Override + public BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane) { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java new file mode 100644 index 0000000000..b550b07c1e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java @@ -0,0 +1,41 @@ +package com.fr.design.fun.impl; + + +import com.fr.design.fun.ReportLengthUNITProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +@API(level = ReportLengthUNITProvider.CURRENT_LEVEL) +public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider { + + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String unitText() { + return StringUtils.EMPTY; + } + + @Override + public int unitType() { + return 0; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return 0; + } + + @Override + public UNIT float2UNIT(float value) { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java deleted file mode 100644 index bf0822104e..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.design.report.fit.menupane; - - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstractFormAdaptiveConfigUI implements FormAdaptiveConfigUI { - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java deleted file mode 100644 index cd88ec4ece..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.report.fit.menupane; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.stable.fun.mark.Immutable; - -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.image.BufferedImage; - - -/** - * Created by kerry on 2020-04-09 - */ -public interface FormAdaptiveConfigUI extends Immutable { - - String MARK_STRING = "FormAdaptiveConfigUI"; - int CURRENT_LEVEL = 1; - - - BasicBeanPane getConfigPane(); - - BufferedImage getElementCaseImage(Dimension size, JComponent elementCasePane); - - -} - diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index ebffc98095..bbf5106c35 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -5,6 +5,7 @@ import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -43,7 +44,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); if (configPane != null) { return configPane.getConfigPane().getTitle(); } @@ -91,7 +92,7 @@ public class ReportFitAttrAction extends JTemplateAction { showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { BasicBeanPane attrPane = null; - FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); if (configPane != null) { attrPane = configPane.getConfigPane(); }else{ diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java deleted file mode 100644 index 513232d951..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fr.design.unit; - -import com.fr.stable.fun.mark.Mutable; -import com.fr.stable.unit.UNIT; - -/** - * Created by kerry on 2020-04-09 - */ -public interface ReportLengthUNIT extends Mutable { - String MARK_STRING = "ReportLengthUNIT"; - - int CURRENT_LEVEL = 1; - - String unitText(); - - int unitType(); - - float unit2Value4Scale(UNIT value); - - UNIT float2UNIT(float value); -} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java deleted file mode 100644 index 4adffd28c9..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fr.design.unit; - -import com.fr.stable.fun.mark.Immutable; - -/** - * Created by kerry on 2020-04-09 - */ -public interface ReportLengthUnitProcessor extends Immutable { - String MARK_STRING = "ReportLengthUnitProcessor"; - int CURRENT_LEVEL = 1; - - ReportLengthUNIT getReportLengthUNIT(int unitType); - -} diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index fee1cccd78..406ddcfdde 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -1,6 +1,7 @@ package com.fr.design.unit; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.impl.CMReportLengthUNIT; import com.fr.design.unit.impl.INCHReportLengthUNIT; import com.fr.design.unit.impl.MMReportLengthUNIT; @@ -8,18 +9,23 @@ import com.fr.design.unit.impl.PTReportLengthUNIT; import java.util.ArrayList; import java.util.List; +import java.util.Set; /** * Created by kerry on 2020-04-09 */ public class UnitConvertUtil { - private static List lengthUNITList = new ArrayList(); + private static List lengthUNITList = new ArrayList(); static { + lengthUNITList.add(new MMReportLengthUNIT()); lengthUNITList.add(new CMReportLengthUNIT()); lengthUNITList.add(new INCHReportLengthUNIT()); lengthUNITList.add(new PTReportLengthUNIT()); - lengthUNITList.add(new MMReportLengthUNIT()); + Set providers = ExtraDesignClassManager.getInstance().getArray(ReportLengthUNITProvider.MARK_STRING); + for (ReportLengthUNITProvider provider : providers) { + lengthUNITList.add(provider); + } } private UnitConvertUtil() { @@ -27,16 +33,20 @@ public class UnitConvertUtil { } - public static ReportLengthUNIT parseLengthUNIT(int unitType) { - ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); - if (lengthUnitProcessor != null) { - return lengthUnitProcessor.getReportLengthUNIT(unitType); - } - for (ReportLengthUNIT lengthUNIT : lengthUNITList) { + public static ReportLengthUNITProvider parseLengthUNIT(int unitType) { + for (ReportLengthUNITProvider lengthUNIT : lengthUNITList) { if (unitType == lengthUNIT.unitType()) { return lengthUNIT; } } return new MMReportLengthUNIT(); } + + public static String[] getUnitItems() { + String[] unitItems = new String[lengthUNITList.size()]; + for (int i = 0; i < lengthUNITList.size(); i++) { + unitItems[i] = lengthUNITList.get(i).unitText(); + } + return unitItems; + } } diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java deleted file mode 100644 index 64242b3b3c..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fr.design.unit.impl; - -import com.fr.design.unit.ReportLengthUnitProcessor; - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstracReportLengthUnitProcessor implements ReportLengthUnitProcessor { - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java deleted file mode 100644 index d1947b8f4e..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.unit.impl; - - -import com.fr.design.unit.ReportLengthUNIT; - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstractReportLengthUNIT implements ReportLengthUNIT { - - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public String mark4Provider() { - return getClass().getName(); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java index e3b550d018..ef4dcb64af 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.CM; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class CMReportLengthUNIT extends AbstractReportLengthUNIT { +public class CMReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java index c919e14e14..5cfcb6920f 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.INCH; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class INCHReportLengthUNIT extends AbstractReportLengthUNIT { +public class INCHReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java index e6f3523ecc..a4bc2bacaa 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.MM; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class MMReportLengthUNIT extends AbstractReportLengthUNIT { +public class MMReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java index 1ab5bbedfb..9be7a8778a 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java @@ -1,5 +1,6 @@ package com.fr.design.unit.impl; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.PT; import com.fr.stable.unit.UNIT; @@ -7,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class PTReportLengthUNIT extends AbstractReportLengthUNIT { +public class PTReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"); diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index b14d1945b7..f7e86d2c03 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -4,13 +4,14 @@ package com.fr.design.actions.columnrow; import com.fr.design.DesignerEnvManager; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.frpane.UnitInputPane; import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; import com.fr.design.mainframe.DesignerContext; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.UnitConvertUtil; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; @@ -49,7 +50,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction try { float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); UNIT len = lengthUNIT.float2UNIT(newHeight); updateAction(report, len, finalCS); } catch (ValueNotChangeException e) { @@ -64,7 +65,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); float va = lengthUNIT.unit2Value4Scale(unit); uPane.setUnitText(lengthUNIT.unitText()); uPane.populate(va); diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index ed8eea8541..7b4f636a64 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -3,7 +3,7 @@ package com.fr.design.condition; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; @@ -47,7 +47,7 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane Date: Fri, 17 Apr 2020 09:40:18 +0800 Subject: [PATCH 72/88] =?UTF-8?q?REPORT-29882=208.0=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=8D=87=E7=BA=A710.0=E5=90=8E=EF=BC=8C=E6=A8=A1=E6=9D=BFweb?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=89=93=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/style/background/BackgroundPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java index 66fa06c9e0..593250ca8c 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java @@ -118,6 +118,9 @@ public class BackgroundPane extends BasicPane { */ public void populate(Background background) { BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background); + if (wrapper == null) { + return; + } int index = wrapper.getIndex(); BackgroundDetailPane quickPane = getTabItemPane(background, index); quickPane.populate(background); From bbc19821876d36fc943ca7d6be25fa8d05996874 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 17 Apr 2020 10:28:17 +0800 Subject: [PATCH 73/88] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/impl/AbstractReportLengthUNITProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java index b550b07c1e..da77c947f9 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java @@ -36,6 +36,7 @@ public abstract class AbstractReportLengthUNITProvider extends AbstractProvider @Override public UNIT float2UNIT(float value) { - return null; + return UNIT.ZERO; } } + From 434692b6801f997b5867ea5a9341c82bb95565c5 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 17 Apr 2020 10:54:24 +0800 Subject: [PATCH 74/88] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormAdaptiveConfigUIProcessor.java | 11 +++--- ...AbstractFormAdaptiveConfigUIProcessor.java | 17 +--------- .../fit/menupane/ReportFitAttrAction.java | 14 +------- .../java/com/fr/design/mainframe/JForm.java | 34 ++++++++++++------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java index a91e202c9f..1f2853b91d 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java @@ -1,6 +1,7 @@ package com.fr.design.fun; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.ShortCut; import com.fr.stable.fun.mark.Immutable; import javax.swing.JComponent; @@ -14,14 +15,14 @@ import java.awt.image.BufferedImage; */ public interface FormAdaptiveConfigUIProcessor extends Immutable { - String MARK_STRING = "FormAdaptiveConfigUI"; + String MARK_STRING = "FormAdaptiveConfigUIProcessor"; int CURRENT_LEVEL = 1; /** - * 获取表单自适应配置界面 - * @return 表单自适应配置界面 + * 获取表单自适应配置菜单 + * @return 表单自适应配置菜单 */ - BasicBeanPane getConfigPane(); + ShortCut getConfigShortCut(JTemplate jTemplate); /** * 绘制自适应下报表块在表单界面中显示图片 diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java index e573339875..1fc76077c1 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java @@ -1,20 +1,14 @@ package com.fr.design.fun.impl; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.fun.FormAdaptiveConfigUIProcessor; -import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.image.BufferedImage; - /** * Created by kerry on 2020-04-09 */ @API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) -public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProvider implements FormAdaptiveConfigUIProcessor { +public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor { @Override public int currentAPILevel() { @@ -26,13 +20,4 @@ public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProv return DEFAULT_LAYER_INDEX; } - @Override - public BasicBeanPane getConfigPane() { - return null; - } - - @Override - public BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane) { - return null; - } } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index bbf5106c35..c24125059c 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,11 +1,9 @@ package com.fr.design.report.fit.menupane; -import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; -import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -44,10 +42,6 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); - if (configPane != null) { - return configPane.getConfigPane().getTitle(); - } return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); } @@ -91,13 +85,7 @@ public class ReportFitAttrAction extends JTemplateAction { final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { - BasicBeanPane attrPane = null; - FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); - if (configPane != null) { - attrPane = configPane.getConfigPane(); - }else{ - attrPane = new ReportFitAttrPane(); - } + final ReportFitAttrPane attrPane = new ReportFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index e95a7962c2..5502274bcd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -31,6 +31,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -129,20 +130,20 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPane(provider); } } - + private void addPane(PropertyItemPaneProvider provider) { - + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); if (holder != null) { JPanel panel = holder.getInstance(formDesign); EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); } } - + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -561,12 +562,21 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm Date: Fri, 17 Apr 2020 13:20:15 +0800 Subject: [PATCH 75/88] =?UTF-8?q?REPORT-29462=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=A8=A1=E6=9D=BF-?= =?UTF-8?q?=E7=BA=B8=E5=BC=A0=E8=83=8C=E6=99=AF-=E6=B8=90=E5=8F=98?= =?UTF-8?q?=E8=89=B2=EF=BC=8C=E6=BB=91=E5=8A=A8=E5=8F=B3=E8=BE=B9=E6=B8=B8?= =?UTF-8?q?=E6=A0=87=EF=BC=8C=E7=A1=AE=E5=AE=9A=E5=90=8E=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=EF=BC=8C=E4=BD=8D=E7=BD=AE=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/style/background/gradient/GradientBar.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index dcb381e819..efeffa4e49 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -244,6 +244,7 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab */ public void setStartValue(double startValue) { startLabel.setValue(startValue); + p1.setX(startValue); } /** @@ -251,6 +252,7 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab */ public void setEndValue(double endValue) { endLabel.setValue(endValue); + p2.setX(endValue); } /** From 7df8d3748619a7395bb95cfd1d6fd9e3cbcb9e92 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Apr 2020 16:27:53 +0800 Subject: [PATCH 76/88] MOBILE-26174 && MOBILE-25651 --- .../fr/design/actions/FormMobileAttrAction.java | 4 ++-- .../actions/report/ReportMobileAttrAction.java | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index b387cbc703..deec25c0b1 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -82,13 +82,13 @@ public class FormMobileAttrAction extends JTemplateAction { if (changeSize) { ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); } - jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); //改变布局为自适应布局,只在移动端属性设置保存后改变一次 boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch(); if (changeLayout) { + jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); } - WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } }); diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java index a31108f2c4..a002f56e8a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.report; +import com.fr.base.PaperSize; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; @@ -13,8 +14,10 @@ import com.fr.general.IOUtils; import com.fr.intelli.record.Focus; import com.fr.main.TemplateWorkBook; +import com.fr.page.PaperSettingProvider; import com.fr.record.analyzer.EnableMetrics; import com.fr.report.mobile.ElementCaseMobileAttr; +import com.fr.report.report.Report; import javax.swing.*; import java.awt.event.ActionEvent; @@ -51,6 +54,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ final ReportMobileAttrPane mobileAttrPane = new ReportMobileAttrPane(); mobileAttrPane.populateBean(mobileAttr); + final boolean oldMobileCanvasSize = mobileAttr.isMobileCanvasSize(); BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -69,7 +73,16 @@ public class ReportMobileAttrAction extends JWorkBookAction{ } recordFunction(); // 设置移动端属性并刷新界面 - wbTpl.setReportMobileAttr(elementCaseMobileAttr); // 会同时修改页面设置,放到最后 + wbTpl.setReportMobileAttr(elementCaseMobileAttr); + boolean change = !oldMobileCanvasSize && elementCaseMobileAttr.isMobileCanvasSize(); + if (change) { + // 当相关属性从未勾选到勾选状态时 设置成移动端标准页面大小 + for (int i = 0; i < wbTpl.getReportCount(); i++) { + Report report = wbTpl.getReport(i); + PaperSettingProvider paperSetting = report.getReportSettings().getPaperSetting(); + paperSetting.setPaperSize(PaperSize.PAPERSIZE_MOBILE); + } + } jwb.fireTargetModified(); } }); From 0a530fdd684101bf0054bb7e99f0ba64abba90aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 17 Apr 2020 17:14:07 +0800 Subject: [PATCH 77/88] =?UTF-8?q?CHART-13559=20=E5=A4=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8B=E5=8A=A8=E7=94=BB=E7=89=B9=E6=95=88=E5=92=8C=E9=AB=98?= =?UTF-8?q?=E4=BA=AE=E7=9A=84label=E4=B9=9F=E8=A6=81=E5=8F=98=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/VanChartInteractivePane.java | 18 ++++++++++++++++-- .../designer/style/VanChartPlotLegendPane.java | 9 ++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index f25cbe9923..f402418d7d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.axis.VanChartAxis; @@ -60,6 +61,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private UIComboBox largeDataMode; private UISpinner largeModeThresholdNumber; + protected UILabel chartAnimationLabel; protected UIButtonGroup isChartAnimation; //坐标轴翻转属性 @@ -371,7 +373,17 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected JPanel createAnimationPane() { isChartAnimation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation_Effects"), isChartAnimation); + chartAnimationLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Animation_Effects")); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p,p}; + Component[][] components = new Component[][]{ + new Component[]{null,null}, + new Component[]{chartAnimationLabel,isChartAnimation} + }; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); } @@ -499,7 +511,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void populateChartAnimate(Chart chart, Plot plot) { if (plot.isSupportAnimate()) { isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1); - isChartAnimation.setEnabled(!largeModel(plot)); + boolean largeModel = largeModel(plot); + isChartAnimation.setEnabled(!largeModel); + chartAnimationLabel.setEnabled(!largeModel); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 4ab88f6167..7e597bd5d9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -70,6 +70,7 @@ public class VanChartPlotLegendPane extends BasicPane { //private LimitPane limitPane; //高亮显示的按钮 + private UILabel highlightLabel; private UIButtonGroup highlightButton; private JPanel highlightPane; @@ -318,7 +319,7 @@ public class VanChartPlotLegendPane extends BasicPane { private JPanel createHighlightPane(){ highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); - + highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -326,7 +327,7 @@ public class VanChartPlotLegendPane extends BasicPane { double[] rowSize = {p,p}; Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton} + new Component[]{highlightLabel, highlightButton} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); } @@ -429,7 +430,9 @@ public class VanChartPlotLegendPane extends BasicPane { //limitPane.populateBean(legend.getLimitAttribute()); if(highlightButton != null){ highlightButton.setSelectedItem(legend.isHighlight()); - highlightButton.setEnabled(!PlotFactory.largeDataModel(plot)); + boolean largeDataModel = PlotFactory.largeDataModel(plot); + highlightButton.setEnabled(!largeDataModel); + highlightLabel.setEnabled(!largeDataModel); } } From 6963b99daec0f7368a0ad859772f76f1fd95ad9f Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Apr 2020 18:11:36 +0800 Subject: [PATCH 78/88] REPORT-29118 && REPORT-29117 --- .../os/impl/MacOsAddListenerAction.java | 67 ++++++++++++++----- .../com/fr/start/module/DesignerStartup.java | 8 +-- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java index bc09dbf6a1..f33527ccbb 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -1,7 +1,10 @@ package com.fr.design.os.impl; +import com.fr.design.actions.help.AboutDialog; +import com.fr.design.actions.help.AboutPane; import com.fr.design.mainframe.DesignerContext; import com.fr.exit.DesignerExiter; +import com.fr.general.ComparatorUtils; import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.stable.os.support.OSBasedAction; @@ -21,25 +24,55 @@ public class MacOsAddListenerAction implements OSBasedAction { public void execute(final Object... objects) { try { Class app = Class.forName("com.apple.eawt.Application"); - Class handler = Class.forName("com.apple.eawt.QuitHandler"); - Object instance = Proxy.newProxyInstance(handler.getClassLoader(), new Class[]{handler}, - new InvocationHandler() { - @Override - public Object invoke(Object proxy, Method method, - Object[] args) throws Throwable { - if ("handleQuitRequestWith".equals(method.getName())) { - if (DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isShowing()) { - DesignerContext.getDesignerFrame().exit(); - } else { - DesignerExiter.getInstance().execute(); - } - } - return null; - } - }); - Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", instance); + Class quitHandler = Class.forName("com.apple.eawt.QuitHandler"); + Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction()); + Class aboutHandler = Class.forName("com.apple.eawt.AboutHandler"); + Object aboutInstance = getProxy(aboutHandler, "", new AboutAction()); + Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", quitInstance) + .call("setAboutHandler", aboutInstance); } catch (ClassNotFoundException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } + + + private Object getProxy(Class clazz, final String methodName, final Action action) { + return Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, + new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, + Object[] args) throws Throwable { + if (ComparatorUtils.equals(methodName, method.getName())) { + action.execute(); + } + return null; + } + }); + } + + interface Action { + void execute(); + } + + private class QuitAction implements Action { + + @Override + public void execute() { + if (DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isShowing()) { + DesignerContext.getDesignerFrame().exit(); + } else { + DesignerExiter.getInstance().execute(); + } + } + } + + private class AboutAction implements Action { + + @Override + public void execute() { + AboutPane aboutPane = new AboutPane(); + AboutDialog aboutDialog = new AboutDialog(DesignerContext.getDesignerFrame(), aboutPane); + aboutDialog.setVisible(true); + } + } } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 60de86543a..56af5583f5 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -16,11 +16,11 @@ import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; +import com.fr.stable.ArrayUtils; import com.fr.stable.BuildContext; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -35,8 +35,6 @@ import com.fr.start.server.FineEmbedServer; import com.fr.value.NotNullLazyValue; import org.jetbrains.annotations.NotNull; -import javax.swing.JFrame; -import javax.swing.JOptionPane; import java.io.File; import java.util.concurrent.ExecutorService; @@ -71,7 +69,9 @@ public class DesignerStartup extends Activator { if (DesignUtils.isStarted()) { // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 final String[] args = startupArgsValue.getValue().get(); - DesignUtils.clientSend(args); + if (ArrayUtils.isNotEmpty(args)) { + DesignUtils.clientSend(args); + } FineLoggerFactory.getLogger().info("The Designer Has Been Started"); if (args.length == 0) { TipDialog dialog = new TipDialog(null, From 8c88dc76c08eed102b14ae907439d6ee2313847d Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Apr 2020 20:29:50 +0800 Subject: [PATCH 79/88] MOBILE-26198 && MOBILE-26189 --- .../design/mainframe/WidgetPropertyPane.java | 3 +- .../mobile/MobileAdvanceDefinePane.java | 137 +------------- .../mobile/TabMobileWidgetDefinePane.java | 15 +- .../component/MobileAdvanceInnerPane.java | 169 ++++++++++++++++++ .../component/MobileComponentFrozenPane.java | 19 ++ 5 files changed, 209 insertions(+), 134 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index f7668b30a1..93533b7728 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -6,6 +6,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; import com.fr.design.designer.properties.mobile.MobileStylePropertyUI; @@ -179,7 +180,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper if (selection != null && xCreator != null) { embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if(!designer.getDesignerMode().isFormParameterEditor()) { - if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { + if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator)); } if (xCreator.supportMobileStyle()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index 34f6a7adf5..542641c248 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -1,40 +1,14 @@ package com.fr.design.widget.ui.designer.mobile; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.form.main.Form; -import com.fr.form.ui.FormWidgetHelper; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WLayout; -import com.fr.form.ui.container.WSortLayout; -import com.fr.form.ui.mobile.MobileBookMark; -import com.fr.form.ui.widget.CRBoundsWidget; -import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; -import com.fr.stable.StringUtils; +import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Iterator; -import java.util.List; /** * @author hades @@ -44,8 +18,7 @@ import java.util.List; public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { private XCreator xCreator; - private UICheckBox useBookMarkCheck; - private UITextField bookMarkNameField; + private MobileAdvanceInnerPane innerPane; public MobileAdvanceDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -54,71 +27,13 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { @Override public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false); - this.bookMarkNameField = new UITextField() { - @Override - protected void initListener() { - if (shouldResponseChangeListener()) { - addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - attributeChange(); - } - }); - addKeyListener(new KeyAdapter() { - @Override - public void keyTyped(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - attributeChange(); - } - } - }); - } - } - }; - JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{useBookMarkCheck}}, - TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); - final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{new UILabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}}, - TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); - this.useBookMarkCheck.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean selected = MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected(); - Widget widget = MobileAdvanceDefinePane.this.xCreator.toData(); - MobileBookMark bookMark = widget.getMobileBookMark(); - bookMarkNamePane.setVisible(selected); - if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) { - String name = widget.getWidgetName(); - MobileAdvanceDefinePane.this.bookMarkNameField.setText(name); - bookMark.setBookMarkName(name); - } - } - }); - bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark()); - contentPane.add(useBookMarkPane, BorderLayout.NORTH); - contentPane.add(bookMarkNamePane, BorderLayout.CENTER); - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane); + this.innerPane = new MobileAdvanceInnerPane(xCreator); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, innerPane); JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); wrapPane.add(uiExpandablePane, BorderLayout.NORTH); this.add(wrapPane, BorderLayout.NORTH); - initData(); } - private void initData() { - MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); - String bookMarkName = bookMark.getBookMarkName(); - if (StringUtils.isEmpty(bookMarkName)) { - String widgetName = xCreator.toData().getWidgetName(); - this.bookMarkNameField.setText(widgetName); - bookMark.setBookMarkName(widgetName); - } else { - this.bookMarkNameField.setText(bookMarkName); - } - } private void bindListeners2Widgets() { reInitAllListeners(); @@ -147,53 +62,13 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { - MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); - this.bookMarkNameField.setText(bookMark.getBookMarkName()); - if (bookMark.isFrozen()) { - this.useBookMarkCheck.setSelected(false); - this.useBookMarkCheck.setEnabled(false); - } else { - this.useBookMarkCheck.setSelected(bookMark.isUseBookMark()); - } + this.innerPane.populate(); this.bindListeners2Widgets(); } @Override public void update() { - MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); - bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); - String newBookMarkName = this.bookMarkNameField.getText(); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { - return; - } - if (!isExist(newBookMarkName)) { - bookMark.setBookMarkName(newBookMarkName); - } else { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), - JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); - this.bookMarkNameField.setText(bookMark.getBookMarkName()); - } - } - - private boolean isExist(String name) { - Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); - WLayout container = form.getContainer(); - WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); - List list = wSortLayout.getOrderedMobileWidgetList(); - for (String value : list) { - Widget widget = form.getWidgetByName(value); - if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) { - return true; - } - CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); - if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) { - return true; - } - } - return false; + this.innerPane.update(); } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index 3f3d34eaf7..d4f1c0a114 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -15,6 +15,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane; import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; @@ -33,6 +34,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; private MobileBookMarkUsePane mobileBookMarkUsePane; + private MobileAdvanceInnerPane mobileAdvanceInnerPane; public TabMobileWidgetDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -70,9 +72,12 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); if (FormDesignerUtils.isAppRelayout(designer)) { mobileBookMarkUsePane = new MobileBookMarkUsePane(); - innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.SOUTH); + mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator); + innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER); + innerAdvancePane.add(mobileAdvanceInnerPane, BorderLayout.SOUTH); + } - innerAdvancePane.add(marginPane, BorderLayout.CENTER); + innerAdvancePane.add(marginPane, BorderLayout.NORTH); UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane); UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane); //高级 @@ -100,6 +105,9 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.populate(xCreator); } + if (mobileAdvanceInnerPane != null) { + mobileAdvanceInnerPane.populate(); + } } @Override @@ -116,5 +124,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.update(xCreator); } + if (mobileAdvanceInnerPane != null) { + this.mobileAdvanceInnerPane.update(); + } } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java new file mode 100644 index 0000000000..33a957479b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java @@ -0,0 +1,169 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.form.main.Form; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WLayout; +import com.fr.form.ui.container.WSortLayout; +import com.fr.form.ui.mobile.MobileBookMark; +import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.List; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/4/17 + */ +public class MobileAdvanceInnerPane extends BasicPane { + + private XCreator xCreator; + private UICheckBox useBookMarkCheck; + private UITextField bookMarkNameField; + + + public MobileAdvanceInnerPane(XCreator xCreator) { + this.xCreator = xCreator; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + initComponent(); + } + + private void initComponent() { + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false); + this.bookMarkNameField = new UITextField() { + @Override + protected void initListener() { + if (shouldResponseChangeListener()) { + addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + attributeChange(); + } + }); + addKeyListener(new KeyAdapter() { + @Override + public void keyTyped(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + attributeChange(); + } + } + }); + } + } + }; + JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{useBookMarkCheck}}, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); + final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{new UILabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}}, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); + this.useBookMarkCheck.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean selected = MobileAdvanceInnerPane.this.useBookMarkCheck.isSelected(); + Widget widget = MobileAdvanceInnerPane.this.xCreator.toData(); + MobileBookMark bookMark = widget.getMobileBookMark(); + bookMarkNamePane.setVisible(selected); + if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) { + String name = widget.getWidgetName(); + MobileAdvanceInnerPane.this.bookMarkNameField.setText(name); + bookMark.setBookMarkName(name); + } + } + }); + bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark()); + contentPane.add(useBookMarkPane, BorderLayout.NORTH); + contentPane.add(bookMarkNamePane, BorderLayout.CENTER); + this.add(contentPane); + initData(); + } + + private void initData() { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + String bookMarkName = bookMark.getBookMarkName(); + if (StringUtils.isEmpty(bookMarkName)) { + String widgetName = xCreator.toData().getWidgetName(); + this.bookMarkNameField.setText(widgetName); + bookMark.setBookMarkName(widgetName); + } else { + this.bookMarkNameField.setText(bookMarkName); + } + } + + public void populate() { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + this.bookMarkNameField.setText(bookMark.getBookMarkName()); + if (bookMark.isFrozen()) { + this.useBookMarkCheck.setSelected(false); + this.useBookMarkCheck.setEnabled(false); + } else { + this.useBookMarkCheck.setSelected(bookMark.isUseBookMark()); + } + } + + public void update() { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); + String newBookMarkName = this.bookMarkNameField.getText(); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { + return; + } + if (!isExist(newBookMarkName)) { + bookMark.setBookMarkName(newBookMarkName); + } else { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), + JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); + this.bookMarkNameField.setText(bookMark.getBookMarkName()); + } + } + + private boolean isExist(String name) { + Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); + WLayout container = form.getContainer(); + WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); + List list = wSortLayout.getOrderedMobileWidgetList(); + for (String value : list) { + Widget widget = form.getWidgetByName(value); + if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) { + return true; + } + CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); + if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) { + return true; + } + } + return false; + } + + @Override + protected String title4PopupWindow() { + return "MobileAdvanceInnerPane"; + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java index 2492650972..06e1c39d3d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java @@ -11,9 +11,12 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.main.Form; import com.fr.form.ui.FormWidgetHelper; import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WSortLayout; +import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.stable.ArrayUtils; import javax.swing.BorderFactory; @@ -97,6 +100,22 @@ public class MobileComponentFrozenPane extends BasicPane { map.put(value, false); } uiComboCheckBox.setSelectedValues(map); + if (ArrayUtils.isEmpty(uiComboCheckBox.getSelectedValues()) || !uiComboCheckBox.isEnabled()) { + uiComboCheckBox.setEnabled(!shouldFrozen()); + } + } + + private boolean shouldFrozen() { + Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); + WLayout container = form.getContainer(); + WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); + boolean frozen = false; + List list = wSortLayout.getOrderedMobileWidgetList(); + for (String value : list) { + CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); + frozen = frozen || boundsWidget.getWidget().getMobileBookMark().isUseBookMark(); + } + return frozen; } @Override From caeeffcf674e3be80b2a2a69e433424c83f15f71 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Apr 2020 20:38:28 +0800 Subject: [PATCH 80/88] =?UTF-8?q?fix=20=E6=BC=8F=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombocheckbox/UIComboCheckBox.java | 8 ++++++++ .../com/fr/design/os/impl/MacOsAddListenerAction.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index e2a5719d4b..0652f9cf8f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -360,6 +360,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam popup.setSelectedValue(map); } + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + this.popup.setEnabled(enabled); + this.editor.setEnabled(enabled); + this.arrowButton.setEnabled(enabled); + } + /** * 简单的测试demo * @param args diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java index f33527ccbb..1ff796a1dc 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -27,7 +27,7 @@ public class MacOsAddListenerAction implements OSBasedAction { Class quitHandler = Class.forName("com.apple.eawt.QuitHandler"); Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction()); Class aboutHandler = Class.forName("com.apple.eawt.AboutHandler"); - Object aboutInstance = getProxy(aboutHandler, "", new AboutAction()); + Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction()); Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", quitInstance) .call("setAboutHandler", aboutInstance); } catch (ClassNotFoundException e) { From fddd95418ed168948795da459a02c03626ddd7de Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Apr 2020 13:43:02 +0800 Subject: [PATCH 81/88] =?UTF-8?q?MOBILE-26198=20&&=20MOBILE-26189=20?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardlayout/XWCardMainBorderLayout.java | 4 +- .../MobileBookMarkCombinePropertyUI.java | 36 ++++++++++ .../design/mainframe/WidgetPropertyPane.java | 3 +- .../mobile/MobileBookMarkCombinePane.java | 69 +++++++++++++++++++ .../component/MobileComponentFrozenPane.java | 16 ++--- 5 files changed, 117 insertions(+), 11 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkCombinePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkCombinePane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index c51fe491e4..682b92e698 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -16,7 +16,7 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWidgetCreator; -import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; +import com.fr.design.designer.properties.mobile.MobileBookMarkCombinePropertyUI; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -518,7 +518,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; + return new WidgetPropertyUIProvider[] {new MobileBookMarkCombinePropertyUI(this)}; } else { return super.getWidgetPropertyUIProviders(); } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkCombinePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkCombinePropertyUI.java new file mode 100644 index 0000000000..29bc2fb9aa --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkCombinePropertyUI.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.MobileBookMarkCombinePane; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/4/18 + */ +public class MobileBookMarkCombinePropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public MobileBookMarkCombinePropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new MobileBookMarkCombinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 93533b7728..7fb6f20143 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -6,6 +6,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; @@ -180,7 +181,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper if (selection != null && xCreator != null) { embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if(!designer.getDesignerMode().isFormParameterEditor()) { - if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { + if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class, XWCardMainBorderLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator)); } if (xCreator.supportMobileStyle()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkCombinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkCombinePane.java new file mode 100644 index 0000000000..cd46026017 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkCombinePane.java @@ -0,0 +1,69 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane; + +import javax.swing.*; +import java.awt.*; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/4/18 + */ +public class MobileBookMarkCombinePane extends MobileWidgetDefinePane { + + private MobileBookMarkUsePane mobileBookMarkUsePane; + private MobileAdvanceInnerPane mobileAdvanceInnerPane; + private XCreator xCreator; + + + public MobileBookMarkCombinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator); + this.mobileBookMarkUsePane = new MobileBookMarkUsePane(); + panel.add(this.mobileBookMarkUsePane, BorderLayout.NORTH); + panel.add(this.mobileAdvanceInnerPane, BorderLayout.CENTER); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panel); + this.add(uiExpandablePane, BorderLayout.NORTH); + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void populate(FormDesigner designer) { + this.mobileBookMarkUsePane.populate(xCreator); + this.mobileAdvanceInnerPane.populate(); + this.bindListeners2Widgets(); + } + + @Override + public void update() { + this.mobileBookMarkUsePane.update(xCreator); + this.mobileAdvanceInnerPane.update(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java index 06e1c39d3d..de86a07f2b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java @@ -61,6 +61,7 @@ public class MobileComponentFrozenPane extends BasicPane { } List widgetList = ((WSortLayout) selectedModel).getNonContainerWidgetList(); + widgetList.removeAll(frozenWidgets()); return widgetList.toArray(new String[0]); } @@ -100,22 +101,21 @@ public class MobileComponentFrozenPane extends BasicPane { map.put(value, false); } uiComboCheckBox.setSelectedValues(map); - if (ArrayUtils.isEmpty(uiComboCheckBox.getSelectedValues()) || !uiComboCheckBox.isEnabled()) { - uiComboCheckBox.setEnabled(!shouldFrozen()); - } } - private boolean shouldFrozen() { + private List frozenWidgets() { Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); WLayout container = form.getContainer(); WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); - boolean frozen = false; - List list = wSortLayout.getOrderedMobileWidgetList(); + List list = wSortLayout.getNonContainerWidgetList(); + List widgets = new ArrayList<>(); for (String value : list) { CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); - frozen = frozen || boundsWidget.getWidget().getMobileBookMark().isUseBookMark(); + if (boundsWidget.getWidget().getMobileBookMark().isUseBookMark()) { + widgets.add(value); + } } - return frozen; + return widgets; } @Override From 2df36513fb1344e150532dbb2fc90434ba8d9d6c Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Apr 2020 22:18:58 +0800 Subject: [PATCH 82/88] =?UTF-8?q?MOBILE-26189=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/cardlayout/XWCardMainBorderLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 682b92e698..c51fe491e4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -16,7 +16,7 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWidgetCreator; -import com.fr.design.designer.properties.mobile.MobileBookMarkCombinePropertyUI; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -518,7 +518,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBookMarkCombinePropertyUI(this)}; + return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; } else { return super.getWidgetPropertyUIProviders(); } From b08c9f9ec17905a9c81d6e4203e51d58bd5181c0 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 22 Apr 2020 15:15:22 +0800 Subject: [PATCH 83/88] =?UTF-8?q?REPORT-30347=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/LifecycleFatalErrorHandler.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java index 252b01dc1a..ef416416c9 100644 --- a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java +++ b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fr.common.report.ReportState; import com.fr.design.RestartHelper; import com.fr.design.dialog.ErrorDialog; import com.fr.design.dialog.FineJOptionPane; @@ -10,6 +11,9 @@ import com.fr.exit.DesignerExiter; import com.fr.general.IOUtils; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StableUtils; import com.fr.stable.lifecycle.ErrorType; import com.fr.stable.lifecycle.FineLifecycleFatalError; @@ -45,6 +49,10 @@ public class LifecycleFatalErrorHandler { public void handle(FineLifecycleFatalError fatal) { SplashContext.getInstance().hide(); + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } map.get(fatal.getErrorType()).handle(fatal); } From 7f08ca3560099aa19dcfd6388e0ed85d9f4c20c0 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 22 Apr 2020 22:20:20 +0800 Subject: [PATCH 84/88] =?UTF-8?q?REPORT-30369=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardMainBorderLayout.java | 9 --------- .../designer/creator/cardlayout/XWTabFitLayout.java | 6 +----- .../com/fr/design/mainframe/WidgetPropertyPane.java | 2 +- .../ui/designer/mobile/TabMobileWidgetDefinePane.java | 10 ---------- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index c51fe491e4..25da3e7754 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -514,13 +514,4 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public boolean isSupportShared() { return true; } - - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; - } else { - return super.getWidgetPropertyUIProviders(); - } - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index f17ac09250..508f3f7dfa 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -593,11 +593,7 @@ public class XWTabFitLayout extends XWFitLayout { */ @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBookMarkPropertyUI(this), new MobileBooKMarkUsePropertyUI(this)}; - } else { - return new WidgetPropertyUIProvider[0]; - } + return new WidgetPropertyUIProvider[0]; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 7fb6f20143..c37b4ba9aa 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -181,7 +181,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper if (selection != null && xCreator != null) { embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if(!designer.getDesignerMode().isFormParameterEditor()) { - if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class, XWCardMainBorderLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { + if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator)); } if (xCreator.supportMobileStyle()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index d4f1c0a114..5919985d59 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -34,7 +34,6 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; private MobileBookMarkUsePane mobileBookMarkUsePane; - private MobileAdvanceInnerPane mobileAdvanceInnerPane; public TabMobileWidgetDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -72,10 +71,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); if (FormDesignerUtils.isAppRelayout(designer)) { mobileBookMarkUsePane = new MobileBookMarkUsePane(); - mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator); innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER); - innerAdvancePane.add(mobileAdvanceInnerPane, BorderLayout.SOUTH); - } innerAdvancePane.add(marginPane, BorderLayout.NORTH); UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane); @@ -105,9 +101,6 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.populate(xCreator); } - if (mobileAdvanceInnerPane != null) { - mobileAdvanceInnerPane.populate(); - } } @Override @@ -124,8 +117,5 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.update(xCreator); } - if (mobileAdvanceInnerPane != null) { - this.mobileAdvanceInnerPane.update(); - } } } From c600b1ef2e99126657f464c61c9c229779502cde Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 23 Apr 2020 15:33:37 +0800 Subject: [PATCH 85/88] =?UTF-8?q?REPORT-29815=20=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E6=8A=A5=E8=A1=A8=E5=92=8C=E8=A1=A8=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/FormMobileAttrAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index deec25c0b1..6227c169b1 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -112,7 +112,7 @@ public class FormMobileAttrAction extends JTemplateAction { private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { @Override public char getMnemonic() { - return 'T'; + return 'P'; } @Override From 6a1934fd1b7597720e3dba9f9b4e316765f05912 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 23 Apr 2020 17:45:51 +0800 Subject: [PATCH 86/88] =?UTF-8?q?REPORT-29815=20=20=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/unit/UnitConvertUtil.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index 406ddcfdde..520430d51d 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -6,7 +6,11 @@ import com.fr.design.unit.impl.CMReportLengthUNIT; import com.fr.design.unit.impl.INCHReportLengthUNIT; import com.fr.design.unit.impl.MMReportLengthUNIT; import com.fr.design.unit.impl.PTReportLengthUNIT; - +import com.fr.general.GeneralContext; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -18,6 +22,23 @@ public class UnitConvertUtil { private static List lengthUNITList = new ArrayList(); static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent pluginEvent) { + initSupportedReportLengthUNIT(); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext pluginContext) { + return pluginContext.contain(ReportLengthUNITProvider.MARK_STRING); + } + }); + + initSupportedReportLengthUNIT(); + } + + private static void initSupportedReportLengthUNIT(){ + lengthUNITList.clear(); lengthUNITList.add(new MMReportLengthUNIT()); lengthUNITList.add(new CMReportLengthUNIT()); lengthUNITList.add(new INCHReportLengthUNIT()); From ad08ec0ec4fba0d7217aea72b82f09e9b9c8274c Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 23 Apr 2020 14:51:17 +0800 Subject: [PATCH 87/88] =?UTF-8?q?REPORT-29118=20mac=E4=B8=8B=E5=B1=8F?= =?UTF-8?q?=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/os/impl/SupportOSImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 5b8d4d2e8d..d799d00466 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -88,7 +88,7 @@ public enum SupportOSImpl implements SupportOS { NON_GUARDIAN_START { @Override public boolean support() { - return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM; + return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM || OperatingSystem.isMacos(); } }, From a95a41adcb75bad379730ac30f87cd5cb1188cbf Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 24 Apr 2020 11:07:08 +0800 Subject: [PATCH 88/88] =?UTF-8?q?REPORT-30467=20=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=97=B6=E9=95=BF=E5=BB=B6=E9=95=BF=20=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E4=B8=8E=E7=A1=AE=E5=AE=9A=E5=AF=B9=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/DesignerSuperListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java index f6fa3c9376..f5c9174649 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit; public class DesignerSuperListener { private static final DesignerSuperListener INSTANCE = new DesignerSuperListener(); - private static final int ONCE_DELAY = 90; + private static final int ONCE_DELAY = 180; private static final int FIXED_DELAY = 0; private static final int FIXED_FREQ = 2; @@ -116,6 +116,7 @@ public class DesignerSuperListener { @Override protected void okEvent() { dispose(); + DesignerLauncher.getInstance().exit(); } @Override @@ -125,7 +126,6 @@ public class DesignerSuperListener { } }; dialog.setVisible(true); - DesignerLauncher.getInstance().exit(); } private void startFallBackListener() {