idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
7,100
public PropertyConstraint gteProperty ( String propertyName , String otherPropertyName ) { return valueProperties ( propertyName , GreaterThanEqualTo . instance ( ) , otherPropertyName ) ; }
Apply a greater than or equal to constraint to two properties .
7,101
public PropertyConstraint ltProperty ( String propertyName , String otherPropertyName ) { return valueProperties ( propertyName , LessThan . instance ( ) , otherPropertyName ) ; }
Apply a less than constraint to two properties .
7,102
public PropertyConstraint lteProperty ( String propertyName , String otherPropertyName ) { return valueProperties ( propertyName , LessThanEqualTo . instance ( ) , otherPropertyName ) ; }
Apply a less than or equal to constraint to two properties .
7,103
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 .
7,104
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 .
7,105
public final void processComponent ( String propertyName , final JComponent component ) { final AbstractOverlayHandler overlayHandler = this . createOverlayHandler ( propertyName , component ) ; final PropertyChangeListener wait4ParentListener = new PropertyChangeListener ( ) { public void propertyChange ( PropertyChan...
Creates an overlay handler for the given property name and component and installs the overlay .
7,106
protected void initRules ( ) { this . validationRules = new Rules ( getClass ( ) ) { protected void initRules ( ) { add ( PROPERTY_USERNAME , all ( new Constraint [ ] { required ( ) , minLength ( getUsernameMinLength ( ) ) } ) ) ; add ( PROPERTY_PASSWORD , all ( new Constraint [ ] { required ( ) , minLength ( getPasswo...
Initialize the field constraints for our properties . Minimal constraints are enforced here . If you need more control you should override this in a subtype .
7,107
private Icon getIcon ( Severity severity ) { if ( severity == Severity . ERROR ) { return getErrorIcon ( ) ; } if ( severity == Severity . WARNING ) { return getWarningIcon ( ) ; } return getInfoIcon ( ) ; }
Returns the icon for the given severity .
7,108
public void setAuthorizingRoles ( String roles ) { ConfigAttributeEditor editor = new ConfigAttributeEditor ( ) ; editor . setAsText ( roles ) ; this . roles = ( List < ConfigAttribute > ) editor . getValue ( ) ; rolesString = roles ; }
Set the roles to compare against the current user s authenticated roles . The secured objects will be authorized if the user holds one or more of these roles . This should be specified as a simple list of comma separated role names .
7,109
public static Class < ? > getTypeForProperty ( Method getter ) { Class < ? > returnType = getter . getReturnType ( ) ; if ( returnType . equals ( Void . TYPE ) ) throw new IllegalArgumentException ( "Getter " + getter . toString ( ) + " does not have a returntype." ) ; else if ( returnType . isPrimitive ( ) ) return Me...
Returns the type of the property checking if it actually does return something and wrapping primitives if needed .
7,110
public static final Method getWriteMethod ( Class < ? > clazz , String propertyName , Class < ? > propertyType ) { String propertyNameCapitalized = capitalize ( propertyName ) ; try { return clazz . getMethod ( "set" + propertyNameCapitalized , new Class [ ] { propertyType } ) ; } catch ( Exception e ) { return null ; ...
Lookup the setter method for the given property .
7,111
public static String capitalize ( String s ) { if ( s == null || s . length ( ) == 0 ) { return s ; } char chars [ ] = s . toCharArray ( ) ; chars [ 0 ] = Character . toUpperCase ( chars [ 0 ] ) ; return new String ( chars ) ; }
Small helper method to capitalize the first character of the given string .
7,112
public static void attachOverlay ( JComponent overlay , JComponent overlayTarget , int center , int xOffset , int yOffset ) { new OverlayHelper ( overlay , overlayTarget , center , xOffset , yOffset ) ; }
Attaches an overlay to the specified component .
7,113
private Rectangle findLargestVisibleRectFor ( final Rectangle overlayRect ) { Rectangle visibleRect = null ; int curxoffset = 0 ; int curyoffset = 0 ; if ( overlayTarget == null ) { return null ; } JComponent comp = overlayTarget ; do { visibleRect = comp . getVisibleRect ( ) ; visibleRect . x -= curxoffset ; visibleRe...
Searches up the component hierarchy to find the largest possible visible rect that can enclose the entire rectangle .
7,114
protected void listWorkerDone ( List < Object > rows , Map < String , Object > parameters ) { setRows ( rows ) ; validationResultsModel . removeMessage ( maximumRowsExceededMessage ) ; if ( ( rows == null ) || ( rows . size ( ) == 0 ) ) { return ; } Object defaultSelectedObject = null ; if ( parameters . containsKey ( ...
This method is called on the gui - thread when the worker ends . As default it will check for the PARAMETER_DEFAULT_SELECTED_OBJECT parameter in the map .
7,115
public Widget createDetailWidget ( ) { return new AbstractWidget ( ) { public void onAboutToShow ( ) { DefaultDataEditorWidget . this . onAboutToShow ( ) ; } public void onAboutToHide ( ) { DefaultDataEditorWidget . this . onAboutToHide ( ) ; } public JComponent getComponent ( ) { return getDetailForm ( ) . getControl ...
Returns only the detail form widget
7,116
protected void setDetailForm ( AbstractForm detailForm ) { if ( this . detailForm != null ) { validationResultsModel . remove ( this . detailForm . getFormModel ( ) . getValidationResults ( ) ) ; } this . detailForm = detailForm ; if ( this . detailForm != null ) { validationResultsModel . add ( this . detailForm . get...
Set the form that will handle one detail item .
7,117
protected void setFilterForm ( FilterForm filterForm ) { if ( this . filterForm != null ) { validationResultsModel . remove ( this . filterForm . getFormModel ( ) . getValidationResults ( ) ) ; } this . filterForm = filterForm ; if ( this . filterForm != null ) { validationResultsModel . add ( filterForm . getFormModel...
Set the form to use as filter .
7,118
protected void setDataProvider ( DataProvider provider ) { if ( ( this . dataProvider != null ) && ( this . dataProvider . getRefreshPolicy ( ) == DataProvider . RefreshPolicy . ON_USER_SWITCH ) ) { getApplicationConfig ( ) . applicationSession ( ) . removePropertyChangeListener ( ApplicationSession . USER , this ) ; }...
Set the provider to use for data manipulation .
7,119
protected CommandGroup createCommandGroup ( ) { CommandGroup group ; if ( isExclusive ( ) ) { ExclusiveCommandGroup g = new ExclusiveCommandGroup ( getGroupId ( ) , getCommandRegistry ( ) ) ; g . setAllowsEmptySelection ( isAllowsEmptySelection ( ) ) ; group = g ; } else { group = new CommandGroup ( getGroupId ( ) , ge...
registry has not been provided .
7,120
protected void initCommandGroupMembers ( CommandGroup group ) { for ( int i = 0 ; i < members . length ; i ++ ) { Object o = members [ i ] ; if ( o instanceof AbstractCommand ) { group . addInternal ( ( AbstractCommand ) o ) ; configureIfNecessary ( ( AbstractCommand ) o ) ; } else if ( o instanceof Component ) { group...
Iterates over the collection of encoded members and adds them to the given command group .
7,121
private void addCommandMember ( String commandId , CommandGroup group ) { Assert . notNull ( commandId , "commandId" ) ; Assert . notNull ( group , "group" ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "adding command group member with id [" + commandId + "] to group [" + group . getId ( ) + "]" ) ; } Abstr...
Adds the command object with the given id to the given command group . If a command registry has not yet been provided to this factory the command id will be passed as a lazy placeholder to the group instead .
7,122
public void updateShowViewCommands ( ) { ViewDescriptorRegistry viewDescriptorRegistry = ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . viewDescriptorRegistry ( ) ; ViewDescriptor [ ] views = viewDescriptorRegistry . getViewDescriptors ( ) ; for ( ViewDescriptor view : views ) { String id = view . ge...
This sets the visible flag on all show view commands that are registered with the command manager . If the page contains the view the command is visible otherwise not . The registration of the show view command with the command manager is the responsibility of the view descriptor .
7,123
public void openEditor ( Object editorInput , boolean activateAfterOpen ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Attempting to open editor for " + editorInput . getClass ( ) . getName ( ) ) ; } if ( workspaceComponent == null ) { log . debug ( "WorkspaceComponent is null" ) ; return ; } PageDescriptor descr...
Implementation of the openEditor command using the editor factory injected into the page descriptor . The editor input is used as the key the factory uses to get the requires editor descriptor . If not editor factory is injected into the page descriptor then the default factory is used which simply returns null for eve...
7,124
public void setValue ( Object toEntity , Object newValue ) throws IllegalAccessException , InvocationTargetException { Object propertyValue = getter . invoke ( toEntity ) ; if ( propertyValue != null ) nestedWriter . setValue ( propertyValue , newValue ) ; }
Set the value on the source entity . If at any point the chaining results in a null value . The chaining should end .
7,125
protected JComponent createControl ( ) { PropertyColumnTableDescription desc = new PropertyColumnTableDescription ( "contactViewTable" , Contact . class ) ; desc . addPropertyColumn ( "lastName" ) . withMinWidth ( 150 ) ; desc . addPropertyColumn ( "firstName" ) . withMinWidth ( 150 ) ; desc . addPropertyColumn ( "addr...
Create the control for this view . This method is called by the platform in order to obtain the control to add to the surrounding window and page .
7,126
protected void registerLocalCommandExecutors ( PageComponentContext context ) { context . register ( "newContactCommand" , newContactExecutor ) ; context . register ( GlobalCommandIds . PROPERTIES , propertiesExecutor ) ; getApplicationConfig ( ) . securityControllerManager ( ) . addSecuredObject ( propertiesExecutor )...
Register the local command executors to be associated with named commands . This is called by the platform prior to making the view visible .
7,127
public EditorDescriptor getEditorDescriptor ( Object editorObject ) { Class editorClass = editorObject . getClass ( ) ; EditorDescriptor descriptor = ( EditorDescriptor ) editorMap . get ( editorClass ) ; if ( descriptor == null ) { Iterator it = editorMap . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Clas...
Returns an EditorDescriptor keyed by the class of the injected object . If non exists null is returned .
7,128
protected Object doParseValue ( String formattedString , Class targetClass ) throws ParseException { return dateFormat . parse ( formattedString ) ; }
convert back from string to date
7,129
protected PageComponent createPageComponent ( PageComponentDescriptor descriptor ) { PageComponent pageComponent = descriptor . createPageComponent ( ) ; pageComponent . setContext ( new DefaultViewContext ( this , createPageComponentPane ( pageComponent ) ) ) ; if ( pageComponent instanceof ApplicationListener && getA...
Creates a PageComponent for the given PageComponentDescriptor .
7,130
public boolean processKeyBinding ( KeyStroke ks , KeyEvent e , int condition , boolean pressed ) { if ( ks == KeyStroke . getKeyStroke ( KeyEvent . VK_ENTER , 0 ) || ks == KeyStroke . getKeyStroke ( KeyEvent . VK_ESCAPE , 0 ) ) { return false ; } return super . processKeyBinding ( ks , e , condition , pressed ) ; }
Overiding this method prevents the TextField from intercepting the Enter Key when focus is not on it . This allows default buttons to function . This should be removed when Swing fixes their bug .
7,131
private boolean managesCommand ( Component component , String commandId ) { if ( component instanceof AbstractButton ) { AbstractButton button = ( AbstractButton ) component ; if ( null != button . getActionCommand ( ) ) { if ( button . getActionCommand ( ) . equals ( commandId ) ) { return true ; } } } else if ( compo...
Searches through the component and nested components in order to see if the command with supplied id exists in this component .
7,132
protected void fill ( GroupContainerPopulator containerPopulator , Object controlFactory , CommandButtonConfigurer buttonConfigurer , java . util . List previousButtons ) { Assert . notNull ( containerPopulator , "containerPopulator" ) ; containerPopulator . add ( component ) ; }
Asks the given container populator to add a component to its underlying container .
7,133
protected void update ( ) { putValue ( Action . ACTION_COMMAND_KEY , command . getActionCommand ( ) ) ; CommandFaceDescriptor face = command . getFaceDescriptor ( ) ; if ( face != null ) { face . configure ( this ) ; } setEnabled ( command . isEnabled ( ) ) ; }
Updates this instance according to the properties provided by the underlying command .
7,134
public final void setConstraint ( Constraint constraint ) { Assert . notNull ( constraint ) ; if ( ! constraint . equals ( this . constraint ) ) { if ( this . constraint instanceof Observable ) { ( ( Observable ) constraint ) . deleteObserver ( this ) ; } this . constraint = constraint ; if ( constraint instanceof Obse...
Defines the constraint which is applied to the list model elements
7,135
public static void customizeFocusTraversalOrder ( JComponent container , java . util . List componentsInOrder ) { for ( Iterator i = componentsInOrder . iterator ( ) ; i . hasNext ( ) ; ) { Component comp = ( Component ) i . next ( ) ; if ( comp . getParent ( ) != container ) { throw new IllegalArgumentException ( "Com...
Sets a custom focus traversal order for the given container . Child components for which there is no order specified will receive focus after components that do have an order specified in the standard layout order .
7,136
protected void init ( ) { addPropertyChangeListener ( ENABLED_PROPERTY , new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent evt ) { validatingUpdated ( ) ; } } ) ; validationResultsModel . addPropertyChangeListener ( ValidationResultsModel . HAS_ERRORS_PROPERTY , childStateChangeHandler )...
Initialization of DefaultFormModel . Adds a listener on the Enabled property in order to switch validating state on or off . When disabling a formModel no validation will happen .
7,137
public ValidatingFormModel createChildPageFormModel ( HierarchicalFormModel parentModel , String childPageName , String childFormObjectPropertyPath ) { final ValueModel childValueModel = parentModel . getValueModel ( childFormObjectPropertyPath ) ; return createChildPageFormModel ( parentModel , childPageName , childVa...
Create a child form model nested by this form model identified by the provided name . The form object associated with the created child model is the value model at the specified parent property path .
7,138
public FormModel getChild ( HierarchicalFormModel formModel , String childPageName ) { if ( childPageName == null ) throw new IllegalArgumentException ( "childPageName == null" ) ; if ( formModel == null ) throw new IllegalArgumentException ( "formModel == null" ) ; final FormModel [ ] children = formModel . getChildre...
Returns the child of the formModel with the given page name .
7,139
public static void setFieldProtected ( FormModel formModel , String fieldName , boolean protectedField ) { FieldMetadata metaData = formModel . getFieldMetadata ( fieldName ) ; metaData . getAllUserMetadata ( ) . put ( PROTECTED_FIELD , Boolean . valueOf ( protectedField ) ) ; }
defines the protectable state for a field
7,140
public CompoundConstraint addAll ( List constraints ) { Algorithms . instance ( ) . forEach ( constraints , new Block ( ) { protected void handle ( Object o ) { add ( ( Constraint ) o ) ; } } ) ; return this ; }
Add the list of constraints to the set of constraints aggregated by this compound constraint .
7,141
private void processUncaughtException ( Thread thread , Throwable throwable ) { if ( exceptionPurger != null ) { throwable = exceptionPurger . purge ( throwable ) ; } logException ( thread , throwable ) ; notifyUserAboutException ( thread , throwable ) ; }
Logs an exception and shows it to the user .
7,142
public void logException ( Thread thread , Throwable throwable ) { String logMessage ; String errorCode = extractErrorCode ( throwable ) ; if ( errorCode != null ) { logMessage = "Uncaught throwable handled with errorCode (" + errorCode + ")." ; } else { logMessage = "Uncaught throwable handled." ; } doLogException ( l...
Log an exception
7,143
public void setCommandExecutor ( ActionCommandExecutor commandExecutor ) { if ( ObjectUtils . nullSafeEquals ( this . commandExecutor , commandExecutor ) ) { return ; } if ( commandExecutor == null ) { detachCommandExecutor ( ) ; } else { if ( this . commandExecutor instanceof GuardedActionCommandExecutor ) { unsubscri...
Attaches the given executor to this command instance detaching the current executor in the process .
7,144
public void detachCommandExecutor ( ) { if ( this . commandExecutor instanceof GuardedActionCommandExecutor ) { unsubscribeFromGuardedCommandDelegate ( ) ; } this . commandExecutor = null ; setEnabled ( false ) ; logger . debug ( "Command delegate detached." ) ; }
Detaches the current executor from this command and sets the command to disabled state .
7,145
protected void doExecuteCommand ( ) { if ( this . commandExecutor instanceof ParameterizableActionCommandExecutor ) { ( ( ParameterizableActionCommandExecutor ) this . commandExecutor ) . execute ( getParameters ( ) ) ; } else { if ( this . commandExecutor != null ) { this . commandExecutor . execute ( ) ; } } }
Executes this command by delegating to the currently assigned executor .
7,146
public void validationResultsChanged ( ValidationResults results ) { if ( resultsModel . getMessageCount ( ) == 0 ) { messageReceiver . setMessage ( null ) ; } else { ValidationMessage message = getValidationMessage ( resultsModel ) ; messageReceiver . setMessage ( message ) ; } }
Handle a change in the validation results model . Update the message receiver based on our current results model state .
7,147
protected void doExecuteCommand ( ) { if ( ! ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . applicationSecurityManager ( ) . isSecuritySupported ( ) ) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage ( "loginForm" ) ; final LoginForm loginForm = createLoginForm ( ) ; tabbedPage . ad...
Execute the login command . Display the dialog and attempt authentication .
7,148
public static void installJideRepaintManagerIfNeeded ( ) { final RepaintManager current = RepaintManager . currentManager ( null ) ; if ( current != JideRepaintManager . getInstance ( ) ) { ObjectUtils . shallowCopy ( current , JideRepaintManager . getInstance ( ) ) ; RepaintManager . setCurrentManager ( JideRepaintMan...
Installs this repaint manager if not already set .
7,149
public void addUserInputListener ( UserInputListener listener ) { if ( this . listeners == null ) this . listeners = new ArrayList ( ) ; this . listeners . add ( listener ) ; }
Add a UserInputListener .
7,150
private void fireUserInputChange ( ) { if ( ! internallySettingText && ( this . listeners != null ) ) { for ( Iterator it = this . listeners . iterator ( ) ; it . hasNext ( ) ; ) { UserInputListener userInputListener = ( UserInputListener ) it . next ( ) ; userInputListener . update ( this ) ; } } }
Fire an event to all UserInputListeners .
7,151
public Number getValue ( ) { if ( ( getText ( ) == null ) || "" . equals ( getText ( ) . trim ( ) ) ) return null ; try { Number n = format . parse ( getText ( ) ) ; if ( n . getClass ( ) == this . numberClass ) return n ; else if ( this . numberClass == BigDecimal . class ) { BigDecimal bd = new BigDecimal ( n . doubl...
Parses a number from the inputField and will adjust it s class if needed .
7,152
public void setValue ( Number number ) { String txt = null ; if ( number != null ) { txt = this . format . format ( number ) ; } setText ( txt ) ; }
Format the number and show it .
7,153
public TableLayoutBuilder row ( ) { ++ currentRow ; lastCC = null ; maxColumns = Math . max ( maxColumns , currentCol ) ; currentCol = 0 ; return this ; }
Inserts a new row . No gap row is inserted before this row .
7,154
public TableLayoutBuilder row ( RowSpec gapRowSpec ) { row ( ) ; gapRows . put ( new Integer ( currentRow ) , gapRowSpec ) ; return this ; }
Inserts a new row . A gap row with specified RowSpec will be inserted before this row .
7,155
public TableLayoutBuilder separator ( String labelKey , String attributes ) { Cell cc = cellInternal ( getComponentFactory ( ) . createLabeledSeparator ( labelKey ) , attributes ) ; lastCC = cc ; items . add ( cc ) ; return this ; }
Inserts a separator with the given label . Attributes my be zero or more of rowSpec columnSpec colGrId rowGrId align and valign .
7,156
public void setFocusTraversalOrder ( int traversalOrder ) { Assert . isTrue ( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER || traversalOrder == ROW_MAJOR_FOCUS_ORDER , "traversalOrder must be one of COLUMN_MAJOR_FOCUS_ORDER or ROW_MAJOR_FOCUS_ORDER" ) ; List focusOrder = new ArrayList ( items . size ( ) ) ; if ( traversa...
Set the focus traversal order .
7,157
public void documentComponentClosed ( DocumentComponentEvent event ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Page component " + pageComponent . getId ( ) + " closed" ) ; } workspace . remove ( pageComponent ) ; ( ( JideApplicationPage ) workspace . getContext ( ) . getPage ( ) ) . fireClosed ( pageComp...
Default closed implementation removes the given page component from the workspace view and so the document from the document pane .
7,158
protected String getTitle ( ) { if ( ! StringUtils . hasText ( this . title ) ) { if ( StringUtils . hasText ( getCallingCommandText ( ) ) ) return getCallingCommandText ( ) ; return DEFAULT_DIALOG_TITLE ; } return this . title ; }
Returns the title of this dialog . If no specific title has been set the calling command s text will be used . If that doesn t yield a result the default title is returned .
7,159
private void constructDialog ( ) { if ( getParentWindow ( ) instanceof Frame ) { dialog = new JDialog ( ( Frame ) getParentWindow ( ) , getTitle ( ) , modal ) ; } else { dialog = new JDialog ( ( Dialog ) getParentWindow ( ) , getTitle ( ) , modal ) ; } dialog . getContentPane ( ) . setLayout ( new BorderLayout ( ) ) ; ...
Construct the visual dialog frame on which the content needs to be added .
7,160
protected String getFinishSuccessMessage ( ) { ActionCommand callingCommand = getCallingCommand ( ) ; if ( callingCommand != null ) { String [ ] successMessageKeys = new String [ ] { callingCommand . getId ( ) + "." + SUCCESS_FINISH_MESSAGE_KEY , DEFAULT_FINISH_SUCCESS_MESSAGE_KEY } ; return getApplicationConfig ( ) . ...
Returns the message to use upon succesful finish .
7,161
protected String getFinishSuccessTitle ( ) { ActionCommand callingCommand = getCallingCommand ( ) ; if ( callingCommand != null ) { String [ ] successTitleKeys = new String [ ] { callingCommand . getId ( ) + "." + SUCCESS_FINISH_TITLE_KEY , DEFAULT_FINISH_SUCCESS_TITLE_KEY } ; return getApplicationConfig ( ) . messageR...
Returns the title to use upon succesful finish .
7,162
private void addCancelByEscapeKey ( ) { int noModifiers = 0 ; KeyStroke escapeKey = KeyStroke . getKeyStroke ( KeyEvent . VK_ESCAPE , noModifiers , false ) ; addActionKeyBinding ( escapeKey , cancelCommand . getId ( ) ) ; }
Force the escape key to call the same action as pressing the Cancel button . This does not always work . See class comment .
7,163
protected void addDialogComponents ( ) { JComponent dialogContentPane = createDialogContentPane ( ) ; GuiStandardUtils . attachDialogBorder ( dialogContentPane ) ; if ( getPreferredSize ( ) != null ) { dialogContentPane . setPreferredSize ( getPreferredSize ( ) ) ; } getDialogContentPane ( ) . add ( dialogContentPane )...
Subclasses may override to customize how this dialog is built .
7,164
protected JComponent createButtonBar ( ) { this . dialogCommandGroup = getCommandManager ( ) . createCommandGroup ( null , getCommandGroupMembers ( ) ) ; JComponent buttonBar = this . dialogCommandGroup . createButtonBar ( ) ; GuiStandardUtils . attachDialogBorder ( buttonBar ) ; return buttonBar ; }
Return a standardized row of command buttons right - justified and all of the same size with OK as the default button and no mnemonics used as per the Java Look and Feel guidelines .
7,165
protected java . util . List < ? extends AbstractCommand > getCommandGroupMembers ( ) { return Lists . < AbstractCommand > newArrayList ( getFinishCommand ( ) , getCancelCommand ( ) ) ; }
Template getter method to return the commands to populate the dialog button bar .
7,166
protected void fill ( GroupContainerPopulator containerPopulator , Object controlFactory , CommandButtonConfigurer configurer , List previousButtons ) { Assert . notNull ( containerPopulator , "containerPopulator" ) ; Assert . notNull ( controlFactory , "controlFactory" ) ; Assert . notNull ( configurer , "configurer" ...
Adds each member of this expansion point to a GUI container using the given container populator . Leading and trailing separators will also be added as determined by the appropriate flags set on this instance .
7,167
public GroupMember getMemberFor ( String commandId ) { for ( Iterator it = members . iterator ( ) ; it . hasNext ( ) ; ) { GroupMember member = ( GroupMember ) it . next ( ) ; if ( member . managesCommand ( commandId ) ) { return member ; } } return null ; }
Returns the group member that manages the command with the given id or null if none of the members in this expansion point manage a command with that id .
7,168
protected ConversionExecutor getPropertyConversionExecutor ( ) { if ( conversionExecutor == null ) { conversionExecutor = getConversionService ( ) . getConversionExecutor ( Object [ ] . class , getPropertyType ( ) ) ; } return conversionExecutor ; }
Returns a conversion executor which converts a value of the given sourceType into the fieldType
7,169
protected void updateSelectedItemsFromValueModel ( ) { Object value = getValue ( ) ; Object [ ] selectedValues = EMPTY_VALUES ; if ( value != null ) { selectedValues = ( Object [ ] ) convertValue ( value , Object [ ] . class ) ; } selectingValues = true ; try { ListSelectionModel selectionModel = getList ( ) . getSelec...
Updates the selection model with the selected values from the value model .
7,170
public final void setSelected ( boolean selected ) { if ( isExclusiveGroupMember ( ) ) { boolean oldState = isSelected ( ) ; exclusiveController . handleSelectionRequest ( this , selected ) ; if ( oldState == isSelected ( ) ) { Iterator iter = buttonIterator ( ) ; while ( iter . hasNext ( ) ) { AbstractButton button = ...
Set the selection state of the command .
7,171
protected boolean requestSetSelection ( boolean selected ) { boolean previousState = isSelected ( ) ; if ( previousState != selected ) { this . selected = onSelection ( selected ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Toggle command selection returned '" + this . selected + "'" ) ; } } Iterator it = ...
Handles the switching of the selected state . All attached buttons are updated .
7,172
protected void addPage ( String wizardConfigurationKey , WizardPage page ) { pages . add ( page ) ; page . setWizard ( this ) ; if ( autoConfigureChildPages ) { String key = ( ( wizardConfigurationKey != null ) ? wizardConfigurationKey + "." : "" ) + page . getId ( ) ; ValkyrieRepository . getInstance ( ) . getApplicat...
Adds a new page to this wizard . The page is inserted at the end of the page list .
7,173
public boolean canFinish ( ) { for ( int i = 0 ; i < pages . size ( ) ; i ++ ) { if ( ! ( ( WizardPage ) pages . get ( i ) ) . isPageComplete ( ) ) return false ; } return true ; }
Returns true if all the pages of this wizard have been completed .
7,174
protected final Binding doBind ( JComponent control , FormModel formModel , String formPropertyPath , Map context ) { AbstractListBinding binding = createListBinding ( control , formModel , formPropertyPath ) ; Assert . notNull ( binding ) ; applyContext ( binding , context ) ; return binding ; }
Creates the binding and applies any context values
7,175
protected void applyContext ( AbstractListBinding binding , Map context ) { if ( context . containsKey ( SELECTABLE_ITEMS_KEY ) ) { binding . setSelectableItems ( decorate ( context . get ( SELECTABLE_ITEMS_KEY ) , selectableItems ) ) ; } else if ( selectableItems != null ) { binding . setSelectableItems ( selectableIt...
Applies any context or preset value .
7,176
protected JComponent createControl ( ) { JTextPane textPane = new JTextPane ( ) ; JScrollPane spDescription = getApplicationConfig ( ) . componentFactory ( ) . createScrollPane ( textPane ) ; try { textPane . setPage ( getDescriptionTextPath ( ) . getURL ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( ...
Create the actual UI control for this view . It will be placed into the window according to the layout of the page holding this view .
7,177
private static String escapeXml ( String input ) { return input == null ? "" : input . replace ( "&" , "&amp;" ) . replace ( "<" , "&lt;" ) . replace ( ">" , "&gt;" ) ; }
Converts the incoming string to an escaped output string . This method is far from perfect only escaping &lt ; &gt ; and &amp ; characters
7,178
public int compareTo ( Object o ) { ViewDescriptor castObj = ( ViewDescriptor ) o ; return this . getDisplayName ( ) . compareToIgnoreCase ( castObj . getDisplayName ( ) ) ; }
Compares the display names of the view descriptors
7,179
public static void runInEventDispatcherThread ( Runnable runnable , Boolean wait ) { Assert . notNull ( runnable , "runnable" ) ; Assert . notNull ( wait , "wait" ) ; if ( EventQueue . isDispatchThread ( ) ) { runnable . run ( ) ; } else if ( wait ) { try { EventQueue . invokeAndWait ( runnable ) ; } catch ( Interrupte...
Ensures the given runnable is executed into the event dispatcher thread .
7,180
public static Component getDescendantNamed ( String name , Component parent ) { Assert . notNull ( name , "name" ) ; Assert . notNull ( parent , "parent" ) ; if ( name . equals ( parent . getName ( ) ) ) { return parent ; } else if ( parent instanceof Container ) { for ( final Component component : ( ( Container ) pare...
Does a pre - order search of a component with a given name .
7,181
public static JComponent generateComponent ( Image image ) { if ( image == null ) { return new LabelUIResource ( "Image is null" ) ; } return SwingUtils . generateComponent ( new ImageIcon ( image ) ) ; }
Generates a component to view an image .
7,182
protected FocusListener createFocusListener ( ) { return new FocusAdapter ( ) { public void focusLost ( FocusEvent e ) { String textFieldValue = getKeyComponentText ( ) ; boolean empty = "" . equals ( textFieldValue . trim ( ) ) ; Object ref = LookupBinding . this . getValue ( ) ; if ( evaluateFocusLost ( e ) ) { if ( ...
Create a focus listener to attach to the textComponent and dataEditorButton that will decide what happens with the changed value . Here a revert can be done if no value is selected or a new value can be created as needed .
7,183
protected Object initializeDataEditor ( ) { final String textFieldValue = getKeyComponentText ( ) ; Object ref = super . getValue ( ) ; if ( ( ref != null ) && textFieldValue . equals ( getObjectLabel ( ref ) ) ) return getDataEditor ( ) . setSelectedSearch ( ref ) ; return getDataEditor ( ) . setSelectedSearch ( creat...
Initialize the dataEditor by passing the search referable as search parameter .
7,184
protected ActionCommand createDataEditorCommand ( ) { ActionCommand selectDialogCommand = new ActionCommand ( getSelectDialogCommandId ( ) ) { private ApplicationDialog dataEditorDialog ; protected void doExecuteCommand ( ) { if ( LookupBinding . this . propertyChangeMonitor . proceedOnChange ( ) ) { if ( dataEditorDia...
Create the dataEditorCommand .
7,185
protected String getMessage ( String contextId , String fieldPath , String [ ] faceDescriptorProperties , String defaultValue ) { String [ ] keys = getMessageKeys ( contextId , fieldPath , faceDescriptorProperties ) ; try { return getMessageSourceAccessor ( ) . getMessage ( new DefaultMessageSourceResolvable ( keys , n...
Returns the value of the required property of the FieldFace . Delegates to the getMessageKeys for the message key generation strategy .
7,186
public void postProcessBeanFactory ( final ConfigurableListableBeanFactory beanFactory ) throws BeansException { if ( beanFactory == null ) { return ; } String [ ] beanNames = beanFactory . getBeanDefinitionNames ( ) ; int singletonBeanCount = 0 ; for ( int i = 0 ; i < beanNames . length ; i ++ ) { BeanDefinition beanD...
Notifies this instance s associated progress monitor of progress made while processing the given bean factory .
7,187
public void setSearchString ( String queryString ) { this . searchString = queryString ; if ( this . textFilterField != null ) { this . textFilterField . setText ( this . searchString ) ; } }
Set the local text filter field value
7,188
protected ActionCommand createUpdateCommand ( ) { ActionCommand command = new ActionCommand ( UPDATE_COMMAND_ID ) { protected void doExecuteCommand ( ) { doUpdate ( ) ; } } ; command . setSecurityControllerId ( getId ( ) + "." + UPDATE_COMMAND_ID ) ; getApplicationConfig ( ) . commandConfigurer ( ) . configure ( comman...
Creates the save command .
7,189
protected ActionCommand createCreateCommand ( ) { ActionCommand command = new ActionCommand ( CREATE_COMMAND_ID ) { protected void doExecuteCommand ( ) { doCreate ( ) ; } } ; command . setSecurityControllerId ( getId ( ) + "." + CREATE_COMMAND_ID ) ; getApplicationConfig ( ) . commandConfigurer ( ) . configure ( comman...
Creates the create command .
7,190
protected CommandGroup getTablePopupMenuCommandGroup ( ) { return getApplicationConfig ( ) . commandManager ( ) . createCommandGroup ( Lists . newArrayList ( getEditRowCommand ( ) , "separator" , getAddRowCommand ( ) , getCloneRowCommand ( ) , getRemoveRowsCommand ( ) , "separator" , getRefreshCommand ( ) , "separator"...
Returns the commandGroup that should be used to create the popup menu for the table .
7,191
public void fireFocusGainedOnActiveComponent ( ) { String documentName = contentPane . getActiveDocumentName ( ) ; if ( documentName != null ) { PageComponent component = ( PageComponent ) pageComponentMap . get ( documentName ) ; JideApplicationPage page = ( JideApplicationPage ) getActiveWindow ( ) . getPage ( ) ; pa...
This is a bit of a hack to get over a limitation in the JIDE docking framework . When focus is regained to the workspace by activation the currently activated document the documentComponentActivated is not fired . This needs to be fired when we know the workspace has become active . For some reason it dosen t work when...
7,192
public void addDocumentComponent ( final PageComponent pageComponent , boolean activateAfterOpen ) { String id = pageComponent . getId ( ) ; if ( ! closeAndReopenEditor && contentPane . getDocument ( id ) != null ) { contentPane . setActiveDocument ( id ) ; } else { if ( contentPane . getDocument ( id ) != null ) { con...
Adds a document to the editor workspace . The behaviour when an editor is already open with editor identity defined by id property is determined by the closeAndReopenEditor property . If this property is true the default the editor is closed and reopened . If false the existing editor becomes the active one .
7,193
public void propertyChange ( PropertyChangeEvent evt ) { int [ ] selected = ( int [ ] ) selectionHolder . getValue ( ) ; guarded . setEnabled ( shouldEnable ( selected ) ) ; }
Handle a change in the selectionHolder value .
7,194
public void activateView ( ) { if ( SwingUtilities . isEventDispatchThread ( ) ) { ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . windowManager ( ) . getActiveWindow ( ) . getPage ( ) . showView ( getId ( ) ) ; } else { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { ValkyrieR...
Activates this view taking care of EDT issues
7,195
private void loadIfNecessary ( ) { if ( loadedMember != null ) { return ; } CommandRegistry commandRegistry = parentGroup . getCommandRegistry ( ) ; Assert . isTrue ( parentGroup . getCommandRegistry ( ) != null , "Command registry must be set for group '" + parentGroup . getId ( ) + "' in order to load lazy command '"...
Attempts to load the lazy command from the command registry of the parent command group but only if it hasn t already been loaded .
7,196
protected String getMessage ( String key , Object [ ] params ) { MessageSource messageSource = ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . messageSource ( ) ; return messageSource . getMessage ( key , params , Locale . getDefault ( ) ) ; }
Method to obtain a message from the message source defined via the services locator at the default locale .
7,197
public void dispose ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Disposing of editor " + getId ( ) ) ; } context . register ( GlobalCommandIds . SAVE , null ) ; context . register ( GlobalCommandIds . SAVE_AS , null ) ; concreteDispose ( ) ; }
This method is called when an editor is removed from the workspace .
7,198
public void setButtonLabelInfo ( String encodedLabelInfo ) { CommandButtonLabelInfo newLabelInfo = CommandButtonLabelInfo . valueOf ( encodedLabelInfo ) ; setLabelInfo ( newLabelInfo ) ; }
Sets the label information for the command using the given encoded label descriptor .
7,199
public void setIcon ( Icon icon ) { Icon old = null ; if ( iconInfo == CommandButtonIconInfo . BLANK_ICON_INFO ) { if ( icon != null ) { setIconInfo ( new CommandButtonIconInfo ( icon ) ) ; } } else { old = iconInfo . getIcon ( ) ; this . iconInfo . setIcon ( icon ) ; } firePropertyChange ( ICON_PROPERTY , old , icon )...
Set the main default icon to be associated with the command .