|
|
@ -18,12 +18,7 @@ import com.fr.design.designer.beans.location.Direction; |
|
|
|
import com.fr.design.designer.beans.location.Location; |
|
|
|
import com.fr.design.designer.beans.location.Location; |
|
|
|
import com.fr.design.designer.beans.models.SelectionModel; |
|
|
|
import com.fr.design.designer.beans.models.SelectionModel; |
|
|
|
import com.fr.design.designer.beans.models.StateModel; |
|
|
|
import com.fr.design.designer.beans.models.StateModel; |
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
import com.fr.design.designer.creator.*; |
|
|
|
import com.fr.design.designer.creator.XCreatorUtils; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XEditorHolder; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XElementCase; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XWFitLayout; |
|
|
|
|
|
|
|
import com.fr.design.form.util.XCreatorConstants; |
|
|
|
import com.fr.design.form.util.XCreatorConstants; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.xpane.ToolTipEditor; |
|
|
|
import com.fr.design.gui.xpane.ToolTipEditor; |
|
|
@ -46,6 +41,10 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private StateModel stateModel; |
|
|
|
private StateModel stateModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private XLayoutContainer xTopLayoutContainer; |
|
|
|
|
|
|
|
private XLayoutContainer clickTopLayout; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取表单设计器 |
|
|
|
* 获取表单设计器 |
|
|
|
* |
|
|
|
* |
|
|
@ -84,10 +83,14 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
|
|
|
|
|
|
|
|
private int minDragSize = 5; |
|
|
|
private int minDragSize = 5; |
|
|
|
private int minMoveSize = 8; |
|
|
|
private int minMoveSize = 8; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int EDIT_BTN_WIDTH = 60; |
|
|
|
|
|
|
|
private static final int EDIT_BTN_HEIGHT = 24; |
|
|
|
//报表块的编辑按钮不灵敏,范围扩大一点
|
|
|
|
//报表块的编辑按钮不灵敏,范围扩大一点
|
|
|
|
private static final int GAP = 10; |
|
|
|
private static final int GAP = 10; |
|
|
|
|
|
|
|
|
|
|
|
private XElementCase xElementCase; |
|
|
|
private XElementCase xElementCase; |
|
|
|
|
|
|
|
private XChartEditor xChartEditor; |
|
|
|
|
|
|
|
|
|
|
|
private JWindow promptWindow = new JWindow(); |
|
|
|
private JWindow promptWindow = new JWindow(); |
|
|
|
|
|
|
|
|
|
|
@ -244,6 +247,12 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
XCreator component = designer.getComponentAt(e); |
|
|
|
XCreator component = designer.getComponentAt(e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setCoverPaneNotDisplay(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(processTopLayoutMouseMove(component, e)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if (component instanceof XEditorHolder) { |
|
|
|
if (component instanceof XEditorHolder) { |
|
|
|
XEditorHolder xcreator = (XEditorHolder) component; |
|
|
|
XEditorHolder xcreator = (XEditorHolder) component; |
|
|
|
Rectangle rect = xcreator.getBounds(); |
|
|
|
Rectangle rect = xcreator.getBounds(); |
|
|
@ -267,17 +276,15 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
if (!BaseUtils.isAuthorityEditing()) { |
|
|
|
if (!BaseUtils.isAuthorityEditing()) { |
|
|
|
stateModel.setDirection(dir); |
|
|
|
stateModel.setDirection(dir); |
|
|
|
} |
|
|
|
} |
|
|
|
if(xElementCase != null){ |
|
|
|
|
|
|
|
xElementCase.displayCoverPane(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (component.isReport()) { |
|
|
|
if (component.isReport()) { |
|
|
|
xElementCase = (XElementCase)component; |
|
|
|
xElementCase = (XElementCase)component; |
|
|
|
UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); |
|
|
|
UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); |
|
|
|
if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { |
|
|
|
if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
|
|
} // component.getParent() 是报表块所在的XWTitleLayout
|
|
|
|
} // component.getParent() 是报表块所在的XWTitleLayout
|
|
|
|
int minX = button.getX() + component.getX() + component.getParent().getX() - designer.getArea().getHorizontalValue(); |
|
|
|
int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); |
|
|
|
int minY = button.getY() + component.getY() + component.getParent().getY() + designer.getParaHeight() - designer.getArea().getVerticalValue(); |
|
|
|
int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); |
|
|
|
if(e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()){ |
|
|
|
if(e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()){ |
|
|
|
if( e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()){ |
|
|
|
if( e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()){ |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
@ -285,14 +292,82 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
} |
|
|
|
} |
|
|
|
xElementCase.displayCoverPane(true); |
|
|
|
xElementCase.displayCoverPane(true); |
|
|
|
xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); |
|
|
|
xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); |
|
|
|
|
|
|
|
|
|
|
|
designer.repaint(); |
|
|
|
designer.repaint(); |
|
|
|
} else { |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
processChartEditorMouseMove(component, e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setCoverPaneNotDisplay(){ |
|
|
|
if (xElementCase != null){ |
|
|
|
if (xElementCase != null){ |
|
|
|
xElementCase.displayCoverPane(false); |
|
|
|
xElementCase.displayCoverPane(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (xChartEditor != null){ |
|
|
|
|
|
|
|
xChartEditor.displayCoverPane(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (xTopLayoutContainer != null) { |
|
|
|
|
|
|
|
xTopLayoutContainer.setMouseEnter(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean processTopLayoutMouseMove(XCreator component, MouseEvent e){ |
|
|
|
|
|
|
|
XLayoutContainer parent = XCreatorUtils.getHotspotContainer(component).getTopLayout(); |
|
|
|
|
|
|
|
if (parent != null){ |
|
|
|
|
|
|
|
xTopLayoutContainer = parent; |
|
|
|
|
|
|
|
xTopLayoutContainer.setMouseEnter(true); |
|
|
|
designer.repaint(); |
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
if(!xTopLayoutContainer.isEditable()) { |
|
|
|
|
|
|
|
if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { |
|
|
|
|
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (e.getX() > (parent.getX() + parent.getWidth() / 2 - EDIT_BTN_WIDTH / 2 - GAP) |
|
|
|
|
|
|
|
&& e.getX() < (parent.getX() + parent.getWidth() / 2 + EDIT_BTN_WIDTH / 2 + GAP)) { |
|
|
|
|
|
|
|
if (e.getY() > (parent.getY() + parent.getHeight() / 2 - EDIT_BTN_HEIGHT / 2 - GAP) |
|
|
|
|
|
|
|
&& e.getY() < (parent.getY() + parent.getHeight() / 2 + EDIT_BTN_HEIGHT / 2 + GAP + designer.getParaHeight())) { |
|
|
|
|
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void processChartEditorMouseMove(XCreator component, MouseEvent e){ |
|
|
|
|
|
|
|
if (component instanceof XChartEditor) { |
|
|
|
|
|
|
|
xChartEditor = (XChartEditor)component; |
|
|
|
|
|
|
|
UIButton button = (UIButton)xChartEditor.getCoverPane().getComponent(0); |
|
|
|
|
|
|
|
if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { |
|
|
|
|
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); |
|
|
|
|
|
|
|
int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); |
|
|
|
|
|
|
|
if(e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()){ |
|
|
|
|
|
|
|
if( e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()){ |
|
|
|
|
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
xChartEditor.displayCoverPane(true); |
|
|
|
|
|
|
|
xChartEditor.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); |
|
|
|
|
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getParentPositionX(XCreator comp, int x){ |
|
|
|
|
|
|
|
return comp.getParent() == null ? |
|
|
|
|
|
|
|
x : getParentPositionX((XCreator)comp.getParent(), comp.getParent().getX() + x); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getParentPositionY(XCreator comp, int y) { |
|
|
|
|
|
|
|
return comp.getParent() == null ? |
|
|
|
|
|
|
|
y : getParentPositionY((XCreator) comp.getParent(), comp.getParent().getY() + y); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 拖拽 |
|
|
|
* 拖拽 |
|
|
@ -342,6 +417,25 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
designer.repaint(); |
|
|
|
designer.repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private XCreator processTopLayoutMouseClick(XCreator creator){ |
|
|
|
|
|
|
|
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout(); |
|
|
|
|
|
|
|
if(topLayout != null){ |
|
|
|
|
|
|
|
if (clickTopLayout != null && clickTopLayout != topLayout){ |
|
|
|
|
|
|
|
clickTopLayout.setEditable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
clickTopLayout = topLayout; |
|
|
|
|
|
|
|
if(!topLayout.isEditable()) { |
|
|
|
|
|
|
|
creator = topLayout; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
if(clickTopLayout != null){ |
|
|
|
|
|
|
|
clickTopLayout.setEditable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return creator; |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 点击 |
|
|
|
* 点击 |
|
|
|
* @param e 鼠标事件 |
|
|
|
* @param e 鼠标事件 |
|
|
@ -351,6 +445,9 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
XCreator creator = designer.getComponentAt(e); |
|
|
|
XCreator creator = designer.getComponentAt(e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
creator = processTopLayoutMouseClick(creator); |
|
|
|
|
|
|
|
|
|
|
|
if(creator != null){ |
|
|
|
if(creator != null){ |
|
|
|
creator.respondClick(this, e); |
|
|
|
creator.respondClick(this, e); |
|
|
|
} |
|
|
|
} |
|
|
@ -368,10 +465,9 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR) { |
|
|
|
if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR) { |
|
|
|
designer.setCursor(Cursor.getDefaultCursor()); |
|
|
|
designer.setCursor(Cursor.getDefaultCursor()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (xElementCase != null){ |
|
|
|
|
|
|
|
xElementCase.displayCoverPane(false); |
|
|
|
setCoverPaneNotDisplay(); |
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cancelPromptWidgetForbidEnter(); |
|
|
|
cancelPromptWidgetForbidEnter(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|