use of com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut in project netbeans-mmd-plugin by raydac.
the class PreferencesPanel method buttonOpenShortcutEditorActionPerformed.
// GEN-LAST:event_spinnerJumpLinkWidthStateChanged
private void buttonOpenShortcutEditorActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_buttonOpenShortcutEditorActionPerformed
final List<KeyShortcut> list = new ArrayList<>();
for (final Map.Entry<String, KeyShortcut> e : this.mapKeyShortCuts.entrySet()) {
list.add(e.getValue());
}
final KeyShortCutEditPanel panel = new KeyShortCutEditPanel(list);
if (DialogProviderManager.getInstance().getDialogProvider().msgOkCancel(this, "Edit shortcuts", panel)) {
for (final KeyShortcut s : panel.getResult()) {
this.mapKeyShortCuts.put(s.getID(), s);
}
if (this.changeNotificationAllowed) {
this.changed = true;
}
}
}
use of com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut in project netbeans-mmd-plugin by raydac.
the class KeyShortCutEditPanel method updateForSelected.
private void updateForSelected() {
final KeyShortcut shortcut = getSelectedRow();
if (shortcut == null) {
this.buttonEditKeyCode.setEnabled(false);
this.buttonEditKeyCode.setSelected(false);
this.checkBoxALT.setSelected(false);
this.checkBoxSHIFT.setSelected(false);
this.checkBoxCTRL.setSelected(false);
this.checkBoxMeta.setSelected(false);
this.checkBoxALT.setEnabled(false);
this.checkBoxCTRL.setEnabled(false);
this.checkBoxSHIFT.setEnabled(false);
this.checkBoxMeta.setEnabled(false);
// NOI18N
this.textFieldKeyCode.setText("");
this.textFieldKeyCode.setEnabled(false);
} else {
this.buttonEditKeyCode.setEnabled(true);
this.buttonEditKeyCode.setSelected(false);
this.textFieldKeyCode.setEnabled(true);
this.checkBoxALT.setEnabled(true);
this.checkBoxCTRL.setEnabled(true);
this.checkBoxMeta.setEnabled(true);
this.checkBoxSHIFT.setEnabled(true);
this.textFieldKeyCode.setText(shortcut.getKeyCodeName());
this.checkBoxALT.setSelected(shortcut.isAlt());
this.checkBoxSHIFT.setSelected(shortcut.isShift());
this.checkBoxMeta.setSelected(shortcut.isMeta());
this.checkBoxCTRL.setSelected(shortcut.isCtrl());
}
}
use of com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut in project netbeans-mmd-plugin by raydac.
the class KeyShortCutEditPanel method updateCurrentSelectedForKey.
private void updateCurrentSelectedForKey(final KeyEvent evt) {
final int index = this.tableKeyShortcuts.getSelectedRow();
if (index >= 0) {
final KeyShortcut oldShortcut = this.listOfKeys.get(index);
final int keyCode = evt.getKeyCode();
final int modifiers = evt.getModifiers() & (KeyEvent.META_MASK | KeyEvent.SHIFT_MASK | KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
final KeyShortcut newShortCut = new KeyShortcut(oldShortcut.getID(), keyCode, modifiers);
this.listOfKeys.set(index, newShortCut);
for (final TableModelListener l : this.listeners) {
l.tableChanged(new TableModelEvent(this, index));
}
}
updateForSelected();
}
use of com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut in project netbeans-mmd-plugin by raydac.
the class KeyShortCutEditPanel method updateForSelected.
private void updateForSelected() {
final KeyShortcut shortcut = getSelectedRow();
if (shortcut == null) {
this.buttonEditKeyCode.setEnabled(false);
this.buttonEditKeyCode.setSelected(false);
this.checkBoxALT.setSelected(false);
this.checkBoxSHIFT.setSelected(false);
this.checkBoxCTRL.setSelected(false);
this.checkBoxMeta.setSelected(false);
this.checkBoxALT.setEnabled(false);
this.checkBoxCTRL.setEnabled(false);
this.checkBoxSHIFT.setEnabled(false);
this.checkBoxMeta.setEnabled(false);
// NOI18N
this.textFieldKeyCode.setText("");
this.textFieldKeyCode.setEnabled(false);
} else {
this.buttonEditKeyCode.setEnabled(true);
this.buttonEditKeyCode.setSelected(false);
this.textFieldKeyCode.setEnabled(true);
this.checkBoxALT.setEnabled(true);
this.checkBoxCTRL.setEnabled(true);
this.checkBoxMeta.setEnabled(true);
this.checkBoxSHIFT.setEnabled(true);
this.textFieldKeyCode.setText(shortcut.getKeyCodeName());
this.checkBoxALT.setSelected(shortcut.isAlt());
this.checkBoxSHIFT.setSelected(shortcut.isShift());
this.checkBoxMeta.setSelected(shortcut.isMeta());
this.checkBoxCTRL.setSelected(shortcut.isCtrl());
}
}
use of com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut in project netbeans-mmd-plugin by raydac.
the class MindMapPanelConfigTest method testHasDifferenceInParameters_DifferenceInKeyShortcuts.
@Test
public void testHasDifferenceInParameters_DifferenceInKeyShortcuts() {
final MindMapPanelConfig one = new MindMapPanelConfig();
final MindMapPanelConfig two = new MindMapPanelConfig();
one.setKeyShortCut(new KeyShortcut(MindMapPanelConfig.KEY_ADD_CHILD_AND_START_EDIT, Integer.MAX_VALUE, Integer.MIN_VALUE));
assertTrue(one.hasDifferenceInParameters(two));
}
Aggregations