Browse Source

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

bugfix/11.0
pengda 3 years ago
parent
commit
24253b6235
  1. 14
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  2. 47
      designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java
  3. 32
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  4. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
  5. 8
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  6. 17
      designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
  7. 94
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  9. 20
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  10. 8
      designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
  11. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
  12. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
  13. 23
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  14. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
  15. 138
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
  16. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  17. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  18. 50
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  19. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  20. 58
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  21. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  22. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  23. 5
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  24. 11
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java
  25. 1
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

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

@ -24,6 +24,16 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
private AttributeChangeListener listener;
private String globalName = "";
private boolean autoFireAttributesChanged = true;
public boolean isAutoFireAttributesChanged() {
return this.autoFireAttributesChanged;
}
public void setAutoFireAttributesChanged(boolean autoFireAttributesChanged) {
this.autoFireAttributesChanged = autoFireAttributesChanged;
}
protected AbstractAttrNoScrollPane() {
initAll();
}
@ -127,7 +137,9 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
public void attributeChanged() {
synchronized (this) {
if (listener != null) {
listener.attributeChange();
if (autoFireAttributesChanged) {
listener.attributeChange();
}
}
}
}

47
designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java

@ -0,0 +1,47 @@
package com.fr.design.gui.frpane;
import java.awt.Component;
import java.awt.Container;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/17
*/
public class AttributeChangeUtils {
private static AbstractAttrNoScrollPane findNearestAttrNoScrollPaneAncestor(Component c) {
for(Container p = c.getParent(); p != null; p = p.getParent()) {
if (p instanceof AbstractAttrNoScrollPane) {
return (AbstractAttrNoScrollPane) p;
}
}
return null;
}
public static void changeComposedUI(Component composedComponent, boolean fireMiddleStateChanged, UIChangeAction action) {
AbstractAttrNoScrollPane attrPane = findNearestAttrNoScrollPaneAncestor(composedComponent);
boolean oldAutoFire = true;
if (!fireMiddleStateChanged) {
// 禁止属性面板自动处理属性更新
if (attrPane != null) {
oldAutoFire = attrPane.isAutoFireAttributesChanged();
attrPane.setAutoFireAttributesChanged(false);
}
}
// 更新UI
action.changeComposedUI();
if (!fireMiddleStateChanged) {
// 恢复属性面板自动处理属性更新
if (attrPane != null) {
attrPane.setAutoFireAttributesChanged(oldAutoFire);
}
}
}
public interface UIChangeAction {
void changeComposedUI();
}
}

32
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -37,6 +37,8 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isToolBarComponent = false;
private boolean isClick;
private boolean autoFireStateChanged = true;
public UIButtonGroup(String[] textArray) {
this(textArray, null);
}
@ -72,7 +74,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -108,7 +110,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -175,7 +177,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -253,6 +255,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
g2d.setClip(oldClip);
}
public void setAutoFireStateChanged(boolean autoFireStateChanged) {
this.autoFireStateChanged = autoFireStateChanged;
}
/**
* setSelectedItem
*
@ -287,13 +293,14 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return selectedIndex;
}
protected void setSelectedWithFireChanged(int newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
if (i == selectedIndex) {
labelButtonList.get(i).setSelectedWithFireListener(true);
} else {
labelButtonList.get(i).setSelected(false);
protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
if (selectedIndex != newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex, false);
}
if (fireChanged) {
fireStateChanged();
}
}
}
@ -304,10 +311,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param newSelectedIndex
*/
public void setSelectedIndex(int newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
setSelectedIndex(newSelectedIndex, true);
}
private void fireStateChanged() {

9
designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java

@ -63,13 +63,8 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
@Override
protected void setSelectedWithFireChanged(int newSelectedIndex) {
if (selectedIndex != newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
}
protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
super.setSelectedIndex(newSelectedIndex, fireChanged);
tabChanged(newSelectedIndex);
}
}

8
designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java

@ -142,10 +142,12 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
}
}
public void setSelectedWithFireListener(boolean isSelected) {
public void setSelected(boolean isSelected, boolean fireChanged) {
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
fireSelectedChanged();
if (fireChanged) {
fireSelectedChanged();
}
refresh(isSelected);
}
}
@ -175,7 +177,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override
public void mouseClicked(MouseEvent e) {
if (isEnabled() && !isEventBannded) {
setSelectedWithFireListener(!isSelected());
setSelected(!isSelected(), true);
}
}
};

17
designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.AttributeChangeUtils;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -47,16 +48,20 @@ public class FollowingThemePane extends BasicPane implements UIObserver {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
followingThemeButtonGroup.setSelectedIndex(1);
followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (FollowingThemeActionChangeListener changeListener : changeListeners) {
changeListener.onFollowingTheme(isFollowingTheme());
}
invalidate();
// 与主题相关的属性面板更新完毕后,再通知外层更新数据
AttributeChangeUtils.changeComposedUI(FollowingThemePane.this, false, new AttributeChangeUtils.UIChangeAction() {
@Override
public void changeComposedUI() {
for (FollowingThemeActionChangeListener changeListener : changeListeners) {
changeListener.onFollowingTheme(isFollowingTheme());
}
invalidate();
}
});
if (uiObserverListener != null) {
uiObserverListener.doChange();
}

94
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -50,9 +50,9 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -86,6 +86,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private static final String CUSTOM = "custom";
private static final String CURRENT_TEMPLATE = "cur";
private static final String OTHER_TEMPLATE = "other";
private static final UILabel EMPTY_LABEL = new UILabel();
static {
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF"));
@ -245,19 +246,21 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
ParameterSettingButton.class
});
this.setDefaultEditor(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultRenderer(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultEditor(ExportTypeCombobox.class, new ExportTypeCombobox());
this.setDefaultEditor(FileNameCombobox.class, new FileNameCombobox());
this.setDefaultEditor(FileNameFormulaEditor.class, new FileNameFormulaEditor());
this.setDefaultEditor(ParameterCombobox.class, new ParameterCombobox());
this.setDefaultEditor(ParameterSettingButton.class, new ParameterSettingButton());
this.setDefaultRenderer(ParameterSettingButton.class, new ParameterSettingButton());
this.createTable().getColumnModel().getColumn(2).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(4).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(40);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(50);
}
@Override
public UITableEditAction[] createAction() {
return new UITableEditAction[] {new AddJSAction(), new DeleteAction()};
return new UITableEditAction[]{new AddJSAction(), new DeleteAction()};
}
@Override
@ -282,14 +285,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public boolean isCellEditable(int row, int col) {
if(col == 3) {
if (col == 3) {
// 命名详情
return this.getList().get(row) != null && !this.getList().get(row).isDefaultFileName();
}
if (col == 5) {
// 参数设置按钮
return this.getList().get(row) != null && !this.getList().get(row).isExtendParameters();
}
return true;
}
@ -318,7 +317,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
// 导出文件选择
class ExportTemplateChooser extends AbstractCellEditor implements TableCellEditor {
class ExportTemplateChooser extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = -9112506131272704717L;
private JPanel reportletNamePane;
@ -364,7 +363,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
@ -387,6 +386,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() {
return reportPathTextField.getText();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
reportPathTextField.setText((String) value);
return reportletNamePane;
}
}
// 导出方式下拉框
@ -396,7 +401,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public ExportTypeCombobox() {
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP);
, EXPORT_TYPES_MAP);
this.addCellEditorListener(new CellEditorListener() {
@Override
@ -406,7 +411,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
@ -453,7 +458,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
@ -496,7 +501,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
@ -524,13 +529,29 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
//参数设置下拉框
class ParameterCombobox extends AbstractCellEditor implements TableCellEditor {
class ParameterCombobox extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = 2630964402770993584L;
private UIComboBox parameterSetting;
public ParameterCombobox() {
parameterSetting = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, PARAMETER_TYPE_MAP);
parameterSetting.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = parameterSetting.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExtendParameters(StringUtils.equals(value, DEFAULT));
}
// 单纯为了刷新表格,使某些联动生效
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
@ -540,15 +561,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = parameterSetting.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExtendParameters(StringUtils.equals(value, DEFAULT));
}
// 这里重新触发是为了触发某些编辑后事件
fireTableDataChanged();
}
});
@ -567,7 +580,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
// 参数设置按钮
class ParameterSettingButton extends AbstractCellEditor implements TableCellEditor {
class ParameterSettingButton extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = 4021592871993049137L;
private UIButton paraButton;
@ -576,8 +589,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public ParameterSettingButton() {
paraSettingPane = new ParameterSettingPane();
paraButton = new UIButton();
paraButton.setBackground(Color.GRAY);
paraButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_Set"));
paraButton.addMouseListener(new MouseAdapter() {
@Override
@ -603,7 +615,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
@ -616,7 +628,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
paraSettingPane.refresh(new ArrayList<>(Arrays.asList((ParameterProvider[]) value)));
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
ParameterProvider[] providers = (ParameterProvider[]) value;
if (providers != null) {
paraSettingPane.refresh(Arrays.asList(providers));
}
return paraButton;
}
@ -624,6 +642,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() {
return paraSettingPane.getParameterList();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
return paraButton;
}
}
// 参数设置弹出框
@ -747,10 +773,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
currentTemplatePane.extendParametersCheckBox.setSelected(true);
} else {
currentTemplatePane.extendParametersCheckBox.setSelected(false);
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = js.getParameters();
this.parameterViewPane.populate(parameters);
if (this.parameterViewPane != null) {
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = js.getParameters();
this.parameterViewPane.populate(parameters);
}
}
} else {
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);

2
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java

@ -124,6 +124,6 @@ public class GuideView extends JDialog {
private void updateGuideViewLocation() {
GUICoreUtils.centerWindow(window, this);
this.setSize(getSize());
this.setBounds(window.getBounds());
}
}

20
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -21,6 +22,7 @@ import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -33,6 +35,7 @@ import java.util.List;
public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private static final int DEFAULT_ARROW_HEIGHT = 12;
private static final int DEFAULT_ARROW_WIDTH = 18;
public static final Insets DEFAULT_HIGHLIGHT_INSETS = new Insets(5, 5, 5, 5);
private GuideScene nextScene;
private SceneFilter sceneFilter;
@ -169,9 +172,22 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) {
ImageIcon ic = new ImageIcon(image);
UILabel label = new UILabel(ic);
UILabel label = new UILabel(ic){
@Override
public Insets getInsets() {
return DEFAULT_HIGHLIGHT_INSETS;
}
};
label.setBorder(BorderFactory.createMatteBorder(DEFAULT_HIGHLIGHT_INSETS.top, DEFAULT_HIGHLIGHT_INSETS.left, DEFAULT_HIGHLIGHT_INSETS.bottom, DEFAULT_HIGHLIGHT_INSETS.right, Color.WHITE));
label.setOpaque(true);
label.setBounds(rectangle);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
return label;
}

8
designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java

@ -2,8 +2,6 @@ package com.fr.design.mainframe.guide.tip;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.ui.bubble.Bubble;
@ -16,9 +14,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BubbleTip implements GuideTip {
private static final int GAP = 5;
private BubbleWithClose bubbleBox;
private Point anchor;
/**
*
* @param title 标题
@ -70,12 +70,12 @@ public class BubbleTip implements GuideTip {
int bubbleW = bubbleBox.getPreferredSize().width;
int bubbleH = bubbleBox.getPreferredSize().height;
if (bubbleBox.isTailHorizontal()) {
int x = bubbleBox.isTailLeft() ? anchor.x : anchor.x - bubbleW;
int x = bubbleBox.isTailLeft() ? anchor.x + GAP : anchor.x - bubbleW - GAP;
int y = anchor.y - (int) (bubbleH * bubbleBox.getTailStart());
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
} else if (bubbleBox.isTailVertical()) {
int x = anchor.x - (int) (bubbleW * bubbleBox.getTailStart());
int y = bubbleBox.isTailTop() ? anchor.y : anchor.y - bubbleH;
int y = bubbleBox.isTailTop() ? anchor.y + GAP : anchor.y - bubbleH - GAP;
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
}
}

28
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java

@ -17,6 +17,7 @@ import java.awt.event.ActionListener;
public class BubbleHint extends Bubble {
private UIButton confirmButton;
private static final Color CONTENT_TEXT_COLOR = new Color(51, 51, 52);
public BubbleHint() {
super(TailDirection.TOP, 0.9f);
@ -38,21 +39,21 @@ public class BubbleHint extends Bubble {
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
UILabel content1 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
content1.setPreferredSize(new Dimension(190,20));
content1.setHorizontalAlignment(SwingConstants.CENTER);
UILabel content1 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
UILabel content2 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
content2.setPreferredSize(new Dimension(190,20));
content2.setHorizontalAlignment(SwingConstants.CENTER);
UILabel content2 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
buttonContainer.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
buttonContainer.setPreferredSize(new Dimension(190,40));
buttonContainer.setOpaque(false);
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know"));
confirmButton.setPreferredSize(new Dimension(78, 24));
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")) {
public Dimension getPreferredSize() {
return new Dimension(78, 24);
}
};
buttonContainer.add(confirmButton);
contentPane.add(title);
@ -71,4 +72,13 @@ public class BubbleHint extends Bubble {
confirmButton.removeActionListener(listener);
}
private UILabel createContentLabel(String text) {
UILabel content = new UILabel(text);
content.setPreferredSize(new Dimension(190,20));
content.setHorizontalAlignment(SwingConstants.CENTER);
content.setFont(content.getFont().deriveFont(14.0f));
content.setForeground(CONTENT_TEXT_COLOR);
return content;
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java

@ -30,7 +30,7 @@ public class ExpandPane extends JPanel {
}
private void initComponent() {
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5);
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
@ -47,7 +47,7 @@ public class ExpandPane extends JPanel {
private JPanel createHeader() {
headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
headerPane.setPreferredSize(new Dimension(200, 24));
headerPane.setPreferredSize(new Dimension(200, 16));
UILabel headerTitle = new UILabel(this.title);
headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
arrow = new UILabel(downIcon);

23
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java

@ -14,7 +14,9 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -22,6 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Window;
import java.awt.event.ActionEvent;
@ -34,12 +37,16 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182;
private static final Color FONT_COLOR = new Color(51, 51, 52);
private static final Color BUTTON_BG_COLOR = new Color(65, 155,249);
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18);
private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14);
private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() {
if (dialog == null) {
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
}
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
return dialog;
}
@ -65,15 +72,16 @@ public class GuideCompleteDialog extends JDialog {
container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52));
UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm"));
title.setFont(title.getFont().deriveFont(22.0f));
title.setFont(TITLE_FONT);
title.setPreferredSize(new Dimension(190, 30));
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setForeground(FONT_COLOR);
textArea = new UITextPane();
changeLineSpacing(textArea, 0.19f,false);
textArea.setEnabled(false);
textArea.setOpaque(false);
textArea.setFont(textArea.getFont().deriveFont(18.0f));
textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR);
@ -83,7 +91,8 @@ public class GuideCompleteDialog extends JDialog {
doc.setParagraphAttributes(0, doc.getLength(), center, false);
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setPreferredSize(new Dimension(190,38));
buttonContainer.setPreferredSize(new Dimension(190,43));
buttonContainer.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
buttonContainer.setOpaque(false);
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){
@ -92,6 +101,7 @@ public class GuideCompleteDialog extends JDialog {
return new Dimension(122, 38);
}
};
button.setFont(BUTTON_FONT);
button.setUI(confirmButtonUI);
button.setRoundBorder(true);
button.setForeground(Color.WHITE);
@ -131,4 +141,11 @@ public class GuideCompleteDialog extends JDialog {
}
}
};
private void changeLineSpacing(JTextPane pane, float factor, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
StyleConstants.setLineSpacing(set, factor);
pane.setParagraphAttributes(set, replace);
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java

@ -74,7 +74,7 @@ public class GuideManageDialog extends JDialog {
}
private JPanel createGuideVersionPane(GuideVersion guideVersion) {
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5);
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 10);
for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);

138
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java

@ -9,6 +9,7 @@ import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -18,7 +19,6 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Rectangle;
@ -32,13 +32,21 @@ import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
public class BubbleWithClose extends Bubble {
private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
private static final int TITLE_LINE_HEIGHT = 22;
private static final int CONTENT_LINE_HEIGHT = 18;
private static final Icon ICON = IOUtils.readIcon("/com/fr/design/mainframe/guide/close.png");
private static final int HEADER_HEIGHT = 24;
private static final Color HEADER_COLOR = new Color(245, 245, 246);
private static final Color TITLE_COLOR = new Color(51, 51, 52);
private static final Color CONTENT_COLOR = new Color(51,51,52,128);
private static final Insets DEFAULT_INSET = new Insets(10, 15, 10, 15);
private static final Color HIGHLIGHT_COLOR = new Color(65, 155, 249);
private static final Insets DEFAULT_INSET = new Insets(15, 15, 15, 15);
private static final int MIN_WIDTH = 140;
private static final int MAX_WIDTH = 275;
private static final int ICON_GAP = 10;
private static final int ICON_SIZE = 10;
private static final int TEXT_GAP = 5;
private String title;
@ -46,6 +54,8 @@ public class BubbleWithClose extends Bubble {
private UITextPane titleTextArea;
private UITextPane contentTextArea;
private UIButton closeButton;
private Dimension titleSize;
private Dimension contentSize;
public BubbleWithClose(String title, String content) {
this(title, content, TailDirection.LEFT, 0.5f);
@ -87,23 +97,17 @@ public class BubbleWithClose extends Bubble {
@Override
public void componentResized(ComponentEvent e) {
Rectangle rectBounds = getRectBounds();
Dimension buttonSize = closeButton.getPreferredSize();
closeButton.setBounds(getWidth() - 10 - buttonSize.width, rectBounds.y + (HEADER_HEIGHT - buttonSize.height) / 2, buttonSize.width, buttonSize.height);
Dimension titleSize = new Dimension(0,0);
Dimension contentSize = new Dimension(0, 0);
closeButton.setBounds(rectBounds.x + rectBounds.width - DEFAULT_INSET.right - ICON_SIZE, rectBounds.y + 21, ICON_SIZE, ICON_SIZE);
if (titleTextArea != null) {
titleSize = calTextSize(titleTextArea, getTextAreaMaxWidth());
int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - titleSize.width) / 2 + DEFAULT_INSET.left;
int y = rectBounds.y + HEADER_HEIGHT + DEFAULT_INSET.top;
int x = rectBounds.x + DEFAULT_INSET.left;
int y = rectBounds.y + DEFAULT_INSET.top;
titleTextArea.setBounds(x, y, titleSize.width, titleSize.height);
}
if (contentTextArea != null) {
contentSize = calTextSize(contentTextArea, getTextAreaMaxWidth());
int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - contentSize.width) / 2 + DEFAULT_INSET.left;
int y = rectBounds.y = HEADER_HEIGHT + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + 10);
int x = rectBounds.x + DEFAULT_INSET.left;
int y = rectBounds.y + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + getTextGap());
contentTextArea.setBounds(x,y, contentSize.width, contentSize.height);
}
setSize(getPreferredSize().width, getPreferredSize().height);
@ -116,7 +120,7 @@ public class BubbleWithClose extends Bubble {
closeButton = new UIButton();
closeButton.setIcon(ICON);
closeButton.set4ToolbarButton();
closeButton.setPreferredSize(new Dimension(12, 12));
closeButton.setPreferredSize(new Dimension(ICON_SIZE, ICON_SIZE));
closeButton.setRolloverEnabled(false);
closeButton.setPressedPainted(false);
this.add(closeButton);
@ -138,44 +142,84 @@ public class BubbleWithClose extends Bubble {
private void createTitleTextArea() {
if (StringUtils.isNotEmpty(title)) {
titleTextArea = createTextArea(title, FONT, TITLE_COLOR);
titleTextArea = createTextArea(title, TITLE_FONT, TITLE_LINE_HEIGHT, TITLE_COLOR);
this.add(titleTextArea);
}
titleSize = calTextSize(titleTextArea, TITLE_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
private void createContentTextArea() {
if (StringUtils.isNotEmpty(content)) {
contentTextArea = createTextArea(content, FONT, CONTENT_COLOR);
contentTextArea = createTextArea(content, CONTENT_FONT, CONTENT_LINE_HEIGHT, CONTENT_COLOR);
this.add(contentTextArea);
}
contentSize = calTextSize(contentTextArea, CONTENT_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
private UITextPane createTextArea(String str, Font font, Color foreground) {
private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) {
int lineSpace = lineHeight - font.getSize();
UITextPane textArea= new UITextPane(){
@Override
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
}
};
textArea.setText(str);
textArea.setEnabled(false);
textArea.setFont(font);
changeLineSpacing(textArea, lineHeight, true);
textArea.setEditable(false);
textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground);
textArea.setBorder(null);
textArea.setFont(font);
textArea.setOpaque(false);
textArea.setForeground(foreground);
StyledDocument doc = textArea.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
textArea.setText(str);
highlightText(textArea);
return textArea;
}
private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight());
pane.setParagraphAttributes(set, replace);
}
private void highlightText(JTextPane textArea) {
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setForeground(sas, HIGHLIGHT_COLOR);
StyledDocument doc = textArea.getStyledDocument();
String text = textArea.getText();
int startPos = -1;
for (int i = 0; i < text.length(); i ++) {
char ch = text.charAt(i);
if (ch == '【') {
startPos = i;
}
if (ch == '】') {
if (startPos > 0) {
try {
doc.setCharacterAttributes(startPos, (i - startPos + 1), sas, false);
startPos = -1;
} catch (Exception e) {
}
}
}
}
}
@Override
protected int getDefaultWidth() {
return Math.max(titleSize.width, contentSize.width) + getHorizontalInsets() + ICON_GAP + ICON_SIZE + (isTailHorizontal() ? TAIL_HEIGHT : 0) ;
}
@Override
protected int getDefaultHeight() {
Dimension titleSize = calTextSize(titleTextArea, getDefaultTextAreaMaxWidth());
Dimension contentSize = calTextSize(contentTextArea, getDefaultTextAreaMaxWidth());
return (isTailVertical() ? TAIL_HEIGHT : 0) + HEADER_HEIGHT + titleSize.height + (titleSize.height == 0 ? 0 : 5) + contentSize.height + getVerticalInsets();
return titleSize.height + contentSize.height + getTextGap() + getVerticalInsets() + (isTailVertical() ? TAIL_HEIGHT : 0);
}
private int getTextGap() {
return (titleSize.height != 0 && contentSize.height != 0) ? TEXT_GAP : 0;
}
private LayoutManager getLayoutManager() {
@ -206,18 +250,6 @@ public class BubbleWithClose extends Bubble {
};
}
@Override
protected void paintBubbleBg(Graphics2D g2) {
super.paintBubbleBg(g2);
paintHeaderBg(g2);
}
private void paintHeaderBg(Graphics2D g2) {
g2.setColor(HEADER_COLOR);
Rectangle bounds = getRectBounds();
g2.fillRoundRect(bounds.x, bounds.y, bounds.width, HEADER_HEIGHT, 10, 10);
}
private int countLines(JTextPane textArea, int max_width) {
AttributedString text = new AttributedString(textArea.getText());
text.addAttribute(TextAttribute.FONT, textArea.getFont());
@ -234,28 +266,26 @@ public class BubbleWithClose extends Bubble {
return lines;
}
private Dimension calTextSize(JTextPane textArea, int maxWidth) {
private Dimension calTextSize(JTextPane textArea, int lineHeight, int maxWidth, int minWidth) {
if (textArea == null) {
return new Dimension(0, 0);
return new Dimension(minWidth, 0);
}
FontMetrics fontMetrics = GraphHelper.getFontMetrics(textArea.getFont());
int line = countLines(textArea, maxWidth);
int width = maxWidth;
if (line == 1) {
width = fontMetrics.stringWidth(textArea.getText());
width = Math.max(fontMetrics.stringWidth(textArea.getText()), minWidth);
}
int height = fontMetrics.getHeight() * line;
int height = lineHeight * line;
return new Dimension(width, height);
}
private int getTextAreaMaxWidth() {
return getWidth() - (isTailHorizontal() ? TAIL_HEIGHT : 0) -getHorizontalInsets();
}
private int getDefaultTextAreaMaxWidth() {
return BUBBLE_WIDTH - getHorizontalInsets();
private int getTextAreaWidth(int bubbleWidth) {
return bubbleWidth - getHorizontalInsets() - ICON_SIZE - ICON_GAP;
}
private int getHorizontalInsets() {
return DEFAULT_INSET.left + DEFAULT_INSET.right;
}

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

@ -660,7 +660,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true);
setSelected(true, true);
fireSelectedChanged();
//需要先更新,最后重构面板

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -356,7 +356,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
if (isEnabled()) {
noSelected();
changeAxisSelected(getButtonName());
setSelectedWithFireListener(true);
setSelected(true, true);
fireSelectedChanged();
}
}

50
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -6,6 +6,7 @@ import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.AttributeChangeUtils;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -50,6 +51,7 @@ public class StylePane extends BasicPane implements UIObserver {
public StylePane() {
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomStylePane();
themedCellStyleListPane = new ThemedCellStyleListPane();
panes[0] = createThemedStylePane();
@ -72,27 +74,13 @@ public class StylePane extends BasicPane implements UIObserver {
followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (selectedIndex == 1) {
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean();
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone();
if (lastSelectedRealStyle != null) {
customStylePane.populateBean(lastSelectedRealStyle);
}
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
AttributeChangeUtils.changeComposedUI(StylePane.this, false, new AttributeChangeUtils.UIChangeAction() {
@Override
public void changeComposedUI() {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
onFollowingThemeSettingChanged(selectedIndex, selectedIndex == 0);
}
} else {
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
themedCellStyleListPane.reset();
}
});
fireStateChanged();
}
});
@ -108,6 +96,28 @@ public class StylePane extends BasicPane implements UIObserver {
IntervalConstants.INTERVAL_L1, 0);
}
private void onFollowingThemeSettingChanged(int selectedIndex, boolean isFollowingTheme) {
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (!isFollowingTheme) {
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean();
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone();
if (lastSelectedRealStyle != null) {
customStylePane.populateBean(lastSelectedRealStyle);
}
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}
} else {
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
themedCellStyleListPane.reset();
}
}
protected JPanel createTabbedContentPane() {
JPanel contentPane = new JPanel(cardLayout) {
@Override

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

@ -47,7 +47,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
styleList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (changeListener != null) {
if (e.getValueIsAdjusting() && changeListener != null) {
changeListener.stateChanged(new ChangeEvent(styleList));
}
}

58
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -14,6 +14,7 @@ import com.fr.design.mainframe.FormCreatorDropTarget;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.scene.AbstractGuideScene;
import com.fr.design.mainframe.guide.utils.ScreenImage;
import com.fr.design.utils.ComponentUtils;
import com.fr.file.FileNodeFILE;
@ -24,6 +25,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
@ -32,8 +34,10 @@ import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -153,17 +157,60 @@ public class GuideCreateUtils {
return new UILabel(ic);
}
public static UILabel createTarget(JComponent component, boolean isModal, boolean withBorder) {
ImageIcon ic;
if (isModal) {
ic = new ImageIcon(ScreenImage.createImageWithModal(component));
} else {
ic = new ImageIcon(ScreenImage.createImage(component));
}
return createImageTarget(ic, withBorder);
}
private static UILabel createImageTarget(ImageIcon ic, boolean withBorder) {
if (withBorder) {
Insets insets = AbstractGuideScene.DEFAULT_HIGHLIGHT_INSETS;
UILabel label = new UILabel(ic){
@Override
public Insets getInsets() {
return insets;
}
};
label.setBorder(BorderFactory.createMatteBorder(insets.top, insets.left, insets.bottom, insets.right, Color.WHITE));
label.setOpaque(true);
return label;
} else {
return new UILabel(ic);
}
}
public static Rectangle getRelativeBounds(Component component, Component parent, int x, int y) {
Point point = SwingUtilities.convertPoint(parent,0,0, GuideManager.getInstance().getCurrentGuide().getGuideView().getRootPane());
return new Rectangle(point.x + x, point.y + y, component.getWidth(), component.getHeight());
}
public static Rectangle getRelativeBoundsWithBorder(Component component, Component parent, int x, int y) {
Rectangle rectangle = getRelativeBounds(component, parent, x, y);
Insets insets = AbstractGuideScene.DEFAULT_HIGHLIGHT_INSETS;
return new Rectangle(
rectangle.x - insets.left,
rectangle.y - insets.top,
rectangle.width + insets.left + insets.right,
rectangle.height + insets.top + insets.bottom
);
}
public static String openGuideFile(String sourcePath, String fileName, String suffix) {
String fileWorkPath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, FILE_PREFIX + UUID.randomUUID().toString() + suffix);
InputStream inputStream = GuideCreateUtils.class.getResourceAsStream(StableUtils.pathJoin(sourcePath, fileName + suffix));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(fileWorkPath, data);
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(fileWorkPath, false)));
FileNodeFILE fileNodeFILE= new FileNodeFILE(new FileNode(fileWorkPath, false));
if (!fileNodeFILE.exists()) {
return null;
}
DesignerContext.getDesignerFrame().openTemplate(fileNodeFILE);
return fileWorkPath;
}
@ -200,6 +247,15 @@ public class GuideCreateUtils {
JOptionPane.WARNING_MESSAGE);
}
public static void showNoFileAuthAlert() {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE
);
}
public static JDialog showConfirmDialog(Window parent, Object message,
String title, int optionType) {
JOptionPane pane = new JOptionPane(message, JOptionPane.QUESTION_MESSAGE, optionType, null, FineJOptionPane.OPTION_OK_CANCEL, FineJOptionPane.OPTION_OK_CANCEL[0]);

7
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -11,6 +11,7 @@ import com.fr.design.mainframe.guide.GuideIds;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideBuilder;
import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.creator.GuideCreateUtils;
import com.fr.design.mainframe.guide.creator.GuideSceneHelper;
import com.fr.design.mainframe.guide.scene.ClickScene;
@ -21,7 +22,6 @@ import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.utils.ComponentUtils;
import javax.swing.SwingUtilities;
import java.awt.Point;
import java.awt.Rectangle;
@ -50,6 +50,11 @@ public class ChangeLayoutComponentGuide {
@Override
public boolean prepared() {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm");
if (filePath == null) {
GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate();
return false;
}
return true;
}

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -105,7 +105,7 @@ public class UseLayoutAndComponentGuide {
ClickScene.ClickType.LEFT
);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form") + "测试文本测试文本测试文本测试文本测试文本", GuideTip.Direction.BOTTOM);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form"), GuideTip.Direction.RIGHT);
scene.showScene();
return true;
}

5
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -94,6 +94,11 @@ public class DownloadComponentPackageGuide {
boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets();
if (loadWidgetSuccess) {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm");
if (filePath == null) {
GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate();
return false;
}
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance();
OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class);

11
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

@ -78,9 +78,14 @@ public class ThemeToggleGuide {
themeLoadCount--;
if (themeLoadCount == 0) {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "toggle_theme", ".frm");
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
asyncThemeFetcher.shutdown();
GuideManager.getInstance().getCurrentGuide().start();
if (filePath == null) {
GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
asyncThemeFetcher.shutdown();
GuideManager.getInstance().getCurrentGuide().start();
}
}
}
});

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

@ -78,6 +78,7 @@ public class ReportStylePane extends BasicPane {
previewArea = new CellStylePreviewPane();
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomFloatStyleSettingPane();
themedFloatStyleSettingPane = new ThemedFloatStyleSettingPane();
panes[0] = createThemedStylePane();

Loading…
Cancel
Save