|
|
|
@ -18,14 +18,13 @@ import com.fr.design.mainframe.JTemplate;
|
|
|
|
|
import com.fr.design.mainframe.TemplateSavingChecker; |
|
|
|
|
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; |
|
|
|
|
import com.fr.design.utils.DesignUtils; |
|
|
|
|
import com.fr.design.utils.TemplateUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
|
import com.fr.design.worker.WorkerManager; |
|
|
|
|
import com.fr.design.utils.TemplateUtils; |
|
|
|
|
import com.fr.design.worker.save.CallbackSaveWorker; |
|
|
|
|
import com.fr.file.FILE; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
@ -69,7 +68,6 @@ import java.awt.geom.Line2D;
|
|
|
|
|
import java.awt.geom.Path2D; |
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
|
|
|
|
|
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; |
|
|
|
|
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; |
|
|
|
@ -77,11 +75,14 @@ import static javax.swing.JOptionPane.OK_OPTION;
|
|
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Author : daisy |
|
|
|
|
* Date: 13-8-5 |
|
|
|
|
* Time: 下午6:12 |
|
|
|
|
*/ |
|
|
|
|
public class MutilTempalteTabPane extends JComponent { |
|
|
|
|
* 改个名字,一个拼写 n 个错误 |
|
|
|
|
* |
|
|
|
|
* @author daisy |
|
|
|
|
* @version 11.0 |
|
|
|
|
* <p> |
|
|
|
|
* created by daisy on 2013/08/05 |
|
|
|
|
**/ |
|
|
|
|
public class MultiTemplateTabPane extends JComponent { |
|
|
|
|
|
|
|
|
|
private static Icon LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_normal.png"); |
|
|
|
|
private static Icon MOUSE_OVER_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png"); |
|
|
|
@ -110,7 +111,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
private static final int MINWIDTH = 100; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static MutilTempalteTabPane THIS; |
|
|
|
|
private static MultiTemplateTabPane THIS; |
|
|
|
|
//用于存放工作簿
|
|
|
|
|
private java.util.List<JTemplate<?, ?>> openedTemplate; |
|
|
|
|
//选中的Tab项
|
|
|
|
@ -144,9 +145,9 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
private JTemplate<?, ?> temTemplate = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static MutilTempalteTabPane getInstance() { |
|
|
|
|
public static MultiTemplateTabPane getInstance() { |
|
|
|
|
if (THIS == null) { |
|
|
|
|
THIS = new MutilTempalteTabPane(); |
|
|
|
|
THIS = new MultiTemplateTabPane(); |
|
|
|
|
} |
|
|
|
|
return THIS; |
|
|
|
|
} |
|
|
|
@ -155,7 +156,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
/** |
|
|
|
|
* 多工作簿面板 |
|
|
|
|
*/ |
|
|
|
|
public MutilTempalteTabPane() { |
|
|
|
|
public MultiTemplateTabPane() { |
|
|
|
|
this.setLayout(new BorderLayout(0, 0)); |
|
|
|
|
this.addMouseListener(new MultiTemplateTabMouseListener()); |
|
|
|
|
this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener()); |
|
|
|
@ -169,7 +170,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
public void eventDispatched(AWTEvent event) { |
|
|
|
|
if (event instanceof MouseEvent) { |
|
|
|
|
MouseEvent mv = (MouseEvent) event; |
|
|
|
|
if (mv.getClickCount() > 0 && !ComparatorUtils.equals(mv.getSource(), MutilTempalteTabPane.this)) { |
|
|
|
|
if (mv.getClickCount() > 0 && !ComparatorUtils.equals(mv.getSource(), MultiTemplateTabPane.this)) { |
|
|
|
|
isShowList = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -203,7 +204,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
//根据当前i18n语言环境,动态调整popupMenu的宽度
|
|
|
|
|
menu.setPreferredSize(new Dimension((int) DesignSizeI18nManager.getInstance(). |
|
|
|
|
i18nDimension("com.fr.design.file.MultiTemplateTabPane.popUpMenu").getWidth(), height)); |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), e.getX(), MutilTempalteTabPane.getInstance().getY() - 1 + MutilTempalteTabPane.getInstance().getHeight()); |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), e.getX(), MultiTemplateTabPane.getInstance().getY() - 1 + MultiTemplateTabPane.getInstance().getHeight()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -335,7 +336,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MutilTempalteTabPane.getInstance().repaint(); |
|
|
|
|
MultiTemplateTabPane.getInstance().repaint(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -349,7 +350,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
//判断关闭的模板是不是格式刷的被参照的模板
|
|
|
|
|
openedTemplate.remove(jTemplate); |
|
|
|
|
if (jTemplate != currentTemplate) { |
|
|
|
|
MutilTempalteTabPane.getInstance().closeFormat(jTemplate); |
|
|
|
|
MultiTemplateTabPane.getInstance().closeFormat(jTemplate); |
|
|
|
|
HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); |
|
|
|
|
closeAndFreeLock(jTemplate); |
|
|
|
|
} |
|
|
|
@ -530,7 +531,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
for (int i = 0; i < items.length; i++) { |
|
|
|
|
menu.add(items[i]); |
|
|
|
|
} |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), MutilTempalteTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1106,7 +1107,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
listDownMode = LIST_DOWN; |
|
|
|
|
closeIconIndex = -1; |
|
|
|
|
mouseOveredIndex = -1; |
|
|
|
|
MutilTempalteTabPane.this.repaint(); |
|
|
|
|
MultiTemplateTabPane.this.repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1185,7 +1186,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); |
|
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") |
|
|
|
|
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); |
|
|
|
|
MutilTempalteTabPane.this.repaint(); |
|
|
|
|
MultiTemplateTabPane.this.repaint(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX)); |
|
|
|
@ -1193,7 +1194,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
} |
|
|
|
|
isShowList = false; |
|
|
|
|
} |
|
|
|
|
MutilTempalteTabPane.this.repaint(); |
|
|
|
|
MultiTemplateTabPane.this.repaint(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -1234,7 +1235,7 @@ public class MutilTempalteTabPane extends JComponent {
|
|
|
|
|
boolean isOverCloseIcon = isOverCloseIcon(evtX); |
|
|
|
|
clodeMode = isOverCloseIcon ? MOUSE_OVER_CLOSE : CLOSE; |
|
|
|
|
closeIconIndex = isOverCloseIcon ? mouseOveredIndex : -1; |
|
|
|
|
MutilTempalteTabPane.this.repaint(); |
|
|
|
|
MultiTemplateTabPane.this.repaint(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|