Browse Source

Pull request #2327: REPORT-35149 预定义样式优化及与图表统一

Merge in DESIGN/design from ~KERRY/design_10.0:feature/10.0 to feature/10.0

* commit '916deab7f97e4efa64901731055f5accd0469273':
  代码修改
  REPORT-35149 预定义样式优化及与图表统一
research/11.0
kerry 4 years ago
parent
commit
d34e0c8a08
  1. 8
      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. 14
      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. 50
      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. 77
      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. 54
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java
  20. 126
      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. 25
      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

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

@ -28,7 +28,7 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged();
}
});
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
@ -42,4 +42,8 @@ public class BackgroundNoImagePane extends BackgroundPane{
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 PatternBackgroundQuickPane());
kinds.add(new ImageBackgroundQuickPane());
kinds.add(new GradientBackgroundQuickPane());
kinds.add(createGradientBackgroundQuickPane());
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING);
for (BackgroundQuickUIProvider provider : providers) {
kinds.add(provider.appearanceForBackground());
@ -98,6 +98,10 @@ public class BackgroundPane extends AbstractBasicStylePane {
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
/**
* 事件监听

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

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged();
}
});
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
@ -48,12 +48,12 @@ public class BackgroundSpecialPane extends BackgroundPane{
});
//hugh:表单支持背景接口
List<BackgroundQuickPane> kinds = new ArrayList<BackgroundQuickPane>();
kinds.add(new NullBackgroundQuickPane());
kinds.add(colorBackgroundPane);
kinds.add(imageBackgroundPane);
kinds.add(gradientPane);
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING);
for (BackgroundQuickUIProvider provider : providers) {
BackgroundQuickPane newTypePane = provider.appearanceForBackground();
@ -65,7 +65,11 @@ public class BackgroundSpecialPane extends BackgroundPane{
});
kinds.add(newTypePane);
}
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;
}
try {
this.getTarget().resetPreferenceStyle(this.getTemplatePredefinedStyle());
this.getTarget().export(editingFILE.asOutputStream());
} catch (Exception 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;
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")) {
@Override
public PredefinedStyle getPredefinedStyle() {
return new PredefinedStyle();
return PredefinedPatternStyleManager.getInstance().getDarkMode();
}
},
LIGHT_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Light_Pattern")) {
@Override
public PredefinedStyle getPredefinedStyle() {
return new PredefinedStyle();
return PredefinedPatternStyleManager.getInstance().getLightMode();
}
};
private String name;
PatternStyle(String 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) {
g.setColor(BORDER_COLOR);
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();
panel.setBorder(BorderFactory.createEmptyBorder(0,0,2,2));
panel.setBorder(BorderFactory.createEmptyBorder(0,9,2,5));
panel.add(label, BorderLayout.WEST);
if (supportEdit) {
addEditButton(panel);

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe.predefined.ui;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.predefined.PredefinedStyleConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane;
@ -14,15 +15,17 @@ 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.ComponentStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Label;
/**
* Created by kerry on 2020-08-26
@ -104,7 +107,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private JPanel createStyleNamePane() {
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.setPreferredSize(new Dimension(160, 20));
jPanel.add(this.styleNameField);
@ -138,6 +141,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
}
});
titlePane.add(uiTabbedPane);
uiTabbedPane.setPreferredSize(new Dimension(323, 298));
titlePane.setPreferredSize(new Dimension(333, 320));
return jPanel;
}
@ -147,7 +151,9 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
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));
return jPanel;
}
@ -182,7 +188,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
isPopulating = true;
styleNameField.setText(previewObject.getStyleName());
this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground());
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleMap());
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig());
this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle());
previewPane.refresh(previewObject);
isPopulating = false;
@ -191,27 +197,41 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
public PredefinedStyle update() {
PredefinedStyle predefinedStyle = new PredefinedStyle();
predefinedStyle.setStyleName(this.styleNameField.getText());
predefinedStyle.setCellStyleMap(this.cellStyleSettingPane.updateBean());
predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean());
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean());
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean());
return predefinedStyle;
}
public void saveStyle() {
public boolean saveStyle() {
PredefinedStyle previewObject = null;
try {
previewObject = update();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
saveStyle(previewObject);
if (this.styleNameField.isEnabled() && !validateRepeat(previewObject.getStyleName())) {
return false;
}
if (!saveStyle(previewObject)) {
return false;
}
DesignUtils.refreshDesignerFrame();
return true;
}
public void saveStyle(PredefinedStyle previewObject) {
public boolean saveStyle(PredefinedStyle previewObject) {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
if (StringUtils.isEmpty(previewObject.getStyleName())) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(PredefinedStyleEditPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Name_Cannot_Empty"));
return false;
}
config.put(previewObject.getStyleName(), previewObject);
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
selectPane.refreshPane();
return true;
}
public void saveAsNewStyle(String styleName) {
@ -222,8 +242,20 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
previewObject.setStyleName(styleName);
saveStyle(previewObject);
if (validateRepeat(styleName)){
saveStyle(previewObject);
}
}
private boolean validateRepeat(String styleName){
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
if (config.getStyle(styleName) != null) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(PredefinedStyleEditPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Name_Repeat"));
return false;
}
return true;
}
}

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.menu.MenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
@ -56,7 +58,8 @@ public class ServerPredefinedStylePane extends BasicPane {
JPanel subPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
subPanel.add(createControlPane(), BorderLayout.NORTH);
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() {
@Override
public void fireChanged(ChangeEvent event) {
@ -136,6 +139,7 @@ public class ServerPredefinedStylePane extends BasicPane {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.setDefaultPredefinedStyle(style.getStyleName());
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
}
}
@ -158,8 +162,8 @@ public class ServerPredefinedStylePane extends BasicPane {
public void actionPerformed(ActionEvent e) {
PredefinedStyle previewObject = ServerPredefinedStylePane.this.selectPane.update();
int selVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this),
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_Predefined_Remove_Style_Confirm", previewObject.getStyleName()),
Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) {
removeStyle(previewObject.getStyleName());
ServerPredefinedStylePane.this.selectPane.refreshPane();
@ -196,6 +200,7 @@ public class ServerPredefinedStylePane extends BasicPane {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.removeStyle(name);
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
}
}

77
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.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.dialog.AttrScrollPane;
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.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@ -46,12 +48,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by kerry on 2020-09-01
*/
public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
public class CellStyleSettingPane extends BasicBeanPane<PredefinedCellStyleConfig> {
private StyleListPane styleListPane;
private List<CustomPredefinedStylePane> customStylePaneList = new ArrayList<>();
@ -59,6 +60,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
private JPanel centerPane;
private PredefinedStyleEditPane editPane;
private CellStylePreviewPane previewPane;
private UIButton removeBtn;
public CellStyleSettingPane(PredefinedStyleEditPane editPane) {
this.editPane = editPane;
@ -86,7 +88,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
});
addBtn.setBorderPainted(false);
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.addActionListener(new ActionListener() {
@Override
@ -133,12 +135,12 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
@Override
public void populateBean(StyleMap ob) {
public void populateBean(PredefinedCellStyleConfig ob) {
styleListPane.populate(ob);
}
@Override
public StyleMap updateBean() {
public PredefinedCellStyleConfig updateBean() {
return styleListPane.update();
}
@ -153,9 +155,9 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
public StyleListPane() {
defaultListModel = new DefaultListModel();
styleList = new JNameEdList(defaultListModel){
styleList = new JNameEdList(defaultListModel) {
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);
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);
styleList.setNameAt("请重新命名", index);
return;
@ -187,8 +189,17 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
@Override
public void mouseClicked(MouseEvent e) {
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();
removeBtn.setEnabled(!cellStyle.isBuiltIn());
if (!validateCouldRename(cellStyle)) {
return;
}
if (e.getClickCount() >= 2
&& SwingUtilities.isLeftMouseButton(e)) {
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) {
styleList.stopEditing();
@ -217,50 +232,58 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
}
public void populate(StyleMap ob) {
Iterator<Map.Entry<String, Style>> iterator = ob.getAllStyles().entrySet().iterator();
public void populate(PredefinedCellStyleConfig ob) {
Iterator<PredefinedCellStyle> iterator = ob.getAllStyles().values().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Style> entry = iterator.next();
addStyle(entry.getKey(), entry.getValue());
PredefinedCellStyle entry = iterator.next();
addStyle(entry);
}
reset();
}
private void reset() {
if (defaultListModel.getSize() > 0) {
styleList.setSelectedIndex(0);
removeBtn.setEnabled(false);
cardLayout.show(centerPane, styleList.getNameAt(0));
centerPane.validate();
Object nameable = styleList.getType(0);
if (nameable == null) {
return;
}
PredefinedCellStyle cellStyle = ((PredefinedCellStyle) nameable);
previewPane.refresh(cellStyle.getStyle());
}
}
public StyleMap update() {
StyleMap styleMap = new StyleMap();
public PredefinedCellStyleConfig update() {
PredefinedCellStyleConfig config = new PredefinedCellStyleConfig();
for (int i = 0; i < defaultListModel.getSize(); i++) {
String name = styleList.getNameAt(i);
String name = styleList.getNameAt(i);
Style style = customStylePaneList.get(i).updateBean();
styleMap.put(name, style);
config.addStyle(new PredefinedCellStyle(name, style));
}
return styleMap;
return config;
}
public void addNewStyle() {
String newStyleName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style");
if (isNameRepeated(new List[] {Arrays.asList(styleList.getAllNames())},
newStyleName)){
if (isNameRepeated(new List[]{Arrays.asList(styleList.getAllNames())},
newStyleName)) {
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newStyleName), 0);
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) {
ListModelElement el = new ListCellStyleModelElement(new NameObject(name, style));
public void addStyle(PredefinedCellStyle cellStyle) {
ListModelElement el = new ListCellStyleModelElement(new NameObject(cellStyle.getName(), cellStyle));
defaultListModel.addElement(el);
CustomPredefinedStylePane customPredefinedStylePane = new CustomPredefinedStylePane();
customPredefinedStylePane.populateBean(style);
customPredefinedStylePane.populateBean(cellStyle.getStyle());
customPredefinedStylePane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -268,7 +291,7 @@ public class CellStyleSettingPane extends BasicBeanPane<StyleMap> {
editPane.valueChangeAction();
}
});
centerPane.add(customPredefinedStylePane, name);
centerPane.add(customPredefinedStylePane, cellStyle.getName());
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.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
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.BackgroundWithAlphaSettingPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -32,22 +29,20 @@ public class PredefinedBackgroundSettingPane extends BasicBeanPane<PredefinedBac
private void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
reportBackgroundSettingPane = new BackgroundSettingPane();
UIScrollPane scrollPane = new UIScrollPane(reportBackgroundSettingPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
formBackgroundSettingPane = new BackgroundWithAlphaSettingPane();
CardLayout tabbedPane = new CardLayout();
JPanel center = new JPanel(tabbedPane);
center.add(scrollPane, "普通报表");
center.add(formBackgroundSettingPane, "决策报表");
center.setPreferredSize(new Dimension(243, 243));
this.buttonGroup = new UIButtonGroup(new String[]{"普通报表", "决策报表"});
center.add(reportBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"));
center.add(formBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report"));
this.buttonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report")});
buttonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (buttonGroup.getSelectedIndex() == 0) {
tabbedPane.show(center, "普通报表");
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"));
} 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
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;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
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.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@ -21,7 +20,6 @@ import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kerry on 2020-09-02
@ -29,7 +27,7 @@ import java.util.List;
public class BackgroundSettingPane extends BasicBeanPane<Background> {
private ChangeListener changeListener = null;
private UIComboBox headCombobox;
private List<BackgroundDetailPane> paneList = new ArrayList<>();
private BackgroundQuickPane[] paneList;
public BackgroundSettingPane() {
init();
@ -38,18 +36,27 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
private void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(createComboHeadPane(), BorderLayout.NORTH);
CardLayout tabbedPane = new CardLayout();
JPanel center = createCenterPane(tabbedPane);
center.setPreferredSize(BackgroundType.EMPTY_BACKGROUND.getDisplayDimension());
CardLayout cardlayout = new CardLayout();
paneList = supportKindsOfBackgroundUI();
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() {
@Override
public void itemStateChanged(ItemEvent e) {
BackgroundType type = BackgroundType.parse(e.getItem().toString());
center.setPreferredSize(type.getDisplayDimension());
tabbedPane.show(center, type.getDisplayName());
cardlayout.show(centerPane, (String) headCombobox.getSelectedItem());
}
});
this.add(center, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER);
}
public void addChangeListener(ChangeListener changeListener) {
@ -58,102 +65,62 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
private JPanel createComboHeadPane() {
headCombobox = new UIComboBox(BackgroundType.allTypes());
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;
}
headCombobox = new UIComboBox();
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(
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));
paneList.add(textureDetailPane);
return jPanel;
}
private JPanel createPatternSelectPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0);
PatternDetailPane patternDetailPane = PatternDetailPane.createPatternDetailPane(6);
jPanel.add(patternDetailPane, BorderLayout.CENTER);
paneList.add(patternDetailPane);
return jPanel;
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
java.util.List<BackgroundQuickPane> kinds = new ArrayList<>();
kinds.add(new EmptyBackgroundPane());
kinds.add(new ColorDetailPane());
kinds.add(new TextureDetailObservePane());
kinds.add(new PatternDetailPane());
kinds.add(createImageSelectPane());
kinds.add(new GradientDetailPane());
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
private JPanel createImageSelectPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0);
protected ImageDetailPane createImageSelectPane() {
ImageDetailPane imageDetailPane = new ImageDetailPane();
imageDetailPane.addChangeListener(new ChangeListener() {
imageDetailPane.registerChangeListener(new UIObserverListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (changeListener != null) {
changeListener.stateChanged(e);
}
public void doChange() {
fireChangeListener();
}
});
jPanel.add(imageDetailPane);
paneList.add(imageDetailPane);
return jPanel;
return imageDetailPane;
}
private JPanel createGradientSelectPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 0, 0);
GradientDetailPane gradientDetailPane = new GradientDetailPane();
jPanel.add(gradientDetailPane);
paneList.add(gradientDetailPane);
return jPanel;
protected void fireChangeListener() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
@Override
public void populateBean(Background background) {
String displayType = BackgroundType.parse(background).getDisplayName();
this.headCombobox.setSelectedItem(displayType);
int index = this.headCombobox.getSelectedIndex();
paneList.get(index).populate(background);
for (int i = 0; i < paneList.length; i++) {
BackgroundQuickPane pane = paneList[i];
if (pane.accept(background)) {
pane.populateBean(background);
headCombobox.setSelectedIndex(i);
return;
}
}
}
@Override
public Background updateBean() {
int selectIndex = this.headCombobox.getSelectedIndex();
try {
return paneList.get(selectIndex).update();
return paneList[selectIndex].updateBean();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -164,4 +131,5 @@ public class BackgroundSettingPane extends BasicBeanPane<Background> {
protected String title4PopupWindow() {
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.designer.IntervalConstants;
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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeListener;
@ -29,7 +27,7 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
public BackgroundWithAlphaSettingPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundSettingPane = new BackgroundSettingPane();
backgroundSettingPane = new FormBackgroundSettingPane();
JPanel eastpane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 0);
this.numberDragPane = new UINumberDragPane(0, 100);
@ -37,7 +35,8 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
eastpane.add(numberDragPane);
eastpane.add(new UILabel("%"));
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));
@ -45,10 +44,8 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
new Component[]{backgroundSettingPane},
new Component[]{transparencyPane}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
UIScrollPane scrollPane = new UIScrollPane(panel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
this.add(scrollPane, BorderLayout.CENTER);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
this.add(panel, BorderLayout.CENTER);
}
@ -67,7 +64,7 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
public BackgroundWithAlpha updateBean() {
BackgroundWithAlpha backgroundWithAlpha = new BackgroundWithAlpha();
backgroundWithAlpha.setBackground(backgroundSettingPane.updateBean());
backgroundWithAlpha.setAlpha((float)(numberDragPane.updateBean()/maxNumber));
backgroundWithAlpha.setAlpha((float) (numberDragPane.updateBean() / maxNumber));
return backgroundWithAlpha;
}
@ -75,4 +72,5 @@ public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWith
protected String title4PopupWindow() {
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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.general.Background;
@ -22,7 +21,7 @@ import java.awt.Dimension;
/**
* Created by kerry on 2020-08-31
*/
public class ColorDetailPane extends BackgroundDetailPane {
public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackground> {
private ColorBackgroundSelectPane selectPane;
@ -33,22 +32,23 @@ public class ColorDetailPane extends BackgroundDetailPane {
}
@Override
public void populate(Background background) {
if (background instanceof ColorBackground) {
this.selectPane.setColor(((ColorBackground) background).getColor());
}
public void populate(ColorBackground background) {
this.selectPane.setColor(background.getColor());
}
@Override
public Background update() {
public ColorBackground update() {
return ColorBackground.getInstance(selectPane.getColor());
}
@Override
public void addChangeListener(ChangeListener changeListener) {
public String title4PopupWindow() {
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 {
protected UIObserverListener uiObserverListener;
@ -75,8 +75,9 @@ public class ColorDetailPane extends BackgroundDetailPane {
UIButton transpanrentBtn = createTranspanrentButton();
transpanrentBtn.setPreferredSize(new Dimension(160, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel("颜色"), transpanrentBtn}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Color")),
transpanrentBtn}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
return jPanel;
}
@ -84,8 +85,8 @@ public class ColorDetailPane extends BackgroundDetailPane {
JPanel centerPane = super.createCenterPane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
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;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.general.Background;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2020-09-01
*/
public class EmptyBackgroundPane extends BackgroundDetailPane {
public class EmptyBackgroundPane extends AbstractBackgroundDetailPane {
@Override
public void populate(Background background) {
@ -20,8 +17,18 @@ public class EmptyBackgroundPane extends BackgroundDetailPane {
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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.background.gradient.GradientBar;
import com.fr.general.Background;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -26,7 +26,7 @@ import java.awt.event.ActionListener;
*
* @author ben
*/
public class GradientDetailPane extends BackgroundDetailPane implements UIObserver {
public class GradientDetailPane extends AbstractBackgroundDetailPane<GradientBackground> implements UIObserver {
private static final long serialVersionUID = -6854603990673031897L;
private UIObserverListener listener;
private UIRadioButton left2right, top2bottom;
@ -35,9 +35,10 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
public GradientDetailPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel blankJp = new JPanel();
gradientBar = new GradientBar(4, 141);
gradientBar = new GradientBar(4, 150);
blankJp.add(gradientBar);
gradientPanel.add(gradientBar, BorderLayout.SOUTH);
@ -59,10 +60,11 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
toggle.add(top2bottom);
Component[][] components = new Component[][]{
new Component[]{new UILabel("渐变色设置"), gradientPanel},
new Component[]{new UILabel("渐变方向"), jp}
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Setting")), gradientPanel},
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() {
@Override
public void stateChanged(ChangeEvent e) {
@ -71,15 +73,19 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
}
}
});
this.add(contentPane);
}
@Override
public boolean accept(Background background) {
return background instanceof GradientBackground;
}
public void populate(Background background) {
if (!(background instanceof GradientBackground)) {
return;
}
GradientBackground bg = (GradientBackground) background;
public void populate(GradientBackground bg) {
this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor());
this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor());
if (bg.getDirection() == GradientBackground.LEFT2RIGHT) {
@ -144,4 +150,10 @@ public class GradientDetailPane extends BackgroundDetailPane implements UIObserv
public boolean shouldResponseChangeListener() {
return true;
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Color");
}
}

54
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.layout.FRGUIPaneFactory;
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.ImagePreviewPane;
import com.fr.general.Background;
@ -31,7 +30,7 @@ import java.awt.event.ActionListener;
/**
* Image background pane.
*/
public class ImageDetailPane extends BackgroundDetailPane {
public class ImageDetailPane extends AbstractBackgroundDetailPane<ImageBackground> {
protected ImagePreviewPane previewPane = null;
private Style imageStyle = null;
@ -85,10 +84,11 @@ public class ImageDetailPane extends BackgroundDetailPane {
defaultRadioButton.setSelected(true);
Component[][] components = new Component[][]{
new Component[]{new UILabel("图片"), selectPictureButton},
new Component[]{new UILabel("填充方式"), jp}
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image")), selectPictureButton},
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);
return selectFilePane;
}
@ -102,6 +102,12 @@ public class ImageDetailPane extends BackgroundDetailPane {
};
}
@Override
public boolean accept(Background background) {
return background instanceof ImageBackground;
}
/**
* Select picture.
*/
@ -141,34 +147,26 @@ public class ImageDetailPane extends BackgroundDetailPane {
};
@Override
public void populate(Background background) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
} else if (imageBackground.getLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
} else if (imageBackground.getLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
} else {
tiledRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}
public void populate(ImageBackground imageBackground) {
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
} else if (imageBackground.getLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
} else if (imageBackground.getLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
} else {
tiledRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}
fireChagneListener();
}
@Override
public Background update() {
public ImageBackground update() {
ImageBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix());
setImageStyle();
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");
}
}

126
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;
import com.fr.base.background.PatternBackground;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.AttrScrollPane;
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.style.background.impl.PatternBackgroundPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -25,69 +28,100 @@ import java.awt.LayoutManager;
/**
* 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 PatternNewBackgroundPane patternNewBackgroundPane;
private PatternDetailPane(int nColumn) {
super(nColumn);
public PatternDetailPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
patternNewBackgroundPane = new PatternNewBackgroundPane(6);
this.add(patternNewBackgroundPane, BorderLayout.CENTER);
}
public static PatternDetailPane createPatternDetailPane(int nColumn) {
return new PatternDetailPane(nColumn);
@Override
public void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return new GridLayout(0, nColumn, 2, 2);
@Override
public void populate(PatternBackground background) {
this.patternNewBackgroundPane.populate(background);
}
protected void initComponents(int nColumn) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder());
JPanel jPanel = new JPanel();
jPanel.setLayout(layoutOfTypePane(nColumn));
setChildrenOfTypePane(jPanel);
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
UILabel label = new UILabel("图案");
label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{
new Component[]{label, jPanel},
new Component[]{new UILabel("前景颜色"), foregroundColorPane},
new Component[]{new UILabel("背景颜色"), backgroundColorPane}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
JPanel jPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
jPanel1.add(centerPane);
BasicScrollPane basicScrollPane = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return jPanel1;
}
};
jPanel1.setBorder(BorderFactory.createEmptyBorder());
this.add(basicScrollPane, BorderLayout.NORTH);
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (listener != null) {
listener.doChange();
}
}
});
@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 void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
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) {
return new GridLayout(0, nColumn, 2, 2);
}
protected void initComponents(int nColumn) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder());
JPanel jPanel = new JPanel();
jPanel.setLayout(layoutOfTypePane(nColumn));
setChildrenOfTypePane(jPanel);
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern"));
label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{
new Component[]{label, jPanel},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_ForeBackground_Color")), foregroundColorPane},
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 jPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
jPanel1.add(centerPane);
BasicScrollPane basicScrollPane = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return jPanel1;
}
};
jPanel1.setBorder(BorderFactory.createEmptyBorder());
this.add(basicScrollPane, BorderLayout.NORTH);
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (listener != null) {
listener.doChange();
}
}
});
}
}
}

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;
import com.fr.base.background.TextureBackground;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
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.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.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* 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 UIObserverListener listener;
public TextureDetailObservePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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() {
@Override
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
@ -44,15 +64,32 @@ public class TextureDetailObservePane extends BackgroundDetailPane implements UI
}
@Override
public void populate(Background background) {
public void populate(TextureBackground background) {
this.detailPane.populate(background);
}
@Override
public Background update() throws Exception {
return this.detailPane.update();
public TextureBackground 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
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.general.act.BorderPacker;
import com.fr.stable.Constants;
@ -70,7 +71,12 @@ public class ComponentFrameStylePane extends ComponentStylePane {
currentLineColorPane.setPreferredSize(new Dimension(20, 20));
JPanel buttonPane = new JPanel(new BorderLayout());
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();
this.numberDragPane = new UINumberDragPane(0, 100);
transparencyPane.add(numberDragPane, BorderLayout.CENTER);
@ -119,7 +125,7 @@ public class ComponentFrameStylePane extends ComponentStylePane {
@Override
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
protected String title4PopupWindow() {
return "边距";
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Margin");
}
@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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.LayoutBorderStyle;
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};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
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));
hPaneContainer.add(hAlignmentPane);
titleBackgroundPane = new BackgroundNoImagePane();
titleBackgroundPane = new BackgroundNoImagePane(){
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane(119);
}
};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, 157};
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(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}};
@ -170,7 +177,7 @@ public class ComponentTitleStylePane extends ComponentStylePane {
@Override
protected String title4PopupWindow() {
return "标题";
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Title");
}
@Override
@ -182,7 +189,6 @@ public class ComponentTitleStylePane extends ComponentStylePane {
populateFormula(widgetTitle);
populateFont(widgetTitle);
hAlignmentPane.setSelectedItem(widgetTitle.getPosition());
titleBackgroundPane.populateBean(widgetTitle.getBackground());

25
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.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
@ -37,21 +38,22 @@ public class PredefinedStyleEditDialog extends JDialog {
public PredefinedStyleEditDialog(Window parent, PredefinedStyleEditPane contentPane, boolean isBuiltIn) {
super(parent, ModalityType.APPLICATION_MODAL);
this.setTitle("服务器预定义样式");
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Edit"));
this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
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.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
contentPane.saveStyle();
dialogExit();
if(contentPane.saveStyle()){
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() {
@Override
public void actionPerformed(ActionEvent e) {
@ -60,7 +62,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() {
@Override
public void actionPerformed(ActionEvent e) {
@ -97,9 +99,9 @@ public class PredefinedStyleEditDialog extends JDialog {
public SaveAsNewStyleDialog(Window parent, PredefinedStyleEditPane editPane) {
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);
UIButton confirm = new UIButton("确认");
UIButton confirm = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirm.setEnabled(false);
confirm.addActionListener(new ActionListener() {
@Override
@ -110,11 +112,11 @@ public class PredefinedStyleEditDialog extends JDialog {
dialogExit();
PredefinedStyleEditDialog.this.dialogExit();
} 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() {
@Override
public void actionPerformed(ActionEvent e) {
@ -148,7 +150,7 @@ public class PredefinedStyleEditDialog extends JDialog {
private JPanel createSaveAsPane(UIButton confirm) {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
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.getDocument().addDocumentListener(new DocumentListener() {
@Override
@ -170,6 +172,7 @@ public class PredefinedStyleEditDialog extends JDialog {
centerPane.add(textField);
panel.add(centerPane, BorderLayout.CENTER);
tipLabel = new UILabel();
tipLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0));
tipLabel.setForeground(Color.RED);
panel.add(tipLabel, BorderLayout.SOUTH);
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) {
super(parent, ModalityType.APPLICATION_MODAL);
this.setTitle("模板预定义样式");
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Style"));
this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
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() {
@Override
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() {
@Override
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() {
@Override
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) {
super(parent, ModalityType.APPLICATION_MODAL);
;
this.setTitle("服务器预定义样式");
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Server_Style"));
this.setResizable(false);
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
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() {
@Override
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() {
@Override
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) {
String paintText = "各城市目标达成情况";
String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text");
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.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane;
@ -16,8 +15,6 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.NamePaddingMargin;
import com.fr.form.ui.PaddingMargin;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
@ -93,15 +90,15 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
private void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane("框架");
frameStylePane = new ComponentFrameStylePane();
frame.add(createEmptyBorderScrollPane(frameStylePane, new Dimension(233, 183)));
frameStylePane.setPreferredSize(new Dimension(233, 183));
frame.add(frameStylePane);
JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane("标题");
titleStylePane = ComponentTitleStylePane.createStyleSettingPane();
title.add(createEmptyBorderScrollPane(titleStylePane, new Dimension(233, 140)));
titleStylePane.setPreferredSize(new Dimension(233, 140));
title.add(titleStylePane);
JPanel margin = FRGUIPaneFactory.createTitledBorderNoGapPane("边距");
@ -114,14 +111,6 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
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
public void populateBean(ComponentStyle ob) {
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块, 说明是新建的模板
if (centerWidget == null) {
XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body"));
layoutContainer.initWidgetPredefinedInfo();
layoutContainer.setSize(LARGE_PREFERRED_SIZE);
setRootComponent(layoutContainer);
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.NameStyle;
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.ServerPreferenceConfig;
import com.fr.config.StyleMap;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane;
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.FormatPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane;
@ -31,6 +34,7 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.ArrayList;
@ -61,12 +65,14 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
}
protected JPanel createPredefinedSettingPane() {
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 44, 10);
jPanel.add(new UILabel("应用格式"));
applicationFormat = new UIComboBox();
applicationFormat.setPreferredSize(new Dimension(80, 30));
jPanel.add(applicationFormat);
return jPanel;
applicationFormat.setPreferredSize(new Dimension(140, 20));
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
{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();
super.populate(ob);
PredefinedStyle predefinedStyle = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getStyle(template.getTemplatePredefinedStyle());
StyleMap map = predefinedStyle.getCellStyleMap();
Map<String, Style> allStyle = map.getAllStyles();
PredefinedCellStyleConfig config = predefinedStyle.getCellStyleConfig();
Map<String, PredefinedCellStyle> allStyle = config.getAllStyles();
this.applicationFormat.clearBoxItems();
for (String name : allStyle.keySet()) {
this.applicationFormat.addItem(name);

Loading…
Cancel
Save