|
|
@ -25,6 +25,7 @@ import com.fr.design.mainframe.theme.edit.ui.ColorListPane; |
|
|
|
import com.fr.design.mainframe.theme.edit.ui.LabelUtils; |
|
|
|
import com.fr.design.mainframe.theme.edit.ui.LabelUtils; |
|
|
|
import com.fr.design.mainframe.theme.ui.BorderUtils; |
|
|
|
import com.fr.design.mainframe.theme.ui.BorderUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.transaction.CallBackAdaptor; |
|
|
|
import com.fr.transaction.CallBackAdaptor; |
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
import com.fr.transaction.Configurations; |
|
|
@ -122,13 +123,13 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String title4PopupWindow() { |
|
|
|
public String title4PopupWindow() { |
|
|
|
return Toolkit.i18nText("Fine-Design_Predefined_Style_Edit"); |
|
|
|
return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Dialog_Title"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createLeftPane() { |
|
|
|
private JPanel createLeftPane() { |
|
|
|
JPanel titleContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel titleContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
titleContainer.setPreferredSize(new Dimension(LEFT_TITLE_PANE_WIDTH, LEFT_TITLE_PANE_HEIGHT)); |
|
|
|
titleContainer.setPreferredSize(new Dimension(LEFT_TITLE_PANE_WIDTH, LEFT_TITLE_PANE_HEIGHT)); |
|
|
|
titleContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Template_Theme_Preview_Pane_Title"), TITLE_BORDER_FONT)); |
|
|
|
titleContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Preview_Pane_Title"), TITLE_BORDER_FONT)); |
|
|
|
|
|
|
|
|
|
|
|
JPanel previewContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel previewContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
previewContainer.setBorder(BorderFactory.createEmptyBorder(5, 4, 10, 4)); |
|
|
|
previewContainer.setBorder(BorderFactory.createEmptyBorder(5, 4, 10, 4)); |
|
|
@ -166,7 +167,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
private JPanel createNameEditPane() { |
|
|
|
private JPanel createNameEditPane() { |
|
|
|
JPanel container = new JPanel(new BorderLayout(30, 0)); |
|
|
|
JPanel container = new JPanel(new BorderLayout(30, 0)); |
|
|
|
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
|
|
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
|
|
container.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Name")), BorderLayout.WEST); |
|
|
|
container.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
|
|
JPanel settingContainer = new JPanel(new BorderLayout(10, 0)); |
|
|
|
JPanel settingContainer = new JPanel(new BorderLayout(10, 0)); |
|
|
|
container.add(settingContainer, BorderLayout.CENTER); |
|
|
|
container.add(settingContainer, BorderLayout.CENTER); |
|
|
@ -235,11 +236,11 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
double[] columnSize = {p, p}; |
|
|
|
double[] columnSize = {p, p}; |
|
|
|
|
|
|
|
|
|
|
|
JPanel previewLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel previewLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
previewLabelPane.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Color_Scheme_Preview_Label")), BorderLayout.NORTH); |
|
|
|
previewLabelPane.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Preview_Label")), BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
JPanel content = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ |
|
|
|
JPanel content = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ |
|
|
|
{LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Color_Scheme_Edit_Label")), colorListPane}, |
|
|
|
{LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Label")), colorListPane}, |
|
|
|
{null, LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Color_Scheme_Edit_Tip"), new Color(0XC6C6C6), 10)}, |
|
|
|
{null, LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Tip"), new Color(0XC6C6C6), 10)}, |
|
|
|
{previewLabelPane, extendedContainer}, |
|
|
|
{previewLabelPane, extendedContainer}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
rowSize, columnSize, 18, 7); |
|
|
|
rowSize, columnSize, 18, 7); |
|
|
@ -247,7 +248,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
|
|
|
|
|
|
|
|
JPanel borderContainer = new JPanel(new BorderLayout()); |
|
|
|
JPanel borderContainer = new JPanel(new BorderLayout()); |
|
|
|
borderContainer.setPreferredSize(new Dimension(COLOR_SCHEME_TITLE_PANE_WIDTH, COLOR_SCHEME_TITLE_PANE_HEIGHT)); |
|
|
|
borderContainer.setPreferredSize(new Dimension(COLOR_SCHEME_TITLE_PANE_WIDTH, COLOR_SCHEME_TITLE_PANE_HEIGHT)); |
|
|
|
borderContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Color_Scheme_Title"))); |
|
|
|
borderContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Title"))); |
|
|
|
borderContainer.add(content); |
|
|
|
borderContainer.add(content); |
|
|
|
|
|
|
|
|
|
|
|
JPanel container = new JPanel(new BorderLayout()); |
|
|
|
JPanel container = new JPanel(new BorderLayout()); |
|
|
@ -265,7 +266,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
} |
|
|
|
} |
|
|
|
protected JPanel createCustomEditorsPane() { |
|
|
|
protected JPanel createCustomEditorsPane() { |
|
|
|
JPanel container = new JPanel(new BorderLayout()); |
|
|
|
JPanel container = new JPanel(new BorderLayout()); |
|
|
|
container.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Custom_Settings_Title"))); |
|
|
|
container.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Custom_Settings_Title"))); |
|
|
|
|
|
|
|
|
|
|
|
uiTabbedPane = new UITabbedPane(); |
|
|
|
uiTabbedPane = new UITabbedPane(); |
|
|
|
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); |
|
|
|
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); |
|
|
@ -311,7 +312,11 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populateBean(T theme) { |
|
|
|
public void populateBean(T theme) { |
|
|
|
this.theme = theme; |
|
|
|
try { |
|
|
|
|
|
|
|
this.theme = (T) theme.clone(); |
|
|
|
|
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
isPopulating = true; |
|
|
|
isPopulating = true; |
|
|
|
|
|
|
|
|
|
|
|
String name = theme.getName(); |
|
|
|
String name = theme.getName(); |
|
|
@ -370,7 +375,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
|
|
|
|
|
|
|
|
public UIButton createSaveButton() { |
|
|
|
public UIButton createSaveButton() { |
|
|
|
saveButton = new UIButton(); |
|
|
|
saveButton = new UIButton(); |
|
|
|
saveButton.setText(Toolkit.i18nText("Fine-Design_Basic_Save")); |
|
|
|
saveButton.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save")); |
|
|
|
saveButton.setEnabled(false); |
|
|
|
saveButton.setEnabled(false); |
|
|
|
saveButton.addActionListener(new ActionListener() { |
|
|
|
saveButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -401,7 +406,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
public UIButton createSaveAsButton(final TemplateThemeProfileDialog<T> profileDialog) { |
|
|
|
public UIButton createSaveAsButton(final TemplateThemeProfileDialog<T> profileDialog) { |
|
|
|
saveAsButton = new UIButton(); |
|
|
|
saveAsButton = new UIButton(); |
|
|
|
saveAsButton.removeAll(); |
|
|
|
saveAsButton.removeAll(); |
|
|
|
saveAsButton.setText(Toolkit.i18nText("Fine-Design_Basic_Predefined_Save_As_New")); |
|
|
|
saveAsButton.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_As")); |
|
|
|
saveAsButton.setEnabled(false); |
|
|
|
saveAsButton.setEnabled(false); |
|
|
|
saveAsButton.addActionListener(new ActionListener() { |
|
|
|
saveAsButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -421,7 +426,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
public SaveAsDialog(TemplateThemeProfileDialog<T> dialog) { |
|
|
|
public SaveAsDialog(TemplateThemeProfileDialog<T> dialog) { |
|
|
|
super(dialog, ModalityType.APPLICATION_MODAL); |
|
|
|
super(dialog, ModalityType.APPLICATION_MODAL); |
|
|
|
|
|
|
|
|
|
|
|
setTitle(Toolkit.i18nText("Fine-Design_Template_Theme_Save_As_Dialog_Title")); |
|
|
|
setTitle(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Save_As_Dialog_Title")); |
|
|
|
setResizable(false); |
|
|
|
setResizable(false); |
|
|
|
setSize(new Dimension(300, 140)); |
|
|
|
setSize(new Dimension(300, 140)); |
|
|
|
GUICoreUtils.centerWindow(this); |
|
|
|
GUICoreUtils.centerWindow(this); |
|
|
@ -448,26 +453,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
T theme = updateBean(); |
|
|
|
saveAsNew(nameTextField.getText()); |
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
|
|
|
|
if (canBeSaved && theme != null) { |
|
|
|
|
|
|
|
theme.setName(nameTextField.getText()); |
|
|
|
|
|
|
|
theme.setRemovable(true); |
|
|
|
|
|
|
|
theme.setMutable(true); |
|
|
|
|
|
|
|
Configurations.modify(new WorkerFacade(config.getClass()) { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
config.addTheme(theme, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.addCallBack(new CallBackAdaptor() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void afterCommit() { |
|
|
|
|
|
|
|
super.afterCommit(); |
|
|
|
|
|
|
|
exit(); |
|
|
|
|
|
|
|
parent.exit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -531,8 +517,9 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
|
|
|
|
JPanel nameTextPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5); |
|
|
|
JPanel nameTextPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5); |
|
|
|
|
|
|
|
nameTextPane.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); |
|
|
|
|
|
|
|
nameTextPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Save_As_Pane_Name_Label"))); |
|
|
|
nameTextPane.add(nameTextField); |
|
|
|
nameTextPane.add(nameTextField); |
|
|
|
nameTextPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Theme_Save_As_Pane_Name_Label"))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.add(nameTextPane, BorderLayout.CENTER); |
|
|
|
container.add(nameTextPane, BorderLayout.CENTER); |
|
|
|
container.add(nameErrorLabel, BorderLayout.SOUTH); |
|
|
|
container.add(nameErrorLabel, BorderLayout.SOUTH); |
|
|
@ -540,6 +527,36 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
return container; |
|
|
|
return container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void saveAsNew(String name) { |
|
|
|
|
|
|
|
T newThemeObject = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
newThemeObject = (T) updateBean().clone(); |
|
|
|
|
|
|
|
} catch (CloneNotSupportedException ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
|
|
|
|
if (canBeSaved && newThemeObject != null) { |
|
|
|
|
|
|
|
newThemeObject.setName(name); |
|
|
|
|
|
|
|
newThemeObject.setRemovable(true); |
|
|
|
|
|
|
|
newThemeObject.setMutable(true); |
|
|
|
|
|
|
|
T finalNewThemeObject = newThemeObject; |
|
|
|
|
|
|
|
Configurations.modify(new WorkerFacade(config.getClass()) { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
config.addTheme(finalNewThemeObject, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.addCallBack(new CallBackAdaptor() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void afterCommit() { |
|
|
|
|
|
|
|
super.afterCommit(); |
|
|
|
|
|
|
|
exit(); |
|
|
|
|
|
|
|
parent.exit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void exit() { |
|
|
|
public void exit() { |
|
|
|
this.dispose(); |
|
|
|
this.dispose(); |
|
|
|
} |
|
|
|
} |
|
|
@ -555,17 +572,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
String error = StringUtils.EMPTY; |
|
|
|
String error = StringUtils.EMPTY; |
|
|
|
String name = textField.getText(); |
|
|
|
String name = textField.getText(); |
|
|
|
if (isThemeNameEmpty(name)) { |
|
|
|
if (isThemeNameEmpty(name)) { |
|
|
|
error = Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"); |
|
|
|
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"); |
|
|
|
} else if (checkDuplicated && isThemeNameDuplicated(name)) { |
|
|
|
} else if (checkDuplicated && isThemeNameDuplicated(name)) { |
|
|
|
error = Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"); |
|
|
|
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"); |
|
|
|
} |
|
|
|
} |
|
|
|
errorLabel.setText(error); |
|
|
|
errorLabel.setText(error); |
|
|
|
|
|
|
|
|
|
|
|
boolean valid = StringUtils.isEmpty(error); |
|
|
|
boolean valid = StringUtils.isEmpty(error); |
|
|
|
|
|
|
|
|
|
|
|
if (!valid) { |
|
|
|
|
|
|
|
textField.requestFocus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
errorLabel.setVisible(!valid); |
|
|
|
errorLabel.setVisible(!valid); |
|
|
|
if (actionButtons != null && actionButtons.length > 0) { |
|
|
|
if (actionButtons != null && actionButtons.length > 0) { |
|
|
|
for (UIButton button : actionButtons) { |
|
|
|
for (UIButton button : actionButtons) { |
|
|
|