|
|
@ -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; |
|
|
@ -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(); |
|
|
@ -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.add(nameTextField); |
|
|
|
nameTextPane.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); |
|
|
|
nameTextPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Theme_Save_As_Pane_Name_Label"))); |
|
|
|
nameTextPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Theme_Save_As_Pane_Name_Label"))); |
|
|
|
|
|
|
|
nameTextPane.add(nameTextField); |
|
|
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|