Browse Source

Merge pull request #6275 in DESIGN/design from release/11.0 to feature/x

* commit 'b75982cb23930c32ace993da73a4eb8551a1b746': (26 commits)
  REPORT-60900 修正图片不符合视觉的问题
  REPORT-60506 & REPORT-60504 url传参行数为负数分页生效,预定义控件没有默认名称
  REPORT-61108 【视觉验收】--主题获取
  REPORT-61116 【主题切换】多选单元格,格子从跟随主题切换到自定义,内边框不可设置
  代码修改
  REPORT-60674 FR11老自适应-报表块右侧选择自定义时,没有手动修改pc浏览器自适应的设置,应该是随着工具栏PC端报表块自适应属性的设置吧,但是出现了不一致现象;10.0是正常的
  无jira任务 漏了编辑事件
  REPORT-60991 导出-导出事件-其它模板-参数设置自定义时无按钮
  REPORT-60942 视觉优化--高亮区域加个5像素的边框
  REPORT-60942 视觉优化
  REPORT-60724 服务器数据集的提示信息视觉问题 && REPORT-60892 全局自适应-样式细节优化-国际化显示不全
  REPORT-61048 远程服务器文件没有权限处理
  REPORT-60942 气泡弹窗交互更新
  REPORT-60889 主题切换,视觉修改
  REPORT-60901【固定布局-原布局推荐4.1】决策报表-自适应布局-jaimme那边出现了,拖拽组件到空白块中蓝色阴影显示偏移了
  REPORT-60894【固定布局-原布局推荐4.1】决策报表-自适应布局-body的组件间隔调的比较大时,固定布局下,尺寸较小的占位块之间尝试对调组件,拖拽A到B的范围内释放鼠标,组件A会消失
  REPORT-61055 【主题获取】主题导出插件几个小问题
  REPORT-60895【固定布局-原布局推荐4.1】决策报表-自适应布局-非固定布局模板刚创建时,选中组件,组件不显示那个可拖拽调整尺寸的小白方框,如果尝试改变整个布局的话,选中组件时会出现白方框;这个的触发规则是什么呢
  REPORT-61095 数据连接与服务器数据集两次重命名后设计器与服务器不一致
  REPORT-61034 mac 全屏时引导窗口未覆盖
  ...
feature/x
superman 3 years ago
parent
commit
72535f5d3e
  1. 14
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 1
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  3. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  5. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  6. 14
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  7. 47
      designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java
  8. 32
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  9. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
  10. 8
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  11. 17
      designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
  12. 94
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  13. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  14. 20
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  15. 8
      designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
  16. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
  17. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
  18. 23
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  19. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
  20. 138
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
  21. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  22. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  23. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  24. 5
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  25. 5
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  26. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  27. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  28. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  29. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  30. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  31. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  32. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  33. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  34. 43
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
  35. 8
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
  36. 6
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
  37. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  38. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  39. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  40. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  41. 44
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  42. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  43. 28
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  44. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java
  45. 16
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
  46. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  47. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
  48. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  49. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java
  50. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  51. BIN
      designer-form/src/main/resources/com/fr/design/form/layouts/images/simple_style_18.png
  52. 3
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  53. 16
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  54. 51
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  55. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  56. 58
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  57. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  58. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  59. 5
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  60. 11
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java
  61. 1
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

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

@ -91,6 +91,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final String VERSION100 = "100";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
public static final int LAYOUT_TEMPLATE_SIMPLE_STYLE = 0;
public static final int LAYOUT_TEMPLATE_REAL_STYLE = 1;
/**
* 指定默认工作空间
*/
@ -205,6 +207,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showTemplateMissingPlugin = true;
private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE;
/**
* DesignerEnvManager.
*/
@ -1691,6 +1695,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.openDebug = openDebug;
}
public int getLayoutTemplateStyle() {
return layoutTemplateStyle;
}
public void setLayoutTemplateStyle(int layoutTemplateStyle) {
this.layoutTemplateStyle = layoutTemplateStyle;
}
/**
* Read XML.<br>
* The method will be invoked when read data from XML file.<br>
@ -1861,6 +1873,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true));
this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE));
}
private void readReportPaneAttributions(XMLableReader reader) {
@ -2134,6 +2147,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
}
writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
writer.end();
}

1
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -88,7 +88,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
protected void renameConnection(final String oldName, final String newName) {
tableDataConfig.renameTableData(oldName, newName);
StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(oldName)));
}
};

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -251,7 +251,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
try {
WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans);
if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.class.getSimpleName());
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

6
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -186,10 +186,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
for (int i = 0; i < lineTips.length; i++) {
String lineTip = lineTips[i];
List<JLabel> jLabels = new ArrayList<>();
jLabels.add(new JLabel(lineTip));
JLabel lineJLabel = new JLabel(lineTip);
lineJLabel.setForeground(Color.lightGray);
jLabels.add(lineJLabel);
if (i == (lineTips.length - 1)) {
JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind"));
jLabel.setForeground(Color.lightGray);
jLabel.setForeground(Color.blue);
jLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {

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

@ -182,7 +182,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
try {
WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans);
if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.class.getSimpleName());
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -197,11 +197,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
ConnectionConfig cloned = connectionConfig.mirror();
populate(cloned);
}
@Override
protected void renameConnection(String oldName, String newName) {
connectionConfig.renameConnection(oldName, newName);
}
};
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionConfig));

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;
}

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

@ -267,6 +267,10 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
return nameTextField.checkValid();
}
public String getThemeName() {
return nameTextField.getText();
}
public List<Color> getCurrentColorScheme() {
return colorListPane.update();
}

19
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -60,6 +60,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton();
private TemplateThemeProfileActionListener actionListener = new TemplateThemeProfileActionAdapter();
public TemplateThemeProfilePane(TemplateThemeConfig<T> config) {
super();
this.config = config;
@ -112,6 +114,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
return;
}
saveButton.setEnabled(valid && isMutable);
actionListener.onThemeNameChecked(themeEditorPane.getThemeName(), valid);
}
});
@ -138,6 +141,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (saveAsButton != null) {
saveAsButton.setEnabled(StringUtils.isNotEmpty(name));
}
isPopulating = false;
}
@ -330,4 +334,19 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
this.dispose();
}
}
public void addProfileActionListener(TemplateThemeProfileActionListener actionListener) {
if (actionListener != null) {
this.actionListener = actionListener;
}
}
public interface TemplateThemeProfileActionListener {
void onThemeNameChecked(String name, boolean valid);
}
public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener {
@Override
public void onThemeNameChecked(String name, boolean valid) { }
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -49,7 +49,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
public PreviewPane() {
this.setPreferredSize(new Dimension(517, 270));
this.setBorder(BorderFactory.createEmptyBorder(7, 10, 5, 10));
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane();

5
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane;
@ -90,9 +91,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
}
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
columnSize[i] = 80;
columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();
} else {
columnSize[i] = 100;
columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth();
}
}

5
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -4,6 +4,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.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -66,13 +67,13 @@ public class ReportFitAttrAction extends JTemplateAction {
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
}, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog"));
dialog.setVisible(true);
}

6
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=800*630
com.fr.design.report.fit.templatePane.dialog=800*400
com.fr.design.report.fit.firstColumn=120*20
com.fr.design.report.fit.column=160*20

6
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=400*20
com.fr.design.web.pane.text.field=400*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=170*20
com.fr.design.report.fit.column=100*20

6
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=130*20
com.fr.design.report.fit.column=100*20

6
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

6
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

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();
}
}

21
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -68,7 +68,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public FRFitLayoutAdapter(XLayoutContainer container) {
super(container);
initMinSize();
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minHeight);
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minWidth, minHeight, actualVal);
painter = this.frLayoutState.getPainter();
}
@ -151,13 +151,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//如果当前处于边缘地带, 那么就把他贴到父容器上
boolean isMatchEdge = matchEdge(x, y);
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
//布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
@ -167,17 +160,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return false;
}
if (isCrossPointArea(comp, x, y)) {
return canAcceptWhileCrossPoint(comp, x, y);
}
if (isTrisectionArea(comp, x, y)) {
return canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
return this.frLayoutState.accept(creator, x, y);
}
private boolean isExtraContainer(Component comp) {

43
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java

@ -12,13 +12,20 @@ import java.awt.Component;
import java.util.ArrayList;
public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
private int minHeight;
private FRBodyLayoutAdapter parentLayoutAdapter;
private static final double TOP_HALF = 0.25;
private static final double BOTTOM_HALF = 0.75;
private final int minWidth;
private final int minHeight;
private final int actualVal;
private final FRBodyLayoutAdapter parentLayoutAdapter;
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minHeight) {
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minWidth, int minHeight, int actualVal) {
super(container);
this.parentLayoutAdapter = parentLayoutAdapter;
this.minWidth = minWidth;
this.minHeight = minHeight;
this.actualVal = actualVal;
}
@Override
@ -79,7 +86,7 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
public void delete(XCreator creator, int creatorWidth, int creatorHeight) {
int x = creator.getX();
int y = creator.getY();
((FRFitLayoutAdapter)parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
((FRFitLayoutAdapter) parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
}
@ -100,7 +107,33 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public boolean accept(XCreator creator, int x, int y) {
return true;
Component comp = container.getComponentAt(x, y);
if (comp == null || checkInterval(comp)) {
return false;
}
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
if (parentLayoutAdapter.isCrossPointArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileCrossPoint(comp, x, y);
}
if (parentLayoutAdapter.isTrisectionArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
}
// 间隔区域
private boolean checkInterval(Component comp) {
return container.getComponentCount() > 0 && comp == container;
}
@Override

8
designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java

@ -1,6 +1,5 @@
package com.fr.design.designer.beans.painters;
import com.fr.design.designer.beans.painters.AbstractPainter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
@ -36,8 +35,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
@Override
public void paint(Graphics g, int startX, int startY) {
super.paint(g, startX, startY);
int x = hotspot.x - hotspot_bounds.x;
int y = hotspot.y - hotspot_bounds.y;
int x = hotspot.x - hotspot_bounds.x ;
int y = hotspot.y - hotspot_bounds.y ;
Component currentComp = container.getComponentAt(x, y);
if (currentComp == null) {
return;
@ -50,7 +49,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
} else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) {
state = OperateState.COMPONENT_REPLACE;
}
state.paint(g, creator.getBackupRectangle(), currentComp.getBounds(), new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
Rectangle currentCompRec = new Rectangle(currentComp.getX() - startX, currentComp.getY() - startY, currentComp.getWidth(), currentComp.getHeight());
state.paint(g, creator.getBackupRectangle(), currentCompRec, new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
} else {
Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
int[] hot_rec = new int[]{x, y, 0, 0};

6
designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java

@ -40,11 +40,11 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
Composite backupComposite = g2d.getComposite();
g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f));
g2d.fillRect(container.getX(), container.getY(), container.getWidth(), container.getHeight());
g2d.fillRect(container.getX() - startX, container.getY() - startY, container.getWidth(), container.getHeight());
g2d.setStroke(XCreatorConstants.DASH_STROKE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
g2d.drawRect(container.getX() + 1, container.getY() + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.drawRect(container.getX() - startX + 1, container.getY() - startY + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.setStroke(backupStroke);
g2d.setComposite(backupComposite);
g2d.setColor(backupColor);
@ -53,4 +53,4 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
}
}
}

1
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -886,6 +886,7 @@ public class XWFitLayout extends XLayoutContainer {
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
dealDirections(newCreator, false);
//对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget();

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

@ -25,7 +25,6 @@ import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Color;
@ -114,14 +113,8 @@ public class FormDesignerUI extends ComponentUI {
if (designer.getPainter() != null) {
// ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用,
// 相当于一个浮动层, 要考虑参数面板的高度
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight());
return null;
}
}.execute();
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight());
}
AddingModel addingModel = designer.getAddingModel();

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -8,11 +8,14 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils;
@ -22,6 +25,7 @@ import com.fr.workspace.WorkContext;
import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
@ -44,6 +48,15 @@ public class DownloadSuitableThemeAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

14
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java

@ -1,11 +1,14 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.stable.StringUtils;
import javax.swing.Action;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) {

44
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java

@ -0,0 +1,44 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import javax.swing.ButtonModel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/18
*/
public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
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, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
}

4
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -1,10 +1,10 @@
package com.fr.design.mainframe.share.ui.block;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader;
@ -116,7 +116,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public JPopupMenu createRightClickPopupMenu() {
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
popupMenu.setBackground(ColorConstants.BACKGROUND);
OnlineShareWidget widget = getWidget();
String suitableThemeFile = widget.getThemePath();

28
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -9,13 +9,16 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.group.ui.GroupMoveDialog;
import com.fr.design.mainframe.share.ui.actions.SharedComponentActionMenuItemUI;
import com.fr.design.mainframe.share.ui.base.PopupMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.local.LocalWidgetSelectPane;
import com.fr.design.mainframe.share.ui.local.WidgetSelectedManager;
@ -275,9 +278,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
popupMenu.add(new PopupMenuItem(new MoveGroupAction()));
popupMenu.add(new PopupMenuItem(new RemoveAction()));
popupMenu.setOpaque(true);
popupMenu.setBackground(ColorConstants.BACKGROUND);
popupMenu.add(new MoveGroupAction().createMenuItem());
popupMenu.add(new RemoveAction().createMenuItem());
return popupMenu;
}
@ -288,6 +292,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Group_Move"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
new GroupMoveDialog(DesignerContext.getDesignerFrame()) {
@ -314,6 +327,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Remove"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),

12
designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java

@ -0,0 +1,12 @@
package com.fr.design.mainframe.share.ui.constants;
import java.awt.Color;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/19
*/
public class ColorConstants {
public static final Color BACKGROUND = new Color(0xF0F0F1);
}

16
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java

@ -5,6 +5,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane;
import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
@ -15,6 +16,7 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@ -43,10 +45,13 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private UILabel suitableThemeNameLabel;
public OnlineWidgetPopupPreviewPane() {
super();
setPreferredSize(new Dimension(POPUP_WIDTH, getPreferredSize().height));
setLayout(new BorderLayout(0, 0));
setOpaque(true);
setBackground(new Color(0xF0F0F1));
setBorder(BorderFactory.createLineBorder(new Color(0xDADADD)));
setBorderPainted(true);
setOpaque(false);
setBackground(ColorConstants.BACKGROUND);
suitableThemeNamePane = createSuitableThemeNamePane();
JPanel previewImagePane = createPreviewImagePane();
@ -57,8 +62,9 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private JPanel createSuitableThemeNamePane() {
suitableThemeNameLabel = new UILabel();
suitableThemeNameLabel.setUI(new BasicLabelUI());
suitableThemeNameLabel.setOpaque(false);
suitableThemeNameLabel.setBackground(new Color(0xF5F5F7));
suitableThemeNameLabel.setBackground(null);
suitableThemeNameLabel.setIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
suitableThemeNameLabel.setIconTextGap(IntervalConstants.INTERVAL_L6);
@ -92,10 +98,12 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
versionLabel = new UILabel();
versionLabel.setVerticalAlignment(SwingConstants.CENTER);
versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F));
versionLabel.setForeground(new Color(0x333334));
downloadsLabel = new UILabel();
downloadsLabel.setVerticalAlignment(SwingConstants.TOP);
downloadsLabel.setFont(FRFont.getInstance(downloadsLabel.getFont()).deriveFont(12.0F));
downloadsLabel.setForeground(new Color(0x333334));
priceLabel = new UILabel();
priceLabel.setVerticalAlignment(SwingConstants.CENTER);
@ -162,7 +170,7 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
String themeName = widget.getThemeName();
if (StringUtils.isNotEmpty(themeName)) {
suitableThemeNamePane.setVisible(true);
suitableThemeNameLabel.setText(themeName);
suitableThemeNameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Suitable_Theme_Prefix") + themeName);
} else {
suitableThemeNamePane.setVisible(false);
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java

@ -151,7 +151,7 @@ public class FilterPane extends JPanel {
Point p = FilterPane.this.getLocationOnScreen();
popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight());
popup.show();
filterPopupPane.setPreferredSize(new Dimension(228, filterPopupPane.getHeight()));
filterPopupPane.setPreferredSize(new Dimension(filterPopupPane.getWidth(), filterPopupPane.getHeight()));
showPopup = true;
arrowButton.setIcon(FILTER_COMBO_UP);
firePopupStateChange(true);

8
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java

@ -31,6 +31,8 @@ public abstract class FilterPopupPane extends JPanel {
private static final Color BORDER_COLOR = Color.decode("#D9DADD");
private static final String FILTER_ALL_ID = "0";
public static final int CONTENT_WIDTH = 225;
FilterPane filterPane;
private List<WidgetFilterInfo> filterList = new ArrayList<>();
private final List<UICheckBox> checkBoxList = new ArrayList<>();
@ -101,7 +103,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type"));
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
titleLabel.setPreferredSize(new Dimension(226, 20));
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH);
@ -131,7 +133,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(filterTypeInfo.getTitle());
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
titleLabel.setPreferredSize(new Dimension(226, 20));
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH);
@ -150,7 +152,7 @@ public abstract class FilterPopupPane extends JPanel {
}
}
int contentPaneHeight = ((displayCount + 1) / 2) * 27;
contentPane.setPreferredSize(new Dimension(228, contentPaneHeight));
contentPane.setPreferredSize(new Dimension(CONTENT_WIDTH, contentPaneHeight));
for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) {
if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) {
continue;

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UITitledMatteBorder;
import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.designer.beans.models.NewFormModel;
@ -187,17 +188,14 @@ public class NewFormPane extends BasicPane {
Toolkit.i18nText("Fine-Design_Real_Style_Template")
});
buttonGroup.setPreferredSize(new Dimension(140, 20));
buttonGroup.setSelectedIndex(1);
buttonGroup.setSelectedIndex(DesignerEnvManager.getEnvManager().getLayoutTemplateStyle());
buttonGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int selectedIndex = buttonGroup.getSelectedIndex();
for (PredefinedLayoutPane layoutCard : layoutCards) {
if (selectedIndex == 1) {
layoutCard.showRealStyle();
} else {
layoutCard.showSimpleStyle();
}
DesignerEnvManager.getEnvManager().setLayoutTemplateStyle(selectedIndex);
layoutCard.showCard();
}
}
});

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java

@ -2,6 +2,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
@ -40,6 +41,7 @@ public class PredefinedLayoutPane extends JPanel {
this.add(simpleStyle, 1);
this.setPreferredSize(new Dimension(235, 134));
this.initListener();
this.showCard();
}
protected void initListener() {
@ -84,6 +86,14 @@ public class PredefinedLayoutPane extends JPanel {
this.clickListener = clickListener;
}
public void showCard() {
if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_SIMPLE_STYLE) {
showSimpleStyle();
} else if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_REAL_STYLE) {
showRealStyle();
}
}
public void showSimpleStyle() {
cardLayout.last(this);
}

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -102,8 +102,10 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
paddingBoundPane.update(elementCaseEditor);
}
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
ReportFitAttr fitAttr = pcFitExpandablePane.update();
elementCaseEditor.setReportFitAttr(fitAttr);
if (DesignerUIModeConfig.getInstance().newUIMode()) {
ReportFitAttr fitAttr = pcFitExpandablePane.update();
elementCaseEditor.setReportFitAttr(fitAttr);
}
return elementCaseEditor;
}
@ -112,6 +114,8 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
paddingBoundPane.populate(ob);
elementCaseToolBarEditor.setValue(ob.getToolBars());
extraPropertyGroupPane.populate(ob);
pcFitExpandablePane.populate(ob.getReportFitAttr());
if (DesignerUIModeConfig.getInstance().newUIMode()) {
pcFitExpandablePane.populate(ob.getReportFitAttr());
}
}
}

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

3
designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -8,6 +8,7 @@ import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane;
@ -54,7 +55,7 @@ public class ServerConfigManagerAction extends UpdateAction {
};
final BasicDialog editReportServerParameterDialog = editReportServerParameterPane.showWindowWithCustomSize(
DesignerContext.getDesignerFrame(), null, DEFAULT
DesignerContext.getDesignerFrame(), null, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.actions.server.dialog")
);
editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() {

16
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -114,11 +114,10 @@ public class CustomStylePane extends MultiTabPane<Style> {
return tabPane.getSelectedIndex() == ONE_INDEX;
}
/**
* @param ePane
*/
public void dealWithBorder(ElementCasePane ePane) {
this.reportPane = ePane;
public void dealWithBorder() {
if (reportPane == null) {
return;
}
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane);
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
@ -130,7 +129,14 @@ public class CustomStylePane extends MultiTabPane<Style> {
(Color) fourObjectArray[THREE_INDEX]);
}
}
}
/**
* @param ePane
*/
public void dealWithBorder(ElementCasePane ePane) {
this.reportPane = ePane;
dealWithBorder();
}
/**

51
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,29 @@ 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);
customStylePane.dealWithBorder();
}
} 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