diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java index 751f8b2676..0952253f4e 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java @@ -40,6 +40,7 @@ public abstract class ConditionAttrSingleConditionPane extends SingleConditio conditionAttributesPane.resetUseAbleActionList(); conditionAttributesPane.updateMenuDef(); conditionAttributesPane.checkConditionPane(); + conditionAttributesPane.resetWindow(); conditionAttributesPane.redraw(); } diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java index 5d6ee4e5ac..e96edbdf07 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java @@ -1,6 +1,10 @@ package com.fr.design.condition; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.common.annotations.Open; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; @@ -10,14 +14,21 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; -import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollPane; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import java.awt.Dimension; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; @Open public abstract class ConditionAttributesPane extends BasicBeanPane { @@ -33,44 +44,47 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { //可用的Actions. protected java.util.List useAbleActionList = new java.util.ArrayList(); - protected void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - // 属性 界面 - JPanel propertyChangePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(propertyChangePane); + protected JScrollPane selectedItemScrollPane = new JScrollPane(); - propertyChangePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property") + ":", null)); + protected void initComponents() { + this.setLayout(new BorderLayout()); // 选择要改变的属性. - JPanel addItemPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel addItemPane = new JPanel(new BorderLayout()); ToolBarDef toolbarDef = new ToolBarDef(); menuDef = new CellHighlightAddMenuDef(); menuDef.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Highlight_Click_to_Choose_Property_To_Modify")); - menuDef.setIconPath("com/fr/design/images/control/addPopup.png"); + menuDef.setIcon(new LazyIcon("add_popup")); toolbarDef.addShortCut(menuDef); updateMenuDef(); UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolBar.setLayout(new BorderLayout()); + toolBar.setBorder(new FineRoundBorder()); + toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); toolbarDef.updateToolBar(toolBar); - addItemPane.add(toolBar); + addItemPane.add(toolBar, BorderLayout.WEST); - propertyChangePane.add(addItemPane); + addItemPane.setBorder(new FineRoundBorder()); selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); -// selectedItemPane.setLayout(new BoxLayout(selectedItemPane,BoxLayout.Y_AXIS)); // 选中的添加Itempane - JScrollPane selectedItemScrollPane = new JScrollPane(); selectedItemScrollPane.setViewportView(selectedItemPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT)); dealScrollPane(selectedItemScrollPane); - propertyChangePane.add(selectedItemScrollPane); + + this.add(FineUIUtils.wrapComponentWithTitle(column( + 10, + row(cell(addItemPane),flex()), + cell(selectedItemScrollPane).with(it -> it.setBorder(new FineRoundBorder())), + fix(10) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")), BorderLayout.NORTH); } protected void dealScrollPane(JScrollPane scrollPane){ @@ -125,6 +139,13 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { } } + /** + * 根据所需属性个数设置属性布局大小 + */ + public void resetWindow() { + selectedItemScrollPane.setPreferredSize(new Dimension(selectedItemScrollPane.getWidth(), Math.min(35 * (classPaneMap.size() - useAbleActionList.size()), 150))); + } + public void removeConditionAttrSingleConditionPane(JComponent component) { selectedItemPane.remove(component); } diff --git a/designer-base/src/main/java/com/fr/design/condition/HighLightConditionAction.java b/designer-base/src/main/java/com/fr/design/condition/HighLightConditionAction.java index 70ae023bf7..953a9f2605 100644 --- a/designer-base/src/main/java/com/fr/design/condition/HighLightConditionAction.java +++ b/designer-base/src/main/java/com/fr/design/condition/HighLightConditionAction.java @@ -29,6 +29,7 @@ public class HighLightConditionAction extends UpdateAction { conditionAttributesPane.removeUpdateActionFromUsableList(this); conditionAttributesPane.updateMenuDef(); conditionAttributesPane.checkConditionPane(); + conditionAttributesPane.resetWindow(); conditionAttributesPane.redraw(); conditionAttrSingleConditionPane.setDefault(); } diff --git a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java index 17dedf60aa..8f2c3008c0 100644 --- a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java @@ -5,6 +5,7 @@ import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; @@ -25,13 +26,11 @@ public abstract class SingleConditionPane extends BasicPane { if (isRemove) { if(cancel == null) { - cancel = new UIButton(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + cancel = new UIButton(new LazyIcon("remove")); cancel.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Remove")); cancel.addActionListener(cancleListener); cancel.setMargin(new Insets(0, 0, 0, 0)); } - - this.add(cancel); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 0106654e8f..1907aa58b6 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -1,5 +1,7 @@ package com.fr.design.data.datapane; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -33,6 +35,9 @@ import java.util.Collections; import java.util.Date; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * @author rinoux * @version 10.0 @@ -72,21 +77,24 @@ public class ESDStrategyConfigPane extends BasicBeanPane { setLayout(FRGUIPaneFactory.createM_BorderLayout()); this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Every_Interval")); - this.updateInterval = new UITextField(4); this.shouldEvolve = new UICheckBox(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Auto_Evolved_Strategy"), false); this.shouldEvolve.setEnabled(false); + this.shouldEvolve.setBorder(new ScaledEmptyBorder(0, 4, 0, 0)); this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Interval_Format")); this.updateIntervalCheckTips.setForeground(Color.RED); this.updateIntervalCheckTips.setVisible(false); - this.selectBySchema = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron")); this.schemaTime = new UITextField(10); this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); this.schemaTimeCheckTips.setVisible(false); this.schemaTimeCheckTips.setForeground(Color.RED); + addListener(); + addCenterPanel(); + } + private void addListener() { this.selectAutoUpdate.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { ESDStrategyConfigPane.this.selectBySchema.setSelected(!ESDStrategyConfigPane.this.selectAutoUpdate.isSelected()); @@ -105,19 +113,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } }); - JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Update_Strategy")); - add(pane, BorderLayout.NORTH); - - JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ - this.selectAutoUpdate, - this.updateInterval, - new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Minute_Update_Cache")), - this.shouldEvolve, - this.updateIntervalCheckTips - }, 0, 5); - pane.add(row1); - - ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron_Help")); + actionLabel = new ActionLabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron_Help")); actionLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -128,6 +124,16 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } } }); + } + + private void addCenterPanel() { + JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ + this.selectAutoUpdate, + this.updateInterval, + new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Minute_Update_Cache")), + this.shouldEvolve, + this.updateIntervalCheckTips + }, 0, 5); JPanel row2 = GUICoreUtils.createFlowPane(new Component[]{ this.selectBySchema, @@ -135,7 +141,9 @@ public class ESDStrategyConfigPane extends BasicBeanPane { actionLabel, this.schemaTimeCheckTips }, 0, 5); - pane.add(row2); + + add(FineUIUtils.wrapComponentWithTitle(column(10, cell(row1), cell(row2)).getComponent(), + InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Update_Strategy")), BorderLayout.NORTH); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index 41556dae83..4c2e6eb897 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -1,5 +1,8 @@ package com.fr.design.data.datapane.connect; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils; import com.fr.data.core.db.TableProcedure; @@ -23,9 +26,11 @@ import javax.swing.BorderFactory; import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import javax.swing.ToolTipManager; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -34,6 +39,9 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 数据集编辑面板左边的部分 * @@ -62,7 +70,7 @@ public class ConnectionTableProcedurePane extends BasicPane { } private void init(SwitchableTableDataPane parent) { - this.setLayout(new BorderLayout(4, 4)); + this.setLayout(new BorderLayout(4, 10)); // 初始化数据连接下拉框 initConnectionComboBox(parent); // 初始化中间的面板 @@ -75,6 +83,7 @@ public class ConnectionTableProcedurePane extends BasicPane { private JPanel initCenterPane() { JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setLayout(new BorderLayout(0, 5)); // 搜索面板 centerPane.add(createSearchPane(), BorderLayout.NORTH); // 数据库表视图面板 @@ -144,8 +153,9 @@ public class ConnectionTableProcedurePane extends BasicPane { } }); UIScrollPane tableViewListPane = new UIScrollPane(tableViewList); - tableViewListPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + tableViewListPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC)); JPanel tableViewBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + tableViewBorderPane.setLayout(new BorderLayout(0, 5)); tableViewBorderPane.add(tableViewListPane, BorderLayout.CENTER); JPanel checkBoxgroupPane = createCheckBoxgroupPane(); if (checkBoxgroupPane != null) { @@ -160,32 +170,15 @@ public class ConnectionTableProcedurePane extends BasicPane { */ private JPanel createSearchPane() { JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel searchPane = new JPanel(new BorderLayout(10, 0)); - searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR)); -// searchPane.setBackground(Color.WHITE); searchField = new UITextField(); - searchField.setBorderPainted(false); searchField.setPlaceholder(Toolkit.i18nText("Fine-Design_Basic_Table_Search")); searchField.getDocument().addDocumentListener(searchListener); - searchField.addMouseListener(new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - super.mouseEntered(e); - searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.CHECKBOX_HOVER_SELECTED)); - } - - @Override - public void mouseExited(MouseEvent e) { - super.mouseExited(e); - searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR)); - } - }); // 搜索图标 UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/search")); - searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - searchPane.add(searchField, BorderLayout.CENTER); - searchPane.add(searchLabel, BorderLayout.EAST); - panel.add(searchPane, BorderLayout.CENTER); + searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3)); + searchField.setBorder(null); + panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(it -> it.setBorder(new FineRoundBorder())).getComponent()); + panel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); return panel; } @@ -199,6 +192,7 @@ public class ConnectionTableProcedurePane extends BasicPane { protected JPanel createCheckBoxgroupPane() { JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); + checkBoxgroupPane.setLayout(new BorderLayout(20, 0)); JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); tableCheckBox = new UICheckBox(); tableCheckBox.setSelected(true); @@ -214,19 +208,19 @@ public class ConnectionTableProcedurePane extends BasicPane { // 根据环境是否为中文设置不同的显示 if (GeneralContext.isChineseEnv()) { first.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_SQL_Table"), - BaseUtils.readIcon("/com/fr/design/images/data/tables.png"), UILabel.LEADING)); + new LazyIcon("tables"), UILabel.LEADING)); second.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_SQL_View"), - BaseUtils.readIcon("/com/fr/design/images/data/views.png"), UILabel.LEADING)); + new LazyIcon("views"), UILabel.LEADING)); } else { - UILabel ui1 = new UILabel(BaseUtils.readIcon("/com/fr/design/images/data/tables.png"), UILabel.LEADING); - UILabel ui2 = new UILabel(BaseUtils.readIcon("/com/fr/design/images/data/views.png"), UILabel.LEADING); + UILabel ui1 = new UILabel(new LazyIcon("tables"), UILabel.LEADING); + UILabel ui2 = new UILabel(new LazyIcon("views"), UILabel.LEADING); ui1.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_SQL_Table")); ui2.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_SQL_View")); first.add(ui1); second.add(ui2); } - checkBoxgroupPane.add(first); - checkBoxgroupPane.add(second); + checkBoxgroupPane.add(first, BorderLayout.WEST); + checkBoxgroupPane.add(second, BorderLayout.CENTER); return checkBoxgroupPane; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index a430a13bd1..08c8e36660 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -7,7 +8,9 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.log.FineLoggerFactory; + import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.util.Iterator; import java.util.concurrent.CancellationException; @@ -45,17 +48,21 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - Dimension buttonSize = new Dimension(26, 20); + Dimension buttonSize = new Dimension(24, 24); itemComboBox = new UIComboBox(); itemComboBox.setEnabled(true); this.add(itemComboBox, BorderLayout.CENTER); - refreshButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); - JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4 ,4); + refreshButton = new UIButton(new LazyIcon("refresh")); + JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 0 ,4); editButton = initEditButton(editButton, buttonSize); + editButton.setBorder(null); + editButton.setBackground(new Color(246, 248, 250, 255)); jPanel.add(editButton); jPanel.add(refreshButton); this.add(jPanel, BorderLayout.EAST); refreshButton.setPreferredSize(buttonSize); + refreshButton.setBorder(null); + refreshButton.setBackground(new Color(246, 248, 250, 255)); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshItems(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java index c4996d539e..ccf17f914c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.preview.sql; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.base.ParameterMapNameSpace; @@ -117,8 +118,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { } imagePanel.add(imageLabel); - topPanel.add(imagePanel, BorderLayout.WEST); - topPanel.add(messagePanel, BorderLayout.CENTER); + topPanel.add(messagePanel, BorderLayout.WEST); topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); //中间的SQL面板 @@ -141,6 +141,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { } scrollPane.setViewportView(checkArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + checkArea.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); centerPanel.add(scrollPane); //底部的按钮面板 diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 4a0d1f665e..fc502121d3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fine.theme.icon.LazyIcon; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; @@ -71,6 +72,7 @@ import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JToolBar; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.BorderLayout; @@ -93,7 +95,7 @@ import java.util.List; */ public class DBTableDataPane extends AbstractTableDataPane implements SwitchableTableDataPane { - private static final int BOTTOM = 6; + private static final int BOTTOM = 9; private static final String PREVIEW_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Preview"); private static final String REFRESH_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Refresh"); private ConnectionTableProcedurePane connectionTableProcedurePane; @@ -162,7 +164,25 @@ public class DBTableDataPane extends AbstractTableDataPane implemen }; editorPane = new UITableEditorPane<>(model); + initConnectionTableProcedurePane(); + this.sqlTextPane.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + barErrorTips.setVisible(false); + } + + + @Override + public void focusLost(FocusEvent e) { + if (DBTableDataPane.this.isPreviewOrRefreshButton(e)) { + DBTableDataPane.this.checkParameter(); + } + } + }); + } + + private void initConnectionTableProcedurePane() { this.connectionTableProcedurePane = new ConnectionTableProcedurePane(this) { @Override protected void filter(Connection connection, String conName, List nameList) { @@ -172,7 +192,6 @@ public class DBTableDataPane extends AbstractTableDataPane implemen }); } - @Override protected void addKeyMonitor() { this.searchField.addKeyListener(new KeyListener() { @@ -196,6 +215,10 @@ public class DBTableDataPane extends AbstractTableDataPane implemen }); } }; + + addConnectionTableProcedurePaneListener(); + } + private void addConnectionTableProcedurePaneListener() { this.connectionTableProcedurePane.addDoubleClickListener(new ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener() { @Override public void actionPerformed(TableProcedure target) { @@ -210,35 +233,20 @@ public class DBTableDataPane extends AbstractTableDataPane implemen DBTableDataPane.this.sqlTextPane.requestFocus(); } }); - - this.sqlTextPane.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - barErrorTips.setVisible(false); - } - - - @Override - public void focusLost(FocusEvent e) { - if (DBTableDataPane.this.isPreviewOrRefreshButton(e)) { - DBTableDataPane.this.checkParameter(); - } - } - }); } private void initMainSplitPane() { Box box = new Box(BoxLayout.Y_AXIS); - JPanel northPane = new JPanel(new BorderLayout(4, 4)); JToolBar editToolBar = createToolBar(); + editToolBar.setBorder(null); northPane.add(editToolBar, BorderLayout.CENTER); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); RTextScrollPane sqlTextScrollPane = new RTextScrollPane(this.sqlTextPane); sqlTextScrollPane.setLineNumbersEnabled(true); - sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + sqlTextScrollPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC)); sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); JPanel paraMeanPane = new JPanel(new BorderLayout()); @@ -262,7 +270,6 @@ public class DBTableDataPane extends AbstractTableDataPane implemen this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); - mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); mainSplitPane.setOneTouchExpandable(true); contentPane.add(mainSplitPane, BorderLayout.CENTER); } @@ -333,6 +340,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen this.barErrorTips.setVisible(false); esdSettingsBtn = new UIButton(Toolkit.i18nText("Fine-Design_ESD_Strategy_Config")); + esdSettingsBtn.setPreferredSize(new Dimension(72, 24)); esdSettingsBtn.addActionListener(new ActionListener() { @Override @@ -594,7 +602,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen public PreviewAction() { setName(PREVIEW_BUTTON); setMnemonic('P'); - setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + setSmallIcon(new LazyIcon("preview")); } @@ -609,7 +617,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen public PreviewPerformedSQLAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Performed_Sql")); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/preview_sql.png")); + this.setSmallIcon(new LazyIcon("preview_sql")); } @Override @@ -623,7 +631,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen public EditPageQueryAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); this.setMnemonic('L'); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/text.png")); + this.setSmallIcon(new LazyIcon("text")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 1686867e3e..5a4f3fca6f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseUtils; import com.fr.base.StoreProcedureParameter; import com.fr.data.core.db.TableProcedure; @@ -42,6 +43,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JToolBar; import javax.swing.SwingWorker; +import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; @@ -89,13 +91,15 @@ public class ProcedureDataPane extends AbstractTableDataPane imp queryText = new UILabel(StringUtils.EMPTY); Box box = new Box(BoxLayout.Y_AXIS); JPanel northpane = new JPanel(new BorderLayout(4, 4)); - northpane.add(creatToolBar(), BorderLayout.CENTER); + JToolBar editToolBar = creatToolBar(); + editToolBar.setBorder(null); + northpane.add(editToolBar, BorderLayout.NORTH); northpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); storeProcedureContext = new SQLEditPane(SQLEditPane.UNREQUEST_DROPTARGET); storeProcedureContext.setEditable(false); UIScrollPane storeProcedureContextPane = new UIScrollPane(storeProcedureContext); - storeProcedureContextPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + storeProcedureContextPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC)); storeProcedureContextPane.setPreferredSize(new Dimension(680, 600)); JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -122,11 +126,11 @@ public class ProcedureDataPane extends AbstractTableDataPane imp // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table initconnectionTableProcedurePane(); this.setLayout(new BorderLayout(4, 4)); - connectionTableProcedurePane.setMinimumSize(new Dimension(155, 500)); - box.setMinimumSize(new Dimension(310, 400)); + this.connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); + this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); + box.setMinimumSize(new Dimension(300, 400)); // 使用SplitPane JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); - mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); } @@ -167,6 +171,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); maxPanel = new MaxMemRowCountPanel(); maxPanel.setBorder(null); + maxPanel.setBackground(null); UIToolbar toolbar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(toolbar); toolbar.add(isShareCheckBox); @@ -376,7 +381,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp public PreviewAction(ProcedureDataPane procedureDataPane) { this.setName(PREVIEW_BUTTON); this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + this.setSmallIcon(new LazyIcon("preview")); this.procedureDataPane = procedureDataPane; } @@ -391,7 +396,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp protected class RefreshAction extends UITableEditAction { public RefreshAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + this.setSmallIcon(new LazyIcon("refresh")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java index e7b7e7026b..88f9b04239 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseFormula; import com.fr.base.StoreProcedureParameter; import com.fr.data.impl.storeproc.StoreProcedureConstants; @@ -21,6 +22,11 @@ import java.awt.*; import java.util.Date; import java.util.HashMap; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class StoreProcedureParameterPane extends BasicPane { @@ -70,27 +76,25 @@ public class StoreProcedureParameterPane extends BasicPane { schemaCombo = new UIComboBox(); initUIComboBox(schemaCombo, schemaName); - JPanel namePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - namePane.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), BorderLayout.WEST); nameField = new UITextField(10); - namePane.add(nameField, BorderLayout.CENTER); - namePane.add(new UILabel(" "), BorderLayout.EAST); - valuePane.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CellWrite_InsertRow_Default") + ":"), BorderLayout.WEST); - valuePane.add(valueEditPane, BorderLayout.CENTER); - valuePane.add(new UILabel(" "), BorderLayout.EAST); - Component[][] components = {{null}, - {namePane}, - {addPane("Fine-Design_Basic_Model", 1, schemaCombo)}, - {valuePane}, - {null} - }; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p}; - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane( - components, rowSize, columnSize, 20, 10); - this.add(centerPane, BorderLayout.CENTER); - + + this.add(FineUIUtils.wrapComponentWithTitle(column( + 10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name"))).weight(0.07), + cell(nameField).weight(0.2), + flex(0.2) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"))).weight(0.07), + cell(schemaCombo).weight(0.2), + flex(0.2) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CellWrite_InsertRow_Default"))).weight(0.07), + cell(valueEditPane).weight(0.2), + flex(0.2) + )).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))); } private JPanel addPane(String s, int i, UIComboBox combo){ diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureTableModel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureTableModel.java index 845010cd55..2870bbcc34 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/StoreProcedureTableModel.java @@ -35,7 +35,6 @@ public class StoreProcedureTableModel extends UITableModelAdapter extends BasicPane { public UITableEditorPane(UITableModelAdapter model) { this.tableModel = model; this.initComponent(model.createAction()); + this.editTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer()); } public UITableEditorPane(UITableModelAdapter model, String s) { leftLabelName = s; this.tableModel = model; this.initComponent(model.createAction()); + this.editTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer()); } protected void initComponent(UITableEditAction[] action) { @@ -169,4 +175,19 @@ public class UITableEditorPane extends BasicPane { editTable.getTableHeader().setResizingAllowed(resizingAllowed); } + /** + * 设置 TableHeader 文字左对齐 + */ + public static class TableHeaderRenderer extends DefaultTableCellRenderer { + public TableHeaderRenderer() { + setHorizontalAlignment(SwingConstants.LEFT); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + setBorder(UIManager.getBorder("TableHeader.cellBorder")); + return this; + } + } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java index f205cca92f..346b2c0419 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java @@ -6,12 +6,14 @@ package com.fr.design.gui.itree.checkboxtree; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import javax.swing.BorderFactory; import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; @@ -54,12 +56,15 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende public CheckBoxTreeCellRenderer(TreeCellRenderer renderer) { if (noFocusBorder == null) { - noFocusBorder = new EmptyBorder(1, 1, 1, 1); + noFocusBorder = new ScaledEmptyBorder(1, 1, 1, 10); } _checkBox.setOpaque(false); setBorder(noFocusBorder); setLayout(FRGUIPaneFactory.createBorderLayout()); - add(_checkBox, BorderLayout.BEFORE_LINE_BEGINS); + add(_checkBox, BorderLayout.WEST); + JPanel gapPanel = new JPanel(); + gapPanel.setPreferredSize(new Dimension(4, 20)); + add(gapPanel, BorderLayout.CENTER); _actualTreeRenderer = renderer; } @@ -76,19 +81,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende setComponentOrientation(tree.getComponentOrientation()); TreePath path = tree.getPathForRow(row); - if (path != null && tree instanceof CheckBoxTree) { - CheckBoxTreeSelectionModel selectionModel = ((CheckBoxTree) tree).getCheckBoxTreeSelectionModel(); - if (selectionModel != null) { - _checkBox.setEnabled(((CheckBoxTree) tree).isCheckBoxEnabled() && ((CheckBoxTree) tree).isCheckBoxEnabled(path)); - if (selectionModel.isPathSelected(path, selectionModel.isDigIn())) { - _checkBox.setState(TristateCheckBox.SELECTED); - } else if (selectionModel.isDigIn() && selectionModel.isPartiallySelected(path)) { - _checkBox.setState(TristateCheckBox.DO_NOT_CARE); - } else { - _checkBox.setState(TristateCheckBox.NOT_SELECTED); - } - } - } + handleCheckBox(tree, path); if (_actualTreeRenderer != null) { JComponent treeCellRendererComponent = (JComponent) _actualTreeRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); @@ -103,12 +96,37 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende remove((Component) this._actualTreeRenderer); - add(treeCellRendererComponent); + add(treeCellRendererComponent, BorderLayout.EAST); } return this; } + private void handleCheckBox(JTree tree, TreePath path) { + if (path == null || !(tree instanceof CheckBoxTree)) { + return; + } + + CheckBoxTree checkBoxTree = (CheckBoxTree) tree; + CheckBoxTreeSelectionModel selectionModel = checkBoxTree.getCheckBoxTreeSelectionModel(); + if (selectionModel == null) { + return; + } + + setCheckBoxState(path, selectionModel, checkBoxTree); + } + + private void setCheckBoxState(TreePath path, CheckBoxTreeSelectionModel selectionModel, CheckBoxTree checkBoxTree) { + _checkBox.setEnabled(checkBoxTree.isCheckBoxEnabled() && checkBoxTree.isCheckBoxEnabled(path)); + if (selectionModel.isPathSelected(path, selectionModel.isDigIn())) { + _checkBox.setState(TristateCheckBox.SELECTED); + } else if (selectionModel.isDigIn() && selectionModel.isPartiallySelected(path)) { + _checkBox.setState(TristateCheckBox.DO_NOT_CARE); + } else { + _checkBox.setState(TristateCheckBox.NOT_SELECTED); + } + } + public String getToolTipText(MouseEvent event) { if (_actualTreeRenderer instanceof JComponent) { Point p = event.getPoint(); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java b/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java index bf06aa2fd7..6b8e0e65b4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java @@ -75,7 +75,6 @@ public class FollowingThemePane extends BasicPane implements UIObserver { JPanel followingThemePane = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[] { followingThemeLabel, FRGUIPaneFactory.createBorderLayoutNorthPaneWithComponent(followingThemeButtonGroup)}}, new double[] { p }, new double[] { SETTING_LABEL_WIDTH, f }, 10, 0); - followingThemePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); followingThemePane.setVisible(false); add(followingThemePane, BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index ce8a9012a9..fabecda3e0 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1,5 +1,7 @@ package com.fr.design.roleAuthority; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; @@ -9,6 +11,7 @@ import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; @@ -40,6 +43,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Enumeration; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy @@ -80,17 +87,20 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); - JPanel buttonPane = new JPanel(new GridLayout()); - buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); - buttonPane.add(buttonGroup, BorderLayout.CENTER); - jPanel.add(buttonPane, BorderLayout.NORTH); - jPanel.add(scrollPane, BorderLayout.CENTER); + buttonGroup.setBorder(null); + buttonGroup.setOpaque(false); + jPanel.setOpaque(true); + jPanel.add(column( + 4, + row(2, cell(new UILabel(new LazyIcon("digitalPlatform"))), cell(buttonGroup)), + cell(scrollPane) + ).getComponent()); this.add(jPanel, BorderLayout.CENTER); + jPanel.setBorder(new ScaledEmptyBorder(0, 4, 4, 4)); registerDSChangeListener(); } @@ -197,7 +207,6 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } } }; - buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); } /** @@ -253,7 +262,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo public RefreshAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon("/com/fr/design/images/buttonicon/refresh"); + this.setSmallIcon(new LazyIcon("refresh")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/style/BorderPane.java index c9dff2c3d2..ee4c130f59 100644 --- a/designer-base/src/main/java/com/fr/design/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/style/BorderPane.java @@ -3,25 +3,24 @@ */ package com.fr.design.style; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.GraphHelper; import com.fr.base.Style; -import com.fr.design.border.UITitledBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.VerticalFlowLayout; -import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.NewColorSelectBox; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; @@ -29,10 +28,9 @@ import javax.swing.JToggleButton; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; -import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; @@ -40,6 +38,11 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * CellBorder Pane. */ @@ -73,7 +76,6 @@ public class BorderPane extends BasicPane { private LineComboBox currentLineCombo; private NewColorSelectBox currentLineColorPane; - private UIButton insidebutton; public BorderPane() { @@ -81,89 +83,57 @@ public class BorderPane extends BasicPane { } protected void initComponents() { - borderComponent = new BorderComponent(); - topToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BorderPane.TOP_BORDER); - horizontalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BorderPane.HORIZONTAL_BORDER); - bottomToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BorderPane.BOTTOM_BORDER); + initBasicComponents(); + JPanel borderAllControlPane = initButtonPanel(); + JPanel borderLeftPane = column(flex(), cell(topToggleButton), cell(horizontalToggleButton), cell(bottomToggleButton), flex()).getComponent(); + JPanel borderBottomPane = row(flex(), cell(leftToggleButton), cell(verticalToggleButton), cell(rightToggleButton), flex()).getComponent(); + this.currentLineColorPane.setSelectObject(Color.BLUE); + Component northPane1 = initNorthPanel(); + Component centerPane1 = FineUIUtils.wrapComponentWithTitle(row(5, cell(borderLeftPane), + column(5, row(flex(), cell(borderAllControlPane),flex()), cell(borderComponent).with(it -> it.setPreferredSize(new Dimension(600, 300))), cell(borderBottomPane)) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); + this.add(column(10, cell(northPane1), cell(centerPane1)).getComponent()); + } - leftToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BorderPane.LEFT_BORDER); - verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER); - rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER); + private void initBasicComponents() { + borderComponent = new BorderComponent(); + topToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BorderPane.TOP_BORDER, false); + horizontalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BorderPane.HORIZONTAL_BORDER, false); + bottomToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BorderPane.BOTTOM_BORDER, false); + leftToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BorderPane.LEFT_BORDER, true); + verticalToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BorderPane.VERTICAL_BORDER, true); + rightToggleButton = new ToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BorderPane.RIGHT_BORDER, true); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.currentLineColorPane = new NewColorSelectBox(100); - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - centerPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))); - JPanel borderAllControlPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - centerPane.add(borderAllControlPane, BorderLayout.NORTH); - borderAllControlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); - borderAllControlPane.add(new UILabel(" ")); - // Button reseting borders - borderAllControlPane.add(createVerButtonPane(NO_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"))); - // Button setting all borders to active with - // current color and current style excepting inside borders - borderAllControlPane.add(createVerButtonPane(EXTERNAL_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_External"))); - - borderAllControlPane.add(createVerButtonPane(INSIDE_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Inner"))); - - // Control - JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(borderPane, BorderLayout.CENTER); - borderPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4)); - borderComponent.addBorderChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { fireStateChanged(); } }); + } - borderPane.add(borderComponent, BorderLayout.CENTER); - - JPanel borderLeftPane = new JPanel(); - JPanel borderCornerPane = new JPanel(); - JPanel borderBottomPane = new JPanel(); - - borderPane.add(borderLeftPane, BorderLayout.WEST); - JPanel tmpBorderBottomPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - borderPane.add(tmpBorderBottomPane, BorderLayout.SOUTH); - tmpBorderBottomPane.add(borderBottomPane, BorderLayout.CENTER); - tmpBorderBottomPane.add(borderCornerPane, BorderLayout.WEST); - - borderLeftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.CENTER, 4, 16)); - - borderLeftPane.add(topToggleButton); - borderLeftPane.add(horizontalToggleButton); - borderLeftPane.add(bottomToggleButton); - - borderBottomPane.setLayout(new /**/FlowLayout(FlowLayout.CENTER, 42, 5)); - borderBottomPane.add(leftToggleButton); - borderBottomPane.add(verticalToggleButton); - borderBottomPane.add(rightToggleButton); - - borderCornerPane.setPreferredSize(new Dimension(borderLeftPane.getPreferredSize().width, borderBottomPane.getPreferredSize().height)); - - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - northPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Line"))); - JPanel rightTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPane.add(rightTopPane, BorderLayout.NORTH); - JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - first.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style") + ":")); - first.add(this.currentLineCombo); - rightTopPane.add(first, BorderLayout.NORTH); - - JPanel second = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - second.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + ":")); + private JPanel initButtonPanel() { + UIButton button1 = createVerButtonPane(NO_BORDERS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No")); + UIButton button2 = createVerButtonPane(EXTERNAL_BORDERS, ""); + UIButton button3 = createVerButtonPane(INSIDE_BORDERS, ""); + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(button1); + buttonGroup.add(button2); + buttonGroup.add(button3); + return row(cell(button1), cell(button2), cell(button3)).getComponent(); + } - second.add(this.currentLineColorPane); - rightTopPane.add(second, BorderLayout.CENTER); - this.currentLineColorPane.setSelectObject(Color.BLACK); - this.add(northPane, BorderLayout.NORTH); - this.add(centerPane, BorderLayout.CENTER); + private Component initNorthPanel() { + return FineUIUtils.wrapComponentWithTitle(column( + 10, row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style"))).weight(0.1), + cell(this.currentLineCombo).weight(0.25), + flex(0.5)), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"))).weight(0.1), + cell(this.currentLineColorPane).weight(0.25), + flex(0.5)) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Line")); } public void addChangeListener(ChangeListener changeListener) { @@ -186,15 +156,16 @@ public class BorderPane extends BasicPane { } } - private JPanel createVerButtonPane(int display, String text) { + private UIButton createVerButtonPane(int display, String text) { JPanel verPane = new JPanel(); - verPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.CENTER, 2, 2)); BorderButton button = new BorderButton(display); + if (StringUtils.isNotEmpty(text)) { + button.setText(text); + } verPane.add(button); - verPane.add(new UILabel(text)); insidebutton = button; - return verPane; + return button; } private void refreshAllToggleButtons() { @@ -206,14 +177,6 @@ public class BorderPane extends BasicPane { rightToggleButton.setSelected(this.cellBorderStyle.getRightStyle() != Constants.LINE_NONE); } - public CellBorderStyle getCellBorderStyle() { - return this.cellBorderStyle; - } - - public void setCellBorderStyle(CellBorderStyle cellBorderStyle) { - this.cellBorderStyle = cellBorderStyle; - } - @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"); @@ -282,11 +245,18 @@ public class BorderPane extends BasicPane { private class ToggleButton extends JToggleButton implements ActionListener { private int borderType = 0; - public ToggleButton(Icon icon, int borderType) { + /** + * 根据水平 或者 垂直布局设置控件大小 + */ + public ToggleButton(Icon icon, int borderType, boolean horizontal) { super(icon); this.borderType = borderType; - this.setPreferredSize(new Dimension(32, 32)); + if (horizontal) { + this.setPreferredSize(new Dimension(40, 24)); + } else { + this.setPreferredSize(new Dimension(24, 40)); + } this.addActionListener(this); } @@ -346,7 +316,7 @@ public class BorderPane extends BasicPane { this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_format/in.png")); } this.addActionListener(this); - setPreferredSize(new Dimension(32, 32)); + setPreferredSize(new Dimension(36, 24)); setFocusPainted(false); } diff --git a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java index 04b285fd56..8e47e3087f 100644 --- a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java @@ -3,34 +3,31 @@ */ package com.fr.design.style; +import com.fine.theme.utils.FineUIScale; import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.color.ColorSelectBox; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.DesignUtils; import com.fr.general.DefaultValues; import com.fr.general.FRFont; import com.fr.stable.CoreConstants; import javax.swing.BorderFactory; import javax.swing.Box; -import javax.swing.JComponent; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import javax.swing.event.EventListenerList; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; @@ -38,17 +35,24 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Pane to edit Font. */ public class FRFontPane extends BasicPane { - private FontFamilyPane familyPane; private FontSizeStylePane fontSizeStylePane; //foreground. private ColorSelectBox foregroundColorPane; + private UIComboBox fontNameComboBox; + //underline private LineComboBox underlineCombo; @@ -76,88 +80,37 @@ public class FRFontPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); - - // 纵向布局 放置list 和 下划线 颜色 - JPanel listVPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(listVPane, BorderLayout.NORTH); - - JPanel listHPane =FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - listVPane.add(listHPane); // 名字 - familyPane = new FontFamilyPane(); - listHPane.add(familyPane); + fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); + this.fontNameComboBox.addActionListener(actionListener); // 字形和大小 fontSizeStylePane = new FontSizeStylePane(); - listHPane.add(fontSizeStylePane); - - fontSizeStylePane.getStyleList().addListSelectionListener(listSelectionListener); - - //Richie:直接输入FRFont的size. - fontSizeStylePane.getSizeField().getDocument().addDocumentListener(documentListener); - fontSizeStylePane.getSizeField().getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) {// 这是更改操作的处理 - updatePreviewLabel(); - } - - public void insertUpdate(DocumentEvent e) {// 这是插入操作的处理 - updatePreviewLabel(); - } - - public void removeUpdate(DocumentEvent e) {// 这是删除操作的处理 - updatePreviewLabel(); - } - }); - - fontSizeStylePane.getSizeList().addListSelectionListener(listSelectionListener); // 下划线 和 颜色 - JPanel listVBottomPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - listVPane.add(listVBottomPane); - - - // underline pane - JPanel underlinePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - listVBottomPane.add(underlinePane); - underlinePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FRFont_Underline"), null)); - this.underlineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.underlineCombo.addActionListener(actionListener); - underlinePane.add(this.underlineCombo, BorderLayout.CENTER); - - // foreground - JPanel foregroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - listVBottomPane.add(foregroundPane); - - foregroundPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Foreground"),null)); foregroundColorPane = new ColorSelectBox(140); foregroundColorPane.addSelectChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { fireStateChanged(); } }); - foregroundPane.add(foregroundColorPane, BorderLayout.WEST); - // center pane - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(centerPane, BorderLayout.CENTER); - centerPane.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - - // other reportFont dialog - JPanel otherFontPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(otherFontPane, BorderLayout.WEST); -// otherFontPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + initCheckbox(); + // preview pane. + preview = new FRFontPreviewArea(); + preview.setPreferredSize(FineUIScale.scale(new Dimension(640, 240))); - // effects pane - JPanel effectsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - otherFontPane.add(effectsPane, BorderLayout.CENTER); -// effectsPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - effectsPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Effects"),null)); + //peteter:这里主动从Context, 获得默认的FRFont的值. + DefaultValues defaultValues = FRContext.getDefaultValues(); + populate(defaultValues.getFRFont()); - JPanel effectsPane2 = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - effectsPane.add(effectsPane2, BorderLayout.NORTH); + addCenterPanel(); + } + private void initCheckbox() { isStrikethroughCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Strikethrough") + " "); isStrikethroughCheckBox.addChangeListener(changeListener); isStrikethroughCheckBox.setMnemonic('K'); @@ -170,23 +123,6 @@ public class FRFontPane extends BasicPane { isSubscriptCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Subscript")); isSubscriptCheckBox.addChangeListener(changeListener); isSubscriptCheckBox.setMnemonic('B'); - - effectsPane2.add(this.getLeftJustPane(isStrikethroughCheckBox)); - effectsPane2.add(this.getLeftJustPane(isShadowCheckBox)); - effectsPane2.add(this.getLeftJustPane(isSuperscriptCheckBox)); - effectsPane2.add(this.getLeftJustPane(isSubscriptCheckBox)); - - // right pane - JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(rightPane, BorderLayout.CENTER); - -// rightPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - // preview pane. - preview = new FRFontPreviewArea(); - preview.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))); - rightPane.add(preview, BorderLayout.CENTER); - // Cannot select superscript and subscript in the same time. this.isSuperscriptCheckBox.addChangeListener(changeListener); this.isSuperscriptCheckBox.addChangeListener(new ChangeListener() { @@ -204,10 +140,34 @@ public class FRFontPane extends BasicPane { } } }); + } - //peteter:这里主动从Context, 获得默认的FRFont的值. - DefaultValues defaultValues = FRContext.getDefaultValues(); - populate(defaultValues.getFRFont()); + private void addCenterPanel() { + add(column(10, + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FRFont_Family"))).weight(0.1), + cell(fontNameComboBox).weight(0.2), + flex(0.4) + ), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"))).weight(0.1), + cell(fontSizeStylePane.fontComboBox).weight(0.25), + fix(5), + cell(fontSizeStylePane.fontSizeComboBox).weight(0.2), + flex(0.15) + ), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FRFont_Underline"))).weight(0.1), + cell(underlineCombo).weight(0.2), + flex(0.4) + ), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Foreground"))).weight(0.1), + cell(foregroundColorPane).weight(0.2), + flex(0.4) + ), + row(cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Effects"))).weight(0.1), + row(cell(this.isStrikethroughCheckBox), fix(5), cell(this.isShadowCheckBox), fix(5), + cell(this.isSuperscriptCheckBox), fix(5), cell(this.isSubscriptCheckBox), flex()).weight(0.6) + ), + column(5, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), cell(preview)) + ).getComponent()); } public void addChangeListener(ChangeListener changeListener) { @@ -242,37 +202,6 @@ public class FRFontPane extends BasicPane { } }; - ListSelectionListener listSelectionListener = new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - fireStateChanged(); - } - }; - - DocumentListener documentListener = new DocumentListener() { - public void changedUpdate(DocumentEvent e) { - fireStateChanged(); - } - - public void insertUpdate(DocumentEvent e) { - fireStateChanged(); - } - - public void removeUpdate(DocumentEvent e) { - fireStateChanged(); - } - }; - - //use the method to make all checkbox donot margin == 0. - private JPanel getLeftJustPane(JComponent comp) { - JPanel leftJustPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); -// leftJustPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - leftJustPane.add(comp, BorderLayout.CENTER); - - leftJustPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - - return leftJustPane; - } - @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sytle_FRFont"); @@ -282,9 +211,24 @@ public class FRFontPane extends BasicPane { * Use font to populate pane. */ public void populate(FRFont frFont) { - familyPane.populate(frFont); - fontSizeStylePane.populate(frFont); + this.fontNameComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + updatePreviewLabel(); + } + }); + + this.fontSizeStylePane.fontComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + updatePreviewLabel(); + } + }); + + this.fontSizeStylePane.fontSizeComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + updatePreviewLabel(); + } + }); //foreground. this.foregroundColorPane.setSelectObject(frFont.getForeground()); @@ -297,12 +241,6 @@ public class FRFontPane extends BasicPane { this.isSuperscriptCheckBox.setSelected(frFont.isSuperscript()); this.isSubscriptCheckBox.setSelected(frFont.isSubscript()); - //添加ListHandler. - ListHandler listHandler = new ListHandler(); - - familyPane.addListSelectionListener(listHandler); - fontSizeStylePane.getStyleList().addListSelectionListener(listHandler); - fontSizeStylePane.getSizeList().addListSelectionListener(listHandler); //actionlistner ActionListener updatePreviewActionListener = new ActionListener() { @@ -336,13 +274,13 @@ public class FRFontPane extends BasicPane { * Update pane to get new font. */ public FRFont update() { - double fs = fontSizeStylePane.getSizeField().getValue(); + double fs = (double)((int)fontSizeStylePane.fontSizeComboBox.getSelectedItem()); if (!(fs + "").endsWith(".5")) { fs = (int)fs; } - return FRFont.getInstance(this.familyPane.getText(), - this.fontSizeStylePane.getStyleList().getSelectedIndex(), - (float)fs, + return FRFont.getInstance((String) this.fontNameComboBox.getSelectedItem(), + this.fontSizeStylePane.fontComboBox.getSelectedIndex(), + (float)((int)fontSizeStylePane.fontSizeComboBox.getSelectedItem()), this.foregroundColorPane.getSelectObject(), this.underlineCombo.getSelectedLineStyle(), @@ -393,10 +331,4 @@ public class FRFontPane extends BasicPane { private void updatePreviewLabel() { preview.setFontObject(this.update()); } - - class ListHandler implements ListSelectionListener { - public void valueChanged(ListSelectionEvent evt) { - updatePreviewLabel(); - } - } } diff --git a/designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java b/designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java index ba496ae138..7213c819cd 100644 --- a/designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java @@ -1,6 +1,8 @@ package com.fr.design.style; import com.fr.base.Utils; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.DesignUtils; @@ -13,32 +15,35 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.BorderLayout; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + public class FontFamilyPane extends JPanel { private UITextField familyField; private JList familyList; + private UIComboBox familyComBox; + public FontFamilyPane() { this.init(); } private void init() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setLayout(new BorderLayout()); // 名字 familyField = new UITextField(); familyField.setEditable(false); familyList = new JList(DesignUtils.getAvailableFontFamilyNames4Report()); familyList.setVisibleRowCount(4); - - familyList.addListSelectionListener(listener); - - JPanel familyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); -// familyPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - familyPane.add(FRFontPane.createTextFieldListPane("", familyField, familyList), BorderLayout.CENTER); - familyPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FRFont_Family"),null)); + familyComBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); - this.add(familyPane); + familyList.addListSelectionListener(listener); + this.add(row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FRFont_Family"))).weight(0.1), + cell(familyComBox).weight(0.4) + ).getComponent()); } ListSelectionListener listener = new ListSelectionListener() { diff --git a/designer-base/src/main/java/com/fr/design/style/FontSizeStylePane.java b/designer-base/src/main/java/com/fr/design/style/FontSizeStylePane.java index 2fa5acf578..924c1129a1 100644 --- a/designer-base/src/main/java/com/fr/design/style/FontSizeStylePane.java +++ b/designer-base/src/main/java/com/fr/design/style/FontSizeStylePane.java @@ -7,6 +7,8 @@ import javax.swing.JPanel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -14,25 +16,22 @@ import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + public class FontSizeStylePane extends JPanel { - private UINumberField sizeField; - private JList sizeList; - private UITextField styleField; - private JList styleList; - + + public UIComboBox fontComboBox; + public UIComboBox fontSizeComboBox; + public FontSizeStylePane() { this.init(); } private void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel fontVSizPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); - this.add(fontVSizPane); - -// fontVSizPane.setLayout(new BoxLayout(fontVSizPane, BoxLayout.X_AXIS)); - fontVSizPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"), null)); String[] styles = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Plain"), @@ -40,67 +39,15 @@ public class FontSizeStylePane extends JPanel { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Italic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Bold_Italic")}; - styleField = new UITextField(); - styleField.setEditable(false); - - styleList = new JList(styles); - styleList.setVisibleRowCount(4); - - JPanel stylePanel = FRFontPane.createTextFieldListPane("", styleField, styleList); - fontVSizPane.add(stylePanel); - - fontVSizPane.add(Box.createHorizontalStrut(6)); + fontComboBox = new UIComboBox(styles); + fontSizeComboBox = new UIComboBox(FRFontPane.Font_Sizes); - JPanel sizePanel = FRFontPane.createTextFieldListPane("", sizeField = new UINumberField(), sizeList = new JList(FRFontPane.Font_Sizes)); - sizeField.setMaxDecimalLength(1); - - sizeField.setEditable(false); - - sizeList.setVisibleRowCount(4); - - fontVSizPane.add(sizePanel); - - styleField.setText((String) styleList.getSelectedValue()); - - sizeList.addListSelectionListener(listener); - styleList.addListSelectionListener(listener); - + this.add(row( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"))).weight(0.1), + cell(fontComboBox).weight(0.2), + cell(fontSizeComboBox).weight(0.2), + flex(0.2) + ).getComponent()); } - - ListSelectionListener listener = new ListSelectionListener() { - public void valueChanged(ListSelectionEvent evt) { - Object source = evt.getSource(); - if (source == getSizeList()) { - Integer size = (Integer) getSizeList().getSelectedValue(); - if (size != null) { - getSizeField().setValue(size.intValue()); - } - } else if (source == getStyleList()) { - String style = (String) getStyleList().getSelectedValue(); - if (style != null) getStyleField().setText(style); - } - } - }; - - public UINumberField getSizeField() { - return sizeField; - } - - public JList getStyleList() { - return styleList; - } - - public JList getSizeList() { - return sizeList; - } - - public UITextField getStyleField() { - return styleField; - } - - public void populate(FRFont frFont) { - styleList.setSelectedIndex(frFont.getStyle()); - sizeList.setSelectedValue(new Integer(frFont.getSize()), true); - sizeField.setValue(frFont.getSize2D()); - } } diff --git a/designer-base/src/main/java/com/fr/design/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/style/FormatPane.java index f1d7a086bd..66316d83b0 100644 --- a/designer-base/src/main/java/com/fr/design/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FormatPane.java @@ -3,6 +3,7 @@ */ package com.fr.design.style; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.FRContext; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; @@ -40,6 +41,10 @@ import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性界面中的格式面板 */ @@ -81,43 +86,17 @@ public class FormatPane extends BasicPane { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); //sample pane - JPanel samplePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(samplePane, BorderLayout.NORTH); - samplePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"), null)); - samplePane.setLayout(FRGUIPaneFactory.createBorderLayout()); sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); - samplePane.add(sampleLabel, BorderLayout.CENTER); sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); - //left control pane - JPanel leftControlPane =FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - this.add(leftControlPane, BorderLayout.WEST); - leftControlPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Format_Category"), null)); initRadioButton(); - ButtonGroup categoryButtonGroup = new ButtonGroup(); - categoryButtonGroup.add(nullRadioButton); - categoryButtonGroup.add(numberRadioButton); - categoryButtonGroup.add(currencyRadioButton); - categoryButtonGroup.add(percentRadioButton); - categoryButtonGroup.add(thousandthsRadioButton); - categoryButtonGroup.add(scientificRadioButton); - categoryButtonGroup.add(dateRadioButton); - categoryButtonGroup.add(timeRadioButton); - categoryButtonGroup.add(textRadioButton); + initRadioButtonGroup(); + //left control pane + JPanel leftControlPane = initLeftControlPane(); - leftControlPane.add(this.createRadioCenterPane(nullRadioButton)); - leftControlPane.add(this.createRadioCenterPane(numberRadioButton)); - leftControlPane.add(this.createRadioCenterPane(currencyRadioButton)); - leftControlPane.add(this.createRadioCenterPane(percentRadioButton)); - leftControlPane.add(this.createRadioCenterPane(thousandthsRadioButton)); - leftControlPane.add(this.createRadioCenterPane(scientificRadioButton)); - leftControlPane.add(this.createRadioCenterPane(dateRadioButton)); - leftControlPane.add(this.createRadioCenterPane(timeRadioButton)); - leftControlPane.add(this.createRadioCenterPane(textRadioButton)); //content pane. JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(contentPane, BorderLayout.CENTER); contentPane.setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0)); patternTextField = new UITextField(); contentPane.add(patternTextField, BorderLayout.NORTH); @@ -128,6 +107,16 @@ public class FormatPane extends BasicPane { //init values. nullRadioButton.setSelected(true); this.applyRadioActionListener(this.nullRadioButton); + + this.add(column( + 10, + cell(FineUIUtils.wrapComponentWithTitle(sampleLabel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Sample"))), + row( + 10, + cell(FineUIUtils.wrapComponentWithTitle(leftControlPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Format_Category"))).weight(0.1), + cell(contentPane).weight(0.5) + ) + ).getComponent()); } private void initRadioButton () { @@ -161,6 +150,32 @@ public class FormatPane extends BasicPane { textRadioButton.addActionListener(radioActionListener); } + private void initRadioButtonGroup() { + ButtonGroup categoryButtonGroup = new ButtonGroup(); + categoryButtonGroup.add(nullRadioButton); + categoryButtonGroup.add(numberRadioButton); + categoryButtonGroup.add(currencyRadioButton); + categoryButtonGroup.add(percentRadioButton); + categoryButtonGroup.add(thousandthsRadioButton); + categoryButtonGroup.add(scientificRadioButton); + categoryButtonGroup.add(dateRadioButton); + categoryButtonGroup.add(timeRadioButton); + categoryButtonGroup.add(textRadioButton); + } + + private JPanel initLeftControlPane() { + JPanel leftControlPane =FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + leftControlPane.add(this.createRadioCenterPane(nullRadioButton)); + leftControlPane.add(this.createRadioCenterPane(numberRadioButton)); + leftControlPane.add(this.createRadioCenterPane(currencyRadioButton)); + leftControlPane.add(this.createRadioCenterPane(percentRadioButton)); + leftControlPane.add(this.createRadioCenterPane(thousandthsRadioButton)); + leftControlPane.add(this.createRadioCenterPane(scientificRadioButton)); + leftControlPane.add(this.createRadioCenterPane(dateRadioButton)); + leftControlPane.add(this.createRadioCenterPane(timeRadioButton)); + leftControlPane.add(this.createRadioCenterPane(textRadioButton)); + return leftControlPane; + } /** * Create radio center pane. */ diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundButtonPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundButtonPane.java index 2ffe5ccadb..4dd7ebab4d 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundButtonPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundButtonPane.java @@ -19,7 +19,7 @@ public class BackgroundButtonPane extends BackgroundPane { for (Class key : BackgroundFactory.buttonKindsOfKey()) { BackgroundUIWrapper wrapper = BackgroundFactory.getButtonWrapper(key); wrapper.setIndex(index++); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + tabbedPaneBuilder.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), getTabItemPaneByIndex(wrapper.getIndex())); } } @@ -31,11 +31,7 @@ public class BackgroundButtonPane extends BackgroundPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createButtonIfAbsent(background == null ? null : background.getClass()); - quickPane.addChangeListener(backgroundChangeListener); - cacheMap.put(index, quickPane); } - tabbedPane.setComponentAt(index, quickPane); - tabbedPane.setSelectedIndex(index); return quickPane; } @@ -43,9 +39,7 @@ public class BackgroundButtonPane extends BackgroundPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createButtonIfAbsent(index); - tabbedPane.setComponentAt(index, quickPane); cacheMap.put(index, quickPane); - quickPane.addChangeListener(backgroundChangeListener); } return quickPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java index ed8afc9e4d..9eb384ab55 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java @@ -47,7 +47,7 @@ public class BackgroundCardSwitchButtonPane extends BackgroundButtonPane { for (Class key : cardSwitchButton.keySet()) { BackgroundUIWrapper wrapper = cardSwitchButton.get(key); wrapper.setIndex(index++); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + tabbedPaneBuilder.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), getTabItemPaneByIndex(wrapper.getIndex())); } } @@ -63,11 +63,8 @@ public class BackgroundCardSwitchButtonPane extends BackgroundButtonPane { if (quickPane == null) { BackgroundUIWrapper uiWrapper = getBackgroundUIWrapper(background); quickPane = BackgroundFactory.createByWrapper(uiWrapper); - quickPane.addChangeListener(backgroundChangeListener); cacheMap.put(index, quickPane); } - tabbedPane.setComponentAt(index, quickPane); - tabbedPane.setSelectedIndex(index); return quickPane; } @@ -76,9 +73,7 @@ public class BackgroundCardSwitchButtonPane extends BackgroundButtonPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = createDetailPaneByIndex(index); - tabbedPane.setComponentAt(index, quickPane); cacheMap.put(index, quickPane); - quickPane.addChangeListener(backgroundChangeListener); } return quickPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java index ebaf04e32a..390b77c39f 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java @@ -3,13 +3,12 @@ */ package com.fr.design.style.background; -import java.awt.BorderLayout; import java.awt.Dimension; import java.util.HashMap; import java.util.Map; import com.fr.base.background.ColorBackground; -import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.frpane.FineTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -23,10 +22,14 @@ import com.fr.design.style.background.impl.ColorNoThemeBackgroundPane; import com.fr.general.Background; import com.fr.log.FineLoggerFactory; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + public class BackgroundPane extends BasicPane { - protected UITabbedPane tabbedPane = null; + protected FineTabbedPane.TabPaneBuilder tabbedPaneBuilder = new FineTabbedPane.TabPaneBuilder(); + protected FineTabbedPane tabbedPane = null; private EventListenerList eventChangeList = new EventListenerList(); protected Map cacheMap = new HashMap<>(); @@ -42,21 +45,12 @@ public class BackgroundPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - previewPane = new BackgroundPreviewLabel(); - previewPane.addBackgroundChangeListener(new ChangeListener() { - - public void stateChanged(ChangeEvent e) { - fireStateChanged(); - } - }); - tabbedPane = new UITabbedPane(); - this.add(tabbedPane, BorderLayout.CENTER); - initTabPane(); + tabbedPane = tabbedPaneBuilder.withHeadRatio(0.65f).build(); - tabbedPane.addChangeListener(backgroundChangeListener); - tabbedPane.setPreferredSize(new Dimension(200, 210)); + add(column( + cell(tabbedPane) + ).getComponent()); } protected void initTabPane() { @@ -64,7 +58,7 @@ public class BackgroundPane extends BasicPane { for (Class key : BackgroundFactory.kindsOfKey()) { BackgroundUIWrapper wrapper = BackgroundFactory.getWrapper(key); wrapper.setIndex(index++); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + tabbedPaneBuilder.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), getTabItemPaneByIndex(wrapper.getIndex())); } } @@ -98,11 +92,8 @@ public class BackgroundPane extends BasicPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createIfAbsent(background == null ? null : background.getClass()); - quickPane.addChangeListener(backgroundChangeListener); cacheMap.put(index, quickPane); } - tabbedPane.setComponentAt(index, quickPane); - tabbedPane.setSelectedIndex(index); return quickPane; } @@ -110,9 +101,7 @@ public class BackgroundPane extends BasicPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createIfAbsent(index); - tabbedPane.setComponentAt(index, quickPane); cacheMap.put(index, quickPane); - quickPane.addChangeListener(backgroundChangeListener); } return quickPane; } @@ -129,9 +118,6 @@ public class BackgroundPane extends BasicPane { int index = wrapper.getIndex(); BackgroundDetailPane quickPane = getTabItemPane(background, index); quickPane.populate(background); - - tabbedPane.doLayout(); - tabbedPane.validate(); } protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) { @@ -151,16 +137,5 @@ public class BackgroundPane extends BasicPane { } return null; } - /** - * Change listener. - */ - protected ChangeListener backgroundChangeListener = new ChangeListener() { - - public void stateChanged(ChangeEvent evt) { - previewPane.setBackgroundObject(update()); - previewPane.repaint(); - } - }; - private BackgroundPreviewLabel previewPane = null; } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane4Browser.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane4Browser.java index d6cae505b5..8aca7bac53 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane4Browser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane4Browser.java @@ -18,7 +18,7 @@ public class BackgroundPane4Browser extends BackgroundPane { for (Class key : BackgroundFactory.browserKindsOfKey()) { BackgroundUIWrapper wrapper = BackgroundFactory.getBrowserWrapper(key); wrapper.setIndex(index++); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + tabbedPaneBuilder.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), getTabItemPaneByIndex(wrapper.getIndex())); } } @@ -30,11 +30,8 @@ public class BackgroundPane4Browser extends BackgroundPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createBrowserIfAbsent(background == null ? null : background.getClass()); - quickPane.addChangeListener(backgroundChangeListener); cacheMap.put(index, quickPane); } - tabbedPane.setComponentAt(index, quickPane); - tabbedPane.setSelectedIndex(index); return quickPane; } @@ -42,9 +39,7 @@ public class BackgroundPane4Browser extends BackgroundPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = BackgroundFactory.createBrowserIfAbsent(index); - tabbedPane.setComponentAt(index, quickPane); cacheMap.put(index, quickPane); - quickPane.addChangeListener(backgroundChangeListener); } return quickPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundTabPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundTabPane.java index 08d2a2e6a4..3e58ac12a3 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundTabPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundTabPane.java @@ -44,7 +44,7 @@ public class BackgroundTabPane extends BackgroundPane { for (Class key : tabpane.keySet()) { BackgroundUIWrapper wrapper = tabpane.get(key); wrapper.setIndex(index++); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + tabbedPaneBuilder.addTab(com.fr.design.i18n.Toolkit.i18nText(wrapper.getTitle()), getTabItemPaneByIndex(wrapper.getIndex())); } } @@ -57,11 +57,8 @@ public class BackgroundTabPane extends BackgroundPane { if (quickPane == null) { BackgroundUIWrapper uiWrapper = getBackgroundUIWrapper(background); quickPane = BackgroundFactory.createByWrapper(uiWrapper); - quickPane.addChangeListener(backgroundChangeListener); cacheMap.put(index, quickPane); } - tabbedPane.setComponentAt(index, quickPane); - tabbedPane.setSelectedIndex(index); return quickPane; } @@ -69,9 +66,7 @@ public class BackgroundTabPane extends BackgroundPane { BackgroundDetailPane quickPane = cacheMap.get(index); if (quickPane == null) { quickPane = createDetailPaneByIndex(index); - tabbedPane.setComponentAt(index, quickPane); cacheMap.put(index, quickPane); - quickPane.addChangeListener(backgroundChangeListener); } return quickPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java index 1cbf543a4b..d26f837737 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.gradient; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.background.GradientBackground; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; @@ -20,6 +21,12 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 渐变色的面板,不是很pp,面板应用显得繁琐,有写可以写成控件类型,比如色彩选择的。。,可以做得花哨点 * @author ben @@ -33,45 +40,44 @@ public class GradientBackgroundPane extends BackgroundDetailPane { private ChangeListener changeListener = null; public GradientBackgroundPane() { - - // bug 5452 简化GradientPane - JPanel jpanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Background_Choose_Gradient_Color")); - jpanel.setPreferredSize(new Dimension(450, 320)); - jpanel.setLayout(new BorderLayout()); - // neil:增加渐变色拖动条 - JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel blankJp = new JPanel(); gradientBar = new GradientBar(4, DEFAULT_GRADIENT_WIDTH); - blankJp.add(gradientBar); - UILabel jl = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); - jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); - jl.setHorizontalAlignment(SwingConstants.CENTER); - gradientPanel.add(jl, BorderLayout.NORTH); - gradientPanel.add(blankJp, BorderLayout.SOUTH); - jpanel.add(gradientPanel, BorderLayout.NORTH); - - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - JPanel innercenterPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - centerPane.add(new UILabel(" ")); - centerPane.add(innercenterPane); - innercenterPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Direction") + ":")); left2right = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_Horizontal")); - innercenterPane.add(left2right); left2right.setSelected(true); left2right.addActionListener(reviewListener); top2bottom = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_Vertical")); - innercenterPane.add(top2bottom); top2bottom.addActionListener(reviewListener); ButtonGroup toggle = new ButtonGroup(); toggle.add(left2right); toggle.add(top2bottom); - jpanel.add(centerPane, BorderLayout.CENTER); - this.add(jpanel); + JPanel jpanel = column( + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient"))), + flex() + ), + fix(100), + row( + flex(), + cell(gradientBar), + flex() + ), + fix(100), + row( + 5, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Direction") + ":")), + cell(left2right), + cell(top2bottom), + flex() + + ) + ).getComponent(); + + jpanel.setPreferredSize(new Dimension(600, 450)); + this.add(FineUIUtils.wrapComponentWithTitle(jpanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Background_Choose_Gradient_Color"))); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java index 8f91686764..0015daaf2c 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/BPane.java @@ -1,11 +1,15 @@ package com.fr.design.style.background.impl; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundDetailPane; import javax.swing.*; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * Created by richie on 16/5/18. */ @@ -18,20 +22,16 @@ public abstract class BPane extends BackgroundDetailPane { protected void initComponents(int nColumn) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); - - JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(contentPane, BorderLayout.NORTH); -// contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); - - // type type. - - JPanel typePane = FRGUIPaneFactory.createTitledBorderPane(titleOfTypePane()); - contentPane.add(typePane); JPanel typePane2 = new JPanel(); - typePane.add(typePane2); typePane2.setLayout(layoutOfTypePane(nColumn)); setChildrenOfTypePane(typePane2); + JPanel contentPane = column( + 10, + cell(FineUIUtils.wrapComponentWithTitle(typePane2, titleOfTypePane())) + ).getComponent(); + this.add(contentPane, BorderLayout.NORTH); + setChildrenOfContentPane(contentPane); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java index 3eb990c318..8863236b90 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.impl; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Style; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; @@ -19,14 +20,20 @@ import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Image background pane. */ @@ -47,36 +54,35 @@ public class ImageBackgroundPane extends BackgroundDetailPane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); // preview pane - JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.add(previewContainerPane, BorderLayout.CENTER); - - JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); - previewOwnerPane.setLayout(new BorderLayout()); - previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); - previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); previewPane = new ImagePreviewPane(); - previewOwnerPane.add(new JScrollPane(previewPane)); previewPane.addChangeListener(imageSizeChangeListener); // init image file chooser. imageFileChooser = new ImageFileChooser(); imageFileChooser.setMultiSelectionEnabled(false); + + + this.add(column( + 5, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), + row( + 10, + cell(new JScrollPane(previewPane)).weight(0.65).with(it -> { + it.getViewport().setBackground(Color.WHITE); + it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor"))); + }), + cell(initSelectFilePane()).weight(0.1) + ).with(it -> it.setPreferredSize(new Dimension(it.getWidth(), 400))) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); } public JPanel initSelectFilePane() { - JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - - selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0)); UIButton selectPictureButton = new UIButton( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); - selectFilePane.add(selectPictureButton, BorderLayout.NORTH); selectPictureButton.setMnemonic('S'); selectPictureButton.addActionListener(selectPictureActionListener); - JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane(); - selectFilePane.add(layoutPane, BorderLayout.CENTER); - //布局 defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default")); tiledRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled")); @@ -92,16 +98,20 @@ public class ImageBackgroundPane extends BackgroundDetailPane { for (UIRadioButton button : imageLayoutButtons()) { jp.add(button); } - layoutPane.add(jp); - ButtonGroup layoutBG = new ButtonGroup(); layoutBG.add(defaultRadioButton); layoutBG.add(tiledRadioButton); layoutBG.add(extendRadioButton); layoutBG.add(adjustRadioButton); - defaultRadioButton.setSelected(true); - return selectFilePane; + return column( + 15, + cell(selectPictureButton), + column( + 15, + cell(jp) + ) + ).getComponent(); } protected UIRadioButton[] imageLayoutButtons() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java index f29ece0c01..8945e8c87f 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java @@ -19,10 +19,9 @@ public class NullBackgroundPane extends BackgroundDetailPane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel centerLabel = new UILabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Background_Is_Null") + "..."); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Background_Is_Null")); this.add(centerLabel); centerLabel.setHorizontalAlignment(SwingConstants.CENTER); - centerLabel.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); } public void populate(Background background) { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java index 886076ca08..56a90f0bc3 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.impl; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.GraphHelper; import com.fr.base.background.PatternBackground; import com.fr.design.gui.ilable.UILabel; @@ -16,6 +17,10 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Rectangle2D; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Pattern background pane. */ @@ -64,30 +69,27 @@ public class PatternBackgroundPane extends BPane { protected void setChildrenOfContentPane(JPanel contentPane) { // colors JPanel colorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors")); - contentPane.add(colorPane); foregroundColorPane = new ColorSelectBox(80); + foregroundColorPane.setPreferredSize(new Dimension(80, 24)); backgroundColorPane = new ColorSelectBox(80); + backgroundColorPane.setPreferredSize(new Dimension(80, 24)); foregroundColorPane.setSelectObject(Color.lightGray); backgroundColorPane.setSelectObject(Color.black); - - colorPane.add(Box.createHorizontalStrut(2)); - colorPane.add(this.createLabelColorPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Foreground") - + ":", foregroundColorPane)); - - colorPane.add(Box.createHorizontalStrut(8)); - - colorPane.add(this.createLabelColorPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background") - + ":", backgroundColorPane)); - } - - private JPanel createLabelColorPane(String text, - ColorSelectBox colorPane) { - JPanel labelColorPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - labelColorPane.add(new UILabel(text)); - labelColorPane.add(colorPane); - - return labelColorPane; + contentPane.add(FineUIUtils.wrapComponentWithTitle(row( + 10, + row( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Foreground") + ":")), + cell(foregroundColorPane) + ).weight(0.1), + row( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background") + ":")), + cell(backgroundColorPane) + ).weight(0.1), + flex(0.1) + ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors"))); } public void populate(Background background) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java index f5ff739fa6..6d982edc05 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java @@ -1,5 +1,6 @@ package com.fr.design.style.color; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.chart.base.ChartConstants; import com.fr.design.DesignerEnvManager; @@ -13,6 +14,7 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -36,7 +38,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver { public static final Color[] DEFAULT_COLORS = ChartConstants.NEW_FEATURES; - private static final int COUNT_OF_ROW = 8; + private static final int COUNT_OF_ROW = 20; private static final int MAX_BUTTON = 40; @@ -81,10 +83,10 @@ public class ColorAdjustPane extends JPanel implements UIObserver { private void createContentPane() { VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0); layout.setAlignLeft(true); - this.setLayout(layout); + this.setLayout(new BorderLayout()); for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) { - JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 2); int count = i + COUNT_OF_ROW > colorButtons.size() ? colorButtons.size() : i + COUNT_OF_ROW; for (int j = i; j < count; j++) { colorButtons.get(j).setLastButton(false); @@ -124,6 +126,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver { }; colorButton.addChangeListener(changeListener); + colorButton.setBorder(new ScaledEmptyBorder(0, 0, 0, 15)); return colorButton; } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java index 3756fc627e..9c08d62ef9 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java @@ -1,6 +1,11 @@ package com.fr.design.style.color; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.FineTabbedPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,6 +16,10 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.i18n.Toolkit.i18nText; /** @@ -26,9 +35,6 @@ public class ColorSelectDetailPane extends BasicPane { // 颜色选择器面板 private JColorChooser selectedPanel; - // 最近使用颜色面板 - private JPanel recentUsePanel; - // 预览 private JPanel previewPanel; @@ -76,20 +82,12 @@ public class ColorSelectDetailPane extends BasicPane { swatchChooserPanel = new SwatchChooserPanel(); customChooserPanel = new CustomChooserPanel(); selectedPanel.setChooserPanels(new AbstractColorChooserPanel[]{customChooserPanel, swatchChooserPanel}); - this.add(selectedPanel, BorderLayout.NORTH); - - // 最近使用面板 - recentUsePanel = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Used")); - RecentUseColorPane recent = new RecentUseColorPane(selectedPanel); - recentUsePanel.add(recent); - - this.add(recentUsePanel, BorderLayout.CENTER); - selectedPanel.setPreviewPanel(new JPanel()); // 预览 - previewPanel = FRGUIPaneFactory.createTitledBorderPaneCenter(i18nText("Fine-Design_Basic_Preview")); + previewPanel = new JPanel(new BorderLayout()); final ColorChooserPreview colorChooserPreview = new ColorChooserPreview(); + colorChooserPreview.setBackground(Color.WHITE); ColorSelectionModel model = selectedPanel.getSelectionModel(); model.addChangeListener(new ChangeListener() { @Override @@ -99,8 +97,42 @@ public class ColorSelectDetailPane extends BasicPane { colorChooserPreview.repaint(); } }); - previewPanel.add(colorChooserPreview); - this.add(previewPanel, BorderLayout.SOUTH); + previewPanel.add(row( + flex(), + column(flex(), cell(colorChooserPreview), flex()), + flex() + ).getComponent()); + add(initCenterPane()); + } + + private FineTabbedPane buildTabbedPane() { + return FineTabbedPane.builder().withHeadRatio(0.3f) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), customChooserPanel) + .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Swatch"), swatchChooserPanel).build(); + } + + private JPanel initCenterPane() { + // 最近使用面板 + RecentUseColorPane recent = new RecentUseColorPane(selectedPanel); + UILabel label = new UILabel( i18nText("Fine-Design_Basic_Used")); + FineUIUtils.wrapBoldLabelWithUnderline(label); + + FineTabbedPane tabbedPane = buildTabbedPane(); + return column( + cell(tabbedPane), + column( + 10, + cell(label), cell(recent), + column( + 2, + cell(new UILabel(i18nText("Fine-Design_Basic_Preview"))), + cell(previewPanel).with(it -> { + it.setBorder(new FineRoundBorder()); + it.setPreferredSize(new Dimension(this.getPreferredSize().width, 120)); + it.setBackground(Color.WHITE); + }) + )).with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 10))) + ).getComponent(); } public void populate(Color color){ diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 95f2d7f36e..729159c731 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -29,6 +29,12 @@ import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.log.FineLoggerFactory; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 颜色选择器自定义面板 @@ -114,17 +120,17 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec /** * The default width of the gradient image. */ - private static final int IMG_WIDTH = 200; + private static final int IMG_WIDTH = 180; /** * The default height of the gradient image. */ - private static final int IMG_HEIGHT = 205; + private static final int IMG_HEIGHT = 180; /** * The default width of the track gradient. */ - private static final int TRACK_WIDTH = 20; + private static final int TRACK_WIDTH = 12; /** * The UILabel for Red. @@ -156,6 +162,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private static final int TWENTY_FOUR = 24; private static final int HEX_FF = 0xff; + private static final int BUTTON_SPINNER_GAP = 5; + private static final int HSB_GAP = 10; + // 占位label private static final UILabel PLACE_HOLDER_LABEL = new UILabel(); @@ -583,8 +592,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * This method builds the DefaultHSBChooserPanel. */ protected void buildChooser() { - setLayout(new BorderLayout()); - add(buildRightPanel(), BorderLayout.EAST); + setLayout(new BorderLayout(10, 0)); + setPreferredSize(new Dimension((int) this.getPreferredSize().getWidth(), 180)); + add(buildRightPanel(), BorderLayout.CENTER); JPanel container = new JPanel(); container.setLayout(new BorderLayout()); @@ -679,47 +689,50 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @return The right side panel. */ private Container buildRightPanel() { - JPanel container = new JPanel(); - container.setLayout(new FlowLayout(FlowLayout.RIGHT)); - - // 主面板 - JPanel mainPanel = new JPanel(); - mainPanel.setLayout(new BorderLayout(0, 10)); - UILabel label = new UILabel(); - label.setSize(200, 200); - container.add(label); - container.add(mainPanel); - - // hsb和rgb面板 - JPanel hsbAndRgbPanel = new JPanel(); - hsbAndRgbPanel.setLayout(new BorderLayout(0, 16)); - hsbAndRgbPanel.add(initialHSBPanel(), BorderLayout.CENTER); - hsbAndRgbPanel.add(initialRGBPanel(), BorderLayout.SOUTH); - - // 十六进制面板 - JPanel hexPanel = new JPanel(); - hexPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 0)); - hexPanel.add(new UILabel("#")); - hexPanel.add(field); - - mainPanel.add(hsbAndRgbPanel, BorderLayout.CENTER); - mainPanel.add(hexPanel, BorderLayout.SOUTH); - - JPanel rightPane = new JPanel(new BorderLayout()); + + JPanel container = new JPanel(new BorderLayout()); JButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); - JPanel blankArea = new JPanel(); - blankArea.setPreferredSize(new Dimension(100, 175)); - rightPane.add(blankArea, BorderLayout.CENTER); - JPanel buttonPane = new JPanel(new BorderLayout()); - buttonPane.add(pickColorButton, BorderLayout.WEST); - rightPane.add(buttonPane, BorderLayout.SOUTH); - container.add(rightPane); + container.add(column( + 10, + row( + 10, + cell(initialHSBPanel()), + cell(initialRGBPanel()), + flex() + ), + row( + BUTTON_SPINNER_GAP, + row(fix((int) hRadio.getPreferredSize().getHeight()), cell(new UILabel("#")), flex()).with(it -> it.setPreferredSize(hRadio.getPreferredSize())), + cell(field), + column( + flex(), + cell(pickColorButton), + flex() + ) + ) + ).getComponent()); return container; } //初始化HSB部分 private JPanel initialHSBPanel() { + initButtonGroup(); + initSpinner(); + MouseAdapter cl = new RadioStateListener(); + locked = HLOCKED; + hRadio.setSelected(true); + hRadio.addMouseListener(cl); + sRadio.addMouseListener(cl); + bRadio.addMouseListener(cl); + + return column(HSB_GAP, row(BUTTON_SPINNER_GAP, cell(hRadio), cell(hSpinner)), + row(BUTTON_SPINNER_GAP, cell(sRadio), cell(sSpinner)), + row(BUTTON_SPINNER_GAP, cell(bRadio), cell(bSpinner)) + ).getComponent(); + } + + private void initButtonGroup() { hRadio = new UIRadioButton("H"); sRadio = new UIRadioButton("S"); bRadio = new UIRadioButton("B"); @@ -727,54 +740,37 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec group.add(hRadio); group.add(sRadio); group.add(bRadio); + } + private void initSpinner() { hSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 359, 1)); + setBackground(hSpinner); sSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 100, 1)); + setBackground(sSpinner); bSpinner = new UIBasicSpinner(new SpinnerNumberModel(100, 0, 100, 1)); + setBackground(bSpinner); hSpinner.setEnabled(true); sSpinner.setEnabled(false); bSpinner.setEnabled(false); - MouseAdapter cl = new RadioStateListener(); - locked = HLOCKED; - hRadio.setSelected(true); - hRadio.addMouseListener(cl); - sRadio.addMouseListener(cl); - bRadio.addMouseListener(cl); - ChangeListener scroll = new ImageScrollListener(); hSpinner.addChangeListener(scroll); sSpinner.addChangeListener(scroll); bSpinner.addChangeListener(scroll); + } - JPanel hsbPanel = new JPanel(); - hsbPanel.setLayout(new GridLayout(3, 0, 0, 5)); - - JPanel hPanel = new JPanel(); - hPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - hPanel.add(hRadio); - hPanel.add(hSpinner); - hsbPanel.add(hPanel); - - JPanel sPanel = new JPanel(); - sPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - sPanel.add(sRadio); - sPanel.add(sSpinner); - hsbPanel.add(sPanel); - - JPanel lPanel = new JPanel(); - lPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - lPanel.add(bRadio); - lPanel.add(bSpinner); - hsbPanel.add(lPanel); - return hsbPanel; + private void setBackground(Component component) { + component.setBackground(Color.WHITE); } private JPanel initialRGBPanel() { // 初始化RGB部分 rSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); + setBackground(rSpinner); gSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); + setBackground(gSpinner); bbSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, 255, 1)); + setBackground(bbSpinner); rSpinner.setEnabled(true); gSpinner.setEnabled(true); @@ -784,31 +780,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec TextDocumentListener listen = new TextDocumentListener(); field = new UITextField(); - field.setPreferredSize(new Dimension(70, 18)); + field.setPreferredSize(new Dimension(hSpinner.getPreferredSize())); field.getDocument().addDocumentListener(listen); - JPanel rgbPanel = new JPanel(); - rgbPanel.setLayout(new GridLayout(3, 0, 0, 5)); - - JPanel rPanel = new JPanel(); - rPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - rPanel.add(R); - rPanel.add(rSpinner); - rgbPanel.add(rPanel); - - JPanel gPanel = new JPanel(); - gPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - gPanel.add(G); - gPanel.add(gSpinner); - rgbPanel.add(gPanel); - - JPanel bPanel = new JPanel(); - bPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - bPanel.add(B); - bPanel.add(bbSpinner); - rgbPanel.add(bPanel); - - return rgbPanel; + return column( + HSB_GAP, + row(BUTTON_SPINNER_GAP, cell(R), cell(rSpinner)), + row(BUTTON_SPINNER_GAP, cell(G), cell(gSpinner)), + row(BUTTON_SPINNER_GAP, cell(B), cell(bbSpinner)) + ).getComponent(); } /** diff --git a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java index 5d7e81487e..28fcadfab7 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java @@ -11,10 +11,12 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; -import javax.swing.BorderFactory; -import javax.swing.Box; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.gui.ilable.UILabel; + +import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -23,6 +25,10 @@ import com.fr.design.border.UITitledBorder; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * The detail color select pane. @@ -39,26 +45,12 @@ public class DetailColorSelectPane extends BasicPane { public DetailColorSelectPane(boolean supportTheme) { this.setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel titledefaultPane=FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color")); - JPanel defaultPane =FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); - this.add(titledefaultPane, BorderLayout.WEST); - titledefaultPane.add(defaultPane); - - defaultPane.add(Box.createHorizontalStrut(4)); - JPanel colorSelectContainPane =FRGUIPaneFactory.createBorderLayout_L_Pane(); - defaultPane.add(colorSelectContainPane); colorSelectPane = NewColorSelectPane.createColorSelectPaneWithTheme(supportTheme); - colorSelectContainPane.add(colorSelectPane, BorderLayout.NORTH); - - defaultPane.add(Box.createHorizontalStrut(8)); //color preview JPanel colorPreviewContainPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - defaultPane.add(colorPreviewContainPane); JPanel colorPreviewPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - colorPreviewPane.setPreferredSize(new Dimension(180, 60)); colorPreviewContainPane.add(colorPreviewPane, BorderLayout.NORTH); colorPreviewLabel = new UILabel(" ") { @@ -76,13 +68,26 @@ public class DetailColorSelectPane extends BasicPane { this.getFont().getStyle(), this.getFont().getSize() + 4)); colorPreviewLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 2, 2)); colorPreviewPane.add(colorPreviewLabel, BorderLayout.CENTER); - UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); - colorPreviewPane.setBorder(explainBorder); this.addChangeListener(colorPreviewLabelChangeListener); //use the white as the default color. this.populate(Color.WHITE); + + JPanel center = column( + 5, + row( + 20, + cell(colorSelectPane.transparentButton).weight(0.2), + cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + "")).weight(0.36) + ), + row( + 20, + cell(colorSelectPane.theme).weight(0.2).with(it -> it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor")))), + cell(colorPreviewPane).weight(0.36).with(it -> it.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIManager.getColor("defaultBorderColor")))) + ) + ).getComponent(); + this.add(FineUIUtils.wrapComponentWithTitle(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"))); } @Override diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 9b89f07768..54824dd0cc 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -1,6 +1,8 @@ package com.fr.design.style.color; +import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.FineColor; import com.fr.base.theme.FineColorDeriveState; @@ -26,13 +28,15 @@ import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; -import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * @author zhou @@ -59,6 +63,12 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private final JPanel menuColorPane; private ColorCell[][] themeColorCellGrid; + // 透明 + public UIButton transparentButton = new UIButton(); + // 主题 + public JPanel theme = new JPanel(); + + public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) { return new NewColorSelectPane(true, supportTheme); } @@ -82,34 +92,37 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { initSelectButton(isSupportTransparent); // center JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - centerPane.setBorder(new ScaledEmptyBorder(10, 6, 0, 6)); - this.add(centerPane, BorderLayout.CENTER); + centerPane.setOpaque(false); menuColorPane = getMenuColorPane(); if (isSupportThemeColor) { JPanel themePane = initThemeColorPane(); + themePane.setOpaque(false); + themePane.setBorder(new ScaledEmptyBorder(5, 6, 0, 6)); centerPane.add(themePane); } else { + menuColorPane.setBorder(new ScaledEmptyBorder(5, 6, 0, 6)); centerPane.add(menuColorPane); + menuColorPane.setOpaque(false); initMenuColorPane(); } JPanel standardColorPane = new JPanel(new BorderLayout(0, 5)); - standardColorPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); + standardColorPane.setBorder(new ScaledEmptyBorder(10, 6, 0, 6)); standardColorPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Standard_Color")), BorderLayout.CENTER); - centerPane.add(standardColorPane); JPanel colorSelectPane = createStandardColorPane(); standardColorPane.add(colorSelectPane, BorderLayout.SOUTH); + standardColorPane.setOpaque(false); // 增加最近使用 pane JPanel row1Pane = new JPanel(new BorderLayout(0, 5)); - row1Pane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); + row1Pane.setBorder(new ScaledEmptyBorder(10, 6, 0, 6)); row1Pane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Used")), BorderLayout.CENTER); - centerPane.add(row1Pane); // 最近使用 usedColorPane = new NewUsedColorPane(9, this, selectRealTime()); row1Pane.add(usedColorPane.getPane(), BorderLayout.SOUTH); + row1Pane.setOpaque(false); // mod by anchore 16/11/16 final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); @@ -127,9 +140,26 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); JPanel centerPane1 = new JPanel(new BorderLayout(0, 0)); - centerPane1.setBorder(new ScaledEmptyBorder(8, 0, 9, 0)); + centerPane1.setBorder(new ScaledEmptyBorder(10, 6, 6, 6)); centerPane1.add(customButton, BorderLayout.CENTER); - centerPane.add(centerPane1); + centerPane1.setOpaque(false); + + + theme = column( + cell(centerPane), + cell(standardColorPane), + cell(row1Pane), + cell(centerPane1) + ).with(it -> { + it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + it.setOpaque(true); + + if (!isSupportTransparent) { + it.setBorder(new FineRoundBorder()); + } + }).getComponent(); + + this.add(theme, BorderLayout.CENTER); } private JPanel createStandardColorPane() { @@ -154,6 +184,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { JPanel centerPane = new JPanel(new GridLayout(1, 8, DEFAULT_COLOR_HOR_INTERVAL, 0)); menuColorPane.add(northPane, BorderLayout.NORTH); menuColorPane.add(centerPane, BorderLayout.CENTER); + menuColorPane.setOpaque(false); + northPane.setOpaque(false); + centerPane.setOpaque(false); Color[] colorArray = new Color[]{ // 8列主题色 @@ -189,10 +222,11 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { northPane.add(themeColorCellGrid[i][0]); } for (int i = 0; i < colorArray.length; i++) { - JPanel columnPane = new JPanel(new GridLayout(DEFAULT_DERIVE_COUNT - 1, 1, 0, 0)); + JPanel columnPane = new JPanel(new GridLayout(DEFAULT_DERIVE_COUNT - 1, 1, 4, 4)); for (int j = 1; j < DEFAULT_DERIVE_COUNT; j++) { columnPane.add(themeColorCellGrid[i][j]); } + columnPane.setOpaque(false); centerPane.add(columnPane); } @@ -237,7 +271,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { Color[] colorArray = this.getColorArray(); for (int i = 0; i < colorArray.length; i++) { Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i]; - menuColorPane.add(new ColorCell(color, this)); + ColorCell c = new ColorCell(color, this); + c.setOpaque(false); + menuColorPane.add(c); } } @@ -257,11 +293,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { protected void initSelectButton(boolean isSupportTransparent) { this.isSupportTransparent = isSupportTransparent; this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); if (isSupportTransparent) { - UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); - this.add(transparentButton, BorderLayout.NORTH); + JPanel transparentJpanel = new JPanel(new BorderLayout(0, 0)); + transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); transparentButton.addActionListener(e -> doTransparent()); + transparentButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); + transparentJpanel.add(transparentButton, BorderLayout.CENTER); + transparentJpanel.setBorder(new ScaledEmptyBorder(6, 6, 6, 6)); + this.add(transparentJpanel, BorderLayout.NORTH); } } @@ -397,6 +436,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private void initialComponents() { int total = columns; JPanel panel = new JPanel(); + // 取色按钮 + JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); + panel.add(pickColorButton); panel.setLayout(new GridLayout(1, columns + 1, DEFAULT_COLOR_HOR_INTERVAL, 0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); //最近使用颜色 @@ -407,9 +449,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { UsedColorPane.DEFAULT_COLOR; panel.add(new ColorCell(color == null ? UsedColorPane.DEFAULT_COLOR : color, selectable)); } - // 取色按钮 - JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); - panel.add(pickColorButton); this.pane = panel; } @@ -420,7 +459,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { int total = columns; Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors(); int size = colors.length; - for (int i = 0; i < total; i++) { + for (int i = 1; i <= total; i++) { ColorCell cell = (ColorCell) this.pane.getComponent(i); Color color = i < size ? colors[size - i - 1] : UsedColorPane.DEFAULT_COLOR; cell.setColor(color == null ? UsedColorPane.DEFAULT_COLOR : color); diff --git a/designer-base/src/main/java/com/fr/design/style/color/RecentUseColorPane.java b/designer-base/src/main/java/com/fr/design/style/color/RecentUseColorPane.java index 1e6d7be885..116220afd9 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/RecentUseColorPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/RecentUseColorPane.java @@ -18,13 +18,10 @@ public class RecentUseColorPane extends BasicPane implements ColorSelectable { public RecentUseColorPane(JColorChooser chooser) { this.chooser = chooser; - - // center - JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(centerPane, BorderLayout.CENTER); // 最近使用 - UsedColorPane pane = new UsedColorPane(2, 10, this); - centerPane.add(pane.getPane()); + setLayout(new BorderLayout()); + UsedColorPane pane = new UsedColorPane(1, 20, this); + add(pane.getPane(), BorderLayout.WEST); } /** diff --git a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java index a48f33c164..8d12a47c59 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java @@ -65,7 +65,6 @@ public class UsedColorPane extends BasicPane { int total = columns * rows; JPanel panel = new JPanel(); panel.setLayout(new GridLayout(rows, columns, 1, 1)); - panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); //最近使用颜色 Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors(); int size = colors.length; diff --git a/designer-base/src/main/resources/com/fine/theme/icon/digitalPlatform.svg b/designer-base/src/main/resources/com/fine/theme/icon/digitalPlatform.svg new file mode 100644 index 0000000000..ca248de1d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/digitalPlatform.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/logo.svg b/designer-base/src/main/resources/com/fine/theme/icon/logo.svg new file mode 100644 index 0000000000..eb0f0815d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/logo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/pages.svg b/designer-base/src/main/resources/com/fine/theme/icon/pages.svg new file mode 100644 index 0000000000..afc2ecb557 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/pages.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/previewSql.svg b/designer-base/src/main/resources/com/fine/theme/icon/previewSql.svg new file mode 100644 index 0000000000..0dd74b8af5 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/previewSql.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/tables.svg b/designer-base/src/main/resources/com/fine/theme/icon/tables.svg new file mode 100644 index 0000000000..dd13c2e491 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/tables.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/time.svg b/designer-base/src/main/resources/com/fine/theme/icon/time.svg new file mode 100644 index 0000000000..41774b3bdb --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/time.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/views.svg b/designer-base/src/main/resources/com/fine/theme/icon/views.svg new file mode 100644 index 0000000000..3e4fe18362 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/views.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index cfcdb3c99a..4184e561b6 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -23,6 +23,13 @@ "up_arrow": "up_arrow.svg", "select": "select.svg", "recycle": "recycle.svg", + "time": "time.svg", + "logo": "logo.svg", + "pages": "pages.svg", + "digitalPlatform": "digitalPlatform.svg", + "tables": "tables.svg", + "views": "views.svg", + "preview_sql": "previewSql.svg", "database": "dataset/database.svg", "preview": "dataset/preview.svg", "connection": "dataset/connection.svg", @@ -46,6 +53,7 @@ "minus": "filetree/minus.svg", "plus": "filetree/plus.svg", "locate": "filetree/locate.svg", + "locate_disable": "filetree/locate_disable.svg", "rename": "filetree/rename.svg", "collapse_all": "filetree/collapse_all.svg", "vcs_list": "filetree/vcs_list.svg", diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index 72228e094d..be065a429b 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -1,5 +1,6 @@ package com.fr.design.module; +import com.fine.theme.light.ui.FineRoundBorder; import com.fr.base.BaseUtils; import com.fr.base.ChartEmptyDataStyleConf; import com.fr.base.Style; @@ -26,21 +27,23 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingWorker; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Created by mengao on 2017/11/23. */ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private static final int WIDTH = 150; - private static final int HEIGHT = 20; + private static final int HEIGHT = 26; private static final int FIVE = 5; private static final int TEN = 10; private static final int THIRTY = 30; @@ -75,6 +78,17 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { } private JPanel creatNorthPane() { + initEmptyData(); + initImageData(); + UILabel promptContent = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); + imageContent = new UILabel(Toolkit.i18nText("Fine-Design_Report_Image")); + + return row(20, + row(10, cell(promptContent), cell(emptyData), fix(10), cell(imageContent), cell(imageData)) + ).getComponent(); + } + + private void initEmptyData() { emptyData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); emptyData.setSelectedIndex(0); emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); @@ -85,7 +99,9 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { repaintPreviewPane(); } }); + } + private void initImageData() { imageData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}); imageData.setSelectedIndex(0); imageData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); @@ -97,26 +113,19 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { repaintPreviewPane(); } }); - - UILabel promptContent = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); - imageContent = new UILabel(Toolkit.i18nText("Fine-Design_Report_Image")); - JPanel emptyPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0); - JPanel imagePane = GUICoreUtils.createFlowPane(new Component[]{imageContent, imageData}, FlowLayout.LEFT, TEN, 0); - imagePane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{emptyPane, imagePane}, FlowLayout.LEFT, 0, 0); - northPane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, 0)); - return northPane; } private JPanel creatCenterPane() { JPanel centerPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); // preview pane - JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel previewContainerPane = new JPanel(new BorderLayout()); centerPane.add(previewContainerPane, BorderLayout.CENTER); + centerPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Preview"))), BorderLayout.NORTH); + + JPanel previewOwnerPane = new JPanel(new BorderLayout()); + previewOwnerPane.setBorder(new FineRoundBorder()); - JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview")); - previewOwnerPane.setLayout(new BorderLayout()); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); previewPane = new ImagePreviewPane(); @@ -133,7 +142,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - selectFilePane.setBorder(BorderFactory.createEmptyBorder(TEN, FIVE, 0, THIRTY)); + selectFilePane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, THIRTY)); defaultRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Default")); adjustRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Image_Adjust")); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java index 4cc8466fd4..498e6d44ef 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java @@ -25,6 +25,11 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 预定义的图表配色界面. @@ -50,35 +55,29 @@ public class ChartPreFillStylePane extends BasicBeanPane { } private void initComponents() { - - JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); - groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")}); groupButton.setSelectedIndex(0); - customPane.add(groupButton, BorderLayout.NORTH); - changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); changeColorSetPane.add(colorGradient = new FixedGradientBarNoTheme(4, 150), "gradient"); changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc"); cardLayout.show(changeColorSetPane, "acc"); - customPane.add(changeColorSetPane, BorderLayout.CENTER); - customPane.setPreferredSize(new Dimension(155, 300)); - colorGradient.setPreferredSize(new Dimension(155, 30)); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER); - - double p = TableLayout.PREFERRED; - double[] columnSize = {p, p}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match")), null}, - new Component[]{null, customPane}, - }; + this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.WEST); + + this.add(column( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match"))), + row( + cell(groupButton).weight(0.1), + flex(0.2) + ), + cell(changeColorSetPane) + ).getComponent()); } private void initListener() { diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java index 9cce2be7c3..876864a421 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java @@ -10,6 +10,7 @@ import com.fr.design.chart.gui.ChartComponent; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import javax.swing.JPanel; @@ -19,6 +20,9 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + /** * 图表预定义风格界面, 服务器--图表风格. * @author kunsnat E-mail:kunsnat@gmail.com @@ -45,19 +49,24 @@ public class ChartPreStylePane extends BasicBeanPane { boxPane.add(pane, BorderLayout.SOUTH); boxPane.add(fillStylePane, BorderLayout.CENTER); - - this.add(boxPane, BorderLayout.CENTER); - ChartCollection cc = new ChartCollection(); demoPlot = new Bar2DPlot(); cc.addChart(new Chart(demoPlot)); chartComponent = new ChartComponent(); chartComponent.populate(cc); - chartComponent.setPreferredSize(new Dimension(400, 300)); + chartComponent.setPreferredSize(new Dimension(441, 356)); chartComponent.setSupportEdit(false); - - this.add(chartComponent, BorderLayout.SOUTH); + + this.add(column( + 20, + cell(fillStylePane), + column( + 10, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), + cell(chartComponent) + ) + ).getComponent()); initListener(ChartPreStylePane.this); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index 8b7d865d22..56f1fb4cad 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -1,5 +1,6 @@ package com.fr.design.actions.replace.ui; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.svg.IconUtils; import com.fr.design.actions.replace.action.setting.SettingContent; import com.fr.design.actions.replace.action.setting.SettingController; @@ -7,7 +8,6 @@ import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; @@ -15,15 +15,12 @@ import com.fr.general.GeneralUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.ComboBoxEditor; import javax.swing.Icon; import javax.swing.JPanel; -import javax.swing.ScrollPaneConstants; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.CardLayout; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -32,6 +29,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 上面板 * @@ -55,8 +57,8 @@ public class ITReplaceNorthPanel { private UILabel iconLabel; private UIComboBox findInputCombobox; private UIComboBox replaceInputCombobox; - private UIScrollPane contentScrollPane; - private UIScrollPane settingScrollPane; + private JPanel contentScrollPane; + private JPanel settingScrollPane; private UIButton replaceButton; private UIButton searchButton; @@ -157,6 +159,7 @@ public class ITReplaceNorthPanel { public ITReplaceNorthPanel() { cardLayout = new CardLayout(); cardPanel = new JPanel(cardLayout); + cardPanel.setBorder(new ScaledEmptyBorder(20, 20, 20, 20)); upContentPanel = new JPanel(null); upSettingPanel = new JPanel(null); @@ -191,6 +194,12 @@ public class ITReplaceNorthPanel { super.setEditor(new ITComboBoxEditor()); } }; + initButton(); + initUpContentPanel(); + contentScrollPane = cell(upContentPanel).getComponent(); + } + + private void initButton() { matchRadioButton = new UICheckBox(Toolkit.i18nText("Fine-Design_Replace_WildCard")); matchRadioButton.addActionListener(new ActionListener() { @Override @@ -198,23 +207,22 @@ public class ITReplaceNorthPanel { ITReplaceMainDialog.setMatched(matchRadioButton.isSelected()); } }); - replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); - upContentPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); - contentScrollPane = new UIScrollPane(upContentPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - upContentPanel.add(findLabel); - upContentPanel.add(rangeLabel); - upContentPanel.add(resultLabel); - upContentPanel.add(findCombobox); - upContentPanel.add(rangeCombobox); - upContentPanel.add(findInputCombobox); - upContentPanel.add(replaceInputCombobox); - upContentPanel.add(matchRadioButton); - upContentPanel.add(replaceButton); - upContentPanel.add(searchButton); - upContentPanel.add(iconLabel); - contentScrollPane.setBorder(BorderFactory.createEmptyBorder()); + } + + private void initUpContentPanel() { + upContentPanel = column(10, + row(row(cell(findLabel).weight(0.1), cell(findCombobox).weight(0.5)).weight(0.45), flex(0.1), + row(cell(rangeLabel).weight(0.1), cell(rangeCombobox).weight(0.5)).weight(0.45) + ), + row(cell(findInputCombobox).weight(0.45), + row(flex(0.2), cell(iconLabel).weight(0.6), flex(0.2)).weight(0.1), + cell(replaceInputCombobox).weight(0.45) + ), + cell(matchRadioButton), + row(5, row(cell(resultLabel)), flex(), row(5, cell(searchButton), cell(replaceButton))) + ).getComponent(); } /** @@ -224,6 +232,19 @@ public class ITReplaceNorthPanel { findSettingLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element")); rangeSettingLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range")); settingResultLabel = new UILabel(); + initComboBox(); + updateSettingPlaceholder(SettingContent.CELL_FORMAT_NAME); + + iconSettingLabel = new UILabel(CHANGE_ICON); + searchSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); + replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); + replaceSettingButton.setEnabled(false); + initUpSettingPanel(); + settingScrollPane = cell(upSettingPanel).getComponent(); + initListener(); + + } + private void initComboBox() { findSettingComboBox = new UIComboBox(findSettingItems.toArray()); rangeSettingComboBox = new UIComboBox(RANGE_ITEMS); findSettingInputComboBox = new UIComboBox(formatItems.toArray()) { @@ -241,40 +262,100 @@ public class ITReplaceNorthPanel { }; replaceSettingInputComboBox.setSelectedIndex(-1); - updateSettingPlaceholder(SettingContent.CELL_FORMAT_NAME); findSettingInputComboBox.setEditable(true); ((UITextField) (findSettingInputComboBox.getEditor().getEditorComponent())).setEditable(false); replaceSettingInputComboBox.setEditable(true); ((UITextField) (replaceSettingInputComboBox.getEditor().getEditorComponent())).setEditable(false); - - iconSettingLabel = new UILabel(CHANGE_ICON); findExtraSettingComboBox = new UIComboBox(groupItems.toArray()); findExtraSettingComboBox.setVisible(false); replaceExtraSettingComboBox = new UIComboBox(groupItems.toArray()); replaceExtraSettingComboBox.setVisible(false); - searchSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); - replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); - - replaceSettingButton.setEnabled(false); - upSettingPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); - upSettingPanel.add(findSettingLabel); - upSettingPanel.add(rangeSettingLabel); - upSettingPanel.add(findSettingComboBox); - upSettingPanel.add(rangeSettingComboBox); - upSettingPanel.add(findSettingInputComboBox); - upSettingPanel.add(replaceSettingInputComboBox); - upSettingPanel.add(iconSettingLabel); - upSettingPanel.add(findExtraSettingComboBox); - upSettingPanel.add(replaceExtraSettingComboBox); - upSettingPanel.add(searchSettingButton); - upSettingPanel.add(replaceSettingButton); - upSettingPanel.add(settingResultLabel); - settingScrollPane = new UIScrollPane(upSettingPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - settingScrollPane.setBorder(BorderFactory.createEmptyBorder()); + } - initListener(); + private void initUpSettingPanel() { + upSettingPanel = column(10, + cell(buildFirstLine()), + cell(buildSecondLine()), + row( + cell(findExtraSettingComboBox).weight(0.45), + flex(0.1), + cell(replaceExtraSettingComboBox).weight(0.45) + ), + row( + 5, + row(cell(settingResultLabel)), + flex(), + row( + 5, + cell(searchSettingButton), + cell(replaceSettingButton) + ) + ) + ).getComponent(); + } + + private JPanel buildFirstLine() { + return row( + row( + 5, + cell(findSettingLabel).weight(0.1), + cell(findSettingComboBox).weight(0.5) + ).weight(0.45), + flex(0.1), + row( + 5, + cell(rangeSettingLabel).weight(0.1), + cell(rangeSettingComboBox).weight(0.5) + ).weight(0.45)).getComponent(); + } + + private JPanel buildSecondLine() { + return row( + cell(findSettingInputComboBox).weight(0.45), + row( + flex(0.2), + cell(iconSettingLabel).weight(0.6), + flex(0.2) + ).weight(0.1), + cell(replaceSettingInputComboBox).weight(0.45) + ).getComponent(); + } + /** + * 根据是否支持查找和替换,重绘面板 + * @param find 查找 + * @param replace 替换 + */ + public void repaintThirdPanel(boolean find, boolean replace) { + if (find && replace) { + settingScrollPane.remove(settingScrollPane.getComponent(2)); + settingScrollPane.add(row( + cell(findExtraSettingComboBox).weight(0.45), + flex(0.1), + cell(replaceExtraSettingComboBox).weight(0.45) + ).getComponent(), 2); + settingScrollPane.revalidate(); + settingScrollPane.repaint(); + } + if (!find && replace) { + settingScrollPane.remove(settingScrollPane.getComponent(2)); + settingScrollPane.add(row( + flex(0.55), + cell(replaceExtraSettingComboBox).weight(0.45) + ).getComponent(), 2); + settingScrollPane.revalidate(); + settingScrollPane.repaint(); + } + if (find && !replace) { + settingScrollPane.remove(settingScrollPane.getComponent(2)); + settingScrollPane.add(row( + cell(findExtraSettingComboBox).weight(0.45), + flex(0.55) + ).getComponent(), 2); + settingScrollPane.revalidate(); + settingScrollPane.repaint(); + } } /** @@ -413,6 +494,7 @@ public class ITReplaceNorthPanel { } else { extraComboBox.setVisible(false); } + ITReplaceMainDialog.getInstance().getNorthPane().repaintThirdPanel(findExtraSettingComboBox.isVisible(), replaceExtraSettingComboBox.isVisible()); refreshSettingReplaceButtonStatus(); } @@ -544,15 +626,6 @@ public class ITReplaceNorthPanel { } } - - public UIScrollPane getContentScrollPane() { - return contentScrollPane; - } - - public void setContentScrollPane(UIScrollPane contentScrollPane) { - this.contentScrollPane = contentScrollPane; - } - private void setIconLabelBounds() { iconX = inputLength + GAP; iconY = SECOND_Y; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java index 57b81077dd..a549c0fa5e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java @@ -33,8 +33,6 @@ public class ITReplaceSouthPanel { } }; tableEditorPane.getEditTable().setRowSorter(sorter); - tableEditorPane.getEditTable().setBorder(BorderFactory.createEmptyBorder()); - tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254)); tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight()); tableEditorPane.makeFace(tableEditorPane.getEditTable()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java index c4914c9622..cbc9626521 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java @@ -22,6 +22,10 @@ import java.awt.GridLayout; import java.awt.event.MouseEvent; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 左侧面板 * @@ -46,7 +50,7 @@ public class ITReplaceWestPanel { */ private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Template_Level_Search_Replace_Default"; private static final String HELP_URL = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); - private static final int FILL_COUNT = 11; + private static final int FILL_COUNT = 12; public static final int LEFT_WIDTH = 100; public static final String CONTENT_TEXT = "" + Toolkit.i18nText("Fine-Design_Basic_Templates_Content") + ""; public static final String SETTING_TEXT = "" + Toolkit.i18nText("Fine-Design_Replace_Setting") + ""; @@ -58,6 +62,8 @@ public class ITReplaceWestPanel { contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content")); settingButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Replace_Setting")); + contentButton.setHorizontalAlignment(SwingConstants.LEFT); + settingButton.setHorizontalAlignment(SwingConstants.LEFT); contentButton.setText(CONTENT_TEXT); contentButton.addChangeListener(new ChangeListener() { @Override @@ -90,8 +96,16 @@ public class ITReplaceWestPanel { //去除按钮的边框 contentButton.setBorderPainted(false); settingButton.setBorderPainted(false); - leftPanel.add(contentButton); - leftPanel.add(settingButton); + leftPanel.add(row( + flex(0.07), + cell(contentButton).weight(1.0), + flex(0.07) + ).getComponent()); + leftPanel.add(row( + flex(0.07), + cell(settingButton).weight(1.0), + flex(0.07) + ).getComponent()); leftPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(218, 218, 221))); //填充一下面板 for (int i = 0; i < FILL_COUNT; i++) { @@ -100,7 +114,7 @@ public class ITReplaceWestPanel { //添加帮助文档按钮及超链 iconLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Replace_Tooltip")); - iconLabel.setHorizontalAlignment(SwingConstants.CENTER); + iconLabel.setHorizontalAlignment(SwingConstants.LEFT); //设置游标 iconLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); iconLabel.addMouseListener(new MouseClickListener() { @@ -109,8 +123,11 @@ public class ITReplaceWestPanel { BrowseUtils.browser(HELP_URL); } }); - leftPanel.add(iconLabel); - leftPanel.add(new UILabel(StringUtils.EMPTY)); + leftPanel.add(row( + flex(0.23), + cell(iconLabel).weight(1.0), + flex(0.07) + ).getComponent()); } public JPanel getLeftPanel() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java index 5cee5af04f..a84faf432c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java @@ -1,5 +1,6 @@ package com.fr.design.actions.replace.ui; +import com.fine.theme.icon.LazyIcon; import com.fr.base.TRL; import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.file.HistoryTemplateListCache; @@ -14,7 +15,9 @@ import com.fr.stable.StringUtils; import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; import javax.swing.JTable; +import javax.swing.UIManager; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.Component; @@ -35,9 +38,10 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor private UIButton paraButton; public ITTableButton() { - paraButton = new UIButton("" + Toolkit.i18nText("Fine-Design_Chart_Location") + " "); + paraButton = new UIButton(); paraButton.setVisible(true); - paraButton.setBorderPainted(false); + paraButton.setBorderPainted(true); + paraButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); } @@ -72,7 +76,11 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ITContent content = (ITContent) table.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX); - paraButton.setEnabled(content.isJumpAble()); + if (content.isJumpAble()) { + paraButton.setIcon(new LazyIcon("locate")); + } else { + paraButton.setIcon(new LazyIcon("locate_disable")); + } return paraButton; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java index d805d430ee..23c3d99ac3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java @@ -1,5 +1,7 @@ package com.fr.design.actions.replace.ui; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.replace.info.Info; import com.fr.design.actions.replace.info.base.ITContent; @@ -15,9 +17,12 @@ import org.jetbrains.annotations.Nullable; import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; +import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTable; +import javax.swing.UIManager; import javax.swing.plaf.UIResource; +import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import java.awt.Color; import java.awt.Component; @@ -56,13 +61,28 @@ public class ITTableEditor extends UITableModelAdapter { ITTableButton.class, }); + + DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + ((JComponent) c).setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), + new ScaledEmptyBorder(0,4,0,0))); + c.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + return c; + } + }; + + this.setDefaultRenderer(UILabel.class, cellRenderer); this.setDefaultEditor(ITTableButton.class, new ITTableButton()); this.setDefaultRenderer(ITTableButton.class, new ITTableButton()); this.setDefaultEditor(Boolean.class, new ITBooleanEditor()); this.setDefaultRenderer(Boolean.class, new ITBooleanRenderer()); this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(50); - this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(50); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(28); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setCellRenderer(new ITBooleanRenderer()); } @@ -263,7 +283,7 @@ public class ITTableEditor extends UITableModelAdapter { setEnabled(!content.isReplaced()); setSelected((value != null && ((Boolean) value).booleanValue())); setUI(getUICheckBoxUI()); - setBorder(BorderFactory.createEmptyBorder()); + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); setBackground(Color.WHITE); return this; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java index ef32da98d6..4029fefe9d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java @@ -1,5 +1,7 @@ package com.fr.design.actions.replace.ui; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.TRL; import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.border.UIRoundedBorder; @@ -23,6 +25,7 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTable; +import javax.swing.SortOrder; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.table.JTableHeader; @@ -52,7 +55,6 @@ public class ITTableEditorPane extends BasicPane { public ITTableEditorPane(UITableModelAdapter model) { this.tableModel = model; this.initComponent(model.createAction()); - editTable.setGridColor(new Color(218, 218, 221)); } @@ -64,11 +66,7 @@ public class ITTableEditorPane extends BasicPane { */ private void initComponent(UITableEditAction[] action) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel pane = new JPanel(new BorderLayout(4, 4)); - this.add(pane, BorderLayout.CENTER); - UILabel l = new UILabel(leftLabelName); editTable = tableModel.createTable(); - editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER); editTable.addMouseListener(new MouseClickListener() { @Override public void mouseClicked(MouseEvent e) { @@ -94,7 +92,7 @@ public class ITTableEditorPane extends BasicPane { }); UIScrollPane scrollPane = new UIScrollPane(editTable); scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); - pane.add(scrollPane, BorderLayout.CENTER); + this.add(scrollPane, BorderLayout.CENTER); } /** @@ -143,6 +141,7 @@ public class ITTableEditorPane extends BasicPane { public static class ITHeaderRenderer implements TableCellRenderer { JTableHeader tableHeader; final UICheckBox selectBox; + private boolean ascSort = true; public ITHeaderRenderer(JTable table) { this.tableHeader = table.getTableHeader(); @@ -155,15 +154,17 @@ public class ITTableEditorPane extends BasicPane { int selectColumn = tableHeader.columnAtPoint(e.getPoint()); if (selectColumn == ITReplaceSouthPanel.CHECKBOX_INDEX) { boolean value = !selectBox.isSelected(); - selectBox.setSelected(value); selectAllOrNull(value); if (value) { ITReplaceMainDialog.selectCount = getEditTable().getRowCount(); } else { ITReplaceMainDialog.selectCount = 0; } + setHeaderStatus(value); tableHeader.repaint(); table.repaint(); + } else if (selectColumn != ITReplaceSouthPanel.CONTENT_INDEX) { + ascSort = table.getRowSorter().getSortKeys().get(0).getSortOrder() == SortOrder.ASCENDING; } } } @@ -175,13 +176,27 @@ public class ITTableEditorPane extends BasicPane { * * @param table */ - public void refreshHeader(JTable table, boolean value) { - selectBox.setSelected(value); + public void refreshHeader(JTable table, boolean isAllSelected) { + setHeaderStatus(isAllSelected); int rowHeight = table.getRowHeight(); table.updateUI(); table.setRowHeight(rowHeight); } + public void setHeaderStatus(boolean isAllSelected) { + if (isAllSelected) { + selectBox.setSelected(true); + selectBox.setSelectedIcon(new LazyIcon("checkbox_checked")); + } else if (ITReplaceMainDialog.selectCount > 0 && ITReplaceMainDialog.selectCount < editTable.getRowCount()) { + selectBox.setSelected(true); + selectBox.setSelectedIcon(new LazyIcon("checkbox_part_checked")); + } else { + selectBox.setSelected(false); + selectBox.setSelectedIcon(new LazyIcon("checkbox_unchecked")); + } + } + + @Override public Component getTableCellRendererComponent(JTable table, Object value, @@ -195,6 +210,15 @@ public class ITTableEditorPane extends BasicPane { label.setHorizontalAlignment(SwingConstants.LEFT); selectBox.setHorizontalAlignment(SwingConstants.CENTER); selectBox.setBorderPainted(true); + if (column != ITReplaceSouthPanel.CHECKBOX_INDEX && column != ITReplaceSouthPanel.CONTENT_INDEX) { + if (ascSort) { + label.setIcon(new LazyIcon("sort_asc")); + } else { + label.setIcon(new LazyIcon("sort_desc")); + } + } + label.setIconTextGap(5); + label.setHorizontalTextPosition(JLabel.LEFT); JComponent component = (column == ITReplaceSouthPanel.CHECKBOX_INDEX) ? selectBox : label; component.setForeground(tableHeader.getForeground()); component.setBackground(tableHeader.getBackground()); @@ -216,7 +240,7 @@ public class ITTableEditorPane extends BasicPane { Dimension size = table.getTableHeader().getPreferredSize(); size.height = 26;//设置新的表头高度 - table.getTableHeader().setBackground(new Color(232, 232, 233)); + table.getTableHeader().setBackground(FlatUIUtils.getUIColor("TableHeader.background", Color.WHITE)); table.getTableHeader().setPreferredSize(size); diff --git a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java index 5187c1f322..08a26b9de5 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java @@ -16,6 +16,9 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author richie * @date 2015-03-26 @@ -50,12 +53,16 @@ public class BackPane extends ConditionAttrSingleConditionPane com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Cell"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") }); - - this.add(backgroundLabel); - this.add(backgroundPreviewPane); - this.add(editBackgroundButton); - this.add(this.backScopeComboBox); this.backgroundPreviewPane.setBackgroundObject(ColorBackground.getInstance(Color.WHITE)); + backgroundLabel.setPreferredSize(new Dimension(100, backgroundLabel.getHeight())); + + this.add(row(10, cell(backgroundLabel), row( + 10, + cell(backgroundPreviewPane), + cell(editBackgroundButton), + cell(backScopeComboBox), + cell(cancel)) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java index f2d006c546..4877c87c39 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java @@ -16,6 +16,9 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author richie * @date 2015-03-26 @@ -47,9 +50,15 @@ public class BorderHighlightPane extends ConditionAttrSingleConditionPane com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Cell"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Column") }); - - this.add(fontLabel); - this.add(frFontPreviewPane); - this.add(editFRFontButton); - this.add(this.fontScopeComboBox); this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont()); + + fontLabel.setPreferredSize(new Dimension(100, fontLabel.getHeight())); + + this.add(row(10, cell(fontLabel), row( + 10, + cell(frFontPreviewPane), + cell(editFRFontButton), + cell(fontScopeComboBox), + cell(cancel)) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java index c27854b3de..c00d761b25 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java @@ -9,6 +9,9 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author richie * @date 2015-03-26 @@ -23,15 +26,21 @@ public class ForeGroundPane extends ConditionAttrSingleConditionPane public PagePane(ConditionAttributesPane conditionAttributesPane) { super(conditionAttributesPane); pageLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Pagination") + ":"); - this.add(pageLabel); this.pageComboBox = new UIComboBox(new String[] { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_No_Pagination"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_After_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_After_Column"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Column") }); - this.add(this.pageComboBox); this.pageComboBox.setSelectedIndex(0); + + pageLabel.setPreferredSize(new Dimension(100, pageLabel.getHeight())); + + this.add(row(10, cell(pageLabel), row( + 10, + cell(pageComboBox), + cell(cancel)) + ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java index 6961b06c13..51e02a86d3 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java @@ -15,11 +15,15 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.PresentHighlightAction; import javax.swing.*; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * @author richie * @date 2015-03-26 @@ -33,11 +37,10 @@ public class PresentHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent(); + this.add(centerPane, BorderLayout.CENTER); + } + private JToolBar createToolbar() { //toolbar. JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); - Dimension separatorDimension = new Dimension(6, 18);//Separator分隔线 - - toolbar.add(this.createHFInsertButton(new TextHFElement())); - toolbar.add(this.createHFInsertButton(new FormulaHFElement())); - toolbar.addSeparator(separatorDimension); - toolbar.add(this.createHFInsertButton(new PageNumberHFElement())); - toolbar.add(this.createHFInsertButton(new NumberOfPageHFElement())); - toolbar.addSeparator(separatorDimension); - toolbar.add(this.createHFInsertButton(new DateHFElement())); - toolbar.add(this.createHFInsertButton(new TimeHFElement())); - toolbar.addSeparator(separatorDimension); - toolbar.add(this.createHFInsertButton(new ImageHFElement())); - toolbar.add(this.createHFInsertButton(new NewLineHFElement())); - toolbar.addSeparator(separatorDimension); + printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background")); + headerUnitFieldPane = new AdjustHeightPane(); + footerUnitFieldPane = new AdjustHeightPane(); + headFootUnitFieldPane = new AdjustHeightPane(); + initIconToolPanel(); + toolbar.add(iconToolPanel); + return toolbar; + } + + private UIButton initCustomBackgroundButton() { UIButton customBackgroundButton = new UIButton(); - customBackgroundButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")); + customBackgroundButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")); customBackgroundButton.set4ToolbarButton(); - customBackgroundButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/dialog/headerfooter/background.png")); - toolbar.add(customBackgroundButton); + customBackgroundButton.setIcon(new LazyIcon("background")); customBackgroundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final BackgroundPane backgroundPane = new BackgroundPane(); BasicDialog backgroundDialog = backgroundPane.showWindow( SwingUtilities.getWindowAncestor(HeaderFooterEditPane.this)); - backgroundPane.populate(background); + backgroundPane.populate(background); backgroundDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { background = backgroundPane.update(); refreshPreivewPane(); - } + } }); backgroundDialog.setVisible(true); } }); - printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background")); - toolbar.add(printBackgroundCheckBox); + return customBackgroundButton; + } - toolbar.addSeparator(separatorDimension); - - JPanel headerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - headerUnitFieldPane = new AdjustHeightPane(); - headerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Header") + ":")); - headerPane.add(headerUnitFieldPane); + private void initIconToolPanel() { + iconToolPanel = row( + 6, + cell(this.createHFInsertButton(new TextHFElement())), + cell(this.createHFInsertButton(new FormulaHFElement())), + cell(this.createHFInsertButton(new PageNumberHFElement())), + cell(this.createHFInsertButton(new NumberOfPageHFElement())), + cell(this.createHFInsertButton(new DateHFElement())), + cell(this.createHFInsertButton(new TimeHFElement())), + cell(this.createHFInsertButton(new ImageHFElement())), + cell(this.createHFInsertButton(new NewLineHFElement())), + cell(initCustomBackgroundButton()), + cell(printBackgroundCheckBox), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":")), + cell(headFootUnitFieldPane) + ).with(it -> it.setBorder(new ScaledEmptyBorder(2,0,2,0))) + ).getComponent(); + } - JPanel footerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - footerUnitFieldPane = new AdjustHeightPane(); - footerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Footer") + ":")); - footerPane.add(footerUnitFieldPane); + /** + * icon 置灰 + */ + public void disableIconToolPanel() { + if (iconToolPanel == null) { + return; + } + for (int i = 0; i < iconToolPanel.getComponentCount(); i++) { + Component component = iconToolPanel.getComponent(i); + if (!(component instanceof UIButton)) { + continue; + } + UIButton button = ((UIButton) component); + if (button.getIcon() instanceof LazyIcon) { + LazyIcon icon = ((LazyIcon) button.getIcon());; + button.setIcon(icon.disabled()); + } + } + } - JPanel headerFooterPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - headFootUnitFieldPane = new AdjustHeightPane(); - headerFooterPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":")); - headerFooterPane.add(headFootUnitFieldPane); - - toolbar.add(headerFooterPane); - return toolbar; + /** + * icon 取消置灰 + */ + public void enableIconToolPanel() { + if (iconToolPanel == null) { + return; + } + for (int i = 0; i < iconToolPanel.getComponentCount(); i++) { + Component component = iconToolPanel.getComponent(i); + if (!(component instanceof UIButton)) { + continue; + } + UIButton button = ((UIButton) component); + if (button.getIcon() instanceof LazyIcon) { + String iconId = ((LazyIcon) button.getIcon()).getId(); + button.setIcon(new LazyIcon(iconId)); + } + } } diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java index a0275ddd87..44730fa268 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java @@ -3,6 +3,8 @@ */ package com.fr.design.headerfooter; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.ScreenResolution; @@ -53,6 +55,7 @@ public abstract class HeaderFooterPane extends BasicPane { reportHFYypeList.setCellRenderer(reportPageTypeRenderer); reportHFYypeList .addListSelectionListener(reportHFTypeSelectionListener); + reportHFYypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); JScrollPane hfTypeListScrollPane = new JScrollPane(reportHFYypeList); leftPane.add(hfTypeListScrollPane, BorderLayout.CENTER); @@ -74,7 +77,7 @@ public abstract class HeaderFooterPane extends BasicPane { JPanel definePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); centerPane.add(definePane, BorderLayout.NORTH); - defineCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_HF_Whether_To_Define_The_Selected_Type"), true); + defineCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_HF_Whether_To_Define_The_Selected_Type"), true); //是否定义选中的类型 definePane.add(defineCheckBox); defineCheckBox.addChangeListener(defineChangeListener); @@ -133,9 +136,11 @@ public abstract class HeaderFooterPane extends BasicPane { GUICoreUtils.setEnabled(headerFooterEditPane, true); reportHFHash.put(currentReportHFType, headerFooterEditPane.update()); + headerFooterEditPane.enableIconToolPanel(); } else { GUICoreUtils.setEnabled(headerFooterEditPane, false); reportHFHash.remove(new Integer(currentReportHFType)); + headerFooterEditPane.disableIconToolPanel(); } reportHFYypeList.repaint(); @@ -198,9 +203,7 @@ public abstract class HeaderFooterPane extends BasicPane { if (value != null && value instanceof Integer) { int reportHFType = (Integer) value; - this - .setIcon(BaseUtils - .readIcon("/com/fr/base/images/oem/logo.png")); + this.setIcon(new LazyIcon("logo")); if (reportHFType == ReportConstants.REPORTPAGE_DEFAULT) { this.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Default_Page")); } else if (reportHFType == ReportConstants.REPORTPAGE_FIRST) { @@ -216,7 +219,7 @@ public abstract class HeaderFooterPane extends BasicPane { if (reportHFHash != null) { Object obj = reportHFHash.get(new Integer(reportHFType)); if (obj == null) { - this.setEnabled(false); + this.setIcon(new LazyIcon("logo").disabled()); } } } diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java index 02d46c82aa..65ff1a1e84 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/ImagePane.java @@ -3,9 +3,13 @@ */ package com.fr.design.headerfooter; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.ImgChooseWrapper; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; @@ -15,10 +19,16 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Image Pane. */ @@ -34,27 +44,17 @@ public class ImagePane extends BasicPane { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); //preview pane. - JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(previewPane); - -// previewPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - if (hasPreviewBorder) { - previewPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))); - } - + JPanel previewPane = new JPanel(new BorderLayout()); imagePreviewPane = new ImagePreviewPane(); previewPane.add(new JScrollPane(imagePreviewPane)); + previewPane.setBorder(new FineRoundBorder()); + previewPane.setPreferredSize(new Dimension(500, 400)); + previewPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); + + //select image JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(rightPane, BorderLayout.EAST); - -// rightPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - if (hasPreviewBorder) { - rightPane.setBorder(BorderFactory.createEmptyBorder(8, 2, 0, 2)); - } else { - rightPane.setBorder(BorderFactory.createEmptyBorder(4, 2, 0, 2)); - } UIButton selectImageButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Select_Picture")); rightPane.add(selectImageButton, BorderLayout.NORTH); selectImageButton.addActionListener(selectPictureActionListener); @@ -62,6 +62,16 @@ public class ImagePane extends BasicPane { //init image file chooser. imageFileChooser = new ImageFileChooser(); imageFileChooser.setMultiSelectionEnabled(false); + + this.add(column( + 3, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), + row( + 10, + cell(previewPane).weight(0.9), + cell(rightPane).weight(0.2) + ) + ).with(it -> it.setBorder(new ScaledEmptyBorder(10,10,10,10))).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java index 5eb1de3664..6a47ee48c3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; @@ -24,10 +25,10 @@ import com.fr.web.attr.ReportWebAttr; import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; -import javax.swing.JPanel; import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; @@ -35,6 +36,9 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Author : daisy * Date: 13-9-9 @@ -129,11 +133,11 @@ public class AuthorityToolBarPane extends BasicBeanPane extends BasicBeanPane extends BasicBeanPane" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 " + "")).weight(0.15), + flex(0.4) + ), + row( + 10, + cell(copyLabel).weight(0.12), + cell(copyTitleTextField).weight(0.33), + cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18" + "")).weight(0.15), + flex(0.4) + ) + ).getComponent(); + + return column( + cell(wrapComponentWithTitle(colPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Area"))) + ).getComponent(); } /** diff --git a/designer-realize/src/main/java/com/fr/design/report/freeze/FreezeAndRepeatPane.java b/designer-realize/src/main/java/com/fr/design/report/freeze/FreezeAndRepeatPane.java index a946b63b16..83848152b1 100644 --- a/designer-realize/src/main/java/com/fr/design/report/freeze/FreezeAndRepeatPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/freeze/FreezeAndRepeatPane.java @@ -26,7 +26,7 @@ public abstract class FreezeAndRepeatPane extends BasicBeanPane { protected boolean isEnalbed; protected void initComponent() { - Dimension size = new Dimension(43, 21); + Dimension size = new Dimension(50, 21); if (start instanceof UISpinner) { start.setPreferredSize(size); ((UISpinner) start).addChangeListener(new ChangeListener() { diff --git a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java index 0d5ca8de7f..971813bff4 100644 --- a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java @@ -4,6 +4,7 @@ import com.fr.base.FRContext; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.extra.WebViewDlgHelper; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.ActionLabel; @@ -24,6 +25,13 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * Sets Report Page Attributes */ @@ -33,7 +41,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { private static final int LABEL_HEIGHT = 45; //tab - private UITabbedPane tabbedPane; + private FineTabbedPane tabbedPane; // 重复标题行 private RepeatRowPane repeatTitleRowPane; @@ -82,15 +90,16 @@ public class RepeatAndFreezeSettingPane extends BasicPane { * 重复标题行 */ private JPanel initRowStartPane() { - JPanel soverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); useRepeatTitleRCheckBox = new UICheckBox(); - soverlapRowStartPane.add(useRepeatTitleRCheckBox); - soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form"))); repeatTitleRowPane = new RepeatRowPane(); - soverlapRowStartPane.add(repeatTitleRowPane); - soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row"))); - return soverlapRowStartPane; + return row( + 2, + cell(useRepeatTitleRCheckBox), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form"))), + cell(repeatTitleRowPane), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row"))) + ).getComponent(); } /** @@ -98,16 +107,49 @@ public class RepeatAndFreezeSettingPane extends BasicPane { */ private JPanel initColStartPane() { // 重复打印标题的起始列 - JPanel soverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); useRepeatTitleCCheckBox = new UICheckBox(); - soverlapColStartPane.add(useRepeatTitleCCheckBox); - soverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Column_Form"))); - // 重复打印标题的结束列 repeatTitleColPane = new RepeatColPane(); - soverlapColStartPane.add(repeatTitleColPane); - soverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column"))); - return soverlapColStartPane; + return row( + 2, + cell(useRepeatTitleCCheckBox), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Title_Start_Column_Form"))), + cell(repeatTitleColPane), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Column"))) + ).getComponent(); + } + + private JPanel initPageRepeatPane() { + return row( + 10, + column( + 10, + cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5), + flex(0.5) + ), + column( + 10, + cell(initRowStartPane()).weight(0.5), + cell(initColStartPane()).weight(0.5) + ) + + ).getComponent(); + } + + private JPanel initPageRepeatFootPane() { + return row( + 10, + column( + 10, + cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5), + flex(0.5) + ), + column( + 10, + cell(initFootRowStarPane()).weight(0.5), + cell(initFootColStartPane()).weight(0.5) + ) + ).getComponent(); } /** @@ -115,15 +157,16 @@ public class RepeatAndFreezeSettingPane extends BasicPane { */ private JPanel initFootRowStarPane() { // 重复打印结尾的起始行 - JPanel foverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); useRepeatFinisRCheckBox = new UICheckBox(); - foverlapRowStartPane.add(useRepeatFinisRCheckBox); - foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form"))); repeatFinisRowPane = new RepeatRowPane(); - foverlapRowStartPane.add(repeatFinisRowPane); - foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row"))); - return foverlapRowStartPane; + return row( + 2, + cell(useRepeatFinisRCheckBox), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form"))), + cell(repeatFinisRowPane), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Row"))) + ).getComponent(); } /** @@ -131,15 +174,16 @@ public class RepeatAndFreezeSettingPane extends BasicPane { */ private JPanel initFootColStartPane() { // 重复打印结尾的起始列 - JPanel foverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); useRepeatFinisCCheckBox = new UICheckBox(); - foverlapColStartPane.add(useRepeatFinisCCheckBox); - foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form"))); repeatFinisColPane = new RepeatColPane(); - foverlapColStartPane.add(repeatFinisColPane); - foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column"))); - return foverlapColStartPane; + return row( + 2, + cell(useRepeatFinisCCheckBox), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form"))), + cell(repeatFinisColPane), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column"))) + ).getComponent(); } /** @@ -157,37 +201,64 @@ public class RepeatAndFreezeSettingPane extends BasicPane { */ private JPanel initPageFrozenPane() { // 分页冻结 - JPanel pagecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - pagecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - - JPanel pageRowGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageRowGridPane.add(this.usePageHeadFrozenRCheckBox = new UICheckBox()); + usePageHeadFrozenRCheckBox = new UICheckBox(); // 显示行冻结信息的panel freezePageRowPane = new FreezePagePane(true); - pageRowGridPane.add(freezePageRowPane); - pagecon.add(pageRowGridPane); - addPageFrozenCol(pagecon); - addBorder(pagecon, REPEAT_AND_FROZEN_HEAD); - return pagecon; + freezePageColPane = new FreezePagePane(false); + usePageHeadFrozenCCheckBox = new UICheckBox(); + + return row( + 10, + column( + 10, + cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5), + flex(0.5) + ), + column( + 10, + row( + 2, + cell(usePageHeadFrozenRCheckBox), + cell(freezePageRowPane) + ).weight(0.5), + row( + 2, + cell(usePageHeadFrozenCCheckBox), + cell(freezePageColPane) + ).weight(0.5) + ) + ).getComponent(); } private JPanel initPageFrozenFootPane() { - JPanel pageContentPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - pageContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); // 行冻结 - JPanel pageRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageRowPane.add(this.usePageFootFrozenRCheckBox = new UICheckBox()); + usePageFootFrozenRCheckBox = new UICheckBox(); // 列冻结 - JPanel pageColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageColPane.add(this.usePageFootFrozenCCheckBox = new UICheckBox()); - pageContentPanel.add(pageRowPane); + usePageFootFrozenCCheckBox = new UICheckBox(); freezeFootRowPane = new FreezePagePane(true, true); - pageRowPane.add(freezeFootRowPane); - pageContentPanel.add(pageColPane); freezeFootColPane = new FreezePagePane(false, true); - pageColPane.add(freezeFootColPane); - addBorder(pageContentPanel, REPEAT_AND_FROZEN_FOOT); - return pageContentPanel; + + return row( + 10, + column( + 10, + cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5), + flex(0.5) + ), + column( + 10, + row( + 2, + cell(usePageFootFrozenRCheckBox), + cell(freezeFootRowPane) + ).weight(0.5), + row( + 2, + cell(usePageFootFrozenCCheckBox), + cell(freezeFootColPane) + ).weight(0.5) + ) + ).getComponent(); } @@ -207,49 +278,59 @@ public class RepeatAndFreezeSettingPane extends BasicPane { * 填报冻结Pane */ protected JPanel initWriteFrozenPane() { - JPanel writePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); // 填报冻结 - UILabel writeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Face_Write_Frozen") + ":"); - JPanel writeLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeLabelPanel.add(writeLabel); - writePanel.add(writeLabelPanel, BorderLayout.NORTH); - JPanel writecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - writecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - writePanel.add(writecon, BorderLayout.CENTER); - // 行冻结 - JPanel writeRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeRowPane.add(this.useWriteFrozenRCheckBox = new UICheckBox()); - // 列冻结 - JPanel writeColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeColPane.add(this.useWriteFrozenCCheckBox = new UICheckBox()); - writecon.add(writeRowPane); + useWriteFrozenRCheckBox = new UICheckBox(); freezeWriteRowPane = new FreezeWriteRowPane(); - writeRowPane.add(freezeWriteRowPane); - writecon.add(writeColPane); + // 列冻结 + useWriteFrozenCCheckBox = new UICheckBox(); freezeWriteColPane = new FreezeWriteColPane(); - writeColPane.add(freezeWriteColPane); - return writePanel; + return row( + 10, + column( + 10, + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Face_Write_Frozen"))).weight(0.5), + flex(0.5) + ), + column( + 10, + row( + 2, + cell(useWriteFrozenRCheckBox), + cell(freezeWriteRowPane) + ).weight(0.5), + row( + 2, + cell(useWriteFrozenCCheckBox), + cell(freezeWriteColPane) + ).weight(0.5) + ) + ).getComponent(); } public RepeatAndFreezeSettingPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel outrepeatPanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Repeat")); - JPanel cenrepeatPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - outrepeatPanel.add(cenrepeatPanel); - JPanel outfreezePanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen")); - JPanel pagePanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); - JPanel repeatHeadPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - JPanel repeatFootPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - tabbedPane = new UITabbedPane(); - - //添加上方的边界线 - addBorder(repeatHeadPanel, REPEAT_AND_FROZEN_HEAD); - addBorder(repeatFootPanel, REPEAT_AND_FROZEN_FOOT); - - pagePanel.add(outrepeatPanel, BorderLayout.NORTH); - pagePanel.add(outfreezePanel, BorderLayout.CENTER); + this.setLayout(new BorderLayout()); + + JPanel outrepeatPanel = column( + 10, + cell(initPageRepeatPane()), + cell(initPageRepeatFootPane()) + ).getComponent(); + + JPanel outfreezePanel = column( + 10, + cell(initPageFrozenPane()), + cell(initPageFrozenFootPane()) + ).getComponent(); + + JPanel pagePanel = column( + 10, + fix(10), + cell(wrapComponentWithTitle(outrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Repeat"))), + cell(wrapComponentWithTitle(outfreezePanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen"))), + cell(new UILabel(""+ Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip") + "")) + ).getComponent(); // 重复打印部分 // 重复打印标题的起始行 @@ -258,31 +339,22 @@ public class RepeatAndFreezeSettingPane extends BasicPane { UILabel warning = new UILabel("(" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_FreezeWarning") + ")"); warning.setForeground(Color.red); labelPanel.add(warning); - cenrepeatPanel.add(repeatHeadPanel, BorderLayout.NORTH); - cenrepeatPanel.add(repeatFootPanel, BorderLayout.CENTER); - - repeatHeadPanel.add(initRowStartPane()); - addColStart(repeatHeadPanel); - repeatFootPanel.add(initFootRowStarPane()); - addFootColStart(repeatFootPanel); - - outfreezePanel.add(initPageFrozenPane(), BorderLayout.NORTH); - outfreezePanel.add(initPageFrozenFootPane(),BorderLayout.CENTER); - outfreezePanel.add(new UILabel(" "+ Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip") + ""),BorderLayout.SOUTH); - JPanel writePanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen")); + JPanel writeOutrepeatPanel = initWriteFrozenPane(); + JPanel writePanel = column( + 10, + fix(10), + cell(wrapComponentWithTitle(writeOutrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen"))) + ).getComponent(); addWriteFrozen(writePanel, pagePanel); - if (tabbedPane.getTabSize() == 0) { - this.add(pagePanel); - } initPageRwoListener(); initPageColListener(); initWriteListener(); } private boolean shouldShowTip() { - + return WorkContext.getCurrent().isLocal() && FRContext.isChineseEnv(); } @@ -320,9 +392,10 @@ public class RepeatAndFreezeSettingPane extends BasicPane { } protected void addWriteFrozen(JPanel freezePanel, JPanel pagePanel) { - freezePanel.add(initWriteFrozenPane(), BorderLayout.CENTER); - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_M_Page_Preview"), pagePanel); - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_M_Write_Preview"), freezePanel); + FineTabbedPane.TabPaneBuilder tabbedPaneBuilder = new FineTabbedPane.TabPaneBuilder(); + tabbedPaneBuilder.addTab(Toolkit.i18nText("Fine-Design_Basic_M_Page_Preview"), pagePanel); //分页预览 + tabbedPaneBuilder.addTab(Toolkit.i18nText("Fine-Design_Basic_M_Write_Preview"), freezePanel); + tabbedPane = tabbedPaneBuilder.withHeadRatio(0.35f).build(); //去除对应的焦点虚线边框 tabbedPane.setFocusable(false); this.add(tabbedPane);