diff --git a/designer-base/src/main/java/com/fr/design/DesignState.java b/designer-base/src/main/java/com/fr/design/DesignState.java index fc7130aa26..fcc971b7e4 100644 --- a/designer-base/src/main/java/com/fr/design/DesignState.java +++ b/designer-base/src/main/java/com/fr/design/DesignState.java @@ -1,6 +1,7 @@ package com.fr.design; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.workspace.WorkContext; @@ -43,7 +44,7 @@ public class DesignState { // designState += REMOTE; // } // isRoot = env != null && env.isRoot(); - isAuthority = BaseUtils.isAuthorityEditing(); + isAuthority = DesignerMode.isAuthorityEditing(); } public int getDesignState() { diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 4d73692054..507632c72a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1,81 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; + +import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; +import com.fr.design.constants.UIConstants; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.roleAuthority.ReportAndFSManagePane; +import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.mainframe.*; + +/** + * Author : daisy + * Date: 13-8-30 + * Time: 上午10:12 + */ +public class AllowAuthorityEditAction extends TemplateComponentAction { + + public AllowAuthorityEditAction(TargetComponent t) { + super(t); + this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); + this.setName(getMenuKeySet().getMenuName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); + } + + /** + * 撤销 + */ + public void prepare4Undo() { + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + public boolean executeActionReturnUndoRecordNeeded() { + TargetComponent tc = getEditingComponent(); + if (tc == null) { + return false; + } + + cleanAuthorityCondition(); + + //进入时是格式刷则取消格式刷 + if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { + tc.cancelFormat(); + } + DesignerMode.setMode(DesignerMode.AUTHORITY); + ReportAndFSManagePane.getInstance().refreshDockingView(); + RolesAlreadyEditedPane.getInstance().refreshDockingView(); + WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); + DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); + DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); + DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); + EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); + DesignerContext.getDesignerFrame().refreshDottedLine(); + EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); + EastRegionContainerPane.getInstance().removeParameterPane(); + + //画虚线 + return true; + } + + + /** + * 进入权限编辑之前将权限编辑界面重置一下工具栏 + */ + private void cleanAuthorityCondition() { + + java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); + for (int i = 0; i < opendedTemplate.size(); i++) { + opendedTemplate.get(i).cleanAuthorityUndo(); + } + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index a90f7923ce..4d2b1d40a2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.DesignModelAdapter; import com.fr.design.designer.TargetComponent; @@ -33,8 +34,8 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { return false; } - if (BaseUtils.isAuthorityEditing()) { - BaseUtils.setAuthorityEditing(false); + if (DesignerMode.isAuthorityEditing()) { + DesignerMode.setMode(DesignerMode.NORMARL); WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 5cb36f3df8..e1c426eec7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -1,6 +1,7 @@ package com.fr.design.actions.file; import com.fr.base.extension.FileExtension; +import com.fr.base.vcs.DesignerMode; import com.fr.design.fun.PreviewProvider; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -15,6 +16,7 @@ import com.fr.stable.web.AbstractWebletCreator; import javax.swing.JOptionPane; import java.util.Collections; +import java.util.HashMap; import java.util.Map; public final class WebPreviewUtils { @@ -34,6 +36,12 @@ public final class WebPreviewUtils { return; } + if (map == null || map == Collections.EMPTY_MAP) { + map = new HashMap<>(); + } + if (DesignerMode.isVcsMode()) { + map.put("mode", DesignerMode.getMode().toString()); + } DesignerContext.getDesignerFrame().refreshToolbar(); jt.stopEditing(); @@ -105,4 +113,4 @@ public final class WebPreviewUtils { } } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2ebd5fe9c0..0190e60784 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -3,6 +3,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; @@ -313,6 +314,15 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M } + public void paint(Graphics g) { + //不可见时,按钮.4f透明 + AlphaComposite composite = DesignerMode.isVcsMode() + ? AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f) + : (AlphaComposite) ((Graphics2D) g).getComposite(); + ((Graphics2D) g).setComposite(composite); + super.paint(g); + } + private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { paintDefaultBackground(g2d); //最多能画的个数 @@ -359,7 +369,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M templateStartX += realWidth; } + if (!DesignerMode.isVcsMode()) { paintListDown(g2d, maxWidth); + } paintUnderLine(templateStartX, maxWidth, g2d); } @@ -538,7 +550,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + if (!DesignerMode.isVcsMode()) { closeIcon.paintIcon(this, g2d, closePosition, closeY); + } return closePosition; } @@ -594,7 +608,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; + if (!DesignerMode.isVcsMode()) { closeIcon.paintIcon(this, g2d, closePosition, closeY); + } return closePosition; } @@ -640,6 +656,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M * @param e 鼠标事件 */ public void mousePressed(MouseEvent e) { + //如果在版本管理情况下,不允许切换tab + if (DesignerMode.isVcsMode()) { + return; + } int evtX = e.getX(); int evtY = e.getY(); @@ -672,7 +692,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M openedTemplate.get(selectedIndex).stopEditing(); selectedIndex = getTemplateIndex(evtX); //如果在权限编辑情况下,不允许切换到表单类型的工作簿 - if (BaseUtils.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { + if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); @@ -712,7 +732,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/"); - if (!specifiedTemplate.isALLSaved()) { + if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -951,4 +971,4 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java index 47db76f4e5..dae921a1c8 100644 --- a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; @@ -20,11 +21,10 @@ import java.awt.geom.Rectangle2D; public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener { private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png"); - private static final int PRE_GAP = 0; + private static final int ICON_START_X = 5; private static final int HEIGHT = 26; private Graphics2D g2d; private Icon newWorkBookIconMode = null; - private int newIconStartX = PRE_GAP; public NewTemplatePane() { @@ -49,7 +49,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight())); int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; - newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY); + newWorkBookIconMode.paintIcon(this, g2d, ICON_START_X, sheetIconY); // paintUnderLine(g2d); } @@ -65,7 +65,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseClicked(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -76,12 +76,11 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene */ public void mousePressed(MouseEvent e) { int evtX = e.getX(); - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { newWorkBookIconMode = getMousePressNew(); - newIconStartX = 0; DesignerContext.getDesignerFrame().addAndActivateJTemplate(); } this.repaint(); @@ -92,7 +91,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseReleased(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -102,7 +101,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseEntered(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -112,8 +111,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseExited(MouseEvent e) { - newIconStartX = PRE_GAP; - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } else { newWorkBookIconMode = getNew(); @@ -135,10 +133,9 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene */ public void mouseMoved(MouseEvent e) { int evtX = e.getX(); - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } else if (isOverNewIcon(evtX)) { - newIconStartX = 0; newWorkBookIconMode = getMouseOverNew(); } @@ -146,9 +143,13 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene } + private boolean needGrayNewCpt() { + return DesignerMode.isAuthorityEditing() || DesignerMode.isVcsMode(); + } + private boolean isOverNewIcon(int evtX) { - return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth()); + return (evtX >= ICON_START_X && evtX <= ICON_START_X + newWorkBookIconMode.getIconWidth()); } public void setButtonGray(boolean isGray) { @@ -161,4 +162,4 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene public abstract Icon getMousePressNew(); -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java new file mode 100644 index 0000000000..f5c9e09c6a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java @@ -0,0 +1,14 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Aftermath; +import com.fr.stable.fun.mark.Mutable; + +/** + * 左上角目录树上边工具条的插件接口 + * Created by hzzz on 2017/11/30. + */ +public interface TemplateTreeShortCutProvider extends Mutable, Aftermath { + String XML_TAG = "TemplateTreeShortCut"; + + int CURRENT_LEVEL = 1; +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java new file mode 100644 index 0000000000..22fe8aa767 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java @@ -0,0 +1,26 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.fun.TemplateTreeShortCutProvider; +import com.fr.stable.fun.mark.API; + +/** + * 左上角目录树上边工具条的插件接口 + * Created by hzzz on 2017/11/30. + */ +@API(level = TemplateTreeShortCutProvider.CURRENT_LEVEL) +public abstract class AbstractTemplateTreeShortCutProvider extends UpdateAction implements TemplateTreeShortCutProvider { + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void process() { + } + + @Override + public void undo() { + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index be6f570aca..6da878d8d7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -13,6 +13,7 @@ import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.stable.Constants; @@ -174,7 +175,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); @@ -187,7 +188,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); @@ -199,7 +200,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { Color oldColor = g2d.getColor(); - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); } else { g2d.setColor(UIConstants.POP_DIALOG_BORDER); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index 81b291f41d..1513eb6e95 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; @@ -281,7 +282,7 @@ public class UIEastResizableContainer extends JPanel { } onResize(); refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index 2492a6c360..51bdba9859 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -72,7 +73,7 @@ public class UIModeControlContainer extends JLayeredPane { public void needToShowCoverAndHidPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.remove(coverPane); this.remove(hidePane); } else { @@ -115,7 +116,7 @@ public class UIModeControlContainer extends JLayeredPane { if (isHideMode || !upEditMode) { return; } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); @@ -142,7 +143,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } boolean notUpEditMode = isHideMode || !upEditMode; @@ -183,7 +184,7 @@ public class UIModeControlContainer extends JLayeredPane { setUpPaneHeight(0); } - if (BaseUtils.isAuthorityEditing() && isSheeetCovered) { + if (DesignerMode.isAuthorityEditing() && isSheeetCovered) { sheetInvisibleCoverPane.setBounds(0, toolPaneY + toolPaneHeight + UIConstants.SIZE, getWidth(), getHeight() - toolPaneY - toolPaneHeight - sheetCorverGap); UIModeControlContainer.this.add(sheetInvisibleCoverPane); UIModeControlContainer.this.setLayer(sheetInvisibleCoverPane, 2); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 09d95f8434..73199d2ab2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; @@ -443,7 +444,7 @@ public class UIResizableContainer extends JPanel { containerWidth = toolPaneHeight; } refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } @@ -476,7 +477,7 @@ public class UIResizableContainer extends JPanel { containerWidth = toolPaneHeight; } refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 9e9746ec23..81e1ccfe8a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -22,6 +23,7 @@ import com.fr.design.file.NewTemplatePane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.TitlePlaceProcessor; +import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; @@ -32,6 +34,7 @@ import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; +import com.fr.design.menu.ShortCut; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FILE; @@ -97,6 +100,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Set; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { @@ -218,9 +222,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - - if (BaseUtils.isAuthorityEditing()) { - BaseUtils.setAuthorityEditing(false); + if (DesignerMode.isAuthorityEditing()) { + DesignerMode.setMode(DesignerMode.NORMARL); WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); @@ -303,7 +306,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void componentResized(ComponentEvent e) { reCalculateFrameSize(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { doResize(); } } @@ -526,7 +529,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void refreshDottedLine() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { populateAuthorityArea(); populateCloseButton(); addDottedLine(); @@ -589,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta for (int i = 0; i < fixButtons.length; i++) { combineUp.add(fixButtons[i]); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { combineUp.addSeparator(new Dimension(2, 16)); if (toolbar4Form != null) { for (int i = 0; i < toolbar4Form.length; i++) { @@ -706,7 +709,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); + newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing()); + + // 进入或退出权限编辑模式,通知插件 + Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); + for (ShortCut shortCut : extraShortCuts) { + if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { + ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); + } + } } /** @@ -797,6 +808,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta TemplateTreePane.getInstance().refreshDockingView(); DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); + + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } } /** @@ -1152,4 +1168,4 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return progressDialog; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 137d0bf4db..55ba067c12 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -31,21 +32,30 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; - import com.fr.io.utils.ResourceIOUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -60,6 +70,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private JPanel cardPane; + private java.util.List otherToobarStateChangeListeners = new ArrayList<>(); + private FileOperations selectedOperation; private UIToolbar toolBar; @@ -130,7 +142,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt); //处理自动新建的模板 MutilTempalteTabPane.getInstance().doWithtemTemplate(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } @@ -244,6 +256,21 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt selectedOperation.refresh(); stateChange(); + + } + } + + public void addToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { + this.otherToobarStateChangeListeners.add(toobarStateChangeListener); + } + + public void removeToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { + this.otherToobarStateChangeListeners.remove(toobarStateChangeListener); + } + + private void otherStateChange() { + for (FileToolbarStateChangeListener toobarStateChangeListener : otherToobarStateChangeListeners) { + toobarStateChangeListener.stateChange(); } } @@ -313,6 +340,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt delFileAction.setEnabled(true); } + otherStateChange(); } /** @@ -578,4 +606,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return null; } -} \ No newline at end of file + public FileOperations getSelectedOperation() { + return selectedOperation; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 9f03ddcf66..b9cc68da41 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -6,6 +6,7 @@ import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.TemplateIdAttrMark; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -32,6 +33,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.mainframe.toolbar.VcsScene; import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; @@ -274,7 +276,7 @@ public abstract class JTemplate> * @return 是则返回true */ public boolean isSaved() { - return BaseUtils.isAuthorityEditing() ? this.authoritySaved : this.saved; + return DesignerMode.isAuthorityEditing() ? this.authoritySaved : this.saved; } /** @@ -297,7 +299,7 @@ public abstract class JTemplate> } public void setSaved(boolean isSaved) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { authoritySaved = isSaved; } else { saved = isSaved; @@ -308,7 +310,7 @@ public abstract class JTemplate> * @return */ public UndoManager getUndoManager() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (this.authorityUndoManager == null) { this.authorityUndoManager = new UndoManager(); int limit = DesignerEnvManager.getEnvManager().getUndoLimit(); @@ -383,7 +385,7 @@ public abstract class JTemplate> return; } //如果是在不同的模式下产生的 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.getUndoManager().addEdit(new UndoStateEdit(authorityUndoState, newState)); authorityUndoState = newState; } else { @@ -412,7 +414,7 @@ public abstract class JTemplate> } private void fireSuperTargetModified() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.authoritySaved = false; } else { this.saved = false; @@ -699,7 +701,9 @@ public abstract class JTemplate> */ @Override public ShortCut[] shortcut4FileMenu() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isVcsMode()) { + return VcsScene.shortcut4FileMenu(this); + } else if (DesignerMode.isAuthorityEditing()) { return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; } else { return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)}; @@ -716,12 +720,14 @@ public abstract class JTemplate> public MenuDef[] menus4Target() { MenuDef tplMenu = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Template"), 'T'); tplMenu.setAnchor(MenuHandler.TEMPLATE); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_WorkBook"))); tplMenu.addShortCut(new TableDataSourceAction(this)); tplMenu.addShortCut(shortcut4TemplateMenu()); } + if (!DesignerMode.isVcsMode()) { tplMenu.addShortCut(shortCuts4Authority()); + } return new MenuDef[]{tplMenu}; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java new file mode 100644 index 0000000000..1f7cab6d6f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java @@ -0,0 +1,36 @@ +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.design.file.NewTemplatePane; + +import javax.swing.Icon; + +/** + * Created by hzzz on 2017/12/26. + */ +public class ToolBarNewTemplatePane extends NewTemplatePane { + + private static final ToolBarNewTemplatePane instance = new ToolBarNewTemplatePane(); + + private ToolBarNewTemplatePane() { + } + + public static NewTemplatePane getInstance() { + return instance; + } + + @Override + public Icon getNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); + } + + @Override + public Icon getMouseOverNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); + } + + @Override + public Icon getMousePressNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java index 60421dcad5..62cfb7fd09 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; @@ -52,7 +53,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { if (this.old != null) { this.old.applyState(); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } } @@ -67,7 +68,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { if (this.cur != null) { this.cur.applyState(); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index ea6d694c70..b618669e9b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -5,6 +5,7 @@ package com.fr.design.mainframe.toolbar; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; @@ -42,6 +43,7 @@ import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; @@ -60,8 +62,17 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -319,10 +330,15 @@ public abstract class ToolBarMenuDock { } public MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { + if (DesignerMode.isVcsMode()) { + MenuDef menuDef = VcsScene.createFileMenuDef(plus); + insertMenu(menuDef, MenuHandler.FILE); + return menuDef; + } MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F'); ShortCut[] scs = new ShortCut[0]; - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { scs = createNewFileShortCuts(); } if (!ArrayUtils.isEmpty(scs)) { @@ -353,13 +369,13 @@ public abstract class ToolBarMenuDock { } protected void addCloseCurrentTemplateAction(MenuDef menuDef) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(new CloseCurrentTemplateAction()); } } protected void addPreferenceAction(MenuDef menuDef) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(new PreferenceAction()); } } @@ -395,7 +411,7 @@ public abstract class ToolBarMenuDock { protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Server"), 'S'); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut( new ConnectionListAction(), createGlobalTDAction() @@ -411,7 +427,7 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new RemoteDesignAuthorityManagerAction()); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { if (shouldShowPlugin()) { menuDef.addShortCut( new PluginManagerAction() @@ -433,7 +449,7 @@ public abstract class ToolBarMenuDock { } private boolean shouldShowRemotePermission() { - + return WorkContext.getCurrent() != null && !WorkContext.getCurrent().isLocal() && WorkContext.getCurrent().isRoot(); } @@ -587,22 +603,7 @@ public abstract class ToolBarMenuDock { } public NewTemplatePane getNewTemplatePane() { - return new NewTemplatePane() { - @Override - public Icon getNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); - } - - @Override - public Icon getMouseOverNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); - } - - @Override - public Icon getMousePressNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); - } - }; + return ToolBarNewTemplatePane.getInstance(); } protected void insertMenu(MenuDef menuDef, String anchor) { @@ -750,4 +751,4 @@ public abstract class ToolBarMenuDock { return handler.shortcut(plus); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java new file mode 100644 index 0000000000..34fed3a86b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java @@ -0,0 +1,46 @@ +package com.fr.design.mainframe.toolbar; + +import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; +import com.fr.design.actions.edit.RedoAction; +import com.fr.design.actions.edit.UndoAction; +import com.fr.design.actions.file.ExitDesignerAction; +import com.fr.design.actions.file.PreferenceAction; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuDef; +import com.fr.design.menu.SeparatorDef; +import com.fr.design.menu.ShortCut; +import com.fr.stable.ArrayUtils; + +/** + * Created by hzzz on 2017/12/28. + */ +public class VcsScene { + + public static MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { + MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F'); + + ShortCut[] scs = new ShortCut[0]; + if (!ArrayUtils.isEmpty(scs)) { + menuDef.addShortCut(scs); + } + + scs = plus.shortcut4FileMenu(); + if (!ArrayUtils.isEmpty(scs)) { + menuDef.addShortCut(SeparatorDef.DEFAULT); + menuDef.addShortCut(scs); + menuDef.addShortCut(SeparatorDef.DEFAULT); + } + + if (!DesignerMode.isAuthorityEditing()) { + menuDef.addShortCut(new PreferenceAction()); + } + + menuDef.addShortCut(new ExitDesignerAction()); + return menuDef; + } + + public static ShortCut[] shortcut4FileMenu(JTemplate jTemplate) { + return new ShortCut[]{new UndoAction(jTemplate), new RedoAction(jTemplate)}; + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/ShortCut.java b/designer-base/src/main/java/com/fr/design/menu/ShortCut.java index a2f8e943c8..beca4ae723 100644 --- a/designer-base/src/main/java/com/fr/design/menu/ShortCut.java +++ b/designer-base/src/main/java/com/fr/design/menu/ShortCut.java @@ -71,4 +71,11 @@ public abstract class ShortCut extends AbstractProvider implements Mutable { public void setMenuKeySet(MenuKeySet menuKeySet) { this.menuKeySet = menuKeySet; } + + /** + * 权限编辑模式变更时候会调用这个方法 + * @param isAuhtority + */ + public void notifyFromAuhtorityChange(boolean isAuhtority) { + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 18ed104fe7..a26d01e45b 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1,6 +1,7 @@ package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; @@ -265,7 +266,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java index 94131a5ff8..30984197c0 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java @@ -1,6 +1,7 @@ package com.fr.design.utils.gui; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; @@ -17,7 +18,7 @@ public class GUIPaintUtils { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { Color oldColor = g2d.getColor(); Shape oldClip = g2d.getClip(); - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR); } else { g2d.setColor(UIConstants.POP_DIALOG_BORDER); @@ -67,7 +68,7 @@ public class GUIPaintUtils { public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, color, 1, height - 1, color); @@ -99,7 +100,7 @@ public class GUIPaintUtils { GradientPaint gp; if (hoverColor != null) { gp = new GradientPaint(1, 1, hoverColor, 1, height - 1, hoverColor); - } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_HOVER, 1, height - 1, UIConstants.ATTRIBUTE_HOVER); @@ -129,7 +130,7 @@ public class GUIPaintUtils { Color oldColor = g2d.getColor(); if (pressedColor != null) { g2d.setColor(pressedColor); - } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); } else { g2d.setColor(UIConstants.ATTRIBUTE_PRESS); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index d71f81387a..b7d7b3a45d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -3,6 +3,7 @@ */ package com.fr.design.designer.creator; +import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index abff9a9c88..56579a1a32 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 6e075f7338..64caf83659 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -5,6 +5,7 @@ import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.base.Utils; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; @@ -84,7 +85,7 @@ public class FormDesignerUI extends ComponentUI { paintSelection(g); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { paintAuthorityDetails(g, designer.getRootComponent()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java index 211c3ef3dd..b28d5c253c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -102,7 +103,7 @@ public class FormToolBarButton extends JButton implements MouseListener { //该button只在报表块工具栏中使用, //parent只有FormToolBarPane一种,故可以直接强转 final FormToolBarPane toolBarPane = (FormToolBarPane) this.getParent(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { auhtorityMouseAction(); return; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index b219f6396b..3165d08c5f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.Parameter; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.WebPreviewUtils; @@ -55,7 +56,6 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; - import com.fr.log.FineLoggerFactory; import com.fr.page.PaperSettingProvider; import com.fr.report.worksheet.FormElementCase; @@ -141,7 +141,7 @@ public class JForm extends JTemplate implements BaseJForm { return processInfo; } - public FormECCompositeProvider getReportComposite(){ + public FormECCompositeProvider getReportComposite() { return this.reportComposite; } @@ -204,7 +204,8 @@ public class JForm extends JTemplate implements BaseJForm { */ public ShortCut[] shortcut4FileMenu() { return (ShortCut[]) ArrayUtils.addAll( - super.shortcut4FileMenu(), new ShortCut[]{this.createWorkBookExportMenu()} + super.shortcut4FileMenu(), + DesignerMode.isVcsMode() ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -257,6 +258,7 @@ public class JForm extends JTemplate implements BaseJForm { }); formDesign.addDesignerEditListener(new DesignerEditListener() { private XComponent lastAffectedCreator; + @Override public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { @@ -340,7 +342,7 @@ public class JForm extends JTemplate implements BaseJForm { } ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this); editingComponent = comp.createToolPane(this, formDesign); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); } else { @@ -578,7 +580,7 @@ public class JForm extends JTemplate implements BaseJForm { throw new RuntimeException(e); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.authorityUndoState = u; } else { this.undoState = u; @@ -653,7 +655,7 @@ public class JForm extends JTemplate implements BaseJForm { public JPanel getEastUpPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (formDesign.isSupportAuthority()) { return new AuthorityPropertyPane(this); } else { @@ -717,7 +719,7 @@ public class JForm extends JTemplate implements BaseJForm { DesignerContext.getDesignerFrame().resetToolkitByPlus(JForm.this); //表单切换后拖不进去组件是因为找不到designer WidgetToolBarPane.getInstance(formDesign); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (formDesign.isSupportAuthority()) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new AuthorityPropertyPane(this)); @@ -843,7 +845,7 @@ public class JForm extends JTemplate implements BaseJForm { Object[] designerArg = new Object[]{formDesign.getElementCase(), getTarget()}; FormECDesignerProvider formECDesigner = StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class); // 如果是移动端专属模版,需要修改页面大小并显示边缘线 - PaperSettingProvider paperSetting = ((FormElementCase)formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting(); + PaperSettingProvider paperSetting = ((FormElementCase) formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting(); paperSetting.setPaperSize(getTarget().getFormMobileAttr().isMobileOnly() ? PaperSize.PAPERSIZE_MOBILE : new PaperSize()); return formECDesigner; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java index cbca8c4f82..a79ac17a5c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.SharableAttrMark; +import com.fr.base.vcs.DesignerMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; @@ -199,7 +200,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (lastPressEvent == null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java index b152f6f4b3..baf69fa878 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.core.WidgetOption; import com.fr.design.designer.creator.XCreatorUtils; @@ -70,7 +71,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (lastPressEvent == null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java index c6dfdd9ed2..bde1367c47 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.core.FormWidgetOption; @@ -122,7 +123,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide private void checkEnable() { for (JComponent comp : componentsList4Form) { - comp.setEnabled(!BaseUtils.isAuthorityEditing()); + comp.setEnabled(!DesignerMode.isAuthorityEditing()); } } @@ -149,7 +150,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide chartButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (chartWindow == null) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index e0efed6499..b5f78ef604 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -10,6 +10,7 @@ import com.fr.base.FRContext; import com.fr.base.Formula; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -756,7 +757,7 @@ public abstract class ElementCasePane extends Tar * @return 返回是否清除内容. */ public boolean clearContents() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return false; } boolean b = this.selection.clear(Clear.CONTENTS, this); @@ -1043,7 +1044,7 @@ public abstract class ElementCasePane extends Tar */ public UIPopupMenu createRowPopupMenu(MouseEvent evt, int selectedRows) { UIPopupMenu popupMenu = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); return popupMenu; } @@ -1136,7 +1137,7 @@ public abstract class ElementCasePane extends Tar public UIPopupMenu createColumnPopupMenu(MouseEvent evt, int selectedColumn) { UIPopupMenu popupMenu = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); return popupMenu; } @@ -1237,7 +1238,7 @@ public abstract class ElementCasePane extends Tar public ShortCut[] shortCuts4Authority() { return new ShortCut[]{ new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})), - BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), + DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), }; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index a1902d6fb9..543268ea28 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; @@ -51,7 +52,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { this.addSelectionChangeListener(new SelectionListener() { @Override public void selectionChanged(SelectionEvent e) { - if (!isEditable() && !BaseUtils.isAuthorityEditing()) { + if (!isEditable() && !DesignerMode.isAuthorityEditing()) { return; } refreshPropertyPanes(); @@ -71,7 +72,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { private void refreshPropertyPanes() { //在编辑权限,所以要更新权限编辑面板 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); @@ -124,7 +125,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { * @return 返回MenuDef数组. */ public MenuDef[] menus4Target() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return super.menus4Target(); } return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 0fd66e40f5..a300b835ed 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -5,6 +5,7 @@ import com.fr.base.DynamicUnitList; import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.AllowAuthorityEditAction; @@ -285,7 +286,7 @@ public class JWorkBook extends JTemplate { if (this.getEditingElementCasePane() == null) { return JWorkBook.this; } - this.getEditingElementCasePane().getGrid().setEditable(!BaseUtils.isAuthorityEditing()); + this.getEditingElementCasePane().getGrid().setEditable(!DesignerMode.isAuthorityEditing()); centerPane.needToShowCoverAndHidPane(); if (centerPane.isUpEditMode()) { return parameterPane; @@ -316,7 +317,7 @@ public class JWorkBook extends JTemplate { @Override public JPanel getEastUpPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return allowAuthorityUpPane(); } else { return exitEastUpPane(); @@ -632,9 +633,11 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4FileMenu() { - return (ShortCut[]) ArrayUtils.addAll( - super.shortcut4FileMenu(), - BaseUtils.isAuthorityEditing() || (!WorkContext.getCurrent().isLocal()) ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} + boolean showWorkBookExportMenu = DesignerMode.isVcsMode() + || DesignerMode.isAuthorityEditing() + || !WorkContext.getCurrent().isLocal(); + return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), + showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -679,7 +682,7 @@ public class JWorkBook extends JTemplate { public ShortCut[] shortCuts4Authority() { return new ShortCut[]{ new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Permissions_Edition")), - BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), + DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), }; } @@ -725,7 +728,7 @@ public class JWorkBook extends JTemplate { protected void applyUndoState(WorkBookUndoState u) { try { this.setTarget((WorkBook) u.getWorkBook().clone()); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { applyAll(u); this.undoState = u; @@ -990,7 +993,7 @@ public class JWorkBook extends JTemplate { } } } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(allowAuthorityUpPane()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); @@ -1161,4 +1164,4 @@ public class JWorkBook extends JTemplate { public String route() { return ViewRequestConstants.REPORT_VIEW_PATH; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java index 775bfae173..ea74cc7b3b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.report.ReportBackgroundAction; @@ -68,7 +69,7 @@ public abstract class ReportComponent= 2 && !BaseUtils.isAuthorityEditing()) { + if (clickCount >= 2 && !DesignerMode.isAuthorityEditing()) { grid.startEditing(); } - if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !BaseUtils.isAuthorityEditing()) { + if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !DesignerMode.isAuthorityEditing()) { showWidetWindow(cellElement, report); } reportPane.repaint(); @@ -362,12 +363,12 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } Selection selection = reportPane.getSelection(); - if (selection instanceof FloatSelection && !BaseUtils.isAuthorityEditing()) { + if (selection instanceof FloatSelection && !DesignerMode.isAuthorityEditing()) { doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection); grid.setDragType(GridUtils.DRAG_FLOAT); - } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !BaseUtils.isAuthorityEditing()) { + } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !DesignerMode.isAuthorityEditing()) { doWithCellElementDragged(evtX, evtY, (CellSelection) selection); - } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) { + } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !DesignerMode.isAuthorityEditing()) { // peter:获得调整过的Selected Column Row. ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) { diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index 303752e71c..44f1fe8749 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -12,6 +12,7 @@ import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.ElementCasePane; @@ -137,7 +138,7 @@ public class GridRowUI extends ComponentUI { } private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpHeight1, double tmpIncreaseHeight, Dimension size, int i) { - boolean isAuthorityEdited = BaseUtils.isAuthorityEditing(); + boolean isAuthorityEdited = DesignerMode.isAuthorityEditing(); if (isAuthorityEdited) { ColumnRowPrivilegeControl cpc = elementCase.getRowPrivilegeControl(i); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 45d8143c8d..f64fa08643 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -11,6 +11,7 @@ import com.fr.base.Utils; import com.fr.base.background.ColorBackground; import com.fr.base.background.ImageFileBackground; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; @@ -1060,7 +1061,7 @@ public class GridUI extends ComponentUI { throw new IllegalArgumentException("The component c to paint must be a Grid!"); } - isAuthority = BaseUtils.isAuthorityEditing(); + isAuthority = DesignerMode.isAuthorityEditing(); Graphics2D g2d = (Graphics2D) g; diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 3bbf8e952b..cff3f5ddcb 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -4,6 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.base.NameStyle; import com.fr.base.Utils; +import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; @@ -463,7 +464,7 @@ public class CellSelection extends Selection { */ public UIPopupMenu createPopupMenu(ElementCasePane ePane) { UIPopupMenu popup = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index eaad78306d..da6f1d45a1 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -2,6 +2,7 @@ package com.fr.grid.selection; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.core.ActionFactory; @@ -125,7 +126,7 @@ public class FloatSelection extends Selection { @Override public JPopupMenu createPopupMenu(ElementCasePane ePane) { UIPopupMenu popup = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java index ef48594d05..3a7fc58b36 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java @@ -5,6 +5,7 @@ import com.fr.base.FRContext; import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartNameID; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itooltip.MultiLineToolTip; @@ -53,7 +54,7 @@ public class PolyComponetsBar extends JToolBar { */ public void checkEnable() { for (SerIcon serIcon : serIcons) { - serIcon.setEnabled(!BaseUtils.isAuthorityEditing()); + serIcon.setEnabled(!DesignerMode.isAuthorityEditing()); } } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index eefff3e1ec..2307765e33 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -7,6 +7,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -355,7 +356,7 @@ public class PolyDesigner extends ReportComponent { */ public void resetSelectionAndChooseState() { designer.setChooseType(SelectionType.INNER); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jTemplate.isJWorkBook()) { //清参数面板 diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java index 1d211189a4..0f3c489c5b 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java @@ -4,6 +4,7 @@ package com.fr.poly.creator; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.menu.KeySetUtils; @@ -55,7 +56,7 @@ public class ECBlockPane extends PolyElementCasePane { if (!isEditable()) { return; } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (designer.getSelection().getEditingElementCasePane() == null) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit()); @@ -106,7 +107,7 @@ public class ECBlockPane extends PolyElementCasePane { * @return 返回MenuDef数组. */ public MenuDef[] menus4Target() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return super.menus4Target(); } return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java b/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java index b55916e777..0985667eb6 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java @@ -11,6 +11,7 @@ import javax.swing.event.MouseInputAdapter; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils.RectangleDesigner; @@ -49,7 +50,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } pressed = e.getPoint(); @@ -66,7 +67,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mouseReleased(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } editor.setDragging(false); @@ -92,7 +93,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); return; } diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java b/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java index 39b4c13213..6704e06289 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java @@ -8,6 +8,7 @@ import java.awt.event.MouseEvent; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.general.ComparatorUtils; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner.SelectionType; @@ -57,7 +58,7 @@ public abstract class ColumnOperationMouseHandler extends * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } startPoint = e.getPoint(); @@ -74,7 +75,7 @@ public abstract class ColumnOperationMouseHandler extends * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } TemplateBlock block = editor.getValue(); diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java index bc105c684e..7317e3ecd9 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java @@ -19,6 +19,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChart; +import com.fr.base.vcs.DesignerMode; import com.fr.design.mainframe.DesignerContext; import com.fr.grid.Grid; import com.fr.poly.PolyDesigner; @@ -55,7 +56,7 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { */ public void dragEnter(DropTargetDragEvent dtde) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } // richer:避免在一次拖拽过程中重复查找 diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java b/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java index eeef42e626..96c8bf5194 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java @@ -8,6 +8,7 @@ import java.awt.event.MouseEvent; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.general.ComparatorUtils; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner.SelectionType; @@ -55,7 +56,7 @@ public abstract class RowOperationMouseHandler extends Bl * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } startPoint = e.getPoint(); @@ -72,7 +73,7 @@ public abstract class RowOperationMouseHandler extends Bl * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } TemplateBlock block = editor.getValue(); diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 29e84d031a..d02fcb0164 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -2,6 +2,7 @@ package com.fr.start; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.file.WebPreviewUtils; @@ -192,7 +193,7 @@ public class Designer extends BaseDesigner { return menuDef; } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(SeparatorDef.DEFAULT); if (WorkContext.getCurrent().isRoot()) { @@ -362,7 +363,7 @@ public class Designer extends BaseDesigner { if (jt == null) { return; } - saveButton.setEnabled(!jt.isSaved()); + saveButton.setEnabled(!jt.isSaved() && !DesignerMode.isVcsMode()); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList()); MutilTempalteTabPane.getInstance().repaint(); if (DesignerEnvManager.getEnvManager().isSupportUndo()) { @@ -387,7 +388,7 @@ public class Designer extends BaseDesigner { @Override public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { //如果是处于权限编辑状态 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (plus instanceof JWorkBook && plus.toolbars4Target() == null) { //聚合块编辑 return super.polyToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Privilege_Poly_Block_Edit"));