|
|
@ -7,6 +7,7 @@ import com.fr.base.theme.settings.ThemeThumbnail; |
|
|
|
import com.fr.base.theme.settings.ThemedCellStyleList; |
|
|
|
import com.fr.base.theme.settings.ThemedCellStyleList; |
|
|
|
import com.fr.base.theme.settings.ThemedChartStyle; |
|
|
|
import com.fr.base.theme.settings.ThemedChartStyle; |
|
|
|
import com.fr.base.theme.settings.ThemedColorScheme; |
|
|
|
import com.fr.base.theme.settings.ThemedColorScheme; |
|
|
|
|
|
|
|
import com.fr.design.designer.IntervalConstants; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
|
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
@ -26,6 +27,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.general.Inter; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
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; |
|
|
@ -44,6 +46,7 @@ import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
@ -151,12 +154,12 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
return titleContainer; |
|
|
|
return titleContainer; |
|
|
|
} |
|
|
|
} |
|
|
|
private JPanel createRightPane() { |
|
|
|
private JPanel createRightPane() { |
|
|
|
JPanel container = new JPanel(new BorderLayout(0, 12)); |
|
|
|
JPanel container = new JPanel(new BorderLayout(0, 0)); |
|
|
|
container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT)); |
|
|
|
container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT)); |
|
|
|
JPanel nameEditPane = createNameEditPane(); |
|
|
|
JPanel nameEditPane = createNameEditPane(); |
|
|
|
container.add(nameEditPane, BorderLayout.NORTH); |
|
|
|
container.add(nameEditPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
JPanel settingPane = new JPanel(new BorderLayout(0, 10)); |
|
|
|
JPanel settingPane = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1)); |
|
|
|
container.add(settingPane, BorderLayout.CENTER); |
|
|
|
container.add(settingPane, BorderLayout.CENTER); |
|
|
|
settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH); |
|
|
|
settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH); |
|
|
|
settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER); |
|
|
|
settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER); |
|
|
@ -172,13 +175,6 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createNameEditPane() { |
|
|
|
private JPanel createNameEditPane() { |
|
|
|
JPanel container = new JPanel(new BorderLayout(30, 0)); |
|
|
|
|
|
|
|
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
|
|
|
|
|
|
container.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel settingContainer = new JPanel(new BorderLayout(10, 0)); |
|
|
|
|
|
|
|
container.add(settingContainer, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED); |
|
|
|
nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED); |
|
|
|
nameErrorLabel.setVisible(false); |
|
|
|
nameErrorLabel.setVisible(false); |
|
|
|
|
|
|
|
|
|
|
@ -189,14 +185,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -209,22 +205,26 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
settingContainer.add(nameTextField, BorderLayout.WEST); |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
|
|
|
|
settingContainer.add(nameErrorLabel, BorderLayout.CENTER); |
|
|
|
JPanel container = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ |
|
|
|
|
|
|
|
new Component[] { LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), nameTextField }, |
|
|
|
|
|
|
|
new Component[] { null, nameErrorLabel }, |
|
|
|
|
|
|
|
}, new double[] { 20, 20}, new double[] { p, 165}, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_W0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
|
|
return container; |
|
|
|
return container; |
|
|
|
} |
|
|
|
} |
|
|
|
private JPanel createColorSchemeEditPane() { |
|
|
|
private JPanel createColorSchemeEditPane() { |
|
|
@ -393,7 +393,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
T theme = updateBean(); |
|
|
|
T theme = updateBean(); |
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); |
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); |
|
|
|
if (canBeSaved && theme != null) { |
|
|
|
if (canBeSaved && theme != null) { |
|
|
|
theme.setName(nameTextField.getText()); |
|
|
|
theme.setName(nameTextField.getText()); |
|
|
|
config.addTheme(theme, true, new CallBackAdaptor() { |
|
|
|
config.addTheme(theme, true, new CallBackAdaptor() { |
|
|
@ -478,14 +478,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -498,14 +498,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
if (isEnabled()) { |
|
|
|
if (isEnabled()) { |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -551,7 +551,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton); |
|
|
|
if (canBeSaved && newThemeObject != null) { |
|
|
|
if (canBeSaved && newThemeObject != null) { |
|
|
|
newThemeObject.setName(name); |
|
|
|
newThemeObject.setName(name); |
|
|
|
newThemeObject.setRemovable(true); |
|
|
|
newThemeObject.setRemovable(true); |
|
|
@ -587,17 +587,28 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends |
|
|
|
private boolean isThemeNameDuplicated(String name) { |
|
|
|
private boolean isThemeNameDuplicated(String name) { |
|
|
|
return config.cachedFetch(name) != null; |
|
|
|
return config.cachedFetch(name) != null; |
|
|
|
} |
|
|
|
} |
|
|
|
private boolean checkThemeCanBeSavedAndUpdateUI(boolean checkDuplicated, UITextField textField, UILabel errorLabel, UIButton... actionButtons) { |
|
|
|
private boolean checkThemeCanBeSavedAndUpdateUI( |
|
|
|
String error = StringUtils.EMPTY; |
|
|
|
boolean checkEmpty, |
|
|
|
|
|
|
|
boolean displayEmptyTip, |
|
|
|
|
|
|
|
boolean checkDuplicated, |
|
|
|
|
|
|
|
boolean displayDuplicatedTip, |
|
|
|
|
|
|
|
UITextField textField, |
|
|
|
|
|
|
|
UILabel errorLabel, UIButton... actionButtons) { |
|
|
|
String name = textField.getText(); |
|
|
|
String name = textField.getText(); |
|
|
|
if (isThemeNameEmpty(name)) { |
|
|
|
|
|
|
|
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"); |
|
|
|
boolean valid = true; |
|
|
|
|
|
|
|
errorLabel.setText(StringUtils.EMPTY); |
|
|
|
|
|
|
|
if (checkEmpty && isThemeNameEmpty(name)) { |
|
|
|
|
|
|
|
valid = false; |
|
|
|
|
|
|
|
if (displayEmptyTip) { |
|
|
|
|
|
|
|
errorLabel.setText(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_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"); |
|
|
|
valid = false; |
|
|
|
|
|
|
|
if (displayDuplicatedTip) { |
|
|
|
|
|
|
|
errorLabel.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
errorLabel.setText(error); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean valid = StringUtils.isEmpty(error); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorLabel.setVisible(!valid); |
|
|
|
errorLabel.setVisible(!valid); |
|
|
|
if (actionButtons != null && actionButtons.length > 0) { |
|
|
|
if (actionButtons != null && actionButtons.length > 0) { |
|
|
|