/** * @return The input map for the condition {@link #WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT} * @see #setInputMap(javax.swing.InputMap) */ public InputMap getInputMap() { return getInputMap(WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT); }
protected static String strokes(Set<SComponent> components) { if (components == null) return null; StringBuilder builder = new StringBuilder(); builder.append("var wk = wingS.keyboard;"); builder.append("var kss = wk.keyStrokes = [];"); builder.append("var ks = wingS.keyboard.KeyStroke;\n"); for (SComponent component : components) { if (component.isRecursivelyVisible()) { appendStrokes(builder, component, SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT, component.getInputMap(SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT)); appendStrokes(builder, component, SComponent.WHEN_IN_FOCUSED_FRAME, component.getInputMap(SComponent.WHEN_IN_FOCUSED_FRAME)); } } return builder.toString(); }
private boolean checkForChange(SComponent component, int condition) { InputMap inputMap = component.getInputMap(condition); if (inputMap != null && inputMap.size() > 0) { if (!(inputMap instanceof VersionedInputMap)) { inputMap = new VersionedInputMap(inputMap); component.setInputMap(condition, inputMap); component.putClientProperty("inputMapVersion" + condition, -1); } final VersionedInputMap versionedInputMap = (VersionedInputMap)inputMap; final Integer inputMapVersion = (Integer) component.getClientProperty("inputMapVersion" + condition); if (inputMapVersion == null || versionedInputMap.getVersion() != inputMapVersion) { component.putClientProperty("inputMapVersion" + condition, versionedInputMap.getVersion()); return true; } } return false; } }
.put(wingsAction.getValue(Action.NAME), wingsAction); view.getPeer() .getInputMap( SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT) .put(ks, wingsAction.getValue(Action.NAME));
view.getPeer().getActionMap().put( wingsAction.getValue(Action.NAME), wingsAction); view.getPeer().getInputMap( SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT) .put(ks, wingsAction.getValue(Action.NAME));