forked from fanruan/design
58 changed files with 507 additions and 156 deletions
@ -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<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
} |
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<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); |
||||||
|
for (int i = 0; i < opendedTemplate.size(); i++) { |
||||||
|
opendedTemplate.get(i).cleanAuthorityUndo(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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; |
||||||
|
} |
@ -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() { |
||||||
|
} |
||||||
|
} |
@ -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"); |
||||||
|
} |
||||||
|
} |
@ -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)}; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue