diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java index 54ad9623ef..556b27c21f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java +++ b/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 }; } -} \ No newline at end of file + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){ + return new GradientBackgroundQuickPane(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java index 22e883c1e9..407c522ceb 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java +++ b/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 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(); + } + /** * 事件监听 diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 72aa1b35e7..3713fca7bc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/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 kinds = new ArrayList(); - + kinds.add(new NullBackgroundQuickPane()); kinds.add(colorBackgroundPane); kinds.add(imageBackgroundPane); kinds.add(gradientPane); - + Set 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()]); } -} \ No newline at end of file + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){ + return new GradientBackgroundQuickPane(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index b898dda3a1..c1682f9745 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -809,6 +809,7 @@ public abstract class JTemplate> return false; } try { + this.getTarget().resetPreferenceStyle(this.getTemplatePredefinedStyle()); this.getTarget().export(editingFILE.asOutputStream()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/PatternStyle.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/PatternStyle.java index 372ad10c70..467c554a4f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/PatternStyle.java +++ b/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; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java index 5fb8f35320..18a7e2c492 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java +++ b/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); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java index 8052ec039d..cc3811f9f6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java +++ b/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.ComponentStyleSettingPane; import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; +import com.fr.design.utils.DesignUtils; import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; @@ -22,7 +23,6 @@ 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 +104,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 +138,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 +148,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 +185,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,7 +194,7 @@ 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; @@ -205,6 +208,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { FineLoggerFactory.getLogger().error(e.getMessage(), e); } saveStyle(previewObject); + DesignUtils.refreshDesignerFrame(); } public void saveStyle(PredefinedStyle previewObject) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java index a8f37ace35..90b013e0e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java +++ b/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(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleSettingPane.java index f5f3209420..9cff0482f6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleSettingPane.java +++ b/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 { +public class CellStyleSettingPane extends BasicBeanPane { private StyleListPane styleListPane; private List customStylePaneList = new ArrayList<>(); @@ -59,6 +60,7 @@ public class CellStyleSettingPane extends BasicBeanPane { 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 { }); 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 { @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 { 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 { 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 { @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 { }); } + private boolean validateCouldRename(PredefinedCellStyle cellStyle) { + return !cellStyle.isBuiltIn(); + } + private void showTipDialogAndReset(String content, int index) { styleList.stopEditing(); @@ -217,11 +232,11 @@ public class CellStyleSettingPane extends BasicBeanPane { } - public void populate(StyleMap ob) { - Iterator> iterator = ob.getAllStyles().entrySet().iterator(); + public void populate(PredefinedCellStyleConfig ob) { + Iterator iterator = ob.getAllStyles().values().iterator(); while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - addStyle(entry.getKey(), entry.getValue()); + PredefinedCellStyle entry = iterator.next(); + addStyle(entry); } reset(); @@ -230,37 +245,38 @@ public class CellStyleSettingPane extends BasicBeanPane { private void reset() { if (defaultListModel.getSize() > 0) { styleList.setSelectedIndex(0); + removeBtn.setEnabled(false); cardLayout.show(centerPane, styleList.getNameAt(0)); centerPane.validate(); - } } - 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 +284,7 @@ public class CellStyleSettingPane extends BasicBeanPane { editPane.valueChangeAction(); } }); - centerPane.add(customPredefinedStylePane, name); + centerPane.add(customPredefinedStylePane, cellStyle.getName()); customStylePaneList.add(customPredefinedStylePane); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/PredefinedBackgroundSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/PredefinedBackgroundSettingPane.java index 7601b9957c..05b02a5645 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/PredefinedBackgroundSettingPane.java +++ b/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 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) { + + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundSettingPane.java index 2a8ee64e6c..3efd0b447e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundSettingPane.java +++ b/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 { private ChangeListener changeListener = null; private UIComboBox headCombobox; - private List paneList = new ArrayList<>(); + private BackgroundQuickPane[] paneList; public BackgroundSettingPane() { init(); @@ -38,18 +36,27 @@ public class BackgroundSettingPane extends BasicBeanPane { 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 { 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 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 { protected String title4PopupWindow() { return null; } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundType.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundType.java deleted file mode 100644 index 0efa9eb09c..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundType.java +++ /dev/null @@ -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; - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundWithAlphaSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundWithAlphaSettingPane.java index 6c25113540..dba0dce230 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/BackgroundWithAlphaSettingPane.java +++ b/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 { 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; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/EmptyBackgroundPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/EmptyBackgroundPane.java index 300a1e6e51..569db10231 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/EmptyBackgroundPane.java +++ b/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; } + + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/FormBackgroundSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/FormBackgroundSettingPane.java new file mode 100644 index 0000000000..1a683df5cc --- /dev/null +++ b/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 kinds = new ArrayList(); + + kinds.add(new EmptyBackgroundPane()); + kinds.add(colorDetailPane); + kinds.add(imageDetailPane); + kinds.add(gradientPane); + + Set 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()]); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/GradientDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/GradientDetailPane.java index 1a6b60b74a..dba975cccd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/GradientDetailPane.java +++ b/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 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"); + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java index 7c6f0458d7..8817f8d8ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java +++ b/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 { 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"); + } + + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/PatternDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/PatternDetailPane.java index 4b79fd4f40..5fa3b6ac25 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/PatternDetailPane.java +++ b/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 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(); + } + } + }); + } + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/TextureDetailObservePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/TextureDetailObservePane.java index df2879ee62..189b811d99 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/TextureDetailObservePane.java +++ b/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 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) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java index 311e64f1c7..e5d411b301 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentMarginStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentMarginStylePane.java index 1b435d8f97..b36702fb71 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentMarginStylePane.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java index b7367eb257..2d0e7746e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java +++ b/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(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()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/PredefinedStyleEditDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/PredefinedStyleEditDialog.java index 3ee8cd6b91..41b9f19027 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/PredefinedStyleEditDialog.java +++ b/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,12 +38,12 @@ 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 @@ -51,7 +52,7 @@ public class PredefinedStyleEditDialog extends JDialog { 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 +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() { @Override public void actionPerformed(ActionEvent e) { @@ -97,9 +98,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 +111,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 +149,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 +171,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; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ReportPredefinedStyleDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ReportPredefinedStyleDialog.java index 2940632b9c..8c9daf0b09 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ReportPredefinedStyleDialog.java +++ b/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) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ServerPredefinedStyleDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ServerPredefinedStyleDialog.java index 8d54f94a67..439bb3ec28 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/dialog/ServerPredefinedStyleDialog.java +++ b/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) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java index 83e8915b0a..0fffe2ff4f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java +++ b/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); } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java index 3a147ad6f4..4b729dd6da 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java +++ b/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(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index eefeb01a32..fb82ae59f0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -935,6 +935,7 @@ public class FormDesigner extends TargetComponent
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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java index b15e91ed36..15cfbf2089 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java +++ b/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 allStyle = map.getAllStyles(); + PredefinedCellStyleConfig config = predefinedStyle.getCellStyleConfig(); + Map allStyle = config.getAllStyles(); this.applicationFormat.clearBoxItems(); for (String name : allStyle.keySet()) { this.applicationFormat.addItem(name);