本文整理汇总了Java中org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart类的典型用法代码示例。如果您正苦于以下问题:Java ERDiagramEditPart类的具体用法?Java ERDiagramEditPart怎么用?Java ERDiagramEditPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ERDiagramEditPart类属于org.insightech.er.editor.controller.editpart.element包,在下文中一共展示了ERDiagramEditPart类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateEnabled
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected boolean calculateEnabled() {
List<EditPart> list = new ArrayList<EditPart>(this.getSelectedObjects());
if (list.isEmpty()) {
return false;
}
if (list.size() == 1 && list.get(0) instanceof ModelPropertiesEditPart
|| list.get(0) instanceof ERDiagramEditPart) {
return false;
}
return true;
}
示例2: mouseDown
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
@Override
public void mouseDown(final MouseEvent e, final EditPartViewer viewer) {
if (viewer.getContents() instanceof ERDiagramEditPart) {
final ERDiagramEditPart editPart = (ERDiagramEditPart) viewer.getContents();
final ERDiagram diagram = (ERDiagram) editPart.getModel();
diagram.mousePoint = new Point(e.x, e.y);
editPart.getFigure().translateToRelative(diagram.mousePoint);
}
super.mouseDown(e, viewer);
}
示例3: getPropertySource
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
@Override
public IPropertySource getPropertySource(final Object object) {
if (object instanceof ERDiagramEditPart) {
final ERDiagram diagram = (ERDiagram) ((ERDiagramEditPart) object).getModel();
return new ERDiagramPropertySource(editor, diagram);
} else if (object instanceof ERTableEditPart) {
final ERTable table = (ERTable) ((ERTableEditPart) object).getModel();
return new ERTablePropertySource(editor, table);
}
return null;
}
示例4: calculateEnabled
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected boolean calculateEnabled() {
final List<EditPart> list = new ArrayList<EditPart>(getSelectedObjects());
if (list.isEmpty()) {
return false;
}
if (list.size() == 1 && list.get(0) instanceof ModelPropertiesEditPart || list.get(0) instanceof ERDiagramEditPart) {
return false;
}
return true;
}
示例5: getCreateCommand
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
final ERDiagramEditPart editPart = (ERDiagramEditPart) getHost();
final Point point = request.getLocation();
editPart.getFigure().translateToRelative(point);
final NodeElement element = (NodeElement) request.getNewObject();
final ERDiagram diagram = (ERDiagram) editPart.getModel();
Dimension size = request.getSize();
final List<NodeElement> enclosedElementList = new ArrayList<NodeElement>();
if (size != null) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
size = new Dimension((int) (size.width / zoom), (int) (size.height / zoom));
for (final Object child : editPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
final NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
final Rectangle bounds = nodeElementEditPart.getFigure().getBounds();
if (bounds.x > point.x && bounds.x + bounds.width < point.x + size.width && bounds.y > point.y && bounds.y + bounds.height < point.y + size.height) {
enclosedElementList.add((NodeElement) nodeElementEditPart.getModel());
}
}
}
}
return new CreateElementCommand(diagram, element, point.x, point.y, size, enclosedElementList);
}
示例6: mouseDown
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
@Override
public void mouseDown(MouseEvent e, EditPartViewer viewer) {
if (viewer.getContents() instanceof ERDiagramEditPart) {
ERDiagramEditPart editPart = (ERDiagramEditPart) viewer
.getContents();
ERDiagram diagram = (ERDiagram) editPart.getModel();
diagram.mousePoint = new Point(e.x, e.y);
editPart.getFigure().translateToRelative(diagram.mousePoint);
}
super.mouseDown(e, viewer);
}
示例7: getPropertySource
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
public IPropertySource getPropertySource(Object object) {
if (object instanceof ERDiagramEditPart) {
ERDiagram diagram = (ERDiagram) ((ERDiagramEditPart) object)
.getModel();
return new ERDiagramPropertySource(this.editor, diagram);
} else if (object instanceof ERTableEditPart) {
ERTable table = (ERTable) ((ERTableEditPart) object).getModel();
return new ERTablePropertySource(this.editor, table);
}
return null;
}
示例8: getRectangle
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* When category management (Change Setting Command) is executed, new
* categorie's bounds will be calculated. If undo, replaced all with old
* categories.
*/
@Override
protected Rectangle getRectangle() {
final Rectangle rectangle = super.getRectangle();
final Category category = (Category) getModel();
final ERDiagramEditPart rootEditPart = (ERDiagramEditPart) getRoot().getContents();
for (final Object child : rootEditPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
final NodeElementEditPart editPart = (NodeElementEditPart) child;
final NodeElement element = (NodeElement) editPart.getModel();
if (category.contains((NodeElement) editPart.getModel())) {
final Location bounds = element.getActualLocation();
if (bounds.x < rectangle.x) {
rectangle.width += rectangle.x - bounds.x;
rectangle.x = bounds.x;
}
if (bounds.y < rectangle.y) {
rectangle.height += rectangle.y - bounds.y;
rectangle.y = bounds.y;
}
if (bounds.x + bounds.width > rectangle.x + rectangle.width) {
rectangle.width = bounds.x + bounds.width - rectangle.x;
}
if (bounds.y + bounds.height > rectangle.y + rectangle.height) {
rectangle.height = bounds.y + bounds.height - rectangle.y;
}
}
}
}
if (rectangle.x != category.getX() || rectangle.y != category.getY() || rectangle.width != category.getWidth() || rectangle.height != category.getHeight()) {
category.setLocation(new Location(rectangle.x, rectangle.y, rectangle.width, rectangle.height));
}
return rectangle;
}
示例9: getRectangle
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* When category management (Change Setting Command) is executed, new
* categorie's bounds will be calculated. If undo, replaced all with old
* categories.
*/
@Override
protected Rectangle getRectangle() {
Rectangle rectangle = super.getRectangle();
Category category = (Category) this.getModel();
ERDiagramEditPart rootEditPart = (ERDiagramEditPart) this.getRoot()
.getContents();
for (Object child : rootEditPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
NodeElementEditPart editPart = (NodeElementEditPart) child;
NodeElement element = (NodeElement) editPart.getModel();
if (category.contains((NodeElement) editPart.getModel())) {
Location bounds = element.getLocationInAll();
if (bounds.x < rectangle.x) {
rectangle.width += rectangle.x - bounds.x;
rectangle.x = bounds.x;
}
if (bounds.y < rectangle.y) {
rectangle.height += rectangle.y - bounds.y;
rectangle.y = bounds.y;
}
if (bounds.x + bounds.width > rectangle.x + rectangle.width) {
rectangle.width = bounds.x + bounds.width - rectangle.x;
}
if (bounds.y + bounds.height > rectangle.y
+ rectangle.height) {
rectangle.height = bounds.y + bounds.height
- rectangle.y;
}
}
}
}
if (rectangle.x != category.getX() || rectangle.y != category.getY()
|| rectangle.width != category.getWidth()
|| rectangle.height != category.getHeight()) {
category.setLocation(new Location(rectangle.x, rectangle.y,
rectangle.width, rectangle.height));
}
return rectangle;
}
示例10: getCreateCommand
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateCommand(CreateRequest request) {
ERDiagramEditPart editPart = (ERDiagramEditPart) this.getHost();
Point point = request.getLocation();
editPart.getFigure().translateToRelative(point);
NodeElement element = (NodeElement) request.getNewObject();
ERDiagram diagram = (ERDiagram) editPart.getModel();
Dimension size = request.getSize();
List<NodeElement> enclosedElementList = new ArrayList<NodeElement>();
if (size != null) {
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
size = new Dimension((int) (size.width / zoom),
(int) (size.height / zoom));
for (Object child : editPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
Rectangle bounds = nodeElementEditPart.getFigure()
.getBounds();
if (bounds.x > point.x
&& bounds.x + bounds.width < point.x + size.width
&& bounds.y > point.y
&& bounds.y + bounds.height < point.y + size.height) {
enclosedElementList
.add((NodeElement) nodeElementEditPart
.getModel());
}
}
}
}
return new CreateElementCommand(diagram, element, point.x, point.y,
size, enclosedElementList);
}
示例11: getRectangle
import org.insightech.er.editor.controller.editpart.element.ERDiagramEditPart; //导入依赖的package包/类
/**
* When category management (Change Setting Command) is executed, new
* categorie's bounds will be calculated. If undo, replaced all with old
* categories.
*/
@Override
protected Rectangle getRectangle() {
Rectangle rectangle = super.getRectangle();
Category category = (Category) this.getModel();
ERDiagramEditPart rootEditPart = (ERDiagramEditPart) this.getRoot()
.getContents();
for (Object child : rootEditPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
NodeElementEditPart editPart = (NodeElementEditPart) child;
NodeElement element = (NodeElement) editPart.getModel();
if (category.contains((NodeElement) editPart.getModel())) {
Location bounds = element.getActualLocation();
if (bounds.x < rectangle.x) {
rectangle.width += rectangle.x - bounds.x;
rectangle.x = bounds.x;
}
if (bounds.y < rectangle.y) {
rectangle.height += rectangle.y - bounds.y;
rectangle.y = bounds.y;
}
if (bounds.x + bounds.width > rectangle.x + rectangle.width) {
rectangle.width = bounds.x + bounds.width - rectangle.x;
}
if (bounds.y + bounds.height > rectangle.y
+ rectangle.height) {
rectangle.height = bounds.y + bounds.height
- rectangle.y;
}
}
}
}
if (rectangle.x != category.getX() || rectangle.y != category.getY()
|| rectangle.width != category.getWidth()
|| rectangle.height != category.getHeight()) {
category.setLocation(new Location(rectangle.x, rectangle.y,
rectangle.width, rectangle.height));
}
return rectangle;
}