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,700
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
AbstractObjectTable.onDoubleClick
protected void onDoubleClick() { // Dispatch this to the doubleClickHandler, if any if (doubleClickHandler != null) { boolean okToExecute = true; if (doubleClickHandler instanceof GuardedActionCommandExecutor) { okToExecute = ((GuardedActionCommandExecutor) doubleClickHandler) .isEnabled(); } if (okToExecute) { doubleClickHandler.execute(); } } }
java
protected void onDoubleClick() { // Dispatch this to the doubleClickHandler, if any if (doubleClickHandler != null) { boolean okToExecute = true; if (doubleClickHandler instanceof GuardedActionCommandExecutor) { okToExecute = ((GuardedActionCommandExecutor) doubleClickHandler) .isEnabled(); } if (okToExecute) { doubleClickHandler.execute(); } } }
[ "protected", "void", "onDoubleClick", "(", ")", "{", "// Dispatch this to the doubleClickHandler, if any", "if", "(", "doubleClickHandler", "!=", "null", ")", "{", "boolean", "okToExecute", "=", "true", ";", "if", "(", "doubleClickHandler", "instanceof", "GuardedActionCommandExecutor", ")", "{", "okToExecute", "=", "(", "(", "GuardedActionCommandExecutor", ")", "doubleClickHandler", ")", ".", "isEnabled", "(", ")", ";", "}", "if", "(", "okToExecute", ")", "{", "doubleClickHandler", ".", "execute", "(", ")", ";", "}", "}", "}" ]
Handle a double click on a row of the table. The row will already be selected.
[ "Handle", "a", "double", "click", "on", "a", "row", "of", "the", "table", ".", "The", "row", "will", "already", "be", "selected", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L440-L453
11,701
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
AbstractObjectTable.createTableModel
protected GlazedTableModel createTableModel(EventList eventList) { return new GlazedTableModel(eventList, getColumnPropertyNames(), modelId) { protected TableFormat createTableFormat() { return new DefaultAdvancedTableFormat(); } }; }
java
protected GlazedTableModel createTableModel(EventList eventList) { return new GlazedTableModel(eventList, getColumnPropertyNames(), modelId) { protected TableFormat createTableFormat() { return new DefaultAdvancedTableFormat(); } }; }
[ "protected", "GlazedTableModel", "createTableModel", "(", "EventList", "eventList", ")", "{", "return", "new", "GlazedTableModel", "(", "eventList", ",", "getColumnPropertyNames", "(", ")", ",", "modelId", ")", "{", "protected", "TableFormat", "createTableFormat", "(", ")", "{", "return", "new", "DefaultAdvancedTableFormat", "(", ")", ";", "}", "}", ";", "}" ]
Construct the table model for this table. The default implementation of this creates a GlazedTableModel using an Advanced format. @param eventList on which to build the model @return table model
[ "Construct", "the", "table", "model", "for", "this", "table", ".", "The", "default", "implementation", "of", "this", "creates", "a", "GlazedTableModel", "using", "an", "Advanced", "format", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L463-L470
11,702
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
AbstractObjectTable.updateStatusBar
protected void updateStatusBar() { if (statusBar != null) { int all = getBaseEventList().size(); int showing = getFinalEventList().size(); String msg; if (all == showing) { String[] keys = new String[] { modelId + "." + SHOWINGALL_MSG_KEY, SHOWINGALL_MSG_KEY }; msg = getApplicationConfig().messageResolver().getMessage( keys, new Object[] { "" + all, (all != 1) ? objectPluralName : objectSingularName }); } else { String[] keys = new String[] { modelId + "." + SHOWINGN_MSG_KEY, SHOWINGN_MSG_KEY }; msg = getApplicationConfig().messageResolver().getMessage( keys, new Object[] { "" + showing, (showing != 1) ? objectPluralName : objectSingularName, "" + all }); } // Now add the selection info int nselected = getTable().getSelectedRowCount(); if (nselected > 0) { String[] keys = new String[] { modelId + "." + SELECTEDN_MSG_KEY, SELECTEDN_MSG_KEY }; msg += getApplicationConfig().messageResolver().getMessage(keys, new Object[] { "" + nselected }); } statusBar.setMessage(msg.toString()); } }
java
protected void updateStatusBar() { if (statusBar != null) { int all = getBaseEventList().size(); int showing = getFinalEventList().size(); String msg; if (all == showing) { String[] keys = new String[] { modelId + "." + SHOWINGALL_MSG_KEY, SHOWINGALL_MSG_KEY }; msg = getApplicationConfig().messageResolver().getMessage( keys, new Object[] { "" + all, (all != 1) ? objectPluralName : objectSingularName }); } else { String[] keys = new String[] { modelId + "." + SHOWINGN_MSG_KEY, SHOWINGN_MSG_KEY }; msg = getApplicationConfig().messageResolver().getMessage( keys, new Object[] { "" + showing, (showing != 1) ? objectPluralName : objectSingularName, "" + all }); } // Now add the selection info int nselected = getTable().getSelectedRowCount(); if (nselected > 0) { String[] keys = new String[] { modelId + "." + SELECTEDN_MSG_KEY, SELECTEDN_MSG_KEY }; msg += getApplicationConfig().messageResolver().getMessage(keys, new Object[] { "" + nselected }); } statusBar.setMessage(msg.toString()); } }
[ "protected", "void", "updateStatusBar", "(", ")", "{", "if", "(", "statusBar", "!=", "null", ")", "{", "int", "all", "=", "getBaseEventList", "(", ")", ".", "size", "(", ")", ";", "int", "showing", "=", "getFinalEventList", "(", ")", ".", "size", "(", ")", ";", "String", "msg", ";", "if", "(", "all", "==", "showing", ")", "{", "String", "[", "]", "keys", "=", "new", "String", "[", "]", "{", "modelId", "+", "\".\"", "+", "SHOWINGALL_MSG_KEY", ",", "SHOWINGALL_MSG_KEY", "}", ";", "msg", "=", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "keys", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "all", ",", "(", "all", "!=", "1", ")", "?", "objectPluralName", ":", "objectSingularName", "}", ")", ";", "}", "else", "{", "String", "[", "]", "keys", "=", "new", "String", "[", "]", "{", "modelId", "+", "\".\"", "+", "SHOWINGN_MSG_KEY", ",", "SHOWINGN_MSG_KEY", "}", ";", "msg", "=", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "keys", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "showing", ",", "(", "showing", "!=", "1", ")", "?", "objectPluralName", ":", "objectSingularName", ",", "\"\"", "+", "all", "}", ")", ";", "}", "// Now add the selection info", "int", "nselected", "=", "getTable", "(", ")", ".", "getSelectedRowCount", "(", ")", ";", "if", "(", "nselected", ">", "0", ")", "{", "String", "[", "]", "keys", "=", "new", "String", "[", "]", "{", "modelId", "+", "\".\"", "+", "SELECTEDN_MSG_KEY", ",", "SELECTEDN_MSG_KEY", "}", ";", "msg", "+=", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "keys", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "nselected", "}", ")", ";", "}", "statusBar", ".", "setMessage", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Update the status bar with the current display counts.
[ "Update", "the", "status", "bar", "with", "the", "current", "display", "counts", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L624-L660
11,703
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
AbstractObjectTable.onApplicationEvent
public void onApplicationEvent(ApplicationEvent e) { if (e instanceof LifecycleApplicationEvent) { LifecycleApplicationEvent le = (LifecycleApplicationEvent) e; if (shouldHandleEvent(e)) { if (le.getEventType() == LifecycleApplicationEvent.CREATED) { handleNewObject(le.getObject()); } else if (le.getEventType() == LifecycleApplicationEvent.MODIFIED) { handleUpdatedObject(le.getObject()); } else if (le.getEventType() == LifecycleApplicationEvent.DELETED) { handleDeletedObject(le.getObject()); } } } }
java
public void onApplicationEvent(ApplicationEvent e) { if (e instanceof LifecycleApplicationEvent) { LifecycleApplicationEvent le = (LifecycleApplicationEvent) e; if (shouldHandleEvent(e)) { if (le.getEventType() == LifecycleApplicationEvent.CREATED) { handleNewObject(le.getObject()); } else if (le.getEventType() == LifecycleApplicationEvent.MODIFIED) { handleUpdatedObject(le.getObject()); } else if (le.getEventType() == LifecycleApplicationEvent.DELETED) { handleDeletedObject(le.getObject()); } } } }
[ "public", "void", "onApplicationEvent", "(", "ApplicationEvent", "e", ")", "{", "if", "(", "e", "instanceof", "LifecycleApplicationEvent", ")", "{", "LifecycleApplicationEvent", "le", "=", "(", "LifecycleApplicationEvent", ")", "e", ";", "if", "(", "shouldHandleEvent", "(", "e", ")", ")", "{", "if", "(", "le", ".", "getEventType", "(", ")", "==", "LifecycleApplicationEvent", ".", "CREATED", ")", "{", "handleNewObject", "(", "le", ".", "getObject", "(", ")", ")", ";", "}", "else", "if", "(", "le", ".", "getEventType", "(", ")", "==", "LifecycleApplicationEvent", ".", "MODIFIED", ")", "{", "handleUpdatedObject", "(", "le", ".", "getObject", "(", ")", ")", ";", "}", "else", "if", "(", "le", ".", "getEventType", "(", ")", "==", "LifecycleApplicationEvent", ".", "DELETED", ")", "{", "handleDeletedObject", "(", "le", ".", "getObject", "(", ")", ")", ";", "}", "}", "}", "}" ]
Handle an application event. This will notify us of object adds, deletes, and modifications. Update our table model accordingly. @param e event to process
[ "Handle", "an", "application", "event", ".", "This", "will", "notify", "us", "of", "object", "adds", "deletes", "and", "modifications", ".", "Update", "our", "table", "model", "accordingly", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L669-L682
11,704
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/support/DialogPageUtils.java
DialogPageUtils.createButtonBar
public static JComponent createButtonBar(Object[] groupMembers) { CommandGroupFactoryBean commandGroupFactoryBean = new CommandGroupFactoryBean( null, groupMembers); // CommandGroup dialogCommandGroup = // CommandGroup.createCommandGroup(null, // groupMembers); CommandGroup dialogCommandGroup = commandGroupFactoryBean .getCommandGroup(); JComponent buttonBar = dialogCommandGroup.createButtonBar(); GuiStandardUtils.attachDialogBorder(buttonBar); return buttonBar; }
java
public static JComponent createButtonBar(Object[] groupMembers) { CommandGroupFactoryBean commandGroupFactoryBean = new CommandGroupFactoryBean( null, groupMembers); // CommandGroup dialogCommandGroup = // CommandGroup.createCommandGroup(null, // groupMembers); CommandGroup dialogCommandGroup = commandGroupFactoryBean .getCommandGroup(); JComponent buttonBar = dialogCommandGroup.createButtonBar(); GuiStandardUtils.attachDialogBorder(buttonBar); return buttonBar; }
[ "public", "static", "JComponent", "createButtonBar", "(", "Object", "[", "]", "groupMembers", ")", "{", "CommandGroupFactoryBean", "commandGroupFactoryBean", "=", "new", "CommandGroupFactoryBean", "(", "null", ",", "groupMembers", ")", ";", "// CommandGroup dialogCommandGroup =", "// CommandGroup.createCommandGroup(null,", "// groupMembers);", "CommandGroup", "dialogCommandGroup", "=", "commandGroupFactoryBean", ".", "getCommandGroup", "(", ")", ";", "JComponent", "buttonBar", "=", "dialogCommandGroup", ".", "createButtonBar", "(", ")", ";", "GuiStandardUtils", ".", "attachDialogBorder", "(", "buttonBar", ")", ";", "return", "buttonBar", ";", "}" ]
Return a standardized row of command buttons. @param groupMembers @return button bar
[ "Return", "a", "standardized", "row", "of", "command", "buttons", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/support/DialogPageUtils.java#L115-L126
11,705
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/support/DialogPageUtils.java
DialogPageUtils.adaptPageCompletetoGuarded
public static void adaptPageCompletetoGuarded(DialogPage dialogPage, Guarded guarded) { dialogPage.addPropertyChangeListener(DialogPage.PAGE_COMPLETE_PROPERTY, new PageCompleteAdapter(guarded)); }
java
public static void adaptPageCompletetoGuarded(DialogPage dialogPage, Guarded guarded) { dialogPage.addPropertyChangeListener(DialogPage.PAGE_COMPLETE_PROPERTY, new PageCompleteAdapter(guarded)); }
[ "public", "static", "void", "adaptPageCompletetoGuarded", "(", "DialogPage", "dialogPage", ",", "Guarded", "guarded", ")", "{", "dialogPage", ".", "addPropertyChangeListener", "(", "DialogPage", ".", "PAGE_COMPLETE_PROPERTY", ",", "new", "PageCompleteAdapter", "(", "guarded", ")", ")", ";", "}" ]
Create an adapter that will monitor the page complete status of the dialog page and adapt it to operations on the provided Guarded object. If the page is complete, then the guarded object will be enabled. If this page is not complete, then the guarded object will be disabled. @param dialogPage to monitor @param guarded object to adapt
[ "Create", "an", "adapter", "that", "will", "monitor", "the", "page", "complete", "status", "of", "the", "dialog", "page", "and", "adapt", "it", "to", "operations", "on", "the", "provided", "Guarded", "object", ".", "If", "the", "page", "is", "complete", "then", "the", "guarded", "object", "will", "be", "enabled", ".", "If", "this", "page", "is", "not", "complete", "then", "the", "guarded", "object", "will", "be", "disabled", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/support/DialogPageUtils.java#L155-L159
11,706
instacount/appengine-counter
src/main/java/io/instacount/appengine/counter/CounterBuilder.java
CounterBuilder.build
public Counter build() { return new Counter(this.getName(), this.getDescription(), this.getNumShards(), this.getCounterStatus(), this.getCount(), this.getIndexes(), this.getCreationDateTime()); }
java
public Counter build() { return new Counter(this.getName(), this.getDescription(), this.getNumShards(), this.getCounterStatus(), this.getCount(), this.getIndexes(), this.getCreationDateTime()); }
[ "public", "Counter", "build", "(", ")", "{", "return", "new", "Counter", "(", "this", ".", "getName", "(", ")", ",", "this", ".", "getDescription", "(", ")", ",", "this", ".", "getNumShards", "(", ")", ",", "this", ".", "getCounterStatus", "(", ")", ",", "this", ".", "getCount", "(", ")", ",", "this", ".", "getIndexes", "(", ")", ",", "this", ".", "getCreationDateTime", "(", ")", ")", ";", "}" ]
Build method for constructing a new Counter. @return
[ "Build", "method", "for", "constructing", "a", "new", "Counter", "." ]
60aa86ab28f173ec1642539926b69924b8bda238
https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/CounterBuilder.java#L87-L91
11,707
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java
ReflectiveVisitorHelper.getMethod
private Method getMethod(Class visitorClass, Object argument) { ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods .get(visitorClass); return visitMethods.getVisitMethod(argument != null ? argument .getClass() : null); }
java
private Method getMethod(Class visitorClass, Object argument) { ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods .get(visitorClass); return visitMethods.getVisitMethod(argument != null ? argument .getClass() : null); }
[ "private", "Method", "getMethod", "(", "Class", "visitorClass", ",", "Object", "argument", ")", "{", "ClassVisitMethods", "visitMethods", "=", "(", "ClassVisitMethods", ")", "this", ".", "visitorClassVisitMethods", ".", "get", "(", "visitorClass", ")", ";", "return", "visitMethods", ".", "getVisitMethod", "(", "argument", "!=", "null", "?", "argument", ".", "getClass", "(", ")", ":", "null", ")", ";", "}" ]
Determines the most appropriate visit method for the given visitor class and argument.
[ "Determines", "the", "most", "appropriate", "visit", "method", "for", "the", "given", "visitor", "class", "and", "argument", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java#L114-L119
11,708
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedCollectionValueModel.java
BufferedCollectionValueModel.hasSameStructure
private boolean hasSameStructure() { Object wrappedCollection = getWrappedValue(); if (wrappedCollection == null) { return bufferedListModel.size() == 0; } else if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; if (wrappedArray.length != bufferedListModel.size()) { return false; } for (int i = 0; i < bufferedListModel.size(); i++) { if(super.hasValueChanged(wrappedArray[i], bufferedListModel.get(i))) { return false; } } } else { if (((Collection)wrappedCollection).size() != bufferedListModel.size()) { return false; } for (Iterator i = ((Collection)wrappedCollection).iterator(), j = bufferedListModel.iterator(); i.hasNext();) { if (super.hasValueChanged(i.next(), j.next())) { return false; } } } return true; }
java
private boolean hasSameStructure() { Object wrappedCollection = getWrappedValue(); if (wrappedCollection == null) { return bufferedListModel.size() == 0; } else if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; if (wrappedArray.length != bufferedListModel.size()) { return false; } for (int i = 0; i < bufferedListModel.size(); i++) { if(super.hasValueChanged(wrappedArray[i], bufferedListModel.get(i))) { return false; } } } else { if (((Collection)wrappedCollection).size() != bufferedListModel.size()) { return false; } for (Iterator i = ((Collection)wrappedCollection).iterator(), j = bufferedListModel.iterator(); i.hasNext();) { if (super.hasValueChanged(i.next(), j.next())) { return false; } } } return true; }
[ "private", "boolean", "hasSameStructure", "(", ")", "{", "Object", "wrappedCollection", "=", "getWrappedValue", "(", ")", ";", "if", "(", "wrappedCollection", "==", "null", ")", "{", "return", "bufferedListModel", ".", "size", "(", ")", "==", "0", ";", "}", "else", "if", "(", "wrappedCollection", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "wrappedArray", "=", "(", "Object", "[", "]", ")", "wrappedCollection", ";", "if", "(", "wrappedArray", ".", "length", "!=", "bufferedListModel", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bufferedListModel", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "super", ".", "hasValueChanged", "(", "wrappedArray", "[", "i", "]", ",", "bufferedListModel", ".", "get", "(", "i", ")", ")", ")", "{", "return", "false", ";", "}", "}", "}", "else", "{", "if", "(", "(", "(", "Collection", ")", "wrappedCollection", ")", ".", "size", "(", ")", "!=", "bufferedListModel", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "Iterator", "i", "=", "(", "(", "Collection", ")", "wrappedCollection", ")", ".", "iterator", "(", ")", ",", "j", "=", "bufferedListModel", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "if", "(", "super", ".", "hasValueChanged", "(", "i", ".", "next", "(", ")", ",", "j", ".", "next", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
Checks if the structure of the buffered list model is the same as the wrapped collection. "same structure" is defined as having the same elements in the same order with the one exception that NULL == empty list.
[ "Checks", "if", "the", "structure", "of", "the", "buffered", "list", "model", "is", "the", "same", "as", "the", "wrapped", "collection", ".", "same", "structure", "is", "defined", "as", "having", "the", "same", "elements", "in", "the", "same", "order", "with", "the", "one", "exception", "that", "NULL", "==", "empty", "list", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedCollectionValueModel.java#L150-L177
11,709
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedCollectionValueModel.java
BufferedCollectionValueModel.updateBufferedListModel
private Object updateBufferedListModel(final Object wrappedCollection) { if (bufferedListModel == null) { bufferedListModel = createBufferedListModel(); bufferedListModel.addListDataListener(listChangeHandler); setValue(bufferedListModel); } if (wrappedCollection == null) { bufferedListModel.clear(); } else { if (wrappedType.isAssignableFrom(wrappedCollection.getClass())) { Collection buffer = null; if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; buffer = Arrays.asList(wrappedArray); } else { buffer = (Collection)wrappedCollection; } bufferedListModel.clear(); bufferedListModel.addAll(prepareBackingCollection(buffer)); } else { throw new IllegalArgumentException("wrappedCollection must be assignable from " + wrappedType.getName()); } } return bufferedListModel; }
java
private Object updateBufferedListModel(final Object wrappedCollection) { if (bufferedListModel == null) { bufferedListModel = createBufferedListModel(); bufferedListModel.addListDataListener(listChangeHandler); setValue(bufferedListModel); } if (wrappedCollection == null) { bufferedListModel.clear(); } else { if (wrappedType.isAssignableFrom(wrappedCollection.getClass())) { Collection buffer = null; if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; buffer = Arrays.asList(wrappedArray); } else { buffer = (Collection)wrappedCollection; } bufferedListModel.clear(); bufferedListModel.addAll(prepareBackingCollection(buffer)); } else { throw new IllegalArgumentException("wrappedCollection must be assignable from " + wrappedType.getName()); } } return bufferedListModel; }
[ "private", "Object", "updateBufferedListModel", "(", "final", "Object", "wrappedCollection", ")", "{", "if", "(", "bufferedListModel", "==", "null", ")", "{", "bufferedListModel", "=", "createBufferedListModel", "(", ")", ";", "bufferedListModel", ".", "addListDataListener", "(", "listChangeHandler", ")", ";", "setValue", "(", "bufferedListModel", ")", ";", "}", "if", "(", "wrappedCollection", "==", "null", ")", "{", "bufferedListModel", ".", "clear", "(", ")", ";", "}", "else", "{", "if", "(", "wrappedType", ".", "isAssignableFrom", "(", "wrappedCollection", ".", "getClass", "(", ")", ")", ")", "{", "Collection", "buffer", "=", "null", ";", "if", "(", "wrappedCollection", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "wrappedArray", "=", "(", "Object", "[", "]", ")", "wrappedCollection", ";", "buffer", "=", "Arrays", ".", "asList", "(", "wrappedArray", ")", ";", "}", "else", "{", "buffer", "=", "(", "Collection", ")", "wrappedCollection", ";", "}", "bufferedListModel", ".", "clear", "(", ")", ";", "bufferedListModel", ".", "addAll", "(", "prepareBackingCollection", "(", "buffer", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"wrappedCollection must be assignable from \"", "+", "wrappedType", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "bufferedListModel", ";", "}" ]
Gets the list value associated with this value model, creating a list model buffer containing its contents, suitable for manipulation. @return The list model buffer
[ "Gets", "the", "list", "value", "associated", "with", "this", "value", "model", "creating", "a", "list", "model", "buffer", "containing", "its", "contents", "suitable", "for", "manipulation", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedCollectionValueModel.java#L237-L265
11,710
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/ApplicationLauncher.java
ApplicationLauncher.loadStartupContext
private ApplicationContext loadStartupContext(Class<? extends SplashScreenConfig> startupConfig) { if(startupConfig == null) return null; logger.info("Loading startup context from class (" + startupConfig.getName() + ")"); return new AnnotationConfigApplicationContext(startupConfig); }
java
private ApplicationContext loadStartupContext(Class<? extends SplashScreenConfig> startupConfig) { if(startupConfig == null) return null; logger.info("Loading startup context from class (" + startupConfig.getName() + ")"); return new AnnotationConfigApplicationContext(startupConfig); }
[ "private", "ApplicationContext", "loadStartupContext", "(", "Class", "<", "?", "extends", "SplashScreenConfig", ">", "startupConfig", ")", "{", "if", "(", "startupConfig", "==", "null", ")", "return", "null", ";", "logger", ".", "info", "(", "\"Loading startup context from class (\"", "+", "startupConfig", ".", "getName", "(", ")", "+", "\")\"", ")", ";", "return", "new", "AnnotationConfigApplicationContext", "(", "startupConfig", ")", ";", "}" ]
Returns an application context loaded from the bean definition file at the given classpath-relative location. @return An application context loaded from the given location, or null if {@code startupContextPath} is null or empty.
[ "Returns", "an", "application", "context", "loaded", "from", "the", "bean", "definition", "file", "at", "the", "given", "classpath", "-", "relative", "location", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/ApplicationLauncher.java#L225-L232
11,711
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java
EditableComboBoxAutoCompletion.keyReleased
public void keyReleased(KeyEvent e) { char ch = e.getKeyChar(); if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch)) return; int pos = editor.getCaretPosition(); String str = editor.getText(); if (str.length() == 0) return; boolean matchFound = false; for (int k = 0; k < comboBox.getItemCount(); k++) { String item = comboBox.getItemAt(k).toString(); if (startsWithIgnoreCase(item, str)) { comboBox.setSelectedIndex(k); editor.setText(item); editor.setCaretPosition(item.length()); editor.moveCaretPosition(pos); // show popup when the user types if (comboBox.isDisplayable()) comboBox.setPopupVisible(true); matchFound = true; break; } } if (!matchFound) { // hide popup when there is no match comboBox.setPopupVisible(false); } }
java
public void keyReleased(KeyEvent e) { char ch = e.getKeyChar(); if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch)) return; int pos = editor.getCaretPosition(); String str = editor.getText(); if (str.length() == 0) return; boolean matchFound = false; for (int k = 0; k < comboBox.getItemCount(); k++) { String item = comboBox.getItemAt(k).toString(); if (startsWithIgnoreCase(item, str)) { comboBox.setSelectedIndex(k); editor.setText(item); editor.setCaretPosition(item.length()); editor.moveCaretPosition(pos); // show popup when the user types if (comboBox.isDisplayable()) comboBox.setPopupVisible(true); matchFound = true; break; } } if (!matchFound) { // hide popup when there is no match comboBox.setPopupVisible(false); } }
[ "public", "void", "keyReleased", "(", "KeyEvent", "e", ")", "{", "char", "ch", "=", "e", ".", "getKeyChar", "(", ")", ";", "if", "(", "ch", "==", "KeyEvent", ".", "CHAR_UNDEFINED", "||", "Character", ".", "isISOControl", "(", "ch", ")", ")", "return", ";", "int", "pos", "=", "editor", ".", "getCaretPosition", "(", ")", ";", "String", "str", "=", "editor", ".", "getText", "(", ")", ";", "if", "(", "str", ".", "length", "(", ")", "==", "0", ")", "return", ";", "boolean", "matchFound", "=", "false", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "comboBox", ".", "getItemCount", "(", ")", ";", "k", "++", ")", "{", "String", "item", "=", "comboBox", ".", "getItemAt", "(", "k", ")", ".", "toString", "(", ")", ";", "if", "(", "startsWithIgnoreCase", "(", "item", ",", "str", ")", ")", "{", "comboBox", ".", "setSelectedIndex", "(", "k", ")", ";", "editor", ".", "setText", "(", "item", ")", ";", "editor", ".", "setCaretPosition", "(", "item", ".", "length", "(", ")", ")", ";", "editor", ".", "moveCaretPosition", "(", "pos", ")", ";", "// show popup when the user types", "if", "(", "comboBox", ".", "isDisplayable", "(", ")", ")", "comboBox", ".", "setPopupVisible", "(", "true", ")", ";", "matchFound", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "matchFound", ")", "{", "// hide popup when there is no match", "comboBox", ".", "setPopupVisible", "(", "false", ")", ";", "}", "}" ]
Handle a key release event. See if what they've type so far matches anything in the selectable items list. If so, then show the popup and select the item. If not, then hide the popup. @param e key event
[ "Handle", "a", "key", "release", "event", ".", "See", "if", "what", "they", "ve", "type", "so", "far", "matches", "anything", "in", "the", "selectable", "items", "list", ".", "If", "so", "then", "show", "the", "popup", "and", "select", "the", "item", ".", "If", "not", "then", "hide", "the", "popup", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java#L59-L89
11,712
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java
EditableComboBoxAutoCompletion.startsWithIgnoreCase
private boolean startsWithIgnoreCase(String str1, String str2) { return str1 != null && str2 != null && str1.toUpperCase().startsWith(str2.toUpperCase()); }
java
private boolean startsWithIgnoreCase(String str1, String str2) { return str1 != null && str2 != null && str1.toUpperCase().startsWith(str2.toUpperCase()); }
[ "private", "boolean", "startsWithIgnoreCase", "(", "String", "str1", ",", "String", "str2", ")", "{", "return", "str1", "!=", "null", "&&", "str2", "!=", "null", "&&", "str1", ".", "toUpperCase", "(", ")", ".", "startsWith", "(", "str2", ".", "toUpperCase", "(", ")", ")", ";", "}" ]
See if one string begins with another, ignoring case. @param str1 The string to test @param str2 The prefix to test for @return true if str1 starts with str2, ingnoring case
[ "See", "if", "one", "string", "begins", "with", "another", "ignoring", "case", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java#L98-L100
11,713
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java
EditableComboBoxAutoCompletion.highlightText
private void highlightText(int start) { editor.setCaretPosition(editor.getText().length()); editor.moveCaretPosition(start); }
java
private void highlightText(int start) { editor.setCaretPosition(editor.getText().length()); editor.moveCaretPosition(start); }
[ "private", "void", "highlightText", "(", "int", "start", ")", "{", "editor", ".", "setCaretPosition", "(", "editor", ".", "getText", "(", ")", ".", "length", "(", ")", ")", ";", "editor", ".", "moveCaretPosition", "(", "start", ")", ";", "}" ]
Highlight the text from the given start location to the end of the text. @param start Starting location to highlight
[ "Highlight", "the", "text", "from", "the", "given", "start", "location", "to", "the", "end", "of", "the", "text", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java#L107-L110
11,714
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/list/ListMultipleSelectionGuard.java
ListMultipleSelectionGuard.shouldEnable
protected boolean shouldEnable( int[] selected ) { return selected != null && selected.length >= 1 && (requiredCount == -1 || requiredCount == selected.length); }
java
protected boolean shouldEnable( int[] selected ) { return selected != null && selected.length >= 1 && (requiredCount == -1 || requiredCount == selected.length); }
[ "protected", "boolean", "shouldEnable", "(", "int", "[", "]", "selected", ")", "{", "return", "selected", "!=", "null", "&&", "selected", ".", "length", ">=", "1", "&&", "(", "requiredCount", "==", "-", "1", "||", "requiredCount", "==", "selected", ".", "length", ")", ";", "}" ]
Determine if the guarded object should be enabled based on the contents of the current selection model value. @param selected The array of selected rows @return boolean true if the guarded object should be enabled
[ "Determine", "if", "the", "guarded", "object", "should", "be", "enabled", "based", "on", "the", "contents", "of", "the", "current", "selection", "model", "value", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/ListMultipleSelectionGuard.java#L64-L66
11,715
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java
PropertyChangeSupportUtils.getNamedPCLAdder
private static Method getNamedPCLAdder(Class beanClass) { try { return beanClass.getMethod("addPropertyChangeListener", NAMED_PCL_PARAMS); } catch (NoSuchMethodException e) { return null; } }
java
private static Method getNamedPCLAdder(Class beanClass) { try { return beanClass.getMethod("addPropertyChangeListener", NAMED_PCL_PARAMS); } catch (NoSuchMethodException e) { return null; } }
[ "private", "static", "Method", "getNamedPCLAdder", "(", "Class", "beanClass", ")", "{", "try", "{", "return", "beanClass", ".", "getMethod", "(", "\"addPropertyChangeListener\"", ",", "NAMED_PCL_PARAMS", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Looks up and returns the method that adds a PropertyChangeListener for a specified property name to instances of the given class. @param beanClass the class that provides the adder method @return the method that adds the PropertyChangeListeners
[ "Looks", "up", "and", "returns", "the", "method", "that", "adds", "a", "PropertyChangeListener", "for", "a", "specified", "property", "name", "to", "instances", "of", "the", "given", "class", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java#L154-L161
11,716
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java
GuiStandardUtils.createCommandButtonColumn
public static JComponent createCommandButtonColumn(JButton[] buttons) { ButtonStackBuilder builder = new ButtonStackBuilder(); for (int i = 0; i < buttons.length; i++) { if (i > 0) { builder.addRelatedGap(); } builder.addGridded(buttons[i]); } return builder.getPanel(); }
java
public static JComponent createCommandButtonColumn(JButton[] buttons) { ButtonStackBuilder builder = new ButtonStackBuilder(); for (int i = 0; i < buttons.length; i++) { if (i > 0) { builder.addRelatedGap(); } builder.addGridded(buttons[i]); } return builder.getPanel(); }
[ "public", "static", "JComponent", "createCommandButtonColumn", "(", "JButton", "[", "]", "buttons", ")", "{", "ButtonStackBuilder", "builder", "=", "new", "ButtonStackBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buttons", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "builder", ".", "addRelatedGap", "(", ")", ";", "}", "builder", ".", "addGridded", "(", "buttons", "[", "i", "]", ")", ";", "}", "return", "builder", ".", "getPanel", "(", ")", ";", "}" ]
Make a vertical row of buttons of equal size, whch are equally spaced, and aligned on the right. <P> The returned component has border spacing only on the left (of the size recommended by the Look and Feel Design Guidelines). All other spacing must be applied elsewhere ; usually, this will only mean that the dialog's top-level panel should use {@link #buildStandardBorder}. @param buttons contains <code>JButton</code> objects. @return A column displaying the buttons vertically.
[ "Make", "a", "vertical", "row", "of", "buttons", "of", "equal", "size", "whch", "are", "equally", "spaced", "and", "aligned", "on", "the", "right", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java#L138-L148
11,717
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java
GuiStandardUtils.createStandardTextArea
public static JTextArea createStandardTextArea(String text) { JTextArea result = new JTextArea(text); return configureStandardTextArea(result); }
java
public static JTextArea createStandardTextArea(String text) { JTextArea result = new JTextArea(text); return configureStandardTextArea(result); }
[ "public", "static", "JTextArea", "createStandardTextArea", "(", "String", "text", ")", "{", "JTextArea", "result", "=", "new", "JTextArea", "(", "text", ")", ";", "return", "configureStandardTextArea", "(", "result", ")", ";", "}" ]
An alternative to multi-line labels, for the presentation of several lines of text, and for which the line breaks are determined solely by the control. @param text text that does not contain newline characters or html. @return <code>JTextArea</code> which is not editable, has improved spacing over the supplied default (placing {@link UIConstants#ONE_SPACE}on the left and right), and which wraps lines on word boundarie.
[ "An", "alternative", "to", "multi", "-", "line", "labels", "for", "the", "presentation", "of", "several", "lines", "of", "text", "and", "for", "which", "the", "line", "breaks", "are", "determined", "solely", "by", "the", "control", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java#L202-L205
11,718
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java
GuiStandardUtils.truncateLabelIfLong
public static void truncateLabelIfLong(JLabel label) { String originalText = label.getText(); if (originalText.length() > UIConstants.MAX_LABEL_LENGTH) { label.setToolTipText(originalText); String truncatedText = originalText.substring(0, UIConstants.MAX_LABEL_LENGTH) + "..."; label.setText(truncatedText); } }
java
public static void truncateLabelIfLong(JLabel label) { String originalText = label.getText(); if (originalText.length() > UIConstants.MAX_LABEL_LENGTH) { label.setToolTipText(originalText); String truncatedText = originalText.substring(0, UIConstants.MAX_LABEL_LENGTH) + "..."; label.setText(truncatedText); } }
[ "public", "static", "void", "truncateLabelIfLong", "(", "JLabel", "label", ")", "{", "String", "originalText", "=", "label", ".", "getText", "(", ")", ";", "if", "(", "originalText", ".", "length", "(", ")", ">", "UIConstants", ".", "MAX_LABEL_LENGTH", ")", "{", "label", ".", "setToolTipText", "(", "originalText", ")", ";", "String", "truncatedText", "=", "originalText", ".", "substring", "(", "0", ",", "UIConstants", ".", "MAX_LABEL_LENGTH", ")", "+", "\"...\"", ";", "label", ".", "setText", "(", "truncatedText", ")", ";", "}", "}" ]
If aLabel has text which is longer than MAX_LABEL_LENGTH, then truncate the label text and place an ellipsis at the end; the original text is placed in a tooltip. This is particularly useful for displaying file names, whose length can vary widely between deployments. @param label The label to truncate if length() > MAX_LABEL_LENGTH.
[ "If", "aLabel", "has", "text", "which", "is", "longer", "than", "MAX_LABEL_LENGTH", "then", "truncate", "the", "label", "text", "and", "place", "an", "ellipsis", "at", "the", "end", ";", "the", "original", "text", "is", "placed", "in", "a", "tooltip", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java#L244-L251
11,719
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java
GuiStandardUtils.createDebugBorder
public static void createDebugBorder(JComponent c, Color color) { if (color == null) { color = Color.BLACK; } c.setBorder(BorderFactory.createLineBorder(color)); }
java
public static void createDebugBorder(JComponent c, Color color) { if (color == null) { color = Color.BLACK; } c.setBorder(BorderFactory.createLineBorder(color)); }
[ "public", "static", "void", "createDebugBorder", "(", "JComponent", "c", ",", "Color", "color", ")", "{", "if", "(", "color", "==", "null", ")", "{", "color", "=", "Color", ".", "BLACK", ";", "}", "c", ".", "setBorder", "(", "BorderFactory", ".", "createLineBorder", "(", "color", ")", ")", ";", "}" ]
Useful debug function to place a colored, line border around a component for layout management debugging. @param c the component @param color the border color
[ "Useful", "debug", "function", "to", "place", "a", "colored", "line", "border", "around", "a", "component", "for", "layout", "management", "debugging", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java#L289-L294
11,720
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.append
public GridBagLayoutBuilder append(Component component, int colSpan, int rowSpan) { return append(component, colSpan, rowSpan, 0.0, 0.0); }
java
public GridBagLayoutBuilder append(Component component, int colSpan, int rowSpan) { return append(component, colSpan, rowSpan, 0.0, 0.0); }
[ "public", "GridBagLayoutBuilder", "append", "(", "Component", "component", ",", "int", "colSpan", ",", "int", "rowSpan", ")", "{", "return", "append", "(", "component", ",", "colSpan", ",", "rowSpan", ",", "0.0", ",", "0.0", ")", ";", "}" ]
Appends the given component to the end of the current line, using the default insets and no expansion @param component the component to add to the current line @param colSpan the number of columns to span @param rowSpan the number of rows to span @return "this" to make it easier to string together append calls
[ "Appends", "the", "given", "component", "to", "the", "end", "of", "the", "current", "line", "using", "the", "default", "insets", "and", "no", "expansion" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L145-L147
11,721
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendLabel
public GridBagLayoutBuilder appendLabel(JLabel label, int colSpan) { return append(label, colSpan, 1, false, false); }
java
public GridBagLayoutBuilder appendLabel(JLabel label, int colSpan) { return append(label, colSpan, 1, false, false); }
[ "public", "GridBagLayoutBuilder", "appendLabel", "(", "JLabel", "label", ",", "int", "colSpan", ")", "{", "return", "append", "(", "label", ",", "colSpan", ",", "1", ",", "false", ",", "false", ")", ";", "}" ]
Appends the given label to the end of the current line. The label does not "grow." @param label the label to append @param colSpan the number of columns to span @return "this" to make it easier to string together append calls
[ "Appends", "the", "given", "label", "to", "the", "end", "of", "the", "current", "line", ".", "The", "label", "does", "not", "grow", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L471-L473
11,722
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendField
public GridBagLayoutBuilder appendField(Component component, int colSpan) { return append(component, colSpan, 1, true, false); }
java
public GridBagLayoutBuilder appendField(Component component, int colSpan) { return append(component, colSpan, 1, true, false); }
[ "public", "GridBagLayoutBuilder", "appendField", "(", "Component", "component", ",", "int", "colSpan", ")", "{", "return", "append", "(", "component", ",", "colSpan", ",", "1", ",", "true", ",", "false", ")", ";", "}" ]
Appends the given component to the end of the current line. The component will "grow" horizontally as space allows. @param component the item to append @param colSpan the number of columns to span @return "this" to make it easier to string together append calls
[ "Appends", "the", "given", "component", "to", "the", "end", "of", "the", "current", "line", ".", "The", "component", "will", "grow", "horizontally", "as", "space", "allows", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L562-L564
11,723
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.fire
public void fire(String methodName, Object arg) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg }); } }
java
public void fire(String methodName, Object arg) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg }); } }
[ "public", "void", "fire", "(", "String", "methodName", ",", "Object", "arg", ")", "{", "if", "(", "listeners", "!=", "EMPTY_OBJECT_ARRAY", ")", "{", "fireEventByReflection", "(", "methodName", ",", "new", "Object", "[", "]", "{", "arg", "}", ")", ";", "}", "}" ]
Invokes the method with the given name and a single parameter on each of the listeners registered with this list. @param methodName the name of the method to invoke. @param arg the single argument to pass to each invocation. @throws IllegalArgumentException if no method with the given name and a single formal parameter exists on the listener class managed by this list helper.
[ "Invokes", "the", "method", "with", "the", "given", "name", "and", "a", "single", "parameter", "on", "each", "of", "the", "listeners", "registered", "with", "this", "list", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L233-L237
11,724
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.fire
public void fire(String methodName, Object arg1, Object arg2) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg1, arg2 }); } }
java
public void fire(String methodName, Object arg1, Object arg2) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg1, arg2 }); } }
[ "public", "void", "fire", "(", "String", "methodName", ",", "Object", "arg1", ",", "Object", "arg2", ")", "{", "if", "(", "listeners", "!=", "EMPTY_OBJECT_ARRAY", ")", "{", "fireEventByReflection", "(", "methodName", ",", "new", "Object", "[", "]", "{", "arg1", ",", "arg2", "}", ")", ";", "}", "}" ]
Invokes the method with the given name and two parameters on each of the listeners registered with this list. @param methodName the name of the method to invoke. @param arg1 the first argument to pass to each invocation. @param arg2 the second argument to pass to each invocation. @throws IllegalArgumentException if no method with the given name and 2 formal parameters exists on the listener class managed by this list helper.
[ "Invokes", "the", "method", "with", "the", "given", "name", "and", "two", "parameters", "on", "each", "of", "the", "listeners", "registered", "with", "this", "list", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L250-L254
11,725
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.fire
public void fire(String methodName, Object[] args) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, args); } }
java
public void fire(String methodName, Object[] args) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, args); } }
[ "public", "void", "fire", "(", "String", "methodName", ",", "Object", "[", "]", "args", ")", "{", "if", "(", "listeners", "!=", "EMPTY_OBJECT_ARRAY", ")", "{", "fireEventByReflection", "(", "methodName", ",", "args", ")", ";", "}", "}" ]
Invokes the method with the given name and number of formal parameters on each of the listeners registered with this list. @param methodName the name of the method to invoke. @param args an array of arguments to pass to each invocation. @throws IllegalArgumentException if no method with the given name and number of formal parameters exists on the listener class managed by this list helper.
[ "Invokes", "the", "method", "with", "the", "given", "name", "and", "number", "of", "formal", "parameters", "on", "each", "of", "the", "listeners", "registered", "with", "this", "list", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L266-L270
11,726
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.addAll
public boolean addAll(Object[] listenersToAdd) { if (listenersToAdd == null) { return false; } boolean changed = false; for (int i = 0; i < listenersToAdd.length; i++) { if (add(listenersToAdd[i])) { changed = true; } } return changed; }
java
public boolean addAll(Object[] listenersToAdd) { if (listenersToAdd == null) { return false; } boolean changed = false; for (int i = 0; i < listenersToAdd.length; i++) { if (add(listenersToAdd[i])) { changed = true; } } return changed; }
[ "public", "boolean", "addAll", "(", "Object", "[", "]", "listenersToAdd", ")", "{", "if", "(", "listenersToAdd", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "changed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listenersToAdd", ".", "length", ";", "i", "++", ")", "{", "if", "(", "add", "(", "listenersToAdd", "[", "i", "]", ")", ")", "{", "changed", "=", "true", ";", "}", "}", "return", "changed", ";", "}" ]
Adds all the given listeners to the list of registered listeners. If any of the elements in the array are null or are listeners that are already registered, they will not be registered again. @param listenersToAdd The collection of listeners to be added. May be null. @return true if the list of registered listeners changed as a result of attempting to register the given collection of listeners. @throws IllegalArgumentException if any of the listeners in the given collection are of a type that is not assignable to the class of listener that this instance manages.
[ "Adds", "all", "the", "given", "listeners", "to", "the", "list", "of", "registered", "listeners", ".", "If", "any", "of", "the", "elements", "in", "the", "array", "are", "null", "or", "are", "listeners", "that", "are", "already", "registered", "they", "will", "not", "be", "registered", "again", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L322-L333
11,727
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.fireEventByReflection
private void fireEventByReflection(String methodName, Object[] eventArgs) { Method eventMethod = (Method)methodCache.get(new MethodCacheKey(listenerClass, methodName, eventArgs.length)); Object[] listenersCopy = listeners; for (int i = 0; i < listenersCopy.length; i++) { try { eventMethod.invoke(listenersCopy[i], eventArgs); } catch (InvocationTargetException e) { throw new EventBroadcastException("Exception thrown by listener", e.getCause()); } catch (IllegalAccessException e) { throw new EventBroadcastException("Unable to invoke listener", e); } } }
java
private void fireEventByReflection(String methodName, Object[] eventArgs) { Method eventMethod = (Method)methodCache.get(new MethodCacheKey(listenerClass, methodName, eventArgs.length)); Object[] listenersCopy = listeners; for (int i = 0; i < listenersCopy.length; i++) { try { eventMethod.invoke(listenersCopy[i], eventArgs); } catch (InvocationTargetException e) { throw new EventBroadcastException("Exception thrown by listener", e.getCause()); } catch (IllegalAccessException e) { throw new EventBroadcastException("Unable to invoke listener", e); } } }
[ "private", "void", "fireEventByReflection", "(", "String", "methodName", ",", "Object", "[", "]", "eventArgs", ")", "{", "Method", "eventMethod", "=", "(", "Method", ")", "methodCache", ".", "get", "(", "new", "MethodCacheKey", "(", "listenerClass", ",", "methodName", ",", "eventArgs", ".", "length", ")", ")", ";", "Object", "[", "]", "listenersCopy", "=", "listeners", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listenersCopy", ".", "length", ";", "i", "++", ")", "{", "try", "{", "eventMethod", ".", "invoke", "(", "listenersCopy", "[", "i", "]", ",", "eventArgs", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "EventBroadcastException", "(", "\"Exception thrown by listener\"", ",", "e", ".", "getCause", "(", ")", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "EventBroadcastException", "(", "\"Unable to invoke listener\"", ",", "e", ")", ";", "}", "}", "}" ]
Invokes the method with the given name on each of the listeners registered with this list helper. The given arguments are passed to each method invocation. @param methodName The name of the method to be invoked on the listeners. @param eventArgs The arguments that will be passed to each method invocation. The number of arguments is also used to determine the method to be invoked. @throws EventBroadcastException if an error occurs invoking the event method on any of the listeners.
[ "Invokes", "the", "method", "with", "the", "given", "name", "on", "each", "of", "the", "listeners", "registered", "with", "this", "list", "helper", ".", "The", "given", "arguments", "are", "passed", "to", "each", "method", "invocation", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L395-L409
11,728
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.toArray
public Object toArray() { if (listeners == EMPTY_OBJECT_ARRAY) return Array.newInstance(listenerClass, 0); Object[] listenersCopy = listeners; Object copy = Array.newInstance(listenerClass, listenersCopy.length); System.arraycopy(listenersCopy, 0, copy, 0, listenersCopy.length); return copy; }
java
public Object toArray() { if (listeners == EMPTY_OBJECT_ARRAY) return Array.newInstance(listenerClass, 0); Object[] listenersCopy = listeners; Object copy = Array.newInstance(listenerClass, listenersCopy.length); System.arraycopy(listenersCopy, 0, copy, 0, listenersCopy.length); return copy; }
[ "public", "Object", "toArray", "(", ")", "{", "if", "(", "listeners", "==", "EMPTY_OBJECT_ARRAY", ")", "return", "Array", ".", "newInstance", "(", "listenerClass", ",", "0", ")", ";", "Object", "[", "]", "listenersCopy", "=", "listeners", ";", "Object", "copy", "=", "Array", ".", "newInstance", "(", "listenerClass", ",", "listenersCopy", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "listenersCopy", ",", "0", ",", "copy", ",", "0", ",", "listenersCopy", ".", "length", ")", ";", "return", "copy", ";", "}" ]
Returns an object which is a copy of the collection of listeners registered with this instance. @return A copy of the registered listeners array, never null.
[ "Returns", "an", "object", "which", "is", "a", "copy", "of", "the", "collection", "of", "listeners", "registered", "with", "this", "instance", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L502-L510
11,729
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/AbstractElementGenerator.java
AbstractElementGenerator.reset
protected void reset() { if (this.status == ProcessStatus.STOPPED || this.status == ProcessStatus.COMPLETED) { if (this.runOnce) { throw new UnsupportedOperationException("This process template can only safely execute once; " + "instantiate a new instance per request"); } this.status = ProcessStatus.RESET; } }
java
protected void reset() { if (this.status == ProcessStatus.STOPPED || this.status == ProcessStatus.COMPLETED) { if (this.runOnce) { throw new UnsupportedOperationException("This process template can only safely execute once; " + "instantiate a new instance per request"); } this.status = ProcessStatus.RESET; } }
[ "protected", "void", "reset", "(", ")", "{", "if", "(", "this", ".", "status", "==", "ProcessStatus", ".", "STOPPED", "||", "this", ".", "status", "==", "ProcessStatus", ".", "COMPLETED", ")", "{", "if", "(", "this", ".", "runOnce", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"This process template can only safely execute once; \"", "+", "\"instantiate a new instance per request\"", ")", ";", "}", "this", ".", "status", "=", "ProcessStatus", ".", "RESET", ";", "}", "}" ]
Reset the ElementGenerator if possible. @throws UnsupportedOperationException if this ElementGenerator was a runOnce instance.
[ "Reset", "the", "ElementGenerator", "if", "possible", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/AbstractElementGenerator.java#L158-L167
11,730
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JidePageDescriptor.java
JidePageDescriptor.buildInitialLayout
public void buildInitialLayout(PageLayoutBuilder pageLayout) { for (Iterator iter = _viewDescriptors.iterator(); iter.hasNext();) { String viewDescriptorId = (String) iter.next(); pageLayout.addView(viewDescriptorId); } }
java
public void buildInitialLayout(PageLayoutBuilder pageLayout) { for (Iterator iter = _viewDescriptors.iterator(); iter.hasNext();) { String viewDescriptorId = (String) iter.next(); pageLayout.addView(viewDescriptorId); } }
[ "public", "void", "buildInitialLayout", "(", "PageLayoutBuilder", "pageLayout", ")", "{", "for", "(", "Iterator", "iter", "=", "_viewDescriptors", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "String", "viewDescriptorId", "=", "(", "String", ")", "iter", ".", "next", "(", ")", ";", "pageLayout", ".", "addView", "(", "viewDescriptorId", ")", ";", "}", "}" ]
Builds the initial page layout by iterating the collection of view descriptors.
[ "Builds", "the", "initial", "page", "layout", "by", "iterating", "the", "collection", "of", "view", "descriptors", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/JidePageDescriptor.java#L100-L105
11,731
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/CommitTrigger.java
CommitTrigger.commit
public void commit() { for (Iterator i = listeners.iterator(); i.hasNext();) { ((CommitTriggerListener) i.next()).commit(); } }
java
public void commit() { for (Iterator i = listeners.iterator(); i.hasNext();) { ((CommitTriggerListener) i.next()).commit(); } }
[ "public", "void", "commit", "(", ")", "{", "for", "(", "Iterator", "i", "=", "listeners", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "(", "(", "CommitTriggerListener", ")", "i", ".", "next", "(", ")", ")", ".", "commit", "(", ")", ";", "}", "}" ]
Triggers a commit event.
[ "Triggers", "a", "commit", "event", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/CommitTrigger.java#L43-L47
11,732
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/CommitTrigger.java
CommitTrigger.revert
public void revert() { for (Iterator i = listeners.iterator(); i.hasNext();) { ((CommitTriggerListener) i.next()).revert(); } }
java
public void revert() { for (Iterator i = listeners.iterator(); i.hasNext();) { ((CommitTriggerListener) i.next()).revert(); } }
[ "public", "void", "revert", "(", ")", "{", "for", "(", "Iterator", "i", "=", "listeners", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "(", "(", "CommitTriggerListener", ")", "i", ".", "next", "(", ")", ")", ".", "revert", "(", ")", ";", "}", "}" ]
Triggers a revert event.
[ "Triggers", "a", "revert", "event", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/CommitTrigger.java#L52-L56
11,733
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandRegistry.java
DefaultCommandRegistry.internalSetParent
private void internalSetParent(CommandRegistry parentRegistry) { if (!ObjectUtils.nullSafeEquals(this.parent, parentRegistry)) { if (this.parent != null) { this.parent.removeCommandRegistryListener(this); } this.parent = parentRegistry; if (this.parent != null) { this.parent.addCommandRegistryListener(this); } } }
java
private void internalSetParent(CommandRegistry parentRegistry) { if (!ObjectUtils.nullSafeEquals(this.parent, parentRegistry)) { if (this.parent != null) { this.parent.removeCommandRegistryListener(this); } this.parent = parentRegistry; if (this.parent != null) { this.parent.addCommandRegistryListener(this); } } }
[ "private", "void", "internalSetParent", "(", "CommandRegistry", "parentRegistry", ")", "{", "if", "(", "!", "ObjectUtils", ".", "nullSafeEquals", "(", "this", ".", "parent", ",", "parentRegistry", ")", ")", "{", "if", "(", "this", ".", "parent", "!=", "null", ")", "{", "this", ".", "parent", ".", "removeCommandRegistryListener", "(", "this", ")", ";", "}", "this", ".", "parent", "=", "parentRegistry", ";", "if", "(", "this", ".", "parent", "!=", "null", ")", "{", "this", ".", "parent", ".", "addCommandRegistryListener", "(", "this", ")", ";", "}", "}", "}" ]
This method is provided as a private helper so that it can be called by the constructor, instead of the constructor having to call the public overridable setParent method.
[ "This", "method", "is", "provided", "as", "a", "private", "helper", "so", "that", "it", "can", "be", "called", "by", "the", "constructor", "instead", "of", "the", "constructor", "having", "to", "call", "the", "public", "overridable", "setParent", "method", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandRegistry.java#L83-L99
11,734
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/ImageViewWidget.java
ImageViewWidget.setImage
public void setImage(Resource resource) { ImageIcon image = null; if (resource != null && resource.exists()) { try { image = new ImageIcon(resource.getURL()); } catch (IOException e) { logger.warn("Error reading resource: " + resource); throw new RuntimeException("Error reading resource " + resource, e); } } setImage(image); }
java
public void setImage(Resource resource) { ImageIcon image = null; if (resource != null && resource.exists()) { try { image = new ImageIcon(resource.getURL()); } catch (IOException e) { logger.warn("Error reading resource: " + resource); throw new RuntimeException("Error reading resource " + resource, e); } } setImage(image); }
[ "public", "void", "setImage", "(", "Resource", "resource", ")", "{", "ImageIcon", "image", "=", "null", ";", "if", "(", "resource", "!=", "null", "&&", "resource", ".", "exists", "(", ")", ")", "{", "try", "{", "image", "=", "new", "ImageIcon", "(", "resource", ".", "getURL", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "warn", "(", "\"Error reading resource: \"", "+", "resource", ")", ";", "throw", "new", "RuntimeException", "(", "\"Error reading resource \"", "+", "resource", ",", "e", ")", ";", "}", "}", "setImage", "(", "image", ")", ";", "}" ]
Sets the image content of the widget based on a resource @param resource points to a image resource
[ "Sets", "the", "image", "content", "of", "the", "widget", "based", "on", "a", "resource" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/ImageViewWidget.java#L66-L82
11,735
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java
HtmlPane.setAntiAlias
public void setAntiAlias(boolean antiAlias) { if (this.antiAlias == antiAlias) { return; } this.antiAlias = antiAlias; firePropertyChange("antiAlias", !antiAlias, antiAlias); repaint(); }
java
public void setAntiAlias(boolean antiAlias) { if (this.antiAlias == antiAlias) { return; } this.antiAlias = antiAlias; firePropertyChange("antiAlias", !antiAlias, antiAlias); repaint(); }
[ "public", "void", "setAntiAlias", "(", "boolean", "antiAlias", ")", "{", "if", "(", "this", ".", "antiAlias", "==", "antiAlias", ")", "{", "return", ";", "}", "this", ".", "antiAlias", "=", "antiAlias", ";", "firePropertyChange", "(", "\"antiAlias\"", ",", "!", "antiAlias", ",", "antiAlias", ")", ";", "repaint", "(", ")", ";", "}" ]
Set whether the pane should render the HTML using anti-aliasing.
[ "Set", "whether", "the", "pane", "should", "render", "the", "HTML", "using", "anti", "-", "aliasing", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java#L80-L87
11,736
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java
HtmlPane.setAllowSelection
public void setAllowSelection(boolean allowSelection) { if (this.allowSelection == allowSelection) { return; } this.allowSelection = allowSelection; setCaretInternal(); firePropertyChange("allowSelection", !allowSelection, allowSelection); }
java
public void setAllowSelection(boolean allowSelection) { if (this.allowSelection == allowSelection) { return; } this.allowSelection = allowSelection; setCaretInternal(); firePropertyChange("allowSelection", !allowSelection, allowSelection); }
[ "public", "void", "setAllowSelection", "(", "boolean", "allowSelection", ")", "{", "if", "(", "this", ".", "allowSelection", "==", "allowSelection", ")", "{", "return", ";", "}", "this", ".", "allowSelection", "=", "allowSelection", ";", "setCaretInternal", "(", ")", ";", "firePropertyChange", "(", "\"allowSelection\"", ",", "!", "allowSelection", ",", "allowSelection", ")", ";", "}" ]
Set whether or not selection should be allowed in this pane.
[ "Set", "whether", "or", "not", "selection", "should", "be", "allowed", "in", "this", "pane", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java#L99-L106
11,737
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java
HtmlPane.installLaFStyleSheet
protected void installLaFStyleSheet() { Font defaultFont = UIManager.getFont("Button.font"); String stylesheet = "body { font-family: " + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt; }" + "a, p, li { font-family: " + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt; }"; try { ((HTMLDocument)getDocument()).getStyleSheet().loadRules(new StringReader(stylesheet), null); } catch (IOException e) { } }
java
protected void installLaFStyleSheet() { Font defaultFont = UIManager.getFont("Button.font"); String stylesheet = "body { font-family: " + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt; }" + "a, p, li { font-family: " + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt; }"; try { ((HTMLDocument)getDocument()).getStyleSheet().loadRules(new StringReader(stylesheet), null); } catch (IOException e) { } }
[ "protected", "void", "installLaFStyleSheet", "(", ")", "{", "Font", "defaultFont", "=", "UIManager", ".", "getFont", "(", "\"Button.font\"", ")", ";", "String", "stylesheet", "=", "\"body { font-family: \"", "+", "defaultFont", ".", "getName", "(", ")", "+", "\"; font-size: \"", "+", "defaultFont", ".", "getSize", "(", ")", "+", "\"pt; }\"", "+", "\"a, p, li { font-family: \"", "+", "defaultFont", ".", "getName", "(", ")", "+", "\"; font-size: \"", "+", "defaultFont", ".", "getSize", "(", ")", "+", "\"pt; }\"", ";", "try", "{", "(", "(", "HTMLDocument", ")", "getDocument", "(", ")", ")", ".", "getStyleSheet", "(", ")", ".", "loadRules", "(", "new", "StringReader", "(", "stylesheet", ")", ",", "null", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}" ]
Applies the current LaF font setting to the document.
[ "Applies", "the", "current", "LaF", "font", "setting", "to", "the", "document", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/HtmlPane.java#L129-L139
11,738
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.add
public void add(ApplicationWindow window) { if (activeWindow == null) // first window will be set as activeWindow setActiveWindow(window); if (!windows.contains(window)) { windows.add(window); window.setWindowManager(this); setChanged(); notifyObservers(); } }
java
public void add(ApplicationWindow window) { if (activeWindow == null) // first window will be set as activeWindow setActiveWindow(window); if (!windows.contains(window)) { windows.add(window); window.setWindowManager(this); setChanged(); notifyObservers(); } }
[ "public", "void", "add", "(", "ApplicationWindow", "window", ")", "{", "if", "(", "activeWindow", "==", "null", ")", "// first window will be set as activeWindow", "setActiveWindow", "(", "window", ")", ";", "if", "(", "!", "windows", ".", "contains", "(", "window", ")", ")", "{", "windows", ".", "add", "(", "window", ")", ";", "window", ".", "setWindowManager", "(", "this", ")", ";", "setChanged", "(", ")", ";", "notifyObservers", "(", ")", ";", "}", "}" ]
Adds the given window to the set of windows managed by this window manager. Does nothing is this window is already managed by this window manager. @param window the window
[ "Adds", "the", "given", "window", "to", "the", "set", "of", "windows", "managed", "by", "this", "window", "manager", ".", "Does", "nothing", "is", "this", "window", "is", "already", "managed", "by", "this", "window", "manager", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L80-L90
11,739
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.addWindowManager
private void addWindowManager(WindowManager wm) { if (subManagers == null) { subManagers = new ArrayList(); } if (!subManagers.contains(wm)) { subManagers.add(wm); wm.parentManager = this; } }
java
private void addWindowManager(WindowManager wm) { if (subManagers == null) { subManagers = new ArrayList(); } if (!subManagers.contains(wm)) { subManagers.add(wm); wm.parentManager = this; } }
[ "private", "void", "addWindowManager", "(", "WindowManager", "wm", ")", "{", "if", "(", "subManagers", "==", "null", ")", "{", "subManagers", "=", "new", "ArrayList", "(", ")", ";", "}", "if", "(", "!", "subManagers", ".", "contains", "(", "wm", ")", ")", "{", "subManagers", ".", "add", "(", "wm", ")", ";", "wm", ".", "parentManager", "=", "this", ";", "}", "}" ]
Adds the given window manager to the list of window managers that have this one as a parent. @param wm the child window manager
[ "Adds", "the", "given", "window", "manager", "to", "the", "list", "of", "window", "managers", "that", "have", "this", "one", "as", "a", "parent", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L99-L107
11,740
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.close
public boolean close() { List t = (List)((ArrayList)windows).clone(); Iterator e = t.iterator(); while (e.hasNext()) { ApplicationWindow window = (ApplicationWindow)e.next(); if (!window.close()) { return false; } } if (subManagers != null) { e = subManagers.iterator(); while (e.hasNext()) { WindowManager wm = (WindowManager)e.next(); if (!wm.close()) { return false; } } } return true; }
java
public boolean close() { List t = (List)((ArrayList)windows).clone(); Iterator e = t.iterator(); while (e.hasNext()) { ApplicationWindow window = (ApplicationWindow)e.next(); if (!window.close()) { return false; } } if (subManagers != null) { e = subManagers.iterator(); while (e.hasNext()) { WindowManager wm = (WindowManager)e.next(); if (!wm.close()) { return false; } } } return true; }
[ "public", "boolean", "close", "(", ")", "{", "List", "t", "=", "(", "List", ")", "(", "(", "ArrayList", ")", "windows", ")", ".", "clone", "(", ")", ";", "Iterator", "e", "=", "t", ".", "iterator", "(", ")", ";", "while", "(", "e", ".", "hasNext", "(", ")", ")", "{", "ApplicationWindow", "window", "=", "(", "ApplicationWindow", ")", "e", ".", "next", "(", ")", ";", "if", "(", "!", "window", ".", "close", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "subManagers", "!=", "null", ")", "{", "e", "=", "subManagers", ".", "iterator", "(", ")", ";", "while", "(", "e", ".", "hasNext", "(", ")", ")", "{", "WindowManager", "wm", "=", "(", "WindowManager", ")", "e", ".", "next", "(", ")", ";", "if", "(", "!", "wm", ".", "close", "(", ")", ")", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
Attempts to close all windows managed by this window manager, as well as windows managed by any descendent window managers. @return <code>true</code> if all windows were sucessfully closed, and <code>false</code> if any window refused to close
[ "Attempts", "to", "close", "all", "windows", "managed", "by", "this", "window", "manager", "as", "well", "as", "windows", "managed", "by", "any", "descendent", "window", "managers", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L116-L131
11,741
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.getWindows
public ApplicationWindow[] getWindows() { ApplicationWindow managed[] = new ApplicationWindow[windows.size()]; windows.toArray(managed); return managed; }
java
public ApplicationWindow[] getWindows() { ApplicationWindow managed[] = new ApplicationWindow[windows.size()]; windows.toArray(managed); return managed; }
[ "public", "ApplicationWindow", "[", "]", "getWindows", "(", ")", "{", "ApplicationWindow", "managed", "[", "]", "=", "new", "ApplicationWindow", "[", "windows", ".", "size", "(", ")", "]", ";", "windows", ".", "toArray", "(", "managed", ")", ";", "return", "managed", ";", "}" ]
Returns this window manager's set of windows. @return a possibly empty list of window
[ "Returns", "this", "window", "manager", "s", "set", "of", "windows", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L138-L142
11,742
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.remove
public final void remove(ApplicationWindow window) { if (windows.contains(window)) { windows.remove(window); window.setWindowManager(null); setChanged(); notifyObservers(); } }
java
public final void remove(ApplicationWindow window) { if (windows.contains(window)) { windows.remove(window); window.setWindowManager(null); setChanged(); notifyObservers(); } }
[ "public", "final", "void", "remove", "(", "ApplicationWindow", "window", ")", "{", "if", "(", "windows", ".", "contains", "(", "window", ")", ")", "{", "windows", ".", "remove", "(", "window", ")", ";", "window", ".", "setWindowManager", "(", "null", ")", ";", "setChanged", "(", ")", ";", "notifyObservers", "(", ")", ";", "}", "}" ]
Removes the given window from the set of windows managed by this window manager. Does nothing is this window is not managed by this window manager. @param window the window
[ "Removes", "the", "given", "window", "from", "the", "set", "of", "windows", "managed", "by", "this", "window", "manager", ".", "Does", "nothing", "is", "this", "window", "is", "not", "managed", "by", "this", "window", "manager", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L159-L166
11,743
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java
WindowManager.setActiveWindow
public final void setActiveWindow(ApplicationWindow window) { final ApplicationWindow old = this.activeWindow; this.activeWindow = window; if (getParent() != null) // let things ripple up getParent().setActiveWindow(window); getChangeSupport().firePropertyChange("activeWindow", old, window); }
java
public final void setActiveWindow(ApplicationWindow window) { final ApplicationWindow old = this.activeWindow; this.activeWindow = window; if (getParent() != null) // let things ripple up getParent().setActiveWindow(window); getChangeSupport().firePropertyChange("activeWindow", old, window); }
[ "public", "final", "void", "setActiveWindow", "(", "ApplicationWindow", "window", ")", "{", "final", "ApplicationWindow", "old", "=", "this", ".", "activeWindow", ";", "this", ".", "activeWindow", "=", "window", ";", "if", "(", "getParent", "(", ")", "!=", "null", ")", "// let things ripple up", "getParent", "(", ")", ".", "setActiveWindow", "(", "window", ")", ";", "getChangeSupport", "(", ")", ".", "firePropertyChange", "(", "\"activeWindow\"", ",", "old", ",", "window", ")", ";", "}" ]
Set the currently active window. When a window gets focus, it will set itself as the current window of it's manager. @param window
[ "Set", "the", "currently", "active", "window", ".", "When", "a", "window", "gets", "focus", "it", "will", "set", "itself", "as", "the", "current", "window", "of", "it", "s", "manager", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/WindowManager.java#L174-L181
11,744
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/AbstractApplicationLifecycleAdvisor.java
AbstractApplicationLifecycleAdvisor.onPreWindowOpen
@Override public void onPreWindowOpen(ApplicationWindowConfigurer configurer) { configurer.setTitle(application.getName()); configurer.setImage(application.getImage()); }
java
@Override public void onPreWindowOpen(ApplicationWindowConfigurer configurer) { configurer.setTitle(application.getName()); configurer.setImage(application.getImage()); }
[ "@", "Override", "public", "void", "onPreWindowOpen", "(", "ApplicationWindowConfigurer", "configurer", ")", "{", "configurer", ".", "setTitle", "(", "application", ".", "getName", "(", ")", ")", ";", "configurer", ".", "setImage", "(", "application", ".", "getImage", "(", ")", ")", ";", "}" ]
Hook called right before the application opens a window. @param configurer
[ "Hook", "called", "right", "before", "the", "application", "opens", "a", "window", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/AbstractApplicationLifecycleAdvisor.java#L81-L85
11,745
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/ListListModel.java
ListListModel.set
public Object set(int index, Object element) { Object oldObject = items.set(index, element); if (hasChanged(oldObject, element)) { fireContentsChanged(index); } return oldObject; }
java
public Object set(int index, Object element) { Object oldObject = items.set(index, element); if (hasChanged(oldObject, element)) { fireContentsChanged(index); } return oldObject; }
[ "public", "Object", "set", "(", "int", "index", ",", "Object", "element", ")", "{", "Object", "oldObject", "=", "items", ".", "set", "(", "index", ",", "element", ")", ";", "if", "(", "hasChanged", "(", "oldObject", ",", "element", ")", ")", "{", "fireContentsChanged", "(", "index", ")", ";", "}", "return", "oldObject", ";", "}" ]
Set the value of a list element at the specified index. @param index of element to set @param element New element value @return old element value
[ "Set", "the", "value", "of", "a", "list", "element", "at", "the", "specified", "index", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/ListListModel.java#L226-L232
11,746
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/ListListModel.java
ListListModel.replaceWith
public boolean replaceWith(Collection collection) { boolean changed = false; if (items.size() > 0) { items.clear(); changed = true; } if (items.addAll(0, collection) && !changed) { changed = true; } if (changed) { fireContentsChanged(-1, -1); } return changed; }
java
public boolean replaceWith(Collection collection) { boolean changed = false; if (items.size() > 0) { items.clear(); changed = true; } if (items.addAll(0, collection) && !changed) { changed = true; } if (changed) { fireContentsChanged(-1, -1); } return changed; }
[ "public", "boolean", "replaceWith", "(", "Collection", "collection", ")", "{", "boolean", "changed", "=", "false", ";", "if", "(", "items", ".", "size", "(", ")", ">", "0", ")", "{", "items", ".", "clear", "(", ")", ";", "changed", "=", "true", ";", "}", "if", "(", "items", ".", "addAll", "(", "0", ",", "collection", ")", "&&", "!", "changed", ")", "{", "changed", "=", "true", ";", "}", "if", "(", "changed", ")", "{", "fireContentsChanged", "(", "-", "1", ",", "-", "1", ")", ";", "}", "return", "changed", ";", "}" ]
Replace this list model's items with the contents of the provided collection. @param collection The collection to replace with
[ "Replace", "this", "list", "model", "s", "items", "with", "the", "contents", "of", "the", "provided", "collection", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/ListListModel.java#L288-L301
11,747
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/glazedlists/GlazedListsSupport.java
GlazedListsSupport.makeTableFormat
public static TableFormat makeTableFormat(final TableDescription desc) { return new AdvancedWritableTableFormat() { public Class getColumnClass(int i) { return desc.getType(i); } public Comparator getColumnComparator(int i) { Comparator comp = desc.getColumnComparator(i); if (comp != null) return comp; Class type = getColumnClass(i); if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.isAssignableFrom(type)) return GlazedLists.booleanComparator(); else if (String.class.isAssignableFrom(type)) return getLowerCaseStringComparator(); else if(Comparable.class.isAssignableFrom(type)) return GlazedLists.comparableComparator(); else return null; } public int getColumnCount() { return desc.getColumnCount(); } public String getColumnName(int i) { return desc.getHeader(i); } public Object getColumnValue(Object obj, int i) { return desc.getValue(obj, i); } public boolean isEditable(Object baseObject, int column) { return desc.getColumnEditor(column) != null; } public Object setColumnValue(Object baseObject, Object editedValue, int column) { desc.setValue(baseObject, column, editedValue); return baseObject; } }; }
java
public static TableFormat makeTableFormat(final TableDescription desc) { return new AdvancedWritableTableFormat() { public Class getColumnClass(int i) { return desc.getType(i); } public Comparator getColumnComparator(int i) { Comparator comp = desc.getColumnComparator(i); if (comp != null) return comp; Class type = getColumnClass(i); if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.isAssignableFrom(type)) return GlazedLists.booleanComparator(); else if (String.class.isAssignableFrom(type)) return getLowerCaseStringComparator(); else if(Comparable.class.isAssignableFrom(type)) return GlazedLists.comparableComparator(); else return null; } public int getColumnCount() { return desc.getColumnCount(); } public String getColumnName(int i) { return desc.getHeader(i); } public Object getColumnValue(Object obj, int i) { return desc.getValue(obj, i); } public boolean isEditable(Object baseObject, int column) { return desc.getColumnEditor(column) != null; } public Object setColumnValue(Object baseObject, Object editedValue, int column) { desc.setValue(baseObject, column, editedValue); return baseObject; } }; }
[ "public", "static", "TableFormat", "makeTableFormat", "(", "final", "TableDescription", "desc", ")", "{", "return", "new", "AdvancedWritableTableFormat", "(", ")", "{", "public", "Class", "getColumnClass", "(", "int", "i", ")", "{", "return", "desc", ".", "getType", "(", "i", ")", ";", "}", "public", "Comparator", "getColumnComparator", "(", "int", "i", ")", "{", "Comparator", "comp", "=", "desc", ".", "getColumnComparator", "(", "i", ")", ";", "if", "(", "comp", "!=", "null", ")", "return", "comp", ";", "Class", "type", "=", "getColumnClass", "(", "i", ")", ";", "if", "(", "Boolean", ".", "class", ".", "isAssignableFrom", "(", "type", ")", "||", "Boolean", ".", "TYPE", ".", "isAssignableFrom", "(", "type", ")", ")", "return", "GlazedLists", ".", "booleanComparator", "(", ")", ";", "else", "if", "(", "String", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "return", "getLowerCaseStringComparator", "(", ")", ";", "else", "if", "(", "Comparable", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "return", "GlazedLists", ".", "comparableComparator", "(", ")", ";", "else", "return", "null", ";", "}", "public", "int", "getColumnCount", "(", ")", "{", "return", "desc", ".", "getColumnCount", "(", ")", ";", "}", "public", "String", "getColumnName", "(", "int", "i", ")", "{", "return", "desc", ".", "getHeader", "(", "i", ")", ";", "}", "public", "Object", "getColumnValue", "(", "Object", "obj", ",", "int", "i", ")", "{", "return", "desc", ".", "getValue", "(", "obj", ",", "i", ")", ";", "}", "public", "boolean", "isEditable", "(", "Object", "baseObject", ",", "int", "column", ")", "{", "return", "desc", ".", "getColumnEditor", "(", "column", ")", "!=", "null", ";", "}", "public", "Object", "setColumnValue", "(", "Object", "baseObject", ",", "Object", "editedValue", ",", "int", "column", ")", "{", "desc", ".", "setValue", "(", "baseObject", ",", "column", ",", "editedValue", ")", ";", "return", "baseObject", ";", "}", "}", ";", "}" ]
Conversion of RCP TableDescription to GlazedLists TableFormat @param desc @return AdvancedWritableTableFormat
[ "Conversion", "of", "RCP", "TableDescription", "to", "GlazedLists", "TableFormat" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/glazedlists/GlazedListsSupport.java#L48-L100
11,748
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/validation/support/JSR303Validator.java
JSR303Validator.doValidate
protected Set<ConstraintViolation<T>> doValidate(final T object, final String property) { if (property == null) { final Set<ConstraintViolation<T>> ret = Sets.newHashSet(); PropertyDescriptor[] propertyDescriptors; try { propertyDescriptors = Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors(); } catch (IntrospectionException e) { throw new IllegalStateException("Could not retrieve property information"); } for (final PropertyDescriptor prop : propertyDescriptors) { String propertyName = prop.getName(); if (formModel.hasValueModel(propertyName) && !ignoredProperties.contains(propertyName)) { final Set<ConstraintViolation<T>> result = validator.validateValue(beanClass, propertyName, formModel .getValueModel(propertyName).getValue()); //validator.validateProperty(object, propertyName); if (result != null) { ret.addAll(result); } } } return ret; } else if (!ignoredProperties.contains(property) && formModel.hasValueModel(property)) { return validator.validateValue(beanClass, property, formModel .getValueModel(property).getValue()); } else { return null; } }
java
protected Set<ConstraintViolation<T>> doValidate(final T object, final String property) { if (property == null) { final Set<ConstraintViolation<T>> ret = Sets.newHashSet(); PropertyDescriptor[] propertyDescriptors; try { propertyDescriptors = Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors(); } catch (IntrospectionException e) { throw new IllegalStateException("Could not retrieve property information"); } for (final PropertyDescriptor prop : propertyDescriptors) { String propertyName = prop.getName(); if (formModel.hasValueModel(propertyName) && !ignoredProperties.contains(propertyName)) { final Set<ConstraintViolation<T>> result = validator.validateValue(beanClass, propertyName, formModel .getValueModel(propertyName).getValue()); //validator.validateProperty(object, propertyName); if (result != null) { ret.addAll(result); } } } return ret; } else if (!ignoredProperties.contains(property) && formModel.hasValueModel(property)) { return validator.validateValue(beanClass, property, formModel .getValueModel(property).getValue()); } else { return null; } }
[ "protected", "Set", "<", "ConstraintViolation", "<", "T", ">", ">", "doValidate", "(", "final", "T", "object", ",", "final", "String", "property", ")", "{", "if", "(", "property", "==", "null", ")", "{", "final", "Set", "<", "ConstraintViolation", "<", "T", ">", ">", "ret", "=", "Sets", ".", "newHashSet", "(", ")", ";", "PropertyDescriptor", "[", "]", "propertyDescriptors", ";", "try", "{", "propertyDescriptors", "=", "Introspector", ".", "getBeanInfo", "(", "object", ".", "getClass", "(", ")", ")", ".", "getPropertyDescriptors", "(", ")", ";", "}", "catch", "(", "IntrospectionException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not retrieve property information\"", ")", ";", "}", "for", "(", "final", "PropertyDescriptor", "prop", ":", "propertyDescriptors", ")", "{", "String", "propertyName", "=", "prop", ".", "getName", "(", ")", ";", "if", "(", "formModel", ".", "hasValueModel", "(", "propertyName", ")", "&&", "!", "ignoredProperties", ".", "contains", "(", "propertyName", ")", ")", "{", "final", "Set", "<", "ConstraintViolation", "<", "T", ">", ">", "result", "=", "validator", ".", "validateValue", "(", "beanClass", ",", "propertyName", ",", "formModel", ".", "getValueModel", "(", "propertyName", ")", ".", "getValue", "(", ")", ")", ";", "//validator.validateProperty(object, propertyName);", "if", "(", "result", "!=", "null", ")", "{", "ret", ".", "addAll", "(", "result", ")", ";", "}", "}", "}", "return", "ret", ";", "}", "else", "if", "(", "!", "ignoredProperties", ".", "contains", "(", "property", ")", "&&", "formModel", ".", "hasValueModel", "(", "property", ")", ")", "{", "return", "validator", ".", "validateValue", "(", "beanClass", ",", "property", ",", "formModel", ".", "getValueModel", "(", "property", ")", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Validates the object through Hibernate Validator @param object The object that needs to be validated @param property The properties that needs to be validated @return An array of {@link ConstraintViolation}, containing all validation errors
[ "Validates", "the", "object", "through", "Hibernate", "Validator" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/validation/support/JSR303Validator.java#L124-L153
11,749
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java
ObjectUtils.getAllDeclaredFields
public static Field[] getAllDeclaredFields(Class<?> leafClass) { Assert.notNull(leafClass, "leafClass"); final List<Field> fields = new ArrayList<Field>(32); ReflectionUtils.doWithFields(leafClass, new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { fields.add(field); } }); return fields.toArray(new Field[fields.size()]); }
java
public static Field[] getAllDeclaredFields(Class<?> leafClass) { Assert.notNull(leafClass, "leafClass"); final List<Field> fields = new ArrayList<Field>(32); ReflectionUtils.doWithFields(leafClass, new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { fields.add(field); } }); return fields.toArray(new Field[fields.size()]); }
[ "public", "static", "Field", "[", "]", "getAllDeclaredFields", "(", "Class", "<", "?", ">", "leafClass", ")", "{", "Assert", ".", "notNull", "(", "leafClass", ",", "\"leafClass\"", ")", ";", "final", "List", "<", "Field", ">", "fields", "=", "new", "ArrayList", "<", "Field", ">", "(", "32", ")", ";", "ReflectionUtils", ".", "doWithFields", "(", "leafClass", ",", "new", "ReflectionUtils", ".", "FieldCallback", "(", ")", "{", "@", "Override", "public", "void", "doWith", "(", "Field", "field", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", "{", "fields", ".", "add", "(", "field", ")", ";", "}", "}", ")", ";", "return", "fields", ".", "toArray", "(", "new", "Field", "[", "fields", ".", "size", "(", ")", "]", ")", ";", "}" ]
Get all declared fields on the leaf class and all superclasses. Leaf class methods are included first. @param leafClass the leaf class. @return all declared fields. @see ReflectionUtils#getAllDeclaredMethods(Class) since is the same approach as this one.
[ "Get", "all", "declared", "fields", "on", "the", "leaf", "class", "and", "all", "superclasses", ".", "Leaf", "class", "methods", "are", "included", "first", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L150-L166
11,750
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java
ObjectUtils.unwrapProxy
public static Object unwrapProxy(Object bean, Boolean recursive) { Assert.notNull(recursive, "recursive"); Object unwrapped = bean; // If the given object is a proxy, set the return value as the object being proxied, otherwise return the given // object if ((bean != null) && (bean instanceof Advised) && (AopUtils.isAopProxy(bean))) { final Advised advised = (Advised) bean; try { final Object target = advised.getTargetSource().getTarget(); unwrapped = recursive ? ObjectUtils.unwrapProxy(target, recursive) : target; } catch (Exception e) { unwrapped = bean; ObjectUtils.LOGGER.warn("Failure unwrapping \"" + bean + "\".", e); } } return unwrapped; }
java
public static Object unwrapProxy(Object bean, Boolean recursive) { Assert.notNull(recursive, "recursive"); Object unwrapped = bean; // If the given object is a proxy, set the return value as the object being proxied, otherwise return the given // object if ((bean != null) && (bean instanceof Advised) && (AopUtils.isAopProxy(bean))) { final Advised advised = (Advised) bean; try { final Object target = advised.getTargetSource().getTarget(); unwrapped = recursive ? ObjectUtils.unwrapProxy(target, recursive) : target; } catch (Exception e) { unwrapped = bean; ObjectUtils.LOGGER.warn("Failure unwrapping \"" + bean + "\".", e); } } return unwrapped; }
[ "public", "static", "Object", "unwrapProxy", "(", "Object", "bean", ",", "Boolean", "recursive", ")", "{", "Assert", ".", "notNull", "(", "recursive", ",", "\"recursive\"", ")", ";", "Object", "unwrapped", "=", "bean", ";", "// If the given object is a proxy, set the return value as the object being proxied, otherwise return the given", "// object", "if", "(", "(", "bean", "!=", "null", ")", "&&", "(", "bean", "instanceof", "Advised", ")", "&&", "(", "AopUtils", ".", "isAopProxy", "(", "bean", ")", ")", ")", "{", "final", "Advised", "advised", "=", "(", "Advised", ")", "bean", ";", "try", "{", "final", "Object", "target", "=", "advised", ".", "getTargetSource", "(", ")", ".", "getTarget", "(", ")", ";", "unwrapped", "=", "recursive", "?", "ObjectUtils", ".", "unwrapProxy", "(", "target", ",", "recursive", ")", ":", "target", ";", "}", "catch", "(", "Exception", "e", ")", "{", "unwrapped", "=", "bean", ";", "ObjectUtils", ".", "LOGGER", ".", "warn", "(", "\"Failure unwrapping \\\"\"", "+", "bean", "+", "\"\\\".\"", ",", "e", ")", ";", "}", "}", "return", "unwrapped", ";", "}" ]
This is a utility method for getting raw objects that may have been proxied. It is intended to be used in cases where raw implementations are needed rather than working with interfaces which they implement. @param bean the potential proxy. @param recursive whether to procceeed recursively through nested proxies. @return the unwrapped bean or <code>null</code> if target bean is <code>null</code>. If <code>recursive</code> parameter is <code>true</code> then returns the most inner unwrapped bean, otherwise the nearest target bean is returned. Based on this <a href="http://forum.springsource.org/showthread.php?t=60216">Spring forum topic</a>. @see Advised @since 20101223 thanks to <a href="http://jirabluebell.b2b2000.com/browse/BLUE-34">BLUE-34</a>
[ "This", "is", "a", "utility", "method", "for", "getting", "raw", "objects", "that", "may", "have", "been", "proxied", ".", "It", "is", "intended", "to", "be", "used", "in", "cases", "where", "raw", "implementations", "are", "needed", "rather", "than", "working", "with", "interfaces", "which", "they", "implement", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L242-L264
11,751
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java
ObjectUtils.mapObjectOnFormModel
public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } } }
java
public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } } }
[ "public", "static", "void", "mapObjectOnFormModel", "(", "FormModel", "formModel", ",", "Object", "objectToMap", ")", "{", "BeanWrapper", "beanWrapper", "=", "new", "BeanWrapperImpl", "(", "objectToMap", ")", ";", "for", "(", "String", "fieldName", ":", "(", "Set", "<", "String", ">", ")", "formModel", ".", "getFieldNames", "(", ")", ")", "{", "try", "{", "formModel", ".", "getValueModel", "(", "fieldName", ")", ".", "setValue", "(", "beanWrapper", ".", "getPropertyValue", "(", "fieldName", ")", ")", ";", "}", "catch", "(", "BeansException", "be", ")", "{", "// silently ignoring, just mapping values, so if there's one missing, don't bother", "}", "}", "}" ]
This method tries to map the values of the given object on the valueModels of the formModel. Instead of setting the object as a backing object, all valueModels are processed one by one and the corresponding property value is fetched from the objectToMap and set on that valueModel. This triggers the usual buffering etc. just as if the user entered the values. @param formModel @param objectToMap
[ "This", "method", "tries", "to", "map", "the", "values", "of", "the", "given", "object", "on", "the", "valueModels", "of", "the", "formModel", ".", "Instead", "of", "setting", "the", "object", "as", "a", "backing", "object", "all", "valueModels", "are", "processed", "one", "by", "one", "and", "the", "corresponding", "property", "value", "is", "fetched", "from", "the", "objectToMap", "and", "set", "on", "that", "valueModel", ".", "This", "triggers", "the", "usual", "buffering", "etc", ".", "just", "as", "if", "the", "user", "entered", "the", "values", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L327-L341
11,752
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingApplicationPageFactory.java
VLDockingApplicationPageFactory.saveDockingContext
private void saveDockingContext(VLDockingApplicationPage dockingPage) { DockingContext dockingContext = dockingPage.getDockingContext(); // Page descriptor needed for config path VLDockingPageDescriptor vlDockingPageDescriptor = ValkyrieRepository.getInstance().getBean(dockingPage.getId(), VLDockingPageDescriptor.class); // Write docking context to file BufferedOutputStream buffOs = null; try { File desktopLayoutFile = vlDockingPageDescriptor.getInitialLayout().getFile(); checkForConfigPath(desktopLayoutFile); buffOs = new BufferedOutputStream(new FileOutputStream(desktopLayoutFile)); dockingContext.writeXML(buffOs); buffOs.close(); logger.debug("Wrote docking context to config file " + desktopLayoutFile); } catch (IOException e) { logger.warn("Error writing VLDocking config", e); } finally { try { if(buffOs != null) buffOs.close(); } catch (Exception e) { logger.debug("Error closing layoutfile", e); } } }
java
private void saveDockingContext(VLDockingApplicationPage dockingPage) { DockingContext dockingContext = dockingPage.getDockingContext(); // Page descriptor needed for config path VLDockingPageDescriptor vlDockingPageDescriptor = ValkyrieRepository.getInstance().getBean(dockingPage.getId(), VLDockingPageDescriptor.class); // Write docking context to file BufferedOutputStream buffOs = null; try { File desktopLayoutFile = vlDockingPageDescriptor.getInitialLayout().getFile(); checkForConfigPath(desktopLayoutFile); buffOs = new BufferedOutputStream(new FileOutputStream(desktopLayoutFile)); dockingContext.writeXML(buffOs); buffOs.close(); logger.debug("Wrote docking context to config file " + desktopLayoutFile); } catch (IOException e) { logger.warn("Error writing VLDocking config", e); } finally { try { if(buffOs != null) buffOs.close(); } catch (Exception e) { logger.debug("Error closing layoutfile", e); } } }
[ "private", "void", "saveDockingContext", "(", "VLDockingApplicationPage", "dockingPage", ")", "{", "DockingContext", "dockingContext", "=", "dockingPage", ".", "getDockingContext", "(", ")", ";", "// Page descriptor needed for config path", "VLDockingPageDescriptor", "vlDockingPageDescriptor", "=", "ValkyrieRepository", ".", "getInstance", "(", ")", ".", "getBean", "(", "dockingPage", ".", "getId", "(", ")", ",", "VLDockingPageDescriptor", ".", "class", ")", ";", "// Write docking context to file", "BufferedOutputStream", "buffOs", "=", "null", ";", "try", "{", "File", "desktopLayoutFile", "=", "vlDockingPageDescriptor", ".", "getInitialLayout", "(", ")", ".", "getFile", "(", ")", ";", "checkForConfigPath", "(", "desktopLayoutFile", ")", ";", "buffOs", "=", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "desktopLayoutFile", ")", ")", ";", "dockingContext", ".", "writeXML", "(", "buffOs", ")", ";", "buffOs", ".", "close", "(", ")", ";", "logger", ".", "debug", "(", "\"Wrote docking context to config file \"", "+", "desktopLayoutFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "warn", "(", "\"Error writing VLDocking config\"", ",", "e", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "buffOs", "!=", "null", ")", "buffOs", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "debug", "(", "\"Error closing layoutfile\"", ",", "e", ")", ";", "}", "}", "}" ]
Saves the docking layout of a docking page fo the application @param dockingPage The application window (needed to hook in for the docking context)
[ "Saves", "the", "docking", "layout", "of", "a", "docking", "page", "fo", "the", "application" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingApplicationPageFactory.java#L80-L110
11,753
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingApplicationPageFactory.java
VLDockingApplicationPageFactory.checkForConfigPath
private void checkForConfigPath(File configFile) { String desktopLayoutFilePath = configFile.getAbsolutePath(); String configDirPath = desktopLayoutFilePath.substring(0, desktopLayoutFilePath.lastIndexOf(System .getProperty("file.separator"))); File configDir = new File(configDirPath); // create config dir if it does not exist if (!configDir.exists()) { boolean success = configDir.mkdirs(); if(success) logger.debug("Newly created config directory"); else logger.warn("Could not create config directory"); } }
java
private void checkForConfigPath(File configFile) { String desktopLayoutFilePath = configFile.getAbsolutePath(); String configDirPath = desktopLayoutFilePath.substring(0, desktopLayoutFilePath.lastIndexOf(System .getProperty("file.separator"))); File configDir = new File(configDirPath); // create config dir if it does not exist if (!configDir.exists()) { boolean success = configDir.mkdirs(); if(success) logger.debug("Newly created config directory"); else logger.warn("Could not create config directory"); } }
[ "private", "void", "checkForConfigPath", "(", "File", "configFile", ")", "{", "String", "desktopLayoutFilePath", "=", "configFile", ".", "getAbsolutePath", "(", ")", ";", "String", "configDirPath", "=", "desktopLayoutFilePath", ".", "substring", "(", "0", ",", "desktopLayoutFilePath", ".", "lastIndexOf", "(", "System", ".", "getProperty", "(", "\"file.separator\"", ")", ")", ")", ";", "File", "configDir", "=", "new", "File", "(", "configDirPath", ")", ";", "// create config dir if it does not exist", "if", "(", "!", "configDir", ".", "exists", "(", ")", ")", "{", "boolean", "success", "=", "configDir", ".", "mkdirs", "(", ")", ";", "if", "(", "success", ")", "logger", ".", "debug", "(", "\"Newly created config directory\"", ")", ";", "else", "logger", ".", "warn", "(", "\"Could not create config directory\"", ")", ";", "}", "}" ]
Creates the config directory, if it doesn't exist already @param configFile The file for which to create the path
[ "Creates", "the", "config", "directory", "if", "it", "doesn", "t", "exist", "already" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingApplicationPageFactory.java#L118-L132
11,754
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.setModel
public void setModel(ListModel model) { helperList.setModel(model); dataModel = model; clearSelection(); // Once we have a model, we can properly size the two display lists // They should be wide enough to hold the widest string in the model. // So take the width of the source list since it currently has all the // data. Dimension d = helperScroller.getPreferredSize(); chosenPanel.setPreferredSize(d); sourcePanel.setPreferredSize(d); }
java
public void setModel(ListModel model) { helperList.setModel(model); dataModel = model; clearSelection(); // Once we have a model, we can properly size the two display lists // They should be wide enough to hold the widest string in the model. // So take the width of the source list since it currently has all the // data. Dimension d = helperScroller.getPreferredSize(); chosenPanel.setPreferredSize(d); sourcePanel.setPreferredSize(d); }
[ "public", "void", "setModel", "(", "ListModel", "model", ")", "{", "helperList", ".", "setModel", "(", "model", ")", ";", "dataModel", "=", "model", ";", "clearSelection", "(", ")", ";", "// Once we have a model, we can properly size the two display lists", "// They should be wide enough to hold the widest string in the model.", "// So take the width of the source list since it currently has all the", "// data.", "Dimension", "d", "=", "helperScroller", ".", "getPreferredSize", "(", ")", ";", "chosenPanel", ".", "setPreferredSize", "(", "d", ")", ";", "sourcePanel", ".", "setPreferredSize", "(", "d", ")", ";", "}" ]
Sets the model that represents the contents or "value" of the list and clears the list selection. @param model the <code>ListModel</code> that provides the list of items for display @exception IllegalArgumentException if <code>model</code> is <code>null</code>
[ "Sets", "the", "model", "that", "represents", "the", "contents", "or", "value", "of", "the", "list", "and", "clears", "the", "list", "selection", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L150-L163
11,755
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.setVisibleRowCount
public void setVisibleRowCount(int visibleRowCount) { sourceList.setVisibleRowCount(visibleRowCount); chosenList.setVisibleRowCount(visibleRowCount); helperList.setVisibleRowCount(visibleRowCount); // Ok, since we've haven't set a preferred size on the helper scroller, // we can use it's current preferred size for our two control lists. Dimension d = helperScroller.getPreferredSize(); chosenPanel.setPreferredSize(d); sourcePanel.setPreferredSize(d); }
java
public void setVisibleRowCount(int visibleRowCount) { sourceList.setVisibleRowCount(visibleRowCount); chosenList.setVisibleRowCount(visibleRowCount); helperList.setVisibleRowCount(visibleRowCount); // Ok, since we've haven't set a preferred size on the helper scroller, // we can use it's current preferred size for our two control lists. Dimension d = helperScroller.getPreferredSize(); chosenPanel.setPreferredSize(d); sourcePanel.setPreferredSize(d); }
[ "public", "void", "setVisibleRowCount", "(", "int", "visibleRowCount", ")", "{", "sourceList", ".", "setVisibleRowCount", "(", "visibleRowCount", ")", ";", "chosenList", ".", "setVisibleRowCount", "(", "visibleRowCount", ")", ";", "helperList", ".", "setVisibleRowCount", "(", "visibleRowCount", ")", ";", "// Ok, since we've haven't set a preferred size on the helper scroller,", "// we can use it's current preferred size for our two control lists.", "Dimension", "d", "=", "helperScroller", ".", "getPreferredSize", "(", ")", ";", "chosenPanel", ".", "setPreferredSize", "(", "d", ")", ";", "sourcePanel", ".", "setPreferredSize", "(", "d", ")", ";", "}" ]
Sets the preferred number of rows in the list that can be displayed without a scrollbar. @param visibleRowCount an integer specifying the preferred number of visible rows
[ "Sets", "the", "preferred", "number", "of", "rows", "in", "the", "list", "that", "can", "be", "displayed", "without", "a", "scrollbar", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L172-L183
11,756
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.setEditIcon
public void setEditIcon(Icon editIcon, String text) { if (editIcon != null) { editButton.setIcon(editIcon); if (text != null) { editButton.setToolTipText(text); } editButton.setText(""); } else { editButton.setIcon(null); if (text != null) { editButton.setText(text); } } }
java
public void setEditIcon(Icon editIcon, String text) { if (editIcon != null) { editButton.setIcon(editIcon); if (text != null) { editButton.setToolTipText(text); } editButton.setText(""); } else { editButton.setIcon(null); if (text != null) { editButton.setText(text); } } }
[ "public", "void", "setEditIcon", "(", "Icon", "editIcon", ",", "String", "text", ")", "{", "if", "(", "editIcon", "!=", "null", ")", "{", "editButton", ".", "setIcon", "(", "editIcon", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "editButton", ".", "setToolTipText", "(", "text", ")", ";", "}", "editButton", ".", "setText", "(", "\"\"", ")", ";", "}", "else", "{", "editButton", ".", "setIcon", "(", "null", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "editButton", ".", "setText", "(", "text", ")", ";", "}", "}", "}" ]
Set the icon to use on the edit button. If no icon is specified, then just the label will be used otherwise the text will be a tooltip. @param editIcon Icon to use on edit button
[ "Set", "the", "icon", "to", "use", "on", "the", "edit", "button", ".", "If", "no", "icon", "is", "specified", "then", "just", "the", "label", "will", "be", "used", "otherwise", "the", "text", "will", "be", "a", "tooltip", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L200-L213
11,757
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.setListLabels
public void setListLabels(String chosenLabel, String sourceLabel) { if (chosenLabel != null) { this.chosenLabel.setText(chosenLabel); this.chosenLabel.setVisible(true); } else { this.chosenLabel.setVisible(false); } if (sourceLabel != null) { this.sourceLabel.setText(sourceLabel); this.sourceLabel.setVisible(true); } else { this.sourceLabel.setVisible(false); } Dimension d = chosenList.getPreferredSize(); Dimension d1 = this.chosenLabel.getPreferredSize(); Dimension dChosenPanel = chosenPanel.getPreferredSize(); dChosenPanel.width = Math.max(d.width, Math.max(dChosenPanel.width, d1.width)); chosenPanel.setPreferredSize(dChosenPanel); Dimension dSourceList = sourceList.getPreferredSize(); Dimension dSource = this.sourceLabel.getPreferredSize(); Dimension dSourcePanel = sourcePanel.getPreferredSize(); dSourcePanel.width = Math.max(dSource.width, Math.max(dSourceList.width, dSourcePanel.width)); sourcePanel.setPreferredSize(dSourcePanel); Dimension fullPanelSize = getPreferredSize(); fullPanelSize.width = dSourcePanel.width + dChosenPanel.width + (editButton != null ? editButton.getPreferredSize().width : 0) + (buttonPanel != null ? buttonPanel.getPreferredSize().width : 0) + 20; setPreferredSize(fullPanelSize); }
java
public void setListLabels(String chosenLabel, String sourceLabel) { if (chosenLabel != null) { this.chosenLabel.setText(chosenLabel); this.chosenLabel.setVisible(true); } else { this.chosenLabel.setVisible(false); } if (sourceLabel != null) { this.sourceLabel.setText(sourceLabel); this.sourceLabel.setVisible(true); } else { this.sourceLabel.setVisible(false); } Dimension d = chosenList.getPreferredSize(); Dimension d1 = this.chosenLabel.getPreferredSize(); Dimension dChosenPanel = chosenPanel.getPreferredSize(); dChosenPanel.width = Math.max(d.width, Math.max(dChosenPanel.width, d1.width)); chosenPanel.setPreferredSize(dChosenPanel); Dimension dSourceList = sourceList.getPreferredSize(); Dimension dSource = this.sourceLabel.getPreferredSize(); Dimension dSourcePanel = sourcePanel.getPreferredSize(); dSourcePanel.width = Math.max(dSource.width, Math.max(dSourceList.width, dSourcePanel.width)); sourcePanel.setPreferredSize(dSourcePanel); Dimension fullPanelSize = getPreferredSize(); fullPanelSize.width = dSourcePanel.width + dChosenPanel.width + (editButton != null ? editButton.getPreferredSize().width : 0) + (buttonPanel != null ? buttonPanel.getPreferredSize().width : 0) + 20; setPreferredSize(fullPanelSize); }
[ "public", "void", "setListLabels", "(", "String", "chosenLabel", ",", "String", "sourceLabel", ")", "{", "if", "(", "chosenLabel", "!=", "null", ")", "{", "this", ".", "chosenLabel", ".", "setText", "(", "chosenLabel", ")", ";", "this", ".", "chosenLabel", ".", "setVisible", "(", "true", ")", ";", "}", "else", "{", "this", ".", "chosenLabel", ".", "setVisible", "(", "false", ")", ";", "}", "if", "(", "sourceLabel", "!=", "null", ")", "{", "this", ".", "sourceLabel", ".", "setText", "(", "sourceLabel", ")", ";", "this", ".", "sourceLabel", ".", "setVisible", "(", "true", ")", ";", "}", "else", "{", "this", ".", "sourceLabel", ".", "setVisible", "(", "false", ")", ";", "}", "Dimension", "d", "=", "chosenList", ".", "getPreferredSize", "(", ")", ";", "Dimension", "d1", "=", "this", ".", "chosenLabel", ".", "getPreferredSize", "(", ")", ";", "Dimension", "dChosenPanel", "=", "chosenPanel", ".", "getPreferredSize", "(", ")", ";", "dChosenPanel", ".", "width", "=", "Math", ".", "max", "(", "d", ".", "width", ",", "Math", ".", "max", "(", "dChosenPanel", ".", "width", ",", "d1", ".", "width", ")", ")", ";", "chosenPanel", ".", "setPreferredSize", "(", "dChosenPanel", ")", ";", "Dimension", "dSourceList", "=", "sourceList", ".", "getPreferredSize", "(", ")", ";", "Dimension", "dSource", "=", "this", ".", "sourceLabel", ".", "getPreferredSize", "(", ")", ";", "Dimension", "dSourcePanel", "=", "sourcePanel", ".", "getPreferredSize", "(", ")", ";", "dSourcePanel", ".", "width", "=", "Math", ".", "max", "(", "dSource", ".", "width", ",", "Math", ".", "max", "(", "dSourceList", ".", "width", ",", "dSourcePanel", ".", "width", ")", ")", ";", "sourcePanel", ".", "setPreferredSize", "(", "dSourcePanel", ")", ";", "Dimension", "fullPanelSize", "=", "getPreferredSize", "(", ")", ";", "fullPanelSize", ".", "width", "=", "dSourcePanel", ".", "width", "+", "dChosenPanel", ".", "width", "+", "(", "editButton", "!=", "null", "?", "editButton", ".", "getPreferredSize", "(", ")", ".", "width", ":", "0", ")", "+", "(", "buttonPanel", "!=", "null", "?", "buttonPanel", ".", "getPreferredSize", "(", ")", ".", "width", ":", "0", ")", "+", "20", ";", "setPreferredSize", "(", "fullPanelSize", ")", ";", "}" ]
Add labels on top of the 2 lists. If not present, do not show the labels. @param chosenLabel @param sourceLabel
[ "Add", "labels", "on", "top", "of", "the", "2", "lists", ".", "If", "not", "present", "do", "not", "show", "the", "labels", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L221-L254
11,758
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.buildComponent
protected JComponent buildComponent() { helperList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); editButton = new JButton("Edit..."); editButton.setIconTextGap(0); editButton.setMargin(new Insets(2, 4, 2, 4)); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { togglePanels(); } }); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.insets = new Insets(0, 0, 0, 3); gbc.anchor = GridBagConstraints.NORTHWEST; gbl.setConstraints(editButton, gbc); add(editButton); sourceList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); sourceList.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_RIGHT) { moveLeftToRight(); } } }); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; sourcePanel.add(BorderLayout.NORTH, sourceLabel); JScrollPane sourceScroller = new JScrollPane(sourceList); sourcePanel.add(BorderLayout.CENTER, sourceScroller); gbl.setConstraints(sourcePanel, gbc); add(sourcePanel); // JPanel buttonPanel = new ControlButtonPanel(); JPanel buttonPanel = buildButtonPanel(); gbc.fill = GridBagConstraints.VERTICAL; gbc.weightx = 0; gbc.weighty = 1.0; gbl.setConstraints(buttonPanel, gbc); add(buttonPanel); chosenList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); chosenList.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_LEFT) { moveRightToLeft(); } } }); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; chosenPanel.add(BorderLayout.NORTH, chosenLabel); JScrollPane chosenScroller = new JScrollPane(chosenList); chosenPanel.add(BorderLayout.CENTER, chosenScroller); gbl.setConstraints(chosenPanel, gbc); add(chosenPanel); editButton.setVisible(showEditButton); this.buttonPanel.setVisible(panelsShowing); sourcePanel.setVisible(panelsShowing); return this; }
java
protected JComponent buildComponent() { helperList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); editButton = new JButton("Edit..."); editButton.setIconTextGap(0); editButton.setMargin(new Insets(2, 4, 2, 4)); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { togglePanels(); } }); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.insets = new Insets(0, 0, 0, 3); gbc.anchor = GridBagConstraints.NORTHWEST; gbl.setConstraints(editButton, gbc); add(editButton); sourceList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); sourceList.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_RIGHT) { moveLeftToRight(); } } }); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; sourcePanel.add(BorderLayout.NORTH, sourceLabel); JScrollPane sourceScroller = new JScrollPane(sourceList); sourcePanel.add(BorderLayout.CENTER, sourceScroller); gbl.setConstraints(sourcePanel, gbc); add(sourcePanel); // JPanel buttonPanel = new ControlButtonPanel(); JPanel buttonPanel = buildButtonPanel(); gbc.fill = GridBagConstraints.VERTICAL; gbc.weightx = 0; gbc.weighty = 1.0; gbl.setConstraints(buttonPanel, gbc); add(buttonPanel); chosenList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); chosenList.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_LEFT) { moveRightToLeft(); } } }); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; chosenPanel.add(BorderLayout.NORTH, chosenLabel); JScrollPane chosenScroller = new JScrollPane(chosenList); chosenPanel.add(BorderLayout.CENTER, chosenScroller); gbl.setConstraints(chosenPanel, gbc); add(chosenPanel); editButton.setVisible(showEditButton); this.buttonPanel.setVisible(panelsShowing); sourcePanel.setVisible(panelsShowing); return this; }
[ "protected", "JComponent", "buildComponent", "(", ")", "{", "helperList", ".", "setSelectionMode", "(", "ListSelectionModel", ".", "MULTIPLE_INTERVAL_SELECTION", ")", ";", "GridBagLayout", "gbl", "=", "new", "GridBagLayout", "(", ")", ";", "GridBagConstraints", "gbc", "=", "new", "GridBagConstraints", "(", ")", ";", "setLayout", "(", "gbl", ")", ";", "editButton", "=", "new", "JButton", "(", "\"Edit...\"", ")", ";", "editButton", ".", "setIconTextGap", "(", "0", ")", ";", "editButton", ".", "setMargin", "(", "new", "Insets", "(", "2", ",", "4", ",", "2", ",", "4", ")", ")", ";", "editButton", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "ActionEvent", "event", ")", "{", "togglePanels", "(", ")", ";", "}", "}", ")", ";", "gbc", ".", "fill", "=", "GridBagConstraints", ".", "NONE", ";", "gbc", ".", "weightx", "=", "0.0", ";", "gbc", ".", "weighty", "=", "0.0", ";", "gbc", ".", "insets", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "3", ")", ";", "gbc", ".", "anchor", "=", "GridBagConstraints", ".", "NORTHWEST", ";", "gbl", ".", "setConstraints", "(", "editButton", ",", "gbc", ")", ";", "add", "(", "editButton", ")", ";", "sourceList", ".", "setSelectionMode", "(", "ListSelectionModel", ".", "MULTIPLE_INTERVAL_SELECTION", ")", ";", "sourceList", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "public", "void", "keyPressed", "(", "final", "KeyEvent", "e", ")", "{", "if", "(", "e", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_ENTER", "||", "e", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_RIGHT", ")", "{", "moveLeftToRight", "(", ")", ";", "}", "}", "}", ")", ";", "gbc", ".", "fill", "=", "GridBagConstraints", ".", "BOTH", ";", "gbc", ".", "weightx", "=", "1.0", ";", "gbc", ".", "weighty", "=", "1.0", ";", "sourcePanel", ".", "add", "(", "BorderLayout", ".", "NORTH", ",", "sourceLabel", ")", ";", "JScrollPane", "sourceScroller", "=", "new", "JScrollPane", "(", "sourceList", ")", ";", "sourcePanel", ".", "add", "(", "BorderLayout", ".", "CENTER", ",", "sourceScroller", ")", ";", "gbl", ".", "setConstraints", "(", "sourcePanel", ",", "gbc", ")", ";", "add", "(", "sourcePanel", ")", ";", "// JPanel buttonPanel = new ControlButtonPanel();", "JPanel", "buttonPanel", "=", "buildButtonPanel", "(", ")", ";", "gbc", ".", "fill", "=", "GridBagConstraints", ".", "VERTICAL", ";", "gbc", ".", "weightx", "=", "0", ";", "gbc", ".", "weighty", "=", "1.0", ";", "gbl", ".", "setConstraints", "(", "buttonPanel", ",", "gbc", ")", ";", "add", "(", "buttonPanel", ")", ";", "chosenList", ".", "setSelectionMode", "(", "ListSelectionModel", ".", "MULTIPLE_INTERVAL_SELECTION", ")", ";", "chosenList", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "public", "void", "keyPressed", "(", "final", "KeyEvent", "e", ")", "{", "if", "(", "e", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_ENTER", "||", "e", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_LEFT", ")", "{", "moveRightToLeft", "(", ")", ";", "}", "}", "}", ")", ";", "gbc", ".", "fill", "=", "GridBagConstraints", ".", "BOTH", ";", "gbc", ".", "weightx", "=", "1.0", ";", "gbc", ".", "weighty", "=", "1.0", ";", "chosenPanel", ".", "add", "(", "BorderLayout", ".", "NORTH", ",", "chosenLabel", ")", ";", "JScrollPane", "chosenScroller", "=", "new", "JScrollPane", "(", "chosenList", ")", ";", "chosenPanel", ".", "add", "(", "BorderLayout", ".", "CENTER", ",", "chosenScroller", ")", ";", "gbl", ".", "setConstraints", "(", "chosenPanel", ",", "gbc", ")", ";", "add", "(", "chosenPanel", ")", ";", "editButton", ".", "setVisible", "(", "showEditButton", ")", ";", "this", ".", "buttonPanel", ".", "setVisible", "(", "panelsShowing", ")", ";", "sourcePanel", ".", "setVisible", "(", "panelsShowing", ")", ";", "return", "this", ";", "}" ]
Build our component panel. @return component
[ "Build", "our", "component", "panel", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L261-L335
11,759
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.buildButtonPanel
protected JPanel buildButtonPanel() { buttonPanel = new JPanel(); leftToRight = new JButton(">"); allLeftToRight = new JButton(">>"); rightToLeft = new JButton("<"); allRightToLeft = new JButton("<<"); Font smallerFont = leftToRight.getFont().deriveFont(9.0F); leftToRight.setFont(smallerFont); allLeftToRight.setFont(smallerFont); rightToLeft.setFont(smallerFont); allRightToLeft.setFont(smallerFont); Insets margin = new Insets(2, 4, 2, 4); leftToRight.setMargin(margin); allLeftToRight.setMargin(margin); rightToLeft.setMargin(margin); allRightToLeft.setMargin(margin); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); buttonPanel.setLayout(gbl); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; gbl.setConstraints(leftToRight, gbc); gbl.setConstraints(allLeftToRight, gbc); gbl.setConstraints(rightToLeft, gbc); gbl.setConstraints(allRightToLeft, gbc); buttonPanel.add(leftToRight); buttonPanel.add(allLeftToRight); buttonPanel.add(rightToLeft); buttonPanel.add(allRightToLeft); leftToRight.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveLeftToRight(); } }); allLeftToRight.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveAllLeftToRight(); } }); rightToLeft.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveRightToLeft(); } }); allRightToLeft.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveAllRightToLeft(); } }); buttonPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // buttonPanel.setBackground( Color.lightGray ); return buttonPanel; }
java
protected JPanel buildButtonPanel() { buttonPanel = new JPanel(); leftToRight = new JButton(">"); allLeftToRight = new JButton(">>"); rightToLeft = new JButton("<"); allRightToLeft = new JButton("<<"); Font smallerFont = leftToRight.getFont().deriveFont(9.0F); leftToRight.setFont(smallerFont); allLeftToRight.setFont(smallerFont); rightToLeft.setFont(smallerFont); allRightToLeft.setFont(smallerFont); Insets margin = new Insets(2, 4, 2, 4); leftToRight.setMargin(margin); allLeftToRight.setMargin(margin); rightToLeft.setMargin(margin); allRightToLeft.setMargin(margin); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); buttonPanel.setLayout(gbl); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; gbl.setConstraints(leftToRight, gbc); gbl.setConstraints(allLeftToRight, gbc); gbl.setConstraints(rightToLeft, gbc); gbl.setConstraints(allRightToLeft, gbc); buttonPanel.add(leftToRight); buttonPanel.add(allLeftToRight); buttonPanel.add(rightToLeft); buttonPanel.add(allRightToLeft); leftToRight.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveLeftToRight(); } }); allLeftToRight.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveAllLeftToRight(); } }); rightToLeft.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveRightToLeft(); } }); allRightToLeft.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { moveAllRightToLeft(); } }); buttonPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // buttonPanel.setBackground( Color.lightGray ); return buttonPanel; }
[ "protected", "JPanel", "buildButtonPanel", "(", ")", "{", "buttonPanel", "=", "new", "JPanel", "(", ")", ";", "leftToRight", "=", "new", "JButton", "(", "\">\"", ")", ";", "allLeftToRight", "=", "new", "JButton", "(", "\">>\"", ")", ";", "rightToLeft", "=", "new", "JButton", "(", "\"<\"", ")", ";", "allRightToLeft", "=", "new", "JButton", "(", "\"<<\"", ")", ";", "Font", "smallerFont", "=", "leftToRight", ".", "getFont", "(", ")", ".", "deriveFont", "(", "9.0F", ")", ";", "leftToRight", ".", "setFont", "(", "smallerFont", ")", ";", "allLeftToRight", ".", "setFont", "(", "smallerFont", ")", ";", "rightToLeft", ".", "setFont", "(", "smallerFont", ")", ";", "allRightToLeft", ".", "setFont", "(", "smallerFont", ")", ";", "Insets", "margin", "=", "new", "Insets", "(", "2", ",", "4", ",", "2", ",", "4", ")", ";", "leftToRight", ".", "setMargin", "(", "margin", ")", ";", "allLeftToRight", ".", "setMargin", "(", "margin", ")", ";", "rightToLeft", ".", "setMargin", "(", "margin", ")", ";", "allRightToLeft", ".", "setMargin", "(", "margin", ")", ";", "GridBagLayout", "gbl", "=", "new", "GridBagLayout", "(", ")", ";", "GridBagConstraints", "gbc", "=", "new", "GridBagConstraints", "(", ")", ";", "buttonPanel", ".", "setLayout", "(", "gbl", ")", ";", "gbc", ".", "gridwidth", "=", "GridBagConstraints", ".", "REMAINDER", ";", "gbc", ".", "fill", "=", "GridBagConstraints", ".", "HORIZONTAL", ";", "gbl", ".", "setConstraints", "(", "leftToRight", ",", "gbc", ")", ";", "gbl", ".", "setConstraints", "(", "allLeftToRight", ",", "gbc", ")", ";", "gbl", ".", "setConstraints", "(", "rightToLeft", ",", "gbc", ")", ";", "gbl", ".", "setConstraints", "(", "allRightToLeft", ",", "gbc", ")", ";", "buttonPanel", ".", "add", "(", "leftToRight", ")", ";", "buttonPanel", ".", "add", "(", "allLeftToRight", ")", ";", "buttonPanel", ".", "add", "(", "rightToLeft", ")", ";", "buttonPanel", ".", "add", "(", "allRightToLeft", ")", ";", "leftToRight", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "ActionEvent", "event", ")", "{", "moveLeftToRight", "(", ")", ";", "}", "}", ")", ";", "allLeftToRight", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "ActionEvent", "event", ")", "{", "moveAllLeftToRight", "(", ")", ";", "}", "}", ")", ";", "rightToLeft", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "ActionEvent", "event", ")", "{", "moveRightToLeft", "(", ")", ";", "}", "}", ")", ";", "allRightToLeft", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "ActionEvent", "event", ")", "{", "moveAllRightToLeft", "(", ")", ";", "}", "}", ")", ";", "buttonPanel", ".", "setBorder", "(", "BorderFactory", ".", "createEmptyBorder", "(", "2", ",", "2", ",", "2", ",", "2", ")", ")", ";", "// buttonPanel.setBackground( Color.lightGray );", "return", "buttonPanel", ";", "}" ]
Construct the control button panel. @return JPanel
[ "Construct", "the", "control", "button", "panel", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L343-L403
11,760
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.moveLeftToRight
protected void moveLeftToRight() { // Loop over the selected items and locate them in the data model, Add // these to the selection. Object[] sourceSelected = sourceList.getSelectedValues(); int nSourceSelected = sourceSelected.length; int[] currentSelection = helperList.getSelectedIndices(); int[] newSelection = new int[currentSelection.length + nSourceSelected]; System.arraycopy(currentSelection, 0, newSelection, 0, currentSelection.length); int destPos = currentSelection.length; for (int i = 0; i < sourceSelected.length; i++) { newSelection[destPos++] = indexOf(sourceSelected[i]); } helperList.setSelectedIndices(newSelection); update(); }
java
protected void moveLeftToRight() { // Loop over the selected items and locate them in the data model, Add // these to the selection. Object[] sourceSelected = sourceList.getSelectedValues(); int nSourceSelected = sourceSelected.length; int[] currentSelection = helperList.getSelectedIndices(); int[] newSelection = new int[currentSelection.length + nSourceSelected]; System.arraycopy(currentSelection, 0, newSelection, 0, currentSelection.length); int destPos = currentSelection.length; for (int i = 0; i < sourceSelected.length; i++) { newSelection[destPos++] = indexOf(sourceSelected[i]); } helperList.setSelectedIndices(newSelection); update(); }
[ "protected", "void", "moveLeftToRight", "(", ")", "{", "// Loop over the selected items and locate them in the data model, Add", "// these to the selection.", "Object", "[", "]", "sourceSelected", "=", "sourceList", ".", "getSelectedValues", "(", ")", ";", "int", "nSourceSelected", "=", "sourceSelected", ".", "length", ";", "int", "[", "]", "currentSelection", "=", "helperList", ".", "getSelectedIndices", "(", ")", ";", "int", "[", "]", "newSelection", "=", "new", "int", "[", "currentSelection", ".", "length", "+", "nSourceSelected", "]", ";", "System", ".", "arraycopy", "(", "currentSelection", ",", "0", ",", "newSelection", ",", "0", ",", "currentSelection", ".", "length", ")", ";", "int", "destPos", "=", "currentSelection", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sourceSelected", ".", "length", ";", "i", "++", ")", "{", "newSelection", "[", "destPos", "++", "]", "=", "indexOf", "(", "sourceSelected", "[", "i", "]", ")", ";", "}", "helperList", ".", "setSelectedIndices", "(", "newSelection", ")", ";", "update", "(", ")", ";", "}" ]
Move the selected items in the source list to the chosen list. I.e., add the items to our selection model.
[ "Move", "the", "selected", "items", "in", "the", "source", "list", "to", "the", "chosen", "list", ".", "I", ".", "e", ".", "add", "the", "items", "to", "our", "selection", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L419-L435
11,761
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.moveAllLeftToRight
protected void moveAllLeftToRight() { int sz = dataModel.getSize(); int[] selected = new int[sz]; for (int i = 0; i < sz; i++) { selected[i] = i; } helperList.setSelectedIndices(selected); update(); }
java
protected void moveAllLeftToRight() { int sz = dataModel.getSize(); int[] selected = new int[sz]; for (int i = 0; i < sz; i++) { selected[i] = i; } helperList.setSelectedIndices(selected); update(); }
[ "protected", "void", "moveAllLeftToRight", "(", ")", "{", "int", "sz", "=", "dataModel", ".", "getSize", "(", ")", ";", "int", "[", "]", "selected", "=", "new", "int", "[", "sz", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sz", ";", "i", "++", ")", "{", "selected", "[", "i", "]", "=", "i", ";", "}", "helperList", ".", "setSelectedIndices", "(", "selected", ")", ";", "update", "(", ")", ";", "}" ]
Move all the source items to the chosen side. I.e., select all the items.
[ "Move", "all", "the", "source", "items", "to", "the", "chosen", "side", ".", "I", ".", "e", ".", "select", "all", "the", "items", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L440-L448
11,762
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.moveRightToLeft
protected void moveRightToLeft() { Object[] chosenSelectedValues = chosenList.getSelectedValues(); int nChosenSelected = chosenSelectedValues.length; int[] chosenSelected = new int[nChosenSelected]; if (nChosenSelected == 0) { return; // Nothing to move } // Get our current selection int[] currentSelected = helperList.getSelectedIndices(); int nCurrentSelected = currentSelected.length; // Fill the chosenSelected array with the indices of the selected chosen // items for (int i = 0; i < nChosenSelected; i++) { chosenSelected[i] = indexOf(chosenSelectedValues[i]); } // Construct the new selected indices. Loop through the current list // and compare to the head of the chosen list. If not equal, then add // to the new list. If equal, skip it and bump the head pointer on the // chosen list. int newSelection[] = new int[nCurrentSelected - nChosenSelected]; int newSelPos = 0; int chosenPos = 0; for (int i = 0; i < nCurrentSelected; i++) { int currentIdx = currentSelected[i]; if (chosenPos < nChosenSelected && currentIdx == chosenSelected[chosenPos]) { chosenPos += 1; } else { newSelection[newSelPos++] = currentIdx; } } // Install the new selection helperList.setSelectedIndices(newSelection); update(); }
java
protected void moveRightToLeft() { Object[] chosenSelectedValues = chosenList.getSelectedValues(); int nChosenSelected = chosenSelectedValues.length; int[] chosenSelected = new int[nChosenSelected]; if (nChosenSelected == 0) { return; // Nothing to move } // Get our current selection int[] currentSelected = helperList.getSelectedIndices(); int nCurrentSelected = currentSelected.length; // Fill the chosenSelected array with the indices of the selected chosen // items for (int i = 0; i < nChosenSelected; i++) { chosenSelected[i] = indexOf(chosenSelectedValues[i]); } // Construct the new selected indices. Loop through the current list // and compare to the head of the chosen list. If not equal, then add // to the new list. If equal, skip it and bump the head pointer on the // chosen list. int newSelection[] = new int[nCurrentSelected - nChosenSelected]; int newSelPos = 0; int chosenPos = 0; for (int i = 0; i < nCurrentSelected; i++) { int currentIdx = currentSelected[i]; if (chosenPos < nChosenSelected && currentIdx == chosenSelected[chosenPos]) { chosenPos += 1; } else { newSelection[newSelPos++] = currentIdx; } } // Install the new selection helperList.setSelectedIndices(newSelection); update(); }
[ "protected", "void", "moveRightToLeft", "(", ")", "{", "Object", "[", "]", "chosenSelectedValues", "=", "chosenList", ".", "getSelectedValues", "(", ")", ";", "int", "nChosenSelected", "=", "chosenSelectedValues", ".", "length", ";", "int", "[", "]", "chosenSelected", "=", "new", "int", "[", "nChosenSelected", "]", ";", "if", "(", "nChosenSelected", "==", "0", ")", "{", "return", ";", "// Nothing to move", "}", "// Get our current selection", "int", "[", "]", "currentSelected", "=", "helperList", ".", "getSelectedIndices", "(", ")", ";", "int", "nCurrentSelected", "=", "currentSelected", ".", "length", ";", "// Fill the chosenSelected array with the indices of the selected chosen", "// items", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nChosenSelected", ";", "i", "++", ")", "{", "chosenSelected", "[", "i", "]", "=", "indexOf", "(", "chosenSelectedValues", "[", "i", "]", ")", ";", "}", "// Construct the new selected indices. Loop through the current list", "// and compare to the head of the chosen list. If not equal, then add", "// to the new list. If equal, skip it and bump the head pointer on the", "// chosen list.", "int", "newSelection", "[", "]", "=", "new", "int", "[", "nCurrentSelected", "-", "nChosenSelected", "]", ";", "int", "newSelPos", "=", "0", ";", "int", "chosenPos", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nCurrentSelected", ";", "i", "++", ")", "{", "int", "currentIdx", "=", "currentSelected", "[", "i", "]", ";", "if", "(", "chosenPos", "<", "nChosenSelected", "&&", "currentIdx", "==", "chosenSelected", "[", "chosenPos", "]", ")", "{", "chosenPos", "+=", "1", ";", "}", "else", "{", "newSelection", "[", "newSelPos", "++", "]", "=", "currentIdx", ";", "}", "}", "// Install the new selection", "helperList", ".", "setSelectedIndices", "(", "newSelection", ")", ";", "update", "(", ")", ";", "}" ]
Move the selected items in the chosen list to the source list. I.e., remove them from our selection model.
[ "Move", "the", "selected", "items", "in", "the", "chosen", "list", "to", "the", "source", "list", ".", "I", ".", "e", ".", "remove", "them", "from", "our", "selection", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L454-L494
11,763
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.indexOf
protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; } } return -1; }
java
protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; } } return -1; }
[ "protected", "int", "indexOf", "(", "final", "Object", "o", ")", "{", "final", "int", "size", "=", "dataModel", ".", "getSize", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "comparator", "==", "null", ")", "{", "if", "(", "o", ".", "equals", "(", "dataModel", ".", "getElementAt", "(", "i", ")", ")", ")", "{", "return", "i", ";", "}", "}", "else", "if", "(", "comparator", ".", "compare", "(", "o", ",", "dataModel", ".", "getElementAt", "(", "i", ")", ")", "==", "0", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Get the index of a given object in the underlying data model. @param o Object to locate @return index of object in model, -1 if not found
[ "Get", "the", "index", "of", "a", "given", "object", "in", "the", "underlying", "data", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L510-L523
11,764
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.update
protected void update() { int sz = dataModel.getSize(); int[] selected = helperList.getSelectedIndices(); ArrayList sourceItems = new ArrayList(sz); ArrayList chosenItems = new ArrayList(selected.length); // Start with the source items filled from our data model for (int i = 0; i < sz; i++) { sourceItems.add(dataModel.getElementAt(i)); } // Now move the selected items to the chosen list for (int i = selected.length - 1; i >= 0; i--) { chosenItems.add(sourceItems.remove(selected[i])); } Collections.reverse(chosenItems); // We built it backwards // Now install the two new lists sourceList.setListData(sourceItems.toArray()); chosenList.setListData(chosenItems.toArray()); }
java
protected void update() { int sz = dataModel.getSize(); int[] selected = helperList.getSelectedIndices(); ArrayList sourceItems = new ArrayList(sz); ArrayList chosenItems = new ArrayList(selected.length); // Start with the source items filled from our data model for (int i = 0; i < sz; i++) { sourceItems.add(dataModel.getElementAt(i)); } // Now move the selected items to the chosen list for (int i = selected.length - 1; i >= 0; i--) { chosenItems.add(sourceItems.remove(selected[i])); } Collections.reverse(chosenItems); // We built it backwards // Now install the two new lists sourceList.setListData(sourceItems.toArray()); chosenList.setListData(chosenItems.toArray()); }
[ "protected", "void", "update", "(", ")", "{", "int", "sz", "=", "dataModel", ".", "getSize", "(", ")", ";", "int", "[", "]", "selected", "=", "helperList", ".", "getSelectedIndices", "(", ")", ";", "ArrayList", "sourceItems", "=", "new", "ArrayList", "(", "sz", ")", ";", "ArrayList", "chosenItems", "=", "new", "ArrayList", "(", "selected", ".", "length", ")", ";", "// Start with the source items filled from our data model", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sz", ";", "i", "++", ")", "{", "sourceItems", ".", "add", "(", "dataModel", ".", "getElementAt", "(", "i", ")", ")", ";", "}", "// Now move the selected items to the chosen list", "for", "(", "int", "i", "=", "selected", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "chosenItems", ".", "add", "(", "sourceItems", ".", "remove", "(", "selected", "[", "i", "]", ")", ")", ";", "}", "Collections", ".", "reverse", "(", "chosenItems", ")", ";", "// We built it backwards", "// Now install the two new lists", "sourceList", ".", "setListData", "(", "sourceItems", ".", "toArray", "(", ")", ")", ";", "chosenList", ".", "setListData", "(", "chosenItems", ".", "toArray", "(", ")", ")", ";", "}" ]
Update the two lists based on the current selection indices.
[ "Update", "the", "two", "lists", "based", "on", "the", "current", "selection", "indices", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L528-L549
11,765
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinding.java
AbstractListBinding.convertValue
protected Object convertValue(Object value, Class targetClass) throws ConversionException { Assert.notNull(value); Assert.notNull(targetClass); return getConversionService().getConversionExecutor(value.getClass(), targetClass).execute(value); }
java
protected Object convertValue(Object value, Class targetClass) throws ConversionException { Assert.notNull(value); Assert.notNull(targetClass); return getConversionService().getConversionExecutor(value.getClass(), targetClass).execute(value); }
[ "protected", "Object", "convertValue", "(", "Object", "value", ",", "Class", "targetClass", ")", "throws", "ConversionException", "{", "Assert", ".", "notNull", "(", "value", ")", ";", "Assert", ".", "notNull", "(", "targetClass", ")", ";", "return", "getConversionService", "(", ")", ".", "getConversionExecutor", "(", "value", ".", "getClass", "(", ")", ",", "targetClass", ")", ".", "execute", "(", "value", ")", ";", "}" ]
Converts the given object value into the given targetClass @param value the value to convert @param targetClass the target class to convert the value to @return the converted value @throws org.springframework.binding.convert.ConversionException if the value can not be converted
[ "Converts", "the", "given", "object", "value", "into", "the", "given", "targetClass" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinding.java#L157-L161
11,766
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java
BufferedValueModel.setValue
public void setValue(Object value) { if (logger.isDebugEnabled()) { logger.debug("Setting buffered value to '" + value + "'"); } final Object oldValue = getValue(); this.bufferedValue = value; updateBuffering(); fireValueChange(oldValue, bufferedValue); }
java
public void setValue(Object value) { if (logger.isDebugEnabled()) { logger.debug("Setting buffered value to '" + value + "'"); } final Object oldValue = getValue(); this.bufferedValue = value; updateBuffering(); fireValueChange(oldValue, bufferedValue); }
[ "public", "void", "setValue", "(", "Object", "value", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Setting buffered value to '\"", "+", "value", "+", "\"'\"", ")", ";", "}", "final", "Object", "oldValue", "=", "getValue", "(", ")", ";", "this", ".", "bufferedValue", "=", "value", ";", "updateBuffering", "(", ")", ";", "fireValueChange", "(", "oldValue", ",", "bufferedValue", ")", ";", "}" ]
Sets a new buffered value and turns this BufferedValueModel into the buffering state. The buffered value is not provided to the underlying model until the trigger channel indicates a commit. @param value the value to be buffered
[ "Sets", "a", "new", "buffered", "value", "and", "turns", "this", "BufferedValueModel", "into", "the", "buffering", "state", ".", "The", "buffered", "value", "is", "not", "provided", "to", "the", "underlying", "model", "until", "the", "trigger", "channel", "indicates", "a", "commit", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L141-L149
11,767
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java
BufferedValueModel.onWrappedValueChanged
protected void onWrappedValueChanged() { if (logger.isDebugEnabled()) { logger.debug("Wrapped model value has changed; new value is '" + wrappedModel.getValue() + "'"); } setValue(wrappedModel.getValue()); }
java
protected void onWrappedValueChanged() { if (logger.isDebugEnabled()) { logger.debug("Wrapped model value has changed; new value is '" + wrappedModel.getValue() + "'"); } setValue(wrappedModel.getValue()); }
[ "protected", "void", "onWrappedValueChanged", "(", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Wrapped model value has changed; new value is '\"", "+", "wrappedModel", ".", "getValue", "(", ")", "+", "\"'\"", ")", ";", "}", "setValue", "(", "wrappedModel", ".", "getValue", "(", ")", ")", ";", "}" ]
Called when the value held by the wrapped value model changes.
[ "Called", "when", "the", "value", "held", "by", "the", "wrapped", "value", "model", "changes", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L180-L185
11,768
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java
BufferedValueModel.commit
public void commit() { if (isBuffering()) { if (logger.isDebugEnabled()) { logger.debug("Committing buffered value '" + getValue() + "' to wrapped value model '" + wrappedModel + "'"); } wrappedModel.setValueSilently(getValueToCommit(), wrappedModelChangeHandler); setValue(wrappedModel.getValue()); // check if the wrapped model changed the committed value } else { if (logger.isDebugEnabled()) { logger.debug("No buffered edit to commit; nothing to do..."); } } }
java
public void commit() { if (isBuffering()) { if (logger.isDebugEnabled()) { logger.debug("Committing buffered value '" + getValue() + "' to wrapped value model '" + wrappedModel + "'"); } wrappedModel.setValueSilently(getValueToCommit(), wrappedModelChangeHandler); setValue(wrappedModel.getValue()); // check if the wrapped model changed the committed value } else { if (logger.isDebugEnabled()) { logger.debug("No buffered edit to commit; nothing to do..."); } } }
[ "public", "void", "commit", "(", ")", "{", "if", "(", "isBuffering", "(", ")", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Committing buffered value '\"", "+", "getValue", "(", ")", "+", "\"' to wrapped value model '\"", "+", "wrappedModel", "+", "\"'\"", ")", ";", "}", "wrappedModel", ".", "setValueSilently", "(", "getValueToCommit", "(", ")", ",", "wrappedModelChangeHandler", ")", ";", "setValue", "(", "wrappedModel", ".", "getValue", "(", ")", ")", ";", "// check if the wrapped model changed the committed value", "}", "else", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"No buffered edit to commit; nothing to do...\"", ")", ";", "}", "}", "}" ]
Commits the value buffered by this value model back to the wrapped value model.
[ "Commits", "the", "value", "buffered", "by", "this", "value", "model", "back", "to", "the", "wrapped", "value", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L191-L205
11,769
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java
BufferedValueModel.updateBuffering
private void updateBuffering() { boolean wasBuffering = isBuffering(); buffering = hasValueChanged(wrappedModel.getValue(), bufferedValue); firePropertyChange(BUFFERING_PROPERTY, wasBuffering, buffering); }
java
private void updateBuffering() { boolean wasBuffering = isBuffering(); buffering = hasValueChanged(wrappedModel.getValue(), bufferedValue); firePropertyChange(BUFFERING_PROPERTY, wasBuffering, buffering); }
[ "private", "void", "updateBuffering", "(", ")", "{", "boolean", "wasBuffering", "=", "isBuffering", "(", ")", ";", "buffering", "=", "hasValueChanged", "(", "wrappedModel", ".", "getValue", "(", ")", ",", "bufferedValue", ")", ";", "firePropertyChange", "(", "BUFFERING_PROPERTY", ",", "wasBuffering", ",", "buffering", ")", ";", "}" ]
Updates the value of the buffering property. Fires a property change event if there's been a change.
[ "Updates", "the", "value", "of", "the", "buffering", "property", ".", "Fires", "a", "property", "change", "event", "if", "there", "s", "been", "a", "change", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L219-L223
11,770
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java
BufferedValueModel.revert
public final void revert() { if (isBuffering()) { if (logger.isDebugEnabled()) { logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'"); } setValue(wrappedModel.getValue()); } else { if (logger.isDebugEnabled()) { logger.debug("No buffered edit to commit; nothing to do..."); } } }
java
public final void revert() { if (isBuffering()) { if (logger.isDebugEnabled()) { logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'"); } setValue(wrappedModel.getValue()); } else { if (logger.isDebugEnabled()) { logger.debug("No buffered edit to commit; nothing to do..."); } } }
[ "public", "final", "void", "revert", "(", ")", "{", "if", "(", "isBuffering", "(", ")", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Reverting buffered value '\"", "+", "getValue", "(", ")", "+", "\"' to value '\"", "+", "wrappedModel", ".", "getValue", "(", ")", "+", "\"'\"", ")", ";", "}", "setValue", "(", "wrappedModel", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"No buffered edit to commit; nothing to do...\"", ")", ";", "}", "}", "}" ]
Reverts the value held by the value model back to the value held by the wrapped value model.
[ "Reverts", "the", "value", "held", "by", "the", "value", "model", "back", "to", "the", "value", "held", "by", "the", "wrapped", "value", "model", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L229-L241
11,771
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java
CommandButtonLabelInfo.configure
public AbstractButton configure(AbstractButton button) { Assert.notNull(button); button.setText(this.labelInfo.getText()); button.setMnemonic(this.labelInfo.getMnemonic()); button.setDisplayedMnemonicIndex(this.labelInfo.getMnemonicIndex()); configureAccelerator(button, getAccelerator()); return button; }
java
public AbstractButton configure(AbstractButton button) { Assert.notNull(button); button.setText(this.labelInfo.getText()); button.setMnemonic(this.labelInfo.getMnemonic()); button.setDisplayedMnemonicIndex(this.labelInfo.getMnemonicIndex()); configureAccelerator(button, getAccelerator()); return button; }
[ "public", "AbstractButton", "configure", "(", "AbstractButton", "button", ")", "{", "Assert", ".", "notNull", "(", "button", ")", ";", "button", ".", "setText", "(", "this", ".", "labelInfo", ".", "getText", "(", ")", ")", ";", "button", ".", "setMnemonic", "(", "this", ".", "labelInfo", ".", "getMnemonic", "(", ")", ")", ";", "button", ".", "setDisplayedMnemonicIndex", "(", "this", ".", "labelInfo", ".", "getMnemonicIndex", "(", ")", ")", ";", "configureAccelerator", "(", "button", ",", "getAccelerator", "(", ")", ")", ";", "return", "button", ";", "}" ]
Configures an existing button appropriately based on this label info's properties. @param button
[ "Configures", "an", "existing", "button", "appropriately", "based", "on", "this", "label", "info", "s", "properties", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java#L249-L256
11,772
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java
CommandButtonLabelInfo.configureAccelerator
protected void configureAccelerator(AbstractButton button, KeyStroke keystrokeAccelerator) { if ((button instanceof JMenuItem) && !(button instanceof JMenu)) { ((JMenuItem)button).setAccelerator(keystrokeAccelerator); } }
java
protected void configureAccelerator(AbstractButton button, KeyStroke keystrokeAccelerator) { if ((button instanceof JMenuItem) && !(button instanceof JMenu)) { ((JMenuItem)button).setAccelerator(keystrokeAccelerator); } }
[ "protected", "void", "configureAccelerator", "(", "AbstractButton", "button", ",", "KeyStroke", "keystrokeAccelerator", ")", "{", "if", "(", "(", "button", "instanceof", "JMenuItem", ")", "&&", "!", "(", "button", "instanceof", "JMenu", ")", ")", "{", "(", "(", "JMenuItem", ")", "button", ")", ".", "setAccelerator", "(", "keystrokeAccelerator", ")", ";", "}", "}" ]
Sets the given keystroke accelerator on the given button. @param button The button. May be null. @param keystrokeAccelerator The accelerator. May be null.
[ "Sets", "the", "given", "keystroke", "accelerator", "on", "the", "given", "button", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java#L264-L268
11,773
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/factory/DefaultComponentFactory.java
DefaultComponentFactory.getRequiredMessage
protected String getRequiredMessage(final String[] messageKeys) { MessageSourceResolvable resolvable = new MessageSourceResolvable() { public String[] getCodes() { return messageKeys; } public Object[] getArguments() { return null; } public String getDefaultMessage() { if (messageKeys.length > 0) { return messageKeys[0]; } return ""; } }; return getMessages().getMessage(resolvable); }
java
protected String getRequiredMessage(final String[] messageKeys) { MessageSourceResolvable resolvable = new MessageSourceResolvable() { public String[] getCodes() { return messageKeys; } public Object[] getArguments() { return null; } public String getDefaultMessage() { if (messageKeys.length > 0) { return messageKeys[0]; } return ""; } }; return getMessages().getMessage(resolvable); }
[ "protected", "String", "getRequiredMessage", "(", "final", "String", "[", "]", "messageKeys", ")", "{", "MessageSourceResolvable", "resolvable", "=", "new", "MessageSourceResolvable", "(", ")", "{", "public", "String", "[", "]", "getCodes", "(", ")", "{", "return", "messageKeys", ";", "}", "public", "Object", "[", "]", "getArguments", "(", ")", "{", "return", "null", ";", "}", "public", "String", "getDefaultMessage", "(", ")", "{", "if", "(", "messageKeys", ".", "length", ">", "0", ")", "{", "return", "messageKeys", "[", "0", "]", ";", "}", "return", "\"\"", ";", "}", "}", ";", "return", "getMessages", "(", ")", ".", "getMessage", "(", "resolvable", ")", ";", "}" ]
Get the message for the given key. Don't throw an exception if it's not found but return a default value. @param messageKeys The keys to use when looking for the message. @return the message found in the resources or a default message.
[ "Get", "the", "message", "for", "the", "given", "key", ".", "Don", "t", "throw", "an", "exception", "if", "it", "s", "not", "found", "but", "return", "a", "default", "value", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/factory/DefaultComponentFactory.java#L122-L141
11,774
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/factory/DefaultComponentFactory.java
DefaultComponentFactory.createTable
public JTable createTable(TableModel model) { return (getTableFactory() != null) ? getTableFactory().createTable(model) : new JTable(model); }
java
public JTable createTable(TableModel model) { return (getTableFactory() != null) ? getTableFactory().createTable(model) : new JTable(model); }
[ "public", "JTable", "createTable", "(", "TableModel", "model", ")", "{", "return", "(", "getTableFactory", "(", ")", "!=", "null", ")", "?", "getTableFactory", "(", ")", ".", "createTable", "(", "model", ")", ":", "new", "JTable", "(", "model", ")", ";", "}" ]
Construct a JTable with the specified table model. It will delegate the creation to a TableFactory if it exists. @param model the table model @return The new table.
[ "Construct", "a", "JTable", "with", "the", "specified", "table", "model", ".", "It", "will", "delegate", "the", "creation", "to", "a", "TableFactory", "if", "it", "exists", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/factory/DefaultComponentFactory.java#L460-L462
11,775
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java
StringSelectionListBinding.createLabels
private String[] createLabels(final String id, final Object[] keys) { String[] messages = new String[keys.length]; for (int i = 0; i < messages.length; ++i) { messages[i] = getApplicationConfig().messageResolver().getMessage(id, keys[i] == null ? "null" : keys[i].toString(), "label"); } return messages; }
java
private String[] createLabels(final String id, final Object[] keys) { String[] messages = new String[keys.length]; for (int i = 0; i < messages.length; ++i) { messages[i] = getApplicationConfig().messageResolver().getMessage(id, keys[i] == null ? "null" : keys[i].toString(), "label"); } return messages; }
[ "private", "String", "[", "]", "createLabels", "(", "final", "String", "id", ",", "final", "Object", "[", "]", "keys", ")", "{", "String", "[", "]", "messages", "=", "new", "String", "[", "keys", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "messages", ".", "length", ";", "++", "i", ")", "{", "messages", "[", "i", "]", "=", "getApplicationConfig", "(", ")", ".", "messageResolver", "(", ")", ".", "getMessage", "(", "id", ",", "keys", "[", "i", "]", "==", "null", "?", "\"null\"", ":", "keys", "[", "i", "]", ".", "toString", "(", ")", ",", "\"label\"", ")", ";", "}", "return", "messages", ";", "}" ]
Will resolve keys to messages using 'id'.'key'.label as a message resource key. @param id id to use with message key resolving. @param keys keys to extract messages from. @return array containing labels/messages for each key.
[ "Will", "resolve", "keys", "to", "messages", "using", "id", ".", "key", ".", "label", "as", "a", "message", "resource", "key", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java#L81-L90
11,776
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java
StringSelectionListBinding.getLabelsFromMap
public static Collection getLabelsFromMap(Collection sortedKeys, Map keysAndLabels) { Collection<Object> labels = new ArrayList<Object>(); Iterator keyIt = sortedKeys.iterator(); while (keyIt.hasNext()) { labels.add(keysAndLabels.get(keyIt.next())); } return labels; }
java
public static Collection getLabelsFromMap(Collection sortedKeys, Map keysAndLabels) { Collection<Object> labels = new ArrayList<Object>(); Iterator keyIt = sortedKeys.iterator(); while (keyIt.hasNext()) { labels.add(keysAndLabels.get(keyIt.next())); } return labels; }
[ "public", "static", "Collection", "getLabelsFromMap", "(", "Collection", "sortedKeys", ",", "Map", "keysAndLabels", ")", "{", "Collection", "<", "Object", ">", "labels", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "Iterator", "keyIt", "=", "sortedKeys", ".", "iterator", "(", ")", ";", "while", "(", "keyIt", ".", "hasNext", "(", ")", ")", "{", "labels", ".", "add", "(", "keysAndLabels", ".", "get", "(", "keyIt", ".", "next", "(", ")", ")", ")", ";", "}", "return", "labels", ";", "}" ]
Will extract labels from a map in sorted order. @param sortedKeys collection with keys in the appropriate order. Each key corresponds to one in the map. @param keysAndLabels map containing both, keys and labels, from which the labels have to be extracted. @return a collection containing the labels corresponding to the collection of sortedKeys.
[ "Will", "extract", "labels", "from", "a", "map", "in", "sorted", "order", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java#L104-L113
11,777
instacount/appengine-counter
src/main/java/io/instacount/appengine/counter/data/CounterShardData.java
CounterShardData.constructCounterShardIdentifier
@VisibleForTesting static String constructCounterShardIdentifier(final String counterName, final int shardNumber) { Preconditions.checkNotNull(counterName); Preconditions.checkArgument(!StringUtils.isBlank(counterName), "CounterData Names may not be null, blank, or empty!"); Preconditions.checkArgument(shardNumber >= 0, "shardNumber must be greater than or equal to 0!"); return counterName + COUNTER_SHARD_KEY_SEPARATOR + shardNumber; }
java
@VisibleForTesting static String constructCounterShardIdentifier(final String counterName, final int shardNumber) { Preconditions.checkNotNull(counterName); Preconditions.checkArgument(!StringUtils.isBlank(counterName), "CounterData Names may not be null, blank, or empty!"); Preconditions.checkArgument(shardNumber >= 0, "shardNumber must be greater than or equal to 0!"); return counterName + COUNTER_SHARD_KEY_SEPARATOR + shardNumber; }
[ "@", "VisibleForTesting", "static", "String", "constructCounterShardIdentifier", "(", "final", "String", "counterName", ",", "final", "int", "shardNumber", ")", "{", "Preconditions", ".", "checkNotNull", "(", "counterName", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "StringUtils", ".", "isBlank", "(", "counterName", ")", ",", "\"CounterData Names may not be null, blank, or empty!\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "shardNumber", ">=", "0", ",", "\"shardNumber must be greater than or equal to 0!\"", ")", ";", "return", "counterName", "+", "COUNTER_SHARD_KEY_SEPARATOR", "+", "shardNumber", ";", "}" ]
Helper method to set the internal identifier for this entity. @param counterName @param shardNumber A unique identifier to distinguish shards for the same {@code counterName} from each other.
[ "Helper", "method", "to", "set", "the", "internal", "identifier", "for", "this", "entity", "." ]
60aa86ab28f173ec1642539926b69924b8bda238
https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/data/CounterShardData.java#L150-L159
11,778
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/StringLength.java
StringLength.call
public Object call(Object value) { if (value == null) { return new Integer(0); } return new Integer(String.valueOf(value).length()); }
java
public Object call(Object value) { if (value == null) { return new Integer(0); } return new Integer(String.valueOf(value).length()); }
[ "public", "Object", "call", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "new", "Integer", "(", "0", ")", ";", "}", "return", "new", "Integer", "(", "String", ".", "valueOf", "(", "value", ")", ".", "length", "(", ")", ")", ";", "}" ]
Evaluate the string form of the object returning an Integer representing the string length. @return The string length Integer. @see Closure#call(java.lang.Object)
[ "Evaluate", "the", "string", "form", "of", "the", "object", "returning", "an", "Integer", "representing", "the", "string", "length", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/StringLength.java#L46-L49
11,779
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/support/DefaultRulesSource.java
DefaultRulesSource.addRules
public void addRules(Rules rules) { if (logger.isDebugEnabled()) { logger.debug("Adding rules -> " + rules); } addRules(DEFAULT_CONTEXT_ID, rules); }
java
public void addRules(Rules rules) { if (logger.isDebugEnabled()) { logger.debug("Adding rules -> " + rules); } addRules(DEFAULT_CONTEXT_ID, rules); }
[ "public", "void", "addRules", "(", "Rules", "rules", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Adding rules -> \"", "+", "rules", ")", ";", "}", "addRules", "(", "DEFAULT_CONTEXT_ID", ",", "rules", ")", ";", "}" ]
Add or update the rules for a single bean class. @param rules The rules.
[ "Add", "or", "update", "the", "rules", "for", "a", "single", "bean", "class", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/support/DefaultRulesSource.java#L57-L62
11,780
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java
PropertyAccessorUtils.getParentPropertyPath
public static String getParentPropertyPath(String propertyPath) { int propertySeparatorIndex = getLastNestedPropertySeparatorIndex(propertyPath); return propertySeparatorIndex == -1? "": propertyPath.substring(0, propertySeparatorIndex); }
java
public static String getParentPropertyPath(String propertyPath) { int propertySeparatorIndex = getLastNestedPropertySeparatorIndex(propertyPath); return propertySeparatorIndex == -1? "": propertyPath.substring(0, propertySeparatorIndex); }
[ "public", "static", "String", "getParentPropertyPath", "(", "String", "propertyPath", ")", "{", "int", "propertySeparatorIndex", "=", "getLastNestedPropertySeparatorIndex", "(", "propertyPath", ")", ";", "return", "propertySeparatorIndex", "==", "-", "1", "?", "\"\"", ":", "propertyPath", ".", "substring", "(", "0", ",", "propertySeparatorIndex", ")", ";", "}" ]
Returns the path to the parent component of the provided property path.
[ "Returns", "the", "path", "to", "the", "parent", "component", "of", "the", "provided", "property", "path", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java#L31-L34
11,781
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java
PropertyAccessorUtils.getPropertyName
public static String getPropertyName(String propertyPath) { int propertySeparatorIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(propertyPath); return propertySeparatorIndex == -1? propertyPath: propertyPath.substring(propertySeparatorIndex + 1); }
java
public static String getPropertyName(String propertyPath) { int propertySeparatorIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(propertyPath); return propertySeparatorIndex == -1? propertyPath: propertyPath.substring(propertySeparatorIndex + 1); }
[ "public", "static", "String", "getPropertyName", "(", "String", "propertyPath", ")", "{", "int", "propertySeparatorIndex", "=", "PropertyAccessorUtils", ".", "getLastNestedPropertySeparatorIndex", "(", "propertyPath", ")", ";", "return", "propertySeparatorIndex", "==", "-", "1", "?", "propertyPath", ":", "propertyPath", ".", "substring", "(", "propertySeparatorIndex", "+", "1", ")", ";", "}" ]
Returns the last component of the specified property path
[ "Returns", "the", "last", "component", "of", "the", "specified", "property", "path" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java#L39-L42
11,782
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java
PropertyAccessorUtils.isIndexedProperty
public static boolean isIndexedProperty(String propertyName) { return propertyName.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR) != -1 && propertyName.charAt(propertyName.length() - 1) == PropertyAccessor.PROPERTY_KEY_SUFFIX_CHAR; }
java
public static boolean isIndexedProperty(String propertyName) { return propertyName.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR) != -1 && propertyName.charAt(propertyName.length() - 1) == PropertyAccessor.PROPERTY_KEY_SUFFIX_CHAR; }
[ "public", "static", "boolean", "isIndexedProperty", "(", "String", "propertyName", ")", "{", "return", "propertyName", ".", "indexOf", "(", "PropertyAccessor", ".", "PROPERTY_KEY_PREFIX_CHAR", ")", "!=", "-", "1", "&&", "propertyName", ".", "charAt", "(", "propertyName", ".", "length", "(", ")", "-", "1", ")", "==", "PropertyAccessor", ".", "PROPERTY_KEY_SUFFIX_CHAR", ";", "}" ]
Tests whether the specified property path denotes an indexed property.
[ "Tests", "whether", "the", "specified", "property", "path", "denotes", "an", "indexed", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/PropertyAccessorUtils.java#L47-L50
11,783
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.regexp
public Constraint regexp(String regexp, String type) { RegexpConstraint c = new RegexpConstraint(regexp); c.setType(type); return c; }
java
public Constraint regexp(String regexp, String type) { RegexpConstraint c = new RegexpConstraint(regexp); c.setType(type); return c; }
[ "public", "Constraint", "regexp", "(", "String", "regexp", ",", "String", "type", ")", "{", "RegexpConstraint", "c", "=", "new", "RegexpConstraint", "(", "regexp", ")", ";", "c", ".", "setType", "(", "type", ")", ";", "return", "c", ";", "}" ]
Creates a constraint backed by a regular expression, with a type for reporting. @param regexp The regular expression string. @return The constraint.
[ "Creates", "a", "constraint", "backed", "by", "a", "regular", "expression", "with", "a", "type", "for", "reporting", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L437-L441
11,784
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.method
public Constraint method(Object target, String methodName, String constraintType) { return new MethodInvokingConstraint(target, methodName, constraintType); }
java
public Constraint method(Object target, String methodName, String constraintType) { return new MethodInvokingConstraint(target, methodName, constraintType); }
[ "public", "Constraint", "method", "(", "Object", "target", ",", "String", "methodName", ",", "String", "constraintType", ")", "{", "return", "new", "MethodInvokingConstraint", "(", "target", ",", "methodName", ",", "constraintType", ")", ";", "}" ]
Returns a constraint whose test is determined by a boolean method on a target object. @param target The targetObject @param methodName The method name @return The constraint.
[ "Returns", "a", "constraint", "whose", "test", "is", "determined", "by", "a", "boolean", "method", "on", "a", "target", "object", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L451-L453
11,785
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.not
public Constraint not(Constraint constraint) { if (!(constraint instanceof Not)) return new Not(constraint); return ((Not)constraint).getConstraint(); }
java
public Constraint not(Constraint constraint) { if (!(constraint instanceof Not)) return new Not(constraint); return ((Not)constraint).getConstraint(); }
[ "public", "Constraint", "not", "(", "Constraint", "constraint", ")", "{", "if", "(", "!", "(", "constraint", "instanceof", "Not", ")", ")", "return", "new", "Not", "(", "constraint", ")", ";", "return", "(", "(", "Not", ")", "constraint", ")", ".", "getConstraint", "(", ")", ";", "}" ]
Negate the specified constraint. @param constraint The constraint to negate @return The negated constraint.
[ "Negate", "the", "specified", "constraint", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L563-L568
11,786
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.all
public PropertyConstraint all(String propertyName, Constraint[] constraints) { return value(propertyName, all(constraints)); }
java
public PropertyConstraint all(String propertyName, Constraint[] constraints) { return value(propertyName, all(constraints)); }
[ "public", "PropertyConstraint", "all", "(", "String", "propertyName", ",", "Constraint", "[", "]", "constraints", ")", "{", "return", "value", "(", "propertyName", ",", "all", "(", "constraints", ")", ")", ";", "}" ]
Apply an "all" value constraint to the provided bean property. @param propertyName The bean property name @param constraints The constraints that form a all conjunction @return
[ "Apply", "an", "all", "value", "constraint", "to", "the", "provided", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L630-L632
11,787
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.any
public PropertyConstraint any(String propertyName, Constraint[] constraints) { return value(propertyName, any(constraints)); }
java
public PropertyConstraint any(String propertyName, Constraint[] constraints) { return value(propertyName, any(constraints)); }
[ "public", "PropertyConstraint", "any", "(", "String", "propertyName", ",", "Constraint", "[", "]", "constraints", ")", "{", "return", "value", "(", "propertyName", ",", "any", "(", "constraints", ")", ")", ";", "}" ]
Apply an "any" value constraint to the provided bean property. @param propertyName The bean property name @param constraints The constraints that form a all disjunction @return
[ "Apply", "an", "any", "value", "constraint", "to", "the", "provided", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L641-L643
11,788
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.eq
public PropertyConstraint eq(String propertyName, Object propertyValue) { return new ParameterizedPropertyConstraint(propertyName, eq(propertyValue)); }
java
public PropertyConstraint eq(String propertyName, Object propertyValue) { return new ParameterizedPropertyConstraint(propertyName, eq(propertyValue)); }
[ "public", "PropertyConstraint", "eq", "(", "String", "propertyName", ",", "Object", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "eq", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "equal to" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "equal", "to", "constraint", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L666-L668
11,789
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gt
public PropertyConstraint gt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue)); }
java
public PropertyConstraint gt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue)); }
[ "public", "PropertyConstraint", "gt", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "gt", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "greater than" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "greater", "than", "constraint", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L691-L693
11,790
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gte
public PropertyConstraint gte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gte(propertyValue)); }
java
public PropertyConstraint gte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gte(propertyValue)); }
[ "public", "PropertyConstraint", "gte", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "gte", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "greater than equal to" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "greater", "than", "equal", "to", "constraint", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L702-L704
11,791
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.lt
public PropertyConstraint lt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lt(propertyValue)); }
java
public PropertyConstraint lt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lt(propertyValue)); }
[ "public", "PropertyConstraint", "lt", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "lt", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "less than" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "less", "than", "constraint", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L713-L715
11,792
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.lte
public PropertyConstraint lte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lte(propertyValue)); }
java
public PropertyConstraint lte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lte(propertyValue)); }
[ "public", "PropertyConstraint", "lte", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "lte", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "less than equal to" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "less", "than", "equal", "to", "constraint", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L724-L726
11,793
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.eqProperty
public PropertyConstraint eqProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, EqualTo.instance(), otherPropertyName); }
java
public PropertyConstraint eqProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, EqualTo.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "eqProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "EqualTo", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "equal to" constraint to two bean properties. @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "equal", "to", "constraint", "to", "two", "bean", "properties", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L842-L844
11,794
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gtProperty
public PropertyConstraint gtProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThan.instance(), otherPropertyName); }
java
public PropertyConstraint gtProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThan.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "gtProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "GreaterThan", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "greater than" constraint to two properties @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "greater", "than", "constraint", "to", "two", "properties" ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L853-L855
11,795
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gteProperty
public PropertyConstraint gteProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThanEqualTo.instance(), otherPropertyName); }
java
public PropertyConstraint gteProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThanEqualTo.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "gteProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "GreaterThanEqualTo", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "greater than or equal to" constraint to two properties. @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "greater", "than", "or", "equal", "to", "constraint", "to", "two", "properties", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L864-L866
11,796
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.ltProperty
public PropertyConstraint ltProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, LessThan.instance(), otherPropertyName); }
java
public PropertyConstraint ltProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, LessThan.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "ltProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "LessThan", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "less than" constraint to two properties. @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "less", "than", "constraint", "to", "two", "properties", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L875-L877
11,797
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.lteProperty
public PropertyConstraint lteProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, LessThanEqualTo.instance(), otherPropertyName); }
java
public PropertyConstraint lteProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, LessThanEqualTo.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "lteProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "LessThanEqualTo", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "less than or equal to" constraint to two properties. @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "less", "than", "or", "equal", "to", "constraint", "to", "two", "properties", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L886-L888
11,798
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.inRangeProperties
public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName) { Constraint min = gteProperty(propertyName, minPropertyName); Constraint max = lteProperty(propertyName, maxPropertyName); return new CompoundPropertyConstraint(new And(min, max)); }
java
public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName) { Constraint min = gteProperty(propertyName, minPropertyName); Constraint max = lteProperty(propertyName, maxPropertyName); return new CompoundPropertyConstraint(new And(min, max)); }
[ "public", "PropertyConstraint", "inRangeProperties", "(", "String", "propertyName", ",", "String", "minPropertyName", ",", "String", "maxPropertyName", ")", "{", "Constraint", "min", "=", "gteProperty", "(", "propertyName", ",", "minPropertyName", ")", ";", "Constraint", "max", "=", "lteProperty", "(", "propertyName", ",", "maxPropertyName", ")", ";", "return", "new", "CompoundPropertyConstraint", "(", "new", "And", "(", "min", ",", "max", ")", ")", ";", "}" ]
Apply a inclusive "range" constraint between two other properties to a bean property. @param propertyName the property with the range constraint. @param minPropertyName the low edge of the range @param maxPropertyName the high edge of the range @return The range constraint constraint
[ "Apply", "a", "inclusive", "range", "constraint", "between", "two", "other", "properties", "to", "a", "bean", "property", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L911-L915
11,799
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/ui/ContactTable.java
ContactTable.getSelectedContacts
public Contact[] getSelectedContacts() { int[] selected = getTable().getSelectedRows(); Contact[] contacts = new Contact[selected.length]; for (int i = 0; i < selected.length; i++) { contacts[i] = (Contact) getTableModel().getElementAt(selected[i]); } return contacts; }
java
public Contact[] getSelectedContacts() { int[] selected = getTable().getSelectedRows(); Contact[] contacts = new Contact[selected.length]; for (int i = 0; i < selected.length; i++) { contacts[i] = (Contact) getTableModel().getElementAt(selected[i]); } return contacts; }
[ "public", "Contact", "[", "]", "getSelectedContacts", "(", ")", "{", "int", "[", "]", "selected", "=", "getTable", "(", ")", ".", "getSelectedRows", "(", ")", ";", "Contact", "[", "]", "contacts", "=", "new", "Contact", "[", "selected", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "selected", ".", "length", ";", "i", "++", ")", "{", "contacts", "[", "i", "]", "=", "(", "Contact", ")", "getTableModel", "(", ")", ".", "getElementAt", "(", "selected", "[", "i", "]", ")", ";", "}", "return", "contacts", ";", "}" ]
Get the array of selected Contact objects in the table. @return array of Contacts, zero length if nothing is selected
[ "Get", "the", "array", "of", "selected", "Contact", "objects", "in", "the", "table", "." ]
6aad6e640b348cda8f3b0841f6e42025233f1eb8
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/ui/ContactTable.java#L65-L72