|
|
@ -1,9 +1,8 @@ |
|
|
|
package com.fr.design.mainframe.theme.dialog; |
|
|
|
package com.fr.design.mainframe.theme.dialog; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.theme.ThemedTemplate; |
|
|
|
|
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.base.theme.TemplateThemeConfig; |
|
|
|
import com.fr.base.theme.TemplateThemeConfig; |
|
|
|
import com.fr.design.base.mode.DesignModeContext; |
|
|
|
import com.fr.base.theme.ThemedTemplate; |
|
|
|
import com.fr.design.event.ChangeEvent; |
|
|
|
import com.fr.design.event.ChangeEvent; |
|
|
|
import com.fr.design.event.ChangeListener; |
|
|
|
import com.fr.design.event.ChangeListener; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
@ -11,7 +10,6 @@ import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeListPane; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeListPane; |
|
|
|
import com.fr.design.mainframe.theme.ui.BorderUtils; |
|
|
|
import com.fr.design.mainframe.theme.ui.BorderUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
@ -43,54 +41,25 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { |
|
|
|
|
|
|
|
|
|
|
|
JPanel content = createContent(); |
|
|
|
JPanel content = createContent(); |
|
|
|
UIButton openThemeManagerButton = createOpenThemeManagerButton(); |
|
|
|
UIButton openThemeManagerButton = createOpenThemeManagerButton(); |
|
|
|
UIButton usingCurrentThemeButton = createUsingCurrentThemeButton(); |
|
|
|
|
|
|
|
UIButton completeButton = createCompleteButton(); |
|
|
|
UIButton completeButton = createCompleteButton(); |
|
|
|
|
|
|
|
|
|
|
|
setContentPane(createDialogContentPane(content, |
|
|
|
setContentPane(createDialogContentPane(content, |
|
|
|
new UIButton[]{ openThemeManagerButton }, |
|
|
|
new UIButton[]{ openThemeManagerButton }, |
|
|
|
new UIButton[]{ usingCurrentThemeButton, completeButton } |
|
|
|
new UIButton[]{ completeButton } |
|
|
|
)); |
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
themeListPane.startListenThemeConfig(); |
|
|
|
themeListPane.startListenThemeConfig(); |
|
|
|
|
|
|
|
|
|
|
|
resetEnableCurrentThemeButton(themeListPane.getSelectedTheme(), usingCurrentThemeButton); |
|
|
|
|
|
|
|
themeListPane.setSelectedChangeListener(new ChangeListener() { |
|
|
|
themeListPane.setSelectedChangeListener(new ChangeListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void fireChanged(ChangeEvent event) { |
|
|
|
public void fireChanged(ChangeEvent event) { |
|
|
|
resetEnableCurrentThemeButton(themeListPane.getSelectedTheme(), usingCurrentThemeButton); |
|
|
|
TemplateTheme theme = themeListPane.getSelectedTheme(); |
|
|
|
} |
|
|
|
if (theme != null) { |
|
|
|
}); |
|
|
|
currentTemplate.setTemplateTheme(theme); |
|
|
|
} |
|
|
|
themeListPane.repaint(); |
|
|
|
|
|
|
|
|
|
|
|
private void resetEnableCurrentThemeButton(T selectedTheme, UIButton usingCurrentThemeButton) { |
|
|
|
|
|
|
|
if (selectedTheme == null) { |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(false); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String selectedThemeName = selectedTheme.getName(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(selectedThemeName)) { |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(false); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentTemplate == null) { |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(false); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TemplateTheme templateUsingTheme = currentTemplate.getTemplateTheme(); |
|
|
|
|
|
|
|
if (templateUsingTheme == null) { |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(true); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String templateUsingThemeName = templateUsingTheme.getName(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(templateUsingThemeName)) { |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(true); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
usingCurrentThemeButton.setEnabled(!StringUtils.equals(templateUsingThemeName, selectedTheme.getName())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createContent() { |
|
|
|
private JPanel createContent() { |
|
|
@ -123,17 +92,6 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private UIButton createUsingCurrentThemeButton() { |
|
|
|
|
|
|
|
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Use")); |
|
|
|
|
|
|
|
button.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
apply2CurrentTemplate(button); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return button; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIButton createCompleteButton() { |
|
|
|
private UIButton createCompleteButton() { |
|
|
|
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Complete")); |
|
|
|
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Complete")); |
|
|
|
button.addActionListener(new ActionListener() { |
|
|
|
button.addActionListener(new ActionListener() { |
|
|
@ -150,13 +108,4 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { |
|
|
|
themeListPane.stopAsyncFetchTheme(); |
|
|
|
themeListPane.stopAsyncFetchTheme(); |
|
|
|
super.exit(); |
|
|
|
super.exit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void apply2CurrentTemplate(UIButton usingCurrentThemeButton) { |
|
|
|
|
|
|
|
TemplateTheme theme = themeListPane.getSelectedTheme(); |
|
|
|
|
|
|
|
if (theme != null) { |
|
|
|
|
|
|
|
currentTemplate.setTemplateTheme(theme); |
|
|
|
|
|
|
|
themeListPane.repaint(); |
|
|
|
|
|
|
|
usingCurrentThemeButton.setEnabled(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |