idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
19,000
private static WComponent loadUI ( final String key ) { String classname = key . trim ( ) ; try { Class < ? > clas = Class . forName ( classname ) ; if ( WComponent . class . isAssignableFrom ( clas ) ) { WComponent instance = ( WComponent ) clas . newInstance ( ) ; LOG . debug ( "WComponent successfully loaded with cl...
Attempts to load a UI using the key as a class name .
19,001
private void addList ( final WList . Type type , final WList . Separator separator , final boolean renderBorder , final WComponent renderer ) { WList list = new WList ( type ) ; if ( separator != null ) { list . setSeparator ( separator ) ; } list . setRenderBorder ( renderBorder ) ; list . setRepeatedComponent ( rende...
Adds a list to the example .
19,002
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMenu menu = ( WMenu ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int rows = menu . getRows ( ) ; xml . appendTagOpen ( "ui:menu" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . app...
Paints the given WMenu .
19,003
public SearchInAppResponse searchInApp ( int appId , String query , Boolean counts , Boolean highlights , Integer limit , Integer offset , ReferenceTypeSearchInApp refType , String searchFields ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/search/app/" + appId + "/v2" ) ; resource = resource . ...
Searches in all items files and tasks in the application . The objects will be returned sorted descending by the time the object had any update .
19,004
private void renderOption ( final WMultiSelect listBox , final Object option , final int optionIndex , final XmlStringBuilder html , final List < ? > selections , final boolean renderSelectionsOnly ) { boolean selected = selections . contains ( option ) ; if ( selected || ! renderSelectionsOnly ) { String code = listBo...
Renders a single option within the list box .
19,005
public void paint ( final RenderContext renderContext ) { super . paint ( renderContext ) ; if ( ! DebugUtil . isDebugFeaturesEnabled ( ) || ! ( renderContext instanceof WebXmlRenderContext ) ) { return ; } XmlStringBuilder xml = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; xml . appendTag ( "ui:debug" )...
Override paint to render additional information for debugging purposes .
19,006
protected void writeDebugInfo ( final WComponent component , final XmlStringBuilder xml ) { if ( component != null && ( component . isVisible ( ) || component instanceof WInvisibleContainer ) ) { xml . appendTagOpen ( "ui:debugInfo" ) ; xml . appendAttribute ( "for" , component . getId ( ) ) ; xml . appendAttribute ( "...
Writes debugging information for the given component .
19,007
private String getType ( final WComponent component ) { for ( Class < ? > clazz = component . getClass ( ) ; clazz != null && WComponent . class . isAssignableFrom ( clazz ) ; clazz = clazz . getSuperclass ( ) ) { if ( "com.github.bordertech.wcomponents" . equals ( clazz . getPackage ( ) . getName ( ) ) ) { return claz...
Tries to return the type of component .
19,008
public static void deserializeSessionAttributes ( final HttpSession session ) { File file = new File ( SERIALIZE_SESSION_NAME ) ; FileInputStream fis = null ; ObjectInputStream ois = null ; if ( file . canRead ( ) ) { try { fis = new FileInputStream ( file ) ; ois = new ObjectInputStream ( fis ) ; List data = ( List ) ...
Attempts to deserialize the persisted session attributes into the given session .
19,009
public static synchronized void serializeSessionAttributes ( final HttpSession session ) { if ( session != null ) { File file = new File ( SERIALIZE_SESSION_NAME ) ; if ( ! file . exists ( ) || file . canWrite ( ) ) { List data = new ArrayList ( ) ; for ( Enumeration keyEnum = session . getAttributeNames ( ) ; keyEnum ...
Serializes the session attributes of the given session .
19,010
public static void incrementSessionStep ( final UIContext uic ) { int step = uic . getEnvironment ( ) . getStep ( ) ; uic . getEnvironment ( ) . setStep ( step + 1 ) ; }
Increments the step that is recorded in session .
19,011
public static int getRequestStep ( final Request request ) { String val = request . getParameter ( Environment . STEP_VARIABLE ) ; if ( val == null ) { return 0 ; } try { return Integer . parseInt ( val ) ; } catch ( NumberFormatException ex ) { return - 1 ; } }
Retrieves the value of the step variable from the given request .
19,012
public static boolean isStepOnRequest ( final Request request ) { String val = request . getParameter ( Environment . STEP_VARIABLE ) ; return val != null ; }
Checks if the step count is on the request .
19,013
public static boolean isCachedContentRequest ( final Request request ) { String targetId = request . getParameter ( Environment . TARGET_ID ) ; if ( targetId == null ) { return false ; } ComponentWithContext targetWithContext = WebUtilities . getComponentById ( targetId , true ) ; if ( targetWithContext == null ) { ret...
Check if the request is for cached content .
19,014
private synchronized HttpSubSession getSubSession ( ) { HttpSession backingSession = super . getSession ( ) ; Map < Integer , HttpSubSession > subsessions = ( Map < Integer , HttpSubSession > ) backingSession . getAttribute ( SESSION_MAP_KEY ) ; HttpSubSession subsession = subsessions . get ( sessionId ) ; subsession ....
Retrieves the subsession for this request . If there is no existing subsession a new one is created .
19,015
private void addSubordinate ( ) { WComponentGroup < SubordinateTarget > inputs = new WComponentGroup < > ( ) ; add ( inputs ) ; inputs . addToGroup ( checkBoxSelect ) ; inputs . addToGroup ( multiDropdown ) ; inputs . addToGroup ( multiSelect ) ; inputs . addToGroup ( multiSelectPair ) ; inputs . addToGroup ( dropdown ...
Setup the subordinate control .
19,016
private void addButtons ( ) { WButton buttonValidate = new WButton ( "Validate and Update Bean" ) ; add ( buttonValidate ) ; buttonValidate . setAction ( new ValidatingAction ( messages . getValidationErrors ( ) , layout ) { public void executeOnValid ( final ActionEvent event ) { WebUtilities . updateBeanValue ( layou...
Setup the action buttons .
19,017
public String getWServletPath ( ) { final String configValue = ConfigurationProperties . getServletSupportPath ( ) ; return configValue == null ? getPostPath ( ) : getServletPath ( configValue ) ; }
Construct the path to the support servlet . Web components that need to construct a URL to target this servlet will use this method .
19,018
private String getServletPath ( final String relativePath ) { if ( relativePath == null ) { LOG . error ( "relativePath must not be null" ) ; } String context = getHostFreeBaseUrl ( ) ; if ( ! Util . empty ( context ) ) { return context + relativePath ; } return relativePath ; }
Constructs the path to one of the various helper servlets . This is used by the more specific getXXXPath methods .
19,019
private static WComponent build ( ) { WContainer root = new WContainer ( ) ; WSubordinateControl control = new WSubordinateControl ( ) ; root . add ( control ) ; WFieldLayout layout = new WFieldLayout ( ) ; layout . setLabelWidth ( 25 ) ; layout . setMargin ( new com . github . bordertech . wcomponents . Margin ( 0 , 0...
Creates the component to be added to the validation container . This is doen in a static method because the component is passed into the superclass constructor .
19,020
public void paint ( final RenderContext renderContext ) { if ( ! DebugValidateXML . isEnabled ( ) ) { super . paint ( renderContext ) ; return ; } if ( ! ( renderContext instanceof WebXmlRenderContext ) ) { LOG . warn ( "Unable to validate against a " + renderContext ) ; super . paint ( renderContext ) ; return ; } LOG...
Override paint to include XML Validation .
19,021
private void paintOriginalXML ( final String originalXML , final PrintWriter writer ) { String xml = originalXML . replaceAll ( "<!\\[CDATA\\[" , "CDATASTART" ) ; xml = xml . replaceAll ( "\\]\\]>" , "CDATAFINISH" ) ; writer . println ( "<div>" ) ; writer . println ( "<!-- VALIDATE XML ERROR - START XML ) ; writer . p...
Paint the original XML wrapped in a CDATA Section .
19,022
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( ! this . isInitialised ( ) ) { List recent = loadRecentList ( ) ; if ( recent != null && ! recent . isEmpty ( ) ) { String selection = ( String ) recent . get ( 0 ) ; displaySelection ( selection ) ; } this...
When the example picker starts up we want to display the last selection the user made in their previous session . We can do this because the list of recent selections is stored in a file on the file system .
19,023
private void updateTitle ( ) { String title ; if ( this . getCurrentComponent ( ) == null ) { title = "Example Picker" ; } else { title = this . getCurrentComponent ( ) . getClass ( ) . getName ( ) ; } WApplication app = WebUtilities . getAncestorOfClass ( WApplication . class , this ) ; if ( app != null ) { app . setT...
Updates the title based on the selected example .
19,024
protected void afterPaint ( final RenderContext renderContext ) { super . afterPaint ( renderContext ) ; if ( profileBtn . isPressed ( ) ) { UicStats stats = new UicStats ( UIContextHolder . getCurrent ( ) ) ; WComponent currentComp = this . getCurrentComponent ( ) ; if ( currentComp != null ) { stats . analyseWC ( cur...
Override afterPaint in order to paint the UIContext serialization statistics if the profile button has been pressed .
19,025
private List loadRecentList ( ) { try { InputStream in = new BufferedInputStream ( new FileInputStream ( RECENT_FILE_NAME ) ) ; XMLDecoder d = new XMLDecoder ( in ) ; Object result = d . readObject ( ) ; d . close ( ) ; return ( List ) result ; } catch ( FileNotFoundException ex ) { return new ArrayList ( ) ; } }
Retrieves the list of recently selected examples from a file on the file system .
19,026
public Container getCurrentComponent ( ) { Container currentComponent = null ; if ( ( ( Container ) ( container . getChildAt ( 0 ) ) ) . getChildCount ( ) > 0 ) { currentComponent = ( Container ) container . getChildAt ( 0 ) ; } return currentComponent ; }
Retrieves the component that is currently being displayed by the example picker .
19,027
public void displaySelection ( final String selection ) { WComponent selectedComponent = UIRegistry . getInstance ( ) . getUI ( selection ) ; if ( selectedComponent == null ) { WMessages . getInstance ( this ) . error ( "Unable to load example: " + selection + ", see log for details." ) ; return ; } displaySelection ( ...
Get the example picker to display the given selection .
19,028
public void displaySelection ( final WComponent selectedComponent ) { WComponent currentComponent = getCurrentComponent ( ) ; if ( selectedComponent == currentComponent ) { return ; } container . removeAll ( ) ; container . add ( selectedComponent ) ; }
Get the example picker to display the given selected component .
19,029
private void storeRecentList ( final List recent ) { try { if ( recent == null ) { return ; } while ( recent . size ( ) > 8 ) { recent . remove ( recent . size ( ) - 1 ) ; } OutputStream out = new BufferedOutputStream ( new FileOutputStream ( RECENT_FILE_NAME ) ) ; XMLEncoder e = new XMLEncoder ( out ) ; e . writeObjec...
Store the list of recent selections to a file on the file system .
19,030
public static void setCurrentOperationDetails ( final AjaxOperation operation , final ComponentWithContext trigger ) { if ( operation == null ) { THREAD_LOCAL_OPERATION . remove ( ) ; } else { THREAD_LOCAL_OPERATION . set ( operation ) ; } if ( trigger == null ) { THREAD_LOCAL_COMPONENT_WITH_CONTEXT . remove ( ) ; } el...
Sets the current AJAX operation details .
19,031
public static AjaxOperation registerComponents ( final List < String > targetIds , final String triggerId ) { AjaxOperation operation = new AjaxOperation ( triggerId , targetIds ) ; registerAjaxOperation ( operation ) ; return operation ; }
Registers one or more components as being AJAX capable .
19,032
public static AjaxOperation registerComponent ( final String targetId , final String triggerId ) { AjaxOperation operation = new AjaxOperation ( triggerId , targetId ) ; registerAjaxOperation ( operation ) ; return operation ; }
Registers a single component as being AJAX capable .
19,033
public static AjaxOperation getAjaxOperation ( final String triggerId ) { Map < String , AjaxOperation > operations = getRegisteredOperations ( ) ; return operations == null ? null : operations . get ( triggerId ) ; }
Retrieves the AjaxOperation that has been registered for the given trigger . This method will return null if there is no corresponding operation registered .
19,034
public static void clearAllRegisteredOperations ( ) { UIContext uic = UIContextHolder . getCurrentPrimaryUIContext ( ) ; if ( uic != null ) { uic . setFwkAttribute ( AJAX_OPERATIONS_SESSION_KEY , null ) ; } }
Clear the registered AJAX operations for this user context .
19,035
private static void registerAjaxOperation ( final AjaxOperation operation ) { UIContext uic = UIContextHolder . getCurrentPrimaryUIContext ( ) ; if ( uic == null ) { throw new SystemException ( "No User Context Available to Register AJAX Operations." ) ; } Map < String , AjaxOperation > operations = ( Map < String , Aj...
The Ajax servlet needs access to the AjaxOperation Store the operation in the user context using the trigger Id as this will be present in the Servlet HttpRequest . agreed key . The ajax id is passed in the url to the servlet so it can then access the context .
19,036
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WCheckBoxSelect select = ( WCheckBoxSelect ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int cols = select . getButtonColumns ( ) ; boolean readOnly = select . isReadOnly ( ) ; xml . appendTagOpen ( "u...
Paints the given WCheckBoxSelect .
19,037
public WSubordinateControl build ( ) { if ( ! condition ( ) . validate ( ) ) { throw new SystemException ( "Invalid condition: " + condition ) ; } if ( getActionsWhenTrue ( ) . isEmpty ( ) && getActionsWhenFalse ( ) . isEmpty ( ) ) { throw new SystemException ( "No actions to execute" ) ; } WSubordinateControl subordin...
This builds the SubordinateControl . This method will throw a SystemException if the condition is invalid or there are no actions specified .
19,038
public void preparePaint ( final Request request ) { Headers headers = this . getUI ( ) . getHeaders ( ) ; headers . reset ( ) ; headers . setContentType ( WebUtilities . CONTENT_TYPE_XML ) ; super . preparePaint ( request ) ; }
Override preparePaint in order to prepare the headers .
19,039
public void paint ( final RenderContext renderContext ) { WebXmlRenderContext webRenderContext = ( WebXmlRenderContext ) renderContext ; PrintWriter writer = webRenderContext . getWriter ( ) ; beforePaint ( writer ) ; getBackingComponent ( ) . paint ( renderContext ) ; afterPaint ( writer ) ; }
Produce the html output .
19,040
protected void beforePaint ( final PrintWriter writer ) { PageShell pageShell = Factory . newInstance ( PageShell . class ) ; pageShell . openDoc ( writer ) ; pageShell . writeHeader ( writer ) ; }
Renders the content before the backing component .
19,041
protected void afterPaint ( final PrintWriter writer ) { PageShell pageShell = Factory . newInstance ( PageShell . class ) ; pageShell . writeFooter ( writer ) ; pageShell . closeDoc ( writer ) ; }
Renders the content after the backing component .
19,042
public void handleRequest ( final Request request ) { clearPressed ( ) ; String requestValue = request . getParameter ( getId ( ) ) ; boolean pressed = "x" . equals ( requestValue ) ; if ( pressed && ! "POST" . equals ( request . getMethod ( ) ) ) { LOG . warn ( "Button pressed on a request that is not a POST. Will be ...
Override handleRequest in order to perform processing for this component . This implementation checks whether the button has been pressed in the request .
19,043
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; if ( isAjax ( ) && uic . getUI ( ) != null ) { AjaxTarget target = getAjaxTarget ( ) ; AjaxHelper . registerComponent ( target . getId ( ) , getId ( ) ) ; } }
Override preparePaintComponent to register an AJAX operation if this button is AJAX enabled .
19,044
public String getValue ( ) { Object value = getData ( ) ; if ( value != null ) { return value . toString ( ) ; } String text = getText ( ) ; return text == null ? NO_VALUE : text ; }
Return the button value . By default the value is the same as the text placed on the button .
19,045
public void setImage ( final Image image ) { ButtonModel model = getOrCreateComponentModel ( ) ; model . image = image ; model . imageUrl = null ; }
Sets the image to display on the button . The text alternative for the image is generated from the button text .
19,046
protected void preparePaintComponent ( final Request request ) { if ( OPTION_CONTENT1 . equals ( rbSelect . getSelected ( ) ) ) { content . setText ( "This is content 1" ) ; } else if ( OPTION_CONTENT2 . equals ( rbSelect . getSelected ( ) ) ) { content . setText ( "This is content 2" ) ; } else if ( OPTION_CONTENT3 . ...
Set the content of the text field depending on the selected option in the radio button select .
19,047
public void execute ( ) { if ( condition == null ) { throw new SystemException ( "Rule cannot be executed as it has no condition" ) ; } if ( condition . isTrue ( ) ) { for ( Action action : onTrue ) { action . execute ( ) ; } } else { for ( Action action : onFalse ) { action . execute ( ) ; } } }
Executes the rule .
19,048
public static void applyRegisteredControls ( final Request request , final boolean useRequestValues ) { Set < String > controls = getRegisteredSubordinateControls ( ) ; if ( controls == null ) { return ; } for ( String controlId : controls ) { ComponentWithContext controlWithContext = WebUtilities . getComponentById ( ...
Apply the registered Subordinate Controls .
19,049
public static void clearAllRegisteredControls ( ) { UIContext uic = UIContextHolder . getCurrentPrimaryUIContext ( ) ; if ( uic != null ) { uic . setFwkAttribute ( SUBORDINATE_CONTROL_SESSION_KEY , null ) ; } }
Clear all registered Subordinate Controls on the session .
19,050
public void setContent ( final WComponent content ) { getOrCreateComponentModel ( ) . content = content ; holder . removeAll ( ) ; holder . add ( content ) ; }
Set the WComponent which will handle the content for this dialog .
19,051
public void setTitle ( final String title , final Serializable ... args ) { getOrCreateComponentModel ( ) . title = I18nUtilities . asMessage ( title , args ) ; }
Sets the dialog title .
19,052
public void setTrigger ( final DialogOpenTrigger trigger ) { if ( this . hasLegacyTriggerButton ( ) ) { DialogOpenTrigger theTrigger = getTrigger ( ) ; if ( theTrigger instanceof WButton ) { remove ( theTrigger ) ; } setLegacyTriggerButton ( false ) ; } getOrCreateComponentModel ( ) . trigger = trigger ; }
Set the component which will open the WDialog .
19,053
protected void handleTriggerOpenAction ( final Request request ) { final Action action = getTriggerOpenAction ( ) ; if ( action != null ) { final ActionEvent event = new ActionEvent ( this , OPEN_DIALOG_ACTION ) ; Runnable later = new Runnable ( ) { public void run ( ) { action . execute ( event ) ; } } ; invokeLater (...
Run the trigger open action .
19,054
public final boolean isAjaxTargeted ( ) { AjaxOperation operation = AjaxHelper . getCurrentOperation ( ) ; if ( operation == null ) { return false ; } String dialogId = getId ( ) ; String containerId = operation . getTargetContainerId ( ) ; if ( containerId != null && containerId . startsWith ( dialogId ) ) { return tr...
Indicates whether the dialog is currently the target of an AJAX operation .
19,055
public List < Application > getAppsOnSpace ( int spaceId ) { return getResourceFactory ( ) . getApiResource ( "/app/space/" + spaceId + "/" ) . get ( new GenericType < List < Application > > ( ) { } ) ; }
Returns all the apps on the space that are visible . The apps are sorted by any custom ordering and else by name .
19,056
public List < Application > getTopApps ( Integer limit ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/app/top/" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit . toString ( ) ) ; } return resource . get ( new GenericType < List < Application > > ( ) { } ) ; }
Returns the top apps for the active user . This is the apps that the user have interacted with the most .
19,057
public int addApp ( ApplicationCreate app ) { return getResourceFactory ( ) . getApiResource ( "/app/" ) . entity ( app , MediaType . APPLICATION_JSON_TYPE ) . post ( ApplicationCreateResponse . class ) . getId ( ) ; }
Creates a new app on a space .
19,058
public void updateApp ( int appId , ApplicationUpdate app ) { getResourceFactory ( ) . getApiResource ( "/app/" + appId ) . entity ( app , MediaType . APPLICATION_JSON ) . put ( ) ; }
Updates an app . The update can contain an new configuration for the app addition of new fields as well as updates to the configuration of existing fields . Fields not included will not be deleted . To delete a field use the delete field operation .
19,059
public int addField ( int appId , ApplicationFieldCreate field ) { return getResourceFactory ( ) . getApiResource ( "/app/" + appId + "/field/" ) . entity ( field , MediaType . APPLICATION_JSON_TYPE ) . post ( ApplicationFieldCreateResponse . class ) . getId ( ) ; }
Adds a new field to an app
19,060
public void updateField ( int appId , int fieldId , ApplicationFieldConfiguration configuration ) { getResourceFactory ( ) . getApiResource ( "/app/" + appId + "/field/" + fieldId ) . entity ( configuration , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates the configuration of an app field . The type of the field cannot be updated only the configuration .
19,061
public int install ( int appId , int spaceId ) { return getResourceFactory ( ) . getApiResource ( "/app/" + appId + "/install" ) . entity ( new ApplicationInstall ( spaceId ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ApplicationCreateResponse . class ) . getId ( ) ; }
Installs the app with the given id on the space .
19,062
public void updateOrder ( int spaceId , List < Integer > appIds ) { getResourceFactory ( ) . getApiResource ( "/app/space/" + spaceId + "/order" ) . entity ( appIds , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates the order of the apps on the space . It should post all the apps from the space in the order required .
19,063
public void deactivateApp ( int appId ) { getResourceFactory ( ) . getApiResource ( "/app/" + appId + "/deactivate" ) . entity ( new Empty ( ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ) ; }
Deactivates the app with the given id . This removes the app from the app navigator and disables insertion of new items .
19,064
public void downloadFile ( int fileId , java . io . File target , FileSize size ) throws IOException { WebResource builder = getResourceFactory ( ) . getFileResource ( "/" + fileId ) ; if ( size != null ) { builder = builder . path ( "/" + size . name ( ) . toLowerCase ( ) ) ; } byte [ ] data = builder . get ( byte [ ]...
Downloads the file and saves it to given file
19,065
public int uploadFile ( String name , java . io . File file ) { FileDataBodyPart filePart = new FileDataBodyPart ( "source" , file ) ; FormDataContentDisposition . FormDataContentDispositionBuilder builder = FormDataContentDisposition . name ( filePart . getName ( ) ) ; builder . fileName ( file . getName ( ) ) ; build...
Uploads the file to the API
19,066
public void updateFile ( int fileId , FileUpdate update ) { getResourceFactory ( ) . getApiResource ( "/file/" + fileId ) . entity ( update , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Used to update the description of the file .
19,067
public List < File > getOnApp ( int appId , Integer limit , Integer offset ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/file/app/" + appId + "/" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit . toString ( ) ) ; } if ( offset != null ) { resource = resource . quer...
Returns all the files related to the items in the application . This includes files both on the item itself and in comments on the item .
19,068
public List < File > getOnSpace ( int spaceId , Integer limit , Integer offset ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/file/space/" + spaceId + "/" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit . toString ( ) ) ; } if ( offset != null ) { resource = resourc...
Returns all the files on the space order by the file name .
19,069
public List < Diagnostic > validate ( final List < Diagnostic > diags ) { if ( ! isValid ( ) ) { List < Serializable > argList = getMessageArguments ( ) ; Serializable [ ] args = argList . toArray ( new Serializable [ argList . size ( ) ] ) ; diags . add ( new DiagnosticImpl ( Diagnostic . ERROR , input , getErrorMessa...
Validates the input field .
19,070
public R between ( int lower , int upper ) { expr ( ) . between ( _name , lower , upper ) ; return _root ; }
Between lower and upper values .
19,071
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WFieldSet fieldSet = ( WFieldSet ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:fieldset" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttri...
Paints the given WFieldSet .
19,072
private WApplication findApplication ( ) { WApplication appl = WApplication . instance ( this ) ; if ( appl == null ) { messages . addMessage ( new Message ( Message . WARNING_MESSAGE , "There is no WApplication available for this example." ) ) ; } return appl ; }
Find the closest WApplication instance .
19,073
public void addTaggedComponent ( final String tag , final WComponent component ) { if ( Util . empty ( tag ) ) { throw new IllegalArgumentException ( "A tag must be provided." ) ; } if ( component == null ) { throw new IllegalArgumentException ( "A component must be provided." ) ; } TemplateModel model = getOrCreateCom...
Add a tagged component to be included in the template . The component will be rendered in place of the corresponding tag in the template .
19,074
public void removeTaggedComponent ( final WComponent component ) { TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . taggedComponents != null ) { String tag = null ; for ( Map . Entry < String , WComponent > entry : model . taggedComponents . entrySet ( ) ) { if ( entry . getValue ( ) . equals ( compon...
Remove a tagged component via the component instance .
19,075
public void removeTaggedComponent ( final String tag ) { TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . taggedComponents != null ) { WComponent component = model . taggedComponents . remove ( tag ) ; if ( model . taggedComponents . isEmpty ( ) ) { model . taggedComponents = null ; } if ( component !...
Remove a tagged component by its tag .
19,076
public void addParameter ( final String tag , final Object value ) { if ( Util . empty ( tag ) ) { throw new IllegalArgumentException ( "A tag must be provided" ) ; } TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . parameters == null ) { model . parameters = new HashMap < > ( ) ; } model . parameters...
Add a template parameter .
19,077
public void setEngineName ( final TemplateRendererFactory . TemplateEngine templateEngine ) { setEngineName ( templateEngine == null ? null : templateEngine . getEngineName ( ) ) ; }
Set a predefined template engine . If null then the default engine is used .
19,078
public void removeEngineOption ( final String key ) { TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . engineOptions != null ) { model . engineOptions . remove ( key ) ; } }
Remove a template engine option .
19,079
public static Date createDate ( final int day , final int month , final int year ) { Calendar cal = Calendar . getInstance ( ) ; cal . clear ( ) ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; cal . set ( Calendar . MONTH , month - 1 ) ; cal . set ( Calendar . YEAR , year ) ; return cal . getTime ( ) ; }
Creates a date from the given components .
19,080
public void preparePaint ( final Request request ) { Headers headers = this . getUI ( ) . getHeaders ( ) ; headers . reset ( ) ; super . preparePaint ( request ) ; }
Override preparePaint in order to perform processing specific to this interceptor . Any old headers are cleared out before preparePaint is called on the main UI .
19,081
public void paint ( final RenderContext renderContext ) { if ( renderContext instanceof WebXmlRenderContext ) { PageContentHelper . addAllHeadlines ( ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) , getUI ( ) . getHeaders ( ) ) ; } getBackingComponent ( ) . paint ( renderContext ) ; }
Override paint in order to perform processing specific to this interceptor . This implementation is responsible for rendering the headlines for the UI .
19,082
public void handleRequest ( final Request request ) { super . handleRequest ( request ) ; WComponent visibleDialog = getVisible ( ) ; if ( visibleDialog != null ) { visibleDialog . serviceRequest ( request ) ; } }
Since none of the children are visible to standard processing handleRequest has been overridden so that the visible card is processed .
19,083
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; WComponent visibleDialog = getVisible ( ) ; if ( visibleDialog != null ) { visibleDialog . preparePaint ( request ) ; } }
Since none of the children are visible to standard processing preparePaintComponent has been overridden so that the visible card is prepared .
19,084
protected void paintComponent ( final RenderContext renderContext ) { super . paintComponent ( renderContext ) ; WComponent visibleDialog = getVisible ( ) ; if ( visibleDialog != null ) { visibleDialog . paint ( renderContext ) ; } }
Since none of the children are visible to standard processing paintComponent has been overridden so that the visible card is painted .
19,085
protected void validateComponent ( final List < Diagnostic > diags ) { super . validateComponent ( diags ) ; WComponent visibleDialog = getVisible ( ) ; if ( visibleDialog != null ) { visibleDialog . validate ( diags ) ; } }
Since none of the children are visible to standard processing validateComponent has been overridden so that the visible card is processed .
19,086
public void showErrorIndicators ( final List < Diagnostic > diags ) { WComponent visibleComponent = getVisible ( ) ; visibleComponent . showErrorIndicators ( diags ) ; }
Override method to show Error indicators on the visible card .
19,087
public void showWarningIndicators ( final List < Diagnostic > diags ) { WComponent visibleComponent = getVisible ( ) ; visibleComponent . showWarningIndicators ( diags ) ; }
Override method to show Warning indicators on the visible card .
19,088
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WList list = ( WList ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WList . Type type = list . getType ( ) ; WList . Separator separator = list . getSeparator ( ) ; Size gap = list . getSpace ( ) ; Stri...
Paints the given WList .
19,089
private void addInteractiveExamples ( ) { add ( new WHeading ( HeadingLevel . H2 , "Simple WCheckBoxSelect examples" ) ) ; addExampleUsingLookupTable ( ) ; addExampleUsingArrayList ( ) ; addExampleUsingStringArray ( ) ; addInsideAFieldLayoutExamples ( ) ; add ( new WHeading ( HeadingLevel . H2 , "Examples showing LAYOU...
Simple interactive - state WCheckBoxSelect examples .
19,090
private void addExampleUsingStringArray ( ) { add ( new WHeading ( HeadingLevel . H3 , "WCheckBoxSelect created using a String array" ) ) ; String [ ] options = new String [ ] { "Dog" , "Cat" , "Bird" , "Turtle" } ; final WCheckBoxSelect select = new WCheckBoxSelect ( options ) ; select . setToolTip ( "Animals" ) ; sel...
This example creates the WCheckBoxSelect from an array of Strings .
19,091
private void addExampleUsingArrayList ( ) { add ( new WHeading ( HeadingLevel . H3 , "WCheckBoxSelect created using an array list of options" ) ) ; List < CarOption > options = new ArrayList < > ( ) ; options . add ( new CarOption ( "1" , "Ferrari" , "F-360" ) ) ; options . add ( new CarOption ( "2" , "Mercedez Benz" ,...
This example creates the WCheckBoxSelect from a List of CarOptions .
19,092
private void addInsideAFieldLayoutExamples ( ) { add ( new WHeading ( HeadingLevel . H3 , "WCheckBoxSelect inside a WFieldLayout" ) ) ; add ( new ExplanatoryText ( "When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular " + "HTML label. This allows WCheckBoxSele...
When a WCheckBoxSelect is added to a WFieldLayout the legend is moved . The first CheckBoxSelect has a frame the second doesn t
19,093
private void addColumnSelectExample ( ) { add ( new WHeading ( HeadingLevel . H3 , "WCheckBoxSelect laid out in columns" ) ) ; add ( new ExplanatoryText ( "Setting the layout to COLUMN will make the check boxes be rendered in 'n' columns. The number of columns is" + " determined by the layoutColumnCount property." ) ) ...
adds a WCheckBoxSelect with LAYOUT_COLUMN in 2 columns .
19,094
private void addAntiPatternExamples ( ) { add ( new WHeading ( HeadingLevel . H2 , "WCheckBoxSelect anti-pattern examples" ) ) ; add ( new WMessageBox ( WMessageBox . WARN , "These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them." ) ) ; add ( new...
Examples of what not to do when using WCheckBoxSelect .
19,095
private void paintAjaxTrigger ( final WLink link , final XmlStringBuilder xml ) { AjaxTarget [ ] actionTargets = link . getActionTargets ( ) ; xml . appendTagOpen ( "ui:ajaxtrigger" ) ; xml . appendAttribute ( "triggerId" , link . getId ( ) ) ; xml . appendClose ( ) ; if ( actionTargets != null && actionTargets . lengt...
Paint the AJAX trigger if the link has an action .
19,096
public void paint ( final RenderContext renderContext ) { if ( ! ( renderContext instanceof WebXmlRenderContext ) ) { throw new SystemException ( "Unable to render to " + renderContext ) ; } PrintWriter writer = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; Template template = null ; try { template = Velo...
Renders the component using the velocity template which has been provided .
19,097
private static String [ ] getRegions ( final String state ) { if ( "ACT" . equals ( state ) ) { return ACT_REGIONS ; } else if ( "VIC" . equals ( state ) ) { return VIC_REGIONS ; } else { return null ; } }
Retrieves the regions in a state .
19,098
private static String [ ] getSuburbs ( final String region ) { if ( "Tuggeranong" . equals ( region ) ) { return TUGGERANONG_SUBURBS ; } else if ( "Woden" . equals ( region ) ) { return WODEN_SUBURBS ; } else if ( "Melbourne" . equals ( region ) ) { return MELBOURNE_SUBURBS ; } else if ( "Mornington Peninsula" . equals...
Retrieves the suburbs in a region .
19,099
private void applySettings ( ) { container . reset ( ) ; WText component1 = new WText ( "Here is some text that is collapsible via ajax." ) ; WCollapsible collapsible1 = new WCollapsible ( component1 , "Collapsible" , ( CollapsibleMode ) rbCollapsibleSelect . getSelected ( ) ) ; collapsible1 . setCollapsed ( cbCollapse...
applySettings creates the WCollapsible and loads it into the container .