use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class CloneCommand method getWidgetsFromClipboard.
/**
* Returns a list with widget models that are currently stored on the
* clipboard.
*
* @return a list with widget models or an empty list
*/
@SuppressWarnings("unchecked")
private List<AbstractWidgetModel> getWidgetsFromClipboard() {
Clipboard clipboard = new Clipboard(Display.getCurrent());
List<AbstractWidgetModel> result = (List<AbstractWidgetModel>) clipboard.getContents(OPIWidgetsTransfer.getInstance());
return result;
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class DeleteGuideCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
parent.addGuide(guide);
Iterator<AbstractWidgetModel> iter = oldParts.keySet().iterator();
while (iter.hasNext()) {
AbstractWidgetModel model = iter.next();
guide.attachPart(model, ((Integer) oldParts.get(model)).intValue());
}
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class MoveGuideCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
guide.setPosition(guide.getPosition() + pDelta);
Iterator<AbstractWidgetModel> iter = guide.getAttachedModels().iterator();
while (iter.hasNext()) {
AbstractWidgetModel model = iter.next();
Point location = model.getLocation();
if (guide.isHorizontal()) {
location.y += pDelta;
} else {
location.x += pDelta;
}
model.setLocation(location.x, location.y);
}
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class MoveGuideCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
guide.setPosition(guide.getPosition() - pDelta);
Iterator<AbstractWidgetModel> iter = guide.getAttachedModels().iterator();
while (iter.hasNext()) {
AbstractWidgetModel model = iter.next();
Point location = model.getLocation();
if (guide.isHorizontal()) {
location.y -= pDelta;
} else {
location.x -= pDelta;
}
model.setLocation(location.x, location.y);
}
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class ReplaceWidgetCommand method getAllConnections.
private List<ConnectionModel> getAllConnections(AbstractWidgetModel widget, boolean source) {
List<ConnectionModel> result = new ArrayList<ConnectionModel>();
result.addAll(source ? widget.getSourceConnections() : widget.getTargetConnections());
if (widget instanceof AbstractContainerModel) {
for (AbstractWidgetModel child : ((AbstractContainerModel) widget).getAllDescendants()) {
result.addAll(source ? child.getSourceConnections() : child.getTargetConnections());
}
}
return result;
}
Aggregations