idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,500
public int getTabIndex ( final WComponent content ) { List < WTab > tabs = getTabs ( ) ; final int count = tabs . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { WTab tab = tabs . get ( i ) ; if ( content == tab . getContent ( ) ) { return i ; } } return - 1 ; }
Retrieves the tab index for the given tab content .
18,501
private int clientIndexToTabIndex ( final int clientIndex ) { int childCount = getTotalTabs ( ) ; int serverIndex = clientIndex ; for ( int i = 0 ; i <= serverIndex && i < childCount ; i ++ ) { if ( ! isTabVisible ( i ) ) { serverIndex ++ ; } } return serverIndex ; }
The client - side tab indices will differ from the WTabSet s indices when one or more tabs are invisible .
18,502
public String getGroupName ( ) { if ( TabSetType . ACCORDION . equals ( getType ( ) ) ) { CollapsibleGroup group = getComponentModel ( ) . group ; return ( group == null ? null : group . getGroupName ( ) ) ; } return null ; }
The collapsible group name that this tabset belongs to .
18,503
private WMenu buildColumnMenu ( final WText selectedMenuText ) { WMenu menu = new WMenu ( WMenu . MenuType . COLUMN ) ; menu . setSelectMode ( SelectMode . SINGLE ) ; menu . setRows ( 8 ) ; StringTreeNode root = getOrgHierarchyTree ( ) ; mapColumnHierarchy ( menu , root , selectedMenuText ) ; getSubMenuByText ( "Austra...
Builds up a column menu for inclusion in the example .
18,504
private StringTreeNode getOrgHierarchyTree ( ) { Object [ ] data = new Object [ ] { "Australia" , new Object [ ] { "ACT" } , new Object [ ] { "NSW" , new Object [ ] { "Paramatta" } , new Object [ ] { "Sydney" , new Object [ ] { "Branch 1" , new Object [ ] { "Processing Team 1" } , new Object [ ] { "Processing Team 2" ,...
Builds an organisation hierarchy tree for the column menu example .
18,505
private StringTreeNode buildOrgHierarchyTree ( final Object [ ] data ) { StringTreeNode childNode = new StringTreeNode ( ( String ) data [ 0 ] ) ; if ( data . length > 1 ) { for ( int i = 1 ; i < data . length ; i ++ ) { childNode . add ( buildOrgHierarchyTree ( ( Object [ ] ) data [ i ] ) ) ; } } return childNode ; }
Builds one level of the org hierarchy tree .
18,506
private WSubMenu getSubMenuByText ( final String text , final WComponent node ) { if ( node instanceof WSubMenu ) { WSubMenu subMenu = ( WSubMenu ) node ; if ( text . equals ( subMenu . getText ( ) ) ) { return subMenu ; } for ( MenuItem item : subMenu . getMenuItems ( ) ) { WSubMenu result = getSubMenuByText ( text , ...
Retrieves a sub menu by its text .
18,507
public static Size intToSize ( final int convert ) { if ( convert <= 0 ) { return null ; } if ( convert <= MAX_SMALL ) { return Size . SMALL ; } if ( convert <= MAX_MED ) { return Size . MEDIUM ; } if ( convert <= MAX_LARGE ) { return Size . LARGE ; } return Size . XL ; }
Convert an int space to a Size . For backwards compatibility during conversion of int spaces to Size spaces .
18,508
public static int sizeToInt ( final Size size ) { if ( size == null ) { return - 1 ; } switch ( size ) { case ZERO : return 0 ; case SMALL : return MAX_SMALL ; case MEDIUM : return MAX_MED ; case LARGE : return MAX_LARGE ; default : return COMMON_XL ; } }
Convert a size back to a representative int . For testing only during conversion of int spaces to Size spaces .
18,509
public void removeTag ( Reference reference , String tag ) { getResourceFactory ( ) . getApiResource ( "/tag/" + reference . toURLFragment ( ) ) . queryParam ( "text" , tag ) . delete ( ) ; }
Removes a single tag from an object .
18,510
public List < TagReference > getTagsOnAppWithText ( int appId , String text ) { return getResourceFactory ( ) . getApiResource ( "/tag/app/" + appId + "/search/" ) . queryParam ( "text" , text ) . get ( new GenericType < List < TagReference > > ( ) { } ) ; }
Returns the objects that are tagged with the given text on the app . The objects are returned sorted descending by the time the tag was added .
18,511
public List < TagReference > getTagsOnOrgWithText ( int orgId , String text ) { return getResourceFactory ( ) . getApiResource ( "/tag/org/" + orgId + "/search/" ) . queryParam ( "text" , text ) . get ( new GenericType < List < TagReference > > ( ) { } ) ; }
Returns the objects that are tagged with the given text on the org . The objects are returned sorted descending by the time the tag was added .
18,512
public List < TagReference > getTagsOnSpaceWithText ( int spaceId , String text ) { return getResourceFactory ( ) . getApiResource ( "/tag/space/" + spaceId + "/search/" ) . queryParam ( "text" , text ) . get ( new GenericType < List < TagReference > > ( ) { } ) ; }
Returns the objects that are tagged with the given text on the space . The objects are returned sorted descending by the time the tag was added .
18,513
public void addTab ( final WComponent card , final String name ) { WContainer titledCard = new WContainer ( ) ; WText title = new WText ( "<b>[" + name + "]:</b><br/>" ) ; title . setEncodeText ( false ) ; titledCard . add ( title ) ; titledCard . add ( card ) ; deck . add ( titledCard ) ; final TabButton button = new ...
Adds a tab .
18,514
public static void main ( final String [ ] args ) throws Exception { System . setProperty ( "org.apache.commons.logging.Log" , "com.github.bordertech.wcomponents.lde.StandaloneLauncher$TextAreaLogger" ) ; Configuration internalWComponentConfig = Config . getInstance ( ) ; CompositeConfiguration config = new CompositeCo...
The entry point when the launcher is run as a java application .
18,515
private void readFields ( ) { plain . setText ( tf1 . getText ( ) ) ; mandatory . setText ( tf2 . getText ( ) ) ; readOnly . setText ( tf3 . getText ( ) ) ; disabled . setText ( tf4 . getText ( ) ) ; width . setText ( tf5 . getText ( ) ) ; }
Read fields is a simple method to read all the fields and populate the encoded text fields .
18,516
public void setSource ( final String sourceText ) { String formattedSource ; if ( sourceText == null ) { formattedSource = "" ; } else { formattedSource = WebUtilities . encode ( sourceText ) ; } source . setText ( formattedSource ) ; }
Sets the source code to be displayed in the panel .
18,517
public static void main ( final String [ ] args ) throws Exception { Server server = new Server ( ) ; SocketConnector connector = new SocketConnector ( ) ; connector . setMaxIdleTime ( 0 ) ; connector . setPort ( 8080 ) ; server . addConnector ( connector ) ; WebAppContext context = new WebAppContext ( ) ; context . se...
This main method exists to make it easy to run this servlet without having to create a web . xml file build a war and deploy it .
18,518
public boolean isDisabled ( ) { if ( isFlagSet ( ComponentModel . DISABLED_FLAG ) ) { return true ; } MenuContainer container = WebUtilities . getAncestorOfClass ( MenuContainer . class , this ) ; if ( container instanceof Disableable && ( ( Disableable ) container ) . isDisabled ( ) ) { return true ; } return false ; ...
Indicates whether this sub menu is disabled in the given context .
18,519
public void handleRequest ( final Request request ) { if ( isDisabled ( ) ) { return ; } if ( isMenuPresent ( request ) ) { if ( AjaxHelper . isCurrentAjaxTrigger ( this ) ) { WMenu menu = WebUtilities . getAncestorOfClass ( WMenu . class , this ) ; menu . handleRequest ( request ) ; final Action action = getAction ( )...
Override handleRequest in order to perform processing for this component . This implementation checks for submenu selection and executes the associated action if it has been set .
18,520
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; String targetId = getContent ( ) . getId ( ) ; String contentId = getId ( ) + "-content" ; switch ( getComponentModel ( ) . mode ) { case LAZY : { getContent ( ) . setVisible ( isOpen ( ) ) ; AjaxHelper . regist...
Override preparePaintComponent in order to correct the visibility of the sub - menu s children before they are rendered .
18,521
public String getValueAsString ( ) { String result = null ; String [ ] inputs = getValue ( ) ; if ( inputs != null && inputs . length > 0 ) { StringBuffer stringValues = new StringBuffer ( ) ; for ( int i = 0 ; i < inputs . length ; i ++ ) { if ( i > 0 ) { stringValues . append ( ", " ) ; } stringValues . append ( inpu...
The string is a comma seperated list of the string inputs .
18,522
public void serviceRequest ( final Request request ) { windowId = request . getParameter ( WWindow . WWINDOW_REQUEST_PARAM_KEY ) ; if ( windowId == null ) { super . serviceRequest ( request ) ; } else { ComponentWithContext target = WebUtilities . getComponentById ( windowId , true ) ; if ( target == null ) { throw new...
Temporarily replaces the environment while the request is being handled .
18,523
public void preparePaint ( final Request request ) { if ( windowId == null ) { super . preparePaint ( request ) ; } else { ComponentWithContext target = WebUtilities . getComponentById ( windowId , true ) ; if ( target == null ) { throw new SystemException ( "No window component for id " + windowId ) ; } UIContext uic ...
Temporarily replaces the environment while the UI prepares to render .
18,524
public void paint ( final RenderContext renderContext ) { if ( windowId == null ) { super . paint ( renderContext ) ; } else { ComponentWithContext target = WebUtilities . getComponentById ( windowId , true ) ; if ( target == null ) { throw new SystemException ( "No window component for id " + windowId ) ; } UIContext ...
Temporarily replaces the environment while the UI is being rendered .
18,525
private void paintPaginationDetails ( final WTable table , final XmlStringBuilder xml ) { TableModel model = table . getTableModel ( ) ; xml . appendTagOpen ( "ui:pagination" ) ; xml . appendAttribute ( "rows" , model . getRowCount ( ) ) ; xml . appendOptionalAttribute ( "rowsPerPage" , table . getRowsPerPage ( ) > 0 ,...
Paint the pagination aspects of the table .
18,526
private void paintSortDetails ( final WTable table , final XmlStringBuilder xml ) { int col = table . getSortColumnIndex ( ) ; boolean ascending = table . isSortAscending ( ) ; xml . appendTagOpen ( "ui:sort" ) ; if ( col >= 0 ) { int [ ] cols = table . getColumnOrder ( ) ; if ( cols != null ) { for ( int i = 0 ; i < c...
Paints the sort details .
18,527
private void paintTableActions ( final WTable table , final WebXmlRenderContext renderContext ) { XmlStringBuilder xml = renderContext . getWriter ( ) ; List < WButton > tableActions = table . getActions ( ) ; if ( ! tableActions . isEmpty ( ) ) { boolean hasActions = false ; for ( WButton button : tableActions ) { if ...
Paints the table actions of the table .
18,528
private void paintColumnHeading ( final WTableColumn col , final boolean sortable , final WebXmlRenderContext renderContext ) { XmlStringBuilder xml = renderContext . getWriter ( ) ; int width = col . getWidth ( ) ; Alignment align = col . getAlign ( ) ; xml . appendTagOpen ( "ui:th" ) ; xml . appendOptionalAttribute (...
Paints a single column heading .
18,529
public void updateUI ( ) { if ( ! Util . empty ( panelContent . getText ( ) ) ) { panelContentRO . setData ( panelContent . getData ( ) ) ; } else { panelContentRO . setText ( SAMPLE_CONTENT ) ; } panel . setType ( ( WPanel . Type ) panelType . getSelected ( ) ) ; String headingText = tfHeading . getText ( ) ; if ( ! U...
Set up the WPanel so that the appropriate items are visible based on configuration settings .
18,530
private void buildUI ( ) { buildTargetPanel ( ) ; buildConfigOptions ( ) ; add ( new WHorizontalRule ( ) ) ; add ( panel ) ; add ( new WHorizontalRule ( ) ) ; WPanel hiddenPanel = new WPanel ( ) { public boolean isHidden ( ) { return true ; } } ; hiddenPanel . add ( selectedMenuText ) ; add ( hiddenPanel ) ; add ( new ...
Add the components in the required order .
18,531
private void buildConfigOptions ( ) { WFieldLayout layout = new WFieldLayout ( WFieldLayout . LAYOUT_STACKED ) ; layout . setMargin ( new Margin ( null , null , Size . LARGE , null ) ) ; layout . addField ( "Select a WPanel Type" , panelType ) ; contentField = layout . addField ( "Panel content" , panelContent ) ; head...
Set up the UI for the configuration options .
18,532
private void buildTargetPanel ( ) { setUpUtilBar ( ) ; panel . add ( utilBar ) ; panel . add ( heading ) ; panel . add ( panelContentRO ) ; panel . add ( menu ) ; }
Set up the target panel contents .
18,533
private void setUpUtilBar ( ) { utilBar . setLayout ( new ListLayout ( ListLayout . Type . FLAT , ListLayout . Alignment . RIGHT , ListLayout . Separator . NONE , false ) ) ; WTextField selectOther = new WTextField ( ) ; selectOther . setToolTip ( "Enter text." ) ; utilBar . add ( selectOther ) ; utilBar . add ( new WB...
Add some UI to a utility bar type structure .
18,534
public void serviceRequest ( final Request request ) { String triggerId = request . getParameter ( WServlet . AJAX_TRIGGER_PARAM_NAME ) ; if ( triggerId == null ) { throw new SystemException ( "No AJAX trigger id to on request" ) ; } ComponentWithContext trigger = WebUtilities . getComponentById ( triggerId , true ) ; ...
Setup the AJAX operation details .
18,535
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WDecoratedLabel label = ( WDecoratedLabel ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WComponent head = label . getHead ( ) ; WComponent body = label . getBody ( ) ; WComponent tail = label . getTail...
Paints the given WDecoratedLabel .
18,536
public List < Comment > getComments ( Reference reference ) { return getResourceFactory ( ) . getApiResource ( "/comment/" + reference . getType ( ) + "/" + reference . getId ( ) ) . get ( new GenericType < List < Comment > > ( ) { } ) ; }
Used to retrieve all the comments that have been made on an object of the given type and with the given id . It returns a list of all the comments sorted in ascending order by time created .
18,537
public int addComment ( Reference reference , CommentCreate comment , boolean silent , boolean hook ) { return getResourceFactory ( ) . getApiResource ( "/comment/" + reference . getType ( ) + "/" + reference . getId ( ) ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entit...
Adds a new comment to the object of the given type and id f . ex . item 1 .
18,538
public void updateComment ( int commentId , CommentUpdate comment ) { getResourceFactory ( ) . getApiResource ( "/comment/" + commentId ) . entity ( comment , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates an already created comment . This should only be used to correct spelling and grammatical mistakes in the comment .
18,539
public void render ( final WComponent component , final RenderContext context ) { PrintWriter out = ( ( WebXmlRenderContext ) context ) . getWriter ( ) ; boolean debugLayout = ConfigurationProperties . getDeveloperVelocityDebug ( ) ; if ( debugLayout ) { String templateUrl = url ; if ( url == null && component instance...
Paints the component in HTML using the Velocity Template .
18,540
public void paintXml ( final WComponent component , final Writer writer ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "paintXml called for component class " + component . getClass ( ) ) ; } String templateText = null ; if ( component instanceof AbstractWComponent ) { AbstractWComponent abstractComp = ( ( Abstract...
Paints the component in XML using the Velocity Template .
18,541
private void fillContext ( final WComponent component , final VelocityContext context , final Map < String , WComponent > componentsByKey ) { context . put ( "this" , component ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; context . put ( "uicontext" , uic ) ; context . put ( "uic" , uic ) ; if ( component ins...
Fills the given velocity context with data from the component which is being rendered . A map of components is also built up in order to support deferred rendering .
18,542
protected void noTemplatePaintHtml ( final WComponent component , final Writer writer ) { try { writer . write ( "<!-- Start " + url + " not found ) ; new VelocityRenderer ( NO_TEMPLATE_LAYOUT ) . paintXml ( component , writer ) ; writer . write ( "<!-- End " + url + " (template not found) ) ; } catch ( IOException e...
Paints the component in HTML using the NoTemplateLayout .
18,543
private Template getTemplate ( final WComponent component ) { String templateUrl = url ; if ( templateUrl == null && component instanceof AbstractWComponent ) { templateUrl = ( ( AbstractWComponent ) component ) . getTemplate ( ) ; } if ( templateUrl != null ) { try { return VelocityEngineFactory . getVelocityEngine ( ...
Retrieves the Velocity template for the given component .
18,544
public List < StreamObject > getGlobalStream ( Integer limit , Integer offset , DateTime dateFrom , DateTime dateTo ) { return getStream ( "/stream/" , limit , offset , dateFrom , dateTo ) ; }
Returns the global stream . This includes items and statuses with comments ratings files and edits .
18,545
public List < StreamObjectV2 > getGlobalStreamV2 ( Integer limit , Integer offset , DateTime dateFrom , DateTime dateTo ) { return getStreamV2 ( "/stream/v2/" , limit , offset , dateFrom , dateTo ) ; }
Returns the global stream . The types of objects in the stream can be either item status or task .
18,546
public List < StreamObjectV2 > getAppStream ( int appId , Integer limit , Integer offset ) { return getStreamV2 ( "/stream/app/" + appId + "/" , limit , offset , null , null ) ; }
Returns the stream for the app . Is identical to the global stream but only returns objects in the app .
18,547
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { setInitialised ( true ) ; setupVideo ( ) ; } }
Set up the initial state of the video component .
18,548
private void setupVideo ( ) { video . setAutoplay ( cbAutoPlay . isSelected ( ) ) ; video . setLoop ( cbLoop . isSelected ( ) ) ; video . setMuted ( ! cbMute . isDisabled ( ) && cbMute . isSelected ( ) ) ; video . setControls ( cbControls . isSelected ( ) ? WVideo . Controls . PLAY_PAUSE : WVideo . Controls . NATIVE ) ...
Set the video configuration options .
18,549
public List < String > getHeadLines ( final String type ) { ArrayList < String > lines = headers . get ( type ) ; return lines == null ? null : Collections . unmodifiableList ( lines ) ; }
Gets the head lines of a specified type .
18,550
public void append ( final Object text ) { if ( text instanceof Message ) { append ( translate ( text ) , true ) ; } else if ( text != null ) { append ( text . toString ( ) , true ) ; } }
Appends the given text to this XmlStringBuilder . XML values are escaped .
18,551
public void append ( final String string , final boolean encode ) { if ( encode ) { appendOptional ( WebUtilities . encode ( string ) ) ; } else { write ( HtmlToXMLUtil . unescapeToXML ( string ) ) ; } }
Appends the string to this XmlStringBuilder . XML values are not escaped .
18,552
private String translate ( final Object messageObject ) { if ( messageObject instanceof Message ) { Message message = ( Message ) messageObject ; return I18nUtilities . format ( locale , message . getMessage ( ) , ( Object [ ] ) message . getArgs ( ) ) ; } else if ( messageObject != null ) { return I18nUtilities . form...
Translates the given message into the appropriate user text . This takes the current locale into consideration if set .
18,553
public static void addFileItem ( final Map < String , FileItem [ ] > files , final String name , final FileItem item ) { if ( files . containsKey ( name ) ) { FileItem [ ] oldValues = files . get ( name ) ; FileItem [ ] newValues = new FileItem [ oldValues . length + 1 ] ; System . arraycopy ( oldValues , 0 , newValues...
Add the file data to the files collection . If a file already exists with the given name then the value for this name will be an array of all registered files .
18,554
public static void addParameter ( final Map < String , String [ ] > parameters , final String name , final String value ) { if ( parameters . containsKey ( name ) ) { String [ ] oldValues = parameters . get ( name ) ; String [ ] newValues = new String [ oldValues . length + 1 ] ; System . arraycopy ( oldValues , 0 , ne...
Add the request parameter to the parameters collection . If a parameter already exists with the given name then the Map will contain an array of all registered values .
18,555
protected static void renderTagOpen ( final WImage imageComponent , final XmlStringBuilder xml ) { String alternativeText = imageComponent . getAlternativeText ( ) ; if ( alternativeText == null ) { alternativeText = "" ; } else { alternativeText = I18nUtilities . format ( null , alternativeText ) ; } xml . appendTagOp...
Builds the open tag part of the XML that is the tagname and attributes .
18,556
public static void issue ( final WComponent comp , final String message ) { String debugMessage = message + ' ' + comp ; if ( ConfigurationProperties . getIntegrityErrorMode ( ) ) { throw new IntegrityException ( debugMessage ) ; } else { LogFactory . getLog ( Integrity . class ) . warn ( debugMessage ) ; } }
Raises an integrity issue .
18,557
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { AbstractWFieldIndicator fieldIndicator = ( AbstractWFieldIndicator ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WComponent validationTarget = fieldIndicator . getTargetComponent ( ) ; if ( validationT...
Paints the given AbstractWFieldIndicator .
18,558
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { String egVersion = Config . getInstance ( ) . getString ( "wcomponents-examples.version" ) ; String wcVersion = WebUtilities . getProjectVersion ( ) ; if ( egVersion != null && ! egV...
Override preparePaint in order to set up the resources on first access by a user .
18,559
public void setInputWidth ( final int inputWidth ) { if ( inputWidth > 100 ) { throw new IllegalArgumentException ( "inputWidth (" + inputWidth + ") cannot be greater than 100 percent." ) ; } getOrCreateComponentModel ( ) . inputWidth = Math . max ( 0 , inputWidth ) ; }
Sets the desired width of the input field as a percentage of the available space .
18,560
private void setUp ( ) { addExamples ( "AJAX" , ExampleData . AJAX_EXAMPLES ) ; addExamples ( "Form controls" , ExampleData . FORM_CONTROLS ) ; addExamples ( "Feedback and indicators" , ExampleData . FEEDBACK_AND_INDICATORS ) ; addExamples ( "Layout" , ExampleData . LAYOUT_EXAMPLES ) ; addExamples ( "Menus" , ExampleDa...
Add the examples as data in the tree .
18,561
public void addExamples ( final String groupName , final ExampleData [ ] entries ) { data . add ( new ExampleMenuList ( groupName , entries ) ) ; }
Add a set of examples to the WTree .
18,562
public final ExampleData getSelectedExampleData ( ) { Set < String > allSelectedItems = getSelectedRows ( ) ; if ( allSelectedItems == null || allSelectedItems . isEmpty ( ) ) { return null ; } for ( String selectedItem : allSelectedItems ) { List < Integer > rowIndex = TreeItemUtil . rowIndexStringToList ( selectedIte...
Get the example which is selected in the tree .
18,563
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { setInitialised ( true ) ; setTreeModel ( new MenuTreeModel ( data ) ) ; } }
Set the tree model on first use .
18,564
private WPanel createPanelWithText ( final String title , final String text ) { WPanel panel = new WPanel ( WPanel . Type . CHROME ) ; panel . setTitleText ( title ) ; WText textComponent = new WText ( text ) ; textComponent . setEncodeText ( false ) ; panel . add ( textComponent ) ; return panel ; }
Convenience method to create a WPanel with the given title and text .
18,565
public void setErrors ( final List < Diagnostic > errors ) { if ( errors != null ) { ValidationErrorsModel model = getOrCreateComponentModel ( ) ; for ( Diagnostic error : errors ) { if ( error . getSeverity ( ) == Diagnostic . ERROR ) { model . errors . add ( error ) ; } } } }
Sets the errors for a given user .
18,566
public List < GroupedDiagnositcs > getGroupedErrors ( ) { List < GroupedDiagnositcs > grouped = new ArrayList < > ( ) ; Diagnostic previousError = null ; GroupedDiagnositcs group = null ; for ( Diagnostic theError : getErrors ( ) ) { boolean isNewField = ( ( previousError == null ) || ( previousError . getContext ( ) !...
Groups the errors by their source field .
18,567
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WDateField dateField = ( WDateField ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = dateField . isReadOnly ( ) ; Date date = dateField . getDate ( ) ; xml . appendTagOpen ( "ui:datefie...
Paints the given WDateField .
18,568
public void updateUser ( UserUpdate update ) { getResourceFactory ( ) . getApiResource ( "/user/" ) . entity ( update , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates the active user . The old and new password can be left out in which case the password will not be changed . If the mail is changed the old password has to be supplied as well .
18,569
public < T , R > List < T > getProfileField ( ProfileField < T , R > field ) { List < R > values = getResourceFactory ( ) . getApiResource ( "/user/profile/" + field . getName ( ) ) . get ( new GenericType < List < R > > ( ) { } ) ; List < T > formatted = new ArrayList < T > ( ) ; for ( R value : values ) { formatted ....
Returns the field of the profile for the given key from the active user .
18,570
public void updateProfile ( ProfileUpdate profile ) { getResourceFactory ( ) . getApiResource ( "/user/profile/" ) . entity ( profile , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates the fields of an existing profile . All fields must be filled out as any fields not included will not be part of the new revision .
18,571
public void updateProfile ( ProfileFieldValues values ) { getResourceFactory ( ) . getApiResource ( "/user/profile/" ) . entity ( values , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates the fields of an existing profile . Will only update the fields in the values .
18,572
public void setProperty ( String key , boolean value ) { getResourceFactory ( ) . getApiResource ( "/user/property/" + key ) . entity ( new PropertyValue ( value ) , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Sets the value of the property for the active user with the given name . The property is specific to the auth client used .
18,573
public final TableTreeNode getNodeAtLine ( final int row ) { TableTreeNode node = root . next ( ) ; for ( int index = 0 ; node != null && index < row ; index ++ ) { node = node . next ( ) ; } return node ; }
Returns the node at the given line .
18,574
public void handleRequest ( final Request request ) { if ( isDisabled ( ) ) { return ; } if ( isPresent ( request ) ) { List < MenuItemSelectable > selectedItems = new ArrayList < > ( ) ; findSelections ( request , this , selectedItems ) ; setSelectedMenuItems ( selectedItems ) ; } }
Override handleRequest in order to perform processing specific to WMenu .
18,575
private void findSelections ( final Request request , final MenuSelectContainer selectContainer , final List < MenuItemSelectable > selections ) { if ( ! selectContainer . isVisible ( ) || ( selectContainer instanceof Disableable && ( ( Disableable ) selectContainer ) . isDisabled ( ) ) ) { return ; } List < MenuItemSe...
Finds the selected items in a menu for a request .
18,576
private List < MenuItemSelectable > getSelectableItems ( final MenuSelectContainer selectContainer ) { List < MenuItemSelectable > result = new ArrayList < > ( selectContainer . getMenuItems ( ) . size ( ) ) ; SelectionMode selectionMode = selectContainer . getSelectionMode ( ) ; for ( MenuItem item : selectContainer ....
Retrieves the selectable items for the given container .
18,577
private boolean isSelectable ( final MenuItem item , final SelectionMode selectionMode ) { if ( ! ( item instanceof MenuItemSelectable ) || ! item . isVisible ( ) || ( item instanceof Disableable && ( ( Disableable ) item ) . isDisabled ( ) ) ) { return false ; } if ( item instanceof WSubMenu && ! MenuType . COLUMN . e...
Indicates whether the given menu item is selectable .
18,578
public final R in ( T ... values ) { expr ( ) . in ( _name , ( Object [ ] ) values ) ; return _root ; }
Is in a list of values .
18,579
public void write ( final char [ ] cbuf , final int off , final int len ) throws IOException { if ( buffer == null ) { backing . write ( cbuf , off , len ) ; } else { for ( int i = off ; i < off + len ; i ++ ) { buffer [ bufferLen ++ ] = cbuf [ i ] ; if ( bufferLen == buffer . length ) { writeBuf ( buffer . length / 2 ...
Implementation of Writer s write method .
18,580
private void writeBuf ( final int endPos ) throws IOException { String searchTerm ; int pos = 0 ; int lastWritePos = 0 ; while ( pos < endPos ) { searchTerm = findSearchStrings ( pos ) ; if ( searchTerm != null ) { if ( lastWritePos != pos ) { backing . write ( buffer , lastWritePos , pos - lastWritePos ) ; } doReplace...
Writes the current contents of the buffer up to the given position . More data may be written from the buffer when there is a search string that crosses over endPos .
18,581
private String findSearchStrings ( final int start ) { String longestMatch = null ; for ( int i = 0 ; i < search . length ; i ++ ) { if ( start + search [ i ] . length ( ) > bufferLen ) { continue ; } boolean found = true ; for ( int j = 0 ; j < search [ i ] . length ( ) && ( start + j < bufferLen ) ; j ++ ) { int diff...
Searches for any search strings in the buffer that start between the specified offsets .
18,582
public int createStatus ( int spaceId , StatusCreate status ) { return getResourceFactory ( ) . getApiResource ( "/status/space/" + spaceId + "/" ) . entity ( status , MediaType . APPLICATION_JSON_TYPE ) . post ( StatusCreateResponse . class ) . getId ( ) ; }
Creates a new status message for a user on a specific space . A status update is simply a short text message that the user wishes to share with the rest of the space .
18,583
public void updateStatus ( int statusId , StatusUpdate update ) { getResourceFactory ( ) . getApiResource ( "/status/" + statusId ) . entity ( update , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
This will update an existing status message . This will normally only be used to correct spelling and grammatical mistakes .
18,584
public synchronized void register ( final String key , final WComponent ui ) { if ( isRegistered ( key ) ) { throw new SystemException ( "Cannot re-register a component. Key = " + key ) ; } registry . put ( key , ui ) ; }
Registers the given user interface with the given key .
18,585
private static Object loadUI ( final String key ) { String classname = key . trim ( ) ; try { Class < ? > clas = Class . forName ( classname ) ; if ( WComponent . class . isAssignableFrom ( clas ) ) { Object instance = clas . newInstance ( ) ; LOG . debug ( "WComponent successfully loaded with class name \"" + classnam...
Attemps to load a ui using the key as a class name .
18,586
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WComponentGroup group = ( WComponentGroup ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; List < WComponent > components = group . getComponents ( ) ; if ( components != null && ! components . isEmpty ( ...
Paints the given WComponentGroup .
18,587
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSection section = ( WSection ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean renderChildren = isRenderContent ( section ) ; xml . appendTagOpen ( "ui:section" ) ; xml . appendAttribute ( "id" , ...
Paints the given WSection .
18,588
public void remove ( final WComponent aChild ) { super . remove ( aChild ) ; PanelModel model = getOrCreateComponentModel ( ) ; if ( model . layoutConstraints == null ) { Map < WComponent , Serializable > defaultConstraints = ( ( PanelModel ) getDefaultModel ( ) ) . layoutConstraints ; if ( defaultConstraints != null )...
Removes the given component from this component s list of children . This method has been overriden to remove any associated layout constraints .
18,589
public Serializable getLayoutConstraints ( final WComponent child ) { PanelModel model = getComponentModel ( ) ; if ( model . layoutConstraints != null ) { return model . layoutConstraints . get ( child ) ; } return null ; }
Retrieves the layout constraints for the given component if they have been set .
18,590
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WDefinitionList list = ( WDefinitionList ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:definitionlist" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appen...
Paints the given definition list .
18,591
private void addAlignedExample ( ) { add ( new WHeading ( HeadingLevel . H2 , "WRow / WCol with column alignment" ) ) ; WRow alignedColsRow = new WRow ( ) ; add ( alignedColsRow ) ; WColumn alignedCol = new WColumn ( ) ; alignedCol . setAlignment ( WColumn . Alignment . LEFT ) ; alignedCol . setWidth ( 25 ) ; alignedCo...
Add an example showing column alignment .
18,592
private WRow createRow ( final int hgap , final int [ ] colWidths ) { WRow row = new WRow ( hgap ) ; for ( int i = 0 ; i < colWidths . length ; i ++ ) { WColumn col = new WColumn ( colWidths [ i ] ) ; WPanel box = new WPanel ( WPanel . Type . BOX ) ; box . add ( new WText ( colWidths [ i ] + "%" ) ) ; col . add ( box )...
Creates a row containing columns with the given widths .
18,593
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WTextField textField = ( WTextField ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = textField . isReadOnly ( ) ; xml . appendTagOpen ( "ui:textfield" ) ; xml . appendAttribute ( "id" ,...
Paints the given WTextField .
18,594
private String getTag ( final BorderLayoutConstraint constraint ) { switch ( constraint ) { case EAST : return "ui:east" ; case NORTH : return "ui:north" ; case SOUTH : return "ui:south" ; case WEST : return "ui:west" ; case CENTER : default : return "ui:center" ; } }
Retrieves the name of the element that will contain components with the given constraint .
18,595
private void paintChildrenWithConstraint ( final List < Duplet < WComponent , BorderLayoutConstraint > > children , final WebXmlRenderContext renderContext , final BorderLayoutConstraint constraint ) { String containingTag = null ; XmlStringBuilder xml = renderContext . getWriter ( ) ; final int size = children . size ...
Paints all the child components with the given constraint .
18,596
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WTextArea textArea = ( WTextArea ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = textArea . isReadOnly ( ) ; xml . appendTagOpen ( "ui:textarea" ) ; xml . appendAttribute ( "id" , comp...
Paints the given WTextArea .
18,597
private StringBuilder extractJavaDoc ( final String source ) { int docStart = source . indexOf ( "/**" ) ; int docEnd = source . indexOf ( "*/" , docStart ) ; int classStart = source . indexOf ( "public class" ) ; int author = source . indexOf ( "@author" ) ; int since = source . indexOf ( "@since" ) ; if ( classStart ...
extracts the javadoc . It assumes that the java doc for the class is the first javadoc in the file .
18,598
private void stripAsterisk ( final StringBuilder javaDoc ) { int index = javaDoc . indexOf ( "*" ) ; while ( index != - 1 ) { javaDoc . replace ( index , index + 1 , "" ) ; index = javaDoc . indexOf ( "*" ) ; } }
This method removes the additional astrisks from the java doc .
18,599
private String parseLink ( final String link ) { String [ ] tokens = link . substring ( 7 , link . length ( ) - 1 ) . split ( "\\s" ) ; if ( tokens . length == 1 ) { return tokens [ 0 ] ; } StringBuilder result = new StringBuilder ( ) ; boolean parametersSeen = false ; boolean inParameters = false ; for ( int index = 0...
a helper method to process the links as they are found .