Browse Source

Merge pull request #667 in DESIGN/design from ~ZACK/design:release/10.0 to release/10.0

* commit '350665eab47b8b6e853aef73c270e36cae2f29da':
  rt
  REPORT-13018 大赛后续开两个接口 ,右键菜单接口同步10.0
bugfix/10.0
zack 6 years ago
parent
commit
7ead340103
  1. 55
      designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java
  2. 45
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 8
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  5. 29
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  6. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  7. 46
      designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java
  8. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  9. 36
      designer-realize/src/main/java/com/fr/grid/selection/Selection.java

55
designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java

@ -0,0 +1,55 @@
package com.fr.design.fun;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.BaseFormDesigner;
import com.fr.design.selection.SelectableElement;
import com.fr.stable.fun.mark.Mutable;
import java.util.List;
/**
* 设计器右键菜单接口
*/
public interface RightSelectionHandlerProvider extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "RightSelectionHandlerProvider";
/**
* 对单元格或者悬浮元素的右键菜单项进行增删改
*
* @param ePane 选择的元素
* @param popupMenu 右键主菜单
*/
void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu);
/**
* 当前实现是否可以作用于当前元素
*
* @param selectableElement 当前选中元素分为CellSelection和FloatSelection(单元格和悬浮元素)
* @return
*/
boolean accept(SelectableElement selectableElement);
/**
* 对表单,参数面板内置的右键选项进行增删改处理
*
* @param actions 默认的action集合 注意:主体代码要求这边的action必须是UndoableAction 的子类而非updateAction
*/
void dmlUpdateActions(BaseFormDesigner formDesigner, List<UpdateAction> actions);
/**
* 当前实现是否可以作用于当前元素
*
* @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件)
* @return
*/
boolean accept(BaseFormDesigner formDesigner);
}

45
designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java

@ -0,0 +1,45 @@
package com.fr.design.fun.impl;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.RightSelectionHandlerProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.BaseFormDesigner;
import com.fr.design.selection.SelectableElement;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import java.util.List;
@API(level = RightSelectionHandlerProvider.CURRENT_LEVEL)
public abstract class AbstractRightSelectionHandlerProvider extends AbstractProvider implements RightSelectionHandlerProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public void dmlUpdateActions(BaseFormDesigner formDesigner, List<UpdateAction> actions) {
}
@Override
public boolean accept(BaseFormDesigner formDesigner) {
return false;
}
@Override
public void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu) {
}
@Override
public boolean accept(SelectableElement selectableElement) {
return false;
}
}

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

@ -419,7 +419,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified(); fireSuperTargetModified();
} }
protected boolean accept(Object o) { public boolean accept(Object o) {
return true; return true;
} }

8
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -11,6 +11,7 @@ import java.awt.Image;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/ */
public UpdateAction[] getActions() { public UpdateAction[] getActions() {
if (designerActions == null) { if (designerActions == null) {
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), designerActions = new ArrayList<UpdateAction>(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this)}; new FormDeleteAction(this)}));
dmlActions(designerActions);
} }
return designerActions; return designerActions.toArray(new UpdateAction[designerActions.size()]);
} }
private boolean searchQueryCreators(XLayoutContainer rootContainer) { private boolean searchQueryCreators(XLayoutContainer rootContainer) {

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

@ -1,9 +1,11 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -39,6 +41,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.RightSelectionHandlerProvider;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -89,6 +92,7 @@ import java.lang.reflect.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等 * 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等
@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
// 编辑状态的事件表 // 编辑状态的事件表
private CreatorEventListenerTable edit; private CreatorEventListenerTable edit;
protected UpdateAction[] designerActions; protected List<UpdateAction> designerActions;
private FormDesignerModeForSpecial<?> desigerMode; private FormDesignerModeForSpecial<?> desigerMode;
private Action switchAction; private Action switchAction;
private FormElementCaseContainerProvider elementCaseContainer; private FormElementCaseContainerProvider elementCaseContainer;
@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/ */
public UpdateAction[] getActions() { public UpdateAction[] getActions() {
if (designerActions == null) { if (designerActions == null) {
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), designerActions = new ArrayList<UpdateAction>(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this), new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this),
new MoveUpAction(this), new MoveDownAction(this)}; new MoveUpAction(this), new MoveDownAction(this)}));
dmlActions(designerActions);
}
return designerActions.toArray(new UpdateAction[designerActions.size()]);
}
/**
* 扩展菜单项
* @param actions
*/
public void dmlActions(List<UpdateAction> actions) {
try {
Set<RightSelectionHandlerProvider> selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG);
for (RightSelectionHandlerProvider handler : selectionHandlerProviders) {
if (handler.accept(this)) {
handler.dmlUpdateActions(this,actions);
}
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
} }
return designerActions;
} }
// 当前选中控件可以上移一层吗? // 当前选中控件可以上移一层吗?

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

@ -160,7 +160,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
@Override @Override
protected boolean accept(Object o) { public boolean accept(Object o) {
return !(o instanceof FloatElementsProvider); return !(o instanceof FloatElementsProvider);
} }

46
designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java

@ -3,9 +3,6 @@
*/ */
package com.fr.design.cell.clipboard; package com.fr.design.cell.clipboard;
import java.util.Arrays;
import java.util.Iterator;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -15,6 +12,9 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import java.util.Arrays;
import java.util.Iterator;
/** /**
* The clip of CellElement. * The clip of CellElement.
*/ */
@ -39,6 +39,46 @@ public class CellElementsClip implements Cloneable, java.io.Serializable {
this.clips = clips; this.clips = clips;
} }
public int getColumnSpan() {
return columnSpan;
}
public void setColumnSpan(int columnSpan) {
this.columnSpan = columnSpan;
}
public int getRowSpan() {
return rowSpan;
}
public void setRowSpan(int rowSpan) {
this.rowSpan = rowSpan;
}
public FU[] getColumnWidth() {
return columnWidth;
}
public void setColumnWidth(FU[] columnWidth) {
this.columnWidth = columnWidth;
}
public FU[] getRowHeight() {
return rowHeight;
}
public void setRowHeight(FU[] rowHeight) {
this.rowHeight = rowHeight;
}
public TemplateCellElement[] getClips() {
return clips;
}
public void setClips(TemplateCellElement[] clips) {
this.clips = clips;
}
public String compateExcelPaste() { public String compateExcelPaste() {
Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator());

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

@ -663,7 +663,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
} }
private Object getClipObject() { public Object getClipObject() {
// 需要检查是否可以编辑。 // 需要检查是否可以编辑。
Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Clipboard clipboard = DesignerContext.getClipboard(this.getGrid());
Transferable clipData = clipboard.getContents(this); Transferable clipData = clipboard.getContents(this);

36
designer-realize/src/main/java/com/fr/grid/selection/Selection.java

@ -1,19 +1,22 @@
package com.fr.grid.selection; package com.fr.grid.selection;
import java.io.Serializable;
import javax.swing.JPopupMenu;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.fun.RightSelectionHandlerProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.design.selection.SelectableElement; import com.fr.design.selection.SelectableElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.FCloneable; import com.fr.stable.FCloneable;
import javax.swing.JPopupMenu;
import java.io.Serializable;
import java.util.Set;
/* /*
* TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢?
* *
@ -24,10 +27,8 @@ import com.fr.stable.FCloneable;
public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract class Selection implements FCloneable, Serializable , SelectableElement {
public abstract boolean isSelectedOneCell(ElementCasePane ePane); public abstract boolean isSelectedOneCell(ElementCasePane ePane);
// ///////////////////////////////copy/////////////////////////////////
public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane);
// ///////////////////////////////paste////////////////////////////////
public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) {
FloatElementsClip floatElementClip; FloatElementsClip floatElementClip;
try { try {
@ -53,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane);
// ///////////////////////////////merge////////////////////////////////
public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean canMergeCells(ElementCasePane ePane);
public abstract boolean mergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane);
@ -62,18 +62,28 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract boolean unMergeCells(ElementCasePane ePane); public abstract boolean unMergeCells(ElementCasePane ePane);
// ///////////////////////////////popup////////////////////////////////
public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); public abstract JPopupMenu createPopupMenu(ElementCasePane ePane);
// ///////////////////////////////clear//////////////////////////////// /**
* 添加插件菜单(增删改都可以)
* @param ePane
* @param popupMenu
*/
public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) {
Set<RightSelectionHandlerProvider> selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG);
for (RightSelectionHandlerProvider handler : selectionHandlerProviders) {
if (handler.accept(this)) {
handler.dmlMenu(ePane, popupMenu);
}
}
}
public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane);
// ////////////////////////////////////////////////////////////////////
public abstract int[] getSelectedRows(); public abstract int[] getSelectedRows();
public abstract int[] getSelectedColumns(); public abstract int[] getSelectedColumns();
// //////////////////////////////move//////////////////////////////////
public abstract void moveLeft(ElementCasePane ePane); public abstract void moveLeft(ElementCasePane ePane);
public abstract void moveRight(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane);
@ -82,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract void moveDown(ElementCasePane ePane); public abstract void moveDown(ElementCasePane ePane);
// //////////////////////////DeleteAction///////////////////////////////
public abstract boolean triggerDeleteAction(ElementCasePane ePane); public abstract boolean triggerDeleteAction(ElementCasePane ePane);
// //////////////////////////Just4CellSelection///////////////////////////////
public abstract boolean containsColumnRow(ColumnRow cr); public abstract boolean containsColumnRow(ColumnRow cr);
public abstract void populatePropertyPane(ElementCasePane ePane); public abstract void populatePropertyPane(ElementCasePane ePane);

Loading…
Cancel
Save