mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 17:34:43 -04:00
"create new state" dialog matches "edit state" dialog
This commit is contained in:
parent
c3f6c14dab
commit
23fb44b6bd
@ -181,11 +181,14 @@ public class FSMComponent extends JComponent {
|
|||||||
setPreferredSize(new Dimension(600, 600));
|
setPreferredSize(new Dimension(600, 600));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Key[] STATE_EDIT_KEYS = {Keys.LABEL, KEY_NUMBER, KEY_INITIAL, KEY_VALUES, KEY_RADIUS};
|
||||||
|
|
||||||
private void createNewState(Vector posVector, Point point) {
|
private void createNewState(Vector posVector, Point point) {
|
||||||
ElementAttributes attr = new ElementAttributes();
|
ElementAttributes attr = new ElementAttributes();
|
||||||
attr.set(KEY_NUMBER, fsm.getStates().size());
|
attr.set(KEY_NUMBER, fsm.getStates().size());
|
||||||
SwingUtilities.convertPointToScreen(point, this);
|
SwingUtilities.convertPointToScreen(point, this);
|
||||||
AttributeDialog ad = new AttributeDialog(SwingUtilities.getWindowAncestor(this), point, attr, Keys.LABEL, KEY_NUMBER, KEY_VALUES);
|
AttributeDialog ad = new AttributeDialog(SwingUtilities.getWindowAncestor(this),
|
||||||
|
point, attr, STATE_EDIT_KEYS);
|
||||||
ad.setTitle(Lang.get("msg_fsmNewState"));
|
ad.setTitle(Lang.get("msg_fsmNewState"));
|
||||||
ElementAttributes newAttr = ad.showDialog();
|
ElementAttributes newAttr = ad.showDialog();
|
||||||
if (newAttr != null) {
|
if (newAttr != null) {
|
||||||
@ -207,7 +210,7 @@ public class FSMComponent extends JComponent {
|
|||||||
.set(Keys.LABEL, state.getName());
|
.set(Keys.LABEL, state.getName());
|
||||||
SwingUtilities.convertPointToScreen(point, this);
|
SwingUtilities.convertPointToScreen(point, this);
|
||||||
AttributeDialog ad = new AttributeDialog(SwingUtilities.getWindowAncestor(this),
|
AttributeDialog ad = new AttributeDialog(SwingUtilities.getWindowAncestor(this),
|
||||||
point, attr, Keys.LABEL, KEY_NUMBER, KEY_INITIAL, KEY_VALUES, KEY_RADIUS);
|
point, attr, STATE_EDIT_KEYS);
|
||||||
ElementAttributes newAttr = ad.showDialog();
|
ElementAttributes newAttr = ad.showDialog();
|
||||||
if (newAttr != null) {
|
if (newAttr != null) {
|
||||||
state.setNumber(newAttr.get(KEY_NUMBER));
|
state.setNumber(newAttr.get(KEY_NUMBER));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user