|
|
@ -4,7 +4,9 @@ package com.fr.design.file; |
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
import com.fine.swing.ui.layout.Row; |
|
|
|
import com.fine.swing.ui.layout.Row; |
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
import com.fine.theme.utils.FineUIStyle; |
|
|
|
import com.fine.theme.utils.FineUIStyle; |
|
|
|
|
|
|
|
import com.formdev.flatlaf.util.ScaledEmptyBorder; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
import com.fr.design.actions.file.LocateAction; |
|
|
|
import com.fr.design.actions.file.LocateAction; |
|
|
@ -16,6 +18,7 @@ import com.fr.design.gui.imenu.UIScrollPopUpMenu; |
|
|
|
import com.fr.design.gui.itoolbar.UIToolbar; |
|
|
|
import com.fr.design.gui.itoolbar.UIToolbar; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerFrame; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; |
|
|
|
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; |
|
|
|
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; |
|
|
|
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; |
|
|
@ -41,6 +44,7 @@ import javax.swing.ToolTipManager; |
|
|
|
import java.awt.AWTEvent; |
|
|
|
import java.awt.AWTEvent; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.FlowLayout; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
@ -81,8 +85,10 @@ public class MultiTemplateTabPane extends Row { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 前导动作区宽度 |
|
|
|
* 前导动作区宽度 |
|
|
|
|
|
|
|
* 最终宽度 = {@linkplain #SINGLE_BUTTON_WIDTH} * {@literal toolBar.getComponentCount()} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static final int LEADING_WIDTH = 38; |
|
|
|
public static int LEADING_WIDTH = 38; |
|
|
|
|
|
|
|
public static int SINGLE_BUTTON_WIDTH = 38; |
|
|
|
|
|
|
|
|
|
|
|
//每个标签页的最大的长度和最小长度。这些长度均为均分
|
|
|
|
//每个标签页的最大的长度和最小长度。这些长度均为均分
|
|
|
|
|
|
|
|
|
|
|
@ -116,7 +122,7 @@ public class MultiTemplateTabPane extends Row { |
|
|
|
private Icon clodeIcon = new LazyIcon("clear"); |
|
|
|
private Icon clodeIcon = new LazyIcon("clear"); |
|
|
|
private boolean isShowList = false; |
|
|
|
private boolean isShowList = false; |
|
|
|
private JButton leadingActionButton; |
|
|
|
private JButton leadingActionButton; |
|
|
|
public UIToolbar toolBar = ToolBarDef.createJToolBar(); |
|
|
|
private final UIToolbar toolBar = new UIToolbar(); |
|
|
|
|
|
|
|
|
|
|
|
//自动新建的模板B若没有进行任何编辑,切换到其他
|
|
|
|
//自动新建的模板B若没有进行任何编辑,切换到其他
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -179,18 +185,26 @@ public class MultiTemplateTabPane extends Row { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
getToolBarMenuDock().createTemplateToolBarDef().updateToolBar(toolBar); |
|
|
|
ToolBarMenuDock toolBarMenuDock = getToolBarMenuDock(); |
|
|
|
|
|
|
|
if (toolBarMenuDock != null) { |
|
|
|
|
|
|
|
updateMultiTemplateToolBar(getToolBarMenuDock().createTemplateToolBarDef()); |
|
|
|
|
|
|
|
} |
|
|
|
add( |
|
|
|
add( |
|
|
|
Layouts.cell(toolBar).with(it -> { |
|
|
|
Layouts.cell(getToolBar()).with(it -> { |
|
|
|
it.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); |
|
|
|
it.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); |
|
|
|
|
|
|
|
it.setOpaque(false); |
|
|
|
|
|
|
|
it.setBorder(new ScaledEmptyBorder(3, -7, 3, -7)); |
|
|
|
FineUIStyle.setStyle(it, BUTTON_TAB_ACTION); |
|
|
|
FineUIStyle.setStyle(it, BUTTON_TAB_ACTION); |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ToolBarMenuDock getToolBarMenuDock() { |
|
|
|
public ToolBarMenuDock getToolBarMenuDock() { |
|
|
|
return DesignerContext.getDesignerFrame().getToolBarMenuDock(); |
|
|
|
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
|
|
|
|
|
|
|
if (designerFrame == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return designerFrame.getToolBarMenuDock(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -970,4 +984,23 @@ public class MultiTemplateTabPane extends Row { |
|
|
|
public Pair<Integer, Integer> getViewRange() { |
|
|
|
public Pair<Integer, Integer> getViewRange() { |
|
|
|
return new Pair<>(minPaintIndex, maxPaintIndex); |
|
|
|
return new Pair<>(minPaintIndex, maxPaintIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取多模板工具按钮 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 工具按钮 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public UIToolbar getToolBar() { |
|
|
|
|
|
|
|
return this.toolBar; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 生成多模板工具按钮 |
|
|
|
|
|
|
|
* @param toolBarDef |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void updateMultiTemplateToolBar(ToolBarDef toolBarDef) { |
|
|
|
|
|
|
|
toolBarDef.updateToolBar(getToolBar()); |
|
|
|
|
|
|
|
LEADING_WIDTH = getToolBar().getComponentCount() * SINGLE_BUTTON_WIDTH; |
|
|
|
|
|
|
|
getToolBar().setLayout(new FlowLayout(FlowLayout.LEFT, FineUIScale.scale(14), 0)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|