mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 17:04:42 -04:00
allows to open the attribute dialog in locked mode, closes #291
This commit is contained in:
parent
32835fcda3
commit
a7228a8542
@ -40,6 +40,7 @@ public class AttributeDialog extends JDialog {
|
|||||||
private final ElementAttributes modifiedAttributes;
|
private final ElementAttributes modifiedAttributes;
|
||||||
private final JPanel buttonPanel;
|
private final JPanel buttonPanel;
|
||||||
private final ConstraintsBuilder constraints;
|
private final ConstraintsBuilder constraints;
|
||||||
|
private final AbstractAction okAction;
|
||||||
private HashMap<Key, JCheckBox> checkBoxes;
|
private HashMap<Key, JCheckBox> checkBoxes;
|
||||||
private JComponent topMostTextComponent;
|
private JComponent topMostTextComponent;
|
||||||
private VisualElement visualElement;
|
private VisualElement visualElement;
|
||||||
@ -163,7 +164,7 @@ public class AttributeDialog extends JDialog {
|
|||||||
getContentPane().add(new JScrollPane(panel));
|
getContentPane().add(new JScrollPane(panel));
|
||||||
|
|
||||||
|
|
||||||
JButton okButton = new JButton(new AbstractAction(Lang.get("ok")) {
|
okAction = new AbstractAction(Lang.get("ok")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
@ -172,7 +173,8 @@ public class AttributeDialog extends JDialog {
|
|||||||
new ErrorMessage(Lang.get("msg_errorEditingValue")).addCause(err).show(AttributeDialog.this);
|
new ErrorMessage(Lang.get("msg_errorEditingValue")).addCause(err).show(AttributeDialog.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
JButton okButton = new JButton(okAction);
|
||||||
|
|
||||||
final AbstractAction cancel = new AbstractAction(Lang.get("cancel")) {
|
final AbstractAction cancel = new AbstractAction(Lang.get("cancel")) {
|
||||||
@Override
|
@Override
|
||||||
@ -347,6 +349,14 @@ public class AttributeDialog extends JDialog {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the ok button
|
||||||
|
*/
|
||||||
|
public void disableOk() {
|
||||||
|
okAction.setEnabled(false);
|
||||||
|
okPressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
private static final class EditorHolder<T> {
|
private static final class EditorHolder<T> {
|
||||||
private final Editor<T> e;
|
private final Editor<T> e;
|
||||||
private final Key<T> key;
|
private final Key<T> key;
|
||||||
|
@ -1069,8 +1069,12 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("attr_help_tt")));
|
}.setToolTip(Lang.get("attr_help_tt")));
|
||||||
|
|
||||||
|
boolean locked = isLocked();
|
||||||
|
if (isLocked())
|
||||||
|
attributeDialog.disableOk();
|
||||||
|
|
||||||
ElementAttributes modified = attributeDialog.showDialog();
|
ElementAttributes modified = attributeDialog.showDialog();
|
||||||
if (modified != null)
|
if (modified != null && !locked)
|
||||||
modify(new ModifyAttributes(element, modified));
|
modify(new ModifyAttributes(element, modified));
|
||||||
}
|
}
|
||||||
} catch (ElementNotFoundException ex) {
|
} catch (ElementNotFoundException ex) {
|
||||||
@ -1435,11 +1439,9 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
Vector pos = getPosVector(e);
|
Vector pos = getPosVector(e);
|
||||||
|
|
||||||
if (mouse.isSecondaryClick(e)) {
|
if (mouse.isSecondaryClick(e)) {
|
||||||
if (!isLocked()) {
|
VisualElement vp = getVisualElement(pos, true);
|
||||||
VisualElement vp = getVisualElement(pos, true);
|
if (vp != null)
|
||||||
if (vp != null)
|
editAttributes(vp, e);
|
||||||
editAttributes(vp, e);
|
|
||||||
}
|
|
||||||
} else if (mouse.isPrimaryClick(e)) {
|
} else if (mouse.isPrimaryClick(e)) {
|
||||||
VisualElement vp = getVisualElement(pos, false);
|
VisualElement vp = getVisualElement(pos, false);
|
||||||
if (vp != null) {
|
if (vp != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user