|
|
|
@ -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.ui.BorderUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.transaction.CallBackAdaptor; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
@ -311,7 +312,11 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
String name = theme.getName(); |
|
|
|
@ -448,26 +453,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
|
|
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
T theme = updateBean(); |
|
|
|
|
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(); |
|
|
|
|
} |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
saveAsNew(nameTextField.getText()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -540,6 +526,36 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
|
|
|
|
|
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() { |
|
|
|
|
this.dispose(); |
|
|
|
|
} |
|
|
|
|