Browse Source

Merge pull request #633 in DESIGN/design from ~YAOH.WU/design:feature/10.0 to feature/10.0

* commit '47ab6595baf2eb0fb93ba1bcab3bd9711b8c131b':
  f
  remove useless code
  REPORT-11623 模板加密
research/10.0
yaoh.wu 6 years ago
parent
commit
883227cd87
  1. 83
      designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java
  2. 2
      designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java
  3. 5
      designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java
  4. 8
      designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java
  5. 42
      designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java
  6. 8
      designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java
  7. 15
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  8. 18
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  9. 9
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  10. 3
      designer-base/src/main/java/com/fr/file/FileFILE.java
  11. 3
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  12. 5
      designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java
  13. 10
      designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java
  14. 48
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  15. 7
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  16. 12
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  17. 7
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  18. 9
      designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java
  19. 3
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java
  20. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java
  21. 3
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  22. 24
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  23. 7
      designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

83
designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java

@ -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();
}
}

2
designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java

@ -35,7 +35,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction {
}
if (DesignerMode.isAuthorityEditing()) {
DesignerMode.setMode(DesignerMode.NORMARL);
DesignerMode.setMode(DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());

5
designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java

@ -5,10 +5,10 @@ package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -24,6 +24,7 @@ public class CopyAction extends TemplateComponentAction {
this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
this.setEnabled(!DesignModeContext.isBanCopyAndCut());
}
@Override

8
designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java

@ -3,14 +3,13 @@
*/
package com.fr.design.actions.edit;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -28,6 +27,7 @@ public class CutAction extends TemplateComponentAction {
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.setEnabled(!DesignModeContext.isBanCopyAndCut());
}
@Override

42
designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java

@ -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;
}
}

8
designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java

@ -0,0 +1,8 @@
package com.fr.design.base.mode;
public enum DesignerMode {
NORMAL,
BAN_COPY_AND_CUT,
VCS,
AUTHORITY
}

15
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -37,6 +37,7 @@ 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.exception.DecryptTemplateException;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
@ -65,6 +66,7 @@ import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder;
import java.awt.BorderLayout;
@ -223,7 +225,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void mouseReleased(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) {
DesignerMode.setMode(DesignerMode.NORMARL);
DesignerMode.setMode(DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
@ -963,6 +965,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try {
openFile(tplFile);
} catch (DecryptTemplateException e) {
JOptionPane.showMessageDialog(
this,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"),
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.WARNING_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
if (this.getSelectedJTemplate() == null) {
addAndActivateJTemplate();
}
} catch (Throwable t) {
FineLoggerFactory.getLogger().error(t.getMessage(), t);
addAndActivateJTemplate();

18
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -3,12 +3,14 @@
*/
package com.fr.design.mainframe;
import java.awt.*;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.dialog.BasicPane;
import java.awt.BorderLayout;
/**
@ -25,8 +27,14 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
protected void showJTemplate(final JTemplate<?, ?> jt) {
// 判断是否切换设计器状态到禁止拷贝剪切
if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT);
} else {
DesignModeContext.switchTo(DesignerMode.NORMAL);
}
DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt);
if(component != null) {
if (component != null) {
remove(component);
}
add(component = jt, BorderLayout.CENTER);

9
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -5,6 +5,7 @@ import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
@ -17,6 +18,7 @@ import com.fr.design.actions.edit.UndoAction;
import com.fr.design.actions.file.SaveAsTemplateAction;
import com.fr.design.actions.file.SaveTemplateAction;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane;
@ -104,6 +106,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public JTemplate(T t, FILE file, boolean isNewFile) {
super(t);
// 判断是否切换设计器状态到禁止拷贝剪切
if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT);
} else {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
}
this.template = t;
this.previewType = parserPreviewProvider(t.getPreviewType());
this.editingFILE = file;
@ -117,6 +125,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
openTime = System.currentTimeMillis();
process.append(tic.loadProcess(t));
}
}
// 刷新右侧属性面板

3
designer-base/src/main/java/com/fr/file/FileFILE.java

@ -4,6 +4,7 @@ import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.gui.itree.filetree.FileComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.general.ComparatorUtils;
import com.fr.io.EncryptUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.session.SessionLocalManager;
@ -185,7 +186,7 @@ public class FileFILE implements FILE {
public InputStream asInputStream() throws Exception {
InputStream in = new java.io.FileInputStream(file);
return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(in) : in;
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in;
}
/**

3
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -9,6 +9,7 @@ import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.design.i18n.Toolkit;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.io.EncryptUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
@ -367,7 +368,7 @@ public class FileNodeFILE implements FILE {
);
return envPath.endsWith(".cpt") || envPath.endsWith(".frm")
? XMLEncryptUtils.decodeInputStream(in) : in;
? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in;
}
/**

5
designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,11 +1,11 @@
package com.fr.design.designer.beans.actions;
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.*;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -19,6 +19,7 @@ public class CopyAction extends FormWidgetEditAction {
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
setUpdateBehavior(new ComponentEnable());
this.setEnabled(!DesignModeContext.isBanCopyAndCut());
}
@Override

10
designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java

@ -1,14 +1,13 @@
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 {
@ -20,6 +19,7 @@ public class CutAction extends FormWidgetEditAction {
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

48
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -5,10 +5,18 @@ import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.Painter;
import com.fr.design.designer.beans.actions.*;
import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.actions.MoveDownAction;
import com.fr.design.designer.beans.actions.MoveToBottomAction;
import com.fr.design.designer.beans.actions.MoveToTopAction;
import com.fr.design.designer.beans.actions.MoveUpAction;
import com.fr.design.designer.beans.actions.PasteAction;
import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter;
import com.fr.design.designer.beans.events.CreatorEventListenerTable;
import com.fr.design.designer.beans.events.DesignerEditListener;
@ -19,7 +27,14 @@ import com.fr.design.designer.beans.location.RootResizeDirection;
import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane;
@ -45,16 +60,27 @@ import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import javax.swing.*;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.TransferHandler;
import javax.swing.border.Border;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationHandler;
@ -670,7 +696,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
refreshParameter();
}
} else {
for( UpdateAction action : getActions()) {
for (UpdateAction action : getActions()) {
action.update();
}
}
@ -1343,6 +1369,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/
@Override
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
selectionModel.copySelectedCreator2ClipBoard();
}
@ -1364,6 +1393,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/
@Override
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
selectionModel.cutSelectedCreator2ClipBoard();
return false;
}
@ -1482,11 +1514,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
}
public void setResolution(int resolution){
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution(){
public int getResolution() {
return this.resolution;
}
}

7
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -8,6 +8,7 @@ import com.fr.design.DesignState;
import com.fr.design.actions.TemplateParameterAction;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction;
@ -427,6 +428,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
*/
@Override
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
this.formDesign.copy();
}
@ -449,6 +453,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
*/
@Override
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
return this.formDesign.cut();
}

12
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -48,6 +48,7 @@ import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable;
@ -81,7 +82,6 @@ import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils;
import com.fr.grid.Grid;
import com.fr.grid.GridColumn;
import com.fr.grid.GridCorner;
@ -612,6 +612,11 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 成功返回true
*/
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
FineLoggerFactory.getLogger().debug("Prohibit Cut");
return false;
}
this.copy();
return this.clearAll();
@ -621,6 +626,9 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* 复制
*/
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
// p:Elements Transferable.
ElementsTransferable elementsTransferable = this.transferSelection();
@ -884,6 +892,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
// clearReportPage old values.
inputMapAncestor.clear();
actionMap.clear();
if (!DesignModeContext.isBanCopyAndCut()) {
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut");
actionMap.put("cut", new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
@ -898,6 +907,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
copy();
}
});
}
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), "paste");
actionMap.put("paste", new AbstractAction() {
public void actionPerformed(ActionEvent evt) {

7
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -25,6 +25,7 @@ import com.fr.design.actions.report.ReportParameterAction;
import com.fr.design.actions.report.ReportPrintSettingAction;
import com.fr.design.actions.report.ReportWatermarkAction;
import com.fr.design.actions.report.ReportWebAttrAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane;
@ -568,6 +569,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*/
@Override
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
this.delegate4ToolbarMenuAdapter().copy();
}
@ -578,6 +582,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*/
@Override
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
return this.delegate4ToolbarMenuAdapter().cut();
}

9
designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java

@ -6,6 +6,7 @@ import com.fr.design.actions.report.ReportColumnsAction;
import com.fr.design.actions.report.ReportEngineAttrAction;
import com.fr.design.actions.report.ReportPageAttrAction;
import com.fr.design.actions.report.ReportWriteAttrAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -80,6 +81,9 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
@Override
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
this.elementCasePane.copy();
}
@ -90,6 +94,9 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
@Override
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
return this.elementCasePane.cut();
}
@ -181,7 +188,7 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
public void updateJSliderValue() {
ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
JSliderPane jSliderContainer = reportComposite.getjSliderContainer();
jSliderContainer.getShowVal().setValue((int)Math.ceil((double) this.elementCasePane.getResolution() * HUND / ScreenResolution.getScreenResolution()));
jSliderContainer.getShowVal().setValue((int) Math.ceil((double) this.elementCasePane.getResolution() * HUND / ScreenResolution.getScreenResolution()));
}
@Override

3
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java

@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exception.DecryptTemplateException;
import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE;
@ -58,6 +59,8 @@ class CptApp extends AbstractWorkBookApp {
namestyle.clear();
try {
tpl.readStream(file.asInputStream());
} catch (DecryptTemplateException e) {
throw e;
} catch (RemoteDesignPermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {

5
designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java

@ -4,6 +4,7 @@ import com.fr.base.extension.FileExtension;
import com.fr.base.frpx.exception.FRPackageRunTimeException;
import com.fr.base.frpx.exception.InvalidWorkBookException;
import com.fr.design.i18n.Toolkit;
import com.fr.exception.DecryptTemplateException;
import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE;
@ -36,8 +37,8 @@ class CptxApp extends AbstractWorkBookApp {
long time = System.currentTimeMillis();
tpl = new WorkBookX(inputStream);
FineLoggerFactory.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms");
} catch (DecryptTemplateException e) {
throw e;
} catch (RemoteDesignPermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {

3
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -7,6 +7,7 @@ import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.JTemplate;
import com.fr.exception.DecryptTemplateException;
import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE;
@ -57,6 +58,8 @@ class FormApp extends AbstractAppProvider {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("file.getName()", file.getName()) + "...");
try {
tpl.readStream(file.asInputStream());
} catch (DecryptTemplateException e) {
throw e;
} catch (RemoteDesignPermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {

24
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -3,12 +3,12 @@
*/
package com.fr.design.mainframe.form;
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.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.event.TargetModifiedEvent;
@ -30,7 +30,6 @@ import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
@ -50,8 +49,9 @@ import java.awt.image.BufferedImage;
/**
* 表单中的ElementCase编辑面板
*/
public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S>, FormECDesignerProvider{
public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S>, FormECDesignerProvider {
protected FormElementCasePaneDelegate elementCasePane;
@Override
public FormElementCasePaneDelegate getEditingElementCasePane() {
return elementCasePane;
@ -118,9 +118,9 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
* @param size 缩略图的大小
*/
@Override
public BufferedImage getElementCaseImage(Dimension size){
public BufferedImage getElementCaseImage(Dimension size) {
BufferedImage image = null;
try{
try {
image = new java.awt.image.BufferedImage(size.width, size.height,
java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
@ -133,7 +133,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
this.elementCasePane.paintComponents(g);
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
@ -167,11 +167,15 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
*/
@Override
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
this.elementCasePane.copy();
}
/**
* 粘贴
*
* @return 粘贴成功则返回true
*/
@Override
@ -181,10 +185,14 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
/**
* 剪切
*
* @return 粘贴成功则返回true
*/
@Override
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
return this.elementCasePane.cut();
}
@ -327,7 +335,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return;
}
public FormElementCase getElementCase(){
public FormElementCase getElementCase() {
return (FormElementCase) this.getTarget();
}
@ -342,7 +350,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
}
@Override
public FormElementCaseProvider getEditingElementCase(){
public FormElementCaseProvider getEditingElementCase() {
return this.getEditingElementCasePane().getTarget();
}
}

7
designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

@ -13,6 +13,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
@ -472,6 +473,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* 复制
*/
public void copy() {
if (DesignModeContext.isBanCopyAndCut()) {
return;
}
if (selection != null) {
clip_board.clear();
clip_board.add(selection.getValue());
@ -583,6 +587,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* @return 剪切成功返回true
*/
public boolean cut() {
if (DesignModeContext.isBanCopyAndCut()) {
return false;
}
copy();
delete();
return true;

Loading…
Cancel
Save