idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
7,000
public void clearMessages ( String fieldName ) { Set messagesForFieldName = getMessages ( fieldName ) ; for ( Iterator mi = messagesForFieldName . iterator ( ) ; mi . hasNext ( ) ; ) { messages . remove ( mi . next ( ) ) ; } messagesSubSets . clear ( ) ; }
Clear all messages of the given fieldName .
7,001
protected boolean isEditable ( Object row , int column ) { beanWrapper . setWrappedInstance ( row ) ; return beanWrapper . isWritableProperty ( columnPropertyNames [ column ] ) ; }
May be overridden to achieve control over editable columns .
7,002
protected void fill ( GroupContainerPopulator parentContainer , Object factory , CommandButtonConfigurer configurer , List previousButtons ) { parentContainer . add ( Box . createGlue ( ) ) ; }
Adds a glue component using the given container populator .
7,003
public EventList getBaseEventList ( ) { if ( baseList == null ) { Object [ ] data = getInitialData ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Table data: got " + data . length + " entries" ) ; } EventList rawList = GlazedLists . eventList ( Arrays . asList ( data ) ) ; int initialSortColumn = getIniti...
Get the base event list for the table model . This can be used to build layered event models for filtering .
7,004
protected void init ( ) { objectSingularName = getApplicationConfig ( ) . messageResolver ( ) . getMessage ( modelId + ".objectName.singular" ) ; objectPluralName = getApplicationConfig ( ) . messageResolver ( ) . getMessage ( modelId + ".objectName.plural" ) ; }
Initialize our internal values .
7,005
protected void onDoubleClick ( ) { 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 .
7,006
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 .
7,007
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 ( ) ...
Update the status bar with the current display counts .
7,008
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 ...
Handle an application event . This will notify us of object adds deletes and modifications . Update our table model accordingly .
7,009
public static JComponent createButtonBar ( Object [ ] groupMembers ) { CommandGroupFactoryBean commandGroupFactoryBean = new CommandGroupFactoryBean ( null , groupMembers ) ; CommandGroup dialogCommandGroup = commandGroupFactoryBean . getCommandGroup ( ) ; JComponent buttonBar = dialogCommandGroup . createButtonBar ( )...
Return a standardized row of command buttons .
7,010
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 .
7,011
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 .
7,012
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 .
7,013
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 != buffere...
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 .
7,014
private Object updateBufferedListModel ( final Object wrappedCollection ) { if ( bufferedListModel == null ) { bufferedListModel = createBufferedListModel ( ) ; bufferedListModel . addListDataListener ( listChangeHandler ) ; setValue ( bufferedListModel ) ; } if ( wrappedCollection == null ) { bufferedListModel . clear...
Gets the list value associated with this value model creating a list model buffer containing its contents suitable for manipulation .
7,015
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 .
7,016
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 ...
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 .
7,017
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 .
7,018
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 .
7,019
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 .
7,020
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 .
7,021
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 .
7,022
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 .
7,023
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 . set...
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 .
7,024
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 .
7,025
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
7,026
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 .
7,027
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 .
7,028
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 .
7,029
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 .
7,030
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 .
7,031
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 .
7,032
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 { eventMetho...
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 .
7,033
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 ) ; retur...
Returns an object which is a copy of the collection of listeners registered with this instance .
7,034
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 = ProcessStat...
Reset the ElementGenerator if possible .
7,035
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 .
7,036
public void commit ( ) { for ( Iterator i = listeners . iterator ( ) ; i . hasNext ( ) ; ) { ( ( CommitTriggerListener ) i . next ( ) ) . commit ( ) ; } }
Triggers a commit event .
7,037
public void revert ( ) { for ( Iterator i = listeners . iterator ( ) ; i . hasNext ( ) ; ) { ( ( CommitTriggerListener ) i . next ( ) ) . revert ( ) ; } }
Triggers a revert event .
7,038
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 . addComm...
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 .
7,039
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 " + ...
Sets the image content of the widget based on a resource
7,040
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 .
7,041
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 .
7,042
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 ....
Applies the current LaF font setting to the document .
7,043
public void add ( ApplicationWindow window ) { if ( activeWindow == null ) 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 .
7,044
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 .
7,045
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 ( ) ; ...
Attempts to close all windows managed by this window manager as well as windows managed by any descendent window managers .
7,046
public ApplicationWindow [ ] getWindows ( ) { ApplicationWindow managed [ ] = new ApplicationWindow [ windows . size ( ) ] ; windows . toArray ( managed ) ; return managed ; }
Returns this window manager s set of windows .
7,047
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 .
7,048
public final void setActiveWindow ( ApplicationWindow window ) { final ApplicationWindow old = this . activeWindow ; this . activeWindow = window ; if ( getParent ( ) != null ) 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 .
7,049
public void onPreWindowOpen ( ApplicationWindowConfigurer configurer ) { configurer . setTitle ( application . getName ( ) ) ; configurer . setImage ( application . getImage ( ) ) ; }
Hook called right before the application opens a window .
7,050
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 .
7,051
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 .
7,052
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 ) retu...
Conversion of RCP TableDescription to GlazedLists TableFormat
7,053
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 ( ) ...
Validates the object through Hibernate Validator
7,054
public static Field [ ] getAllDeclaredFields ( Class < ? > leafClass ) { Assert . notNull ( leafClass , "leafClass" ) ; final List < Field > fields = new ArrayList < Field > ( 32 ) ; ReflectionUtils . doWithFields ( leafClass , new ReflectionUtils . FieldCallback ( ) { public void doWith ( Field field ) throws IllegalA...
Get all declared fields on the leaf class and all superclasses . Leaf class methods are included first .
7,055
public static Object unwrapProxy ( Object bean , Boolean recursive ) { Assert . notNull ( recursive , "recursive" ) ; Object unwrapped = bean ; if ( ( bean != null ) && ( bean instanceof Advised ) && ( AopUtils . isAopProxy ( bean ) ) ) { final Advised advised = ( Advised ) bean ; try { final Object target = advised . ...
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 .
7,056
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 (...
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...
7,057
private void saveDockingContext ( VLDockingApplicationPage dockingPage ) { DockingContext dockingContext = dockingPage . getDockingContext ( ) ; VLDockingPageDescriptor vlDockingPageDescriptor = ValkyrieRepository . getInstance ( ) . getBean ( dockingPage . getId ( ) , VLDockingPageDescriptor . class ) ; BufferedOutput...
Saves the docking layout of a docking page fo the application
7,058
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 ) ; if ( ...
Creates the config directory if it doesn t exist already
7,059
public void setModel ( ListModel model ) { helperList . setModel ( model ) ; dataModel = model ; clearSelection ( ) ; 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 .
7,060
public void setVisibleRowCount ( int visibleRowCount ) { sourceList . setVisibleRowCount ( visibleRowCount ) ; chosenList . setVisibleRowCount ( visibleRowCount ) ; helperList . setVisibleRowCount ( visibleRowCount ) ; Dimension d = helperScroller . getPreferredSize ( ) ; chosenPanel . setPreferredSize ( d ) ; sourcePa...
Sets the preferred number of rows in the list that can be displayed without a scrollbar .
7,061
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 .
7,062
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 ) ...
Add labels on top of the 2 lists . If not present do not show the labels .
7,063
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 ) ...
Build our component panel .
7,064
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 ( smal...
Construct the control button panel .
7,065
protected void moveLeftToRight ( ) { Object [ ] sourceSelected = sourceList . getSelectedValues ( ) ; int nSourceSelected = sourceSelected . length ; int [ ] currentSelection = helperList . getSelectedIndices ( ) ; int [ ] newSelection = new int [ currentSelection . length + nSourceSelected ] ; System . arraycopy ( cur...
Move the selected items in the source list to the chosen list . I . e . add the items to our selection model .
7,066
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 .
7,067
protected void moveRightToLeft ( ) { Object [ ] chosenSelectedValues = chosenList . getSelectedValues ( ) ; int nChosenSelected = chosenSelectedValues . length ; int [ ] chosenSelected = new int [ nChosenSelected ] ; if ( nChosenSelected == 0 ) { return ; } int [ ] currentSelected = helperList . getSelectedIndices ( ) ...
Move the selected items in the chosen list to the source list . I . e . remove them from our selection model .
7,068
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 ; } } retu...
Get the index of a given object in the underlying data model .
7,069
protected void update ( ) { int sz = dataModel . getSize ( ) ; int [ ] selected = helperList . getSelectedIndices ( ) ; ArrayList sourceItems = new ArrayList ( sz ) ; ArrayList chosenItems = new ArrayList ( selected . length ) ; for ( int i = 0 ; i < sz ; i ++ ) { sourceItems . add ( dataModel . getElementAt ( i ) ) ; ...
Update the two lists based on the current selection indices .
7,070
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
7,071
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 .
7,072
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 .
7,073
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 . ...
Commits the value buffered by this value model back to the wrapped value model .
7,074
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 .
7,075
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 ( "...
Reverts the value held by the value model back to the value held by the wrapped value model .
7,076
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 , g...
Configures an existing button appropriately based on this label info s properties .
7,077
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 .
7,078
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 )...
Get the message for the given key . Don t throw an exception if it s not found but return a default value .
7,079
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 .
7,080
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 ( ...
Will resolve keys to messages using id . key . label as a message resource key .
7,081
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 .
7,082
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 ( shardNum...
Helper method to set the internal identifier for this entity .
7,083
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 .
7,084
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 .
7,085
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 .
7,086
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
7,087
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 .
7,088
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 .
7,089
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 .
7,090
public Constraint not ( Constraint constraint ) { if ( ! ( constraint instanceof Not ) ) return new Not ( constraint ) ; return ( ( Not ) constraint ) . getConstraint ( ) ; }
Negate the specified constraint .
7,091
public PropertyConstraint all ( String propertyName , Constraint [ ] constraints ) { return value ( propertyName , all ( constraints ) ) ; }
Apply an all value constraint to the provided bean property .
7,092
public PropertyConstraint any ( String propertyName , Constraint [ ] constraints ) { return value ( propertyName , any ( constraints ) ) ; }
Apply an any value constraint to the provided bean property .
7,093
public PropertyConstraint eq ( String propertyName , Object propertyValue ) { return new ParameterizedPropertyConstraint ( propertyName , eq ( propertyValue ) ) ; }
Apply a equal to constraint to a bean property .
7,094
public PropertyConstraint gt ( String propertyName , Comparable propertyValue ) { return new ParameterizedPropertyConstraint ( propertyName , gt ( propertyValue ) ) ; }
Apply a greater than constraint to a bean property .
7,095
public PropertyConstraint gte ( String propertyName , Comparable propertyValue ) { return new ParameterizedPropertyConstraint ( propertyName , gte ( propertyValue ) ) ; }
Apply a greater than equal to constraint to a bean property .
7,096
public PropertyConstraint lt ( String propertyName , Comparable propertyValue ) { return new ParameterizedPropertyConstraint ( propertyName , lt ( propertyValue ) ) ; }
Apply a less than constraint to a bean property .
7,097
public PropertyConstraint lte ( String propertyName , Comparable propertyValue ) { return new ParameterizedPropertyConstraint ( propertyName , lte ( propertyValue ) ) ; }
Apply a less than equal to constraint to a bean property .
7,098
public PropertyConstraint eqProperty ( String propertyName , String otherPropertyName ) { return valueProperties ( propertyName , EqualTo . instance ( ) , otherPropertyName ) ; }
Apply a equal to constraint to two bean properties .
7,099
public PropertyConstraint gtProperty ( String propertyName , String otherPropertyName ) { return valueProperties ( propertyName , GreaterThan . instance ( ) , otherPropertyName ) ; }
Apply a greater than constraint to two properties