Browse Source

REPORT-35149 预定义样式优化及与图表统一

research/11.0
kerry 4 years ago
parent
commit
7ac6ce2a25
  1. 6
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  3. 6
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/predefined/PatternStyle.java
  6. 4
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java
  7. 14
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java
  8. 11
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java
  9. 68
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleSettingPane.java
  10. 21
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/PredefinedBackgroundSettingPane.java
  11. 51
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/AbstractBackgroundDetailPane.java
  12. 134
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundSettingPane.java
  13. 99
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundType.java
  14. 16
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundWithAlphaSettingPane.java
  15. 29
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java
  16. 19
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/EmptyBackgroundPane.java
  17. 48
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/FormBackgroundSettingPane.java
  18. 34
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/GradientDetailPane.java
  19. 34
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java
  20. 72
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/PatternDetailPane.java
  21. 49
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/TextureDetailObservePane.java
  22. 10
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java
  23. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentMarginStylePane.java
  24. 16
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java
  25. 20
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/PredefinedStyleEditDialog.java
  26. 8
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ReportPredefinedStyleDialog.java
  27. 7
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ServerPredefinedStyleDialog.java
  28. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java
  29. 19
      designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java
  30. 1
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  31. 22
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java

6
designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java

@ -28,7 +28,7 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -42,4 +42,8 @@ public class BackgroundNoImagePane extends BackgroundPane{
gradientPane gradientPane
}; };
} }
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
} }

6
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -89,7 +89,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
kinds.add(new TextureBackgroundQuickPane()); kinds.add(new TextureBackgroundQuickPane());
kinds.add(new PatternBackgroundQuickPane()); kinds.add(new PatternBackgroundQuickPane());
kinds.add(new ImageBackgroundQuickPane()); kinds.add(new ImageBackgroundQuickPane());
kinds.add(new GradientBackgroundQuickPane()); kinds.add(createGradientBackgroundQuickPane());
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING); Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING);
for (BackgroundQuickUIProvider provider : providers) { for (BackgroundQuickUIProvider provider : providers) {
kinds.add(provider.appearanceForBackground()); kinds.add(provider.appearanceForBackground());
@ -98,6 +98,10 @@ public class BackgroundPane extends AbstractBasicStylePane {
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
/** /**
* 事件监听 * 事件监听

6
designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
@ -68,4 +68,8 @@ public class BackgroundSpecialPane extends BackgroundPane{
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
} }

1
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -809,6 +809,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
try { try {
this.getTarget().resetPreferenceStyle(this.getTemplatePredefinedStyle());
this.getTarget().export(editingFILE.asOutputStream()); this.getTarget().export(editingFILE.asOutputStream());
} 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/mainframe/predefined/PatternStyle.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.predefined; package com.fr.design.mainframe.predefined;
import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyle;
import com.fr.predefined.PredefinedPatternStyleManager;
/** /**
@ -10,19 +11,20 @@ public enum PatternStyle {
DARK_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Dark_Pattern")) { DARK_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Dark_Pattern")) {
@Override @Override
public PredefinedStyle getPredefinedStyle() { public PredefinedStyle getPredefinedStyle() {
return new PredefinedStyle(); return PredefinedPatternStyleManager.getInstance().getDarkMode();
} }
}, },
LIGHT_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Light_Pattern")) { LIGHT_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Light_Pattern")) {
@Override @Override
public PredefinedStyle getPredefinedStyle() { public PredefinedStyle getPredefinedStyle() {
return new PredefinedStyle(); return PredefinedPatternStyleManager.getInstance().getLightMode();
} }
}; };
private String name; private String name;
PatternStyle(String name) { PatternStyle(String name) {
this.name = name; this.name = name;
} }

4
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java

@ -88,7 +88,7 @@ public class PredefinedStyleBlock extends JPanel {
if (isSelected || this.mouseOver) { if (isSelected || this.mouseOver) {
g.setColor(BORDER_COLOR); g.setColor(BORDER_COLOR);
Rectangle rectangle = new Rectangle(1, 1, this.getWidth() - 2, this.getHeight() - 2); Rectangle rectangle = new Rectangle(1, 1, this.getWidth() - 2, this.getHeight() - 2);
GraphHelper.draw(g, rectangle, Constants.LINE_LARGE); GraphHelper.draw(g, rectangle, Constants.LINE_MEDIUM);
} }
} }
@ -102,7 +102,7 @@ public class PredefinedStyleBlock extends JPanel {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(0,0,2,2)); panel.setBorder(BorderFactory.createEmptyBorder(0,9,2,5));
panel.add(label, BorderLayout.WEST); panel.add(label, BorderLayout.WEST);
if (supportEdit) { if (supportEdit) {
addEditButton(panel); addEditButton(panel);

14
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

@ -14,6 +14,7 @@ import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingP
import com.fr.design.mainframe.predefined.ui.detail.CellStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.CellStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -22,7 +23,6 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Label;
/** /**
* Created by kerry on 2020-08-26 * Created by kerry on 2020-08-26
@ -104,7 +104,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private JPanel createStyleNamePane() { private JPanel createStyleNamePane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 26, 8); JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 26, 8);
jPanel.add(new Label(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Name"))); jPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Name")));
this.styleNameField = new UITextField(); this.styleNameField = new UITextField();
this.styleNameField.setPreferredSize(new Dimension(160, 20)); this.styleNameField.setPreferredSize(new Dimension(160, 20));
jPanel.add(this.styleNameField); jPanel.add(this.styleNameField);
@ -138,6 +138,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
} }
}); });
titlePane.add(uiTabbedPane); titlePane.add(uiTabbedPane);
uiTabbedPane.setPreferredSize(new Dimension(323, 298));
titlePane.setPreferredSize(new Dimension(333, 320)); titlePane.setPreferredSize(new Dimension(333, 320));
return jPanel; return jPanel;
} }
@ -147,7 +148,9 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
this.backgroundSettingPane = new PredefinedBackgroundSettingPane(); this.backgroundSettingPane = new PredefinedBackgroundSettingPane();
this.backgroundSettingPane.setPreferredSize(new Dimension(313, 265)); jPanel.setPreferredSize(new Dimension(309, 248));
UIScrollPane scrollPane = new UIScrollPane(this.backgroundSettingPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
jPanel.add(new UIScrollPane(this.backgroundSettingPane)); jPanel.add(new UIScrollPane(this.backgroundSettingPane));
return jPanel; return jPanel;
} }
@ -182,7 +185,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
isPopulating = true; isPopulating = true;
styleNameField.setText(previewObject.getStyleName()); styleNameField.setText(previewObject.getStyleName());
this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground()); this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground());
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleMap()); this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig());
this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle()); this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle());
previewPane.refresh(previewObject); previewPane.refresh(previewObject);
isPopulating = false; isPopulating = false;
@ -191,7 +194,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
public PredefinedStyle update() { public PredefinedStyle update() {
PredefinedStyle predefinedStyle = new PredefinedStyle(); PredefinedStyle predefinedStyle = new PredefinedStyle();
predefinedStyle.setStyleName(this.styleNameField.getText()); predefinedStyle.setStyleName(this.styleNameField.getText());
predefinedStyle.setCellStyleMap(this.cellStyleSettingPane.updateBean()); predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean());
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean()); predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean());
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean()); predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean());
return predefinedStyle; return predefinedStyle;
@ -205,6 +208,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
saveStyle(previewObject); saveStyle(previewObject);
DesignUtils.refreshDesignerFrame();
} }
public void saveStyle(PredefinedStyle previewObject) { public void saveStyle(PredefinedStyle previewObject) {

11
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java

@ -19,6 +19,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.predefined.ui.dialog.PredefinedStyleEditDialog; import com.fr.design.mainframe.predefined.ui.dialog.PredefinedStyleEditDialog;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -56,7 +58,8 @@ public class ServerPredefinedStylePane extends BasicPane {
JPanel subPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel subPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
subPanel.add(createControlPane(), BorderLayout.NORTH); subPanel.add(createControlPane(), BorderLayout.NORTH);
PredefinedStyle style = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getDefaultPredefinedStyle(); PredefinedStyle style = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getDefaultPredefinedStyle();
this.selectPane = new PredefinedStyleSelectPane(style.getStyleName(), true);
this.selectPane = new PredefinedStyleSelectPane(style == null ? StringUtils.EMPTY : style.getStyleName(), true);
this.selectPane.registerChangeListener(new ChangeListener() { this.selectPane.registerChangeListener(new ChangeListener() {
@Override @Override
public void fireChanged(ChangeEvent event) { public void fireChanged(ChangeEvent event) {
@ -136,6 +139,7 @@ public class ServerPredefinedStylePane extends BasicPane {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.setDefaultPredefinedStyle(style.getStyleName()); config.setDefaultPredefinedStyle(style.getStyleName());
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
} }
} }
@ -158,8 +162,8 @@ public class ServerPredefinedStylePane extends BasicPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PredefinedStyle previewObject = ServerPredefinedStylePane.this.selectPane.update(); PredefinedStyle previewObject = ServerPredefinedStylePane.this.selectPane.update();
int selVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this), int selVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this),
Toolkit.i18nText("Fine-Design_Predefined_Remove_Style_Confirm:" + previewObject.getStyleName()) + " ?", Toolkit.i18nText("Fine-Design_Predefined_Remove_Style_Confirm", previewObject.getStyleName()),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) { if (selVal == JOptionPane.YES_OPTION) {
removeStyle(previewObject.getStyleName()); removeStyle(previewObject.getStyleName());
ServerPredefinedStylePane.this.selectPane.refreshPane(); ServerPredefinedStylePane.this.selectPane.refreshPane();
@ -196,6 +200,7 @@ public class ServerPredefinedStylePane extends BasicPane {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.removeStyle(name); config.removeStyle(name);
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
} }
} }

68
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleSettingPane.java

@ -2,7 +2,8 @@ package com.fr.design.mainframe.predefined.ui.detail;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.config.StyleMap; import com.fr.config.predefined.PredefinedCellStyle;
import com.fr.config.predefined.PredefinedCellStyleConfig;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
@ -25,6 +26,7 @@ import com.fr.report.core.PaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -46,12 +48,11 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by kerry on 2020-09-01 * Created by kerry on 2020-09-01
*/ */
public class CellStyleSettingPane extends BasicBeanPane<StyleMap> { public class CellStyleSettingPane extends BasicBeanPane<PredefinedCellStyleConfig> {
private StyleListPane styleListPane; private StyleListPane styleListPane;
private List<CustomPredefinedStylePane> customStylePaneList = new ArrayList<>(); private List<CustomPredefinedStylePane> customStylePaneList = new ArrayList<>();
@ -59,6 +60,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
private JPanel centerPane; private JPanel centerPane;
private PredefinedStyleEditPane editPane; private PredefinedStyleEditPane editPane;
private CellStylePreviewPane previewPane; private CellStylePreviewPane previewPane;
private UIButton removeBtn;
public CellStyleSettingPane(PredefinedStyleEditPane editPane) { public CellStyleSettingPane(PredefinedStyleEditPane editPane) {
this.editPane = editPane; this.editPane = editPane;
@ -86,7 +88,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
}); });
addBtn.setBorderPainted(false); addBtn.setBorderPainted(false);
panel.add(addBtn); panel.add(addBtn);
UIButton removeBtn = new UIButton(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); removeBtn = new UIButton(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH));
removeBtn.setBorderPainted(false); removeBtn.setBorderPainted(false);
removeBtn.addActionListener(new ActionListener() { removeBtn.addActionListener(new ActionListener() {
@Override @Override
@ -133,12 +135,12 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
@Override @Override
public void populateBean(StyleMap ob) { public void populateBean(PredefinedCellStyleConfig ob) {
styleListPane.populate(ob); styleListPane.populate(ob);
} }
@Override @Override
public StyleMap updateBean() { public PredefinedCellStyleConfig updateBean() {
return styleListPane.update(); return styleListPane.update();
} }
@ -153,9 +155,9 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
public StyleListPane() { public StyleListPane() {
defaultListModel = new DefaultListModel(); defaultListModel = new DefaultListModel();
styleList = new JNameEdList(defaultListModel){ styleList = new JNameEdList(defaultListModel) {
public Rectangle createRect(Rectangle rect, int iconWidth) { public Rectangle createRect(Rectangle rect, int iconWidth) {
return new Rectangle(rect.x , rect.y, rect.width, rect.height); return new Rectangle(rect.x, rect.y, rect.width, rect.height);
} }
}; };
@ -171,7 +173,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index);
return; return;
} }
if (isNameRepeated(new List[] {Arrays.asList(allNames)}, newName)) { if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index);
styleList.setNameAt("请重新命名", index); styleList.setNameAt("请重新命名", index);
return; return;
@ -187,8 +189,17 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
int selectIndex = styleList.getSelectedIndex(); int selectIndex = styleList.getSelectedIndex();
cardLayout.show(centerPane,styleList.getNameAt(selectIndex)); Object nameable = styleList.getType(selectIndex);
if (nameable == null) {
return;
}
PredefinedCellStyle cellStyle = ((PredefinedCellStyle) nameable);
cardLayout.show(centerPane, styleList.getNameAt(selectIndex));
styleList.stopEditing(); styleList.stopEditing();
removeBtn.setEnabled(!cellStyle.isBuiltIn());
if (!validateCouldRename(cellStyle)) {
return;
}
if (e.getClickCount() >= 2 if (e.getClickCount() >= 2
&& SwingUtilities.isLeftMouseButton(e)) { && SwingUtilities.isLeftMouseButton(e)) {
styleList.editItemAt(styleList.getSelectedIndex()); styleList.editItemAt(styleList.getSelectedIndex());
@ -197,6 +208,10 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
}); });
} }
private boolean validateCouldRename(PredefinedCellStyle cellStyle) {
return !cellStyle.isBuiltIn();
}
private void showTipDialogAndReset(String content, int index) { private void showTipDialogAndReset(String content, int index) {
styleList.stopEditing(); styleList.stopEditing();
@ -217,11 +232,11 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
} }
public void populate(StyleMap ob) { public void populate(PredefinedCellStyleConfig ob) {
Iterator<Map.Entry<String, Style>> iterator = ob.getAllStyles().entrySet().iterator(); Iterator<PredefinedCellStyle> iterator = ob.getAllStyles().values().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<String, Style> entry = iterator.next(); PredefinedCellStyle entry = iterator.next();
addStyle(entry.getKey(), entry.getValue()); addStyle(entry);
} }
reset(); reset();
@ -230,37 +245,38 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
private void reset() { private void reset() {
if (defaultListModel.getSize() > 0) { if (defaultListModel.getSize() > 0) {
styleList.setSelectedIndex(0); styleList.setSelectedIndex(0);
removeBtn.setEnabled(false);
cardLayout.show(centerPane, styleList.getNameAt(0)); cardLayout.show(centerPane, styleList.getNameAt(0));
centerPane.validate(); centerPane.validate();
} }
} }
public StyleMap update() { public PredefinedCellStyleConfig update() {
StyleMap styleMap = new StyleMap(); PredefinedCellStyleConfig config = new PredefinedCellStyleConfig();
for (int i = 0; i < defaultListModel.getSize(); i++) { for (int i = 0; i < defaultListModel.getSize(); i++) {
String name = styleList.getNameAt(i); String name = styleList.getNameAt(i);
Style style = customStylePaneList.get(i).updateBean(); Style style = customStylePaneList.get(i).updateBean();
styleMap.put(name, style); config.addStyle(new PredefinedCellStyle(name, style));
} }
return styleMap; return config;
} }
public void addNewStyle() { public void addNewStyle() {
String newStyleName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"); String newStyleName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style");
if (isNameRepeated(new List[] {Arrays.asList(styleList.getAllNames())}, if (isNameRepeated(new List[]{Arrays.asList(styleList.getAllNames())},
newStyleName)){ newStyleName)) {
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newStyleName), 0); showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newStyleName), 0);
return; return;
} }
addStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), Style.getInstance()); PredefinedCellStyle cellStyle = new PredefinedCellStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), Style.getInstance());
addStyle(cellStyle);
} }
public void addStyle(String name, Style style) { public void addStyle(PredefinedCellStyle cellStyle) {
ListModelElement el = new ListCellStyleModelElement(new NameObject(name, style)); ListModelElement el = new ListCellStyleModelElement(new NameObject(cellStyle.getName(), cellStyle));
defaultListModel.addElement(el); defaultListModel.addElement(el);
CustomPredefinedStylePane customPredefinedStylePane = new CustomPredefinedStylePane(); CustomPredefinedStylePane customPredefinedStylePane = new CustomPredefinedStylePane();
customPredefinedStylePane.populateBean(style); customPredefinedStylePane.populateBean(cellStyle.getStyle());
customPredefinedStylePane.addChangeListener(new ChangeListener() { customPredefinedStylePane.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -268,7 +284,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
editPane.valueChangeAction(); editPane.valueChangeAction();
} }
}); });
centerPane.add(customPredefinedStylePane, name); centerPane.add(customPredefinedStylePane, cellStyle.getName());
customStylePaneList.add(customPredefinedStylePane); customStylePaneList.add(customPredefinedStylePane);
} }

21
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/PredefinedBackgroundSettingPane.java

@ -3,16 +3,13 @@ package com.fr.design.mainframe.predefined.ui.detail;
import com.fr.config.predefined.PredefinedBackground; import com.fr.config.predefined.PredefinedBackground;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundSettingPane; import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundWithAlphaSettingPane; import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundWithAlphaSettingPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -32,22 +29,20 @@ public class PredefinedBackgroundSettingPane extends BasicBeanPane<PredefinedBac
private void initPane() { private void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
reportBackgroundSettingPane = new BackgroundSettingPane(); reportBackgroundSettingPane = new BackgroundSettingPane();
UIScrollPane scrollPane = new UIScrollPane(reportBackgroundSettingPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
formBackgroundSettingPane = new BackgroundWithAlphaSettingPane(); formBackgroundSettingPane = new BackgroundWithAlphaSettingPane();
CardLayout tabbedPane = new CardLayout(); CardLayout tabbedPane = new CardLayout();
JPanel center = new JPanel(tabbedPane); JPanel center = new JPanel(tabbedPane);
center.add(scrollPane, "普通报表"); center.add(reportBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"));
center.add(formBackgroundSettingPane, "决策报表"); center.add(formBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report"));
center.setPreferredSize(new Dimension(243, 243)); this.buttonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"),
this.buttonGroup = new UIButtonGroup(new String[]{"普通报表", "决策报表"}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report")});
buttonGroup.addActionListener(new ActionListener() { buttonGroup.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (buttonGroup.getSelectedIndex() == 0) { if (buttonGroup.getSelectedIndex() == 0) {
tabbedPane.show(center, "普通报表"); tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"));
} else { } else {
tabbedPane.show(center, "决策报表"); tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report"));
} }
} }
}); });
@ -79,10 +74,8 @@ public class PredefinedBackgroundSettingPane extends BasicBeanPane<PredefinedBac
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "预定义背景设置"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Background_Setting");
} }
} }

51
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/AbstractBackgroundDetailPane.java

@ -0,0 +1,51 @@
package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.general.Background;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2020-09-14
*/
public abstract class AbstractBackgroundDetailPane<T extends Background> extends BackgroundQuickPane {
@Override
public boolean accept(Background background) {
return false;
}
@Override
public void populateBean(Background background) {
this.populate((T) background);
}
@Override
public Background updateBean() {
return this.update();
}
@Override
public String title4PopupWindow() {
return null;
}
@Override
public void reset() {
}
@Override
public void registerChangeListener(UIObserverListener listener) {
}
public abstract void populate(T background);
public abstract T update();
public void addChangeListener(ChangeListener changeListener) {
}
}

134
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundSettingPane.java

@ -1,18 +1,17 @@
package com.fr.design.mainframe.predefined.ui.detail.background; package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.UIObserverListener;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.BackgroundDetailPane; import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
@ -21,7 +20,6 @@ import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* Created by kerry on 2020-09-02 * Created by kerry on 2020-09-02
@ -29,7 +27,7 @@ import java.util.List;
public class BackgroundSettingPane extends BasicBeanPane<Background> { public class BackgroundSettingPane extends BasicBeanPane<Background> {
private ChangeListener changeListener = null; private ChangeListener changeListener = null;
private UIComboBox headCombobox; private UIComboBox headCombobox;
private List<BackgroundDetailPane> paneList = new ArrayList<>(); private BackgroundQuickPane[] paneList;
public BackgroundSettingPane() { public BackgroundSettingPane() {
init(); init();
@ -38,18 +36,27 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
private void init() { private void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(createComboHeadPane(), BorderLayout.NORTH); this.add(createComboHeadPane(), BorderLayout.NORTH);
CardLayout tabbedPane = new CardLayout(); CardLayout cardlayout = new CardLayout();
JPanel center = createCenterPane(tabbedPane); paneList = supportKindsOfBackgroundUI();
center.setPreferredSize(BackgroundType.EMPTY_BACKGROUND.getDisplayDimension()); final JPanel centerPane = new JPanel(cardlayout) {
@Override
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
int index = headCombobox.getSelectedIndex();
return new Dimension(super.getPreferredSize().width, paneList[index].getPreferredSize().height);
}
};
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
for (BackgroundQuickPane pane : paneList) {
headCombobox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
headCombobox.addItemListener(new ItemListener() { headCombobox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
BackgroundType type = BackgroundType.parse(e.getItem().toString()); cardlayout.show(centerPane, (String) headCombobox.getSelectedItem());
center.setPreferredSize(type.getDisplayDimension());
tabbedPane.show(center, type.getDisplayName());
} }
}); });
this.add(center, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -58,102 +65,62 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
private JPanel createComboHeadPane() { private JPanel createComboHeadPane() {
headCombobox = new UIComboBox(BackgroundType.allTypes()); headCombobox = new UIComboBox();
headCombobox.setPreferredSize(new Dimension(160, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel("填充"), headCombobox}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
return jPanel;
}
private JPanel createCenterPane(CardLayout tabbedPane) {
JPanel centerPane = new JPanel(tabbedPane);
centerPane.add(createEmptyPane(), BackgroundType.EMPTY_BACKGROUND.getDisplayName());
centerPane.add(createColorSelectPane(), BackgroundType.COLOR_BACKGROUND.getDisplayName());
centerPane.add(createTextureSelectPane(), BackgroundType.TEXTURE_BACKGROUND.getDisplayName());
centerPane.add(createPatternSelectPane(), BackgroundType.PATTERN_BACKGROUND.getDisplayName());
centerPane.add(createImageSelectPane(), BackgroundType.IMAGE_BACKGROUND.getDisplayName());
centerPane.add(createGradientSelectPane(), BackgroundType.GRADIENT_BACKGROUND.getDisplayName());
return centerPane;
}
private JPanel createEmptyPane() {
EmptyBackgroundPane emptyBackgroundPane = new EmptyBackgroundPane();
paneList.add(emptyBackgroundPane);
return emptyBackgroundPane;
}
private JPanel createColorSelectPane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
ColorDetailPane colorDetailPane = new ColorDetailPane();
paneList.add(colorDetailPane);
jPanel.add(colorDetailPane, BorderLayout.CENTER);
return jPanel;
}
private JPanel createTextureSelectPane() {
TextureDetailObservePane textureDetailPane = new TextureDetailObservePane();
textureDetailPane.setPreferredSize(new Dimension(160, 108));
UILabel label = new UILabel("纹理");
label.setPreferredSize(new Dimension(24, 108));
label.setVerticalAlignment(SwingConstants.TOP);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{label, textureDetailPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5); new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")), headCombobox}},
TableLayoutHelper.FILL_NONE, 33, 5);
headCombobox.setPreferredSize(new Dimension(160, 20));
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
paneList.add(textureDetailPane);
return jPanel; return jPanel;
} }
private JPanel createPatternSelectPane() { protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0); java.util.List<BackgroundQuickPane> kinds = new ArrayList<>();
PatternDetailPane patternDetailPane = PatternDetailPane.createPatternDetailPane(6); kinds.add(new EmptyBackgroundPane());
jPanel.add(patternDetailPane, BorderLayout.CENTER); kinds.add(new ColorDetailPane());
paneList.add(patternDetailPane); kinds.add(new TextureDetailObservePane());
return jPanel; kinds.add(new PatternDetailPane());
kinds.add(createImageSelectPane());
kinds.add(new GradientDetailPane());
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
private JPanel createImageSelectPane() { protected ImageDetailPane createImageSelectPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0);
ImageDetailPane imageDetailPane = new ImageDetailPane(); ImageDetailPane imageDetailPane = new ImageDetailPane();
imageDetailPane.addChangeListener(new ChangeListener() { imageDetailPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void doChange() {
if (changeListener != null) { fireChangeListener();
changeListener.stateChanged(e);
}
} }
}); });
jPanel.add(imageDetailPane); return imageDetailPane;
paneList.add(imageDetailPane);
return jPanel;
} }
private JPanel createGradientSelectPane() { protected void fireChangeListener() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0); if (changeListener != null) {
GradientDetailPane gradientDetailPane = new GradientDetailPane(); changeListener.stateChanged(null);
jPanel.add(gradientDetailPane); }
paneList.add(gradientDetailPane);
return jPanel;
} }
@Override @Override
public void populateBean(Background background) { public void populateBean(Background background) {
String displayType = BackgroundType.parse(background).getDisplayName(); for (int i = 0; i < paneList.length; i++) {
this.headCombobox.setSelectedItem(displayType); BackgroundQuickPane pane = paneList[i];
int index = this.headCombobox.getSelectedIndex(); if (pane.accept(background)) {
paneList.get(index).populate(background); pane.populateBean(background);
headCombobox.setSelectedIndex(i);
return;
}
}
} }
@Override @Override
public Background updateBean() { public Background updateBean() {
int selectIndex = this.headCombobox.getSelectedIndex(); int selectIndex = this.headCombobox.getSelectedIndex();
try { try {
return paneList.get(selectIndex).update(); return paneList[selectIndex].updateBean();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -164,4 +131,5 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return null;
} }
} }

99
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundType.java

@ -1,99 +0,0 @@
package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.awt.Dimension;
/**
* Created by kerry on 2020-08-31
*/
public enum BackgroundType {
EMPTY_BACKGROUND("NullBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Background_Is_Null")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(0, 0);
}
},
COLOR_BACKGROUND("ColorBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Color")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(242, 187);
}
},
TEXTURE_BACKGROUND("TextureBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(242, 155);
}
},
PATTERN_BACKGROUND("PatternBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(242, 266);
}
},
IMAGE_BACKGROUND("ImageBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(242, 160);
}
},
GRADIENT_BACKGROUND("GradientBackground", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Color")) {
@Override
public Dimension getDisplayDimension() {
return new Dimension(242, 155);
}
};
private String backgroundType;
private String displayName;
BackgroundType(String backgroundType, String displayName) {
this.backgroundType = backgroundType;
this.displayName = displayName;
}
public String getDisplayName() {
return displayName;
}
public abstract Dimension getDisplayDimension();
public static String[] allTypes() {
BackgroundType[] backgroundTypes = values();
String[] backgrounds = new String[backgroundTypes.length];
for (int i = 0; i < backgroundTypes.length; i++) {
backgrounds[i] = backgroundTypes[i].getDisplayName();
}
return backgrounds;
}
public static BackgroundType parse(Background background) {
if (background == null) {
return EMPTY_BACKGROUND;
}
for (BackgroundType type : values()) {
if (ComparatorUtils.equals(background.getBackgroundType(), type.backgroundType)) {
return type;
}
}
return EMPTY_BACKGROUND;
}
public static BackgroundType parse(String displayName) {
if (StringUtils.isEmpty(displayName)) {
return EMPTY_BACKGROUND;
}
for (BackgroundType type : values()) {
if (ComparatorUtils.equals(displayName, type.displayName)) {
return type;
}
}
return EMPTY_BACKGROUND;
}
}

16
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundWithAlphaSettingPane.java

@ -4,11 +4,9 @@ import com.fr.config.predefined.BackgroundWithAlpha;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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 javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -29,7 +27,7 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
public BackgroundWithAlphaSettingPane() { public BackgroundWithAlphaSettingPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundSettingPane = new BackgroundSettingPane(); backgroundSettingPane = new FormBackgroundSettingPane();
JPanel eastpane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 0); JPanel eastpane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 0);
this.numberDragPane = new UINumberDragPane(0, 100); this.numberDragPane = new UINumberDragPane(0, 100);
@ -37,7 +35,8 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
eastpane.add(numberDragPane); eastpane.add(numberDragPane);
eastpane.add(new UILabel("%")); eastpane.add(new UILabel("%"));
JPanel transparencyPane = TableLayoutHelper.createGapTableLayoutPane( JPanel transparencyPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel("不透明度"), eastpane}}, TableLayoutHelper.FILL_LASTCOLUMN,18, 5); new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha")),
eastpane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 5);
transparencyPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); transparencyPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
@ -45,10 +44,8 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
new Component[]{backgroundSettingPane}, new Component[]{backgroundSettingPane},
new Component[]{transparencyPane}}; new Component[]{transparencyPane}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
UIScrollPane scrollPane = new UIScrollPane(panel); this.add(panel, BorderLayout.CENTER);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
this.add(scrollPane, BorderLayout.CENTER);
} }
@ -67,7 +64,7 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
public BackgroundWithAlpha updateBean() { public BackgroundWithAlpha updateBean() {
BackgroundWithAlpha backgroundWithAlpha = new BackgroundWithAlpha(); BackgroundWithAlpha backgroundWithAlpha = new BackgroundWithAlpha();
backgroundWithAlpha.setBackground(backgroundSettingPane.updateBean()); backgroundWithAlpha.setBackground(backgroundSettingPane.updateBean());
backgroundWithAlpha.setAlpha((float)(numberDragPane.updateBean()/maxNumber)); backgroundWithAlpha.setAlpha((float) (numberDragPane.updateBean() / maxNumber));
return backgroundWithAlpha; return backgroundWithAlpha;
} }
@ -75,4 +72,5 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return null;
} }
} }

29
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java

@ -7,7 +7,6 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.style.background.BackgroundDetailPane;
import com.fr.design.style.color.ColorSelectPane; import com.fr.design.style.color.ColorSelectPane;
import com.fr.general.Background; import com.fr.general.Background;
@ -22,7 +21,7 @@ import java.awt.Dimension;
/** /**
* Created by kerry on 2020-08-31 * Created by kerry on 2020-08-31
*/ */
public class ColorDetailPane extends BackgroundDetailPane { public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackground> {
private ColorBackgroundSelectPane selectPane; private ColorBackgroundSelectPane selectPane;
@ -33,22 +32,23 @@ public class ColorDetailPane extends BackgroundDetailPane {
} }
@Override @Override
public void populate(Background background) { public void populate(ColorBackground background) {
if (background instanceof ColorBackground) { this.selectPane.setColor(background.getColor());
this.selectPane.setColor(((ColorBackground) background).getColor());
}
} }
@Override @Override
public Background update() { public ColorBackground update() {
return ColorBackground.getInstance(selectPane.getColor()); return ColorBackground.getInstance(selectPane.getColor());
} }
@Override public String title4PopupWindow() {
public void addChangeListener(ChangeListener changeListener) { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color");
} }
@Override
public boolean accept(Background background) {
return background instanceof ColorBackground;
}
class ColorBackgroundSelectPane extends ColorSelectPane implements UIObserver { class ColorBackgroundSelectPane extends ColorSelectPane implements UIObserver {
protected UIObserverListener uiObserverListener; protected UIObserverListener uiObserverListener;
@ -75,8 +75,9 @@ public class ColorDetailPane extends BackgroundDetailPane {
UIButton transpanrentBtn = createTranspanrentButton(); UIButton transpanrentBtn = createTranspanrentButton();
transpanrentBtn.setPreferredSize(new Dimension(160, 20)); transpanrentBtn.setPreferredSize(new Dimension(160, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel("颜色"), transpanrentBtn}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5); new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Color")),
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); transpanrentBtn}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
return jPanel; return jPanel;
} }
@ -84,8 +85,8 @@ public class ColorDetailPane extends BackgroundDetailPane {
JPanel centerPane = super.createCenterPane(); JPanel centerPane = super.createCenterPane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5); new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
return jPanel; return jPanel;
} }

19
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/EmptyBackgroundPane.java

@ -1,14 +1,11 @@
package com.fr.design.mainframe.predefined.ui.detail.background; package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.event.ChangeListener;
/** /**
* Created by kerry on 2020-09-01 * Created by kerry on 2020-09-01
*/ */
public class EmptyBackgroundPane extends BackgroundDetailPane { public class EmptyBackgroundPane extends AbstractBackgroundDetailPane {
@Override @Override
public void populate(Background background) { public void populate(Background background) {
@ -20,8 +17,18 @@ public class EmptyBackgroundPane extends BackgroundDetailPane {
return null; return null;
} }
@Override /**
public void addChangeListener(ChangeListener changeListener) { * 名称
*
* @return 名称
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Null");
}
public boolean accept(Background background) {
return background == null;
} }
} }

48
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/FormBackgroundSettingPane.java

@ -0,0 +1,48 @@
package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.event.UIObserverListener;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by kerry on 2020-09-14
*/
public class FormBackgroundSettingPane extends BackgroundSettingPane {
public FormBackgroundSettingPane() {
super();
}
@Override
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorDetailPane colorDetailPane = new ColorDetailPane();
ImageDetailPane imageDetailPane = createImageSelectPane();
GradientDetailPane gradientPane = new GradientDetailPane();
//hugh:表单支持背景接口
List<BackgroundQuickPane> kinds = new ArrayList<BackgroundQuickPane>();
kinds.add(new EmptyBackgroundPane());
kinds.add(colorDetailPane);
kinds.add(imageDetailPane);
kinds.add(gradientPane);
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING);
for (BackgroundQuickUIProvider provider : providers) {
BackgroundQuickPane newTypePane = provider.appearanceForBackground();
newTypePane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
fireChangeListener();
}
});
kinds.add(newTypePane);
}
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
}

34
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/GradientDetailPane.java

@ -8,9 +8,9 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.style.background.BackgroundDetailPane;
import com.fr.design.style.background.gradient.GradientBar; import com.fr.design.style.background.gradient.GradientBar;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -26,7 +26,7 @@ import java.awt.event.ActionListener;
* *
* @author ben * @author ben
*/ */
public class GradientDetailPane extends BackgroundDetailPane implements UIObserver { public class GradientDetailPane extends AbstractBackgroundDetailPane<GradientBackground> implements UIObserver {
private static final long serialVersionUID = -6854603990673031897L; private static final long serialVersionUID = -6854603990673031897L;
private UIObserverListener listener; private UIObserverListener listener;
private UIRadioButton left2right, top2bottom; private UIRadioButton left2right, top2bottom;
@ -35,9 +35,10 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
public GradientDetailPane() { public GradientDetailPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel blankJp = new JPanel(); JPanel blankJp = new JPanel();
gradientBar = new GradientBar(4, 141); gradientBar = new GradientBar(4, 150);
blankJp.add(gradientBar); blankJp.add(gradientBar);
gradientPanel.add(gradientBar, BorderLayout.SOUTH); gradientPanel.add(gradientBar, BorderLayout.SOUTH);
@ -59,10 +60,11 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
toggle.add(top2bottom); toggle.add(top2bottom);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel("渐变色设置"), gradientPanel}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Setting")), gradientPanel},
new Component[]{new UILabel("渐变方向"), jp} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Color")), jp}
}; };
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN,
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -71,15 +73,19 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
} }
} }
}); });
this.add(contentPane); this.add(contentPane);
} }
@Override
public void populate(Background background) { public boolean accept(Background background) {
if (!(background instanceof GradientBackground)) { return background instanceof GradientBackground;
return;
} }
GradientBackground bg = (GradientBackground) background;
public void populate(GradientBackground bg) {
this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor()); this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor());
this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor()); this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor());
if (bg.getDirection() == GradientBackground.LEFT2RIGHT) { if (bg.getDirection() == GradientBackground.LEFT2RIGHT) {
@ -144,4 +150,10 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Color");
}
} }

34
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java

@ -10,7 +10,6 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.style.background.BackgroundDetailPane;
import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane; import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.general.Background; import com.fr.general.Background;
@ -31,7 +30,7 @@ import java.awt.event.ActionListener;
/** /**
* Image background pane. * Image background pane.
*/ */
public class ImageDetailPane extends BackgroundDetailPane { public class ImageDetailPane extends AbstractBackgroundDetailPane<ImageBackground> {
protected ImagePreviewPane previewPane = null; protected ImagePreviewPane previewPane = null;
private Style imageStyle = null; private Style imageStyle = null;
@ -85,10 +84,11 @@ public class ImageDetailPane extends BackgroundDetailPane {
defaultRadioButton.setSelected(true); defaultRadioButton.setSelected(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel("图片"), selectPictureButton}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image")), selectPictureButton},
new Component[]{new UILabel("填充方式"), jp} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Fill_Mode")), jp}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE,
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
selectFilePane.add(centerPane, BorderLayout.CENTER); selectFilePane.add(centerPane, BorderLayout.CENTER);
return selectFilePane; return selectFilePane;
} }
@ -102,6 +102,12 @@ public class ImageDetailPane extends BackgroundDetailPane {
}; };
} }
@Override
public boolean accept(Background background) {
return background instanceof ImageBackground;
}
/** /**
* Select picture. * Select picture.
*/ */
@ -141,11 +147,7 @@ public class ImageDetailPane extends BackgroundDetailPane {
}; };
@Override @Override
public void populate(Background background) { public void populate(ImageBackground imageBackground) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) { if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true); defaultRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
@ -160,15 +162,11 @@ public class ImageDetailPane extends BackgroundDetailPane {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
} }
} else {
tiledRadioButton.setSelected(true);
}
fireChagneListener(); fireChagneListener();
} }
@Override @Override
public Background update() { public ImageBackground update() {
ImageBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix()); ImageBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix());
setImageStyle(); setImageStyle();
imageBackground.setLayout(imageStyle.getImageLayout()); imageBackground.setLayout(imageStyle.getImageLayout());
@ -187,4 +185,10 @@ public class ImageDetailPane extends BackgroundDetailPane {
} }
} }
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image");
}
} }

72
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/PatternDetailPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.predefined.ui.detail.background; package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.base.background.PatternBackground;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
@ -10,6 +11,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.impl.PatternBackgroundPane; import com.fr.design.style.background.impl.PatternBackgroundPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -25,16 +28,56 @@ import java.awt.LayoutManager;
/** /**
* Created by kerry on 2020-08-31 * Created by kerry on 2020-08-31
*/ */
public class PatternDetailPane extends PatternBackgroundPane implements UIObserver { public class PatternDetailPane extends AbstractBackgroundDetailPane<PatternBackground> implements UIObserver {
private UIObserverListener listener; private UIObserverListener listener;
private PatternNewBackgroundPane patternNewBackgroundPane;
private PatternDetailPane(int nColumn) { public PatternDetailPane() {
super(nColumn); this.setLayout(FRGUIPaneFactory.createBorderLayout());
patternNewBackgroundPane = new PatternNewBackgroundPane(6);
this.add(patternNewBackgroundPane, BorderLayout.CENTER);
}
@Override
public void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
} }
public static PatternDetailPane createPatternDetailPane(int nColumn) { @Override
return new PatternDetailPane(nColumn); public void populate(PatternBackground background) {
this.patternNewBackgroundPane.populate(background);
}
@Override
public PatternBackground update() {
try {
return (PatternBackground) this.patternNewBackgroundPane.update();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern");
}
@Override
public boolean accept(Background background) {
return background instanceof PatternBackground;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
class PatternNewBackgroundPane extends PatternBackgroundPane {
private PatternNewBackgroundPane(int nColumn) {
super(nColumn);
} }
protected LayoutManager layoutOfTypePane(int nColumn) { protected LayoutManager layoutOfTypePane(int nColumn) {
@ -52,14 +95,15 @@ public class PatternDetailPane extends PatternBackgroundPane implements UIObserv
backgroundColorPane = new ColorSelectBox(80); backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray); foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black); backgroundColorPane.setSelectObject(Color.black);
UILabel label = new UILabel("图案"); UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern"));
label.setVerticalAlignment(SwingConstants.TOP); label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{label, jPanel}, new Component[]{label, jPanel},
new Component[]{new UILabel("前景颜色"), foregroundColorPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_ForeBackground_Color")), foregroundColorPane},
new Component[]{new UILabel("背景颜色"), backgroundColorPane} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern_Color")), backgroundColorPane}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN,
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
JPanel jPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel jPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
jPanel1.add(centerPane); jPanel1.add(centerPane);
BasicScrollPane basicScrollPane = new AttrScrollPane() { BasicScrollPane basicScrollPane = new AttrScrollPane() {
@ -79,15 +123,5 @@ public class PatternDetailPane extends PatternBackgroundPane implements UIObserv
} }
}); });
} }
@Override
public void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
} }
} }

49
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/TextureDetailObservePane.java

@ -1,26 +1,46 @@
package com.fr.design.mainframe.predefined.ui.detail.background; package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.base.background.TextureBackground;
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.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.texture.TextureDetailPane; import com.fr.design.style.background.texture.TextureDetailPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by kerry on 2020-09-02 * Created by kerry on 2020-09-02
*/ */
public class TextureDetailObservePane extends BackgroundDetailPane implements UIObserver { public class TextureDetailObservePane extends AbstractBackgroundDetailPane<TextureBackground> implements UIObserver {
private TextureDetailPane detailPane; private TextureDetailPane detailPane;
private UIObserverListener listener; private UIObserverListener listener;
public TextureDetailObservePane() { public TextureDetailObservePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailPane = TextureDetailPane.createMiniTextureDetailPane(6); detailPane = TextureDetailPane.createMiniTextureDetailPane(6);
detailPane.setPreferredSize(new Dimension(160, 108));
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture"));
label.setPreferredSize(new Dimension(24, 108));
label.setVerticalAlignment(SwingConstants.TOP);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{label, detailPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
detailPane.addChangeListener(new ChangeListener() { detailPane.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -29,7 +49,7 @@ public class TextureDetailObservePane extends BackgroundDetailPane implements UI
} }
} }
}); });
this.add(detailPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER);
} }
@Override @Override
@ -44,15 +64,32 @@ public class TextureDetailObservePane extends BackgroundDetailPane implements UI
} }
@Override @Override
public void populate(Background background) { public void populate(TextureBackground background) {
this.detailPane.populate(background); this.detailPane.populate(background);
} }
@Override @Override
public Background update() throws Exception { public TextureBackground update() {
return this.detailPane.update(); try {
return (TextureBackground) this.detailPane.update();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture");
} }
@Override
public boolean accept(Background background) {
return background instanceof TextureBackground;
}
@Override @Override
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {

10
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java

@ -16,6 +16,7 @@ import com.fr.design.gui.style.BackgroundSpecialPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.general.act.BorderPacker; import com.fr.general.act.BorderPacker;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -70,7 +71,12 @@ public class ComponentFrameStylePane extends ComponentStylePane {
currentLineColorPane.setPreferredSize(new Dimension(20, 20)); currentLineColorPane.setPreferredSize(new Dimension(20, 20));
JPanel buttonPane = new JPanel(new BorderLayout()); JPanel buttonPane = new JPanel(new BorderLayout());
buttonPane.add(currentLineColorPane, BorderLayout.WEST); buttonPane.add(currentLineColorPane, BorderLayout.WEST);
backgroundPane = new BackgroundSpecialPane(); backgroundPane = new BackgroundSpecialPane(){
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane(119);
}
};
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.numberDragPane = new UINumberDragPane(0, 100); this.numberDragPane = new UINumberDragPane(0, 100);
transparencyPane.add(numberDragPane, BorderLayout.CENTER); transparencyPane.add(numberDragPane, BorderLayout.CENTER);
@ -119,7 +125,7 @@ public class ComponentFrameStylePane extends ComponentStylePane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "框架"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame");
} }

2
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentMarginStylePane.java

@ -72,7 +72,7 @@ public class ComponentMarginStylePane extends ComponentStylePane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "边距"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Margin");
} }
@Override @Override

16
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java

@ -18,6 +18,7 @@ import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
@ -89,17 +90,23 @@ public class ComponentTitleStylePane extends ComponentStylePane {
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
JPanel hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JPanel hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
hPaneContainer.add(hAlignmentPane); hPaneContainer.add(hAlignmentPane);
titleBackgroundPane = new BackgroundNoImagePane(); titleBackgroundPane = new BackgroundNoImagePane(){
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane(119);
}
};
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, 157}; double[] columnSize = {p, 157};
JComponent[][] jComponents = new JComponent[][]{ JComponent[][] jComponents = new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("字符")), fontSizeTypePane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Char"))), fontSizeTypePane},
{new UILabel(""), initFontButtonPane()}, {new UILabel(""), initFontButtonPane()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Alignment-Style")), hAlignmentPane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Alignment-Style")), hAlignmentPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Background")), titleBackgroundPane}}; {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Background")), titleBackgroundPane}};
@ -170,7 +177,7 @@ public class ComponentTitleStylePane extends ComponentStylePane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "标题"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Title");
} }
@Override @Override
@ -182,7 +189,6 @@ public class ComponentTitleStylePane extends ComponentStylePane {
populateFormula(widgetTitle); populateFormula(widgetTitle);
populateFont(widgetTitle); populateFont(widgetTitle);
hAlignmentPane.setSelectedItem(widgetTitle.getPosition()); hAlignmentPane.setSelectedItem(widgetTitle.getPosition());
titleBackgroundPane.populateBean(widgetTitle.getBackground()); titleBackgroundPane.populateBean(widgetTitle.getBackground());

20
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/PredefinedStyleEditDialog.java

@ -10,6 +10,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -37,12 +38,12 @@ public class PredefinedStyleEditDialog extends JDialog {
public PredefinedStyleEditDialog(Window parent, PredefinedStyleEditPane contentPane, boolean isBuiltIn) { public PredefinedStyleEditDialog(Window parent, PredefinedStyleEditPane contentPane, boolean isBuiltIn) {
super(parent, ModalityType.APPLICATION_MODAL); super(parent, ModalityType.APPLICATION_MODAL);
this.setTitle("服务器预定义样式"); this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Edit"));
this.setResizable(false); this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.setContentPane(defaultPane); this.setContentPane(defaultPane);
UIButton saveBtn = new UIButton("保存"); UIButton saveBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save"));
saveBtn.setEnabled(!isBuiltIn); saveBtn.setEnabled(!isBuiltIn);
saveBtn.addActionListener(new ActionListener() { saveBtn.addActionListener(new ActionListener() {
@Override @Override
@ -51,7 +52,7 @@ public class PredefinedStyleEditDialog extends JDialog {
dialogExit(); dialogExit();
} }
}); });
UIButton saveAsBtn = new UIButton("另存为新样式"); UIButton saveAsBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Save_As_New"));
saveAsBtn.addActionListener(new ActionListener() { saveAsBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -60,7 +61,7 @@ public class PredefinedStyleEditDialog extends JDialog {
} }
}); });
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("取消")); UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelBtn.addActionListener(new ActionListener() { cancelBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -97,9 +98,9 @@ public class PredefinedStyleEditDialog extends JDialog {
public SaveAsNewStyleDialog(Window parent, PredefinedStyleEditPane editPane) { public SaveAsNewStyleDialog(Window parent, PredefinedStyleEditPane editPane) {
super(parent, ModalityType.APPLICATION_MODAL); super(parent, ModalityType.APPLICATION_MODAL);
this.setTitle("服务器预定义样式"); this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Save_As_New"));
this.setResizable(false); this.setResizable(false);
UIButton confirm = new UIButton("确认"); UIButton confirm = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirm.setEnabled(false); confirm.setEnabled(false);
confirm.addActionListener(new ActionListener() { confirm.addActionListener(new ActionListener() {
@Override @Override
@ -110,11 +111,11 @@ public class PredefinedStyleEditDialog extends JDialog {
dialogExit(); dialogExit();
PredefinedStyleEditDialog.this.dialogExit(); PredefinedStyleEditDialog.this.dialogExit();
} else { } else {
tipLabel.setText("该名称已存在"); tipLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Name_Repeat"));
} }
} }
}); });
UIButton cancle = new UIButton("取消"); UIButton cancle = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancle.addActionListener(new ActionListener() { cancle.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -148,7 +149,7 @@ public class PredefinedStyleEditDialog extends JDialog {
private JPanel createSaveAsPane(UIButton confirm) { private JPanel createSaveAsPane(UIButton confirm) {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel centerPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5); JPanel centerPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5);
centerPane.add(new UILabel("样式名称")); centerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Name")));
textField = new UITextField(); textField = new UITextField();
textField.getDocument().addDocumentListener(new DocumentListener() { textField.getDocument().addDocumentListener(new DocumentListener() {
@Override @Override
@ -170,6 +171,7 @@ public class PredefinedStyleEditDialog extends JDialog {
centerPane.add(textField); centerPane.add(textField);
panel.add(centerPane, BorderLayout.CENTER); panel.add(centerPane, BorderLayout.CENTER);
tipLabel = new UILabel(); tipLabel = new UILabel();
tipLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0));
tipLabel.setForeground(Color.RED); tipLabel.setForeground(Color.RED);
panel.add(tipLabel, BorderLayout.SOUTH); panel.add(tipLabel, BorderLayout.SOUTH);
return panel; return panel;

8
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ReportPredefinedStyleDialog.java

@ -25,11 +25,11 @@ public class ReportPredefinedStyleDialog extends JDialog {
public ReportPredefinedStyleDialog(Window parent, ReportPredefinedStylePane contentPane) { public ReportPredefinedStyleDialog(Window parent, ReportPredefinedStylePane contentPane) {
super(parent, ModalityType.APPLICATION_MODAL); super(parent, ModalityType.APPLICATION_MODAL);
this.setTitle("模板预定义样式"); this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Style"));
this.setResizable(false); this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.setContentPane(defaultPane); this.setContentPane(defaultPane);
UIButton managerBtn = new UIButton("样式管理"); UIButton managerBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Manager"));
managerBtn.addActionListener(new ActionListener() { managerBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -46,7 +46,7 @@ public class ReportPredefinedStyleDialog extends JDialog {
}); });
UIButton settingBtn = new UIButton("应用样式"); UIButton settingBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Applicate_Style"));
settingBtn.addActionListener(new ActionListener() { settingBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -55,7 +55,7 @@ public class ReportPredefinedStyleDialog extends JDialog {
} }
}); });
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("取消")); UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelBtn.addActionListener(new ActionListener() { cancelBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

7
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ServerPredefinedStyleDialog.java

@ -23,13 +23,12 @@ public class ServerPredefinedStyleDialog extends JDialog {
public ServerPredefinedStyleDialog(Window parent, ServerPredefinedStylePane contentPane) { public ServerPredefinedStyleDialog(Window parent, ServerPredefinedStylePane contentPane) {
super(parent, ModalityType.APPLICATION_MODAL); super(parent, ModalityType.APPLICATION_MODAL);
; this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Server_Style"));
this.setTitle("服务器预定义样式");
this.setResizable(false); this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.setContentPane(defaultPane); this.setContentPane(defaultPane);
UIButton settingBtn = new UIButton("设为默认样式"); UIButton settingBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Set_Default"));
settingBtn.addActionListener(new ActionListener() { settingBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -38,7 +37,7 @@ public class ServerPredefinedStyleDialog extends JDialog {
} }
}); });
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("取消")); UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelBtn.addActionListener(new ActionListener() { cancelBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

2
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java

@ -134,7 +134,7 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
} }
private void drawTabBack(Graphics2D g2d, int startY) { private void drawTabBack(Graphics2D g2d, int startY) {
String paintText = "各城市目标达成情况"; String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text");
GraphHelper.drawString(g2d, paintText, GAP, 32); GraphHelper.drawString(g2d, paintText, GAP, 32);
} }

19
designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java

@ -3,7 +3,6 @@ package com.fr.design.gui.xpane;
import com.fr.config.predefined.PredefinedComponentStyle; import com.fr.config.predefined.PredefinedComponentStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane;
@ -16,8 +15,6 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.NameLayoutBorderStyle; import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.NamePaddingMargin; import com.fr.form.ui.NamePaddingMargin;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
@ -93,15 +90,15 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
private void initPane() { private void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane("框架"); JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane("框架");
frameStylePane = new ComponentFrameStylePane(); frameStylePane = new ComponentFrameStylePane();
frame.add(createEmptyBorderScrollPane(frameStylePane, new Dimension(233, 183))); frameStylePane.setPreferredSize(new Dimension(233, 183));
frame.add(frameStylePane);
JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane("标题"); JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane("标题");
titleStylePane = ComponentTitleStylePane.createStyleSettingPane(); titleStylePane = ComponentTitleStylePane.createStyleSettingPane();
title.add(createEmptyBorderScrollPane(titleStylePane, new Dimension(233, 140))); titleStylePane.setPreferredSize(new Dimension(233, 140));
title.add(titleStylePane);
JPanel margin = FRGUIPaneFactory.createTitledBorderNoGapPane("边距"); JPanel margin = FRGUIPaneFactory.createTitledBorderNoGapPane("边距");
@ -114,14 +111,6 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
this.add(margin, BorderLayout.SOUTH); this.add(margin, BorderLayout.SOUTH);
} }
private UIScrollPane createEmptyBorderScrollPane(JPanel panel, Dimension dimension) {
UIScrollPane scrollPane = new UIScrollPane(panel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setPreferredSize(dimension);
return scrollPane;
}
@Override @Override
public void populateBean(ComponentStyle ob) { public void populateBean(ComponentStyle ob) {
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); PredefinedComponentStyle componentStyle = new PredefinedComponentStyle();

1
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -935,6 +935,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 不存在center块, 说明是新建的模板 // 不存在center块, 说明是新建的模板
if (centerWidget == null) { if (centerWidget == null) {
XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body")); XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body"));
layoutContainer.initWidgetPredefinedInfo();
layoutContainer.setSize(LARGE_PREFERRED_SIZE); layoutContainer.setSize(LARGE_PREFERRED_SIZE);
setRootComponent(layoutContainer); setRootComponent(layoutContainer);
formLayoutContainer.add(rootComponent, WBorderLayout.CENTER); formLayoutContainer.add(rootComponent, WBorderLayout.CENTER);

22
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java

@ -3,11 +3,13 @@ package com.fr.design.mainframe.cell.settingpane.style;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.config.predefined.PredefinedCellStyle;
import com.fr.config.predefined.PredefinedCellStyleConfig;
import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.config.StyleMap;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane; import com.fr.design.dialog.MultiTabPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
@ -19,6 +21,7 @@ import com.fr.design.gui.style.BackgroundPane;
import com.fr.design.gui.style.BorderPane; import com.fr.design.gui.style.BorderPane;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane;
@ -31,6 +34,7 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.util.ArrayList; import java.util.ArrayList;
@ -61,12 +65,14 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
} }
protected JPanel createPredefinedSettingPane() { protected JPanel createPredefinedSettingPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 44, 10);
jPanel.add(new UILabel("应用格式"));
applicationFormat = new UIComboBox(); applicationFormat = new UIComboBox();
applicationFormat.setPreferredSize(new Dimension(80, 30)); applicationFormat.setPreferredSize(new Dimension(140, 20));
jPanel.add(applicationFormat); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
return jPanel; {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Applicate_Format")), applicationFormat}
}, TableLayoutHelper.FILL_NONE, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
return centerPane;
} }
@ -81,8 +87,8 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
super.populate(ob); super.populate(ob);
PredefinedStyle predefinedStyle = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getStyle(template.getTemplatePredefinedStyle()); PredefinedStyle predefinedStyle = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getStyle(template.getTemplatePredefinedStyle());
StyleMap map = predefinedStyle.getCellStyleMap(); PredefinedCellStyleConfig config = predefinedStyle.getCellStyleConfig();
Map<String, Style> allStyle = map.getAllStyles(); Map<String, PredefinedCellStyle> allStyle = config.getAllStyles();
this.applicationFormat.clearBoxItems(); this.applicationFormat.clearBoxItems();
for (String name : allStyle.keySet()) { for (String name : allStyle.keySet()) {
this.applicationFormat.addItem(name); this.applicationFormat.addItem(name);

Loading…
Cancel
Save