Browse Source

Merge branch 'release/11.0' of ssh://code.fineres.com:7999/~tommy/design into release/11.0

bugfix/11.0
kuangshuai 3 years ago
parent
commit
cea1eb8afc
  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/theme/preview/ecpreview/ECReportPreviewPane.java
  14. 5
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  15. 5
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  16. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  17. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  18. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  19. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  20. 6
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  21. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  22. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  23. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  24. 43
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
  25. 8
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
  26. 6
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
  27. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  28. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  29. 27
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  30. 34
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  31. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  32. 50
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java
  33. 55
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  34. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  35. 28
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  36. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java
  37. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
  38. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  39. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
  40. 2
      designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  41. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  42. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java
  43. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  44. BIN
      designer-form/src/main/resources/com/fr/design/form/images/loading.gif
  45. BIN
      designer-form/src/main/resources/com/fr/design/form/layouts/images/simple_style_18.png
  46. 3
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  47. 16
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  48. 51
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  49. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  50. 1
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java
  51. 51
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.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 String VERSION100 = "100";
private static final int CACHINGTEMPLATE_LIMIT = 5; private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps"; 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 boolean showTemplateMissingPlugin = true;
private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE;
/** /**
* DesignerEnvManager. * DesignerEnvManager.
*/ */
@ -1691,6 +1695,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.openDebug = openDebug; this.openDebug = openDebug;
} }
public int getLayoutTemplateStyle() {
return layoutTemplateStyle;
}
public void setLayoutTemplateStyle(int layoutTemplateStyle) {
this.layoutTemplateStyle = layoutTemplateStyle;
}
/** /**
* Read XML.<br> * Read XML.<br>
* The method will be invoked when read data from XML file.<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.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true));
this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE));
} }
private void readReportPaneAttributions(XMLableReader reader) { private void readReportPaneAttributions(XMLableReader reader) {
@ -2134,6 +2147,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isShowTemplateMissingPlugin()) { if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
} }
writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
writer.end(); 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) { protected void renameConnection(final String oldName, final String newName) {
tableDataConfig.renameTableData(oldName, newName);
StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(oldName))); 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 { try {
WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans); WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans);
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.class.getSimpleName()); EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace());
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), 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++) { for (int i = 0; i < lineTips.length; i++) {
String lineTip = lineTips[i]; String lineTip = lineTips[i];
List<JLabel> jLabels = new ArrayList<>(); 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)) { if (i == (lineTips.length - 1)) {
JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind")); JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind"));
jLabel.setForeground(Color.lightGray); jLabel.setForeground(Color.blue);
jLabel.addMouseListener(new MouseAdapter() { jLabel.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { 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 { try {
WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans); WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans);
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.class.getSimpleName()); EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace());
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -197,11 +197,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
ConnectionConfig cloned = connectionConfig.mirror(); ConnectionConfig cloned = connectionConfig.mirror();
populate(cloned); populate(cloned);
} }
@Override
protected void renameConnection(String oldName, String newName) {
connectionConfig.renameConnection(oldName, newName);
}
}; };
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null); final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionConfig)); 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 AttributeChangeListener listener;
private String globalName = ""; private String globalName = "";
private boolean autoFireAttributesChanged = true;
public boolean isAutoFireAttributesChanged() {
return this.autoFireAttributesChanged;
}
public void setAutoFireAttributesChanged(boolean autoFireAttributesChanged) {
this.autoFireAttributesChanged = autoFireAttributesChanged;
}
protected AbstractAttrNoScrollPane() { protected AbstractAttrNoScrollPane() {
initAll(); initAll();
} }
@ -127,7 +137,9 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
public void attributeChanged() { public void attributeChanged() {
synchronized (this) { synchronized (this) {
if (listener != null) { 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 isToolBarComponent = false;
private boolean isClick; private boolean isClick;
private boolean autoFireStateChanged = true;
public UIButtonGroup(String[] textArray) { public UIButtonGroup(String[] textArray) {
this(textArray, null); this(textArray, null);
} }
@ -72,7 +74,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) { if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName); globalNameListener.setGlobalName(buttonGroupName);
} }
setSelectedWithFireChanged(index); setSelectedIndex(index, autoFireStateChanged);
} }
}; };
} }
@ -108,7 +110,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) { if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName); globalNameListener.setGlobalName(buttonGroupName);
} }
setSelectedWithFireChanged(index); setSelectedIndex(index, autoFireStateChanged);
} }
}; };
} }
@ -175,7 +177,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) { if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName); globalNameListener.setGlobalName(buttonGroupName);
} }
setSelectedWithFireChanged(index); setSelectedIndex(index, autoFireStateChanged);
} }
}; };
} }
@ -253,6 +255,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
g2d.setClip(oldClip); g2d.setClip(oldClip);
} }
public void setAutoFireStateChanged(boolean autoFireStateChanged) {
this.autoFireStateChanged = autoFireStateChanged;
}
/** /**
* setSelectedItem * setSelectedItem
* *
@ -287,13 +293,14 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return selectedIndex; return selectedIndex;
} }
protected void setSelectedWithFireChanged(int newSelectedIndex) { protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
selectedIndex = newSelectedIndex; if (selectedIndex != newSelectedIndex) {
for (int i = 0; i < labelButtonList.size(); i++) { selectedIndex = newSelectedIndex;
if (i == selectedIndex) { for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelectedWithFireListener(true); labelButtonList.get(i).setSelected(i == selectedIndex, false);
} else { }
labelButtonList.get(i).setSelected(false); if (fireChanged) {
fireStateChanged();
} }
} }
} }
@ -304,10 +311,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param newSelectedIndex * @param newSelectedIndex
*/ */
public void setSelectedIndex(int newSelectedIndex) { public void setSelectedIndex(int newSelectedIndex) {
selectedIndex = newSelectedIndex; setSelectedIndex(newSelectedIndex, true);
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
} }
private void fireStateChanged() { 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 @Override
protected void setSelectedWithFireChanged(int newSelectedIndex) { protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
if (selectedIndex != newSelectedIndex) { super.setSelectedIndex(newSelectedIndex, fireChanged);
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
}
tabChanged(newSelectedIndex); 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) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
fireSelectedChanged(); if (fireChanged) {
fireSelectedChanged();
}
refresh(isSelected); refresh(isSelected);
} }
} }
@ -175,7 +177,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (isEnabled() && !isEventBannded) { 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.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache; 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.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -47,16 +48,20 @@ public class FollowingThemePane extends BasicPane implements UIObserver {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
followingThemeButtonGroup.setSelectedIndex(1); followingThemeButtonGroup.setSelectedIndex(1);
followingThemeButtonGroup.addActionListener(new ActionListener() { followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
for (FollowingThemeActionChangeListener changeListener : changeListeners) { AttributeChangeUtils.changeComposedUI(FollowingThemePane.this, false, new AttributeChangeUtils.UIChangeAction() {
changeListener.onFollowingTheme(isFollowingTheme()); @Override
} public void changeComposedUI() {
invalidate(); for (FollowingThemeActionChangeListener changeListener : changeListeners) {
changeListener.onFollowingTheme(isFollowingTheme());
// 与主题相关的属性面板更新完毕后,再通知外层更新数据 }
invalidate();
}
});
if (uiObserverListener != null) { if (uiObserverListener != null) {
uiObserverListener.doChange(); 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.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 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 CUSTOM = "custom";
private static final String CURRENT_TEMPLATE = "cur"; private static final String CURRENT_TEMPLATE = "cur";
private static final String OTHER_TEMPLATE = "other"; private static final String OTHER_TEMPLATE = "other";
private static final UILabel EMPTY_LABEL = new UILabel();
static { static {
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF")); 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 ParameterSettingButton.class
}); });
this.setDefaultEditor(ExportTemplateChooser.class, new ExportTemplateChooser()); this.setDefaultEditor(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultRenderer(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultEditor(ExportTypeCombobox.class, new ExportTypeCombobox()); this.setDefaultEditor(ExportTypeCombobox.class, new ExportTypeCombobox());
this.setDefaultEditor(FileNameCombobox.class, new FileNameCombobox()); this.setDefaultEditor(FileNameCombobox.class, new FileNameCombobox());
this.setDefaultEditor(FileNameFormulaEditor.class, new FileNameFormulaEditor()); this.setDefaultEditor(FileNameFormulaEditor.class, new FileNameFormulaEditor());
this.setDefaultEditor(ParameterCombobox.class, new ParameterCombobox()); this.setDefaultEditor(ParameterCombobox.class, new ParameterCombobox());
this.setDefaultEditor(ParameterSettingButton.class, new ParameterSettingButton()); this.setDefaultEditor(ParameterSettingButton.class, new ParameterSettingButton());
this.setDefaultRenderer(ParameterSettingButton.class, new ParameterSettingButton());
this.createTable().getColumnModel().getColumn(2).setMaxWidth(60); this.createTable().getColumnModel().getColumn(2).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(4).setMaxWidth(60); this.createTable().getColumnModel().getColumn(4).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(40); this.createTable().getColumnModel().getColumn(5).setMaxWidth(50);
} }
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return new UITableEditAction[] {new AddJSAction(), new DeleteAction()}; return new UITableEditAction[]{new AddJSAction(), new DeleteAction()};
} }
@Override @Override
@ -282,14 +285,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public boolean isCellEditable(int row, int col) { public boolean isCellEditable(int row, int col) {
if(col == 3) { if (col == 3) {
// 命名详情 // 命名详情
return this.getList().get(row) != null && !this.getList().get(row).isDefaultFileName(); 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; 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 static final long serialVersionUID = -9112506131272704717L;
private JPanel reportletNamePane; private JPanel reportletNamePane;
@ -364,7 +363,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){ if (table.getSelectedRow() == -1) {
return; return;
} }
SingleJavaScript js = getList().get(table.getSelectedRow()); SingleJavaScript js = getList().get(table.getSelectedRow());
@ -387,6 +386,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() { public Object getCellEditorValue() {
return reportPathTextField.getText(); 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() { 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} 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() { this.addCellEditorListener(new CellEditorListener() {
@Override @Override
@ -406,7 +411,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){ if (table.getSelectedRow() == -1) {
return; return;
} }
SingleJavaScript js = getList().get(table.getSelectedRow()); SingleJavaScript js = getList().get(table.getSelectedRow());
@ -453,7 +458,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){ if (table.getSelectedRow() == -1) {
return; return;
} }
SingleJavaScript js = getList().get(table.getSelectedRow()); SingleJavaScript js = getList().get(table.getSelectedRow());
@ -496,7 +501,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){ if (table.getSelectedRow() == -1) {
return; return;
} }
SingleJavaScript js = getList().get(table.getSelectedRow()); 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 static final long serialVersionUID = 2630964402770993584L;
private UIComboBox parameterSetting; private UIComboBox parameterSetting;
public ParameterCombobox() { public ParameterCombobox() {
parameterSetting = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, PARAMETER_TYPE_MAP); 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() { this.addCellEditorListener(new CellEditorListener() {
@Override @Override
@ -540,15 +561,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { 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(); 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 static final long serialVersionUID = 4021592871993049137L;
private UIButton paraButton; private UIButton paraButton;
@ -576,8 +589,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public ParameterSettingButton() { public ParameterSettingButton() {
paraSettingPane = new ParameterSettingPane(); paraSettingPane = new ParameterSettingPane();
paraButton = new UIButton(); paraButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_Set"));
paraButton.setBackground(Color.GRAY);
paraButton.addMouseListener(new MouseAdapter() { paraButton.addMouseListener(new MouseAdapter() {
@Override @Override
@ -603,7 +615,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){ if (table.getSelectedRow() == -1) {
return; return;
} }
SingleJavaScript js = getList().get(table.getSelectedRow()); SingleJavaScript js = getList().get(table.getSelectedRow());
@ -616,7 +628,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 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; return paraButton;
} }
@ -624,6 +642,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() { public Object getCellEditorValue() {
return paraSettingPane.getParameterList(); 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); currentTemplatePane.extendParametersCheckBox.setSelected(true);
} else { } else {
currentTemplatePane.extendParametersCheckBox.setSelected(false); currentTemplatePane.extendParametersCheckBox.setSelected(false);
List<ParameterProvider> parameterList = this.parameterViewPane.update(); if (this.parameterViewPane != null) {
parameterList.clear(); List<ParameterProvider> parameterList = this.parameterViewPane.update();
ParameterProvider[] parameters = js.getParameters(); parameterList.clear();
this.parameterViewPane.populate(parameters); ParameterProvider[] parameters = js.getParameters();
this.parameterViewPane.populate(parameters);
}
} }
} else { } else {
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1); OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);

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() { public PreviewPane() {
this.setPreferredSize(new Dimension(517, 270)); 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()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane(); 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.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane; 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++) { for (int i = 0; i < columnSize.length; i++) {
if (i == 0) { if (i == 0) {
columnSize[i] = 80; columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();
} else { } 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.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; 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) { private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr); attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean()); wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified(); jwb.fireTargetModified();
} }
}); }, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog"));
dialog.setVisible(true); 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.label=750*30
com.fr.design.version.detail.dialog=900*500 com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 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.label=650*30
com.fr.design.version.detail.dialog=800*500 com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 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.label=700*30
com.fr.design.version.detail.dialog=850*500 com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 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.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 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.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 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 //记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID(); String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
changeCollectionSelected(getButtonName()); changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true); setSelected(true, true);
fireSelectedChanged(); 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()) { if (isEnabled()) {
noSelected(); noSelected();
changeAxisSelected(getButtonName()); changeAxisSelected(getButtonName());
setSelectedWithFireListener(true); setSelected(true, true);
fireSelectedChanged(); 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) { public FRFitLayoutAdapter(XLayoutContainer container) {
super(container); super(container);
initMinSize(); initMinSize();
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minHeight); this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minWidth, minHeight, actualVal);
painter = this.frLayoutState.getPainter(); painter = this.frLayoutState.getPainter();
} }
@ -151,13 +151,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//如果当前处于边缘地带, 那么就把他贴到父容器上 //如果当前处于边缘地带, 那么就把他贴到父容器上
boolean isMatchEdge = matchEdge(x, y); 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(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble(); boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
@ -167,17 +160,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return false; return false;
} }
if (isCrossPointArea(comp, x, y)) { return this.frLayoutState.accept(creator, 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;
} }
private boolean isExtraContainer(Component comp) { 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; import java.util.ArrayList;
public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
private int minHeight; private static final double TOP_HALF = 0.25;
private FRBodyLayoutAdapter parentLayoutAdapter; 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); super(container);
this.parentLayoutAdapter = parentLayoutAdapter; this.parentLayoutAdapter = parentLayoutAdapter;
this.minWidth = minWidth;
this.minHeight = minHeight; this.minHeight = minHeight;
this.actualVal = actualVal;
} }
@Override @Override
@ -79,7 +86,7 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
public void delete(XCreator creator, int creatorWidth, int creatorHeight) { public void delete(XCreator creator, int creatorWidth, int creatorHeight) {
int x = creator.getX(); int x = creator.getX();
int y = creator.getY(); 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 @Override
public boolean accept(XCreator creator, int x, int y) { 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 @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; 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.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout; import com.fr.design.designer.creator.XOccupiedLayout;
@ -36,8 +35,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
@Override @Override
public void paint(Graphics g, int startX, int startY) { public void paint(Graphics g, int startX, int startY) {
super.paint(g, startX, startY); super.paint(g, startX, startY);
int x = hotspot.x - hotspot_bounds.x; int x = hotspot.x - hotspot_bounds.x ;
int y = hotspot.y - hotspot_bounds.y; int y = hotspot.y - hotspot_bounds.y ;
Component currentComp = container.getComponentAt(x, y); Component currentComp = container.getComponentAt(x, y);
if (currentComp == null) { if (currentComp == null) {
return; return;
@ -50,7 +49,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
} else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) { } else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) {
state = OperateState.COMPONENT_REPLACE; 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 { } else {
Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR; Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
int[] hot_rec = new int[]{x, y, 0, 0}; 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(); Composite backupComposite = g2d.getComposite();
g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR); g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f)); 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.setStroke(XCreatorConstants.DASH_STROKE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); 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.setStroke(backupStroke);
g2d.setComposite(backupComposite); g2d.setComposite(backupComposite);
g2d.setColor(backupColor); 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; isRefreshing = true;
this.remove(oldCreator); this.remove(oldCreator);
this.add(newCreator); this.add(newCreator);
dealDirections(newCreator, false);
//对于新增的绝对布局的组件,需要更新下内部组件的大小 //对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){ if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget(); ((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.JComponent;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color; import java.awt.Color;
@ -114,14 +113,8 @@ public class FormDesignerUI extends ComponentUI {
if (designer.getPainter() != null) { if (designer.getPainter() != null) {
// ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用, // ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用,
// 相当于一个浮动层, 要考虑参数面板的高度 // 相当于一个浮动层, 要考虑参数面板的高度
new SwingWorker<Void, Void>() { designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
@Override designer.getArea().getVerticalValue() + designer.getParaHeight());
protected Void doInBackground() throws Exception {
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight());
return null;
}
}.execute();
} }
AddingModel addingModel = designer.getAddingModel(); AddingModel addingModel = designer.getAddingModel();

27
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -81,6 +81,9 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
* 创建组件事件 * 创建组件事件
*/ */
public class CreateComponentAction extends UpdateAction { public class CreateComponentAction extends UpdateAction {
private static final double MAX_WIDTH = 960.0;
private static final double MAX_HEIGHT = 540.0;
ShareUIAspect aspect; ShareUIAspect aspect;
/** /**
* 等待时间 500 ms. * 等待时间 500 ms.
@ -114,8 +117,12 @@ public class CreateComponentAction extends UpdateAction {
// 获取选中的组件 // 获取选中的组件
Triple<Widget, XCreator, Rectangle> sharedTriple = ComponentTransformerFactory.getInstance().transform(selection); Triple<Widget, XCreator, Rectangle> sharedTriple = ComponentTransformerFactory.getInstance().transform(selection);
if (sharedTriple == null) { if (sharedTriple == null) {
FineJOptionPane.showMessageDialog(designerFrame, Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"), showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"));
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), ERROR_MESSAGE, IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png")); return;
}
if (isBeyondMaxSize(sharedTriple.getRight())) {
showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Widget_Size_Error_Tip"));
return; return;
} }
@ -398,4 +405,20 @@ public class CreateComponentAction extends UpdateAction {
} }
return paras; return paras;
} }
private boolean isBeyondMaxSize(Rectangle rec) {
double width = rec.getWidth();
double height = rec.getHeight();
return width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT);
}
private void showErrMsgDialog(String err) {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
err,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png")
);
}
} }

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

@ -8,11 +8,15 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource; import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; 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.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -22,6 +26,7 @@ import com.fr.workspace.WorkContext;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -35,15 +40,37 @@ import java.util.concurrent.ExecutionException;
*/ */
public class DownloadSuitableThemeAction extends UpdateAction { public class DownloadSuitableThemeAction extends UpdateAction {
private final String themePath; private final String themePath;
private final UIPopupMenu popupMenu;
private boolean downloading = false; private boolean downloading = false;
private JTemplate<?, ?> currentTemplate; private JTemplate<?, ?> currentTemplate;
public DownloadSuitableThemeAction(String themePath) { public DownloadSuitableThemeAction(String themePath, UIPopupMenu popupMenu) {
this.themePath = themePath; this.themePath = themePath;
this.popupMenu = popupMenu;
this.putValue(Action.SMALL_ICON, null); this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme")); this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
} }
@Override
public UIMenuItem createMenuItem() {
return getLoadingMenuItem();
}
public LoadingMenuItem getLoadingMenuItem() {
Object object = this.getValue(LoadingMenuItem.class.getName());
if (object == null) {
UIMenuItem menuItem = new LoadingMenuItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(LoadingMenuItem.class.getName(), object);
}
return (LoadingMenuItem) object;
}
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
@ -78,6 +105,8 @@ public class DownloadSuitableThemeAction extends UpdateAction {
} }
downloading = true; downloading = true;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.startLoading();
new SwingWorker<FormTheme, Void>() { new SwingWorker<FormTheme, Void>() {
@Override @Override
@ -96,11 +125,14 @@ public class DownloadSuitableThemeAction extends UpdateAction {
onThemeFetched(theme); onThemeFetched(theme);
downloading = false; downloading = false;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.stopLoading();
} }
}.execute(); }.execute();
} }
public void onThemeFetched(FormTheme theme) { public void onThemeFetched(FormTheme theme) {
popupMenu.menuSelectionChanged(false);
if (theme == null) { if (theme == null) {
return; return;
} }

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; package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction; 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.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 com.fr.stable.StringUtils;
import javax.swing.Action; import javax.swing.Action;
import java.awt.Color;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail")); 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {

50
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java

@ -0,0 +1,50 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.general.IOUtils;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import java.awt.Graphics;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/19
*/
public class LoadingMenuItem extends UIMenuItem {
private boolean loading = false;
private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/form/images/loading.gif");
public LoadingMenuItem(Action action) {
super(action);
setOpaque(true);
setBackground(ColorConstants.BACKGROUND);
setUI(new SharedComponentActionMenuItemUI(false));
}
public void startLoading() {
loading = true;
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
revalidate();
repaint();
}
public void stopLoading() {
loading = false;
setBorder(BorderFactory.createEmptyBorder());
revalidate();
repaint();
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
if (loading) {
profileIcon.paintIcon(this, g, getWidth() - 20, 0);
}
}
}

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

@ -0,0 +1,55 @@
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.MenuSelectionManager;
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 {
private final boolean autoClosePopup;
public SharedComponentActionMenuItemUI(boolean autoClosePopup) {
this.autoClosePopup = autoClosePopup;
}
public SharedComponentActionMenuItemUI() {
this(true);
}
@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();
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 0);
}
g.setColor(oldColor);
}
@Override
protected void doClick(MenuSelectionManager msm) {
if (autoClosePopup) {
super.doClick(msm);
} else {
menuItem.doClick(0);
}
}
}

7
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; 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.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction; 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.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.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader; import com.fr.design.mainframe.share.ui.online.ResourceLoader;
@ -116,12 +116,13 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public JPopupMenu createRightClickPopupMenu() { public JPopupMenu createRightClickPopupMenu() {
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true); popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER); popupMenu.setOpaque(true);
popupMenu.setBackground(ColorConstants.BACKGROUND);
OnlineShareWidget widget = getWidget(); OnlineShareWidget widget = getWidget();
String suitableThemeFile = widget.getThemePath(); String suitableThemeFile = widget.getThemePath();
if (StringUtils.isNotEmpty(suitableThemeFile)) { if (StringUtils.isNotEmpty(suitableThemeFile)) {
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile).createMenuItem()); popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile, popupMenu).createMenuItem());
} }
popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem()); popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem());

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

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

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(); Point p = FilterPane.this.getLocationOnScreen();
popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight()); popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight());
popup.show(); popup.show();
filterPopupPane.setPreferredSize(new Dimension(228, filterPopupPane.getHeight())); filterPopupPane.setPreferredSize(new Dimension(filterPopupPane.getWidth(), filterPopupPane.getHeight()));
showPopup = true; showPopup = true;
arrowButton.setIcon(FILTER_COMBO_UP); arrowButton.setIcon(FILTER_COMBO_UP);
firePopupStateChange(true); 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 Color BORDER_COLOR = Color.decode("#D9DADD");
private static final String FILTER_ALL_ID = "0"; private static final String FILTER_ALL_ID = "0";
public static final int CONTENT_WIDTH = 225;
FilterPane filterPane; FilterPane filterPane;
private List<WidgetFilterInfo> filterList = new ArrayList<>(); private List<WidgetFilterInfo> filterList = new ArrayList<>();
private final List<UICheckBox> checkBoxList = new ArrayList<>(); private final List<UICheckBox> checkBoxList = new ArrayList<>();
@ -101,7 +103,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE); jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type")); UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type"));
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); 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.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE")); titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH); jPanel.add(titleLabel, BorderLayout.NORTH);
@ -131,7 +133,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE); jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(filterTypeInfo.getTitle()); UILabel titleLabel = new UILabel(filterTypeInfo.getTitle());
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); 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.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE")); titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH); jPanel.add(titleLabel, BorderLayout.NORTH);
@ -150,7 +152,7 @@ public abstract class FilterPopupPane extends JPanel {
} }
} }
int contentPaneHeight = ((displayCount + 1) / 2) * 27; 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()) { for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) {
if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) {
continue; continue;

2
designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -49,6 +49,7 @@ import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.NameWidget; import com.fr.form.ui.NameWidget;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.PageFixedRowComboBox;
import com.fr.form.ui.Password; import com.fr.form.ui.Password;
import com.fr.form.ui.Radio; import com.fr.form.ui.Radio;
import com.fr.form.ui.RadioGroup; import com.fr.form.ui.RadioGroup;
@ -98,6 +99,7 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + ""));
defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine"));
defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + ""));
defineMap.put(PageFixedRowComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + ""));
defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + ""));
defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + ""));

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

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.GraphHelper;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.designer.beans.PredefinedLayout; import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.design.mainframe.share.ui.base.MouseClickListener;
@ -40,6 +41,7 @@ public class PredefinedLayoutPane extends JPanel {
this.add(simpleStyle, 1); this.add(simpleStyle, 1);
this.setPreferredSize(new Dimension(235, 134)); this.setPreferredSize(new Dimension(235, 134));
this.initListener(); this.initListener();
this.showCard();
} }
protected void initListener() { protected void initListener() {
@ -84,6 +86,14 @@ public class PredefinedLayoutPane extends JPanel {
this.clickListener = clickListener; 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() { public void showSimpleStyle() {
cardLayout.last(this); 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); paddingBoundPane.update(elementCaseEditor);
} }
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue()); elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
ReportFitAttr fitAttr = pcFitExpandablePane.update(); if (DesignerUIModeConfig.getInstance().newUIMode()) {
elementCaseEditor.setReportFitAttr(fitAttr); ReportFitAttr fitAttr = pcFitExpandablePane.update();
elementCaseEditor.setReportFitAttr(fitAttr);
}
return elementCaseEditor; return elementCaseEditor;
} }
@ -112,6 +114,8 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
paddingBoundPane.populate(ob); paddingBoundPane.populate(ob);
elementCaseToolBarEditor.setValue(ob.getToolBars()); elementCaseToolBarEditor.setValue(ob.getToolBars());
extraPropertyGroupPane.populate(ob); 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/images/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

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.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane; import com.fr.design.webattr.EditReportServerParameterPane;
@ -54,7 +55,7 @@ public class ServerConfigManagerAction extends UpdateAction {
}; };
final BasicDialog editReportServerParameterDialog = editReportServerParameterPane.showWindowWithCustomSize( 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() { 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; return tabPane.getSelectedIndex() == ONE_INDEX;
} }
/** public void dealWithBorder() {
* @param ePane if (reportPane == null) {
*/ return;
public void dealWithBorder(ElementCasePane ePane) { }
this.reportPane = ePane;
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane);
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
@ -130,7 +129,14 @@ public class CustomStylePane extends MultiTabPane<Style> {
(Color) fourObjectArray[THREE_INDEX]); (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.dialog.BasicPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.AttributeChangeUtils;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -50,6 +51,7 @@ public class StylePane extends BasicPane implements UIObserver {
public StylePane() { public StylePane() {
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomStylePane(); customStylePane = new CustomStylePane();
themedCellStyleListPane = new ThemedCellStyleListPane(); themedCellStyleListPane = new ThemedCellStyleListPane();
panes[0] = createThemedStylePane(); panes[0] = createThemedStylePane();
@ -72,27 +74,13 @@ public class StylePane extends BasicPane implements UIObserver {
followingThemeButtonGroup.addActionListener(new ActionListener() { followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex(); AttributeChangeUtils.changeComposedUI(StylePane.this, false, new AttributeChangeUtils.UIChangeAction() {
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]); @Override
if (selectedIndex == 1) { public void changeComposedUI() {
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致 int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean(); onFollowingThemeSettingChanged(selectedIndex, selectedIndex == 0);
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone();
if (lastSelectedRealStyle != null) {
customStylePane.populateBean(lastSelectedRealStyle);
}
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
} }
} else { });
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
themedCellStyleListPane.reset();
}
fireStateChanged(); fireStateChanged();
} }
}); });
@ -108,6 +96,29 @@ public class StylePane extends BasicPane implements UIObserver {
IntervalConstants.INTERVAL_L1, 0); 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() { protected JPanel createTabbedContentPane() {
JPanel contentPane = new JPanel(cardLayout) { JPanel contentPane = new JPanel(cardLayout) {
@Override @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() { styleList.addListSelectionListener(new ListSelectionListener() {
@Override @Override
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
if (changeListener != null) { if (e.getValueIsAdjusting() && changeListener != null) {
changeListener.stateChanged(new ChangeEvent(styleList)); changeListener.stateChanged(new ChangeEvent(styleList));
} }
} }

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

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

51
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

@ -19,24 +19,22 @@ import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.exception.LackOfValueException; import com.fr.design.mainframe.share.exception.LackOfValueException;
import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter; import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter;
import com.fr.design.mainframe.share.select.ComponentTransformerFactory; import com.fr.design.mainframe.share.select.ComponentTransformerFactory;
import com.fr.design.mod.ContentObjectManager;
import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.mainframe.share.util.ShareUIUtils;
import com.fr.design.mod.ContentObjectManager;
import com.fr.design.share.effect.EffectItemGroup; import com.fr.design.share.effect.EffectItemGroup;
import com.fr.design.share.utils.EffectItemUtils; import com.fr.design.share.utils.EffectItemUtils;
import com.fr.design.share.utils.ShareDialogUtils; import com.fr.design.share.utils.ShareDialogUtils;
import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.Group;
import com.fr.form.share.config.ComponentReuseConfigManager; import com.fr.form.share.config.ComponentReuseConfigManager;
import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.form.share.Group;
import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.share.record.ShareWidgetInfoManager;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -51,7 +49,9 @@ import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -65,8 +65,6 @@ public class ShareGeneratePane extends BasicPane {
private static final Dimension DIALOG_SIZE = new Dimension(670, 760); private static final Dimension DIALOG_SIZE = new Dimension(670, 760);
private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610); private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610);
private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6);
private static final double MAX_WIDTH = 500.0;
private static final double MAX_HEIGHT = 260.0;
private JPanel mainPane = null; private JPanel mainPane = null;
private ShareMainPane uploadPane = null; private ShareMainPane uploadPane = null;
@ -213,7 +211,6 @@ public class ShareGeneratePane extends BasicPane {
dialog.setButtonEnabled(false); dialog.setButtonEnabled(false);
ShareDialogUtils.getInstance().setShareDialog(dialog); ShareDialogUtils.getInstance().setShareDialog(dialog);
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
ShareMainPane mainPane = getSelectMainPane(); ShareMainPane mainPane = getSelectMainPane();
@ -297,29 +294,11 @@ public class ShareGeneratePane extends BasicPane {
} }
private boolean generateModule(DefaultSharableWidget info) throws Exception { private boolean generateModule(DefaultSharableWidget info) throws Exception {
ComponentGenerateInfo generateInfo = new ComponentGenerateInfo(uploadCheckbox.isSelected(), jt, paraMap, shareWidget, info);
DefaultSharableWidget transformInfo = transform(info);
ComponentGenerateInfo generateInfo = new ComponentGenerateInfo(uploadCheckbox.isSelected(), jt, paraMap, shareWidget, transformInfo);
ComponentGeneratorCenter center = new ComponentGeneratorCenter(generateInfo); ComponentGeneratorCenter center = new ComponentGeneratorCenter(generateInfo);
return center.generate(); return center.generate();
} }
private DefaultSharableWidget transform(DefaultSharableWidget info) {
confineSize(info);
//先屏蔽
//if (shareWidget instanceof AbstractBorderStyleWidget) {
// AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) shareWidget;
// ExtendSharableAttrMark attrMark = styleWidget.getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
// if (attrMark != null) {
// String shareId = attrMark.getShareId();
// info.setId(shareId);
// }
//}
return info;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Share_Module_Msg"); return Toolkit.i18nText("Fine-Design_Share_Module_Msg");
@ -328,20 +307,4 @@ public class ShareGeneratePane extends BasicPane {
private Dimension getDialogSize() { private Dimension getDialogSize() {
return effectItemGroups.size() > 0 ? DIALOG_SIZE : DIALOG_NORMAL_SIZE; return effectItemGroups.size() > 0 ? DIALOG_SIZE : DIALOG_NORMAL_SIZE;
} }
private void confineSize(DefaultSharableWidget info) {
double width = info.getWidth();
double height = info.getHeight();
if (width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT)) {
double aspectRatio = width / height;
if (width / height > MAX_WIDTH / MAX_HEIGHT) {
info.setWidth((int) MAX_WIDTH);
info.setHeight((int) (MAX_WIDTH / aspectRatio));
} else {
info.setHeight((int) MAX_HEIGHT);
info.setWidth((int) (MAX_HEIGHT * aspectRatio));
}
}
}
} }

Loading…
Cancel
Save