Browse Source
* commit '47ab6595baf2eb0fb93ba1bcab3bd9711b8c131b': f remove useless code REPORT-11623 模板加密research/10.0
yaoh.wu
6 years ago
23 changed files with 349 additions and 97 deletions
@ -0,0 +1,83 @@
|
||||
package com.fr.base.vcs; |
||||
|
||||
import com.fr.design.base.mode.DesignModeContext; |
||||
|
||||
/** |
||||
* 兼容 |
||||
* |
||||
* @deprecated user {@link com.fr.design.base.mode.DesignerMode} and {@link DesignModeContext} instead |
||||
*/ |
||||
@Deprecated |
||||
public enum DesignerMode { |
||||
|
||||
NORMAL() { |
||||
@Override |
||||
public void doSwitch() { |
||||
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); |
||||
} |
||||
}, |
||||
VCS() { |
||||
@Override |
||||
public void doSwitch() { |
||||
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.VCS); |
||||
} |
||||
}, |
||||
AUTHORITY() { |
||||
@Override |
||||
public void doSwitch() { |
||||
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.AUTHORITY); |
||||
} |
||||
}; |
||||
|
||||
abstract void doSwitch(); |
||||
|
||||
|
||||
/** |
||||
* @return 是否时版本控制模式 |
||||
* @deprecated use {@link DesignModeContext#isVcsMode()} instead |
||||
*/ |
||||
@Deprecated |
||||
public static boolean isVcsMode() { |
||||
return DesignModeContext.isVcsMode(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 切换设计器模式 |
||||
* |
||||
* @param mode mode |
||||
* @deprecated use {@link DesignModeContext#switchTo(com.fr.design.base.mode.DesignerMode)} instead |
||||
*/ |
||||
@Deprecated |
||||
public static void setMode(DesignerMode mode) { |
||||
mode.doSwitch(); |
||||
} |
||||
|
||||
/** |
||||
* @return 获取当前设计器模式 |
||||
* @deprecated use {@link DesignModeContext#getMode()} instead |
||||
*/ |
||||
@Deprecated |
||||
public static DesignerMode getMode() { |
||||
switch (DesignModeContext.getMode()) { |
||||
case VCS: |
||||
return VCS; |
||||
case AUTHORITY: |
||||
return AUTHORITY; |
||||
case NORMAL: |
||||
default: |
||||
return NORMAL; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 是否为权限编辑 |
||||
* |
||||
* @return 是否为权限编辑 |
||||
* @deprecated use {@link DesignModeContext#isAuthorityEditing()} instead |
||||
*/ |
||||
@Deprecated |
||||
public static boolean isAuthorityEditing() { |
||||
return DesignModeContext.isAuthorityEditing(); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.base.mode; |
||||
|
||||
import static com.fr.design.base.mode.DesignerMode.AUTHORITY; |
||||
|
||||
public class DesignModeContext { |
||||
|
||||
private static DesignerMode mode = DesignerMode.NORMAL; |
||||
|
||||
public static void switchTo(DesignerMode mode) { |
||||
DesignModeContext.mode = mode; |
||||
} |
||||
|
||||
public static DesignerMode getMode() { |
||||
return mode; |
||||
} |
||||
|
||||
/** |
||||
* 是否是版本控制模式 |
||||
* |
||||
* @return 是否是版本控制模式 |
||||
*/ |
||||
public static boolean isVcsMode() { |
||||
return mode == DesignerMode.VCS; |
||||
} |
||||
|
||||
/** |
||||
* @return 是否是禁止拷贝剪切模式 |
||||
*/ |
||||
public static boolean isBanCopyAndCut() { |
||||
return mode == DesignerMode.BAN_COPY_AND_CUT; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 是否为权限编辑 |
||||
* |
||||
* @return 是否为权限编辑 |
||||
*/ |
||||
public static boolean isAuthorityEditing() { |
||||
return mode == AUTHORITY; |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.fr.design.base.mode; |
||||
|
||||
public enum DesignerMode { |
||||
NORMAL, |
||||
BAN_COPY_AND_CUT, |
||||
VCS, |
||||
AUTHORITY |
||||
} |
@ -1,33 +1,33 @@
|
||||
package com.fr.design.designer.beans.actions; |
||||
|
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.base.mode.DesignModeContext; |
||||
import com.fr.design.designer.beans.actions.behavior.ComponentEnable; |
||||
|
||||
import com.fr.design.mainframe.FormDesigner; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
public class CutAction extends FormWidgetEditAction { |
||||
|
||||
public CutAction(FormDesigner t) { |
||||
super(t); |
||||
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); |
||||
this.setMnemonic('T'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); |
||||
this.setUpdateBehavior(new ComponentEnable()); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
FormDesigner editPane = getEditingComponent(); |
||||
if (editPane == null) { |
||||
return false; |
||||
} |
||||
return editPane.cut(); |
||||
} |
||||
public CutAction(FormDesigner t) { |
||||
super(t); |
||||
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); |
||||
this.setMnemonic('T'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); |
||||
this.setUpdateBehavior(new ComponentEnable()); |
||||
this.setEnabled(!DesignModeContext.isBanCopyAndCut()); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
FormDesigner editPane = getEditingComponent(); |
||||
if (editPane == null) { |
||||
return false; |
||||
} |
||||
return editPane.cut(); |
||||
} |
||||
} |
Loading…
Reference in new issue