idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
19,200 | protected void paintComponent ( final RenderContext renderContext ) { if ( renderContext instanceof WebXmlRenderContext ) { PrintWriter writer = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; writer . println ( getMessage ( ) ) ; if ( developerFriendly ) { writer . println ( "<pre style=\"background: light... | Renders this FatalErrorPage . |
19,201 | public void setText ( final String text , final Serializable ... args ) { Serializable currText = getComponentModel ( ) . text ; Serializable textToBeSet = I18nUtilities . asMessage ( text , args ) ; if ( ! Objects . equals ( textToBeSet , currText ) ) { getOrCreateComponentModel ( ) . text = textToBeSet ; } } | Sets the label s text . |
19,202 | public void setHint ( final String hint , final Serializable ... args ) { Serializable currHint = getComponentModel ( ) . hint ; Serializable hintToBeSet = I18nUtilities . asMessage ( hint , args ) ; if ( ! Objects . equals ( hintToBeSet , currHint ) ) { getOrCreateComponentModel ( ) . hint = hintToBeSet ; } } | Sets the label hint text which can be used to provide additional information to the user . |
19,203 | public void setForComponent ( final WComponent forComponent ) { getOrCreateComponentModel ( ) . forComponent = forComponent ; if ( forComponent instanceof AbstractWComponent ) { ( ( AbstractWComponent ) forComponent ) . setLabel ( this ) ; } } | Sets the component that this label is associated with . |
19,204 | protected void preparePaintComponent ( final Request request ) { if ( ! isInitialised ( ) ) { repeat . setData ( getNames ( ) ) ; setInitialised ( true ) ; } } | Initialise the WRepeater data . |
19,205 | private void setupUI ( final String labelText ) { WButton dupBtn = new WButton ( "Duplicate" ) ; dupBtn . setAction ( new DuplicateAction ( ) ) ; WButton clrBtn = new WButton ( "Clear" ) ; clrBtn . setAction ( new ClearAction ( ) ) ; add ( new WLabel ( labelText , textFld ) ) ; add ( textFld ) ; add ( dupBtn ) ; add ( ... | Add the controls to the UI . |
19,206 | private void addRecentExample ( final String text , final ExampleData data , final boolean select ) { WMenuItem item = new WMenuItem ( text , new SelectExampleAction ( ) ) ; item . setCancel ( true ) ; menu . add ( item ) ; item . setActionObject ( data ) ; if ( select ) { menu . setSelectedMenuItem ( item ) ; } } | Adds an example to the recent subMenu . |
19,207 | private ExampleData getMatch ( final WComponent node , final String name , final boolean partial ) { if ( node instanceof WMenuItem ) { ExampleData data = ( ExampleData ) ( ( WMenuItem ) node ) . getActionObject ( ) ; Class < ? extends WComponent > clazz = data . getExampleClass ( ) ; if ( clazz . getName ( ) . equals ... | Recursively searches the menu for a match to a WComponent with the given name . |
19,208 | private void loadRecentList ( ) { recent . clear ( ) ; File file = new File ( RECENT_FILE_NAME ) ; if ( file . exists ( ) ) { try { InputStream inputStream = new BufferedInputStream ( new FileInputStream ( file ) ) ; XMLDecoder decoder = new XMLDecoder ( inputStream ) ; List result = ( List ) decoder . readObject ( ) ;... | Reads the list of recently selected examples from a file on the file system . |
19,209 | private void storeRecentList ( ) { synchronized ( recent ) { try { OutputStream out = new BufferedOutputStream ( new FileOutputStream ( RECENT_FILE_NAME ) ) ; XMLEncoder encoder = new XMLEncoder ( out ) ; encoder . writeObject ( recent ) ; encoder . close ( ) ; } catch ( IOException ex ) { LogFactory . getLog ( getClas... | Writes the list of recent selections to a file on the file system . |
19,210 | public void addToRecent ( final ExampleData example ) { synchronized ( recent ) { recent . remove ( example ) ; recent . add ( 0 , example ) ; while ( recent . size ( ) > MAX_RECENT_ITEMS ) { recent . remove ( MAX_RECENT_ITEMS ) ; } storeRecentList ( ) ; setInitialised ( false ) ; } } | Adds an example to the list of recently accessed examples . The list of recently examples will be persisted to the file system . |
19,211 | private void updateRecentMenu ( ) { menu . removeAllMenuItems ( ) ; int index = 1 ; boolean first = true ; for ( Iterator < ExampleData > i = recent . iterator ( ) ; i . hasNext ( ) ; ) { ExampleData data = i . next ( ) ; try { StringBuilder builder = new StringBuilder ( Integer . toString ( index ++ ) ) . append ( ". ... | Updates the entries in the Recent sub - menu . |
19,212 | public void setContent ( final WComponent content ) { WComponent oldContent = getContent ( ) ; if ( oldContent != null ) { remove ( oldContent ) ; } if ( content != null ) { add ( content ) ; } } | Sets the tab content . |
19,213 | protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; WComponent content = getContent ( ) ; if ( content != null ) { switch ( getMode ( ) ) { case EAGER : { content . setVisible ( true ) ; AjaxHelper . registerContainer ( getId ( ) , getId ( ) + "-content" , conten... | Override preparePaintComponent in order to correct the visibility of the tab s content before it is rendered . |
19,214 | public SpaceCreateResponse createSpace ( SpaceCreate data ) { return getResourceFactory ( ) . getApiResource ( "/space/" ) . entity ( data , MediaType . APPLICATION_JSON_TYPE ) . post ( SpaceCreateResponse . class ) ; } | Add a new space to an organization . |
19,215 | public void updateSpace ( int spaceId , SpaceUpdate data ) { getResourceFactory ( ) . getApiResource ( "/space/" + spaceId ) . entity ( data , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Updates the space with the given id |
19,216 | public SpaceWithOrganization getSpaceByURL ( String url ) { return getResourceFactory ( ) . getApiResource ( "/space/url" ) . queryParam ( "url" , url ) . get ( SpaceWithOrganization . class ) ; } | Returns the space and organization with the given full URL . |
19,217 | public SpaceMember getSpaceMembership ( int spaceId , int userId ) { return getResourceFactory ( ) . getApiResource ( "/space/" + spaceId + "/member/" + userId ) . get ( SpaceMember . class ) ; } | Used to get the details of an active users membership of a space . |
19,218 | public void updateSpaceMembership ( int spaceId , int userId , Role role ) { getResourceFactory ( ) . getApiResource ( "/space/" + spaceId + "/member/" + userId ) . entity ( new SpaceMemberUpdate ( role ) , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Updates a space membership with another role |
19,219 | public List < SpaceMember > getActiveMembers ( int spaceId ) { return getResourceFactory ( ) . getApiResource ( "/space/" + spaceId + "/member/" ) . get ( new GenericType < List < SpaceMember > > ( ) { } ) ; } | Returns the active members of the given space . |
19,220 | public List < SpaceMember > getEndedMembers ( int spaceId ) { return getResourceFactory ( ) . getApiResource ( "/space/" + spaceId + "/member/ended/" ) . get ( new GenericType < List < SpaceMember > > ( ) { } ) ; } | Returns a list of the members that have been removed from the space . |
19,221 | public List < SpaceWithOrganization > getTopSpaces ( Integer limit ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/space/top/" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit . toString ( ) ) ; } return resource . get ( new GenericType < List < SpaceWithOrganization ... | Returns the top spaces for the user |
19,222 | public static void registerList ( final String key , final Request request ) { request . setSessionAttribute ( DATA_LIST_UIC_SESSION_KEY , UIContextHolder . getCurrentPrimaryUIContext ( ) ) ; } | Registers a data list with the servlet . |
19,223 | public static UIContext getContext ( final String key , final Request request ) { return ( UIContext ) request . getSessionAttribute ( DATA_LIST_UIC_SESSION_KEY ) ; } | Retrieves the UIContext for the given data list . |
19,224 | public static List < ComponentWithContext > collateVisibles ( final WComponent comp ) { final List < ComponentWithContext > list = new ArrayList < > ( ) ; WComponentTreeVisitor visitor = new WComponentTreeVisitor ( ) { public VisitorResult visit ( final WComponent comp ) { if ( comp . isVisible ( ) ) { list . add ( new... | Obtains a list of components which are visible in the given tree . Repeated components will be returned multiple times one for each row which they are visible in . |
19,225 | public static WComponent getRoot ( final UIContext uic , final WComponent comp ) { UIContextHolder . pushContext ( uic ) ; try { return WebUtilities . getTop ( comp ) ; } finally { UIContextHolder . popContext ( ) ; } } | Retrieves the root component of a WComponent hierarchy . |
19,226 | public static List < ComponentWithContext > findComponentsByClass ( final WComponent root , final String className , final boolean includeRoot , final boolean visibleOnly ) { FindComponentsByClassVisitor visitor = new FindComponentsByClassVisitor ( root , className , includeRoot ) ; doTraverse ( root , visibleOnly , vi... | Search for components implementing a particular class name . |
19,227 | public static WComponent getComponentWithId ( final WComponent root , final String id , final boolean visibleOnly ) { ComponentWithContext comp = getComponentWithContextForId ( root , id , visibleOnly ) ; return comp == null ? null : comp . getComponent ( ) ; } | Retrieves the component with the given Id . |
19,228 | public static UIContext getClosestContextForId ( final WComponent root , final String id , final boolean visibleOnly ) { FindComponentByIdVisitor visitor = new FindComponentByIdVisitor ( id ) { public VisitorResult visit ( final WComponent comp ) { VisitorResult result = super . visit ( comp ) ; if ( result == VisitorR... | Retrieves the closest context for the component with the given Id . |
19,229 | private static VisitorResult doTraverse ( final WComponent node , final boolean visibleOnly , final WComponentTreeVisitor visitor ) { if ( visibleOnly ) { if ( node instanceof WInvisibleContainer ) { WComponent parent = node . getParent ( ) ; if ( parent instanceof WCardManager ) { WComponent visible = ( ( WCardManager... | Internal implementation of tree traversal method . |
19,230 | public void setText ( final String text , final Serializable ... args ) { getOrCreateComponentModel ( ) . text = I18nUtilities . asMessage ( text , args ) ; } | Sets the text displayed on the link . |
19,231 | public void handleRequest ( final Request request ) { AjaxOperation operation = AjaxHelper . getCurrentOperation ( ) ; boolean pressed = ( operation != null && getId ( ) . equals ( operation . getTriggerId ( ) ) ) ; if ( isDisabled ( ) && pressed ) { LOG . warn ( "A disabled link has been triggered. " + getText ( ) + "... | Override handleRequest in order to perform processing for this component . This implementation checks whether the link has been pressed via the current ajax operation . |
19,232 | protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; final Action action = getAction ( ) ; final AjaxTarget [ ] actionTargets = getActionTargets ( ) ; if ( action != null && uic . getUI ( ) != null ) { if ( action... | Override preparePaintComponent to register an AJAX operation if this link has an action . |
19,233 | public void setImage ( final Image image ) { LinkModel model = getOrCreateComponentModel ( ) ; model . image = image ; model . imageUrl = null ; } | Sets the image to display on the link . |
19,234 | public void setImageUrl ( final String imageUrl ) { LinkModel model = getOrCreateComponentModel ( ) ; model . imageUrl = imageUrl ; model . image = null ; } | Sets the URL of the image to display on the link . |
19,235 | public void addFile ( final FileWidgetUpload file ) { List < FileWidgetUpload > files = ( List < FileWidgetUpload > ) getData ( ) ; if ( files == null ) { files = new ArrayList < > ( ) ; setData ( files ) ; } files . add ( file ) ; MemoryUtil . checkSize ( files . size ( ) , this . getClass ( ) . getSimpleName ( ) ) ; ... | Add a file item to this widget . |
19,236 | public void removeFile ( final FileWidgetUpload file ) { List < FileWidgetUpload > files = ( List < FileWidgetUpload > ) getData ( ) ; if ( files != null ) { files . remove ( file ) ; if ( files . isEmpty ( ) ) { setData ( null ) ; } } } | Remove the file . |
19,237 | private boolean isValid ( final String fileType ) { boolean result = false ; if ( fileType != null && fileType . length ( ) > 1 ) { if ( fileType . startsWith ( "." ) ) { result = true ; } else if ( fileType . length ( ) > 2 && fileType . indexOf ( '/' ) > 0 ) { result = true ; } } return result ; } | Check that the file type SEEMS to be legit . |
19,238 | public List < String > getFileTypes ( ) { Set < String > fileTypes = getComponentModel ( ) . fileTypes ; List < String > result ; if ( fileTypes == null || fileTypes . isEmpty ( ) ) { return Collections . emptyList ( ) ; } result = new ArrayList < > ( fileTypes ) ; return result ; } | Returns a list of file types accepted by the file input . |
19,239 | public void setColumns ( final Integer cols ) { if ( cols != null && cols < 0 ) { throw new IllegalArgumentException ( "Must have zero or more columns" ) ; } Integer currColumns = getColumns ( ) ; if ( ! Objects . equals ( cols , currColumns ) ) { getOrCreateComponentModel ( ) . cols = cols ; } } | Sets the layout of uploaded files to be a certain number of columns . Null uses the theme default . |
19,240 | protected void doHandleFileAjaxActionRequest ( final Request request ) { if ( isDisabled ( ) ) { throw new SystemException ( "File widget is disabled." ) ; } String fileId = request . getParameter ( FILE_UPLOAD_ID_KEY ) ; if ( fileId == null ) { throw new SystemException ( "No file id provided for ajax action." ) ; } F... | Handle a file action AJAX request . |
19,241 | protected void doHandleTargetedRequest ( final Request request ) { String fileId = request . getParameter ( FILE_UPLOAD_ID_KEY ) ; if ( fileId == null ) { throw new SystemException ( "No file id provided for content request." ) ; } FileWidgetUpload file = getFile ( fileId ) ; if ( file == null ) { throw new SystemExcep... | Handle a targeted request . Can be a file upload thumbnail request or file content request . |
19,242 | protected void doHandleUploadRequest ( final Request request ) { if ( isDisabled ( ) || isReadOnly ( ) ) { throw new SystemException ( "File widget cannot be updated." ) ; } if ( ! "POST" . equals ( request . getMethod ( ) ) ) { throw new SystemException ( "File widget cannot be updated by " + request . getMethod ( ) +... | The request is a targeted file upload request . Upload the file and respond with the file information . |
19,243 | protected void doHandleThumbnailRequest ( final FileWidgetUpload file ) { if ( file . getThumbnail ( ) == null ) { Image thumbnail = createThumbNail ( file . getFile ( ) ) ; file . setThumbnail ( thumbnail ) ; } ContentEscape escape = new ContentEscape ( file . getThumbnail ( ) ) ; throw escape ; } | Handle the thumb nail request . |
19,244 | public String getFileUrl ( final String fileId ) { FileWidgetUpload file = getFile ( fileId ) ; if ( file == null ) { return null ; } Environment env = getEnvironment ( ) ; Map < String , String > parameters = env . getHiddenParameters ( ) ; parameters . put ( Environment . TARGET_ID , getTargetId ( ) ) ; if ( Util . e... | Retrieves a URL for the uploaded file content . |
19,245 | public String getFileThumbnailUrl ( final String fileId ) { FileWidgetUpload file = getFile ( fileId ) ; if ( file == null ) { return null ; } Image thumbnail = file . getThumbnail ( ) ; if ( thumbnail instanceof InternalResource ) { return ( ( InternalResource ) thumbnail ) . getTargetUrl ( ) ; } Environment env = get... | Retrieves a URL for the thumbnail of an uploaded file . |
19,246 | public void serviceRequest ( final Request request ) { UIContext uic = UIContextHolder . getCurrent ( ) ; uic . setFocussed ( null , null ) ; uic . setFocusRequired ( true ) ; super . serviceRequest ( request ) ; } | Override serviceRequest in order to perform processing specific to this interceptor . |
19,247 | public void paint ( final RenderContext renderContext ) { getBackingComponent ( ) . paint ( renderContext ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; if ( uic . isFocusRequired ( ) ) { boolean sticky = ConfigurationProperties . getStickyFocus ( ) ; if ( ! sticky ) { uic . setFocussed ( null , null ) ; uic . ... | Override paint in order to perform processing specific to this interceptor . |
19,248 | private void applyEnableAction ( final WComponent target , final boolean enabled ) { if ( target instanceof Disableable ) { target . setValidate ( enabled ) ; ( ( Disableable ) target ) . setDisabled ( ! enabled ) ; } else if ( target instanceof Container ) { Container cont = ( Container ) target ; final int size = con... | Apply the enable action against the target and its children . |
19,249 | private void startLoad ( ) { tableLayout . setVisible ( true ) ; List < PersonBean > beans = ExampleDataUtil . createExampleData ( numRows . getNumber ( ) . intValue ( ) , numDocs . getNumber ( ) . intValue ( ) ) ; if ( isLoadWTable ( ) ) { table . setBean ( beans ) ; } if ( isLoadWDataTable ( ) ) { TableTreeNode tree ... | Start load . |
19,250 | private void applyMandatoryAction ( final WComponent target , final boolean mandatory ) { if ( target instanceof Mandatable ) { ( ( Mandatable ) target ) . setMandatory ( mandatory ) ; } else if ( target instanceof Container ) { Container cont = ( Container ) target ; final int size = cont . getChildCount ( ) ; for ( i... | Apply the mandatory action against the target and its children . |
19,251 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WShuffler shuffler = ( WShuffler ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = shuffler . isReadOnly ( ) ; xml . appendTagOpen ( "ui:shuffler" ) ; xml . appendAttribute ( "id" , comp... | Paints the given WShuffler . |
19,252 | private String deriveId ( final String idName ) { NamingContextable parent = WebUtilities . getParentNamingContext ( this ) ; if ( parent == null ) { return idName ; } String prefix = parent . getNamingContextId ( ) ; if ( prefix . length ( ) == 0 ) { return idName ; } StringBuffer nameBuf = new StringBuffer ( prefix .... | Derive the full id from its naming context . |
19,253 | void registerInContext ( ) { if ( ! ConfigurationProperties . getCheckDuplicateIds ( ) ) { return ; } if ( getIdName ( ) != null ) { NamingContextable context = WebUtilities . getParentNamingContext ( this ) ; if ( context == null ) { if ( WebUtilities . isActiveNamingContext ( this ) ) { this . registerId ( this ) ; }... | Register this component s ID in its naming context . |
19,254 | protected void invokeLaters ( ) { if ( getParent ( ) == null ) { UIContext uic = UIContextHolder . getCurrent ( ) ; if ( uic != null ) { uic . doInvokeLaters ( ) ; } } } | The framework calls this method at the end of the serviceRequest method . The default implementation is that only a root wcomponent actually runs them . |
19,255 | protected void paintComponent ( final RenderContext renderContext ) { Renderer renderer = UIManager . getRenderer ( this , renderContext ) ; if ( getTemplate ( ) != null || getTemplateMarkUp ( ) != null ) { Renderer templateRenderer = UIManager . getTemplateRenderer ( renderContext ) ; templateRenderer . render ( this ... | This is where most of the painting work is normally done . If a layout has been supplied either directly or by supplying a velocity template then painting is delegated to the layout manager . If there is no layout the default behaviour is to paint the child components in sequence . |
19,256 | protected Diagnostic createErrorDiagnostic ( final WComponent source , final String message , final Serializable ... args ) { return new DiagnosticImpl ( Diagnostic . ERROR , source , message , args ) ; } | Create and return an error diagnostic associated to the given error source . |
19,257 | protected void setFlag ( final int mask , final boolean flag ) { if ( flag != isFlagSet ( mask ) ) { ComponentModel model = getOrCreateComponentModel ( ) ; model . setFlags ( switchFlag ( model . getFlags ( ) , mask , flag ) ) ; } } | Sets or clears one or more component flags in the component model for the given context .. |
19,258 | private static int switchFlag ( final int flags , final int mask , final boolean value ) { int newFlags = value ? flags | mask : flags & ~ mask ; return newFlags ; } | A utility method to set or clear one or more bits in the given set of flags . |
19,259 | protected ComponentModel getComponentModel ( ) { UIContext effectiveContext = UIContextHolder . getCurrent ( ) ; if ( effectiveContext == null ) { return sharedModel ; } else { ComponentModel model = ( ComponentModel ) effectiveContext . getModel ( this ) ; if ( model == null ) { return sharedModel ; } else if ( model ... | Returns the effective component model for this component . Subclass may override this method to narrow the return type to their specific model type . |
19,260 | protected ComponentModel getOrCreateComponentModel ( ) { ComponentModel model = getComponentModel ( ) ; if ( locked && model == sharedModel ) { UIContext effectiveContext = UIContextHolder . getCurrent ( ) ; if ( effectiveContext != null ) { model = newComponentModel ( ) ; model . setSharedModel ( sharedModel ) ; effec... | Retrieves the model for this component so that it can be modified . If this method is called during request processing and a session specific model does not yet exist then a new model is created . Subclasses may override this method to narrow the return type to their specific model type . |
19,261 | WComponent getChildAt ( final int index ) { ComponentModel model = getComponentModel ( ) ; return model . getChildren ( ) . get ( index ) ; } | Retrieves a child component by its index . |
19,262 | int getIndexOfChild ( final WComponent childComponent ) { ComponentModel model = getComponentModel ( ) ; List < WComponent > children = model . getChildren ( ) ; return children == null ? - 1 : children . indexOf ( childComponent ) ; } | Retrieves the index of the given child . |
19,263 | List < WComponent > getChildren ( ) { List < WComponent > children = getComponentModel ( ) . getChildren ( ) ; return children != null && ! children . isEmpty ( ) ? Collections . unmodifiableList ( children ) : Collections . < WComponent > emptyList ( ) ; } | Retrieves the children of this component . |
19,264 | void add ( final WComponent component ) { assertAddSupported ( component ) ; assertNotReparenting ( component ) ; if ( ! ( this instanceof Container ) ) { throw new UnsupportedOperationException ( "Components can only be added to a container" ) ; } ComponentModel model = getOrCreateComponentModel ( ) ; if ( model . get... | Adds the given component as a child of this component . |
19,265 | void remove ( final WComponent aChild ) { ComponentModel model = getOrCreateComponentModel ( ) ; if ( model . getChildren ( ) == null ) { model . setChildren ( copyChildren ( getComponentModel ( ) . getChildren ( ) ) ) ; } if ( model . getChildren ( ) . remove ( aChild ) ) { if ( model . getChildren ( ) . isEmpty ( ) )... | Removes the given component from this component s list of children . |
19,266 | private static List < WComponent > copyChildren ( final List < WComponent > children ) { ArrayList < WComponent > copy ; if ( children == null ) { copy = new ArrayList < > ( 1 ) ; } else { copy = new ArrayList < > ( children ) ; } return copy ; } | Creates a copy of the given list of components . |
19,267 | protected Object writeReplace ( ) throws ObjectStreamException { WComponent top = WebUtilities . getTop ( this ) ; String repositoryKey ; if ( top instanceof WApplication ) { repositoryKey = ( ( WApplication ) top ) . getUiVersionKey ( ) ; } else { repositoryKey = top . getClass ( ) . getName ( ) ; } if ( UIRegistry . ... | Implement writeReplace so that on serialization WComponents that are registered in the UIRegistry write a reference to the registered component rather than the component itself . This ensures that on deserialization only one copy of the registered component will be present in the VM . |
19,268 | private void addLink ( final WSubMenu subMenu , final WLink link ) { subMenu . add ( new WMenuItem ( new WDecoratedLabel ( link ) ) ) ; } | Adds a WLink to a sub - menu . |
19,269 | public void setLabelWidth ( final int labelWidth ) { if ( labelWidth > 100 ) { throw new IllegalArgumentException ( "labelWidth (" + labelWidth + ") cannot be greater than 100 percent." ) ; } getOrCreateComponentModel ( ) . labelWidth = Math . max ( 0 , labelWidth ) ; } | Sets the label width . |
19,270 | public WField addField ( final WButton button ) { WField field = new WField ( ( WLabel ) null , button ) ; add ( field ) ; return field ; } | Add a field consisting of a WButton with a null label . |
19,271 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WPartialDateField dateField = ( WPartialDateField ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = dateField . isReadOnly ( ) ; String date = formatDate ( dateField ) ; xml . appendTagO... | Paints the given WPartialDateField . |
19,272 | private String formatDate ( final WPartialDateField dateField ) { Integer day = dateField . getDay ( ) ; Integer month = dateField . getMonth ( ) ; Integer year = dateField . getYear ( ) ; if ( day != null || month != null || year != null ) { StringBuffer buf = new StringBuffer ( 10 ) ; append ( buf , year , 4 ) ; buf ... | Formats a partial date to the format required by the schema . |
19,273 | private void append ( final StringBuffer buf , final Integer num , final int digits ) { if ( num == null ) { for ( int i = 0 ; i < digits ; i ++ ) { buf . append ( '?' ) ; } } else { for ( int digit = 1 , test = 10 ; digit < digits ; digit ++ , test *= 10 ) { if ( num < test ) { buf . append ( '0' ) ; } } buf . append ... | Appends a single date component to the given StringBuffer . Nulls are replaced with question marks and numbers are padded with zeros . |
19,274 | protected void validateComponent ( final List < Diagnostic > diags ) { String text1 = field1 . getText ( ) ; String text2 = field2 . getText ( ) ; String text3 = field3 . getText ( ) ; if ( text1 != null && text1 . length ( ) > 0 && text1 . equals ( text2 ) ) { diags . add ( createErrorDiagnostic ( field2 , "Fields 1 a... | An example of cross field validation . |
19,275 | public StateChange nextState ( final char c ) { StateChange change = currentState . getChange ( c ) ; currentState = change . getNewState ( ) ; return change ; } | Moves the machine to the next state based on the input character . |
19,276 | protected boolean doHandleRequest ( final Request request ) { if ( request . getParameter ( getId ( ) ) != null ) { return false ; } if ( getValue ( ) != null ) { setData ( null ) ; return true ; } return false ; } | This method will only processes a request where the group is on the request and has no value . If the group has no value then none of the group s radio buttons will be triggered to process the request . |
19,277 | private void addDateRangeExample ( ) { add ( new WHeading ( HeadingLevel . H2 , "Example of a date range component" ) ) ; WFieldSet dateRange = new WFieldSet ( "Enter the expected arrival and departure dates." ) ; add ( dateRange ) ; WPanel dateRangePanel = new WPanel ( ) ; dateRangePanel . setLayout ( new FlowLayout (... | Add date range example . |
19,278 | private void addContraintExamples ( ) { add ( new WHeading ( HeadingLevel . H2 , "Date fields with input constraints" ) ) ; WFieldLayout layout = new WFieldLayout ( ) ; layout . setLabelWidth ( 33 ) ; add ( layout ) ; WDateField constrainedDateField = new WDateField ( ) ; constrainedDateField . setMandatory ( true ) ; ... | Add constraint example . |
19,279 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSelectToggle toggle = ( WSelectToggle ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:selecttoggle" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOpt... | Paints the given WSelectToggle . |
19,280 | private void buildUI ( ) { WFieldLayout layout = new WFieldLayout ( WFieldLayout . LAYOUT_STACKED ) ; layout . setMargin ( new Margin ( null , null , Size . LARGE , null ) ) ; add ( layout ) ; layout . addField ( "Autoplay" , cbAutoPlay ) ; layout . addField ( "Loop" , cbLoop ) ; layout . addField ( "Disable" , cbDisab... | Build the UI for this example . |
19,281 | protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { setInitialised ( true ) ; setupAudio ( ) ; } } | Set up the initial state of the audio component . |
19,282 | private void setupAudio ( ) { audio . setAutoplay ( cbAutoPlay . isSelected ( ) ) ; audio . setLoop ( ! cbLoop . isDisabled ( ) && cbLoop . isSelected ( ) ) ; audio . setControls ( cbControls . isSelected ( ) ? WAudio . Controls . PLAY_PAUSE : WAudio . Controls . NATIVE ) ; audio . setDisabled ( cbControls . isSelected... | Set the audio configuration options . |
19,283 | protected void afterPaint ( final RenderContext renderContext ) { super . afterPaint ( renderContext ) ; final int size = getChildCount ( ) ; for ( int i = 0 ; i < size ; i ++ ) { WComponent child = getChildAt ( i ) ; child . reset ( ) ; } } | After the component has been painted the UIContexts for this component and all its children are cleared . |
19,284 | public String getGroupName ( ) { if ( collapsibleToggle != null ) { return collapsibleToggle . getId ( ) ; } else if ( ! collapsibleList . isEmpty ( ) ) { return collapsibleList . get ( 0 ) . getId ( ) ; } return "" ; } | Retrieves the common name used by all collapsible components in the group . |
19,285 | private void addComponent ( final WComponent component ) { collapsibleList . add ( component ) ; MemoryUtil . checkSize ( collapsibleList . size ( ) , this . getClass ( ) . getSimpleName ( ) ) ; } | Responsible for updating the underlying group store . |
19,286 | private List < ? > getNewOptions ( final String [ ] paramValues ) { List < ? > copyOldOptions = new ArrayList ( getOptions ( ) ) ; List < Object > newOptions = new ArrayList < > ( paramValues . length ) ; for ( String param : paramValues ) { for ( Object oldOption : copyOldOptions ) { String stringOldOption = String . ... | Shuffle the options . |
19,287 | private void addListItems ( final WDefinitionList list ) { list . addTerm ( "Colours" , new WText ( "Red" ) , new WText ( "Green" ) , new WText ( "Blue" ) ) ; list . addTerm ( "Shapes" , new WText ( "Circle" ) ) ; list . addTerm ( "Shapes" , new WText ( "Square" ) , new WText ( "Triangle" ) ) ; } | Adds some items to a definition list . |
19,288 | private void applySettings ( ) { container . reset ( ) ; WPanel gridLayoutPanel = new WPanel ( ) ; if ( cbResponsive . isSelected ( ) ) { gridLayoutPanel . setHtmlClass ( HtmlClassProperties . RESPOND ) ; } GridLayout layout = new GridLayout ( rowCount . getValue ( ) . intValue ( ) , columnCount . getValue ( ) . intVal... | reset the container that holds the grid layout and create a new grid layout with the appropriate properties . |
19,289 | public Subscription getSubscription ( Reference reference ) { return getResourceFactory ( ) . getApiResource ( "/subscription/" + reference . toURLFragment ( false ) ) . get ( Subscription . class ) ; } | Get the subscription for the given object |
19,290 | public void subscribe ( Reference reference ) { getResourceFactory ( ) . getApiResource ( "/subscription/" + reference . toURLFragment ( false ) ) . entity ( new Empty ( ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ) ; } | Subscribes the user to the given object . Based on the object type the user will receive notifications when actions are performed on the object . See the area for more details . |
19,291 | public void paint ( final RenderContext renderContext ) { AjaxOperation operation = AjaxHelper . getCurrentOperation ( ) ; if ( operation == null ) { throw new SystemException ( "Can't paint AJAX response. Couldn't find the expected reference to the AjaxOperation." ) ; } if ( operation . getTargetContainerId ( ) != nul... | Paints the targeted ajax regions . The format of the response is an agreement between the server and the client side JavaScript handling our ajax response . |
19,292 | private void paintContainerResponse ( final RenderContext renderContext , final AjaxOperation operation ) { WebXmlRenderContext webRenderContext = ( WebXmlRenderContext ) renderContext ; XmlStringBuilder xml = webRenderContext . getWriter ( ) ; ComponentWithContext trigger = AjaxHelper . getCurrentTriggerAndContext ( )... | Paint the ajax container response . |
19,293 | private boolean isProcessTriggerOnly ( final ComponentWithContext triggerWithContext , final AjaxOperation operation ) { if ( operation . getTargetContainerId ( ) != null || operation . isInternalAjaxRequest ( ) ) { return true ; } WComponent trigger = triggerWithContext . getComponent ( ) ; if ( trigger instanceof WAj... | Check if process this trigger only . |
19,294 | public static boolean getHandleErrorWithFatalErrorPageFactory ( ) { Boolean parameterValue = get ( ) . getBoolean ( HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY , null ) ; if ( parameterValue != null ) { return parameterValue ; } return get ( ) . getBoolean ( HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY_DEPRECATED , false ) ; } | The flag indicating whether to handle an error with a fatal error page factory . |
19,295 | public static String getRendererOverride ( final String classname ) { if ( StringUtils . isBlank ( classname ) ) { throw new IllegalArgumentException ( "classname cannot be blank." ) ; } return get ( ) . getString ( RENDERER_OVERRIDE_PREFIX + classname ) ; } | The overridden renderer class for the given fully qualified classname . |
19,296 | public static String getResponseCacheHeaderSettings ( final String contentType ) { String parameter = MessageFormat . format ( RESPONSE_CACHE_HEADER_SETTINGS , contentType ) ; return get ( ) . getString ( parameter ) ; } | The response cache header settings for the given contentType . |
19,297 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSuggestions suggestions = ( WSuggestions ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String dataKey = suggestions . getListCacheKey ( ) ; boolean useAjax = dataKey == null && suggestions . getRefres... | Paints the given WSuggestions . |
19,298 | public void handleRequest ( final Request request ) { if ( ! isDisabled ( ) ) { final SelectToggleModel model = getComponentModel ( ) ; String requestParam = request . getParameter ( getId ( ) ) ; final State newValue ; if ( "all" . equals ( requestParam ) ) { newValue = State . ALL ; } else if ( "none" . equals ( requ... | Override handleRequest to handle selection toggling if server - side processing is being used . |
19,299 | private static void setSelections ( final WComponent component , final boolean selected ) { if ( component instanceof WCheckBox ) { ( ( WCheckBox ) component ) . setSelected ( selected ) ; } else if ( component instanceof WCheckBoxSelect ) { WCheckBoxSelect select = ( WCheckBoxSelect ) component ; select . setSelected ... | Sets the selections for the given context . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.