Browse Source

REPORT-107972 设计器样式翻新-翻新超链/控件列表面板

newui
Levy.Xie-解安森 1 year ago
parent
commit
e96abf7648
  1. 9
      designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java
  2. 9
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  3. 12
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  5. 43
      designer-base/src/main/java/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  6. 17
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java
  7. 24
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  8. 6
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java

9
designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java

@ -91,7 +91,6 @@ public class FineLightIconSet extends AbstractIconSet {
new SvgIconSource("widgetsettings", "com/fine/theme/icon/propertiestab/widgetsettings.svg", false, 18),
new SvgIconSource("widgetsettings_disabled", "com/fine/theme/icon/propertiestab/widgetsettings_disabled.svg", false, 18),
new SvgIconSource("widgetsettings_selected", "com/fine/theme/icon/propertiestab/widgetsettings_selected.svg", false, 18),
// TODO: 视觉未提供,先用旧的,待视觉提供后替换
new SvgIconSource("configuredroles", "com/fine/theme/icon/propertiestab/configuredroles.svg", false, 18),
new SvgIconSource("configuredroles_selected", "com/fine/theme/icon/propertiestab/configuredroles_selected.svg", false, 18),
new SvgIconSource("configuredroles_disabled", "com/fine/theme/icon/propertiestab/configuredroles_disabled.svg", false, 18),
@ -139,6 +138,14 @@ public class FineLightIconSet extends AbstractIconSet {
new SvgIconSource("popup", "com/fine/theme/icon/popup/popup.svg", true),
new SvgIconSource("clear", "com/fine/theme/icon/clear.svg", true),
// 工具栏
new SvgIconSource("tool_copy", "com/fine/theme/icon/toolbar/copy.svg", true),
new SvgIconSource("move_down", "com/fine/theme/icon/toolbar/move_down.svg", true),
new SvgIconSource("move_up", "com/fine/theme/icon/toolbar/move_up.svg", true),
new SvgIconSource("sort_asc", "com/fine/theme/icon/toolbar/sort_asc.svg", true),
new SvgIconSource("tool_edit", "com/fine/theme/icon/toolbar/edit.svg", true),
new SvgIconSource("tool_edit_white", "com/fine/theme/icon/toolbar/edit_white.svg", true),
// 参数面板
new SvgIconSource("param_edit", "com/fine/theme/icon/param/edit.svg", true, 24),
new SvgIconSource("param_edit_pressed", "com/fine/theme/icon/param/edit_pressed.svg", true, 24),

9
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -111,14 +111,6 @@ public abstract class UIControlPane extends JControlPane {
@Override
protected void initToolBar() {
super.initToolBar();
// toolBar.setUI(new UIToolBarUI() {
// @Override
// public void paint(Graphics g, JComponent c) {
// Graphics2D g2 = (Graphics2D) g;
// g2.setColor(Color.WHITE);
// g2.fillRect(0, 0, c.getWidth(), c.getHeight());
// }
// });
}
protected JPanel getLeftPane() {
@ -139,7 +131,6 @@ public abstract class UIControlPane extends JControlPane {
// 封装一层,加边框
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIConstants.RULER_LINE_COLOR));
leftContentPane.add(toolBarPane, BorderLayout.NORTH);

12
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -1,7 +1,7 @@
package com.fr.design.gui.controlpane;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
@ -10,8 +10,10 @@ import com.fr.form.event.Listener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
@ -40,7 +42,6 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
public UIListControlPane() {
super();
}
private ListControlPaneHelper getHelper() {
@ -75,9 +76,10 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
protected void initLeftPane(JPanel leftPane) {
nameableList = createJNameList();
nameableList.setName(LIST_NAME);
nameableList.setSelectionBackground(UIConstants.ATTRIBUTE_PRESS);
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
UIScrollPane scrollPane = new UIScrollPane(nameableList);
scrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("defaultBorderColor")));
leftPane.add(scrollPane, BorderLayout.CENTER);
leftPane.setBorder(new FineRoundBorder());
nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
nameableList.addMouseListener(getHelper().getListMouseListener(nameableList, this));

3
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -24,6 +24,7 @@ import javax.swing.DefaultListModel;
import javax.swing.JPanel;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
@ -541,7 +542,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
label.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
label.setOpaque(true);
label.setBackground(Color.WHITE);
label.setForeground(Color.decode("#333334"));
label.setForeground(UIManager.getColor("List.wrapper.text.fontColor"));
label.setFont(label.getFont().deriveFont(11F));
//预留 10px 的纵向滚动条的宽度
label.setPreferredSize(new Dimension(214, 26));

43
designer-base/src/main/java/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -1,6 +1,6 @@
package com.fr.design.gui.controlpane;
import com.fr.design.constants.UIConstants;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.stable.Nameable;
@ -8,7 +8,6 @@ import sun.swing.DefaultLookup;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import java.awt.*;
/**
@ -19,18 +18,19 @@ import java.awt.*;
public class UINameableListCellRenderer extends
JPanel implements ListCellRenderer {
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Color BORDER_COLOR = new Color(201, 198, 184);
protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
private static final int BUTTON_WIDTH = 25;
private static final Color BORDER_COLOR = UIManager.getColor("defaultBorderColor");
private static final int BUTTON_WIDTH = UIManager.getInt("List.cellRender.button.width");
private static final int BUTTON_HEIGHT = UIManager.getInt("List.cellRender.button.height");
private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
private UILabel label;
private boolean isNewStyle;
private NameableCreator[] creators;
private Color initialLabelForeground;
public UINameableListCellRenderer( boolean isNewStyle, NameableCreator[] creators) {
private static final Icon LIST_EDIT_ICON = new LazyIcon("tool_edit");
private static final Icon CPT_ICON = new LazyIcon("cpt_icon");
public UINameableListCellRenderer(boolean isNewStyle, NameableCreator[] creators) {
super();
this.isNewStyle = isNewStyle;
this.creators = creators;
@ -43,11 +43,11 @@ public class UINameableListCellRenderer extends
private void initComponents() {
editButton = new UILabel() {
public Dimension getPreferredSize() {
return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH);
return new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT);
}
};
editButton.setIcon(isNewStyle ? UIConstants.LIST_EDIT_ICON : UIConstants.CPT_ICON);
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIConstants.LIST_ITEM_SPLIT_LINE));
editButton.setIcon(isNewStyle ? LIST_EDIT_ICON : CPT_ICON);
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
editButton.setHorizontalAlignment(SwingConstants.CENTER);
label = new UILabel();
label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
@ -58,7 +58,7 @@ public class UINameableListCellRenderer extends
}
private Border getNoFocusBorder() {
return BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LIST_ITEM_SPLIT_LINE);
return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR);
}
private void setText(String t) {
@ -87,18 +87,13 @@ public class UINameableListCellRenderer extends
if (isSelected) {
setBackground(bg == null ? list.getSelectionBackground() : bg);
setForeground(fg == null ? list.getSelectionForeground() : fg);
label.setForeground(Color.WHITE);
if (isNewStyle) {
editButton.setIcon(UIConstants.LIST_EDIT_WHITE_ICON);
}
}
else {
setBackground(list.getBackground());
} else {
setBackground(UIManager.getColor("List.cellRender.background"));
setForeground(list.getForeground());
label.setForeground(initialLabelForeground);
if (isNewStyle) {
editButton.setIcon(UIConstants.LIST_EDIT_ICON);
}
}
if (isNewStyle) {
editButton.setIcon(LIST_EDIT_ICON);
}
setText((value == null) ? "" : value.toString());
@ -107,11 +102,11 @@ public class UINameableListCellRenderer extends
setFont(list.getFont());
if (value instanceof ListModelElement) {
Nameable wrappee = ((ListModelElement) value).wrapper;
Nameable wrapper = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName());
for (NameableCreator creator : creators) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrapper) != null) {
this.setToolTipText(creator.createTooltip());
break;
}

17
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java

@ -1,6 +1,6 @@
package com.fr.design.gui.controlpane.shortcutfactory;
import com.fr.base.BaseUtils;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
@ -99,8 +99,7 @@ public abstract class AbstractShortCutFactory {
RemoveItemAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Remove")));
this.setMnemonic('R');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/base/images/cell/control/remove.png"));
this.setSmallIcon(new LazyIcon("remove"));
}
@Override
@ -116,8 +115,7 @@ public abstract class AbstractShortCutFactory {
CopyItemAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setSmallIcon(new LazyIcon("tool_copy"));
}
@Override
@ -133,8 +131,7 @@ public abstract class AbstractShortCutFactory {
MoveUpItemAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up"));
this.setMnemonic('U');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/up.png"));
this.setSmallIcon(new LazyIcon("move_up"));
}
@Override
@ -150,8 +147,7 @@ public abstract class AbstractShortCutFactory {
MoveDownItemAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down"));
this.setMnemonic('D');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/down.png"));
this.setSmallIcon(new LazyIcon("move_down"));
}
@Override
@ -166,8 +162,7 @@ public abstract class AbstractShortCutFactory {
SortItemAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Sort"));
this.setMnemonic('S');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/sortAsc.png"));
this.setSmallIcon(new LazyIcon("sort_asc"));
}
@Override

24
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -103,8 +103,8 @@ Component.defaultHeight=24
@menuBackground = @background
# selection
@selectionBackground = @accentSelectionBackground
@selectionForeground = contrast(@selectionBackground, @foreground, #fff)
@selectionBackground = #2576ef1e
@selectionForeground = @foreground
@selectionInactiveBackground = shade(@background,13%)
@selectionInactiveForeground = @foreground
@ -213,6 +213,13 @@ Button.toolbar.selectedBackground = $Button.selectedBackground
Button.toolbar.margin = 3,3,3,3
Button.toolbar.spacingInsets = 1,2,1,2
Button.group.background = #FFF
Button.group.selectedBackground = #2576EF
Button.group.pressedBackground = #2576EF
Button.group.selectedForeground = #FFF
Button.group.pressedForeground = #FFF
Button.group.minimumWidth = 32
Button.group.minimumHeight = 20
#---- CheckBox ----
CheckBox.border = com.formdev.flatlaf.ui.FlatMarginBorder
@ -308,6 +315,7 @@ ComboBox.selectionInsets = 0,0,0,0
ComboBox.selectionArc = 0
ComboBox.borderCornerRadius = 3
ComboBox.comboHeight = 24
ComboBox.selectBox.button.offsetX = 2
#---- Component ----
@ -456,13 +464,16 @@ List.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Default
List.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Focused
List.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Selected
List.background = @componentBackground
List.selectionInactiveBackground = @selectionInactiveBackground
List.selectionInactiveBackground = @selectionBackground
List.selectionInactiveForeground = @selectionInactiveForeground
List.dropCellBackground = @dropCellBackground
List.dropCellForeground = @dropCellForeground
List.dropLineColor = @dropLineColor
List.showCellFocusIndicator = false
List.cellRender.background = #FFF
List.cellRender.button.width = 28
List.cellRender.button.height = 24
List.wrapper.text.fontColor = #0a1c3877
#---- Menu ----
Menu.icon.arrowColor = @buttonArrowColor
@ -542,6 +553,11 @@ OptionPane.informationIcon = com.formdev.flatlaf.icons.FlatOptionPaneInformation
OptionPane.questionIcon = com.formdev.flatlaf.icons.FlatOptionPaneQuestionIcon
OptionPane.warningIcon = com.formdev.flatlaf.icons.FlatOptionPaneWarningIcon
#---- SortPane ----
SortPane.height = 24
SortPane.vGap = 4
SortPane.hGap = 14
#---- PasswordField ----
PasswordField.capsLockIconColor = #00000064

6
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java

@ -18,13 +18,13 @@ import java.util.List;
public abstract class AbstractSortPane extends JPanel {
protected int sortPaneWidth;
protected int sortPaneRightWidth;
public static final int PANE_COMPONENT_HEIGHT = 20;
public static final int PANE_COMPONENT_V_GAP = 4;
public static final int PANE_COMPONENT_H_GAP = 14;
protected AbstractSortGroupPane sortGroupPane;
protected SortHeaderPane sortHeaderPane;
protected String selfSortArea;
protected String defaultHeaderArea;
public static final int PANE_COMPONENT_HEIGHT = UIManager.getInt("SortPane.height");
public static final int PANE_COMPONENT_V_GAP = UIManager.getInt("SortPane.vGap");
public static final int PANE_COMPONENT_H_GAP = UIManager.getInt("SortPane.hGap");
public AbstractSortPane(Dimension dimension) {
this(dimension.width, dimension.height);

Loading…
Cancel
Save