Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;

import org.csstudio.display.builder.editor.DisplayEditor;
import org.csstudio.display.builder.editor.Messages;
Expand Down Expand Up @@ -213,9 +214,12 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propX().getValue();
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propX(), dest));
final int min = widgets.stream()
.mapToInt(w -> w.propX().getValue())
.min()
.orElseThrow(NoSuchElementException::new);
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propX(), min));
}
};

Expand All @@ -230,10 +234,18 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propX().getValue() + widgets.get(0).propWidth().getValue() / 2;
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propX(),
dest - widgets.get(i).propWidth().getValue()/2));
final int min = widgets.stream()
.mapToInt(w -> w.propX().getValue())
.min()
.orElseThrow(NoSuchElementException::new);
final int max = widgets.stream()
.mapToInt(w -> w.propX().getValue() + w.propWidth().getValue())
.max()
.orElseThrow(NoSuchElementException::new);
final int center = (min + max) / 2;
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propX(),
center - w.propWidth().getValue()/2));
}
};

Expand All @@ -248,10 +260,12 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propX().getValue() + widgets.get(0).propWidth().getValue();
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propX(),
dest - widgets.get(i).propWidth().getValue()));
final int max = widgets.stream()
.mapToInt(w -> w.propX().getValue() + w.propWidth().getValue())
.max()
.orElseThrow(NoSuchElementException::new);
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propX(), max - w.propWidth().getValue()));
}
};

Expand All @@ -266,9 +280,12 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propY().getValue();
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propY(), dest));
final int min = widgets.stream()
.mapToInt(w -> w.propY().getValue())
.min()
.orElseThrow(NoSuchElementException::new);
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propY(), min));
}
};

Expand All @@ -283,10 +300,18 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propY().getValue() + widgets.get(0).propHeight().getValue()/2;
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propY(),
dest - widgets.get(i).propHeight().getValue()/2));
final int min = widgets.stream()
.mapToInt(w -> w.propY().getValue())
.min()
.orElseThrow(NoSuchElementException::new);
final int max = widgets.stream()
.mapToInt(w -> w.propY().getValue() + w.propHeight().getValue())
.max()
.orElseThrow(NoSuchElementException::new);
final int middle = ( min + max ) / 2;
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propY(),
middle - w.propHeight().getValue()/2));
}
};

Expand All @@ -301,10 +326,13 @@ public void run(final DisplayEditor editor, final boolean selected)
final UndoableActionManager undo = editor.getUndoableActionManager();
if (widgets.size() < 2)
return;
final int dest = widgets.get(0).propY().getValue() + widgets.get(0).propHeight().getValue();
for (int i=1; i<widgets.size(); ++i)
undo.execute(new SetWidgetPropertyAction<>(widgets.get(i).propY(),
dest - widgets.get(i).propHeight().getValue()));
final int max = widgets.stream()
.mapToInt(w -> w.propY().getValue() + w.propHeight().getValue())
.max()
.orElseThrow(NoSuchElementException::new);
for (Widget w : widgets)
undo.execute(new SetWidgetPropertyAction<>(w.propY(),
max - w.propHeight().getValue()));
}
};

Expand Down