id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
11,800
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java
AbstractOverlayFormComponentInterceptor.processComponent
@Override public final void processComponent(String propertyName, final JComponent component) { final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component); // Wait until has parent and overlay is correctly installed final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { final JComponent targetComponent = overlayHandler.getTargetComponent(); final JComponent overlay = overlayHandler.getOverlay(); // Install overlay final int position = AbstractOverlayFormComponentInterceptor.this.getPosition(); final Boolean success = AbstractOverlayFormComponentInterceptor.this.// getOverlayService().installOverlay(targetComponent, overlay, position, null); if (success) { targetComponent.removePropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this); } } }; component.addPropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener); }
java
@Override public final void processComponent(String propertyName, final JComponent component) { final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component); // Wait until has parent and overlay is correctly installed final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { final JComponent targetComponent = overlayHandler.getTargetComponent(); final JComponent overlay = overlayHandler.getOverlay(); // Install overlay final int position = AbstractOverlayFormComponentInterceptor.this.getPosition(); final Boolean success = AbstractOverlayFormComponentInterceptor.this.// getOverlayService().installOverlay(targetComponent, overlay, position, null); if (success) { targetComponent.removePropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this); } } }; component.addPropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener); }
[ "@", "Override", "public", "final", "void", "processComponent", "(", "String", "propertyName", ",", "final", "JComponent", "component", ")", "{", "final", "AbstractOverlayHandler", "overlayHandler", "=", "this", ".", "createOverlayHandler", "(", "propertyName", ",", "component", ")", ";", "// Wait until has parent and overlay is correctly installed", "final", "PropertyChangeListener", "wait4ParentListener", "=", "new", "PropertyChangeListener", "(", ")", "{", "public", "void", "propertyChange", "(", "PropertyChangeEvent", "e", ")", "{", "final", "JComponent", "targetComponent", "=", "overlayHandler", ".", "getTargetComponent", "(", ")", ";", "final", "JComponent", "overlay", "=", "overlayHandler", ".", "getOverlay", "(", ")", ";", "// Install overlay", "final", "int", "position", "=", "AbstractOverlayFormComponentInterceptor", ".", "this", ".", "getPosition", "(", ")", ";", "final", "Boolean", "success", "=", "AbstractOverlayFormComponentInterceptor", ".", "this", ".", "//", "getOverlayService", "(", ")", ".", "installOverlay", "(", "targetComponent", ",", "overlay", ",", "position", ",", "null", ")", ";", "if", "(", "success", ")", "{", "targetComponent", ".", "removePropertyChangeListener", "(", "//", "AbstractOverlayFormComponentInterceptor", ".", "ANCESTOR_PROPERTY", ",", "this", ")", ";", "}", "}", "}", ";", "component", ".", "addPropertyChangeListener", "(", "//", "AbstractOverlayFormComponentInterceptor", ".", "ANCESTOR_PROPERTY", ",", "wait4ParentListener", ")", ";", "}" ]
Creates an overlay handler for the given property name and component and installs the overlay. @param propertyName the property name. @param component the component. @see OverlayService#installOverlay(JComponent, JComponent)
[ "Creates", "an", "overlay", "handler", "for", "the", "given", "property", "name", "and", "component", "and", "installs", "the", "overlay", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java#L89-L116
11,801
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginDetails.java
LoginDetails.initRules
protected void initRules() { this.validationRules = new Rules( getClass() ) { protected void initRules() { add( PROPERTY_USERNAME, all( new Constraint[] { required(), minLength( getUsernameMinLength() ) } ) ); add( PROPERTY_PASSWORD, all( new Constraint[] { required(), minLength( getPasswordMinLength() ) } ) ); } protected int getUsernameMinLength() { return 2; } protected int getPasswordMinLength() { return 2; } }; }
java
protected void initRules() { this.validationRules = new Rules( getClass() ) { protected void initRules() { add( PROPERTY_USERNAME, all( new Constraint[] { required(), minLength( getUsernameMinLength() ) } ) ); add( PROPERTY_PASSWORD, all( new Constraint[] { required(), minLength( getPasswordMinLength() ) } ) ); } protected int getUsernameMinLength() { return 2; } protected int getPasswordMinLength() { return 2; } }; }
[ "protected", "void", "initRules", "(", ")", "{", "this", ".", "validationRules", "=", "new", "Rules", "(", "getClass", "(", ")", ")", "{", "protected", "void", "initRules", "(", ")", "{", "add", "(", "PROPERTY_USERNAME", ",", "all", "(", "new", "Constraint", "[", "]", "{", "required", "(", ")", ",", "minLength", "(", "getUsernameMinLength", "(", ")", ")", "}", ")", ")", ";", "add", "(", "PROPERTY_PASSWORD", ",", "all", "(", "new", "Constraint", "[", "]", "{", "required", "(", ")", ",", "minLength", "(", "getPasswordMinLength", "(", ")", ")", "}", ")", ")", ";", "}", "protected", "int", "getUsernameMinLength", "(", ")", "{", "return", "2", ";", "}", "protected", "int", "getPasswordMinLength", "(", ")", "{", "return", "2", ";", "}", "}", ";", "}" ]
Initialize the field constraints for our properties. Minimal constraints are enforced here. If you need more control, you should override this in a subtype.
[ "Initialize", "the", "field", "constraints", "for", "our", "properties", ".", "Minimal", "constraints", "are", "enforced", "here", ".", "If", "you", "need", "more", "control", "you", "should", "override", "this", "in", "a", "subtype", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginDetails.java#L69-L85
11,802
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/AlertMessageAreaPane.java
AlertMessageAreaPane.getIcon
private Icon getIcon( Severity severity ) { if( severity == Severity.ERROR ) { return getErrorIcon(); } if( severity == Severity.WARNING ) { return getWarningIcon(); } return getInfoIcon(); }
java
private Icon getIcon( Severity severity ) { if( severity == Severity.ERROR ) { return getErrorIcon(); } if( severity == Severity.WARNING ) { return getWarningIcon(); } return getInfoIcon(); }
[ "private", "Icon", "getIcon", "(", "Severity", "severity", ")", "{", "if", "(", "severity", "==", "Severity", ".", "ERROR", ")", "{", "return", "getErrorIcon", "(", ")", ";", "}", "if", "(", "severity", "==", "Severity", ".", "WARNING", ")", "{", "return", "getWarningIcon", "(", ")", ";", "}", "return", "getInfoIcon", "(", ")", ";", "}" ]
Returns the icon for the given severity. @param severity The severity level. @return The icon for the given severity, never null.
[ "Returns", "the", "icon", "for", "the", "given", "severity", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/AlertMessageAreaPane.java#L164-L172
11,803
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/UserRoleSecurityController.java
UserRoleSecurityController.setAuthorizingRoles
public void setAuthorizingRoles(String roles) { // The ConfigAttributeEditor is named incorrectly, so you can't use it // to automatically convert the string to a ConfigAttributeDefinition. // So, we do it manually :-( ConfigAttributeEditor editor = new ConfigAttributeEditor(); editor.setAsText( roles ); this.roles = (List<ConfigAttribute>) editor.getValue(); rolesString = roles; }
java
public void setAuthorizingRoles(String roles) { // The ConfigAttributeEditor is named incorrectly, so you can't use it // to automatically convert the string to a ConfigAttributeDefinition. // So, we do it manually :-( ConfigAttributeEditor editor = new ConfigAttributeEditor(); editor.setAsText( roles ); this.roles = (List<ConfigAttribute>) editor.getValue(); rolesString = roles; }
[ "public", "void", "setAuthorizingRoles", "(", "String", "roles", ")", "{", "// The ConfigAttributeEditor is named incorrectly, so you can't use it", "// to automatically convert the string to a ConfigAttributeDefinition.", "// So, we do it manually :-(", "ConfigAttributeEditor", "editor", "=", "new", "ConfigAttributeEditor", "(", ")", ";", "editor", ".", "setAsText", "(", "roles", ")", ";", "this", ".", "roles", "=", "(", "List", "<", "ConfigAttribute", ">", ")", "editor", ".", "getValue", "(", ")", ";", "rolesString", "=", "roles", ";", "}" ]
Set the roles to compare against the current user's authenticated roles. The secured objects will be authorized if the user holds one or more of these roles. This should be specified as a simple list of comma separated role names. @param roles
[ "Set", "the", "roles", "to", "compare", "against", "the", "current", "user", "s", "authenticated", "roles", ".", "The", "secured", "objects", "will", "be", "authorized", "if", "the", "user", "holds", "one", "or", "more", "of", "these", "roles", ".", "This", "should", "be", "specified", "as", "a", "simple", "list", "of", "comma", "separated", "role", "names", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/UserRoleSecurityController.java#L89-L98
11,804
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java
ClassUtils.getTypeForProperty
public static Class<?> getTypeForProperty(Method getter) { Class<?> returnType = getter.getReturnType(); if (returnType.equals(Void.TYPE)) throw new IllegalArgumentException("Getter " + getter.toString() + " does not have a returntype."); else if (returnType.isPrimitive()) return MethodUtils.getPrimitiveWrapper(returnType); return returnType; }
java
public static Class<?> getTypeForProperty(Method getter) { Class<?> returnType = getter.getReturnType(); if (returnType.equals(Void.TYPE)) throw new IllegalArgumentException("Getter " + getter.toString() + " does not have a returntype."); else if (returnType.isPrimitive()) return MethodUtils.getPrimitiveWrapper(returnType); return returnType; }
[ "public", "static", "Class", "<", "?", ">", "getTypeForProperty", "(", "Method", "getter", ")", "{", "Class", "<", "?", ">", "returnType", "=", "getter", ".", "getReturnType", "(", ")", ";", "if", "(", "returnType", ".", "equals", "(", "Void", ".", "TYPE", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Getter \"", "+", "getter", ".", "toString", "(", ")", "+", "\" does not have a returntype.\"", ")", ";", "else", "if", "(", "returnType", ".", "isPrimitive", "(", ")", ")", "return", "MethodUtils", ".", "getPrimitiveWrapper", "(", "returnType", ")", ";", "return", "returnType", ";", "}" ]
Returns the type of the property checking if it actually does return something and wrapping primitives if needed. @param getter the method to access the property. @return the type of the property. @throws IllegalArgumentException if the method has a {@link Void} return type.
[ "Returns", "the", "type", "of", "the", "property", "checking", "if", "it", "actually", "does", "return", "something", "and", "wrapping", "primitives", "if", "needed", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java#L78-L86
11,805
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java
ClassUtils.getWriteMethod
public static final Method getWriteMethod(Class<?> clazz, String propertyName, Class<?> propertyType) { String propertyNameCapitalized = capitalize(propertyName); try { return clazz.getMethod("set" + propertyNameCapitalized, new Class[]{propertyType}); } catch (Exception e) { return null; } }
java
public static final Method getWriteMethod(Class<?> clazz, String propertyName, Class<?> propertyType) { String propertyNameCapitalized = capitalize(propertyName); try { return clazz.getMethod("set" + propertyNameCapitalized, new Class[]{propertyType}); } catch (Exception e) { return null; } }
[ "public", "static", "final", "Method", "getWriteMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "Class", "<", "?", ">", "propertyType", ")", "{", "String", "propertyNameCapitalized", "=", "capitalize", "(", "propertyName", ")", ";", "try", "{", "return", "clazz", ".", "getMethod", "(", "\"set\"", "+", "propertyNameCapitalized", ",", "new", "Class", "[", "]", "{", "propertyType", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "}" ]
Lookup the setter method for the given property. @param clazz type which contains the property. @param propertyName name of the property. @param propertyType type of the property. @return a Method with write-access for the property.
[ "Lookup", "the", "setter", "method", "for", "the", "given", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java#L99-L110
11,806
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java
ClassUtils.capitalize
public static String capitalize(String s) { if (s == null || s.length() == 0) { return s; } char chars[] = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); }
java
public static String capitalize(String s) { if (s == null || s.length() == 0) { return s; } char chars[] = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); }
[ "public", "static", "String", "capitalize", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "length", "(", ")", "==", "0", ")", "{", "return", "s", ";", "}", "char", "chars", "[", "]", "=", "s", ".", "toCharArray", "(", ")", ";", "chars", "[", "0", "]", "=", "Character", ".", "toUpperCase", "(", "chars", "[", "0", "]", ")", ";", "return", "new", "String", "(", "chars", ")", ";", "}" ]
Small helper method to capitalize the first character of the given string. @param s string to capitalize @return a string starting with a capital character.
[ "Small", "helper", "method", "to", "capitalize", "the", "first", "character", "of", "the", "given", "string", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/ClassUtils.java#L119-L128
11,807
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java
OverlayHelper.attachOverlay
public static void attachOverlay(JComponent overlay, JComponent overlayTarget, int center, int xOffset, int yOffset) { new OverlayHelper(overlay, overlayTarget, center, xOffset, yOffset); }
java
public static void attachOverlay(JComponent overlay, JComponent overlayTarget, int center, int xOffset, int yOffset) { new OverlayHelper(overlay, overlayTarget, center, xOffset, yOffset); }
[ "public", "static", "void", "attachOverlay", "(", "JComponent", "overlay", ",", "JComponent", "overlayTarget", ",", "int", "center", ",", "int", "xOffset", ",", "int", "yOffset", ")", "{", "new", "OverlayHelper", "(", "overlay", ",", "overlayTarget", ",", "center", ",", "xOffset", ",", "yOffset", ")", ";", "}" ]
Attaches an overlay to the specified component. @param overlay the overlay component @param overlayTarget the component over which <code>overlay</code> will be attached @param center position relative to <code>overlayTarget</code> that overlay should be centered. May be one of the <code>SwingConstants</code> compass positions or <code>SwingConstants.CENTER</code>. @param xOffset x offset from center @param yOffset y offset from center @see SwingConstants
[ "Attaches", "an", "overlay", "to", "the", "specified", "component", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java#L67-L70
11,808
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java
OverlayHelper.findLargestVisibleRectFor
private Rectangle findLargestVisibleRectFor(final Rectangle overlayRect) { Rectangle visibleRect = null; int curxoffset = 0; int curyoffset = 0; if (overlayTarget == null) { return null; } JComponent comp = overlayTarget; do { visibleRect = comp.getVisibleRect(); visibleRect.x -= curxoffset; visibleRect.y -= curyoffset; if (visibleRect.contains(overlayRect)) { return visibleRect; } curxoffset += comp.getX(); curyoffset += comp.getY(); comp = comp.getParent() instanceof JComponent ? (JComponent) comp.getParent() : null; } while (comp != null && !(comp instanceof JViewport) && !(comp instanceof JScrollPane)); return visibleRect; }
java
private Rectangle findLargestVisibleRectFor(final Rectangle overlayRect) { Rectangle visibleRect = null; int curxoffset = 0; int curyoffset = 0; if (overlayTarget == null) { return null; } JComponent comp = overlayTarget; do { visibleRect = comp.getVisibleRect(); visibleRect.x -= curxoffset; visibleRect.y -= curyoffset; if (visibleRect.contains(overlayRect)) { return visibleRect; } curxoffset += comp.getX(); curyoffset += comp.getY(); comp = comp.getParent() instanceof JComponent ? (JComponent) comp.getParent() : null; } while (comp != null && !(comp instanceof JViewport) && !(comp instanceof JScrollPane)); return visibleRect; }
[ "private", "Rectangle", "findLargestVisibleRectFor", "(", "final", "Rectangle", "overlayRect", ")", "{", "Rectangle", "visibleRect", "=", "null", ";", "int", "curxoffset", "=", "0", ";", "int", "curyoffset", "=", "0", ";", "if", "(", "overlayTarget", "==", "null", ")", "{", "return", "null", ";", "}", "JComponent", "comp", "=", "overlayTarget", ";", "do", "{", "visibleRect", "=", "comp", ".", "getVisibleRect", "(", ")", ";", "visibleRect", ".", "x", "-=", "curxoffset", ";", "visibleRect", ".", "y", "-=", "curyoffset", ";", "if", "(", "visibleRect", ".", "contains", "(", "overlayRect", ")", ")", "{", "return", "visibleRect", ";", "}", "curxoffset", "+=", "comp", ".", "getX", "(", ")", ";", "curyoffset", "+=", "comp", ".", "getY", "(", ")", ";", "comp", "=", "comp", ".", "getParent", "(", ")", "instanceof", "JComponent", "?", "(", "JComponent", ")", "comp", ".", "getParent", "(", ")", ":", "null", ";", "}", "while", "(", "comp", "!=", "null", "&&", "!", "(", "comp", "instanceof", "JViewport", ")", "&&", "!", "(", "comp", "instanceof", "JScrollPane", ")", ")", ";", "return", "visibleRect", ";", "}" ]
Searches up the component hierarchy to find the largest possible visible rect that can enclose the entire rectangle. @param overlayRect rectangle whose largest enclosing visible rect to find @return largest enclosing visible rect for the specified rectangle
[ "Searches", "up", "the", "component", "hierarchy", "to", "find", "the", "largest", "possible", "visible", "rect", "that", "can", "enclose", "the", "entire", "rectangle", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java#L282-L312
11,809
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java
DefaultDataEditorWidget.listWorkerDone
protected void listWorkerDone(List<Object> rows, Map<String, Object> parameters) { setRows(rows); // remove maximumRowsExceededMessages if needed validationResultsModel.removeMessage(maximumRowsExceededMessage); if ((rows == null) || (rows.size() == 0)) { return; } Object defaultSelectedObject = null; if (parameters.containsKey(PARAMETER_DEFAULT_SELECTED_OBJECT)) { defaultSelectedObject = parameters .get(PARAMETER_DEFAULT_SELECTED_OBJECT); } if (defaultSelectedObject == null) { getTableWidget().selectRowObject(0, null); } else { getTableWidget().selectRowObject(defaultSelectedObject, null); } }
java
protected void listWorkerDone(List<Object> rows, Map<String, Object> parameters) { setRows(rows); // remove maximumRowsExceededMessages if needed validationResultsModel.removeMessage(maximumRowsExceededMessage); if ((rows == null) || (rows.size() == 0)) { return; } Object defaultSelectedObject = null; if (parameters.containsKey(PARAMETER_DEFAULT_SELECTED_OBJECT)) { defaultSelectedObject = parameters .get(PARAMETER_DEFAULT_SELECTED_OBJECT); } if (defaultSelectedObject == null) { getTableWidget().selectRowObject(0, null); } else { getTableWidget().selectRowObject(defaultSelectedObject, null); } }
[ "protected", "void", "listWorkerDone", "(", "List", "<", "Object", ">", "rows", ",", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "setRows", "(", "rows", ")", ";", "// remove maximumRowsExceededMessages if needed", "validationResultsModel", ".", "removeMessage", "(", "maximumRowsExceededMessage", ")", ";", "if", "(", "(", "rows", "==", "null", ")", "||", "(", "rows", ".", "size", "(", ")", "==", "0", ")", ")", "{", "return", ";", "}", "Object", "defaultSelectedObject", "=", "null", ";", "if", "(", "parameters", ".", "containsKey", "(", "PARAMETER_DEFAULT_SELECTED_OBJECT", ")", ")", "{", "defaultSelectedObject", "=", "parameters", ".", "get", "(", "PARAMETER_DEFAULT_SELECTED_OBJECT", ")", ";", "}", "if", "(", "defaultSelectedObject", "==", "null", ")", "{", "getTableWidget", "(", ")", ".", "selectRowObject", "(", "0", ",", "null", ")", ";", "}", "else", "{", "getTableWidget", "(", ")", ".", "selectRowObject", "(", "defaultSelectedObject", ",", "null", ")", ";", "}", "}" ]
This method is called on the gui-thread when the worker ends. As default it will check for the PARAMETER_DEFAULT_SELECTED_OBJECT parameter in the map. @param rows fetched by the listWorker. @param parameters a map of parameters specific to this listWorker instance.
[ "This", "method", "is", "called", "on", "the", "gui", "-", "thread", "when", "the", "worker", "ends", ".", "As", "default", "it", "will", "check", "for", "the", "PARAMETER_DEFAULT_SELECTED_OBJECT", "parameter", "in", "the", "map", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L199-L219
11,810
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java
DefaultDataEditorWidget.createDetailWidget
@Override public Widget createDetailWidget() { return new AbstractWidget() { @Override public void onAboutToShow() { DefaultDataEditorWidget.this.onAboutToShow(); } @Override public void onAboutToHide() { DefaultDataEditorWidget.this.onAboutToHide(); } public JComponent getComponent() { return getDetailForm().getControl(); } @Override public List<? extends AbstractCommand> getCommands() { return Arrays.asList(getDetailForm().getCommitCommand()); } @Override public String getId() { return DefaultDataEditorWidget.this.getId() + "." + getDetailForm().getId(); } }; }
java
@Override public Widget createDetailWidget() { return new AbstractWidget() { @Override public void onAboutToShow() { DefaultDataEditorWidget.this.onAboutToShow(); } @Override public void onAboutToHide() { DefaultDataEditorWidget.this.onAboutToHide(); } public JComponent getComponent() { return getDetailForm().getControl(); } @Override public List<? extends AbstractCommand> getCommands() { return Arrays.asList(getDetailForm().getCommitCommand()); } @Override public String getId() { return DefaultDataEditorWidget.this.getId() + "." + getDetailForm().getId(); } }; }
[ "@", "Override", "public", "Widget", "createDetailWidget", "(", ")", "{", "return", "new", "AbstractWidget", "(", ")", "{", "@", "Override", "public", "void", "onAboutToShow", "(", ")", "{", "DefaultDataEditorWidget", ".", "this", ".", "onAboutToShow", "(", ")", ";", "}", "@", "Override", "public", "void", "onAboutToHide", "(", ")", "{", "DefaultDataEditorWidget", ".", "this", ".", "onAboutToHide", "(", ")", ";", "}", "public", "JComponent", "getComponent", "(", ")", "{", "return", "getDetailForm", "(", ")", ".", "getControl", "(", ")", ";", "}", "@", "Override", "public", "List", "<", "?", "extends", "AbstractCommand", ">", "getCommands", "(", ")", "{", "return", "Arrays", ".", "asList", "(", "getDetailForm", "(", ")", ".", "getCommitCommand", "(", ")", ")", ";", "}", "@", "Override", "public", "String", "getId", "(", ")", "{", "return", "DefaultDataEditorWidget", ".", "this", ".", "getId", "(", ")", "+", "\".\"", "+", "getDetailForm", "(", ")", ".", "getId", "(", ")", ";", "}", "}", ";", "}" ]
Returns only the detail form widget
[ "Returns", "only", "the", "detail", "form", "widget" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L289-L318
11,811
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java
DefaultDataEditorWidget.setDetailForm
protected void setDetailForm(AbstractForm detailForm) { if (this.detailForm != null) { validationResultsModel.remove(this.detailForm.getFormModel() .getValidationResults()); } this.detailForm = detailForm; if (this.detailForm != null) { validationResultsModel.add(this.detailForm.getFormModel() .getValidationResults()); } }
java
protected void setDetailForm(AbstractForm detailForm) { if (this.detailForm != null) { validationResultsModel.remove(this.detailForm.getFormModel() .getValidationResults()); } this.detailForm = detailForm; if (this.detailForm != null) { validationResultsModel.add(this.detailForm.getFormModel() .getValidationResults()); } }
[ "protected", "void", "setDetailForm", "(", "AbstractForm", "detailForm", ")", "{", "if", "(", "this", ".", "detailForm", "!=", "null", ")", "{", "validationResultsModel", ".", "remove", "(", "this", ".", "detailForm", ".", "getFormModel", "(", ")", ".", "getValidationResults", "(", ")", ")", ";", "}", "this", ".", "detailForm", "=", "detailForm", ";", "if", "(", "this", ".", "detailForm", "!=", "null", ")", "{", "validationResultsModel", ".", "add", "(", "this", ".", "detailForm", ".", "getFormModel", "(", ")", ".", "getValidationResults", "(", ")", ")", ";", "}", "}" ]
Set the form that will handle one detail item.
[ "Set", "the", "form", "that", "will", "handle", "one", "detail", "item", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L323-L335
11,812
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java
DefaultDataEditorWidget.setFilterForm
protected void setFilterForm(FilterForm filterForm) { if (this.filterForm != null) { validationResultsModel.remove(this.filterForm.getFormModel() .getValidationResults()); } this.filterForm = filterForm; if (this.filterForm != null) { validationResultsModel.add(filterForm.getFormModel() .getValidationResults()); } }
java
protected void setFilterForm(FilterForm filterForm) { if (this.filterForm != null) { validationResultsModel.remove(this.filterForm.getFormModel() .getValidationResults()); } this.filterForm = filterForm; if (this.filterForm != null) { validationResultsModel.add(filterForm.getFormModel() .getValidationResults()); } }
[ "protected", "void", "setFilterForm", "(", "FilterForm", "filterForm", ")", "{", "if", "(", "this", ".", "filterForm", "!=", "null", ")", "{", "validationResultsModel", ".", "remove", "(", "this", ".", "filterForm", ".", "getFormModel", "(", ")", ".", "getValidationResults", "(", ")", ")", ";", "}", "this", ".", "filterForm", "=", "filterForm", ";", "if", "(", "this", ".", "filterForm", "!=", "null", ")", "{", "validationResultsModel", ".", "add", "(", "filterForm", ".", "getFormModel", "(", ")", ".", "getValidationResults", "(", ")", ")", ";", "}", "}" ]
Set the form to use as filter. @see DataProvider#supportsFiltering()
[ "Set", "the", "form", "to", "use", "as", "filter", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L347-L359
11,813
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java
DefaultDataEditorWidget.setDataProvider
protected void setDataProvider(DataProvider provider) { if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig() .applicationSession() .removePropertyChangeListener(ApplicationSession.USER, this); } this.dataProvider = provider; if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig().applicationSession().addPropertyChangeListener( ApplicationSession.USER, this); } }
java
protected void setDataProvider(DataProvider provider) { if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig() .applicationSession() .removePropertyChangeListener(ApplicationSession.USER, this); } this.dataProvider = provider; if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig().applicationSession().addPropertyChangeListener( ApplicationSession.USER, this); } }
[ "protected", "void", "setDataProvider", "(", "DataProvider", "provider", ")", "{", "if", "(", "(", "this", ".", "dataProvider", "!=", "null", ")", "&&", "(", "this", ".", "dataProvider", ".", "getRefreshPolicy", "(", ")", "==", "DataProvider", ".", "RefreshPolicy", ".", "ON_USER_SWITCH", ")", ")", "{", "getApplicationConfig", "(", ")", ".", "applicationSession", "(", ")", ".", "removePropertyChangeListener", "(", "ApplicationSession", ".", "USER", ",", "this", ")", ";", "}", "this", ".", "dataProvider", "=", "provider", ";", "if", "(", "(", "this", ".", "dataProvider", "!=", "null", ")", "&&", "(", "this", ".", "dataProvider", ".", "getRefreshPolicy", "(", ")", "==", "DataProvider", ".", "RefreshPolicy", ".", "ON_USER_SWITCH", ")", ")", "{", "getApplicationConfig", "(", ")", ".", "applicationSession", "(", ")", ".", "addPropertyChangeListener", "(", "ApplicationSession", ".", "USER", ",", "this", ")", ";", "}", "}" ]
Set the provider to use for data manipulation.
[ "Set", "the", "provider", "to", "use", "for", "data", "manipulation", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L416-L431
11,814
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java
CommandGroupFactoryBean.createCommandGroup
protected CommandGroup createCommandGroup() { CommandGroup group; if (isExclusive()) { ExclusiveCommandGroup g = new ExclusiveCommandGroup(getGroupId(), getCommandRegistry()); g.setAllowsEmptySelection(isAllowsEmptySelection()); group = g; } else { group = new CommandGroup(getGroupId(), getCommandRegistry()); } // Apply our security controller id to the new group group.setSecurityControllerId(getSecurityControllerId()); initCommandGroupMembers(group); return group; }
java
protected CommandGroup createCommandGroup() { CommandGroup group; if (isExclusive()) { ExclusiveCommandGroup g = new ExclusiveCommandGroup(getGroupId(), getCommandRegistry()); g.setAllowsEmptySelection(isAllowsEmptySelection()); group = g; } else { group = new CommandGroup(getGroupId(), getCommandRegistry()); } // Apply our security controller id to the new group group.setSecurityControllerId(getSecurityControllerId()); initCommandGroupMembers(group); return group; }
[ "protected", "CommandGroup", "createCommandGroup", "(", ")", "{", "CommandGroup", "group", ";", "if", "(", "isExclusive", "(", ")", ")", "{", "ExclusiveCommandGroup", "g", "=", "new", "ExclusiveCommandGroup", "(", "getGroupId", "(", ")", ",", "getCommandRegistry", "(", ")", ")", ";", "g", ".", "setAllowsEmptySelection", "(", "isAllowsEmptySelection", "(", ")", ")", ";", "group", "=", "g", ";", "}", "else", "{", "group", "=", "new", "CommandGroup", "(", "getGroupId", "(", ")", ",", "getCommandRegistry", "(", ")", ")", ";", "}", "// Apply our security controller id to the new group", "group", ".", "setSecurityControllerId", "(", "getSecurityControllerId", "(", ")", ")", ";", "initCommandGroupMembers", "(", "group", ")", ";", "return", "group", ";", "}" ]
registry has not been provided.
[ "registry", "has", "not", "been", "provided", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java#L315-L331
11,815
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java
CommandGroupFactoryBean.initCommandGroupMembers
protected void initCommandGroupMembers(CommandGroup group) { for (int i = 0; i < members.length; i++) { Object o = members[i]; if (o instanceof AbstractCommand) { group.addInternal((AbstractCommand) o); configureIfNecessary((AbstractCommand) o); } else if (o instanceof Component) { group.addComponentInternal((Component) o); } else if (o instanceof String) { String str = (String) o; if (str.equalsIgnoreCase(SEPARATOR_MEMBER_CODE)) { group.addSeparatorInternal(); } else if (str.equalsIgnoreCase(GLUE_MEMBER_CODE)) { group.addGlueInternal(); } else if (str.startsWith(COMMAND_MEMBER_PREFIX)) { String commandId = str.substring(COMMAND_MEMBER_PREFIX.length()); if (!StringUtils.hasText(commandId)) { throw new InvalidGroupMemberEncodingException( "The group member encoding does not specify a command id", str); } addCommandMember(str.substring(COMMAND_MEMBER_PREFIX.length()), group); } else if (str.startsWith(GROUP_MEMBER_PREFIX)) { String commandId = str.substring(GROUP_MEMBER_PREFIX.length()); if (!StringUtils.hasText(commandId)) { throw new InvalidGroupMemberEncodingException( "The group member encoding does not specify a command id", str); } addCommandMember(commandId, group); } else { addCommandMember(str, group); } } } }
java
protected void initCommandGroupMembers(CommandGroup group) { for (int i = 0; i < members.length; i++) { Object o = members[i]; if (o instanceof AbstractCommand) { group.addInternal((AbstractCommand) o); configureIfNecessary((AbstractCommand) o); } else if (o instanceof Component) { group.addComponentInternal((Component) o); } else if (o instanceof String) { String str = (String) o; if (str.equalsIgnoreCase(SEPARATOR_MEMBER_CODE)) { group.addSeparatorInternal(); } else if (str.equalsIgnoreCase(GLUE_MEMBER_CODE)) { group.addGlueInternal(); } else if (str.startsWith(COMMAND_MEMBER_PREFIX)) { String commandId = str.substring(COMMAND_MEMBER_PREFIX.length()); if (!StringUtils.hasText(commandId)) { throw new InvalidGroupMemberEncodingException( "The group member encoding does not specify a command id", str); } addCommandMember(str.substring(COMMAND_MEMBER_PREFIX.length()), group); } else if (str.startsWith(GROUP_MEMBER_PREFIX)) { String commandId = str.substring(GROUP_MEMBER_PREFIX.length()); if (!StringUtils.hasText(commandId)) { throw new InvalidGroupMemberEncodingException( "The group member encoding does not specify a command id", str); } addCommandMember(commandId, group); } else { addCommandMember(str, group); } } } }
[ "protected", "void", "initCommandGroupMembers", "(", "CommandGroup", "group", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "length", ";", "i", "++", ")", "{", "Object", "o", "=", "members", "[", "i", "]", ";", "if", "(", "o", "instanceof", "AbstractCommand", ")", "{", "group", ".", "addInternal", "(", "(", "AbstractCommand", ")", "o", ")", ";", "configureIfNecessary", "(", "(", "AbstractCommand", ")", "o", ")", ";", "}", "else", "if", "(", "o", "instanceof", "Component", ")", "{", "group", ".", "addComponentInternal", "(", "(", "Component", ")", "o", ")", ";", "}", "else", "if", "(", "o", "instanceof", "String", ")", "{", "String", "str", "=", "(", "String", ")", "o", ";", "if", "(", "str", ".", "equalsIgnoreCase", "(", "SEPARATOR_MEMBER_CODE", ")", ")", "{", "group", ".", "addSeparatorInternal", "(", ")", ";", "}", "else", "if", "(", "str", ".", "equalsIgnoreCase", "(", "GLUE_MEMBER_CODE", ")", ")", "{", "group", ".", "addGlueInternal", "(", ")", ";", "}", "else", "if", "(", "str", ".", "startsWith", "(", "COMMAND_MEMBER_PREFIX", ")", ")", "{", "String", "commandId", "=", "str", ".", "substring", "(", "COMMAND_MEMBER_PREFIX", ".", "length", "(", ")", ")", ";", "if", "(", "!", "StringUtils", ".", "hasText", "(", "commandId", ")", ")", "{", "throw", "new", "InvalidGroupMemberEncodingException", "(", "\"The group member encoding does not specify a command id\"", ",", "str", ")", ";", "}", "addCommandMember", "(", "str", ".", "substring", "(", "COMMAND_MEMBER_PREFIX", ".", "length", "(", ")", ")", ",", "group", ")", ";", "}", "else", "if", "(", "str", ".", "startsWith", "(", "GROUP_MEMBER_PREFIX", ")", ")", "{", "String", "commandId", "=", "str", ".", "substring", "(", "GROUP_MEMBER_PREFIX", ".", "length", "(", ")", ")", ";", "if", "(", "!", "StringUtils", ".", "hasText", "(", "commandId", ")", ")", "{", "throw", "new", "InvalidGroupMemberEncodingException", "(", "\"The group member encoding does not specify a command id\"", ",", "str", ")", ";", "}", "addCommandMember", "(", "commandId", ",", "group", ")", ";", "}", "else", "{", "addCommandMember", "(", "str", ",", "group", ")", ";", "}", "}", "}", "}" ]
Iterates over the collection of encoded members and adds them to the given command group. @param group The group that is to contain the commands from the encoded members list. Must not be null. @throws InvalidGroupMemberEncodingException if a member prefix is provided without a command id.
[ "Iterates", "over", "the", "collection", "of", "encoded", "members", "and", "adds", "them", "to", "the", "given", "command", "group", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java#L343-L389
11,816
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java
CommandGroupFactoryBean.addCommandMember
private void addCommandMember(String commandId, CommandGroup group) { Assert.notNull(commandId, "commandId"); Assert.notNull(group, "group"); if (logger.isDebugEnabled()) { logger.debug("adding command group member with id [" + commandId + "] to group [" + group.getId() + "]"); } AbstractCommand command = null; if (getCommandRegistry() != null) { command = (AbstractCommand) getCommandRegistry().getCommand(commandId); if (command != null) { group.addInternal(command); } } if (command == null) { group.addLazyInternal(commandId); } }
java
private void addCommandMember(String commandId, CommandGroup group) { Assert.notNull(commandId, "commandId"); Assert.notNull(group, "group"); if (logger.isDebugEnabled()) { logger.debug("adding command group member with id [" + commandId + "] to group [" + group.getId() + "]"); } AbstractCommand command = null; if (getCommandRegistry() != null) { command = (AbstractCommand) getCommandRegistry().getCommand(commandId); if (command != null) { group.addInternal(command); } } if (command == null) { group.addLazyInternal(commandId); } }
[ "private", "void", "addCommandMember", "(", "String", "commandId", ",", "CommandGroup", "group", ")", "{", "Assert", ".", "notNull", "(", "commandId", ",", "\"commandId\"", ")", ";", "Assert", ".", "notNull", "(", "group", ",", "\"group\"", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"adding command group member with id [\"", "+", "commandId", "+", "\"] to group [\"", "+", "group", ".", "getId", "(", ")", "+", "\"]\"", ")", ";", "}", "AbstractCommand", "command", "=", "null", ";", "if", "(", "getCommandRegistry", "(", ")", "!=", "null", ")", "{", "command", "=", "(", "AbstractCommand", ")", "getCommandRegistry", "(", ")", ".", "getCommand", "(", "commandId", ")", ";", "if", "(", "command", "!=", "null", ")", "{", "group", ".", "addInternal", "(", "command", ")", ";", "}", "}", "if", "(", "command", "==", "null", ")", "{", "group", ".", "addLazyInternal", "(", "commandId", ")", ";", "}", "}" ]
Adds the command object with the given id to the given command group. If a command registry has not yet been provided to this factory, the command id will be passed as a 'lazy placeholder' to the group instead. @param commandId The id of the command to be added to the group. This is expected to be in decoded form, i.e. any command prefixes have been removed. Must not be null. @param group The group that the commands will be added to. Must not be null.
[ "Adds", "the", "command", "object", "with", "the", "given", "id", "to", "the", "given", "command", "group", ".", "If", "a", "command", "registry", "has", "not", "yet", "been", "provided", "to", "this", "factory", "the", "command", "id", "will", "be", "passed", "as", "a", "lazy", "placeholder", "to", "the", "group", "instead", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java#L403-L425
11,817
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JideApplicationPage.java
JideApplicationPage.updateShowViewCommands
public void updateShowViewCommands(){ ViewDescriptorRegistry viewDescriptorRegistry = ValkyrieRepository.getInstance().getApplicationConfig().viewDescriptorRegistry(); ViewDescriptor[] views = viewDescriptorRegistry.getViewDescriptors(); for (ViewDescriptor view : views) { String id = view.getId(); CommandManager commandManager = window.getCommandManager(); /*if(commandManager.containsActionCommand(id)){ ActionCommand command = commandManager.getActionCommand(id); command.setVisible(pageViews.contains(views[i].getId())); }*/ if (commandManager.isTypeMatch(id, ActionCommand.class)) { ActionCommand command = (ActionCommand) commandManager.getCommand(id, ActionCommand.class); command.setVisible(pageViews.contains(view.getId())); } } }
java
public void updateShowViewCommands(){ ViewDescriptorRegistry viewDescriptorRegistry = ValkyrieRepository.getInstance().getApplicationConfig().viewDescriptorRegistry(); ViewDescriptor[] views = viewDescriptorRegistry.getViewDescriptors(); for (ViewDescriptor view : views) { String id = view.getId(); CommandManager commandManager = window.getCommandManager(); /*if(commandManager.containsActionCommand(id)){ ActionCommand command = commandManager.getActionCommand(id); command.setVisible(pageViews.contains(views[i].getId())); }*/ if (commandManager.isTypeMatch(id, ActionCommand.class)) { ActionCommand command = (ActionCommand) commandManager.getCommand(id, ActionCommand.class); command.setVisible(pageViews.contains(view.getId())); } } }
[ "public", "void", "updateShowViewCommands", "(", ")", "{", "ViewDescriptorRegistry", "viewDescriptorRegistry", "=", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "viewDescriptorRegistry", "(", ")", ";", "ViewDescriptor", "[", "]", "views", "=", "viewDescriptorRegistry", ".", "getViewDescriptors", "(", ")", ";", "for", "(", "ViewDescriptor", "view", ":", "views", ")", "{", "String", "id", "=", "view", ".", "getId", "(", ")", ";", "CommandManager", "commandManager", "=", "window", ".", "getCommandManager", "(", ")", ";", "/*if(commandManager.containsActionCommand(id)){\n\t \t\tActionCommand command =\n\t \t\t\tcommandManager.getActionCommand(id);\n\t \t\tcommand.setVisible(pageViews.contains(views[i].getId()));\n \t\t}*/", "if", "(", "commandManager", ".", "isTypeMatch", "(", "id", ",", "ActionCommand", ".", "class", ")", ")", "{", "ActionCommand", "command", "=", "(", "ActionCommand", ")", "commandManager", ".", "getCommand", "(", "id", ",", "ActionCommand", ".", "class", ")", ";", "command", ".", "setVisible", "(", "pageViews", ".", "contains", "(", "view", ".", "getId", "(", ")", ")", ")", ";", "}", "}", "}" ]
This sets the visible flag on all show view commands that are registered with the command manager. If the page contains the view the command is visible, otherwise not. The registration of the show view command with the command manager is the responsibility of the view descriptor.
[ "This", "sets", "the", "visible", "flag", "on", "all", "show", "view", "commands", "that", "are", "registered", "with", "the", "command", "manager", ".", "If", "the", "page", "contains", "the", "view", "the", "command", "is", "visible", "otherwise", "not", ".", "The", "registration", "of", "the", "show", "view", "command", "with", "the", "command", "manager", "is", "the", "responsibility", "of", "the", "view", "descriptor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JideApplicationPage.java#L143-L161
11,818
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JideApplicationPage.java
JideApplicationPage.openEditor
public void openEditor(Object editorInput, boolean activateAfterOpen){ if(log.isDebugEnabled()){ log.debug("Attempting to open editor for "+editorInput.getClass().getName()); } if(workspaceComponent == null){ log.debug("WorkspaceComponent is null"); return; } PageDescriptor descriptor = getPageDescriptor(); if(descriptor instanceof JidePageDescriptor){ if(editorInput.getClass().isArray()){ Object[] array = (Object[])editorInput; for (Object editorObject : array) { processEditorObject(editorObject, activateAfterOpen); } } else{ processEditorObject(editorInput, activateAfterOpen); } } }
java
public void openEditor(Object editorInput, boolean activateAfterOpen){ if(log.isDebugEnabled()){ log.debug("Attempting to open editor for "+editorInput.getClass().getName()); } if(workspaceComponent == null){ log.debug("WorkspaceComponent is null"); return; } PageDescriptor descriptor = getPageDescriptor(); if(descriptor instanceof JidePageDescriptor){ if(editorInput.getClass().isArray()){ Object[] array = (Object[])editorInput; for (Object editorObject : array) { processEditorObject(editorObject, activateAfterOpen); } } else{ processEditorObject(editorInput, activateAfterOpen); } } }
[ "public", "void", "openEditor", "(", "Object", "editorInput", ",", "boolean", "activateAfterOpen", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Attempting to open editor for \"", "+", "editorInput", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "workspaceComponent", "==", "null", ")", "{", "log", ".", "debug", "(", "\"WorkspaceComponent is null\"", ")", ";", "return", ";", "}", "PageDescriptor", "descriptor", "=", "getPageDescriptor", "(", ")", ";", "if", "(", "descriptor", "instanceof", "JidePageDescriptor", ")", "{", "if", "(", "editorInput", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "Object", "[", "]", "array", "=", "(", "Object", "[", "]", ")", "editorInput", ";", "for", "(", "Object", "editorObject", ":", "array", ")", "{", "processEditorObject", "(", "editorObject", ",", "activateAfterOpen", ")", ";", "}", "}", "else", "{", "processEditorObject", "(", "editorInput", ",", "activateAfterOpen", ")", ";", "}", "}", "}" ]
Implementation of the openEditor command using the editor factory injected into the page descriptor. The editor input is used as the key the factory uses to get the requires editor descriptor. If not editor factory is injected into the page descriptor then the default factory is used which simply returns null for every editor object resulting in no editor being opened. @param editorInput the editor contents @param activateAfterOpen specifies if the document should be activated after opening
[ "Implementation", "of", "the", "openEditor", "command", "using", "the", "editor", "factory", "injected", "into", "the", "page", "descriptor", ".", "The", "editor", "input", "is", "used", "as", "the", "key", "the", "factory", "uses", "to", "get", "the", "requires", "editor", "descriptor", ".", "If", "not", "editor", "factory", "is", "injected", "into", "the", "page", "descriptor", "then", "the", "default", "factory", "is", "used", "which", "simply", "returns", "null", "for", "every", "editor", "object", "resulting", "in", "no", "editor", "being", "opened", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JideApplicationPage.java#L206-L227
11,819
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/NestedWriter.java
NestedWriter.setValue
public void setValue(Object toEntity, Object newValue) throws IllegalAccessException, InvocationTargetException { Object propertyValue = getter.invoke(toEntity); if (propertyValue != null) nestedWriter.setValue(propertyValue, newValue); }
java
public void setValue(Object toEntity, Object newValue) throws IllegalAccessException, InvocationTargetException { Object propertyValue = getter.invoke(toEntity); if (propertyValue != null) nestedWriter.setValue(propertyValue, newValue); }
[ "public", "void", "setValue", "(", "Object", "toEntity", ",", "Object", "newValue", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "Object", "propertyValue", "=", "getter", ".", "invoke", "(", "toEntity", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "nestedWriter", ".", "setValue", "(", "propertyValue", ",", "newValue", ")", ";", "}" ]
Set the value on the source entity. If at any point the chaining results in a null value. The chaining should end. @param toEntity the entity on which the getter should operate. @param newValue the value to set.
[ "Set", "the", "value", "on", "the", "source", "entity", ".", "If", "at", "any", "point", "the", "chaining", "results", "in", "a", "null", "value", ".", "The", "chaining", "should", "end", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/NestedWriter.java#L77-L83
11,820
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-dockingframes-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/ContactView.java
ContactView.createControl
protected JComponent createControl() { PropertyColumnTableDescription desc = new PropertyColumnTableDescription("contactViewTable", Contact.class); desc.addPropertyColumn("lastName").withMinWidth(150); desc.addPropertyColumn("firstName").withMinWidth(150); desc.addPropertyColumn("address.address1"); desc.addPropertyColumn("address.city"); desc.addPropertyColumn("address.state"); desc.addPropertyColumn("address.zip"); widget = new GlazedListTableWidget(Arrays.asList(contactDataStore.getAllContacts()), desc); JPanel table = new JPanel(new BorderLayout()); table.add(widget.getListSummaryLabel(), BorderLayout.NORTH); table.add(widget.getComponent(), BorderLayout.CENTER); table.add(widget.getButtonBar(), BorderLayout.SOUTH); CommandGroup popup = new CommandGroup(); popup.add((ActionCommand) getWindowCommandManager().getCommand("deleteCommand", ActionCommand.class)); popup.addSeparator(); popup.add((ActionCommand) getWindowCommandManager().getCommand("propertiesCommand", ActionCommand.class)); JPopupMenu popupMenu = popup.createPopupMenu(); widget.getTable().addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { // If the user right clicks on a row other than the selection, // then move the selection to the current row if (e.getButton() == MouseEvent.BUTTON3) { int rowUnderMouse = widget.getTable().rowAtPoint(e.getPoint()); if (rowUnderMouse != -1 && !widget.getTable().isRowSelected(rowUnderMouse)) { // Select the row under the mouse widget.getTable().getSelectionModel().setSelectionInterval(rowUnderMouse, rowUnderMouse); } } } @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { if (propertiesExecutor.isEnabled()) propertiesExecutor.execute(); } } }); widget.getTable().addMouseListener(new PopupMenuMouseListener(popupMenu)); ValueModel selectionHolder = new ListSelectionValueModelAdapter(widget.getTable().getSelectionModel()); new ListSingleSelectionGuard(selectionHolder, deleteExecutor); new ListSingleSelectionGuard(selectionHolder, propertiesExecutor); JPanel view = new JPanel(new BorderLayout()); view.add(widget.getTextFilterField(), BorderLayout.NORTH); view.add(table, BorderLayout.CENTER); return view; //"lastName", "firstName", "address.address1", "address.city", "address.state", "address.zip" // JPanel filterPanel = new JPanel(new BorderLayout()); // JLabel filterLabel = getComponentFactory().createLabel("nameAddressFilter.label"); // filterPanel.add(filterLabel, BorderLayout.WEST); // // String tip = getMessage("nameAddressFilter.caption"); // filterField = getComponentFactory().createTextField(); // filterField.setToolTipText(tip); // filterPanel.add(filterField, BorderLayout.CENTER); // filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // // contactTable = new ContactTableFactory().createContactTable(); // // JPanel view = new JPanel(new BorderLayout()); // JScrollPane sp = getComponentFactory().createScrollPane(contactTable.getControl()); // view.add(filterPanel, BorderLayout.NORTH); // view.add(sp, BorderLayout.CENTER); // return view; }
java
protected JComponent createControl() { PropertyColumnTableDescription desc = new PropertyColumnTableDescription("contactViewTable", Contact.class); desc.addPropertyColumn("lastName").withMinWidth(150); desc.addPropertyColumn("firstName").withMinWidth(150); desc.addPropertyColumn("address.address1"); desc.addPropertyColumn("address.city"); desc.addPropertyColumn("address.state"); desc.addPropertyColumn("address.zip"); widget = new GlazedListTableWidget(Arrays.asList(contactDataStore.getAllContacts()), desc); JPanel table = new JPanel(new BorderLayout()); table.add(widget.getListSummaryLabel(), BorderLayout.NORTH); table.add(widget.getComponent(), BorderLayout.CENTER); table.add(widget.getButtonBar(), BorderLayout.SOUTH); CommandGroup popup = new CommandGroup(); popup.add((ActionCommand) getWindowCommandManager().getCommand("deleteCommand", ActionCommand.class)); popup.addSeparator(); popup.add((ActionCommand) getWindowCommandManager().getCommand("propertiesCommand", ActionCommand.class)); JPopupMenu popupMenu = popup.createPopupMenu(); widget.getTable().addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { // If the user right clicks on a row other than the selection, // then move the selection to the current row if (e.getButton() == MouseEvent.BUTTON3) { int rowUnderMouse = widget.getTable().rowAtPoint(e.getPoint()); if (rowUnderMouse != -1 && !widget.getTable().isRowSelected(rowUnderMouse)) { // Select the row under the mouse widget.getTable().getSelectionModel().setSelectionInterval(rowUnderMouse, rowUnderMouse); } } } @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { if (propertiesExecutor.isEnabled()) propertiesExecutor.execute(); } } }); widget.getTable().addMouseListener(new PopupMenuMouseListener(popupMenu)); ValueModel selectionHolder = new ListSelectionValueModelAdapter(widget.getTable().getSelectionModel()); new ListSingleSelectionGuard(selectionHolder, deleteExecutor); new ListSingleSelectionGuard(selectionHolder, propertiesExecutor); JPanel view = new JPanel(new BorderLayout()); view.add(widget.getTextFilterField(), BorderLayout.NORTH); view.add(table, BorderLayout.CENTER); return view; //"lastName", "firstName", "address.address1", "address.city", "address.state", "address.zip" // JPanel filterPanel = new JPanel(new BorderLayout()); // JLabel filterLabel = getComponentFactory().createLabel("nameAddressFilter.label"); // filterPanel.add(filterLabel, BorderLayout.WEST); // // String tip = getMessage("nameAddressFilter.caption"); // filterField = getComponentFactory().createTextField(); // filterField.setToolTipText(tip); // filterPanel.add(filterField, BorderLayout.CENTER); // filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // // contactTable = new ContactTableFactory().createContactTable(); // // JPanel view = new JPanel(new BorderLayout()); // JScrollPane sp = getComponentFactory().createScrollPane(contactTable.getControl()); // view.add(filterPanel, BorderLayout.NORTH); // view.add(sp, BorderLayout.CENTER); // return view; }
[ "protected", "JComponent", "createControl", "(", ")", "{", "PropertyColumnTableDescription", "desc", "=", "new", "PropertyColumnTableDescription", "(", "\"contactViewTable\"", ",", "Contact", ".", "class", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"lastName\"", ")", ".", "withMinWidth", "(", "150", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"firstName\"", ")", ".", "withMinWidth", "(", "150", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"address.address1\"", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"address.city\"", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"address.state\"", ")", ";", "desc", ".", "addPropertyColumn", "(", "\"address.zip\"", ")", ";", "widget", "=", "new", "GlazedListTableWidget", "(", "Arrays", ".", "asList", "(", "contactDataStore", ".", "getAllContacts", "(", ")", ")", ",", "desc", ")", ";", "JPanel", "table", "=", "new", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "table", ".", "add", "(", "widget", ".", "getListSummaryLabel", "(", ")", ",", "BorderLayout", ".", "NORTH", ")", ";", "table", ".", "add", "(", "widget", ".", "getComponent", "(", ")", ",", "BorderLayout", ".", "CENTER", ")", ";", "table", ".", "add", "(", "widget", ".", "getButtonBar", "(", ")", ",", "BorderLayout", ".", "SOUTH", ")", ";", "CommandGroup", "popup", "=", "new", "CommandGroup", "(", ")", ";", "popup", ".", "add", "(", "(", "ActionCommand", ")", "getWindowCommandManager", "(", ")", ".", "getCommand", "(", "\"deleteCommand\"", ",", "ActionCommand", ".", "class", ")", ")", ";", "popup", ".", "addSeparator", "(", ")", ";", "popup", ".", "add", "(", "(", "ActionCommand", ")", "getWindowCommandManager", "(", ")", ".", "getCommand", "(", "\"propertiesCommand\"", ",", "ActionCommand", ".", "class", ")", ")", ";", "JPopupMenu", "popupMenu", "=", "popup", ".", "createPopupMenu", "(", ")", ";", "widget", ".", "getTable", "(", ")", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "public", "void", "mousePressed", "(", "MouseEvent", "e", ")", "{", "// If the user right clicks on a row other than the selection,", "// then move the selection to the current row", "if", "(", "e", ".", "getButton", "(", ")", "==", "MouseEvent", ".", "BUTTON3", ")", "{", "int", "rowUnderMouse", "=", "widget", ".", "getTable", "(", ")", ".", "rowAtPoint", "(", "e", ".", "getPoint", "(", ")", ")", ";", "if", "(", "rowUnderMouse", "!=", "-", "1", "&&", "!", "widget", ".", "getTable", "(", ")", ".", "isRowSelected", "(", "rowUnderMouse", ")", ")", "{", "// Select the row under the mouse", "widget", ".", "getTable", "(", ")", ".", "getSelectionModel", "(", ")", ".", "setSelectionInterval", "(", "rowUnderMouse", ",", "rowUnderMouse", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "mouseClicked", "(", "MouseEvent", "e", ")", "{", "if", "(", "e", ".", "getClickCount", "(", ")", ">=", "2", ")", "{", "if", "(", "propertiesExecutor", ".", "isEnabled", "(", ")", ")", "propertiesExecutor", ".", "execute", "(", ")", ";", "}", "}", "}", ")", ";", "widget", ".", "getTable", "(", ")", ".", "addMouseListener", "(", "new", "PopupMenuMouseListener", "(", "popupMenu", ")", ")", ";", "ValueModel", "selectionHolder", "=", "new", "ListSelectionValueModelAdapter", "(", "widget", ".", "getTable", "(", ")", ".", "getSelectionModel", "(", ")", ")", ";", "new", "ListSingleSelectionGuard", "(", "selectionHolder", ",", "deleteExecutor", ")", ";", "new", "ListSingleSelectionGuard", "(", "selectionHolder", ",", "propertiesExecutor", ")", ";", "JPanel", "view", "=", "new", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "view", ".", "add", "(", "widget", ".", "getTextFilterField", "(", ")", ",", "BorderLayout", ".", "NORTH", ")", ";", "view", ".", "add", "(", "table", ",", "BorderLayout", ".", "CENTER", ")", ";", "return", "view", ";", "//\"lastName\", \"firstName\", \"address.address1\", \"address.city\", \"address.state\", \"address.zip\"", "//\t\tJPanel filterPanel = new JPanel(new BorderLayout());", "//\t\tJLabel filterLabel = getComponentFactory().createLabel(\"nameAddressFilter.label\");", "//\t\tfilterPanel.add(filterLabel, BorderLayout.WEST);", "//", "//\t\tString tip = getMessage(\"nameAddressFilter.caption\");", "//\t\tfilterField = getComponentFactory().createTextField();", "//\t\tfilterField.setToolTipText(tip);", "//\t\tfilterPanel.add(filterField, BorderLayout.CENTER);", "//\t\tfilterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));", "//", "//\t\tcontactTable = new ContactTableFactory().createContactTable();", "//", "//\t\tJPanel view = new JPanel(new BorderLayout());", "//\t\tJScrollPane sp = getComponentFactory().createScrollPane(contactTable.getControl());", "//\t\tview.add(filterPanel, BorderLayout.NORTH);", "//\t\tview.add(sp, BorderLayout.CENTER);", "//\t\treturn view;", "}" ]
Create the control for this view. This method is called by the platform in order to obtain the control to add to the surrounding window and page. @return component holding this view
[ "Create", "the", "control", "for", "this", "view", ".", "This", "method", "is", "called", "by", "the", "platform", "in", "order", "to", "obtain", "the", "control", "to", "add", "to", "the", "surrounding", "window", "and", "page", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-dockingframes-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/ContactView.java#L119-L199
11,821
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-dockingframes-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/ContactView.java
ContactView.registerLocalCommandExecutors
protected void registerLocalCommandExecutors(PageComponentContext context) { context.register("newContactCommand", newContactExecutor); context.register(GlobalCommandIds.PROPERTIES, propertiesExecutor); getApplicationConfig().securityControllerManager().addSecuredObject(propertiesExecutor); context.register(GlobalCommandIds.DELETE, deleteExecutor); getApplicationConfig().securityControllerManager().addSecuredObject(deleteExecutor); }
java
protected void registerLocalCommandExecutors(PageComponentContext context) { context.register("newContactCommand", newContactExecutor); context.register(GlobalCommandIds.PROPERTIES, propertiesExecutor); getApplicationConfig().securityControllerManager().addSecuredObject(propertiesExecutor); context.register(GlobalCommandIds.DELETE, deleteExecutor); getApplicationConfig().securityControllerManager().addSecuredObject(deleteExecutor); }
[ "protected", "void", "registerLocalCommandExecutors", "(", "PageComponentContext", "context", ")", "{", "context", ".", "register", "(", "\"newContactCommand\"", ",", "newContactExecutor", ")", ";", "context", ".", "register", "(", "GlobalCommandIds", ".", "PROPERTIES", ",", "propertiesExecutor", ")", ";", "getApplicationConfig", "(", ")", ".", "securityControllerManager", "(", ")", ".", "addSecuredObject", "(", "propertiesExecutor", ")", ";", "context", ".", "register", "(", "GlobalCommandIds", ".", "DELETE", ",", "deleteExecutor", ")", ";", "getApplicationConfig", "(", ")", ".", "securityControllerManager", "(", ")", ".", "addSecuredObject", "(", "deleteExecutor", ")", ";", "}" ]
Register the local command executors to be associated with named commands. This is called by the platform prior to making the view visible.
[ "Register", "the", "local", "command", "executors", "to", "be", "associated", "with", "named", "commands", ".", "This", "is", "called", "by", "the", "platform", "prior", "to", "making", "the", "view", "visible", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-dockingframes-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/ContactView.java#L205-L212
11,822
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/DefaultEditorRegistry.java
DefaultEditorRegistry.getEditorDescriptor
public EditorDescriptor getEditorDescriptor(Object editorObject) { Class editorClass = editorObject.getClass(); EditorDescriptor descriptor = (EditorDescriptor)editorMap.get(editorClass); if(descriptor == null){ Iterator it = editorMap.keySet().iterator(); while(it.hasNext()){ Class klass = (Class)it.next(); if(klass.isAssignableFrom(editorClass)){ descriptor = (EditorDescriptor)editorMap.get(klass); } } } return descriptor; }
java
public EditorDescriptor getEditorDescriptor(Object editorObject) { Class editorClass = editorObject.getClass(); EditorDescriptor descriptor = (EditorDescriptor)editorMap.get(editorClass); if(descriptor == null){ Iterator it = editorMap.keySet().iterator(); while(it.hasNext()){ Class klass = (Class)it.next(); if(klass.isAssignableFrom(editorClass)){ descriptor = (EditorDescriptor)editorMap.get(klass); } } } return descriptor; }
[ "public", "EditorDescriptor", "getEditorDescriptor", "(", "Object", "editorObject", ")", "{", "Class", "editorClass", "=", "editorObject", ".", "getClass", "(", ")", ";", "EditorDescriptor", "descriptor", "=", "(", "EditorDescriptor", ")", "editorMap", ".", "get", "(", "editorClass", ")", ";", "if", "(", "descriptor", "==", "null", ")", "{", "Iterator", "it", "=", "editorMap", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Class", "klass", "=", "(", "Class", ")", "it", ".", "next", "(", ")", ";", "if", "(", "klass", ".", "isAssignableFrom", "(", "editorClass", ")", ")", "{", "descriptor", "=", "(", "EditorDescriptor", ")", "editorMap", ".", "get", "(", "klass", ")", ";", "}", "}", "}", "return", "descriptor", ";", "}" ]
Returns an EditorDescriptor keyed by the class of the injected object. If non exists null is returned.
[ "Returns", "an", "EditorDescriptor", "keyed", "by", "the", "class", "of", "the", "injected", "object", ".", "If", "non", "exists", "null", "is", "returned", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/DefaultEditorRegistry.java#L42-L55
11,823
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/format/support/DateFormatter.java
DateFormatter.doParseValue
protected Object doParseValue(String formattedString, Class targetClass) throws ParseException { return dateFormat.parse(formattedString); }
java
protected Object doParseValue(String formattedString, Class targetClass) throws ParseException { return dateFormat.parse(formattedString); }
[ "protected", "Object", "doParseValue", "(", "String", "formattedString", ",", "Class", "targetClass", ")", "throws", "ParseException", "{", "return", "dateFormat", ".", "parse", "(", "formattedString", ")", ";", "}" ]
convert back from string to date
[ "convert", "back", "from", "string", "to", "date" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/format/support/DateFormatter.java#L57-L59
11,824
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/AbstractApplicationPage.java
AbstractApplicationPage.createPageComponent
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) { PageComponent pageComponent = descriptor.createPageComponent(); pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent))); if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) { getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent); } return pageComponent; }
java
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) { PageComponent pageComponent = descriptor.createPageComponent(); pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent))); if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) { getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent); } return pageComponent; }
[ "protected", "PageComponent", "createPageComponent", "(", "PageComponentDescriptor", "descriptor", ")", "{", "PageComponent", "pageComponent", "=", "descriptor", ".", "createPageComponent", "(", ")", ";", "pageComponent", ".", "setContext", "(", "new", "DefaultViewContext", "(", "this", ",", "createPageComponentPane", "(", "pageComponent", ")", ")", ")", ";", "if", "(", "pageComponent", "instanceof", "ApplicationListener", "&&", "getApplicationEventMulticaster", "(", ")", "!=", "null", ")", "{", "getApplicationEventMulticaster", "(", ")", ".", "addApplicationListener", "(", "(", "ApplicationListener", ")", "pageComponent", ")", ";", "}", "return", "pageComponent", ";", "}" ]
Creates a PageComponent for the given PageComponentDescriptor. @param descriptor the descriptor @return the created PageComponent
[ "Creates", "a", "PageComponent", "for", "the", "given", "PageComponentDescriptor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/AbstractApplicationPage.java#L363-L371
11,825
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/PatchedJFormattedTextField.java
PatchedJFormattedTextField.processKeyBinding
public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0) || ks == KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)) { return false; } return super.processKeyBinding(ks, e, condition, pressed); }
java
public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0) || ks == KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)) { return false; } return super.processKeyBinding(ks, e, condition, pressed); }
[ "public", "boolean", "processKeyBinding", "(", "KeyStroke", "ks", ",", "KeyEvent", "e", ",", "int", "condition", ",", "boolean", "pressed", ")", "{", "if", "(", "ks", "==", "KeyStroke", ".", "getKeyStroke", "(", "KeyEvent", ".", "VK_ENTER", ",", "0", ")", "||", "ks", "==", "KeyStroke", ".", "getKeyStroke", "(", "KeyEvent", ".", "VK_ESCAPE", ",", "0", ")", ")", "{", "return", "false", ";", "}", "return", "super", ".", "processKeyBinding", "(", "ks", ",", "e", ",", "condition", ",", "pressed", ")", ";", "}" ]
Overiding this method prevents the TextField from intercepting the Enter Key when focus is not on it. This allows default buttons to function. This should be removed when Swing fixes their bug. @see javax.swing.JComponent#processKeyBinding(javax.swing.KeyStroke, java.awt.event.KeyEvent, int, boolean)
[ "Overiding", "this", "method", "prevents", "the", "TextField", "from", "intercepting", "the", "Enter", "Key", "when", "focus", "is", "not", "on", "it", ".", "This", "allows", "default", "buttons", "to", "function", ".", "This", "should", "be", "removed", "when", "Swing", "fixes", "their", "bug", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/PatchedJFormattedTextField.java#L80-L85
11,826
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ComponentGroupMember.java
ComponentGroupMember.managesCommand
private boolean managesCommand(Component component, String commandId) { if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; if (null != button.getActionCommand()) { if (button.getActionCommand().equals(commandId)) { return true; } } } else if (component instanceof Container) { Component[] subComponents = ((Container) component).getComponents(); for (int i = 0; i < subComponents.length; ++i) { if (managesCommand(subComponents[i], commandId)) { return true; } } } return false; }
java
private boolean managesCommand(Component component, String commandId) { if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; if (null != button.getActionCommand()) { if (button.getActionCommand().equals(commandId)) { return true; } } } else if (component instanceof Container) { Component[] subComponents = ((Container) component).getComponents(); for (int i = 0; i < subComponents.length; ++i) { if (managesCommand(subComponents[i], commandId)) { return true; } } } return false; }
[ "private", "boolean", "managesCommand", "(", "Component", "component", ",", "String", "commandId", ")", "{", "if", "(", "component", "instanceof", "AbstractButton", ")", "{", "AbstractButton", "button", "=", "(", "AbstractButton", ")", "component", ";", "if", "(", "null", "!=", "button", ".", "getActionCommand", "(", ")", ")", "{", "if", "(", "button", ".", "getActionCommand", "(", ")", ".", "equals", "(", "commandId", ")", ")", "{", "return", "true", ";", "}", "}", "}", "else", "if", "(", "component", "instanceof", "Container", ")", "{", "Component", "[", "]", "subComponents", "=", "(", "(", "Container", ")", "component", ")", ".", "getComponents", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subComponents", ".", "length", ";", "++", "i", ")", "{", "if", "(", "managesCommand", "(", "subComponents", "[", "i", "]", ",", "commandId", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Searches through the component and nested components in order to see if the command with supplied id exists in this component. @param component The component that should be searched. @param commandId The id of the command to be checked for. @return true if the component, or any of its nested components, is a command with the given command id.
[ "Searches", "through", "the", "component", "and", "nested", "components", "in", "order", "to", "see", "if", "the", "command", "with", "supplied", "id", "exists", "in", "this", "component", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ComponentGroupMember.java#L78-L96
11,827
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ComponentGroupMember.java
ComponentGroupMember.fill
protected void fill(GroupContainerPopulator containerPopulator, Object controlFactory, CommandButtonConfigurer buttonConfigurer, java.util.List previousButtons) { Assert.notNull(containerPopulator, "containerPopulator"); containerPopulator.add(component); }
java
protected void fill(GroupContainerPopulator containerPopulator, Object controlFactory, CommandButtonConfigurer buttonConfigurer, java.util.List previousButtons) { Assert.notNull(containerPopulator, "containerPopulator"); containerPopulator.add(component); }
[ "protected", "void", "fill", "(", "GroupContainerPopulator", "containerPopulator", ",", "Object", "controlFactory", ",", "CommandButtonConfigurer", "buttonConfigurer", ",", "java", ".", "util", ".", "List", "previousButtons", ")", "{", "Assert", ".", "notNull", "(", "containerPopulator", ",", "\"containerPopulator\"", ")", ";", "containerPopulator", ".", "add", "(", "component", ")", ";", "}" ]
Asks the given container populator to add a component to its underlying container.
[ "Asks", "the", "given", "container", "populator", "to", "add", "a", "component", "to", "its", "underlying", "container", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ComponentGroupMember.java#L102-L106
11,828
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/SwingActionAdapter.java
SwingActionAdapter.update
protected void update() { putValue(Action.ACTION_COMMAND_KEY, command.getActionCommand()); CommandFaceDescriptor face = command.getFaceDescriptor(); if (face != null) { face.configure(this); } setEnabled(command.isEnabled()); }
java
protected void update() { putValue(Action.ACTION_COMMAND_KEY, command.getActionCommand()); CommandFaceDescriptor face = command.getFaceDescriptor(); if (face != null) { face.configure(this); } setEnabled(command.isEnabled()); }
[ "protected", "void", "update", "(", ")", "{", "putValue", "(", "Action", ".", "ACTION_COMMAND_KEY", ",", "command", ".", "getActionCommand", "(", ")", ")", ";", "CommandFaceDescriptor", "face", "=", "command", ".", "getFaceDescriptor", "(", ")", ";", "if", "(", "face", "!=", "null", ")", "{", "face", ".", "configure", "(", "this", ")", ";", "}", "setEnabled", "(", "command", ".", "isEnabled", "(", ")", ")", ";", "}" ]
Updates this instance according to the properties provided by the underlying command.
[ "Updates", "this", "instance", "according", "to", "the", "properties", "provided", "by", "the", "underlying", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/SwingActionAdapter.java#L82-L89
11,829
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/DefaultFilteredListModel.java
DefaultFilteredListModel.setConstraint
public final void setConstraint(Constraint constraint) { Assert.notNull(constraint); if (!constraint.equals(this.constraint)) { if (this.constraint instanceof Observable) { ((Observable) constraint).deleteObserver(this); } this.constraint = constraint; if (constraint instanceof Observable) { ((Observable) constraint).addObserver(this); } fireContentsChanged(this, -1, -1); } }
java
public final void setConstraint(Constraint constraint) { Assert.notNull(constraint); if (!constraint.equals(this.constraint)) { if (this.constraint instanceof Observable) { ((Observable) constraint).deleteObserver(this); } this.constraint = constraint; if (constraint instanceof Observable) { ((Observable) constraint).addObserver(this); } fireContentsChanged(this, -1, -1); } }
[ "public", "final", "void", "setConstraint", "(", "Constraint", "constraint", ")", "{", "Assert", ".", "notNull", "(", "constraint", ")", ";", "if", "(", "!", "constraint", ".", "equals", "(", "this", ".", "constraint", ")", ")", "{", "if", "(", "this", ".", "constraint", "instanceof", "Observable", ")", "{", "(", "(", "Observable", ")", "constraint", ")", ".", "deleteObserver", "(", "this", ")", ";", "}", "this", ".", "constraint", "=", "constraint", ";", "if", "(", "constraint", "instanceof", "Observable", ")", "{", "(", "(", "Observable", ")", "constraint", ")", ".", "addObserver", "(", "this", ")", ";", "}", "fireContentsChanged", "(", "this", ",", "-", "1", ",", "-", "1", ")", ";", "}", "}" ]
Defines the constraint which is applied to the list model elements @param constraint the constraint to set @throws IllegalArgumentException if constraint is null
[ "Defines", "the", "constraint", "which", "is", "applied", "to", "the", "list", "model", "elements" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/DefaultFilteredListModel.java#L71-L83
11,830
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/CustomizableFocusTraversalPolicy.java
CustomizableFocusTraversalPolicy.customizeFocusTraversalOrder
public static void customizeFocusTraversalOrder(JComponent container, java.util.List componentsInOrder) { for (Iterator i = componentsInOrder.iterator(); i.hasNext();) { Component comp = (Component)i.next(); if (comp.getParent() != container) { throw new IllegalArgumentException("Component [" + comp + "] is not a child of [" + container + "]."); } } container.putClientProperty(FOCUS_ORDER_PROPERTY_NAME, createOrderMapFromList(componentsInOrder)); }
java
public static void customizeFocusTraversalOrder(JComponent container, java.util.List componentsInOrder) { for (Iterator i = componentsInOrder.iterator(); i.hasNext();) { Component comp = (Component)i.next(); if (comp.getParent() != container) { throw new IllegalArgumentException("Component [" + comp + "] is not a child of [" + container + "]."); } } container.putClientProperty(FOCUS_ORDER_PROPERTY_NAME, createOrderMapFromList(componentsInOrder)); }
[ "public", "static", "void", "customizeFocusTraversalOrder", "(", "JComponent", "container", ",", "java", ".", "util", ".", "List", "componentsInOrder", ")", "{", "for", "(", "Iterator", "i", "=", "componentsInOrder", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Component", "comp", "=", "(", "Component", ")", "i", ".", "next", "(", ")", ";", "if", "(", "comp", ".", "getParent", "(", ")", "!=", "container", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Component [\"", "+", "comp", "+", "\"] is not a child of [\"", "+", "container", "+", "\"].\"", ")", ";", "}", "}", "container", ".", "putClientProperty", "(", "FOCUS_ORDER_PROPERTY_NAME", ",", "createOrderMapFromList", "(", "componentsInOrder", ")", ")", ";", "}" ]
Sets a custom focus traversal order for the given container. Child components for which there is no order specified will receive focus after components that do have an order specified in the standard "layout" order. @param container the container @param componentsInOrder a list of child components in the order that thay should receive focus
[ "Sets", "a", "custom", "focus", "traversal", "order", "for", "the", "given", "container", ".", "Child", "components", "for", "which", "there", "is", "no", "order", "specified", "will", "receive", "focus", "after", "components", "that", "do", "have", "an", "order", "specified", "in", "the", "standard", "layout", "order", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/CustomizableFocusTraversalPolicy.java#L53-L61
11,831
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/DefaultFormModel.java
DefaultFormModel.init
protected void init() { addPropertyChangeListener(ENABLED_PROPERTY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validatingUpdated(); } }); validationResultsModel.addPropertyChangeListener(ValidationResultsModel.HAS_ERRORS_PROPERTY, childStateChangeHandler); }
java
protected void init() { addPropertyChangeListener(ENABLED_PROPERTY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validatingUpdated(); } }); validationResultsModel.addPropertyChangeListener(ValidationResultsModel.HAS_ERRORS_PROPERTY, childStateChangeHandler); }
[ "protected", "void", "init", "(", ")", "{", "addPropertyChangeListener", "(", "ENABLED_PROPERTY", ",", "new", "PropertyChangeListener", "(", ")", "{", "public", "void", "propertyChange", "(", "PropertyChangeEvent", "evt", ")", "{", "validatingUpdated", "(", ")", ";", "}", "}", ")", ";", "validationResultsModel", ".", "addPropertyChangeListener", "(", "ValidationResultsModel", ".", "HAS_ERRORS_PROPERTY", ",", "childStateChangeHandler", ")", ";", "}" ]
Initialization of DefaultFormModel. Adds a listener on the Enabled property in order to switch validating state on or off. When disabling a formModel, no validation will happen.
[ "Initialization", "of", "DefaultFormModel", ".", "Adds", "a", "listener", "on", "the", "Enabled", "property", "in", "order", "to", "switch", "validating", "state", "on", "or", "off", ".", "When", "disabling", "a", "formModel", "no", "validation", "will", "happen", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/DefaultFormModel.java#L114-L124
11,832
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java
FormModelFactory.createChildPageFormModel
public ValidatingFormModel createChildPageFormModel(HierarchicalFormModel parentModel, String childPageName, String childFormObjectPropertyPath) { final ValueModel childValueModel = parentModel.getValueModel(childFormObjectPropertyPath); return createChildPageFormModel(parentModel, childPageName, childValueModel); }
java
public ValidatingFormModel createChildPageFormModel(HierarchicalFormModel parentModel, String childPageName, String childFormObjectPropertyPath) { final ValueModel childValueModel = parentModel.getValueModel(childFormObjectPropertyPath); return createChildPageFormModel(parentModel, childPageName, childValueModel); }
[ "public", "ValidatingFormModel", "createChildPageFormModel", "(", "HierarchicalFormModel", "parentModel", ",", "String", "childPageName", ",", "String", "childFormObjectPropertyPath", ")", "{", "final", "ValueModel", "childValueModel", "=", "parentModel", ".", "getValueModel", "(", "childFormObjectPropertyPath", ")", ";", "return", "createChildPageFormModel", "(", "parentModel", ",", "childPageName", ",", "childValueModel", ")", ";", "}" ]
Create a child form model nested by this form model identified by the provided name. The form object associated with the created child model is the value model at the specified parent property path. @param parentModel the model to create the FormModelFactory in @param childPageName the name to associate the created FormModelFactory with in the groupingModel @param childFormObjectPropertyPath the path into the groupingModel that the FormModelFactory is for @return The child form model
[ "Create", "a", "child", "form", "model", "nested", "by", "this", "form", "model", "identified", "by", "the", "provided", "name", ".", "The", "form", "object", "associated", "with", "the", "created", "child", "model", "is", "the", "value", "model", "at", "the", "specified", "parent", "property", "path", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java#L129-L133
11,833
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java
FormModelFactory.getChild
public FormModel getChild(HierarchicalFormModel formModel, String childPageName) { if (childPageName == null) throw new IllegalArgumentException("childPageName == null"); if (formModel == null) throw new IllegalArgumentException("formModel == null"); final FormModel[] children = formModel.getChildren(); if (children == null) return null; for (int i = 0; i < children.length; i++) { final FormModel child = children[i]; if (childPageName.equals(child.getId())) return child; } return null; }
java
public FormModel getChild(HierarchicalFormModel formModel, String childPageName) { if (childPageName == null) throw new IllegalArgumentException("childPageName == null"); if (formModel == null) throw new IllegalArgumentException("formModel == null"); final FormModel[] children = formModel.getChildren(); if (children == null) return null; for (int i = 0; i < children.length; i++) { final FormModel child = children[i]; if (childPageName.equals(child.getId())) return child; } return null; }
[ "public", "FormModel", "getChild", "(", "HierarchicalFormModel", "formModel", ",", "String", "childPageName", ")", "{", "if", "(", "childPageName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"childPageName == null\"", ")", ";", "if", "(", "formModel", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"formModel == null\"", ")", ";", "final", "FormModel", "[", "]", "children", "=", "formModel", ".", "getChildren", "(", ")", ";", "if", "(", "children", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "final", "FormModel", "child", "=", "children", "[", "i", "]", ";", "if", "(", "childPageName", ".", "equals", "(", "child", ".", "getId", "(", ")", ")", ")", "return", "child", ";", "}", "return", "null", ";", "}" ]
Returns the child of the formModel with the given page name. @param formModel the parent model to get the child from @param childPageName the name of the child to retrieve @return null the child can not be found @throws IllegalArgumentException if childPageName or formModel are null
[ "Returns", "the", "child", "of", "the", "formModel", "with", "the", "given", "page", "name", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java#L159-L173
11,834
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java
UserMetadata.setFieldProtected
public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) { FieldMetadata metaData = formModel.getFieldMetadata(fieldName); metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField)); }
java
public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) { FieldMetadata metaData = formModel.getFieldMetadata(fieldName); metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField)); }
[ "public", "static", "void", "setFieldProtected", "(", "FormModel", "formModel", ",", "String", "fieldName", ",", "boolean", "protectedField", ")", "{", "FieldMetadata", "metaData", "=", "formModel", ".", "getFieldMetadata", "(", "fieldName", ")", ";", "metaData", ".", "getAllUserMetadata", "(", ")", ".", "put", "(", "PROTECTED_FIELD", ",", "Boolean", ".", "valueOf", "(", "protectedField", ")", ")", ";", "}" ]
defines the protectable state for a field @param formModel the formmodel @param fieldName the field to protect @param protectedField if true the field will be defined as protectable otherwise false
[ "defines", "the", "protectable", "state", "for", "a", "field" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java#L56-L59
11,835
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/CompoundConstraint.java
CompoundConstraint.addAll
public CompoundConstraint addAll(List constraints) { Algorithms.instance().forEach(constraints, new Block() { protected void handle(Object o) { add((Constraint)o); } }); return this; }
java
public CompoundConstraint addAll(List constraints) { Algorithms.instance().forEach(constraints, new Block() { protected void handle(Object o) { add((Constraint)o); } }); return this; }
[ "public", "CompoundConstraint", "addAll", "(", "List", "constraints", ")", "{", "Algorithms", ".", "instance", "(", ")", ".", "forEach", "(", "constraints", ",", "new", "Block", "(", ")", "{", "protected", "void", "handle", "(", "Object", "o", ")", "{", "add", "(", "(", "Constraint", ")", "o", ")", ";", "}", "}", ")", ";", "return", "this", ";", "}" ]
Add the list of constraints to the set of constraints aggregated by this compound constraint. @param constraints the list of constraints to add @return A reference to this, to support chaining.
[ "Add", "the", "list", "of", "constraints", "to", "the", "set", "of", "constraints", "aggregated", "by", "this", "compound", "constraint", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/CompoundConstraint.java#L90-L97
11,836
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/AbstractLoggingExceptionHandler.java
AbstractLoggingExceptionHandler.processUncaughtException
private void processUncaughtException(Thread thread, Throwable throwable) { if (exceptionPurger != null) { throwable = exceptionPurger.purge(throwable); } logException(thread, throwable); notifyUserAboutException(thread, throwable); }
java
private void processUncaughtException(Thread thread, Throwable throwable) { if (exceptionPurger != null) { throwable = exceptionPurger.purge(throwable); } logException(thread, throwable); notifyUserAboutException(thread, throwable); }
[ "private", "void", "processUncaughtException", "(", "Thread", "thread", ",", "Throwable", "throwable", ")", "{", "if", "(", "exceptionPurger", "!=", "null", ")", "{", "throwable", "=", "exceptionPurger", ".", "purge", "(", "throwable", ")", ";", "}", "logException", "(", "thread", ",", "throwable", ")", ";", "notifyUserAboutException", "(", "thread", ",", "throwable", ")", ";", "}" ]
Logs an exception and shows it to the user.
[ "Logs", "an", "exception", "and", "shows", "it", "to", "the", "user", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/AbstractLoggingExceptionHandler.java#L125-L131
11,837
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/AbstractLoggingExceptionHandler.java
AbstractLoggingExceptionHandler.logException
public void logException(Thread thread, Throwable throwable) { String logMessage; String errorCode = extractErrorCode(throwable); if (errorCode != null) { logMessage = "Uncaught throwable handled with errorCode (" + errorCode + ")."; } else { logMessage = "Uncaught throwable handled."; } doLogException(logMessage, throwable); }
java
public void logException(Thread thread, Throwable throwable) { String logMessage; String errorCode = extractErrorCode(throwable); if (errorCode != null) { logMessage = "Uncaught throwable handled with errorCode (" + errorCode + ")."; } else { logMessage = "Uncaught throwable handled."; } doLogException(logMessage, throwable); }
[ "public", "void", "logException", "(", "Thread", "thread", ",", "Throwable", "throwable", ")", "{", "String", "logMessage", ";", "String", "errorCode", "=", "extractErrorCode", "(", "throwable", ")", ";", "if", "(", "errorCode", "!=", "null", ")", "{", "logMessage", "=", "\"Uncaught throwable handled with errorCode (\"", "+", "errorCode", "+", "\").\"", ";", "}", "else", "{", "logMessage", "=", "\"Uncaught throwable handled.\"", ";", "}", "doLogException", "(", "logMessage", ",", "throwable", ")", ";", "}" ]
Log an exception
[ "Log", "an", "exception" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/AbstractLoggingExceptionHandler.java#L146-L156
11,838
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java
TargetableActionCommand.setCommandExecutor
public void setCommandExecutor(ActionCommandExecutor commandExecutor) { if (ObjectUtils.nullSafeEquals(this.commandExecutor, commandExecutor)) { return; } if (commandExecutor == null) { detachCommandExecutor(); } else { if (this.commandExecutor instanceof GuardedActionCommandExecutor) { unsubscribeFromGuardedCommandDelegate(); } this.commandExecutor = commandExecutor; attachCommandExecutor(); } }
java
public void setCommandExecutor(ActionCommandExecutor commandExecutor) { if (ObjectUtils.nullSafeEquals(this.commandExecutor, commandExecutor)) { return; } if (commandExecutor == null) { detachCommandExecutor(); } else { if (this.commandExecutor instanceof GuardedActionCommandExecutor) { unsubscribeFromGuardedCommandDelegate(); } this.commandExecutor = commandExecutor; attachCommandExecutor(); } }
[ "public", "void", "setCommandExecutor", "(", "ActionCommandExecutor", "commandExecutor", ")", "{", "if", "(", "ObjectUtils", ".", "nullSafeEquals", "(", "this", ".", "commandExecutor", ",", "commandExecutor", ")", ")", "{", "return", ";", "}", "if", "(", "commandExecutor", "==", "null", ")", "{", "detachCommandExecutor", "(", ")", ";", "}", "else", "{", "if", "(", "this", ".", "commandExecutor", "instanceof", "GuardedActionCommandExecutor", ")", "{", "unsubscribeFromGuardedCommandDelegate", "(", ")", ";", "}", "this", ".", "commandExecutor", "=", "commandExecutor", ";", "attachCommandExecutor", "(", ")", ";", "}", "}" ]
Attaches the given executor to this command instance, detaching the current executor in the process. @param commandExecutor The executor to be attached. May be null, in which case this command will be disabled.
[ "Attaches", "the", "given", "executor", "to", "this", "command", "instance", "detaching", "the", "current", "executor", "in", "the", "process", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java#L77-L91
11,839
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java
TargetableActionCommand.detachCommandExecutor
public void detachCommandExecutor() { if (this.commandExecutor instanceof GuardedActionCommandExecutor) { unsubscribeFromGuardedCommandDelegate(); } this.commandExecutor = null; setEnabled(false); logger.debug("Command delegate detached."); }
java
public void detachCommandExecutor() { if (this.commandExecutor instanceof GuardedActionCommandExecutor) { unsubscribeFromGuardedCommandDelegate(); } this.commandExecutor = null; setEnabled(false); logger.debug("Command delegate detached."); }
[ "public", "void", "detachCommandExecutor", "(", ")", "{", "if", "(", "this", ".", "commandExecutor", "instanceof", "GuardedActionCommandExecutor", ")", "{", "unsubscribeFromGuardedCommandDelegate", "(", ")", ";", "}", "this", ".", "commandExecutor", "=", "null", ";", "setEnabled", "(", "false", ")", ";", "logger", ".", "debug", "(", "\"Command delegate detached.\"", ")", ";", "}" ]
Detaches the current executor from this command and sets the command to disabled state.
[ "Detaches", "the", "current", "executor", "from", "this", "command", "and", "sets", "the", "command", "to", "disabled", "state", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java#L124-L131
11,840
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java
TargetableActionCommand.doExecuteCommand
protected void doExecuteCommand() { if (this.commandExecutor instanceof ParameterizableActionCommandExecutor) { ((ParameterizableActionCommandExecutor) this.commandExecutor).execute(getParameters()); } else { if (this.commandExecutor != null) { this.commandExecutor.execute(); } } }
java
protected void doExecuteCommand() { if (this.commandExecutor instanceof ParameterizableActionCommandExecutor) { ((ParameterizableActionCommandExecutor) this.commandExecutor).execute(getParameters()); } else { if (this.commandExecutor != null) { this.commandExecutor.execute(); } } }
[ "protected", "void", "doExecuteCommand", "(", ")", "{", "if", "(", "this", ".", "commandExecutor", "instanceof", "ParameterizableActionCommandExecutor", ")", "{", "(", "(", "ParameterizableActionCommandExecutor", ")", "this", ".", "commandExecutor", ")", ".", "execute", "(", "getParameters", "(", ")", ")", ";", "}", "else", "{", "if", "(", "this", ".", "commandExecutor", "!=", "null", ")", "{", "this", ".", "commandExecutor", ".", "execute", "(", ")", ";", "}", "}", "}" ]
Executes this command by delegating to the currently assigned executor.
[ "Executes", "this", "command", "by", "delegating", "to", "the", "currently", "assigned", "executor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/TargetableActionCommand.java#L140-L149
11,841
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/SimpleValidationResultsReporter.java
SimpleValidationResultsReporter.validationResultsChanged
public void validationResultsChanged(ValidationResults results) { if (resultsModel.getMessageCount() == 0) { messageReceiver.setMessage(null); } else { ValidationMessage message = getValidationMessage(resultsModel); messageReceiver.setMessage(message); } }
java
public void validationResultsChanged(ValidationResults results) { if (resultsModel.getMessageCount() == 0) { messageReceiver.setMessage(null); } else { ValidationMessage message = getValidationMessage(resultsModel); messageReceiver.setMessage(message); } }
[ "public", "void", "validationResultsChanged", "(", "ValidationResults", "results", ")", "{", "if", "(", "resultsModel", ".", "getMessageCount", "(", ")", "==", "0", ")", "{", "messageReceiver", ".", "setMessage", "(", "null", ")", ";", "}", "else", "{", "ValidationMessage", "message", "=", "getValidationMessage", "(", "resultsModel", ")", ";", "messageReceiver", ".", "setMessage", "(", "message", ")", ";", "}", "}" ]
Handle a change in the validation results model. Update the message receiver based on our current results model state.
[ "Handle", "a", "change", "in", "the", "validation", "results", "model", ".", "Update", "the", "message", "receiver", "based", "on", "our", "current", "results", "model", "state", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/SimpleValidationResultsReporter.java#L76-L84
11,842
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginCommand.java
LoginCommand.doExecuteCommand
protected void doExecuteCommand() { if(!ValkyrieRepository.getInstance().getApplicationConfig().applicationSecurityManager().isSecuritySupported()) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage( "loginForm" ); final LoginForm loginForm = createLoginForm(); tabbedPage.addForm( loginForm ); if( getDefaultUserName() != null ) { loginForm.setUserName( getDefaultUserName() ); } dialog = new TitledPageApplicationDialog( tabbedPage ) { protected boolean onFinish() { loginForm.commit(); Authentication authentication = loginForm.getAuthentication(); // Hand this token to the security manager to actually attempt the login ApplicationSecurityManager sm = getApplicationConfig().applicationSecurityManager(); try { sm.doLogin( authentication ); postLogin(); return true; } finally { if( isClearPasswordOnFailure() ) { loginForm.setPassword(""); } loginForm.requestFocusInWindow(); } } protected void onCancel() { super.onCancel(); // Close the dialog // Now exit if configured if( isCloseOnCancel() ) { ApplicationSecurityManager sm = getApplicationConfig().applicationSecurityManager(); Authentication authentication = sm.getAuthentication(); if( authentication == null ) { LoginCommand.this.logger.info( "User canceled login; close the application." ); getApplicationConfig().application().close(); } } } protected ActionCommand getCallingCommand() { return LoginCommand.this; } protected void onAboutToShow() { loginForm.requestFocusInWindow(); } }; dialog.setDisplayFinishSuccessMessage( displaySuccessMessage ); dialog.showDialog(); }
java
protected void doExecuteCommand() { if(!ValkyrieRepository.getInstance().getApplicationConfig().applicationSecurityManager().isSecuritySupported()) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage( "loginForm" ); final LoginForm loginForm = createLoginForm(); tabbedPage.addForm( loginForm ); if( getDefaultUserName() != null ) { loginForm.setUserName( getDefaultUserName() ); } dialog = new TitledPageApplicationDialog( tabbedPage ) { protected boolean onFinish() { loginForm.commit(); Authentication authentication = loginForm.getAuthentication(); // Hand this token to the security manager to actually attempt the login ApplicationSecurityManager sm = getApplicationConfig().applicationSecurityManager(); try { sm.doLogin( authentication ); postLogin(); return true; } finally { if( isClearPasswordOnFailure() ) { loginForm.setPassword(""); } loginForm.requestFocusInWindow(); } } protected void onCancel() { super.onCancel(); // Close the dialog // Now exit if configured if( isCloseOnCancel() ) { ApplicationSecurityManager sm = getApplicationConfig().applicationSecurityManager(); Authentication authentication = sm.getAuthentication(); if( authentication == null ) { LoginCommand.this.logger.info( "User canceled login; close the application." ); getApplicationConfig().application().close(); } } } protected ActionCommand getCallingCommand() { return LoginCommand.this; } protected void onAboutToShow() { loginForm.requestFocusInWindow(); } }; dialog.setDisplayFinishSuccessMessage( displaySuccessMessage ); dialog.showDialog(); }
[ "protected", "void", "doExecuteCommand", "(", ")", "{", "if", "(", "!", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "applicationSecurityManager", "(", ")", ".", "isSecuritySupported", "(", ")", ")", "{", "return", ";", "}", "CompositeDialogPage", "tabbedPage", "=", "new", "TabbedDialogPage", "(", "\"loginForm\"", ")", ";", "final", "LoginForm", "loginForm", "=", "createLoginForm", "(", ")", ";", "tabbedPage", ".", "addForm", "(", "loginForm", ")", ";", "if", "(", "getDefaultUserName", "(", ")", "!=", "null", ")", "{", "loginForm", ".", "setUserName", "(", "getDefaultUserName", "(", ")", ")", ";", "}", "dialog", "=", "new", "TitledPageApplicationDialog", "(", "tabbedPage", ")", "{", "protected", "boolean", "onFinish", "(", ")", "{", "loginForm", ".", "commit", "(", ")", ";", "Authentication", "authentication", "=", "loginForm", ".", "getAuthentication", "(", ")", ";", "// Hand this token to the security manager to actually attempt the login", "ApplicationSecurityManager", "sm", "=", "getApplicationConfig", "(", ")", ".", "applicationSecurityManager", "(", ")", ";", "try", "{", "sm", ".", "doLogin", "(", "authentication", ")", ";", "postLogin", "(", ")", ";", "return", "true", ";", "}", "finally", "{", "if", "(", "isClearPasswordOnFailure", "(", ")", ")", "{", "loginForm", ".", "setPassword", "(", "\"\"", ")", ";", "}", "loginForm", ".", "requestFocusInWindow", "(", ")", ";", "}", "}", "protected", "void", "onCancel", "(", ")", "{", "super", ".", "onCancel", "(", ")", ";", "// Close the dialog", "// Now exit if configured", "if", "(", "isCloseOnCancel", "(", ")", ")", "{", "ApplicationSecurityManager", "sm", "=", "getApplicationConfig", "(", ")", ".", "applicationSecurityManager", "(", ")", ";", "Authentication", "authentication", "=", "sm", ".", "getAuthentication", "(", ")", ";", "if", "(", "authentication", "==", "null", ")", "{", "LoginCommand", ".", "this", ".", "logger", ".", "info", "(", "\"User canceled login; close the application.\"", ")", ";", "getApplicationConfig", "(", ")", ".", "application", "(", ")", ".", "close", "(", ")", ";", "}", "}", "}", "protected", "ActionCommand", "getCallingCommand", "(", ")", "{", "return", "LoginCommand", ".", "this", ";", "}", "protected", "void", "onAboutToShow", "(", ")", "{", "loginForm", ".", "requestFocusInWindow", "(", ")", ";", "}", "}", ";", "dialog", ".", "setDisplayFinishSuccessMessage", "(", "displaySuccessMessage", ")", ";", "dialog", ".", "showDialog", "(", ")", ";", "}" ]
Execute the login command. Display the dialog and attempt authentication.
[ "Execute", "the", "login", "command", ".", "Display", "the", "dialog", "and", "attempt", "authentication", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginCommand.java#L61-L118
11,843
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/form/binding/jide/JideRepaintManager.java
JideRepaintManager.installJideRepaintManagerIfNeeded
public static void installJideRepaintManagerIfNeeded() { final RepaintManager current = RepaintManager.currentManager(null); if (current != JideRepaintManager.getInstance()) { // (JAF), 20110101, This is needed unless for setting a suitable PaintManager on target (RepaintManager // seems to be over-protected). ObjectUtils.shallowCopy(current, JideRepaintManager.getInstance()); RepaintManager.setCurrentManager(JideRepaintManager.getInstance()); } }
java
public static void installJideRepaintManagerIfNeeded() { final RepaintManager current = RepaintManager.currentManager(null); if (current != JideRepaintManager.getInstance()) { // (JAF), 20110101, This is needed unless for setting a suitable PaintManager on target (RepaintManager // seems to be over-protected). ObjectUtils.shallowCopy(current, JideRepaintManager.getInstance()); RepaintManager.setCurrentManager(JideRepaintManager.getInstance()); } }
[ "public", "static", "void", "installJideRepaintManagerIfNeeded", "(", ")", "{", "final", "RepaintManager", "current", "=", "RepaintManager", ".", "currentManager", "(", "null", ")", ";", "if", "(", "current", "!=", "JideRepaintManager", ".", "getInstance", "(", ")", ")", "{", "// (JAF), 20110101, This is needed unless for setting a suitable PaintManager on target (RepaintManager", "// seems to be over-protected).", "ObjectUtils", ".", "shallowCopy", "(", "current", ",", "JideRepaintManager", ".", "getInstance", "(", ")", ")", ";", "RepaintManager", ".", "setCurrentManager", "(", "JideRepaintManager", ".", "getInstance", "(", ")", ")", ";", "}", "}" ]
Installs this repaint manager if not already set. @see ObjectUtils#shallowCopy(Object, Object)
[ "Installs", "this", "repaint", "manager", "if", "not", "already", "set", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/form/binding/jide/JideRepaintManager.java#L117-L128
11,844
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java
BigDecimalTextField.addUserInputListener
public void addUserInputListener(UserInputListener listener) { if (this.listeners == null) this.listeners = new ArrayList(); this.listeners.add(listener); }
java
public void addUserInputListener(UserInputListener listener) { if (this.listeners == null) this.listeners = new ArrayList(); this.listeners.add(listener); }
[ "public", "void", "addUserInputListener", "(", "UserInputListener", "listener", ")", "{", "if", "(", "this", ".", "listeners", "==", "null", ")", "this", ".", "listeners", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "listeners", ".", "add", "(", "listener", ")", ";", "}" ]
Add a UserInputListener. @param listener UserInputListener. @see UserInputListener
[ "Add", "a", "UserInputListener", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java#L166-L170
11,845
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java
BigDecimalTextField.fireUserInputChange
private void fireUserInputChange() { if (!internallySettingText && (this.listeners != null)) { for (Iterator it = this.listeners.iterator(); it.hasNext();) { UserInputListener userInputListener = (UserInputListener) it.next(); userInputListener.update(this); } } }
java
private void fireUserInputChange() { if (!internallySettingText && (this.listeners != null)) { for (Iterator it = this.listeners.iterator(); it.hasNext();) { UserInputListener userInputListener = (UserInputListener) it.next(); userInputListener.update(this); } } }
[ "private", "void", "fireUserInputChange", "(", ")", "{", "if", "(", "!", "internallySettingText", "&&", "(", "this", ".", "listeners", "!=", "null", ")", ")", "{", "for", "(", "Iterator", "it", "=", "this", ".", "listeners", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "UserInputListener", "userInputListener", "=", "(", "UserInputListener", ")", "it", ".", "next", "(", ")", ";", "userInputListener", ".", "update", "(", "this", ")", ";", "}", "}", "}" ]
Fire an event to all UserInputListeners.
[ "Fire", "an", "event", "to", "all", "UserInputListeners", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java#L188-L195
11,846
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java
BigDecimalTextField.getValue
public Number getValue() { if ((getText() == null) || "".equals(getText().trim())) return null; try { Number n = format.parse(getText()); if (n.getClass() == this.numberClass) return n; else if (this.numberClass == BigDecimal.class) { BigDecimal bd = new BigDecimal(n.doubleValue()); if (scale != null) { bd = bd.setScale(scale.intValue(), BigDecimal.ROUND_HALF_UP); } return bd; } else if (this.numberClass == Double.class) return new Double(n.doubleValue()); else if (this.numberClass == Float.class) return new Float(n.floatValue()); else if (this.numberClass == BigInteger.class) // we have called setBigDecimalFormat to make sure a BigDecimal // is returned so use toBigInteger on that class return ((BigDecimal) n).toBigInteger(); else if (this.numberClass == Long.class) return new Long(n.longValue()); else if (this.numberClass == Integer.class) return new Integer(n.intValue()); else if (this.numberClass == Short.class) return new Short(n.shortValue()); else if (this.numberClass == Byte.class) return new Byte(n.byteValue()); return null; } catch (Exception pe) { log.error("Error: " + getText() + " is not a number.", pe); return null; } }
java
public Number getValue() { if ((getText() == null) || "".equals(getText().trim())) return null; try { Number n = format.parse(getText()); if (n.getClass() == this.numberClass) return n; else if (this.numberClass == BigDecimal.class) { BigDecimal bd = new BigDecimal(n.doubleValue()); if (scale != null) { bd = bd.setScale(scale.intValue(), BigDecimal.ROUND_HALF_UP); } return bd; } else if (this.numberClass == Double.class) return new Double(n.doubleValue()); else if (this.numberClass == Float.class) return new Float(n.floatValue()); else if (this.numberClass == BigInteger.class) // we have called setBigDecimalFormat to make sure a BigDecimal // is returned so use toBigInteger on that class return ((BigDecimal) n).toBigInteger(); else if (this.numberClass == Long.class) return new Long(n.longValue()); else if (this.numberClass == Integer.class) return new Integer(n.intValue()); else if (this.numberClass == Short.class) return new Short(n.shortValue()); else if (this.numberClass == Byte.class) return new Byte(n.byteValue()); return null; } catch (Exception pe) { log.error("Error: " + getText() + " is not a number.", pe); return null; } }
[ "public", "Number", "getValue", "(", ")", "{", "if", "(", "(", "getText", "(", ")", "==", "null", ")", "||", "\"\"", ".", "equals", "(", "getText", "(", ")", ".", "trim", "(", ")", ")", ")", "return", "null", ";", "try", "{", "Number", "n", "=", "format", ".", "parse", "(", "getText", "(", ")", ")", ";", "if", "(", "n", ".", "getClass", "(", ")", "==", "this", ".", "numberClass", ")", "return", "n", ";", "else", "if", "(", "this", ".", "numberClass", "==", "BigDecimal", ".", "class", ")", "{", "BigDecimal", "bd", "=", "new", "BigDecimal", "(", "n", ".", "doubleValue", "(", ")", ")", ";", "if", "(", "scale", "!=", "null", ")", "{", "bd", "=", "bd", ".", "setScale", "(", "scale", ".", "intValue", "(", ")", ",", "BigDecimal", ".", "ROUND_HALF_UP", ")", ";", "}", "return", "bd", ";", "}", "else", "if", "(", "this", ".", "numberClass", "==", "Double", ".", "class", ")", "return", "new", "Double", "(", "n", ".", "doubleValue", "(", ")", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "Float", ".", "class", ")", "return", "new", "Float", "(", "n", ".", "floatValue", "(", ")", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "BigInteger", ".", "class", ")", "// we have called setBigDecimalFormat to make sure a BigDecimal", "// is returned so use toBigInteger on that class", "return", "(", "(", "BigDecimal", ")", "n", ")", ".", "toBigInteger", "(", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "Long", ".", "class", ")", "return", "new", "Long", "(", "n", ".", "longValue", "(", ")", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "Integer", ".", "class", ")", "return", "new", "Integer", "(", "n", ".", "intValue", "(", ")", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "Short", ".", "class", ")", "return", "new", "Short", "(", "n", ".", "shortValue", "(", ")", ")", ";", "else", "if", "(", "this", ".", "numberClass", "==", "Byte", ".", "class", ")", "return", "new", "Byte", "(", "n", ".", "byteValue", "(", ")", ")", ";", "return", "null", ";", "}", "catch", "(", "Exception", "pe", ")", "{", "log", ".", "error", "(", "\"Error: \"", "+", "getText", "(", ")", "+", "\" is not a number.\"", ",", "pe", ")", ";", "return", "null", ";", "}", "}" ]
Parses a number from the inputField and will adjust it's class if needed. @return Number the Parsed number.
[ "Parses", "a", "number", "from", "the", "inputField", "and", "will", "adjust", "it", "s", "class", "if", "needed", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java#L202-L238
11,847
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java
BigDecimalTextField.setValue
public void setValue(Number number) { String txt = null; if (number != null) { txt = this.format.format(number); } setText(txt); }
java
public void setValue(Number number) { String txt = null; if (number != null) { txt = this.format.format(number); } setText(txt); }
[ "public", "void", "setValue", "(", "Number", "number", ")", "{", "String", "txt", "=", "null", ";", "if", "(", "number", "!=", "null", ")", "{", "txt", "=", "this", ".", "format", ".", "format", "(", "number", ")", ";", "}", "setText", "(", "txt", ")", ";", "}" ]
Format the number and show it. @param number Number to set.
[ "Format", "the", "number", "and", "show", "it", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/BigDecimalTextField.java#L245-L251
11,848
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java
TableLayoutBuilder.row
public TableLayoutBuilder row() { ++currentRow; lastCC = null; maxColumns = Math.max(maxColumns, currentCol); currentCol = 0; return this; }
java
public TableLayoutBuilder row() { ++currentRow; lastCC = null; maxColumns = Math.max(maxColumns, currentCol); currentCol = 0; return this; }
[ "public", "TableLayoutBuilder", "row", "(", ")", "{", "++", "currentRow", ";", "lastCC", "=", "null", ";", "maxColumns", "=", "Math", ".", "max", "(", "maxColumns", ",", "currentCol", ")", ";", "currentCol", "=", "0", ";", "return", "this", ";", "}" ]
Inserts a new row. No gap row is inserted before this row.
[ "Inserts", "a", "new", "row", ".", "No", "gap", "row", "is", "inserted", "before", "this", "row", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java#L193-L199
11,849
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java
TableLayoutBuilder.row
public TableLayoutBuilder row(RowSpec gapRowSpec) { row(); gapRows.put(new Integer(currentRow), gapRowSpec); return this; }
java
public TableLayoutBuilder row(RowSpec gapRowSpec) { row(); gapRows.put(new Integer(currentRow), gapRowSpec); return this; }
[ "public", "TableLayoutBuilder", "row", "(", "RowSpec", "gapRowSpec", ")", "{", "row", "(", ")", ";", "gapRows", ".", "put", "(", "new", "Integer", "(", "currentRow", ")", ",", "gapRowSpec", ")", ";", "return", "this", ";", "}" ]
Inserts a new row. A gap row with specified RowSpec will be inserted before this row.
[ "Inserts", "a", "new", "row", ".", "A", "gap", "row", "with", "specified", "RowSpec", "will", "be", "inserted", "before", "this", "row", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java#L213-L217
11,850
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java
TableLayoutBuilder.separator
public TableLayoutBuilder separator(String labelKey, String attributes) { Cell cc = cellInternal(getComponentFactory().createLabeledSeparator(labelKey), attributes); lastCC = cc; items.add(cc); return this; }
java
public TableLayoutBuilder separator(String labelKey, String attributes) { Cell cc = cellInternal(getComponentFactory().createLabeledSeparator(labelKey), attributes); lastCC = cc; items.add(cc); return this; }
[ "public", "TableLayoutBuilder", "separator", "(", "String", "labelKey", ",", "String", "attributes", ")", "{", "Cell", "cc", "=", "cellInternal", "(", "getComponentFactory", "(", ")", ".", "createLabeledSeparator", "(", "labelKey", ")", ",", "attributes", ")", ";", "lastCC", "=", "cc", ";", "items", ".", "add", "(", "cc", ")", ";", "return", "this", ";", "}" ]
Inserts a separator with the given label. Attributes my be zero or more of rowSpec, columnSpec, colGrId, rowGrId, align and valign. @deprecated this is a layout builder, creating components should be done elsewhere, use cell() methods instead
[ "Inserts", "a", "separator", "with", "the", "given", "label", ".", "Attributes", "my", "be", "zero", "or", "more", "of", "rowSpec", "columnSpec", "colGrId", "rowGrId", "align", "and", "valign", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java#L327-L332
11,851
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java
TableLayoutBuilder.setFocusTraversalOrder
public void setFocusTraversalOrder( int traversalOrder ) { Assert.isTrue( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER || traversalOrder == ROW_MAJOR_FOCUS_ORDER, "traversalOrder must be one of COLUMN_MAJOR_FOCUS_ORDER or ROW_MAJOR_FOCUS_ORDER"); List focusOrder = new ArrayList(items.size()); if( traversalOrder == ROW_MAJOR_FOCUS_ORDER ) { for( int row=0; row < rowOccupiers.size() - 1; row++ ) { for( int col=0; col < maxColumns; col++ ) { Cell currentCell = getOccupier(row, col); if (currentCell != null && currentCell.getComponent() != null && !focusOrder.contains(currentCell.getComponent())) { focusOrder.add(currentCell.getComponent()); } } } } else if( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER ) { for( int col = 0; col < maxColumns; col++ ) { for( int row = 0; row < rowOccupiers.size() - 1; row++ ) { Cell currentCell = getOccupier( row, col ); if( currentCell != null && currentCell.getComponent() != null && !focusOrder.contains( currentCell.getComponent() ) ) { focusOrder.add( currentCell.getComponent() ); } } } } setCustomFocusTraversalOrder( focusOrder ); }
java
public void setFocusTraversalOrder( int traversalOrder ) { Assert.isTrue( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER || traversalOrder == ROW_MAJOR_FOCUS_ORDER, "traversalOrder must be one of COLUMN_MAJOR_FOCUS_ORDER or ROW_MAJOR_FOCUS_ORDER"); List focusOrder = new ArrayList(items.size()); if( traversalOrder == ROW_MAJOR_FOCUS_ORDER ) { for( int row=0; row < rowOccupiers.size() - 1; row++ ) { for( int col=0; col < maxColumns; col++ ) { Cell currentCell = getOccupier(row, col); if (currentCell != null && currentCell.getComponent() != null && !focusOrder.contains(currentCell.getComponent())) { focusOrder.add(currentCell.getComponent()); } } } } else if( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER ) { for( int col = 0; col < maxColumns; col++ ) { for( int row = 0; row < rowOccupiers.size() - 1; row++ ) { Cell currentCell = getOccupier( row, col ); if( currentCell != null && currentCell.getComponent() != null && !focusOrder.contains( currentCell.getComponent() ) ) { focusOrder.add( currentCell.getComponent() ); } } } } setCustomFocusTraversalOrder( focusOrder ); }
[ "public", "void", "setFocusTraversalOrder", "(", "int", "traversalOrder", ")", "{", "Assert", ".", "isTrue", "(", "traversalOrder", "==", "COLUMN_MAJOR_FOCUS_ORDER", "||", "traversalOrder", "==", "ROW_MAJOR_FOCUS_ORDER", ",", "\"traversalOrder must be one of COLUMN_MAJOR_FOCUS_ORDER or ROW_MAJOR_FOCUS_ORDER\"", ")", ";", "List", "focusOrder", "=", "new", "ArrayList", "(", "items", ".", "size", "(", ")", ")", ";", "if", "(", "traversalOrder", "==", "ROW_MAJOR_FOCUS_ORDER", ")", "{", "for", "(", "int", "row", "=", "0", ";", "row", "<", "rowOccupiers", ".", "size", "(", ")", "-", "1", ";", "row", "++", ")", "{", "for", "(", "int", "col", "=", "0", ";", "col", "<", "maxColumns", ";", "col", "++", ")", "{", "Cell", "currentCell", "=", "getOccupier", "(", "row", ",", "col", ")", ";", "if", "(", "currentCell", "!=", "null", "&&", "currentCell", ".", "getComponent", "(", ")", "!=", "null", "&&", "!", "focusOrder", ".", "contains", "(", "currentCell", ".", "getComponent", "(", ")", ")", ")", "{", "focusOrder", ".", "add", "(", "currentCell", ".", "getComponent", "(", ")", ")", ";", "}", "}", "}", "}", "else", "if", "(", "traversalOrder", "==", "COLUMN_MAJOR_FOCUS_ORDER", ")", "{", "for", "(", "int", "col", "=", "0", ";", "col", "<", "maxColumns", ";", "col", "++", ")", "{", "for", "(", "int", "row", "=", "0", ";", "row", "<", "rowOccupiers", ".", "size", "(", ")", "-", "1", ";", "row", "++", ")", "{", "Cell", "currentCell", "=", "getOccupier", "(", "row", ",", "col", ")", ";", "if", "(", "currentCell", "!=", "null", "&&", "currentCell", ".", "getComponent", "(", ")", "!=", "null", "&&", "!", "focusOrder", ".", "contains", "(", "currentCell", ".", "getComponent", "(", ")", ")", ")", "{", "focusOrder", ".", "add", "(", "currentCell", ".", "getComponent", "(", ")", ")", ";", "}", "}", "}", "}", "setCustomFocusTraversalOrder", "(", "focusOrder", ")", ";", "}" ]
Set the focus traversal order. @param traversalOrder focus traversal order. Must be one of {@link #COLUMN_MAJOR_FOCUS_ORDER} or {@link #ROW_MAJOR_FOCUS_ORDER}.
[ "Set", "the", "focus", "traversal", "order", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java#L595-L622
11,852
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/EditorLifecycleListener.java
EditorLifecycleListener.documentComponentClosed
public void documentComponentClosed(DocumentComponentEvent event) { if(logger.isDebugEnabled()){ logger.debug("Page component "+pageComponent.getId()+" closed"); } workspace.remove(pageComponent); ((JideApplicationPage)workspace.getContext().getPage()).fireClosed(pageComponent); }
java
public void documentComponentClosed(DocumentComponentEvent event) { if(logger.isDebugEnabled()){ logger.debug("Page component "+pageComponent.getId()+" closed"); } workspace.remove(pageComponent); ((JideApplicationPage)workspace.getContext().getPage()).fireClosed(pageComponent); }
[ "public", "void", "documentComponentClosed", "(", "DocumentComponentEvent", "event", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Page component \"", "+", "pageComponent", ".", "getId", "(", ")", "+", "\" closed\"", ")", ";", "}", "workspace", ".", "remove", "(", "pageComponent", ")", ";", "(", "(", "JideApplicationPage", ")", "workspace", ".", "getContext", "(", ")", ".", "getPage", "(", ")", ")", ".", "fireClosed", "(", "pageComponent", ")", ";", "}" ]
Default closed implementation removes the given page component from the workspace view, and so the document from the document pane.
[ "Default", "closed", "implementation", "removes", "the", "given", "page", "component", "from", "the", "workspace", "view", "and", "so", "the", "document", "from", "the", "document", "pane", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/EditorLifecycleListener.java#L54-L60
11,853
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.getTitle
protected String getTitle() { if (!StringUtils.hasText(this.title)) { if (StringUtils.hasText(getCallingCommandText())) return getCallingCommandText(); return DEFAULT_DIALOG_TITLE; } return this.title; }
java
protected String getTitle() { if (!StringUtils.hasText(this.title)) { if (StringUtils.hasText(getCallingCommandText())) return getCallingCommandText(); return DEFAULT_DIALOG_TITLE; } return this.title; }
[ "protected", "String", "getTitle", "(", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "this", ".", "title", ")", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "getCallingCommandText", "(", ")", ")", ")", "return", "getCallingCommandText", "(", ")", ";", "return", "DEFAULT_DIALOG_TITLE", ";", "}", "return", "this", ".", "title", ";", "}" ]
Returns the title of this dialog. If no specific title has been set, the calling command's text will be used. If that doesn't yield a result, the default title is returned. @see #getCallingCommandText() @see #DEFAULT_DIALOG_TITLE
[ "Returns", "the", "title", "of", "this", "dialog", ".", "If", "no", "specific", "title", "has", "been", "set", "the", "calling", "command", "s", "text", "will", "be", "used", ".", "If", "that", "doesn", "t", "yield", "a", "result", "the", "default", "title", "is", "returned", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L202-L210
11,854
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.constructDialog
private void constructDialog() { if (getParentWindow() instanceof Frame) { dialog = new JDialog((Frame) getParentWindow(), getTitle(), modal); } else { dialog = new JDialog((Dialog) getParentWindow(), getTitle(), modal); } dialog.getContentPane().setLayout(new BorderLayout()); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.setResizable(resizable); initStandardCommands(); addCancelByEscapeKey(); }
java
private void constructDialog() { if (getParentWindow() instanceof Frame) { dialog = new JDialog((Frame) getParentWindow(), getTitle(), modal); } else { dialog = new JDialog((Dialog) getParentWindow(), getTitle(), modal); } dialog.getContentPane().setLayout(new BorderLayout()); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.setResizable(resizable); initStandardCommands(); addCancelByEscapeKey(); }
[ "private", "void", "constructDialog", "(", ")", "{", "if", "(", "getParentWindow", "(", ")", "instanceof", "Frame", ")", "{", "dialog", "=", "new", "JDialog", "(", "(", "Frame", ")", "getParentWindow", "(", ")", ",", "getTitle", "(", ")", ",", "modal", ")", ";", "}", "else", "{", "dialog", "=", "new", "JDialog", "(", "(", "Dialog", ")", "getParentWindow", "(", ")", ",", "getTitle", "(", ")", ",", "modal", ")", ";", "}", "dialog", ".", "getContentPane", "(", ")", ".", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "dialog", ".", "setDefaultCloseOperation", "(", "WindowConstants", ".", "DO_NOTHING_ON_CLOSE", ")", ";", "dialog", ".", "setResizable", "(", "resizable", ")", ";", "initStandardCommands", "(", ")", ";", "addCancelByEscapeKey", "(", ")", ";", "}" ]
Construct the visual dialog frame on which the content needs to be added.
[ "Construct", "the", "visual", "dialog", "frame", "on", "which", "the", "content", "needs", "to", "be", "added", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L443-L457
11,855
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.getFinishSuccessMessage
protected String getFinishSuccessMessage() { ActionCommand callingCommand = getCallingCommand(); if (callingCommand != null) { String[] successMessageKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_MESSAGE_KEY, DEFAULT_FINISH_SUCCESS_MESSAGE_KEY }; return getApplicationConfig().messageResolver().getMessage(successMessageKeys, getFinishSuccessMessageArguments()); } return getApplicationConfig().messageResolver().getMessage(DEFAULT_FINISH_SUCCESS_MESSAGE_KEY); }
java
protected String getFinishSuccessMessage() { ActionCommand callingCommand = getCallingCommand(); if (callingCommand != null) { String[] successMessageKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_MESSAGE_KEY, DEFAULT_FINISH_SUCCESS_MESSAGE_KEY }; return getApplicationConfig().messageResolver().getMessage(successMessageKeys, getFinishSuccessMessageArguments()); } return getApplicationConfig().messageResolver().getMessage(DEFAULT_FINISH_SUCCESS_MESSAGE_KEY); }
[ "protected", "String", "getFinishSuccessMessage", "(", ")", "{", "ActionCommand", "callingCommand", "=", "getCallingCommand", "(", ")", ";", "if", "(", "callingCommand", "!=", "null", ")", "{", "String", "[", "]", "successMessageKeys", "=", "new", "String", "[", "]", "{", "callingCommand", ".", "getId", "(", ")", "+", "\".\"", "+", "SUCCESS_FINISH_MESSAGE_KEY", ",", "DEFAULT_FINISH_SUCCESS_MESSAGE_KEY", "}", ";", "return", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "successMessageKeys", ",", "getFinishSuccessMessageArguments", "(", ")", ")", ";", "}", "return", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "DEFAULT_FINISH_SUCCESS_MESSAGE_KEY", ")", ";", "}" ]
Returns the message to use upon succesful finish.
[ "Returns", "the", "message", "to", "use", "upon", "succesful", "finish", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L562-L570
11,856
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.getFinishSuccessTitle
protected String getFinishSuccessTitle() { ActionCommand callingCommand = getCallingCommand(); if (callingCommand != null) { String[] successTitleKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_TITLE_KEY, DEFAULT_FINISH_SUCCESS_TITLE_KEY }; return getApplicationConfig().messageResolver().getMessage(successTitleKeys, getFinishSuccessTitleArguments()); } return getApplicationConfig().messageResolver().getMessage(DEFAULT_FINISH_SUCCESS_TITLE_KEY); }
java
protected String getFinishSuccessTitle() { ActionCommand callingCommand = getCallingCommand(); if (callingCommand != null) { String[] successTitleKeys = new String[] { callingCommand.getId() + "." + SUCCESS_FINISH_TITLE_KEY, DEFAULT_FINISH_SUCCESS_TITLE_KEY }; return getApplicationConfig().messageResolver().getMessage(successTitleKeys, getFinishSuccessTitleArguments()); } return getApplicationConfig().messageResolver().getMessage(DEFAULT_FINISH_SUCCESS_TITLE_KEY); }
[ "protected", "String", "getFinishSuccessTitle", "(", ")", "{", "ActionCommand", "callingCommand", "=", "getCallingCommand", "(", ")", ";", "if", "(", "callingCommand", "!=", "null", ")", "{", "String", "[", "]", "successTitleKeys", "=", "new", "String", "[", "]", "{", "callingCommand", ".", "getId", "(", ")", "+", "\".\"", "+", "SUCCESS_FINISH_TITLE_KEY", ",", "DEFAULT_FINISH_SUCCESS_TITLE_KEY", "}", ";", "return", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "successTitleKeys", ",", "getFinishSuccessTitleArguments", "(", ")", ")", ";", "}", "return", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "DEFAULT_FINISH_SUCCESS_TITLE_KEY", ")", ";", "}" ]
Returns the title to use upon succesful finish.
[ "Returns", "the", "title", "to", "use", "upon", "succesful", "finish", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L589-L597
11,857
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.addCancelByEscapeKey
private void addCancelByEscapeKey() { int noModifiers = 0; KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, noModifiers, false); addActionKeyBinding(escapeKey, cancelCommand.getId()); }
java
private void addCancelByEscapeKey() { int noModifiers = 0; KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, noModifiers, false); addActionKeyBinding(escapeKey, cancelCommand.getId()); }
[ "private", "void", "addCancelByEscapeKey", "(", ")", "{", "int", "noModifiers", "=", "0", ";", "KeyStroke", "escapeKey", "=", "KeyStroke", ".", "getKeyStroke", "(", "KeyEvent", ".", "VK_ESCAPE", ",", "noModifiers", ",", "false", ")", ";", "addActionKeyBinding", "(", "escapeKey", ",", "cancelCommand", ".", "getId", "(", ")", ")", ";", "}" ]
Force the escape key to call the same action as pressing the Cancel button. This does not always work. See class comment.
[ "Force", "the", "escape", "key", "to", "call", "the", "same", "action", "as", "pressing", "the", "Cancel", "button", ".", "This", "does", "not", "always", "work", ".", "See", "class", "comment", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L641-L645
11,858
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.addDialogComponents
protected void addDialogComponents() { JComponent dialogContentPane = createDialogContentPane(); GuiStandardUtils.attachDialogBorder(dialogContentPane); if (getPreferredSize() != null) { dialogContentPane.setPreferredSize(getPreferredSize()); } getDialogContentPane().add(dialogContentPane); getDialogContentPane().add(createButtonBar(), BorderLayout.SOUTH); }
java
protected void addDialogComponents() { JComponent dialogContentPane = createDialogContentPane(); GuiStandardUtils.attachDialogBorder(dialogContentPane); if (getPreferredSize() != null) { dialogContentPane.setPreferredSize(getPreferredSize()); } getDialogContentPane().add(dialogContentPane); getDialogContentPane().add(createButtonBar(), BorderLayout.SOUTH); }
[ "protected", "void", "addDialogComponents", "(", ")", "{", "JComponent", "dialogContentPane", "=", "createDialogContentPane", "(", ")", ";", "GuiStandardUtils", ".", "attachDialogBorder", "(", "dialogContentPane", ")", ";", "if", "(", "getPreferredSize", "(", ")", "!=", "null", ")", "{", "dialogContentPane", ".", "setPreferredSize", "(", "getPreferredSize", "(", ")", ")", ";", "}", "getDialogContentPane", "(", ")", ".", "add", "(", "dialogContentPane", ")", ";", "getDialogContentPane", "(", ")", ".", "add", "(", "createButtonBar", "(", ")", ",", "BorderLayout", ".", "SOUTH", ")", ";", "}" ]
Subclasses may override to customize how this dialog is built.
[ "Subclasses", "may", "override", "to", "customize", "how", "this", "dialog", "is", "built", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L705-L713
11,859
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.createButtonBar
protected JComponent createButtonBar() { this.dialogCommandGroup = getCommandManager().createCommandGroup(null, getCommandGroupMembers()); JComponent buttonBar = this.dialogCommandGroup.createButtonBar(); GuiStandardUtils.attachDialogBorder(buttonBar); return buttonBar; }
java
protected JComponent createButtonBar() { this.dialogCommandGroup = getCommandManager().createCommandGroup(null, getCommandGroupMembers()); JComponent buttonBar = this.dialogCommandGroup.createButtonBar(); GuiStandardUtils.attachDialogBorder(buttonBar); return buttonBar; }
[ "protected", "JComponent", "createButtonBar", "(", ")", "{", "this", ".", "dialogCommandGroup", "=", "getCommandManager", "(", ")", ".", "createCommandGroup", "(", "null", ",", "getCommandGroupMembers", "(", ")", ")", ";", "JComponent", "buttonBar", "=", "this", ".", "dialogCommandGroup", ".", "createButtonBar", "(", ")", ";", "GuiStandardUtils", ".", "attachDialogBorder", "(", "buttonBar", ")", ";", "return", "buttonBar", ";", "}" ]
Return a standardized row of command buttons, right-justified and all of the same size, with OK as the default button, and no mnemonics used, as per the Java Look and Feel guidelines.
[ "Return", "a", "standardized", "row", "of", "command", "buttons", "right", "-", "justified", "and", "all", "of", "the", "same", "size", "with", "OK", "as", "the", "default", "button", "and", "no", "mnemonics", "used", "as", "per", "the", "Java", "Look", "and", "Feel", "guidelines", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L766-L771
11,860
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.getCommandGroupMembers
protected java.util.List<? extends AbstractCommand> getCommandGroupMembers() { return Lists.<AbstractCommand>newArrayList(getFinishCommand(), getCancelCommand()); }
java
protected java.util.List<? extends AbstractCommand> getCommandGroupMembers() { return Lists.<AbstractCommand>newArrayList(getFinishCommand(), getCancelCommand()); }
[ "protected", "java", ".", "util", ".", "List", "<", "?", "extends", "AbstractCommand", ">", "getCommandGroupMembers", "(", ")", "{", "return", "Lists", ".", "<", "AbstractCommand", ">", "newArrayList", "(", "getFinishCommand", "(", ")", ",", "getCancelCommand", "(", ")", ")", ";", "}" ]
Template getter method to return the commands to populate the dialog button bar. @return The array of commands (may also be a separator or glue identifier)
[ "Template", "getter", "method", "to", "return", "the", "commands", "to", "populate", "the", "dialog", "button", "bar", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L780-L782
11,861
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ExpansionPointGroupMember.java
ExpansionPointGroupMember.fill
protected void fill(GroupContainerPopulator containerPopulator, Object controlFactory, CommandButtonConfigurer configurer, List previousButtons) { Assert.notNull(containerPopulator, "containerPopulator"); Assert.notNull(controlFactory, "controlFactory"); Assert.notNull(configurer, "configurer"); if (members.size() > 0 && isLeadingSeparator()) { containerPopulator.addSeparator(); } for (Iterator iterator = members.iterator(); iterator.hasNext();) { GroupMember member = (GroupMember)iterator.next(); member.fill(containerPopulator, controlFactory, configurer, previousButtons); } if (members.size() > 0 && isEndingSeparator()) { containerPopulator.addSeparator(); } }
java
protected void fill(GroupContainerPopulator containerPopulator, Object controlFactory, CommandButtonConfigurer configurer, List previousButtons) { Assert.notNull(containerPopulator, "containerPopulator"); Assert.notNull(controlFactory, "controlFactory"); Assert.notNull(configurer, "configurer"); if (members.size() > 0 && isLeadingSeparator()) { containerPopulator.addSeparator(); } for (Iterator iterator = members.iterator(); iterator.hasNext();) { GroupMember member = (GroupMember)iterator.next(); member.fill(containerPopulator, controlFactory, configurer, previousButtons); } if (members.size() > 0 && isEndingSeparator()) { containerPopulator.addSeparator(); } }
[ "protected", "void", "fill", "(", "GroupContainerPopulator", "containerPopulator", ",", "Object", "controlFactory", ",", "CommandButtonConfigurer", "configurer", ",", "List", "previousButtons", ")", "{", "Assert", ".", "notNull", "(", "containerPopulator", ",", "\"containerPopulator\"", ")", ";", "Assert", ".", "notNull", "(", "controlFactory", ",", "\"controlFactory\"", ")", ";", "Assert", ".", "notNull", "(", "configurer", ",", "\"configurer\"", ")", ";", "if", "(", "members", ".", "size", "(", ")", ">", "0", "&&", "isLeadingSeparator", "(", ")", ")", "{", "containerPopulator", ".", "addSeparator", "(", ")", ";", "}", "for", "(", "Iterator", "iterator", "=", "members", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "GroupMember", "member", "=", "(", "GroupMember", ")", "iterator", ".", "next", "(", ")", ";", "member", ".", "fill", "(", "containerPopulator", ",", "controlFactory", ",", "configurer", ",", "previousButtons", ")", ";", "}", "if", "(", "members", ".", "size", "(", ")", ">", "0", "&&", "isEndingSeparator", "(", ")", ")", "{", "containerPopulator", ".", "addSeparator", "(", ")", ";", "}", "}" ]
Adds each member of this expansion point to a GUI container using the given container populator. Leading and trailing separators will also be added as determined by the appropriate flags set on this instance. {@inheritDoc}
[ "Adds", "each", "member", "of", "this", "expansion", "point", "to", "a", "GUI", "container", "using", "the", "given", "container", "populator", ".", "Leading", "and", "trailing", "separators", "will", "also", "be", "added", "as", "determined", "by", "the", "appropriate", "flags", "set", "on", "this", "instance", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ExpansionPointGroupMember.java#L156-L178
11,862
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ExpansionPointGroupMember.java
ExpansionPointGroupMember.getMemberFor
public GroupMember getMemberFor(String commandId) { for (Iterator it = members.iterator(); it.hasNext();) { GroupMember member = (GroupMember)it.next(); if (member.managesCommand(commandId)) { return member; } } return null; }
java
public GroupMember getMemberFor(String commandId) { for (Iterator it = members.iterator(); it.hasNext();) { GroupMember member = (GroupMember)it.next(); if (member.managesCommand(commandId)) { return member; } } return null; }
[ "public", "GroupMember", "getMemberFor", "(", "String", "commandId", ")", "{", "for", "(", "Iterator", "it", "=", "members", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "GroupMember", "member", "=", "(", "GroupMember", ")", "it", ".", "next", "(", ")", ";", "if", "(", "member", ".", "managesCommand", "(", "commandId", ")", ")", "{", "return", "member", ";", "}", "}", "return", "null", ";", "}" ]
Returns the group member that manages the command with the given id, or null if none of the members in this expansion point manage a command with that id. @param commandId The id of the command whose managing member is to be returned. @return The group member that manages the command with the given id, or null.
[ "Returns", "the", "group", "member", "that", "manages", "the", "command", "with", "the", "given", "id", "or", "null", "if", "none", "of", "the", "members", "in", "this", "expansion", "point", "manage", "a", "command", "with", "that", "id", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ExpansionPointGroupMember.java#L187-L195
11,863
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ListBinding.java
ListBinding.getPropertyConversionExecutor
protected ConversionExecutor getPropertyConversionExecutor() { if (conversionExecutor == null) { conversionExecutor = getConversionService().getConversionExecutor(Object[].class, getPropertyType()); } return conversionExecutor; }
java
protected ConversionExecutor getPropertyConversionExecutor() { if (conversionExecutor == null) { conversionExecutor = getConversionService().getConversionExecutor(Object[].class, getPropertyType()); } return conversionExecutor; }
[ "protected", "ConversionExecutor", "getPropertyConversionExecutor", "(", ")", "{", "if", "(", "conversionExecutor", "==", "null", ")", "{", "conversionExecutor", "=", "getConversionService", "(", ")", ".", "getConversionExecutor", "(", "Object", "[", "]", ".", "class", ",", "getPropertyType", "(", ")", ")", ";", "}", "return", "conversionExecutor", ";", "}" ]
Returns a conversion executor which converts a value of the given sourceType into the fieldType @return true if a converter is available, otherwise false @see #getPropertyType()
[ "Returns", "a", "conversion", "executor", "which", "converts", "a", "value", "of", "the", "given", "sourceType", "into", "the", "fieldType" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ListBinding.java#L72-L77
11,864
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ListBinding.java
ListBinding.updateSelectedItemsFromValueModel
protected void updateSelectedItemsFromValueModel() { Object value = getValue(); Object[] selectedValues = EMPTY_VALUES; if (value != null) { selectedValues = (Object[]) convertValue(value, Object[].class); } // flag is used to avoid a round trip while we are selecting the values selectingValues = true; try { ListSelectionModel selectionModel = getList().getSelectionModel(); selectionModel.setValueIsAdjusting(true); try { int[] valueIndexes = determineValueIndexes(selectedValues); int selectionMode = getSelectionMode(); if (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1) { getList().setSelectedIndex(valueIndexes[0]); } else { getList().setSelectedIndices(valueIndexes); } // update value model if selectedValues contain elements which where not found in the list model // elements if (valueIndexes.length != selectedValues.length && !isReadOnly() && isEnabled() || (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1)) { updateSelectedItemsFromSelectionModel(); } } finally { selectionModel.setValueIsAdjusting(false); } } finally { selectingValues = false; } }
java
protected void updateSelectedItemsFromValueModel() { Object value = getValue(); Object[] selectedValues = EMPTY_VALUES; if (value != null) { selectedValues = (Object[]) convertValue(value, Object[].class); } // flag is used to avoid a round trip while we are selecting the values selectingValues = true; try { ListSelectionModel selectionModel = getList().getSelectionModel(); selectionModel.setValueIsAdjusting(true); try { int[] valueIndexes = determineValueIndexes(selectedValues); int selectionMode = getSelectionMode(); if (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1) { getList().setSelectedIndex(valueIndexes[0]); } else { getList().setSelectedIndices(valueIndexes); } // update value model if selectedValues contain elements which where not found in the list model // elements if (valueIndexes.length != selectedValues.length && !isReadOnly() && isEnabled() || (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1)) { updateSelectedItemsFromSelectionModel(); } } finally { selectionModel.setValueIsAdjusting(false); } } finally { selectingValues = false; } }
[ "protected", "void", "updateSelectedItemsFromValueModel", "(", ")", "{", "Object", "value", "=", "getValue", "(", ")", ";", "Object", "[", "]", "selectedValues", "=", "EMPTY_VALUES", ";", "if", "(", "value", "!=", "null", ")", "{", "selectedValues", "=", "(", "Object", "[", "]", ")", "convertValue", "(", "value", ",", "Object", "[", "]", ".", "class", ")", ";", "}", "// flag is used to avoid a round trip while we are selecting the values", "selectingValues", "=", "true", ";", "try", "{", "ListSelectionModel", "selectionModel", "=", "getList", "(", ")", ".", "getSelectionModel", "(", ")", ";", "selectionModel", ".", "setValueIsAdjusting", "(", "true", ")", ";", "try", "{", "int", "[", "]", "valueIndexes", "=", "determineValueIndexes", "(", "selectedValues", ")", ";", "int", "selectionMode", "=", "getSelectionMode", "(", ")", ";", "if", "(", "selectionMode", "==", "ListSelectionModel", ".", "SINGLE_SELECTION", "&&", "valueIndexes", ".", "length", ">", "1", ")", "{", "getList", "(", ")", ".", "setSelectedIndex", "(", "valueIndexes", "[", "0", "]", ")", ";", "}", "else", "{", "getList", "(", ")", ".", "setSelectedIndices", "(", "valueIndexes", ")", ";", "}", "// update value model if selectedValues contain elements which where not found in the list model", "// elements", "if", "(", "valueIndexes", ".", "length", "!=", "selectedValues", ".", "length", "&&", "!", "isReadOnly", "(", ")", "&&", "isEnabled", "(", ")", "||", "(", "selectionMode", "==", "ListSelectionModel", ".", "SINGLE_SELECTION", "&&", "valueIndexes", ".", "length", ">", "1", ")", ")", "{", "updateSelectedItemsFromSelectionModel", "(", ")", ";", "}", "}", "finally", "{", "selectionModel", ".", "setValueIsAdjusting", "(", "false", ")", ";", "}", "}", "finally", "{", "selectingValues", "=", "false", ";", "}", "}" ]
Updates the selection model with the selected values from the value model.
[ "Updates", "the", "selection", "model", "with", "the", "selected", "values", "from", "the", "value", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ListBinding.java#L136-L169
11,865
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ToggleCommand.java
ToggleCommand.setSelected
public final void setSelected(boolean selected) { if (isExclusiveGroupMember()) { boolean oldState = isSelected(); exclusiveController.handleSelectionRequest(this, selected); // set back button state if controller didn't change this command; // needed b/c of natural button check box toggling in swing if (oldState == isSelected()) { Iterator iter = buttonIterator(); while (iter.hasNext()) { AbstractButton button = (AbstractButton)iter.next(); button.setSelected(isSelected()); } } } else { requestSetSelection(selected); } }
java
public final void setSelected(boolean selected) { if (isExclusiveGroupMember()) { boolean oldState = isSelected(); exclusiveController.handleSelectionRequest(this, selected); // set back button state if controller didn't change this command; // needed b/c of natural button check box toggling in swing if (oldState == isSelected()) { Iterator iter = buttonIterator(); while (iter.hasNext()) { AbstractButton button = (AbstractButton)iter.next(); button.setSelected(isSelected()); } } } else { requestSetSelection(selected); } }
[ "public", "final", "void", "setSelected", "(", "boolean", "selected", ")", "{", "if", "(", "isExclusiveGroupMember", "(", ")", ")", "{", "boolean", "oldState", "=", "isSelected", "(", ")", ";", "exclusiveController", ".", "handleSelectionRequest", "(", "this", ",", "selected", ")", ";", "// set back button state if controller didn't change this command;", "// needed b/c of natural button check box toggling in swing", "if", "(", "oldState", "==", "isSelected", "(", ")", ")", "{", "Iterator", "iter", "=", "buttonIterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "AbstractButton", "button", "=", "(", "AbstractButton", ")", "iter", ".", "next", "(", ")", ";", "button", ".", "setSelected", "(", "isSelected", "(", ")", ")", ";", "}", "}", "}", "else", "{", "requestSetSelection", "(", "selected", ")", ";", "}", "}" ]
Set the selection state of the command.
[ "Set", "the", "selection", "state", "of", "the", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ToggleCommand.java#L140-L157
11,866
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ToggleCommand.java
ToggleCommand.requestSetSelection
protected boolean requestSetSelection(boolean selected) { boolean previousState = isSelected(); if (previousState != selected) { this.selected = onSelection(selected); if (logger.isDebugEnabled()) { logger.debug("Toggle command selection returned '" + this.selected + "'"); } } // we must always update toggle buttons Iterator it = buttonIterator(); if (logger.isDebugEnabled()) { logger.debug("Updating all attached toggle buttons to '" + isSelected() + "'"); } while (it.hasNext()) { AbstractButton button = (AbstractButton)it.next(); button.setSelected(isSelected()); } if (previousState != isSelected()) { if (logger.isDebugEnabled()) { logger.debug("Selection changed; firing property change event"); } firePropertyChange(SELECTED_PROPERTY, previousState, isSelected()); } return isSelected(); }
java
protected boolean requestSetSelection(boolean selected) { boolean previousState = isSelected(); if (previousState != selected) { this.selected = onSelection(selected); if (logger.isDebugEnabled()) { logger.debug("Toggle command selection returned '" + this.selected + "'"); } } // we must always update toggle buttons Iterator it = buttonIterator(); if (logger.isDebugEnabled()) { logger.debug("Updating all attached toggle buttons to '" + isSelected() + "'"); } while (it.hasNext()) { AbstractButton button = (AbstractButton)it.next(); button.setSelected(isSelected()); } if (previousState != isSelected()) { if (logger.isDebugEnabled()) { logger.debug("Selection changed; firing property change event"); } firePropertyChange(SELECTED_PROPERTY, previousState, isSelected()); } return isSelected(); }
[ "protected", "boolean", "requestSetSelection", "(", "boolean", "selected", ")", "{", "boolean", "previousState", "=", "isSelected", "(", ")", ";", "if", "(", "previousState", "!=", "selected", ")", "{", "this", ".", "selected", "=", "onSelection", "(", "selected", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Toggle command selection returned '\"", "+", "this", ".", "selected", "+", "\"'\"", ")", ";", "}", "}", "// we must always update toggle buttons", "Iterator", "it", "=", "buttonIterator", "(", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Updating all attached toggle buttons to '\"", "+", "isSelected", "(", ")", "+", "\"'\"", ")", ";", "}", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "AbstractButton", "button", "=", "(", "AbstractButton", ")", "it", ".", "next", "(", ")", ";", "button", ".", "setSelected", "(", "isSelected", "(", ")", ")", ";", "}", "if", "(", "previousState", "!=", "isSelected", "(", ")", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Selection changed; firing property change event\"", ")", ";", "}", "firePropertyChange", "(", "SELECTED_PROPERTY", ",", "previousState", ",", "isSelected", "(", ")", ")", ";", "}", "return", "isSelected", "(", ")", ";", "}" ]
Handles the switching of the selected state. All attached buttons are updated. @param selected select state to set. @return the select state afterwards.
[ "Handles", "the", "switching", "of", "the", "selected", "state", ".", "All", "attached", "buttons", "are", "updated", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/ToggleCommand.java#L165-L193
11,867
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java
AbstractWizard.addPage
protected void addPage(String wizardConfigurationKey, WizardPage page) { pages.add(page); page.setWizard(this); if (autoConfigureChildPages) { String key = ((wizardConfigurationKey != null) ? wizardConfigurationKey + "." : "") + page.getId(); ValkyrieRepository.getInstance().getApplicationConfig().applicationObjectConfigurer().configure(page, key); } }
java
protected void addPage(String wizardConfigurationKey, WizardPage page) { pages.add(page); page.setWizard(this); if (autoConfigureChildPages) { String key = ((wizardConfigurationKey != null) ? wizardConfigurationKey + "." : "") + page.getId(); ValkyrieRepository.getInstance().getApplicationConfig().applicationObjectConfigurer().configure(page, key); } }
[ "protected", "void", "addPage", "(", "String", "wizardConfigurationKey", ",", "WizardPage", "page", ")", "{", "pages", ".", "add", "(", "page", ")", ";", "page", ".", "setWizard", "(", "this", ")", ";", "if", "(", "autoConfigureChildPages", ")", "{", "String", "key", "=", "(", "(", "wizardConfigurationKey", "!=", "null", ")", "?", "wizardConfigurationKey", "+", "\".\"", ":", "\"\"", ")", "+", "page", ".", "getId", "(", ")", ";", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "applicationObjectConfigurer", "(", ")", ".", "configure", "(", "page", ",", "key", ")", ";", "}", "}" ]
Adds a new page to this wizard. The page is inserted at the end of the page list. @param wizardConfigurationKey the parent configuration key of the page, used for configuration, by default this wizard's id * @param page the new page
[ "Adds", "a", "new", "page", "to", "this", "wizard", ".", "The", "page", "is", "inserted", "at", "the", "end", "of", "the", "page", "list", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java#L176-L183
11,868
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java
AbstractWizard.canFinish
public boolean canFinish() { // Default implementation is to check if all pages are complete. for (int i = 0; i < pages.size(); i++) { if (!((WizardPage)pages.get(i)).isPageComplete()) return false; } return true; }
java
public boolean canFinish() { // Default implementation is to check if all pages are complete. for (int i = 0; i < pages.size(); i++) { if (!((WizardPage)pages.get(i)).isPageComplete()) return false; } return true; }
[ "public", "boolean", "canFinish", "(", ")", "{", "// Default implementation is to check if all pages are complete.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pages", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "(", "(", "WizardPage", ")", "pages", ".", "get", "(", "i", ")", ")", ".", "isPageComplete", "(", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns true if all the pages of this wizard have been completed.
[ "Returns", "true", "if", "all", "the", "pages", "of", "this", "wizard", "have", "been", "completed", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java#L225-L232
11,869
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinder.java
AbstractListBinder.doBind
protected final Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context) { AbstractListBinding binding = createListBinding(control, formModel, formPropertyPath); Assert.notNull(binding); applyContext(binding, context); return binding; }
java
protected final Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context) { AbstractListBinding binding = createListBinding(control, formModel, formPropertyPath); Assert.notNull(binding); applyContext(binding, context); return binding; }
[ "protected", "final", "Binding", "doBind", "(", "JComponent", "control", ",", "FormModel", "formModel", ",", "String", "formPropertyPath", ",", "Map", "context", ")", "{", "AbstractListBinding", "binding", "=", "createListBinding", "(", "control", ",", "formModel", ",", "formPropertyPath", ")", ";", "Assert", ".", "notNull", "(", "binding", ")", ";", "applyContext", "(", "binding", ",", "context", ")", ";", "return", "binding", ";", "}" ]
Creates the binding and applies any context values
[ "Creates", "the", "binding", "and", "applies", "any", "context", "values" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinder.java#L173-L178
11,870
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinder.java
AbstractListBinder.applyContext
protected void applyContext(AbstractListBinding binding, Map context) { if (context.containsKey(SELECTABLE_ITEMS_KEY)) { binding.setSelectableItems(decorate(context.get(SELECTABLE_ITEMS_KEY), selectableItems)); } else if (selectableItems != null) { binding.setSelectableItems(selectableItems); } if (context.containsKey(COMPARATOR_KEY)) { binding.setComparator((Comparator) decorate(context.get(COMPARATOR_KEY), comparator)); } else if (comparator != null) { binding.setComparator(comparator); } if (context.containsKey(FILTER_KEY)) { binding.setFilter((Constraint) decorate(context.get(FILTER_KEY), filter)); } else if (filter != null) { binding.setFilter(filter); } }
java
protected void applyContext(AbstractListBinding binding, Map context) { if (context.containsKey(SELECTABLE_ITEMS_KEY)) { binding.setSelectableItems(decorate(context.get(SELECTABLE_ITEMS_KEY), selectableItems)); } else if (selectableItems != null) { binding.setSelectableItems(selectableItems); } if (context.containsKey(COMPARATOR_KEY)) { binding.setComparator((Comparator) decorate(context.get(COMPARATOR_KEY), comparator)); } else if (comparator != null) { binding.setComparator(comparator); } if (context.containsKey(FILTER_KEY)) { binding.setFilter((Constraint) decorate(context.get(FILTER_KEY), filter)); } else if (filter != null) { binding.setFilter(filter); } }
[ "protected", "void", "applyContext", "(", "AbstractListBinding", "binding", ",", "Map", "context", ")", "{", "if", "(", "context", ".", "containsKey", "(", "SELECTABLE_ITEMS_KEY", ")", ")", "{", "binding", ".", "setSelectableItems", "(", "decorate", "(", "context", ".", "get", "(", "SELECTABLE_ITEMS_KEY", ")", ",", "selectableItems", ")", ")", ";", "}", "else", "if", "(", "selectableItems", "!=", "null", ")", "{", "binding", ".", "setSelectableItems", "(", "selectableItems", ")", ";", "}", "if", "(", "context", ".", "containsKey", "(", "COMPARATOR_KEY", ")", ")", "{", "binding", ".", "setComparator", "(", "(", "Comparator", ")", "decorate", "(", "context", ".", "get", "(", "COMPARATOR_KEY", ")", ",", "comparator", ")", ")", ";", "}", "else", "if", "(", "comparator", "!=", "null", ")", "{", "binding", ".", "setComparator", "(", "comparator", ")", ";", "}", "if", "(", "context", ".", "containsKey", "(", "FILTER_KEY", ")", ")", "{", "binding", ".", "setFilter", "(", "(", "Constraint", ")", "decorate", "(", "context", ".", "get", "(", "FILTER_KEY", ")", ",", "filter", ")", ")", ";", "}", "else", "if", "(", "filter", "!=", "null", ")", "{", "binding", ".", "setFilter", "(", "filter", ")", ";", "}", "}" ]
Applies any context or preset value. @param binding the binding to apply the values @param context contains context dependent values
[ "Applies", "any", "context", "or", "preset", "value", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinder.java#L202-L218
11,871
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-vldocking-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/InitialView.java
InitialView.createControl
protected JComponent createControl() { // In this view, we're just going to use standard Swing to place a // few controls. // The location of the text to display has been set as a Resource in the // property descriptionTextPath. So, use that resource to obtain a URL // and set that as the page for the text pane. JTextPane textPane = new JTextPane(); JScrollPane spDescription = getApplicationConfig().componentFactory().createScrollPane(textPane); try { textPane.setPage(getDescriptionTextPath().getURL()); } catch (IOException e) { throw new RuntimeException("Unable to load description URL", e); } JLabel lblMessage = getApplicationConfig().componentFactory().createLabel(getFirstMessage()); lblMessage.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel panel = getApplicationConfig().componentFactory().createPanel(new BorderLayout()); panel.add(spDescription); panel.add(lblMessage, BorderLayout.SOUTH); return panel; }
java
protected JComponent createControl() { // In this view, we're just going to use standard Swing to place a // few controls. // The location of the text to display has been set as a Resource in the // property descriptionTextPath. So, use that resource to obtain a URL // and set that as the page for the text pane. JTextPane textPane = new JTextPane(); JScrollPane spDescription = getApplicationConfig().componentFactory().createScrollPane(textPane); try { textPane.setPage(getDescriptionTextPath().getURL()); } catch (IOException e) { throw new RuntimeException("Unable to load description URL", e); } JLabel lblMessage = getApplicationConfig().componentFactory().createLabel(getFirstMessage()); lblMessage.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel panel = getApplicationConfig().componentFactory().createPanel(new BorderLayout()); panel.add(spDescription); panel.add(lblMessage, BorderLayout.SOUTH); return panel; }
[ "protected", "JComponent", "createControl", "(", ")", "{", "// In this view, we're just going to use standard Swing to place a", "// few controls.", "// The location of the text to display has been set as a Resource in the", "// property descriptionTextPath. So, use that resource to obtain a URL", "// and set that as the page for the text pane.", "JTextPane", "textPane", "=", "new", "JTextPane", "(", ")", ";", "JScrollPane", "spDescription", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createScrollPane", "(", "textPane", ")", ";", "try", "{", "textPane", ".", "setPage", "(", "getDescriptionTextPath", "(", ")", ".", "getURL", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to load description URL\"", ",", "e", ")", ";", "}", "JLabel", "lblMessage", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createLabel", "(", "getFirstMessage", "(", ")", ")", ";", "lblMessage", ".", "setBorder", "(", "BorderFactory", ".", "createEmptyBorder", "(", "5", ",", "0", ",", "5", ",", "0", ")", ")", ";", "JPanel", "panel", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "panel", ".", "add", "(", "spDescription", ")", ";", "panel", ".", "add", "(", "lblMessage", ",", "BorderLayout", ".", "SOUTH", ")", ";", "return", "panel", ";", "}" ]
Create the actual UI control for this view. It will be placed into the window according to the layout of the page holding this view.
[ "Create", "the", "actual", "UI", "control", "for", "this", "view", ".", "It", "will", "be", "placed", "into", "the", "window", "according", "to", "the", "layout", "of", "the", "page", "holding", "this", "view", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-vldocking-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/InitialView.java#L104-L129
11,872
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/JXErrorDialogExceptionHandler.java
JXErrorDialogExceptionHandler.escapeXml
private static String escapeXml(String input) { return input == null ? "" : input.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"); }
java
private static String escapeXml(String input) { return input == null ? "" : input.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"); }
[ "private", "static", "String", "escapeXml", "(", "String", "input", ")", "{", "return", "input", "==", "null", "?", "\"\"", ":", "input", ".", "replace", "(", "\"&\"", ",", "\"&amp;\"", ")", ".", "replace", "(", "\"<\"", ",", "\"&lt;\"", ")", ".", "replace", "(", "\">\"", ",", "\"&gt;\"", ")", ";", "}" ]
Converts the incoming string to an escaped output string. This method is far from perfect, only escaping &lt;, &gt; and &amp; characters
[ "Converts", "the", "incoming", "string", "to", "an", "escaped", "output", "string", ".", "This", "method", "is", "far", "from", "perfect", "only", "escaping", "&lt", ";", "&gt", ";", "and", "&amp", ";", "characters" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/exceptionhandling/JXErrorDialogExceptionHandler.java#L82-L84
11,873
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/view/JideViewDescriptor.java
JideViewDescriptor.compareTo
public int compareTo(Object o) { ViewDescriptor castObj = (ViewDescriptor)o; return this.getDisplayName().compareToIgnoreCase(castObj.getDisplayName()); }
java
public int compareTo(Object o) { ViewDescriptor castObj = (ViewDescriptor)o; return this.getDisplayName().compareToIgnoreCase(castObj.getDisplayName()); }
[ "public", "int", "compareTo", "(", "Object", "o", ")", "{", "ViewDescriptor", "castObj", "=", "(", "ViewDescriptor", ")", "o", ";", "return", "this", ".", "getDisplayName", "(", ")", ".", "compareToIgnoreCase", "(", "castObj", ".", "getDisplayName", "(", ")", ")", ";", "}" ]
Compares the display names of the view descriptors
[ "Compares", "the", "display", "names", "of", "the", "view", "descriptors" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/view/JideViewDescriptor.java#L221-L224
11,874
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java
SwingUtils.runInEventDispatcherThread
public static void runInEventDispatcherThread(Runnable runnable, Boolean wait) { Assert.notNull(runnable, "runnable"); Assert.notNull(wait, "wait"); if (EventQueue.isDispatchThread()) { runnable.run(); } else if (wait) { try { EventQueue.invokeAndWait(runnable); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } else { EventQueue.invokeLater(runnable); } }
java
public static void runInEventDispatcherThread(Runnable runnable, Boolean wait) { Assert.notNull(runnable, "runnable"); Assert.notNull(wait, "wait"); if (EventQueue.isDispatchThread()) { runnable.run(); } else if (wait) { try { EventQueue.invokeAndWait(runnable); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } else { EventQueue.invokeLater(runnable); } }
[ "public", "static", "void", "runInEventDispatcherThread", "(", "Runnable", "runnable", ",", "Boolean", "wait", ")", "{", "Assert", ".", "notNull", "(", "runnable", ",", "\"runnable\"", ")", ";", "Assert", ".", "notNull", "(", "wait", ",", "\"wait\"", ")", ";", "if", "(", "EventQueue", ".", "isDispatchThread", "(", ")", ")", "{", "runnable", ".", "run", "(", ")", ";", "}", "else", "if", "(", "wait", ")", "{", "try", "{", "EventQueue", ".", "invokeAndWait", "(", "runnable", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "else", "{", "EventQueue", ".", "invokeLater", "(", "runnable", ")", ";", "}", "}" ]
Ensures the given runnable is executed into the event dispatcher thread. @param runnable the runnable. @param wait whether should wait until execution is completed.
[ "Ensures", "the", "given", "runnable", "is", "executed", "into", "the", "event", "dispatcher", "thread", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java#L61-L79
11,875
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java
SwingUtils.getDescendantNamed
public static Component getDescendantNamed(String name, Component parent) { Assert.notNull(name, "name"); Assert.notNull(parent, "parent"); if (name.equals(parent.getName())) { // Base case return parent; } else if (parent instanceof Container) { // Recursive case for (final Component component : ((Container) parent).getComponents()) { final Component foundComponent = SwingUtils.getDescendantNamed(name, component); if (foundComponent != null) { return foundComponent; } } } return null; }
java
public static Component getDescendantNamed(String name, Component parent) { Assert.notNull(name, "name"); Assert.notNull(parent, "parent"); if (name.equals(parent.getName())) { // Base case return parent; } else if (parent instanceof Container) { // Recursive case for (final Component component : ((Container) parent).getComponents()) { final Component foundComponent = SwingUtils.getDescendantNamed(name, component); if (foundComponent != null) { return foundComponent; } } } return null; }
[ "public", "static", "Component", "getDescendantNamed", "(", "String", "name", ",", "Component", "parent", ")", "{", "Assert", ".", "notNull", "(", "name", ",", "\"name\"", ")", ";", "Assert", ".", "notNull", "(", "parent", ",", "\"parent\"", ")", ";", "if", "(", "name", ".", "equals", "(", "parent", ".", "getName", "(", ")", ")", ")", "{", "// Base case", "return", "parent", ";", "}", "else", "if", "(", "parent", "instanceof", "Container", ")", "{", "// Recursive case", "for", "(", "final", "Component", "component", ":", "(", "(", "Container", ")", "parent", ")", ".", "getComponents", "(", ")", ")", "{", "final", "Component", "foundComponent", "=", "SwingUtils", ".", "getDescendantNamed", "(", "name", ",", "component", ")", ";", "if", "(", "foundComponent", "!=", "null", ")", "{", "return", "foundComponent", ";", "}", "}", "}", "return", "null", ";", "}" ]
Does a pre-order search of a component with a given name. @param name the name. @param parent the root component in hierarchy. @return the found component (may be null).
[ "Does", "a", "pre", "-", "order", "search", "of", "a", "component", "with", "a", "given", "name", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java#L90-L109
11,876
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java
SwingUtils.generateComponent
public static JComponent generateComponent(Image image) { if (image == null) { return new LabelUIResource("Image is null"); } return SwingUtils.generateComponent(new ImageIcon(image)); }
java
public static JComponent generateComponent(Image image) { if (image == null) { return new LabelUIResource("Image is null"); } return SwingUtils.generateComponent(new ImageIcon(image)); }
[ "public", "static", "JComponent", "generateComponent", "(", "Image", "image", ")", "{", "if", "(", "image", "==", "null", ")", "{", "return", "new", "LabelUIResource", "(", "\"Image is null\"", ")", ";", "}", "return", "SwingUtils", ".", "generateComponent", "(", "new", "ImageIcon", "(", "image", ")", ")", ";", "}" ]
Generates a component to view an image. @param image the image. @return the component.
[ "Generates", "a", "component", "to", "view", "an", "image", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java#L118-L125
11,877
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java
LookupBinding.createFocusListener
protected FocusListener createFocusListener() { return new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String textFieldValue = getKeyComponentText(); boolean empty = "".equals(textFieldValue.trim()); Object ref = LookupBinding.this.getValue(); if (evaluateFocusLost(e)) { // Revert if value isn't empty if (revertValueOnFocusLost()) { if (empty) getValueModel().setValue(null); else valueModelChanged(LookupBinding.super.getValue()); } // Create new referable if value isn't empty else { if (empty && (ref != null)) getValueModel().setValue(null); else if (!empty && ((ref == null) || !textFieldValue.equals(getObjectLabel(ref)))) getValueModel().setValue(createFilterFromString(textFieldValue)); } } } }; }
java
protected FocusListener createFocusListener() { return new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String textFieldValue = getKeyComponentText(); boolean empty = "".equals(textFieldValue.trim()); Object ref = LookupBinding.this.getValue(); if (evaluateFocusLost(e)) { // Revert if value isn't empty if (revertValueOnFocusLost()) { if (empty) getValueModel().setValue(null); else valueModelChanged(LookupBinding.super.getValue()); } // Create new referable if value isn't empty else { if (empty && (ref != null)) getValueModel().setValue(null); else if (!empty && ((ref == null) || !textFieldValue.equals(getObjectLabel(ref)))) getValueModel().setValue(createFilterFromString(textFieldValue)); } } } }; }
[ "protected", "FocusListener", "createFocusListener", "(", ")", "{", "return", "new", "FocusAdapter", "(", ")", "{", "@", "Override", "public", "void", "focusLost", "(", "FocusEvent", "e", ")", "{", "String", "textFieldValue", "=", "getKeyComponentText", "(", ")", ";", "boolean", "empty", "=", "\"\"", ".", "equals", "(", "textFieldValue", ".", "trim", "(", ")", ")", ";", "Object", "ref", "=", "LookupBinding", ".", "this", ".", "getValue", "(", ")", ";", "if", "(", "evaluateFocusLost", "(", "e", ")", ")", "{", "// Revert if value isn't empty", "if", "(", "revertValueOnFocusLost", "(", ")", ")", "{", "if", "(", "empty", ")", "getValueModel", "(", ")", ".", "setValue", "(", "null", ")", ";", "else", "valueModelChanged", "(", "LookupBinding", ".", "super", ".", "getValue", "(", ")", ")", ";", "}", "// Create new referable if value isn't empty", "else", "{", "if", "(", "empty", "&&", "(", "ref", "!=", "null", ")", ")", "getValueModel", "(", ")", ".", "setValue", "(", "null", ")", ";", "else", "if", "(", "!", "empty", "&&", "(", "(", "ref", "==", "null", ")", "||", "!", "textFieldValue", ".", "equals", "(", "getObjectLabel", "(", "ref", ")", ")", ")", ")", "getValueModel", "(", ")", ".", "setValue", "(", "createFilterFromString", "(", "textFieldValue", ")", ")", ";", "}", "}", "}", "}", ";", "}" ]
Create a focus listener to attach to the textComponent and dataEditorButton that will decide what happens with the changed value. Here a revert can be done if no value is selected or a new value can be created as needed. @return a focus listener.
[ "Create", "a", "focus", "listener", "to", "attach", "to", "the", "textComponent", "and", "dataEditorButton", "that", "will", "decide", "what", "happens", "with", "the", "changed", "value", ".", "Here", "a", "revert", "can", "be", "done", "if", "no", "value", "is", "selected", "or", "a", "new", "value", "can", "be", "created", "as", "needed", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java#L427-L455
11,878
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java
LookupBinding.initializeDataEditor
protected Object initializeDataEditor() { final String textFieldValue = getKeyComponentText(); Object ref = super.getValue(); if ((ref != null) && textFieldValue.equals(getObjectLabel(ref))) return getDataEditor().setSelectedSearch(ref); return getDataEditor().setSelectedSearch(createFilterFromString(textFieldValue)); }
java
protected Object initializeDataEditor() { final String textFieldValue = getKeyComponentText(); Object ref = super.getValue(); if ((ref != null) && textFieldValue.equals(getObjectLabel(ref))) return getDataEditor().setSelectedSearch(ref); return getDataEditor().setSelectedSearch(createFilterFromString(textFieldValue)); }
[ "protected", "Object", "initializeDataEditor", "(", ")", "{", "final", "String", "textFieldValue", "=", "getKeyComponentText", "(", ")", ";", "Object", "ref", "=", "super", ".", "getValue", "(", ")", ";", "if", "(", "(", "ref", "!=", "null", ")", "&&", "textFieldValue", ".", "equals", "(", "getObjectLabel", "(", "ref", ")", ")", ")", "return", "getDataEditor", "(", ")", ".", "setSelectedSearch", "(", "ref", ")", ";", "return", "getDataEditor", "(", ")", ".", "setSelectedSearch", "(", "createFilterFromString", "(", "textFieldValue", ")", ")", ";", "}" ]
Initialize the dataEditor by passing the search referable as search parameter. @return a single object if the search has an unique match, a list if multiple matches occurred or <code>null</code> if nothing was found.
[ "Initialize", "the", "dataEditor", "by", "passing", "the", "search", "referable", "as", "search", "parameter", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java#L482-L489
11,879
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java
LookupBinding.createDataEditorCommand
protected ActionCommand createDataEditorCommand() { ActionCommand selectDialogCommand = new ActionCommand(getSelectDialogCommandId()) { private ApplicationDialog dataEditorDialog; @Override protected void doExecuteCommand() { if (LookupBinding.this.propertyChangeMonitor.proceedOnChange()) { if (dataEditorDialog == null) { dataEditorDialog = new TitledWidgetApplicationDialog(getDataEditor(), TitledWidgetApplicationDialog.SELECT_CANCEL_MODE) { protected boolean onFinish() { if (getDataEditor().canClose()) return LookupBinding.this.onFinish(); return false; } @Override protected boolean onSelectNone() { getDataEditor().getTableWidget().unSelectAll(); return super.onSelectNone(); } @Override protected void onCancel() { if (getDataEditor().canClose()) super.onCancel(); } }; dataEditorDialog.setParentComponent(getDataEditorButton()); getDataEditor().setSelectMode(AbstractDataEditorWidget.ON); getApplicationConfig().applicationObjectConfigurer().configure(dataEditorDialog, getSelectDialogId()); } if (getParameter(NO_INITIALIZE_DATA_EDITOR) != ON) initializeDataEditor(); if (getDialogSize() != null) { dataEditorDialog.getDialog().setMinimumSize(getDialogSize()); } dataEditorDialog.showDialog(); } } }; getApplicationConfig().commandConfigurer().configure(selectDialogCommand); return selectDialogCommand; }
java
protected ActionCommand createDataEditorCommand() { ActionCommand selectDialogCommand = new ActionCommand(getSelectDialogCommandId()) { private ApplicationDialog dataEditorDialog; @Override protected void doExecuteCommand() { if (LookupBinding.this.propertyChangeMonitor.proceedOnChange()) { if (dataEditorDialog == null) { dataEditorDialog = new TitledWidgetApplicationDialog(getDataEditor(), TitledWidgetApplicationDialog.SELECT_CANCEL_MODE) { protected boolean onFinish() { if (getDataEditor().canClose()) return LookupBinding.this.onFinish(); return false; } @Override protected boolean onSelectNone() { getDataEditor().getTableWidget().unSelectAll(); return super.onSelectNone(); } @Override protected void onCancel() { if (getDataEditor().canClose()) super.onCancel(); } }; dataEditorDialog.setParentComponent(getDataEditorButton()); getDataEditor().setSelectMode(AbstractDataEditorWidget.ON); getApplicationConfig().applicationObjectConfigurer().configure(dataEditorDialog, getSelectDialogId()); } if (getParameter(NO_INITIALIZE_DATA_EDITOR) != ON) initializeDataEditor(); if (getDialogSize() != null) { dataEditorDialog.getDialog().setMinimumSize(getDialogSize()); } dataEditorDialog.showDialog(); } } }; getApplicationConfig().commandConfigurer().configure(selectDialogCommand); return selectDialogCommand; }
[ "protected", "ActionCommand", "createDataEditorCommand", "(", ")", "{", "ActionCommand", "selectDialogCommand", "=", "new", "ActionCommand", "(", "getSelectDialogCommandId", "(", ")", ")", "{", "private", "ApplicationDialog", "dataEditorDialog", ";", "@", "Override", "protected", "void", "doExecuteCommand", "(", ")", "{", "if", "(", "LookupBinding", ".", "this", ".", "propertyChangeMonitor", ".", "proceedOnChange", "(", ")", ")", "{", "if", "(", "dataEditorDialog", "==", "null", ")", "{", "dataEditorDialog", "=", "new", "TitledWidgetApplicationDialog", "(", "getDataEditor", "(", ")", ",", "TitledWidgetApplicationDialog", ".", "SELECT_CANCEL_MODE", ")", "{", "protected", "boolean", "onFinish", "(", ")", "{", "if", "(", "getDataEditor", "(", ")", ".", "canClose", "(", ")", ")", "return", "LookupBinding", ".", "this", ".", "onFinish", "(", ")", ";", "return", "false", ";", "}", "@", "Override", "protected", "boolean", "onSelectNone", "(", ")", "{", "getDataEditor", "(", ")", ".", "getTableWidget", "(", ")", ".", "unSelectAll", "(", ")", ";", "return", "super", ".", "onSelectNone", "(", ")", ";", "}", "@", "Override", "protected", "void", "onCancel", "(", ")", "{", "if", "(", "getDataEditor", "(", ")", ".", "canClose", "(", ")", ")", "super", ".", "onCancel", "(", ")", ";", "}", "}", ";", "dataEditorDialog", ".", "setParentComponent", "(", "getDataEditorButton", "(", ")", ")", ";", "getDataEditor", "(", ")", ".", "setSelectMode", "(", "AbstractDataEditorWidget", ".", "ON", ")", ";", "getApplicationConfig", "(", ")", ".", "applicationObjectConfigurer", "(", ")", ".", "configure", "(", "dataEditorDialog", ",", "getSelectDialogId", "(", ")", ")", ";", "}", "if", "(", "getParameter", "(", "NO_INITIALIZE_DATA_EDITOR", ")", "!=", "ON", ")", "initializeDataEditor", "(", ")", ";", "if", "(", "getDialogSize", "(", ")", "!=", "null", ")", "{", "dataEditorDialog", ".", "getDialog", "(", ")", ".", "setMinimumSize", "(", "getDialogSize", "(", ")", ")", ";", "}", "dataEditorDialog", ".", "showDialog", "(", ")", ";", "}", "}", "}", ";", "getApplicationConfig", "(", ")", ".", "commandConfigurer", "(", ")", ".", "configure", "(", "selectDialogCommand", ")", ";", "return", "selectDialogCommand", ";", "}" ]
Create the dataEditorCommand.
[ "Create", "the", "dataEditorCommand", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/editor/LookupBinding.java#L529-L574
11,880
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java
MessageSourceFieldFaceSource.getMessage
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperties, String defaultValue) { String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperties); try { return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, defaultValue)); } catch (NoSuchMessageException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } return null; } }
java
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperties, String defaultValue) { String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperties); try { return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, defaultValue)); } catch (NoSuchMessageException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } return null; } }
[ "protected", "String", "getMessage", "(", "String", "contextId", ",", "String", "fieldPath", ",", "String", "[", "]", "faceDescriptorProperties", ",", "String", "defaultValue", ")", "{", "String", "[", "]", "keys", "=", "getMessageKeys", "(", "contextId", ",", "fieldPath", ",", "faceDescriptorProperties", ")", ";", "try", "{", "return", "getMessageSourceAccessor", "(", ")", ".", "getMessage", "(", "new", "DefaultMessageSourceResolvable", "(", "keys", ",", "null", ",", "defaultValue", ")", ")", ";", "}", "catch", "(", "NoSuchMessageException", "e", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "}" ]
Returns the value of the required property of the FieldFace. Delegates to the getMessageKeys for the message key generation strategy.
[ "Returns", "the", "value", "of", "the", "required", "property", "of", "the", "FieldFace", ".", "Delegates", "to", "the", "getMessageKeys", "for", "the", "message", "key", "generation", "strategy", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java#L122-L133
11,881
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/ProgressMonitoringBeanFactoryPostProcessor.java
ProgressMonitoringBeanFactoryPostProcessor.postProcessBeanFactory
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { if (beanFactory == null) { return; } String[] beanNames = beanFactory.getBeanDefinitionNames(); int singletonBeanCount = 0; for (int i = 0; i < beanNames.length; i++) { // using beanDefinition to check singleton property because when // accessing through // context (applicationContext.isSingleton(beanName)), bean will be // created already, // possibly bypassing other BeanFactoryPostProcessors BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanNames[i]); if (beanDefinition.isSingleton()) { singletonBeanCount++; } } this.progressMonitor.taskStarted(this.loadingAppContextMessage, singletonBeanCount); beanFactory.addBeanPostProcessor(new ProgressMonitoringBeanPostProcessor(beanFactory)); }
java
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { if (beanFactory == null) { return; } String[] beanNames = beanFactory.getBeanDefinitionNames(); int singletonBeanCount = 0; for (int i = 0; i < beanNames.length; i++) { // using beanDefinition to check singleton property because when // accessing through // context (applicationContext.isSingleton(beanName)), bean will be // created already, // possibly bypassing other BeanFactoryPostProcessors BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanNames[i]); if (beanDefinition.isSingleton()) { singletonBeanCount++; } } this.progressMonitor.taskStarted(this.loadingAppContextMessage, singletonBeanCount); beanFactory.addBeanPostProcessor(new ProgressMonitoringBeanPostProcessor(beanFactory)); }
[ "public", "void", "postProcessBeanFactory", "(", "final", "ConfigurableListableBeanFactory", "beanFactory", ")", "throws", "BeansException", "{", "if", "(", "beanFactory", "==", "null", ")", "{", "return", ";", "}", "String", "[", "]", "beanNames", "=", "beanFactory", ".", "getBeanDefinitionNames", "(", ")", ";", "int", "singletonBeanCount", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "beanNames", ".", "length", ";", "i", "++", ")", "{", "// using beanDefinition to check singleton property because when", "// accessing through", "// context (applicationContext.isSingleton(beanName)), bean will be", "// created already,", "// possibly bypassing other BeanFactoryPostProcessors", "BeanDefinition", "beanDefinition", "=", "beanFactory", ".", "getBeanDefinition", "(", "beanNames", "[", "i", "]", ")", ";", "if", "(", "beanDefinition", ".", "isSingleton", "(", ")", ")", "{", "singletonBeanCount", "++", ";", "}", "}", "this", ".", "progressMonitor", ".", "taskStarted", "(", "this", ".", "loadingAppContextMessage", ",", "singletonBeanCount", ")", ";", "beanFactory", ".", "addBeanPostProcessor", "(", "new", "ProgressMonitoringBeanPostProcessor", "(", "beanFactory", ")", ")", ";", "}" ]
Notifies this instance's associated progress monitor of progress made while processing the given bean factory. @param beanFactory the bean factory that is to be processed.
[ "Notifies", "this", "instance", "s", "associated", "progress", "monitor", "of", "progress", "made", "while", "processing", "the", "given", "bean", "factory", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/ProgressMonitoringBeanFactoryPostProcessor.java#L102-L129
11,882
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java
AbstractDataEditorWidget.setSearchString
public void setSearchString(String queryString) { this.searchString = queryString; if (this.textFilterField != null) { this.textFilterField.setText(this.searchString); } }
java
public void setSearchString(String queryString) { this.searchString = queryString; if (this.textFilterField != null) { this.textFilterField.setText(this.searchString); } }
[ "public", "void", "setSearchString", "(", "String", "queryString", ")", "{", "this", ".", "searchString", "=", "queryString", ";", "if", "(", "this", ".", "textFilterField", "!=", "null", ")", "{", "this", ".", "textFilterField", ".", "setText", "(", "this", ".", "searchString", ")", ";", "}", "}" ]
Set the local text filter field value @param queryString filterText.
[ "Set", "the", "local", "text", "filter", "field", "value" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java#L206-L213
11,883
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java
AbstractDataEditorWidget.createUpdateCommand
protected ActionCommand createUpdateCommand() { ActionCommand command = new ActionCommand(UPDATE_COMMAND_ID) { @Override protected void doExecuteCommand() { doUpdate(); } }; command.setSecurityControllerId(getId() + "." + UPDATE_COMMAND_ID); getApplicationConfig().commandConfigurer().configure(command); getDetailForm().addGuarded(command, FormGuard.LIKE_COMMITCOMMAND); return command; }
java
protected ActionCommand createUpdateCommand() { ActionCommand command = new ActionCommand(UPDATE_COMMAND_ID) { @Override protected void doExecuteCommand() { doUpdate(); } }; command.setSecurityControllerId(getId() + "." + UPDATE_COMMAND_ID); getApplicationConfig().commandConfigurer().configure(command); getDetailForm().addGuarded(command, FormGuard.LIKE_COMMITCOMMAND); return command; }
[ "protected", "ActionCommand", "createUpdateCommand", "(", ")", "{", "ActionCommand", "command", "=", "new", "ActionCommand", "(", "UPDATE_COMMAND_ID", ")", "{", "@", "Override", "protected", "void", "doExecuteCommand", "(", ")", "{", "doUpdate", "(", ")", ";", "}", "}", ";", "command", ".", "setSecurityControllerId", "(", "getId", "(", ")", "+", "\".\"", "+", "UPDATE_COMMAND_ID", ")", ";", "getApplicationConfig", "(", ")", ".", "commandConfigurer", "(", ")", ".", "configure", "(", "command", ")", ";", "getDetailForm", "(", ")", ".", "addGuarded", "(", "command", ",", "FormGuard", ".", "LIKE_COMMITCOMMAND", ")", ";", "return", "command", ";", "}" ]
Creates the save command. @see #doUpdate()
[ "Creates", "the", "save", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java#L471-L486
11,884
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java
AbstractDataEditorWidget.createCreateCommand
protected ActionCommand createCreateCommand() { ActionCommand command = new ActionCommand(CREATE_COMMAND_ID) { @Override protected void doExecuteCommand() { doCreate(); } }; command.setSecurityControllerId(getId() + "." + CREATE_COMMAND_ID); getApplicationConfig().commandConfigurer().configure(command); getDetailForm().addGuarded(command, FormGuard.LIKE_COMMITCOMMAND); return command; }
java
protected ActionCommand createCreateCommand() { ActionCommand command = new ActionCommand(CREATE_COMMAND_ID) { @Override protected void doExecuteCommand() { doCreate(); } }; command.setSecurityControllerId(getId() + "." + CREATE_COMMAND_ID); getApplicationConfig().commandConfigurer().configure(command); getDetailForm().addGuarded(command, FormGuard.LIKE_COMMITCOMMAND); return command; }
[ "protected", "ActionCommand", "createCreateCommand", "(", ")", "{", "ActionCommand", "command", "=", "new", "ActionCommand", "(", "CREATE_COMMAND_ID", ")", "{", "@", "Override", "protected", "void", "doExecuteCommand", "(", ")", "{", "doCreate", "(", ")", ";", "}", "}", ";", "command", ".", "setSecurityControllerId", "(", "getId", "(", ")", "+", "\".\"", "+", "CREATE_COMMAND_ID", ")", ";", "getApplicationConfig", "(", ")", ".", "commandConfigurer", "(", ")", ".", "configure", "(", "command", ")", ";", "getDetailForm", "(", ")", ".", "addGuarded", "(", "command", ",", "FormGuard", ".", "LIKE_COMMITCOMMAND", ")", ";", "return", "command", ";", "}" ]
Creates the create command. @see #doCreate()
[ "Creates", "the", "create", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java#L537-L552
11,885
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java
AbstractDataEditorWidget.getTablePopupMenuCommandGroup
protected CommandGroup getTablePopupMenuCommandGroup() { return getApplicationConfig().commandManager().createCommandGroup(Lists.newArrayList(getEditRowCommand(), "separator", getAddRowCommand(), getCloneRowCommand(), getRemoveRowsCommand(), "separator", getRefreshCommand(), "separator", getCopySelectedRowsToClipboardCommand())); }
java
protected CommandGroup getTablePopupMenuCommandGroup() { return getApplicationConfig().commandManager().createCommandGroup(Lists.newArrayList(getEditRowCommand(), "separator", getAddRowCommand(), getCloneRowCommand(), getRemoveRowsCommand(), "separator", getRefreshCommand(), "separator", getCopySelectedRowsToClipboardCommand())); }
[ "protected", "CommandGroup", "getTablePopupMenuCommandGroup", "(", ")", "{", "return", "getApplicationConfig", "(", ")", ".", "commandManager", "(", ")", ".", "createCommandGroup", "(", "Lists", ".", "newArrayList", "(", "getEditRowCommand", "(", ")", ",", "\"separator\"", ",", "getAddRowCommand", "(", ")", ",", "getCloneRowCommand", "(", ")", ",", "getRemoveRowsCommand", "(", ")", ",", "\"separator\"", ",", "getRefreshCommand", "(", ")", ",", "\"separator\"", ",", "getCopySelectedRowsToClipboardCommand", "(", ")", ")", ")", ";", "}" ]
Returns the commandGroup that should be used to create the popup menu for the table.
[ "Returns", "the", "commandGroup", "that", "should", "be", "used", "to", "create", "the", "popup", "menu", "for", "the", "table", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/AbstractDataEditorWidget.java#L703-L708
11,886
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/WorkspaceView.java
WorkspaceView.fireFocusGainedOnActiveComponent
public void fireFocusGainedOnActiveComponent(){ String documentName = contentPane.getActiveDocumentName(); if(documentName != null){ PageComponent component = (PageComponent)pageComponentMap.get(documentName); JideApplicationPage page = (JideApplicationPage)getActiveWindow().getPage(); page.fireFocusGained(component); } }
java
public void fireFocusGainedOnActiveComponent(){ String documentName = contentPane.getActiveDocumentName(); if(documentName != null){ PageComponent component = (PageComponent)pageComponentMap.get(documentName); JideApplicationPage page = (JideApplicationPage)getActiveWindow().getPage(); page.fireFocusGained(component); } }
[ "public", "void", "fireFocusGainedOnActiveComponent", "(", ")", "{", "String", "documentName", "=", "contentPane", ".", "getActiveDocumentName", "(", ")", ";", "if", "(", "documentName", "!=", "null", ")", "{", "PageComponent", "component", "=", "(", "PageComponent", ")", "pageComponentMap", ".", "get", "(", "documentName", ")", ";", "JideApplicationPage", "page", "=", "(", "JideApplicationPage", ")", "getActiveWindow", "(", ")", ".", "getPage", "(", ")", ";", "page", ".", "fireFocusGained", "(", "component", ")", ";", "}", "}" ]
This is a bit of a hack to get over a limitation in the JIDE docking framework. When focus is regained to the workspace by activation the currently activated document the documentComponentActivated is not fired. This needs to be fired when we know the workspace has become active. For some reason it dosen't work when using the componentFocusGained method
[ "This", "is", "a", "bit", "of", "a", "hack", "to", "get", "over", "a", "limitation", "in", "the", "JIDE", "docking", "framework", ".", "When", "focus", "is", "regained", "to", "the", "workspace", "by", "activation", "the", "currently", "activated", "document", "the", "documentComponentActivated", "is", "not", "fired", ".", "This", "needs", "to", "be", "fired", "when", "we", "know", "the", "workspace", "has", "become", "active", ".", "For", "some", "reason", "it", "dosen", "t", "work", "when", "using", "the", "componentFocusGained", "method" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/WorkspaceView.java#L245-L252
11,887
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/WorkspaceView.java
WorkspaceView.addDocumentComponent
public void addDocumentComponent(final PageComponent pageComponent, boolean activateAfterOpen){ String id = pageComponent.getId(); if(!closeAndReopenEditor && contentPane.getDocument(id) != null){ contentPane.setActiveDocument(id); } else{ if(contentPane.getDocument(id) != null){ contentPane.closeDocument(id); } DocumentComponent document = constructDocumentComponent(pageComponent); DocumentComponentListener lifecycleListener = constructLifecycleListener(pageComponent); document.addDocumentComponentListener(lifecycleListener); if(contentPane.getDocument(id) == null){ contentPane.openDocument(document); } if(activateAfterOpen){ contentPane.setActiveDocument(id); } registerDropTargetListeners(pageComponent.getControl()); // This listener ensures that the focus is transfered to the workspace // itself if the number of documents becomes zero. document.addDocumentComponentListener(new DocumentComponentAdapter(){ public void documentComponentClosed(DocumentComponentEvent event) { int count = contentPane.getDocumentCount(); if(count == 0){ fireFocusGainedOnWorkspace(); } } }); pageComponentMap.put(id, pageComponent); } }
java
public void addDocumentComponent(final PageComponent pageComponent, boolean activateAfterOpen){ String id = pageComponent.getId(); if(!closeAndReopenEditor && contentPane.getDocument(id) != null){ contentPane.setActiveDocument(id); } else{ if(contentPane.getDocument(id) != null){ contentPane.closeDocument(id); } DocumentComponent document = constructDocumentComponent(pageComponent); DocumentComponentListener lifecycleListener = constructLifecycleListener(pageComponent); document.addDocumentComponentListener(lifecycleListener); if(contentPane.getDocument(id) == null){ contentPane.openDocument(document); } if(activateAfterOpen){ contentPane.setActiveDocument(id); } registerDropTargetListeners(pageComponent.getControl()); // This listener ensures that the focus is transfered to the workspace // itself if the number of documents becomes zero. document.addDocumentComponentListener(new DocumentComponentAdapter(){ public void documentComponentClosed(DocumentComponentEvent event) { int count = contentPane.getDocumentCount(); if(count == 0){ fireFocusGainedOnWorkspace(); } } }); pageComponentMap.put(id, pageComponent); } }
[ "public", "void", "addDocumentComponent", "(", "final", "PageComponent", "pageComponent", ",", "boolean", "activateAfterOpen", ")", "{", "String", "id", "=", "pageComponent", ".", "getId", "(", ")", ";", "if", "(", "!", "closeAndReopenEditor", "&&", "contentPane", ".", "getDocument", "(", "id", ")", "!=", "null", ")", "{", "contentPane", ".", "setActiveDocument", "(", "id", ")", ";", "}", "else", "{", "if", "(", "contentPane", ".", "getDocument", "(", "id", ")", "!=", "null", ")", "{", "contentPane", ".", "closeDocument", "(", "id", ")", ";", "}", "DocumentComponent", "document", "=", "constructDocumentComponent", "(", "pageComponent", ")", ";", "DocumentComponentListener", "lifecycleListener", "=", "constructLifecycleListener", "(", "pageComponent", ")", ";", "document", ".", "addDocumentComponentListener", "(", "lifecycleListener", ")", ";", "if", "(", "contentPane", ".", "getDocument", "(", "id", ")", "==", "null", ")", "{", "contentPane", ".", "openDocument", "(", "document", ")", ";", "}", "if", "(", "activateAfterOpen", ")", "{", "contentPane", ".", "setActiveDocument", "(", "id", ")", ";", "}", "registerDropTargetListeners", "(", "pageComponent", ".", "getControl", "(", ")", ")", ";", "// This listener ensures that the focus is transfered to the workspace", "//\titself if the number of documents becomes zero.", "document", ".", "addDocumentComponentListener", "(", "new", "DocumentComponentAdapter", "(", ")", "{", "public", "void", "documentComponentClosed", "(", "DocumentComponentEvent", "event", ")", "{", "int", "count", "=", "contentPane", ".", "getDocumentCount", "(", ")", ";", "if", "(", "count", "==", "0", ")", "{", "fireFocusGainedOnWorkspace", "(", ")", ";", "}", "}", "}", ")", ";", "pageComponentMap", ".", "put", "(", "id", ",", "pageComponent", ")", ";", "}", "}" ]
Adds a document to the editor workspace. The behaviour when an editor is already open, with editor identity defined by id property, is determined by the closeAndReopenEditor property. If this property is true, the default, the editor is closed and reopened. If false, the existing editor becomes the active one. @param pageComponent The page component to be added as a document @param activateAfterOpen specifies if the component should be activated after opening
[ "Adds", "a", "document", "to", "the", "editor", "workspace", ".", "The", "behaviour", "when", "an", "editor", "is", "already", "open", "with", "editor", "identity", "defined", "by", "id", "property", "is", "determined", "by", "the", "closeAndReopenEditor", "property", ".", "If", "this", "property", "is", "true", "the", "default", "the", "editor", "is", "closed", "and", "reopened", ".", "If", "false", "the", "existing", "editor", "becomes", "the", "active", "one", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/WorkspaceView.java#L348-L379
11,888
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/AbstractListSelectionGuard.java
AbstractListSelectionGuard.propertyChange
public void propertyChange( PropertyChangeEvent evt ) { int[] selected = (int[]) selectionHolder.getValue(); guarded.setEnabled(shouldEnable(selected)); }
java
public void propertyChange( PropertyChangeEvent evt ) { int[] selected = (int[]) selectionHolder.getValue(); guarded.setEnabled(shouldEnable(selected)); }
[ "public", "void", "propertyChange", "(", "PropertyChangeEvent", "evt", ")", "{", "int", "[", "]", "selected", "=", "(", "int", "[", "]", ")", "selectionHolder", ".", "getValue", "(", ")", ";", "guarded", ".", "setEnabled", "(", "shouldEnable", "(", "selected", ")", ")", ";", "}" ]
Handle a change in the selectionHolder value.
[ "Handle", "a", "change", "in", "the", "selectionHolder", "value", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/AbstractListSelectionGuard.java#L53-L56
11,889
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/view/JideAbstractView.java
JideAbstractView.activateView
public void activateView(){ if(SwingUtilities.isEventDispatchThread()){ ValkyrieRepository.getInstance().getApplicationConfig().windowManager().getActiveWindow().getPage().showView(getId()); } else{ SwingUtilities.invokeLater(new Runnable(){ public void run() { ValkyrieRepository.getInstance().getApplicationConfig().windowManager().getActiveWindow().getPage().showView(getId()); } }); } }
java
public void activateView(){ if(SwingUtilities.isEventDispatchThread()){ ValkyrieRepository.getInstance().getApplicationConfig().windowManager().getActiveWindow().getPage().showView(getId()); } else{ SwingUtilities.invokeLater(new Runnable(){ public void run() { ValkyrieRepository.getInstance().getApplicationConfig().windowManager().getActiveWindow().getPage().showView(getId()); } }); } }
[ "public", "void", "activateView", "(", ")", "{", "if", "(", "SwingUtilities", ".", "isEventDispatchThread", "(", ")", ")", "{", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "windowManager", "(", ")", ".", "getActiveWindow", "(", ")", ".", "getPage", "(", ")", ".", "showView", "(", "getId", "(", ")", ")", ";", "}", "else", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "windowManager", "(", ")", ".", "getActiveWindow", "(", ")", ".", "getPage", "(", ")", ".", "showView", "(", "getId", "(", ")", ")", ";", "}", "}", ")", ";", "}", "}" ]
Activates this view taking care of EDT issues
[ "Activates", "this", "view", "taking", "care", "of", "EDT", "issues" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/view/JideAbstractView.java#L126-L138
11,890
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/LazyGroupMember.java
LazyGroupMember.loadIfNecessary
private void loadIfNecessary() { if (loadedMember != null) { return; } CommandRegistry commandRegistry = parentGroup.getCommandRegistry(); Assert.isTrue(parentGroup.getCommandRegistry() != null, "Command registry must be set for group '" + parentGroup.getId() + "' in order to load lazy command '" + lazyCommandId + "'."); if (commandRegistry.containsCommandGroup(lazyCommandId)) { CommandGroup group = commandRegistry.getCommandGroup(lazyCommandId); loadedMember = new SimpleGroupMember(parentGroup, group); } else if (commandRegistry.containsActionCommand(lazyCommandId)) { ActionCommand command = commandRegistry.getActionCommand(lazyCommandId); loadedMember = new SimpleGroupMember(parentGroup, command); } else { if (logger.isWarnEnabled()) { logger.warn("Lazy command '" + lazyCommandId + "' was asked to display; however, no backing command instance exists in registry."); } } if (addedLazily && loadedMember != null) { loadedMember.onAdded(); } }
java
private void loadIfNecessary() { if (loadedMember != null) { return; } CommandRegistry commandRegistry = parentGroup.getCommandRegistry(); Assert.isTrue(parentGroup.getCommandRegistry() != null, "Command registry must be set for group '" + parentGroup.getId() + "' in order to load lazy command '" + lazyCommandId + "'."); if (commandRegistry.containsCommandGroup(lazyCommandId)) { CommandGroup group = commandRegistry.getCommandGroup(lazyCommandId); loadedMember = new SimpleGroupMember(parentGroup, group); } else if (commandRegistry.containsActionCommand(lazyCommandId)) { ActionCommand command = commandRegistry.getActionCommand(lazyCommandId); loadedMember = new SimpleGroupMember(parentGroup, command); } else { if (logger.isWarnEnabled()) { logger.warn("Lazy command '" + lazyCommandId + "' was asked to display; however, no backing command instance exists in registry."); } } if (addedLazily && loadedMember != null) { loadedMember.onAdded(); } }
[ "private", "void", "loadIfNecessary", "(", ")", "{", "if", "(", "loadedMember", "!=", "null", ")", "{", "return", ";", "}", "CommandRegistry", "commandRegistry", "=", "parentGroup", ".", "getCommandRegistry", "(", ")", ";", "Assert", ".", "isTrue", "(", "parentGroup", ".", "getCommandRegistry", "(", ")", "!=", "null", ",", "\"Command registry must be set for group '\"", "+", "parentGroup", ".", "getId", "(", ")", "+", "\"' in order to load lazy command '\"", "+", "lazyCommandId", "+", "\"'.\"", ")", ";", "if", "(", "commandRegistry", ".", "containsCommandGroup", "(", "lazyCommandId", ")", ")", "{", "CommandGroup", "group", "=", "commandRegistry", ".", "getCommandGroup", "(", "lazyCommandId", ")", ";", "loadedMember", "=", "new", "SimpleGroupMember", "(", "parentGroup", ",", "group", ")", ";", "}", "else", "if", "(", "commandRegistry", ".", "containsActionCommand", "(", "lazyCommandId", ")", ")", "{", "ActionCommand", "command", "=", "commandRegistry", ".", "getActionCommand", "(", "lazyCommandId", ")", ";", "loadedMember", "=", "new", "SimpleGroupMember", "(", "parentGroup", ",", "command", ")", ";", "}", "else", "{", "if", "(", "logger", ".", "isWarnEnabled", "(", ")", ")", "{", "logger", ".", "warn", "(", "\"Lazy command '\"", "+", "lazyCommandId", "+", "\"' was asked to display; however, no backing command instance exists in registry.\"", ")", ";", "}", "}", "if", "(", "addedLazily", "&&", "loadedMember", "!=", "null", ")", "{", "loadedMember", ".", "onAdded", "(", ")", ";", "}", "}" ]
Attempts to load the lazy command from the command registry of the parent command group, but only if it hasn't already been loaded.
[ "Attempts", "to", "load", "the", "lazy", "command", "from", "the", "command", "registry", "of", "the", "parent", "command", "group", "but", "only", "if", "it", "hasn", "t", "already", "been", "loaded", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/LazyGroupMember.java#L93-L126
11,891
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java
AbstractEditor.getMessage
protected String getMessage(String key, Object[] params){ MessageSource messageSource = ValkyrieRepository.getInstance().getApplicationConfig().messageSource(); return messageSource.getMessage(key, params, Locale.getDefault()); }
java
protected String getMessage(String key, Object[] params){ MessageSource messageSource = ValkyrieRepository.getInstance().getApplicationConfig().messageSource(); return messageSource.getMessage(key, params, Locale.getDefault()); }
[ "protected", "String", "getMessage", "(", "String", "key", ",", "Object", "[", "]", "params", ")", "{", "MessageSource", "messageSource", "=", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getApplicationConfig", "(", ")", ".", "messageSource", "(", ")", ";", "return", "messageSource", ".", "getMessage", "(", "key", ",", "params", ",", "Locale", ".", "getDefault", "(", ")", ")", ";", "}" ]
Method to obtain a message from the message source defined via the services locator, at the default locale.
[ "Method", "to", "obtain", "a", "message", "from", "the", "message", "source", "defined", "via", "the", "services", "locator", "at", "the", "default", "locale", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java#L176-L179
11,892
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java
AbstractEditor.dispose
public void dispose(){ if(logger.isDebugEnabled()){ logger.debug("Disposing of editor "+getId()); } context.register(GlobalCommandIds.SAVE, null); context.register(GlobalCommandIds.SAVE_AS, null); //descriptor.removePropertyChangeListener((PropertyChangeListener)context.getPane()); concreteDispose(); }
java
public void dispose(){ if(logger.isDebugEnabled()){ logger.debug("Disposing of editor "+getId()); } context.register(GlobalCommandIds.SAVE, null); context.register(GlobalCommandIds.SAVE_AS, null); //descriptor.removePropertyChangeListener((PropertyChangeListener)context.getPane()); concreteDispose(); }
[ "public", "void", "dispose", "(", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Disposing of editor \"", "+", "getId", "(", ")", ")", ";", "}", "context", ".", "register", "(", "GlobalCommandIds", ".", "SAVE", ",", "null", ")", ";", "context", ".", "register", "(", "GlobalCommandIds", ".", "SAVE_AS", ",", "null", ")", ";", "//descriptor.removePropertyChangeListener((PropertyChangeListener)context.getPane());", "concreteDispose", "(", ")", ";", "}" ]
This method is called when an editor is removed from the workspace.
[ "This", "method", "is", "called", "when", "an", "editor", "is", "removed", "from", "the", "workspace", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java#L192-L200
11,893
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.setButtonLabelInfo
public void setButtonLabelInfo(String encodedLabelInfo) { CommandButtonLabelInfo newLabelInfo = CommandButtonLabelInfo.valueOf(encodedLabelInfo); setLabelInfo(newLabelInfo); }
java
public void setButtonLabelInfo(String encodedLabelInfo) { CommandButtonLabelInfo newLabelInfo = CommandButtonLabelInfo.valueOf(encodedLabelInfo); setLabelInfo(newLabelInfo); }
[ "public", "void", "setButtonLabelInfo", "(", "String", "encodedLabelInfo", ")", "{", "CommandButtonLabelInfo", "newLabelInfo", "=", "CommandButtonLabelInfo", ".", "valueOf", "(", "encodedLabelInfo", ")", ";", "setLabelInfo", "(", "newLabelInfo", ")", ";", "}" ]
Sets the label information for the command using the given encoded label descriptor. @param encodedLabelInfo The encoded label descriptor. May be null or empty. @see CommandButtonLabelInfo#valueOf(String)
[ "Sets", "the", "label", "information", "for", "the", "command", "using", "the", "given", "encoded", "label", "descriptor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L304-L307
11,894
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.setIcon
public void setIcon(Icon icon) { Icon old = null; if (iconInfo == CommandButtonIconInfo.BLANK_ICON_INFO) { if (icon != null) { // New IconInfo fires event setIconInfo(new CommandButtonIconInfo(icon)); } } else { old = iconInfo.getIcon(); this.iconInfo.setIcon(icon); } firePropertyChange(ICON_PROPERTY, old, icon); }
java
public void setIcon(Icon icon) { Icon old = null; if (iconInfo == CommandButtonIconInfo.BLANK_ICON_INFO) { if (icon != null) { // New IconInfo fires event setIconInfo(new CommandButtonIconInfo(icon)); } } else { old = iconInfo.getIcon(); this.iconInfo.setIcon(icon); } firePropertyChange(ICON_PROPERTY, old, icon); }
[ "public", "void", "setIcon", "(", "Icon", "icon", ")", "{", "Icon", "old", "=", "null", ";", "if", "(", "iconInfo", "==", "CommandButtonIconInfo", ".", "BLANK_ICON_INFO", ")", "{", "if", "(", "icon", "!=", "null", ")", "{", "// New IconInfo fires event", "setIconInfo", "(", "new", "CommandButtonIconInfo", "(", "icon", ")", ")", ";", "}", "}", "else", "{", "old", "=", "iconInfo", ".", "getIcon", "(", ")", ";", "this", ".", "iconInfo", ".", "setIcon", "(", "icon", ")", ";", "}", "firePropertyChange", "(", "ICON_PROPERTY", ",", "old", ",", "icon", ")", ";", "}" ]
Set the main default icon to be associated with the command. @param icon The main default icon. May be null.
[ "Set", "the", "main", "default", "icon", "to", "be", "associated", "with", "the", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L350-L363
11,895
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.setLargeIcon
public void setLargeIcon(Icon icon) { Icon old = null; if (largeIconInfo == CommandButtonIconInfo.BLANK_ICON_INFO) { if (icon != null) { // new IconInfo fires event setLargeIconInfo(new CommandButtonIconInfo(icon)); } } else { old = largeIconInfo.getIcon(); this.largeIconInfo.setIcon(icon); } firePropertyChange(LARGE_ICON_PROPERTY, old, icon); }
java
public void setLargeIcon(Icon icon) { Icon old = null; if (largeIconInfo == CommandButtonIconInfo.BLANK_ICON_INFO) { if (icon != null) { // new IconInfo fires event setLargeIconInfo(new CommandButtonIconInfo(icon)); } } else { old = largeIconInfo.getIcon(); this.largeIconInfo.setIcon(icon); } firePropertyChange(LARGE_ICON_PROPERTY, old, icon); }
[ "public", "void", "setLargeIcon", "(", "Icon", "icon", ")", "{", "Icon", "old", "=", "null", ";", "if", "(", "largeIconInfo", "==", "CommandButtonIconInfo", ".", "BLANK_ICON_INFO", ")", "{", "if", "(", "icon", "!=", "null", ")", "{", "// new IconInfo fires event", "setLargeIconInfo", "(", "new", "CommandButtonIconInfo", "(", "icon", ")", ")", ";", "}", "}", "else", "{", "old", "=", "largeIconInfo", ".", "getIcon", "(", ")", ";", "this", ".", "largeIconInfo", ".", "setIcon", "(", "icon", ")", ";", "}", "firePropertyChange", "(", "LARGE_ICON_PROPERTY", ",", "old", ",", "icon", ")", ";", "}" ]
Sets the main default large icon for the command. @param icon The large icon. May be null.
[ "Sets", "the", "main", "default", "large", "icon", "for", "the", "command", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L370-L383
11,896
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.configureIconInfo
public void configureIconInfo(AbstractButton button, boolean useLargeIcons) { Assert.notNull(button, "button"); if (useLargeIcons) { largeIconInfo.configure(button); } else { iconInfo.configure(button); } }
java
public void configureIconInfo(AbstractButton button, boolean useLargeIcons) { Assert.notNull(button, "button"); if (useLargeIcons) { largeIconInfo.configure(button); } else { iconInfo.configure(button); } }
[ "public", "void", "configureIconInfo", "(", "AbstractButton", "button", ",", "boolean", "useLargeIcons", ")", "{", "Assert", ".", "notNull", "(", "button", ",", "\"button\"", ")", ";", "if", "(", "useLargeIcons", ")", "{", "largeIconInfo", ".", "configure", "(", "button", ")", ";", "}", "else", "{", "iconInfo", ".", "configure", "(", "button", ")", ";", "}", "}" ]
Configures the given button with the icon information contained in this descriptor. @param button The button to be configured. Must not be null. @param useLargeIcons Set to true to configure the button with large icons. False will use default size icons. @throws IllegalArgumentException if {@code button} is null.
[ "Configures", "the", "given", "button", "with", "the", "icon", "information", "contained", "in", "this", "descriptor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L418-L428
11,897
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.configureColor
public void configureColor(AbstractButton button) { Assert.notNull(button, "button"); if (foreground != null) { button.setForeground(foreground); } if (background != null) { button.setBackground(background); } }
java
public void configureColor(AbstractButton button) { Assert.notNull(button, "button"); if (foreground != null) { button.setForeground(foreground); } if (background != null) { button.setBackground(background); } }
[ "public", "void", "configureColor", "(", "AbstractButton", "button", ")", "{", "Assert", ".", "notNull", "(", "button", ",", "\"button\"", ")", ";", "if", "(", "foreground", "!=", "null", ")", "{", "button", ".", "setForeground", "(", "foreground", ")", ";", "}", "if", "(", "background", "!=", "null", ")", "{", "button", ".", "setBackground", "(", "background", ")", ";", "}", "}" ]
Configures the given button with colours for background and foreground if available. @param button The button to be configured. Must not be null.
[ "Configures", "the", "given", "button", "with", "colours", "for", "background", "and", "foreground", "if", "available", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L435-L443
11,898
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.configure
public void configure(AbstractButton button, AbstractCommand command, CommandButtonConfigurer configurer) { Assert.notNull(button, "button"); Assert.notNull(configurer, "configurer"); configurer.configure(button, command, this); }
java
public void configure(AbstractButton button, AbstractCommand command, CommandButtonConfigurer configurer) { Assert.notNull(button, "button"); Assert.notNull(configurer, "configurer"); configurer.configure(button, command, this); }
[ "public", "void", "configure", "(", "AbstractButton", "button", ",", "AbstractCommand", "command", ",", "CommandButtonConfigurer", "configurer", ")", "{", "Assert", ".", "notNull", "(", "button", ",", "\"button\"", ")", ";", "Assert", ".", "notNull", "(", "configurer", ",", "\"configurer\"", ")", ";", "configurer", ".", "configure", "(", "button", ",", "command", ",", "this", ")", ";", "}" ]
Configures the given button and command using the given configurer and the information contained in this instance. @param button The button to be configured. Must not be null. @param command The command to be configured. May be null. @param configurer The configurer. Must not be null. @throws IllegalArgumentException if {@code button} or {@code configurer} are null.
[ "Configures", "the", "given", "button", "and", "command", "using", "the", "given", "configurer", "and", "the", "information", "contained", "in", "this", "instance", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L455-L459
11,899
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java
CommandFaceDescriptor.configure
public void configure(Action action) { Assert.notNull(action, "The swing action to configure is required"); action.putValue(Action.NAME, getText()); action.putValue(Action.MNEMONIC_KEY, new Integer(getMnemonic())); action.putValue(Action.SMALL_ICON, getIcon()); action.putValue("LargeIcon", getLargeIcon()); action.putValue(Action.ACCELERATOR_KEY, getAccelerator()); action.putValue(Action.SHORT_DESCRIPTION, caption); action.putValue(Action.LONG_DESCRIPTION, description); }
java
public void configure(Action action) { Assert.notNull(action, "The swing action to configure is required"); action.putValue(Action.NAME, getText()); action.putValue(Action.MNEMONIC_KEY, new Integer(getMnemonic())); action.putValue(Action.SMALL_ICON, getIcon()); action.putValue("LargeIcon", getLargeIcon()); action.putValue(Action.ACCELERATOR_KEY, getAccelerator()); action.putValue(Action.SHORT_DESCRIPTION, caption); action.putValue(Action.LONG_DESCRIPTION, description); }
[ "public", "void", "configure", "(", "Action", "action", ")", "{", "Assert", ".", "notNull", "(", "action", ",", "\"The swing action to configure is required\"", ")", ";", "action", ".", "putValue", "(", "Action", ".", "NAME", ",", "getText", "(", ")", ")", ";", "action", ".", "putValue", "(", "Action", ".", "MNEMONIC_KEY", ",", "new", "Integer", "(", "getMnemonic", "(", ")", ")", ")", ";", "action", ".", "putValue", "(", "Action", ".", "SMALL_ICON", ",", "getIcon", "(", ")", ")", ";", "action", ".", "putValue", "(", "\"LargeIcon\"", ",", "getLargeIcon", "(", ")", ")", ";", "action", ".", "putValue", "(", "Action", ".", "ACCELERATOR_KEY", ",", "getAccelerator", "(", ")", ")", ";", "action", ".", "putValue", "(", "Action", ".", "SHORT_DESCRIPTION", ",", "caption", ")", ";", "action", ".", "putValue", "(", "Action", ".", "LONG_DESCRIPTION", ",", "description", ")", ";", "}" ]
Configures the given action with the information contained in this descriptor. @param action The action to be configured. Must not be null. @throws IllegalArgumentException if {@code action} is null.
[ "Configures", "the", "given", "action", "with", "the", "information", "contained", "in", "this", "descriptor", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L468-L477