use of org.tmdmaker.core.model.constraint.AnchorConstraint in project tmdmaker by tmdmaker.
the class AbstractConnectionModel method setTargetAnchorConstraint.
public void setTargetAnchorConstraint(AnchorConstraint targetAnchorConstraint) {
AnchorConstraint oldTargetAnchorConstraint = this.targetAnchorConstraint;
this.targetAnchorConstraint = targetAnchorConstraint;
firePropertyChange(PROPERTY_CONNECTION, oldTargetAnchorConstraint, this.targetAnchorConstraint);
}
use of org.tmdmaker.core.model.constraint.AnchorConstraint in project tmdmaker by tmdmaker.
the class AbstractConnectionModel method setSourceAnchorConstraint.
public void setSourceAnchorConstraint(AnchorConstraint sourceAnchorConstraint) {
AnchorConstraint oldSourceAnchorConstraint = this.sourceAnchorConstraint;
this.sourceAnchorConstraint = sourceAnchorConstraint;
firePropertyChange(PROPERTY_CONNECTION, oldSourceAnchorConstraint, this.sourceAnchorConstraint);
}
use of org.tmdmaker.core.model.constraint.AnchorConstraint in project tmdmaker by tmdmaker.
the class ReconnectableNodeEditPolicy method getReconnectTargetCommand.
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
*/
@Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
AbstractConnectionModel connection = (AbstractConnectionModel) request.getConnectionEditPart().getModel();
if (connection.getSource() == connection.getTarget()) {
logger.debug("source == target");
return null;
}
AbstractEntityModel newTarget = (AbstractEntityModel) request.getTarget().getModel();
if (!connection.getTarget().equals(newTarget)) {
logger.debug("target not equals newTarget");
return null;
}
Point location = new Point(request.getLocation());
AbstractModelEditPart<?> targetEditPart = (AbstractModelEditPart<?>) request.getConnectionEditPart().getTarget();
IFigure targetFigure = targetEditPart.getFigure();
targetFigure.translateToRelative(location);
AnchorConstraint newAnchorConstraint = new XYChopboxAnchorHelper(targetFigure.getBounds()).calculateAnchorConstraint(location);
return new TargetConnectionReconnectCommand(connection, newAnchorConstraint);
}
use of org.tmdmaker.core.model.constraint.AnchorConstraint in project tmdmaker by tmdmaker.
the class AnchorConstraintMigrator method convertNullLocationPoint.
/**
* データ移行.
*
* バージョン0.4.0より前の場合にデータを補正する。
*/
public void convertNullLocationPoint(AbstractConnectionModel connection) {
if (connection.sourceXp == 0 && connection.sourceYp == 0 || connection.targetXp == 0 && connection.targetYp == 0) {
connection.setSourceAnchorConstraint(new AnchorConstraint());
connection.setTargetAnchorConstraint(new AnchorConstraint());
return;
}
connection.setSourceAnchorConstraint(new AnchorConstraint(connection.sourceXp, connection.sourceYp));
connection.setTargetAnchorConstraint(new AnchorConstraint(connection.targetXp, connection.targetYp));
}
use of org.tmdmaker.core.model.constraint.AnchorConstraint in project tmdmaker by tmdmaker.
the class AbstractModelEditPart method getSourceConnectionAnchor.
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
IFigure thisFigure = this.getFigure();
if (request instanceof ReconnectRequest) {
ReconnectRequest reconnectRequest = (ReconnectRequest) request;
ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
AbstractConnectionModel relationship = (AbstractConnectionModel) connectionEditPart.getModel();
if (relationship.getSource() == relationship.getTarget()) {
return new XYChopboxAnchor(thisFigure);
}
EditPart editPart = reconnectRequest.getTarget();
if (editPart == null || !editPart.getModel().equals(relationship.getSource())) {
return new XYChopboxAnchor(thisFigure);
}
Point location = new Point(reconnectRequest.getLocation());
thisFigure.translateToRelative(location);
IFigure sourceFigure = ((AbstractModelEditPart<?>) connectionEditPart.getSource()).getFigure();
AnchorConstraint newAnchorConstraint = new XYChopboxAnchorHelper(sourceFigure.getBounds()).calculateAnchorConstraint(location);
return new XYChopboxAnchor(thisFigure, newAnchorConstraint);
}
return new XYChopboxAnchor(thisFigure);
}
Aggregations