|
|
|
@ -94,6 +94,8 @@ import javax.swing.JOptionPane;
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
import javax.swing.undo.UndoManager; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.FontMetrics; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.concurrent.Callable; |
|
|
|
|
|
|
|
|
@ -103,6 +105,7 @@ import java.util.concurrent.Callable;
|
|
|
|
|
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener, ThemedTemplate { |
|
|
|
|
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
|
|
|
|
|
|
|
|
|
|
private static final int PREDEFINED_ICON_WIDTH = 27; |
|
|
|
|
private static final int PREFIX_NUM = 3000; |
|
|
|
|
protected FILE editingFILE = null; |
|
|
|
|
// alex:初始状态为saved,这样不管是新建模板,还是打开模板,如果未做任何操作直接关闭,不提示保存
|
|
|
|
@ -1420,8 +1423,15 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected UIButton createTemplateThemeButton() { |
|
|
|
|
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")); |
|
|
|
|
button.setToolTipText(Toolkit.i18nText("Fine-Design_Template_Theme_Using_Dialog_Title")); |
|
|
|
|
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")) { |
|
|
|
|
@Override |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
FontMetrics metrics = getFontMetrics(getFont()); |
|
|
|
|
int width = Math.min(metrics.stringWidth(getText()) + PREDEFINED_ICON_WIDTH, 100); |
|
|
|
|
return new Dimension(width, 20); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
button.setToolTipText(getTemplateTheme().getName()); |
|
|
|
|
button.setText(getTemplateTheme().getName()); |
|
|
|
|
button.setAlignmentX(SwingConstants.LEFT); |
|
|
|
|
button.set4ToolbarButton(); |
|
|
|
@ -1730,6 +1740,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
|
|
|
|
|
@Override |
|
|
|
|
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) { |
|
|
|
|
ThemedTemplate.super.setTemplateTheme(newTheme, compatible); |
|
|
|
|
templateThemeButton.setText(newTheme.getName()); |
|
|
|
|
String name = newTheme.getName(); |
|
|
|
|
templateThemeButton.setText(name); |
|
|
|
|
templateThemeButton.setToolTipText(name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|