Browse Source

REPORT-107973 兼容插件图标

newui
Leo.Qin 11 months ago
parent
commit
e9ac59ea0d
  1. 36
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

36
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -7,6 +7,7 @@ import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.FlatDarkLaf;
import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -756,6 +757,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
private static final String ICON_BASE_DIR = "/com/fr/design/standard/propertiestab/";
@Deprecated
private static final String ICON_SUFFIX_NORMAL_DEPRECATED = "_normal.svg";
@Deprecated
private static final String ICON_SUFFIX_DISABLED_DEPRECATED = "_disabled.svg";
@Deprecated
private static final String ICON_SUFFIX_SELECTED_DEPRECATED = "_selected.svg";
private static final String ICON_SUFFIX_NORMAL = StringUtils.EMPTY;
private static final String ICON_SUFFIX_DISABLED = "_disabled";
private static final String ICON_SUFFIX_SELECTED = "_selected";
@ -968,13 +977,22 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
iconSuffix = ICON_SUFFIX_NORMAL;
button.setIcon(new LazyIcon(getBtnIconId()));
button.setOpaque(false);
} else if (ICON_SUFFIX_SELECTED_DEPRECATED.equals(iconSuffix)) {
iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED;
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setOpaque(false);
}
}
public void setTabButtonSelected() {
resetPropertyIcons();
iconSuffix = ICON_SUFFIX_SELECTED;
button.setIcon(new LazyIcon(getBtnIconId()));
if (iconBaseDir == null || StringUtils.isEmpty(iconBaseDir)) {
button.setIcon(new LazyIcon(getBtnIconId()));
iconSuffix = ICON_SUFFIX_SELECTED;
} else {
iconSuffix = ICON_SUFFIX_SELECTED_DEPRECATED;
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
}
button.setBackground(selectedBtnBackground);
button.setOpaque(true);
selectedItem = this;
@ -985,12 +1003,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
private void initButton() {
button = new UIButton(new LazyIcon(getBtnIconId())) {
button = new UIButton() {
public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
}
};
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED));
initButtonIcon();
button.set4LargeToolbarButton();
button.setUI(new RectangleButtonUI(false));
setStyle(button, STYLE_TEXT);
@ -1013,6 +1031,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setName(name);
}
private void initButtonIcon() {
if (iconBaseDir == null || StringUtils.isEmpty(iconBaseDir)) {
button.setIcon(new LazyIcon(getBtnIconId()));
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED));
} else {
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED));
}
}
public void processSnapChat() {
if (snapChat != null && !snapChat.hasRead()) {
snapChat.markRead();

Loading…
Cancel
Save