|
|
@ -51,6 +51,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
private final List<UIObserverListener> observerListeners = new ArrayList<>(); |
|
|
|
private final List<UIObserverListener> observerListeners = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
private Style backupStyleFromPopulating = Style.DEFAULT_STYLE; |
|
|
|
private Style backupStyleFromPopulating = Style.DEFAULT_STYLE; |
|
|
|
|
|
|
|
private boolean isFollowingThemeSettingChanged = false; |
|
|
|
|
|
|
|
|
|
|
|
public StylePane() { |
|
|
|
public StylePane() { |
|
|
|
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); |
|
|
|
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); |
|
|
@ -77,6 +78,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
followingThemeButtonGroup.addActionListener(new ActionListener() { |
|
|
|
followingThemeButtonGroup.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
isFollowingThemeSettingChanged = true; |
|
|
|
AttributeChangeUtils.changeComposedUI(StylePane.this, false, new AttributeChangeUtils.UIChangeAction() { |
|
|
|
AttributeChangeUtils.changeComposedUI(StylePane.this, false, new AttributeChangeUtils.UIChangeAction() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void changeComposedUI() { |
|
|
|
public void changeComposedUI() { |
|
|
@ -85,6 +87,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
fireStateChanged(); |
|
|
|
fireStateChanged(); |
|
|
|
|
|
|
|
isFollowingThemeSettingChanged = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -103,25 +106,33 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]); |
|
|
|
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]); |
|
|
|
if (!isFollowingTheme) { |
|
|
|
if (!isFollowingTheme) { |
|
|
|
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
|
|
|
|
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
|
|
|
|
NameStyle lastSelectedNameStyle = nameStyleListPane.updateNameStyle(); |
|
|
|
syncCustomStylePaneBySelectedNameStyle(); |
|
|
|
if (lastSelectedNameStyle != null) { |
|
|
|
|
|
|
|
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone(); |
|
|
|
|
|
|
|
if (lastSelectedRealStyle != null) { |
|
|
|
|
|
|
|
customStylePane.populateBean(lastSelectedRealStyle); |
|
|
|
|
|
|
|
customStylePane.dealWithBorder(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (CloneNotSupportedException ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
|
|
|
|
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
|
|
|
|
nameStyleListPane.reset(); |
|
|
|
nameStyleListPane.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void syncCustomStylePaneBySelectedNameStyle() { |
|
|
|
|
|
|
|
NameStyle lastSelectedNameStyle = nameStyleListPane.updateNameStyle(); |
|
|
|
|
|
|
|
if (lastSelectedNameStyle != null) { |
|
|
|
|
|
|
|
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone(); |
|
|
|
|
|
|
|
if (lastSelectedRealStyle != null) { |
|
|
|
|
|
|
|
customStylePane.populateBean(lastSelectedRealStyle); |
|
|
|
|
|
|
|
customStylePane.dealWithBorder(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (CloneNotSupportedException ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isFollowingThemeSettingChanged() { |
|
|
|
|
|
|
|
return isFollowingThemeSettingChanged; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected JPanel createTabbedContentPane() { |
|
|
|
protected JPanel createTabbedContentPane() { |
|
|
|
JPanel contentPane = new JPanel(cardLayout) { |
|
|
|
JPanel contentPane = new JPanel(cardLayout) { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -161,14 +172,22 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style"); |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setSelectedIndex(int index) { |
|
|
|
public boolean isFollowingTheme() { |
|
|
|
|
|
|
|
return getSelectedIndex() == 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setFollowingTheme(boolean followingTheme) { |
|
|
|
|
|
|
|
setSelectedIndex(followingTheme ? 0 : 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setSelectedIndex(int index) { |
|
|
|
if (0 <= index && index < FOLLOWING_THEME_STRING_ARRAYS.length) { |
|
|
|
if (0 <= index && index < FOLLOWING_THEME_STRING_ARRAYS.length) { |
|
|
|
followingThemeButtonGroup.setSelectedIndex(index); |
|
|
|
followingThemeButtonGroup.setSelectedIndex(index); |
|
|
|
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[index]); |
|
|
|
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getSelectedIndex() { |
|
|
|
private int getSelectedIndex() { |
|
|
|
return followingThemeButtonGroup.getSelectedIndex(); |
|
|
|
return followingThemeButtonGroup.getSelectedIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -185,11 +204,11 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setSelctedByName(String id) { |
|
|
|
public void setSelctedByName(String id) { |
|
|
|
setSelectedIndex(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), id)? 1 : 0); |
|
|
|
setFollowingTheme(!ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CellBorderStyle updateBorderStyle() { |
|
|
|
public CellBorderStyle updateBorderStyle() { |
|
|
|
if (getSelectedIndex() == 0) { |
|
|
|
if (isFollowingTheme()) { |
|
|
|
return nameStyleListPane.updateBorderStyle(); |
|
|
|
return nameStyleListPane.updateBorderStyle(); |
|
|
|
} else if (customStylePane.isBorderPaneSelected()) { |
|
|
|
} else if (customStylePane.isBorderPaneSelected()) { |
|
|
|
return customStylePane.updateBorderStyle(); |
|
|
|
return customStylePane.updateBorderStyle(); |
|
|
@ -199,7 +218,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
|
|
|
|
|
|
|
|
public Style updateBean() { |
|
|
|
public Style updateBean() { |
|
|
|
Style finalStyle = null; |
|
|
|
Style finalStyle = null; |
|
|
|
if (getSelectedIndex() == 0) { |
|
|
|
if (isFollowingTheme()) { |
|
|
|
finalStyle = nameStyleListPane.updateNameStyle(); |
|
|
|
finalStyle = nameStyleListPane.updateNameStyle(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (finalStyle == null) { |
|
|
|
if (finalStyle == null) { |
|
|
@ -215,7 +234,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
|
|
|
|
|
|
|
|
if (style instanceof NameStyle) { |
|
|
|
if (style instanceof NameStyle) { |
|
|
|
NameStyle nameStyle = (NameStyle) style; |
|
|
|
NameStyle nameStyle = (NameStyle) style; |
|
|
|
setSelectedIndex(0); |
|
|
|
setFollowingTheme(true); |
|
|
|
nameStyleListPane.populateNameStyle(nameStyle); |
|
|
|
nameStyleListPane.populateNameStyle(nameStyle); |
|
|
|
Style realStyle = nameStyle.getRealStyle(); |
|
|
|
Style realStyle = nameStyle.getRealStyle(); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -225,7 +244,7 @@ public class StylePane extends BasicPane implements UIObserver { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setSelectedIndex(1); |
|
|
|
setFollowingTheme(false); |
|
|
|
customStylePane.populateBean(style); |
|
|
|
customStylePane.populateBean(style); |
|
|
|
} |
|
|
|
} |
|
|
|
//单元格配置界面是单例 所以直接在populate的时候把跟随主题的按钮组设置不可见
|
|
|
|
//单元格配置界面是单例 所以直接在populate的时候把跟随主题的按钮组设置不可见
|
|
|
|