idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
19,100
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMenuItemGroup group = ( WMenuItemGroup ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:menugroup" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptio...
Paints the given WMenuItemGroup .
19,101
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMultiDropdown dropdown = ( WMultiDropdown ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String dataKey = dropdown . getListCacheKey ( ) ; boolean readOnly = dropdown . isReadOnly ( ) ; xml . appendTag...
Paints the given WMultiDropdown .
19,102
public void setData ( final List data ) { String [ ] properties = new String [ ] { "colour" , "shape" , "animal" } ; simpleTable . setDataModel ( new SimpleBeanListTableDataModel ( properties , data ) ) ; }
Sets the table data .
19,103
public void setMandatory ( final boolean mandatory , final String message ) { setFlag ( ComponentModel . MANDATORY_FLAG , mandatory ) ; getOrCreateComponentModel ( ) . errorMessage = message ; }
Set whether or not this field set is mandatory and customise the error message that will be displayed .
19,104
private boolean hasInputWithValue ( ) { AbstractVisitorWithResult < Boolean > visitor = new AbstractVisitorWithResult < Boolean > ( ) { public WComponentTreeVisitor . VisitorResult visit ( final WComponent comp ) { if ( comp instanceof Input && ! ( ( Input ) comp ) . isEmpty ( ) ) { setResult ( true ) ; return VisitorR...
Checks at least one input component has a value .
19,105
private static void processJsonToTree ( final TreeItemIdNode parentNode , final JsonObject json ) { String id = json . getAsJsonPrimitive ( "id" ) . getAsString ( ) ; JsonPrimitive expandableJson = json . getAsJsonPrimitive ( "expandable" ) ; TreeItemIdNode node = new TreeItemIdNode ( id ) ; if ( expandableJson != null...
Iterate over the JSON objects to create the tree structure .
19,106
public R fetchQuery ( String path , String properties ) { query . fetchQuery ( path , properties ) ; return root ; }
Specify a path and properties to load using a query join .
19,107
private R pushExprList ( ExpressionList < T > list ) { if ( textMode ) { textStack . push ( list ) ; } else { whereStack . push ( list ) ; } return root ; }
Push the expression list onto the appropriate stack .
19,108
protected ExpressionList < T > peekExprList ( ) { if ( textMode ) { return _peekText ( ) ; } if ( whereStack == null ) { whereStack = new ArrayStack < > ( ) ; whereStack . push ( query . where ( ) ) ; } return whereStack . peek ( ) ; }
Return the current expression list that expressions should be added to .
19,109
public ExpressionBuilder notEquals ( final SubordinateTrigger trigger , final Object compare ) { BooleanExpression exp = new CompareExpression ( CompareType . NOT_EQUAL , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a not equals test to the condition .
19,110
public ExpressionBuilder lessThan ( final SubordinateTrigger trigger , final Object compare ) { BooleanExpression exp = new CompareExpression ( CompareType . LESS_THAN , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a less than test to the condition .
19,111
public ExpressionBuilder lessThanOrEquals ( final SubordinateTrigger trigger , final Object compare ) { BooleanExpression exp = new CompareExpression ( CompareType . LESS_THAN_OR_EQUAL , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a less than or equals test to the condition .
19,112
public ExpressionBuilder greaterThan ( final SubordinateTrigger trigger , final Object compare ) { BooleanExpression exp = new CompareExpression ( CompareType . GREATER_THAN , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a greater than test to the condition .
19,113
public ExpressionBuilder greaterThanOrEquals ( final SubordinateTrigger trigger , final Object compare ) { BooleanExpression exp = new CompareExpression ( CompareType . GREATER_THAN_OR_EQUAL , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a greater than or equals test to the condition .
19,114
public ExpressionBuilder matches ( final SubordinateTrigger trigger , final String compare ) { BooleanExpression exp = new CompareExpression ( CompareType . MATCH , trigger , compare ) ; appendExpression ( exp ) ; return this ; }
Appends a matches test to the condition .
19,115
public ExpressionBuilder or ( ) { GroupExpression lastGroupExpression = stack . isEmpty ( ) ? null : stack . peek ( ) ; if ( lhsExpression == null ) { throw new SyntaxException ( "Syntax exception: OR missing LHS operand" ) ; } else if ( lastGroupExpression == null ) { GroupExpression or = new GroupExpression ( GroupEx...
Appends an OR expression to the RHS of the expression . The current RHS of the expression must be an Operand .
19,116
public ExpressionBuilder and ( ) { GroupExpression lastGroupExpression = stack . isEmpty ( ) ? null : stack . peek ( ) ; if ( lhsExpression == null ) { throw new SyntaxException ( "Syntax exception: AND missing LHS operand" ) ; } else if ( lastGroupExpression == null ) { GroupExpression and = new GroupExpression ( Grou...
Appends an AND expression to the RHS of the expression . The current RHS of the expression must be an Operand .
19,117
public ExpressionBuilder not ( final ExpressionBuilder exp ) { GroupExpression not = new GroupExpression ( Type . NOT ) ; not . add ( exp . expression . getExpression ( ) ) ; appendExpression ( not ) ; return this ; }
Appends a NOT expression to this expression .
19,118
private void appendExpression ( final BooleanExpression newExpression ) { if ( lhsExpression != null ) { throw new SyntaxException ( "Syntax exception: use AND or OR to join expressions" ) ; } lhsExpression = newExpression ; GroupExpression currentExpression = stack . isEmpty ( ) ? null : stack . peek ( ) ; if ( curren...
Appends the given expression to this expression .
19,119
public boolean validate ( ) { try { BooleanExpression built = expression . getExpression ( ) ; if ( built == null ) { return false ; } checkNesting ( built , new ArrayList < BooleanExpression > ( ) ) ; built . evaluate ( ) ; } catch ( Exception e ) { LogFactory . getLog ( getClass ( ) ) . warn ( "Invalid expression: " ...
Determines whether the current expression is syntactically correct .
19,120
private static void checkNesting ( final BooleanExpression expression , final List < BooleanExpression > visitedExpressions ) { if ( visitedExpressions . contains ( expression ) ) { throw new SyntaxException ( "An expression can not contain itself." ) ; } visitedExpressions . add ( expression ) ; if ( expression instan...
Checks nesting of expressions to ensure we don t end up in an infinite recursive loop during evaluation .
19,121
private WFieldSet getDropDownControls ( ) { WFieldSet fieldSet = new WFieldSet ( "Drop down configuration" ) ; WFieldLayout layout = new WFieldLayout ( ) ; layout . setLabelWidth ( 25 ) ; fieldSet . add ( layout ) ; rbsDDType . setButtonLayout ( WRadioButtonSelect . LAYOUT_FLAT ) ; rbsDDType . setSelected ( WDropdown ....
build the drop down controls .
19,122
private void applySettings ( ) { container . reset ( ) ; infoPanel . reset ( ) ; List < String > options = new ArrayList < > ( Arrays . asList ( OPTIONS_ARRAY ) ) ; if ( cbNullOption . isSelected ( ) ) { options . add ( 0 , "" ) ; } final WDropdown dropdown = new WDropdown ( options ) ; dropdown . setType ( ( DropdownT...
Apply the settings from the control table to the drop down .
19,123
private void buildSubordinatePanel ( final WDropdown dropdown , final String value , final WComponentGroup < SubordinateTarget > group , final WSubordinateControl control ) { WPanel panel = new WPanel ( ) ; WStyledText subordinateInfo = new WStyledText ( ) ; subordinateInfo . setWhitespaceMode ( WhitespaceMode . PRESER...
Builds a panel for the subordinate control including the rule for that particular option .
19,124
public void setDateHeader ( final String name , final long value ) { headers . put ( name , String . valueOf ( value ) ) ; }
Sets a date header .
19,125
public void setIntHeader ( final String name , final int value ) { headers . put ( name , String . valueOf ( value ) ) ; }
Sets an integer header .
19,126
public void execute ( ) { if ( target instanceof WComponentGroup < ? > ) { for ( WComponent component : ( ( WComponentGroup < WComponent > ) target ) . getComponents ( ) ) { if ( component instanceof SubordinateTarget ) { applyAction ( ( SubordinateTarget ) component , value ) ; } } } else { applyAction ( target , valu...
Execute the action .
19,127
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WStyledText text = ( WStyledText ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String textString = text . getText ( ) ; if ( textString != null && textString . length ( ) > 0 ) { xml . appendTagOpen ( ...
Paints the given WStyledText .
19,128
private static void writeParagraphs ( final String text , final XmlStringBuilder xml ) { if ( ! Util . empty ( text ) ) { int start = 0 ; int end = text . length ( ) - 1 ; for ( ; start < end ; start ++ ) { char c = text . charAt ( start ) ; if ( c != '\n' && c != '\r' ) { break ; } } for ( ; start < end ; end -- ) { c...
Writes out paragraph delimited content .
19,129
public static void write ( final PrintWriter writer , final UicStats stats ) { writer . println ( "<dl>" ) ; writer . print ( "<dt>Total root wcomponents found in UIC</dt>" ) ; writer . println ( "<dd>" + stats . getRootWCs ( ) . size ( ) + "</dd>" ) ; writer . print ( "<dt>Size of UIC (by serialization)</dt>" ) ; writ...
Writes out the given statistics in HTML format .
19,130
private static void writeProfileForTree ( final PrintWriter writer , final Map < WComponent , UicStats . Stat > treeStats ) { List < UicStats . Stat > statList = new ArrayList < > ( treeStats . values ( ) ) ; Comparator < UicStats . Stat > comparator = new Comparator < UicStats . Stat > ( ) { public int compare ( final...
Writes the stats for a single component .
19,131
private static void writeHeader ( final PrintWriter writer ) { writer . println ( "<table>" ) ; writer . println ( "<thead>" ) ; writer . print ( "<tr>" ) ; writer . print ( "<th>Class</th>" ) ; writer . print ( "<th>Model</th>" ) ; writer . print ( "<th>Size</th>" ) ; writer . print ( "<th>Ref.</th>" ) ; writer . prin...
Writes the stats header HTML .
19,132
private static void writeRow ( final PrintWriter writer , final UicStats . Stat stat ) { writer . print ( "<tr>" ) ; writer . print ( "<td>" + stat . getClassName ( ) + "</td>" ) ; writer . print ( "<td>" + stat . getModelStateAsString ( ) + "</td>" ) ; if ( stat . getSerializedSize ( ) > 0 ) { writer . print ( "<td>" ...
Writes a row containing a single stat .
19,133
private void changePage ( final int direction ) { int currentPage = pages . indexOf ( cardManager . getVisible ( ) ) ; currentPage = Math . min ( 2 , Math . max ( 0 , currentPage + direction ) ) ; cardManager . makeVisible ( pages . get ( currentPage ) ) ; prevButton . setDisabled ( currentPage == 0 ) ; nextButton . se...
Handles a pagination request .
19,134
private String trackKindToString ( final Track . Kind kind ) { if ( kind == null ) { return null ; } switch ( kind ) { case SUBTITLES : return "subtitles" ; case CAPTIONS : return "captions" ; case DESCRIPTIONS : return "descriptions" ; case CHAPTERS : return "chapters" ; case METADATA : return "metadata" ; default : L...
Converts a Track kind to the client track kind identifier .
19,135
public void processAction ( ) throws IOException { if ( isDisposed ( ) ) { LOG . error ( "Skipping action phase. Attempt to reuse disposed ContainerHelper instance" ) ; return ; } try { if ( getNewConversation ( ) == null ) { throw new IllegalStateException ( "User context has not been prepared before the action phase"...
Support standard processing of the action phase of a request .
19,136
public void render ( ) throws IOException { if ( isDisposed ( ) ) { LOG . debug ( "Skipping render phase." ) ; return ; } try { if ( getNewConversation ( ) == null ) { throw new IllegalStateException ( "User context has not been prepared before the render phase" ) ; } prepareRender ( ) ; UIContext uic = getUIContext ( ...
Support standard processing of the render phase of a request .
19,137
protected void cycleUIContext ( ) { boolean cycleIt = ConfigurationProperties . getDeveloperClusterEmulation ( ) ; if ( cycleIt ) { UIContext uic = getUIContext ( ) ; if ( uic instanceof UIContextWrap ) { LOG . info ( "Cycling the UIContext to simulate clustering" ) ; ( ( UIContextWrap ) uic ) . cycle ( ) ; } } }
Call this method to simulate what would happen if the UIContext was serialized due to clustering of servers .
19,138
protected void prepareRequest ( ) { LOG . debug ( "Preparing for request by adding headers and environment to top wcomponent" ) ; UIContext uiContext = getUIContext ( ) ; Environment env ; if ( uiContext . isDummyEnvironment ( ) ) { env = createEnvironment ( ) ; uiContext . setEnvironment ( env ) ; } else { env = uiCon...
Prepare the session for the current request .
19,139
private void propogateError ( final Throwable error ) { if ( getRequest ( ) == null ) { LOG . error ( "Unable to remember error from action phase beyond this request" ) ; } else { LOG . debug ( "Remembering error from action phase" ) ; getRequest ( ) . setAttribute ( ACTION_ERROR_KEY , error ) ; } }
Propogates an error from the action phase to the render phase .
19,140
private boolean havePropogatedError ( ) { Request req = getRequest ( ) ; return req != null && req . getAttribute ( ACTION_ERROR_KEY ) != null ; }
Indicates whether there is an error which has been propogated from the action to the render phase .
19,141
private Throwable getPropogatedError ( ) { Request req = getRequest ( ) ; if ( req != null ) { return ( Throwable ) req . getAttribute ( ACTION_ERROR_KEY ) ; } return null ; }
Retrieves an error which has been propogated from the action to the render phase .
19,142
public void handleError ( final Throwable error ) throws IOException { LOG . debug ( "Start handleError..." ) ; boolean terminate = ConfigurationProperties . getTerminateSessionOnError ( ) ; if ( terminate ) { invalidateSession ( ) ; } boolean friendly = ConfigurationProperties . getDeveloperErrorHandling ( ) ; FatalEr...
Last resort error handling .
19,143
protected String renderErrorPageToHTML ( final WComponent errorPage ) { boolean defaultErrorPage = errorPage instanceof FatalErrorPage ; String html = null ; if ( ! defaultErrorPage ) { UIContext uic = new UIContextImpl ( ) ; uic . setEnvironment ( createEnvironment ( ) ) ; UIContextHolder . pushContext ( uic ) ; try {...
Render the error page component to HTML .
19,144
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WFieldLayout fieldLayout = ( WFieldLayout ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int labelWidth = fieldLayout . getLabelWidth ( ) ; String title = fieldLayout . getTitle ( ) ; xml . appendTagOpe...
Paints the given WFieldLayout .
19,145
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WAbbrText abbrText = ( WAbbrText ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "abbr" ) ; xml . appendOptionalAttribute ( "title" , abbrText . getToolTip ( ) ) ; xml . appendOptio...
Paints the given WAbbrText .
19,146
public Cookie [ ] getCookies ( ) { Collection < Cookie > entries = cookies . values ( ) ; return entries . toArray ( new Cookie [ 0 ] ) ; }
Get all the cookies on this request .
19,147
public void setCookie ( final String name , final String value ) { if ( name != null ) { Cookie cookie = new Cookie ( name , value ) ; cookies . put ( name , cookie ) ; } }
Sets a cookie on this request instance .
19,148
public void setParameter ( final String name , final String value ) { String [ ] currentValue = ( String [ ] ) parameters . get ( name ) ; if ( currentValue == null ) { currentValue = new String [ ] { value } ; } else { String [ ] newValues = new String [ currentValue . length + 1 ] ; System . arraycopy ( currentValue ...
Sets a parameter . If the parameter already exists another value will be added to the parameter values .
19,149
public static < T > T newInstance ( final Class < T > interfaz ) { String classname = ConfigurationProperties . getFactoryImplementation ( interfaz . getName ( ) ) ; if ( classname == null ) { LOG . fatal ( "No implementing class for " + interfaz . getName ( ) ) ; LOG . fatal ( "There needs to be a parameter defined fo...
Given an interface instantiate a class implementing that interface .
19,150
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMultiSelectPair multiSelectPair = ( WMultiSelectPair ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = multiSelectPair . isReadOnly ( ) ; xml . appendTagOpen ( "ui:multiselectpair" ) ; ...
Paints the given WMultiSelectPair .
19,151
private int renderOrderedOptions ( final WMultiSelectPair multiSelectPair , final List < ? > options , final int startIndex , final XmlStringBuilder xml , final boolean renderSelectionsOnly ) { List < ? > selections = multiSelectPair . getSelected ( ) ; int optionIndex = startIndex ; Map < Integer , Integer > currentSe...
Renders the options in selection order . Note though that this does not support the legacy allowNull or setSelected using String representations .
19,152
private int renderUnorderedOptions ( final WMultiSelectPair multiSelectPair , final List < ? > options , final int startIndex , final XmlStringBuilder xml , final boolean renderSelectionsOnly ) { List < ? > selections = multiSelectPair . getSelected ( ) ; int optionIndex = startIndex ; for ( Object option : options ) {...
Renders the options in list order .
19,153
public List < Conversation > getConversationsOnObject ( Reference object ) { return getResourceFactory ( ) . getApiResource ( "/conversation/" + object . toURLFragment ( ) ) . get ( new GenericType < List < Conversation > > ( ) { } ) ; }
Returns a list of all the conversations on the object that the active user is part of .
19,154
public int addReply ( int conversationId , String text ) { return getResourceFactory ( ) . getApiResource ( "/conversation/" + conversationId + "/reply" ) . entity ( new MessageCreate ( text ) , MediaType . APPLICATION_JSON_TYPE ) . get ( MessageCreateResponse . class ) . getMessageId ( ) ; }
Creates a reply to the conversation .
19,155
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WApplication application = ( WApplication ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; String focusId = uic . getFocussedId ( ) ; if ( application . ...
Paints the given WApplication .
19,156
protected void preparePaintComponent ( final Request request ) { StringBuffer text = new StringBuffer ( "Options: " ) ; for ( Object option : shuffler . getOptions ( ) ) { text . append ( option ) . append ( ", " ) ; } order . setText ( text . toString ( ) ) ; }
Concatenate the options to display in the text field .
19,157
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WMultiTextField textField = ( WMultiTextField ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = textField . isReadOnly ( ) ; String [ ] values = textField . getTextInputs ( ) ; xml . app...
Paints the given WMultiTextField .
19,158
private static ExampleBean fakeServiceCall ( final String text ) { ExampleBean exampleBean = new ExampleBean ( ) ; exampleBean . setBeanAttribute ( "(beanAttribute) " + text ) ; ExampleBean . DummyInnerBean dummyInnerBean = new ExampleBean . DummyInnerBean ( ) ; dummyInnerBean . setInnerAttribute ( "(innerBean.innerAtt...
Fakes a service call and just returns dummy data .
19,159
public static void processRequest ( final HttpServletHelper helper , final WComponent ui , final InterceptorComponent interceptorChain ) throws ServletException , IOException { try { if ( interceptorChain == null ) { helper . setWebComponent ( ui ) ; } else { interceptorChain . attachUI ( ui ) ; helper . setWebComponen...
This method does the real work in servicing the http request . It integrates wcomponents into a servlet environment via a servlet specific helper class .
19,160
public static void handleStaticResourceRequest ( final HttpServletRequest request , final HttpServletResponse response ) { String staticRequest = request . getParameter ( WServlet . STATIC_RESOURCE_PARAM_NAME ) ; try { InternalResource staticResource = InternalResourceMap . getResource ( staticRequest ) ; boolean heade...
Handles a request for static resources .
19,161
public static void handleThemeResourceRequest ( final HttpServletRequest req , final HttpServletResponse resp ) throws ServletException , IOException { if ( req . getHeader ( "If-Modified-Since" ) != null ) { resp . reset ( ) ; resp . setStatus ( HttpServletResponse . SC_NOT_MODIFIED ) ; return ; } String fileName = re...
Serves up a file from the theme . In practice it is generally a bad idea to use this servlet to serve up static resources . Instead it would make more sense to move CSS JS HTML resources to a CDN or similar .
19,162
private static boolean checkThemeFile ( final String name ) { return ! ( Util . empty ( name ) || name . contains ( ".." ) || name . charAt ( 0 ) == '/' || name . indexOf ( ':' ) != - 1 ) ; }
Performs basic sanity checks on the file being requested .
19,163
public static InterceptorComponent createInterceptorChain ( final HttpServletRequest request ) { Map < String , String [ ] > parameters = getRequestParameters ( request ) ; InterceptorComponent [ ] chain ; if ( parameters . get ( WServlet . DATA_LIST_PARAM_NAME ) != null ) { chain = new InterceptorComponent [ ] { new T...
Creates a new interceptor chain to handle the given request .
19,164
public static Map < String , String [ ] > getRequestParameters ( final HttpServletRequest request ) { if ( request . getAttribute ( REQUEST_PROCESSED_KEY ) == null ) { setupRequestParameters ( request ) ; } return ( Map < String , String [ ] > ) request . getAttribute ( REQUEST_PARAMETERS_KEY ) ; }
Get a map of request parameters allowing for multi part form fields .
19,165
public static String getRequestParameterValue ( final HttpServletRequest request , final String key ) { String [ ] values = getRequestParameterValues ( request , key ) ; return values == null || values . length == 0 ? null : values [ 0 ] ; }
Get a value for a request parameter allowing for multi part form fields .
19,166
public static String [ ] getRequestParameterValues ( final HttpServletRequest request , final String key ) { return getRequestParameters ( request ) . get ( key ) ; }
Get the values for a request parameter allowing for multi part form fields .
19,167
public static Map < String , FileItem [ ] > getRequestFileItems ( final HttpServletRequest request ) { if ( request . getAttribute ( REQUEST_PROCESSED_KEY ) == null ) { setupRequestParameters ( request ) ; } return ( Map < String , FileItem [ ] > ) request . getAttribute ( REQUEST_FILES_KEY ) ; }
Get a map of file items in the request allowing for multi part form fields .
19,168
public static FileItem getRequestFileItemValue ( final HttpServletRequest request , final String key ) { FileItem [ ] values = getRequestFileItemValues ( request , key ) ; return values == null || values . length == 0 ? null : values [ 0 ] ; }
Get a file item value from the request allowing for multi part form fields .
19,169
public static FileItem [ ] getRequestFileItemValues ( final HttpServletRequest request , final String key ) { return getRequestFileItems ( request ) . get ( key ) ; }
Get file item values from the request allowing for multi part form fields .
19,170
public static void setupRequestParameters ( final HttpServletRequest request ) { if ( request . getAttribute ( REQUEST_PROCESSED_KEY ) != null ) { return ; } Map < String , String [ ] > parameters = new HashMap < > ( ) ; Map < String , FileItem [ ] > files = new HashMap < > ( ) ; extractParameterMap ( request , paramet...
Process the request parameters allowing for multi part form fields .
19,171
public static void extractParameterMap ( final HttpServletRequest request , final Map < String , String [ ] > parameters , final Map < String , FileItem [ ] > files ) { if ( isMultipart ( request ) ) { ServletFileUpload upload = new ServletFileUpload ( ) ; upload . setFileItemFactory ( new DiskFileItemFactory ( ) ) ; t...
Extract the parameters and file items allowing for multi part form fields .
19,172
public static String extractCookie ( final HttpServletRequest request , final String name ) { for ( Cookie cookie : request . getCookies ( ) ) { if ( cookie . getName ( ) . equals ( name ) ) { return cookie . getValue ( ) ; } } return null ; }
Find the value of a cookie on the request by name .
19,173
private void updateRegion ( ) { actMessagePanel . setVisible ( false ) ; if ( rbtACT . isSelected ( ) ) { actMessagePanel . setVisible ( true ) ; regionFields . setVisible ( true ) ; regionSelector . setOptions ( new String [ ] { null , "Belconnen" , "City" , "Woden" } ) ; regionSelector . setVisible ( true ) ; } else ...
Updates the visibility and options present in the region selector depending on the state selector s value .
19,174
public void setContent ( final WComponent content ) { WindowModel model = getOrCreateComponentModel ( ) ; if ( model . wrappedContent != null && model . wrappedContent != model . content ) { model . wrappedContent . removeAll ( ) ; } model . content = content ; if ( content instanceof WApplication ) { model . wrappedCo...
Set the WComponent that will handle the content for this pop up window .
19,175
public void setTitle ( final String title ) { String currTitle = getTitle ( ) ; if ( ! Objects . equals ( title , currTitle ) ) { getOrCreateComponentModel ( ) . title = title ; } }
Sets the window title .
19,176
public String getUrl ( ) { Environment env = getEnvironment ( ) ; Map < String , String > parameters = env . getHiddenParameters ( ) ; parameters . put ( WWINDOW_REQUEST_PARAM_KEY , getId ( ) ) ; parameters . put ( Environment . STEP_VARIABLE , String . valueOf ( getStep ( ) ) ) ; String url = env . getWServletPath ( )...
Returns a dynamic URL that this wwindow component can be accessed from .
19,177
protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; boolean targeted = isPresent ( request ) ; setTargeted ( targeted ) ; if ( getState ( ) == ACTIVE_STATE && isTargeted ( ) ) { getComponentModel ( ) . wrappedContent . preparePaint ( request ) ; } }
Override preparePaintComponent to clear the scratch map before the window content is being painted .
19,178
protected void paintComponent ( final RenderContext renderContext ) { if ( getState ( ) == DISPLAY_STATE ) { setState ( ACTIVE_STATE ) ; showWindow ( renderContext ) ; } else if ( getState ( ) == ACTIVE_STATE && isTargeted ( ) ) { getComponentModel ( ) . wrappedContent . paint ( renderContext ) ; } }
Override paintComponent in order to paint the window or its content depending on the window state .
19,179
protected void showWindow ( final RenderContext renderContext ) { int current = UIContextHolder . getCurrent ( ) . getEnvironment ( ) . getStep ( ) ; int window = getStep ( ) ; setStep ( window + current ) ; if ( renderContext instanceof WebXmlRenderContext ) { PrintWriter writer = ( ( WebXmlRenderContext ) renderConte...
Emits the mark - up which pops up the window .
19,180
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WFileWidget fileWidget = ( WFileWidget ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = fileWidget . isReadOnly ( ) ; xml . appendTagOpen ( TAG_NAME ) ; xml . appendAttribute ( "id" , c...
Paints the given WFileWidget .
19,181
public OrganizationCreateResponse createOrganization ( OrganizationCreate data ) { return getResourceFactory ( ) . getApiResource ( "/org/" ) . entity ( data , MediaType . APPLICATION_JSON_TYPE ) . post ( OrganizationCreateResponse . class ) ; }
Creates a new organization
19,182
public void updateOrganization ( int orgId , OrganizationCreate data ) { getResourceFactory ( ) . getApiResource ( "/org/" + orgId ) . entity ( data , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; }
Updates an organization with new name and logo . Note that the URL of the organization will not change even though the name changes .
19,183
public OrganizationMini getOrganizationByURL ( String url ) { return getResourceFactory ( ) . getApiResource ( "/org/url" ) . queryParam ( "url" , url ) . get ( OrganizationMini . class ) ; }
Returns the organization with the given full URL . The URL does not have to be truncated to the root it can be to any resource on the URL .
19,184
public List < OrganizationWithSpaces > getSharedOrganizations ( int userId ) { return getResourceFactory ( ) . getApiResource ( "/org/shared/" + userId ) . get ( new GenericType < List < OrganizationWithSpaces > > ( ) { } ) ; }
Returns the organizations and spaces that the logged in user shares with the specified user . The organizations and spaces will be returned sorted by name .
19,185
public List < Space > getSpaces ( int orgId ) { return getResourceFactory ( ) . getApiResource ( "/org/" + orgId + "/space/" ) . get ( new GenericType < List < Space > > ( ) { } ) ; }
Returns all the spaces for the organization .
19,186
public EndMemberInfo getEndMemberInfo ( int orgId , int userId ) { return getResourceFactory ( ) . getApiResource ( "/org/" + orgId + "/member/" + userId + "/end_member_info" ) . get ( EndMemberInfo . class ) ; }
Returns information about what would happen if this user would be removed from the org
19,187
public void setUseCamera ( final boolean useCamera ) { if ( useCamera != getUseCamera ( ) ) { ImageEditModel model = getOrCreateComponentModel ( ) ; model . useCamera = useCamera ; } }
Set to true if you wish to allow the user to capture an image from an attached camera . This feature is completely dependent on browser support and will essentially be ignored if the browser does not provide the necessary APIs .
19,188
public void setIsFace ( final boolean isFace ) { if ( isFace != getIsFace ( ) ) { ImageEditModel model = getOrCreateComponentModel ( ) ; model . isFace = isFace ; } }
Set to true to turn on face detection .
19,189
public void setRenderInline ( final boolean renderInline ) { if ( renderInline != getRenderInline ( ) ) { ImageEditModel model = getOrCreateComponentModel ( ) ; model . renderInline = renderInline ; } }
If true then the image editor will render where it is added in the tree instead of in a popup .
19,190
public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WFigure figure = ( WFigure ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean renderChildren = isRenderContent ( figure ) ; xml . appendTagOpen ( "ui:figure" ) ; xml . appendAttribute ( "id" , compo...
Paints the given WFigure .
19,191
public void preparePaintComponent ( final Request request ) { if ( ! this . isInitialised ( ) || resetButton . isPressed ( ) ) { String preferredState = request . getAppPreferenceParameter ( "example.preferred.state" ) ; stateSelector . setSelected ( preferredState ) ; this . setInitialised ( true ) ; } }
Override preparePaintComponent to set the initial selection from the app preferences . The selection is set the first time the example is accessed or when the reset button is used .
19,192
public void addColumn ( final WTableColumn column ) { columns . add ( column ) ; WDataTableRowRenderer renderer = ( WDataTableRowRenderer ) repeater . getRepeatedComponent ( ) ; renderer . addColumn ( column , columns . getChildCount ( ) - 1 ) ; }
Adds a column to the table .
19,193
public void setDataModel ( final TableDataModel dataModel ) { getOrCreateComponentModel ( ) . dataModel = dataModel ; getOrCreateComponentModel ( ) . rowIndexMapping = null ; if ( dataModel instanceof BeanTableDataModel ) { ( ( BeanTableDataModel ) dataModel ) . setBeanProvider ( new DataTableBeanProvider ( this ) ) ; ...
Sets the data model .
19,194
public void setPaginationMode ( final PaginationMode paginationMode ) { getOrCreateComponentModel ( ) . paginationMode = PaginationMode . SERVER . equals ( paginationMode ) ? PaginationMode . DYNAMIC : paginationMode ; }
Sets the pagination mode . Mode . SERVER mapped to Mode . DYNAMIC to overcome accessibility problem .
19,195
public void setExpandMode ( final ExpandMode expandMode ) { getOrCreateComponentModel ( ) . expandMode = ExpandMode . SERVER . equals ( expandMode ) ? ExpandMode . DYNAMIC : expandMode ; }
Sets the row expansion mode . ExpandMode . SERVER mapped to ExpandMode . DYNAMIC to overcome accessibility problems .
19,196
public void handleRequest ( final Request request ) { super . handleRequest ( request ) ; if ( isPresent ( request ) ) { if ( getExpandMode ( ) != ExpandMode . NONE ) { handleExpansionRequest ( request ) ; } if ( getSelectMode ( ) != SelectMode . NONE ) { handleSelectionRequest ( request ) ; } if ( getPaginationMode ( ...
Override handleRequest to add table - specific functionality such as pagination and row selection .
19,197
private void handleFilterRequest ( final Request request ) { String [ ] paramValues = request . getParameterValues ( getId ( ) + ".filters" ) ; if ( paramValues == null ) { setActiveFilters ( new ArrayList < String > ( 0 ) ) ; } else { List < String > filters = Arrays . asList ( paramValues ) ; setActiveFilters ( filte...
Handles a request containing filtering data .
19,198
private int getCurrentPageStartRow ( ) { int startRow = 0 ; if ( getPaginationMode ( ) != PaginationMode . NONE ) { int rowsPerPage = getRowsPerPage ( ) ; TableDataModel model = getDataModel ( ) ; if ( model instanceof TreeTableDataModel ) { TreeTableDataModel treeModel = ( TreeTableDataModel ) model ; TreeNode root = ...
Retrieves the starting row index for the current page . Will always return zero for tables which are not paginated .
19,199
private int getCurrentPageEndRow ( ) { TableDataModel model = getDataModel ( ) ; int rowsPerPage = getRowsPerPage ( ) ; int endRow = model . getRowCount ( ) - 1 ; if ( getPaginationMode ( ) != PaginationMode . NONE ) { if ( model instanceof TreeTableDataModel ) { TreeTableDataModel treeModel = ( TreeTableDataModel ) mo...
Retrieves the ending row index for the current page . Will always return the row count minus 1 for tables which are not paginated .