idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
18,600 | private WButton newVisibilityToggleForTab ( final int idx ) { WButton toggleButton = new WButton ( "Toggle visibility of tab " + ( idx + 1 ) ) ; toggleButton . setAction ( new Action ( ) { public void execute ( final ActionEvent event ) { boolean tabVisible = tabset . isTabVisible ( idx ) ; tabset . setTabVisible ( idx... | Creates a button to toggle the visibility of a tab . |
18,601 | private < T extends Enum < T > > EnumerationRadioButtonSelect < T > createRadioButtonGroup ( final T [ ] options ) { EnumerationRadioButtonSelect < T > rbSelect = new EnumerationRadioButtonSelect < > ( options ) ; rbSelect . setButtonLayout ( EnumerationRadioButtonSelect . Layout . FLAT ) ; rbSelect . setFrameless ( tr... | Create a radio button select containing the options . |
18,602 | private void displaySelected ( ) { copySelection ( table1 , selected1 ) ; copySelection ( table2 , selected2 ) ; copySelection ( table3 , selected3 ) ; } | Display the rows that have been selected . |
18,603 | private BigDecimal convertValue ( final Object value ) { if ( value == null ) { return null ; } else if ( value instanceof BigDecimal ) { return ( BigDecimal ) value ; } String dataString = value . toString ( ) ; if ( Util . empty ( dataString ) ) { return null ; } try { return new BigDecimal ( dataString ) ; } catch (... | Attempts to convert a value to a BigDecimal . Throws a SystemException on error . |
18,604 | public void setMinValue ( final BigDecimal minValue ) { BigDecimal currMin = getMinValue ( ) ; if ( ! Objects . equals ( minValue , currMin ) ) { getOrCreateComponentModel ( ) . minValue = minValue ; } } | Sets the minimum allowable value for this number field . |
18,605 | public void setMaxValue ( final BigDecimal maxValue ) { BigDecimal currMax = getMaxValue ( ) ; if ( ! Objects . equals ( maxValue , currMax ) ) { getOrCreateComponentModel ( ) . maxValue = maxValue ; } } | Sets the maximum allowable value for this number field . |
18,606 | protected void validateComponent ( final List < Diagnostic > diags ) { if ( isValidNumber ( ) ) { super . validateComponent ( diags ) ; validateNumber ( diags ) ; } else { diags . add ( createErrorDiagnostic ( InternalMessages . DEFAULT_VALIDATION_ERROR_INVALID , this ) ) ; } } | Override WInput s validateComponent to perform futher validation on email addresses . |
18,607 | private static boolean containsError ( final List < Diagnostic > diags ) { if ( diags == null || diags . isEmpty ( ) ) { return false ; } for ( Diagnostic diag : diags ) { if ( diag . getSeverity ( ) == Diagnostic . ERROR ) { return true ; } } return false ; } | Indicates whether the given list of diagnostics contains any errors . |
18,608 | protected boolean doHandleRequest ( final Request request ) { String value = getRequestValue ( request ) ; String current = getValue ( ) ; boolean changed = ! Util . equals ( value , current ) ; if ( changed ) { setData ( value ) ; } return changed ; } | Override handleRequest in order to perform processing for this component . This implementation updates the text field s text if it has changed . |
18,609 | public void preparePaint ( final Request request ) { UIContext uic = UIContextHolder . getCurrent ( ) ; Headers headers = uic . getUI ( ) . getHeaders ( ) ; headers . reset ( ) ; headers . setContentType ( WebUtilities . CONTENT_TYPE_XML ) ; super . preparePaint ( request ) ; } | Override to set the content type of the response and reset the headers . |
18,610 | public void paint ( final RenderContext renderContext ) { WebXmlRenderContext webRenderContext = ( WebXmlRenderContext ) renderContext ; XmlStringBuilder xml = webRenderContext . getWriter ( ) ; AjaxOperation operation = AjaxHelper . getCurrentOperation ( ) ; if ( operation == null ) { throw new SystemException ( "Can'... | Paints the targeted ajax regions . The format of the response is an agreement between the server and the client side handling our AJAX response . |
18,611 | public void add ( final WComponent component , final String tag ) { super . add ( component , tag ) ; } | Add the given component as a child of this component . The tag is used to identify the child in this component s velocity template . |
18,612 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WAudio audioComponent = ( WAudio ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; Audio [ ] audio = audioComponent . getAudio ( ) ; if ( audio == null || audio . length == 0 ) { return ; } WAudio . Contro... | Paints the given WAudio . |
18,613 | private void addResponsiveExample ( ) { add ( new WHeading ( HeadingLevel . H2 , "Default responsive design" ) ) ; add ( new ExplanatoryText ( "This example applies the theme's default responsive design rules for ColumnLayout.\n " + "The columns have width and alignment and there is also a hgap and a vgap." ) ) ; WPane... | Add a column layout which will change its rendering on small screens . |
18,614 | private static String getTitle ( final int [ ] widths ) { StringBuffer buf = new StringBuffer ( "Column widths: " ) ; for ( int i = 0 ; i < widths . length ; i ++ ) { if ( i > 0 ) { buf . append ( ", " ) ; } buf . append ( widths [ i ] ) ; } return buf . toString ( ) ; } | Concatenates column widths to form the heading text for the example . |
18,615 | private void addHgapVGapExample ( final Size hgap , final Size vgap ) { add ( new WHeading ( HeadingLevel . H2 , "Column Layout: hgap=" + hgap . toString ( ) + " vgap=" + vgap . toString ( ) ) ) ; WPanel panel = new WPanel ( ) ; panel . setLayout ( new ColumnLayout ( new int [ ] { 25 , 25 , 25 , 25 } , hgap , vgap ) ) ... | Build an example using hgap and vgap . |
18,616 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WTableRowRenderer renderer = ( WTableRowRenderer ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WTable table = renderer . getTable ( ) ; TableModel dataModel = table . getTableModel ( ) ; int [ ] column... | Paints the given WTableRowRenderer . |
18,617 | public static Policy createPolicy ( final String resourceName ) { if ( StringUtils . isBlank ( resourceName ) ) { throw new SystemException ( "AntiSamy Policy resourceName cannot be null " ) ; } URL resource = HtmlSanitizerUtil . class . getClassLoader ( ) . getResource ( resourceName ) ; if ( resource == null ) { thro... | Create a Policy from a named local resource . |
18,618 | public void handleRequest ( final Request request ) { super . handleRequest ( request ) ; Object data = getData ( ) ; if ( data != null ) { updateData ( data ) ; } } | The handleRequest method has been overridden to keep the data object bound to this wcomponent in sync with any changes the user has entered . |
18,619 | protected void doGet ( final HttpServletRequest req , final HttpServletResponse resp ) throws ServletException , IOException { ServletUtil . handleThemeResourceRequest ( req , resp ) ; } | Serves up a file from the theme . |
18,620 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WCollapsibleToggle toggle = ( WCollapsibleToggle ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:collapsibletoggle" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; ... | Paints the given WCollapsibleToggle . |
18,621 | public static boolean empty ( final String aString ) { if ( aString != null ) { final int len = aString . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( aString . charAt ( i ) > ' ' ) { return false ; } } } return true ; } | Determines whether the given string is null or empty . |
18,622 | public static int compareAllowNull ( final Comparable c1 , final Comparable c2 ) { if ( c1 == null && c2 == null ) { return 0 ; } else if ( c1 == null ) { return - 1 ; } else if ( c2 == null ) { return 1 ; } else { return c1 . compareTo ( c2 ) ; } } | Compares two comparable objects where either may be null . Null is regarded as the smallest value and 2 nulls are considered equal . |
18,623 | public static String rightTrim ( final String aString ) { if ( aString == null ) { return null ; } int end = aString . length ( ) - 1 ; while ( ( end >= 0 ) && ( aString . charAt ( end ) <= ' ' ) ) { end -- ; } if ( end == aString . length ( ) - 1 ) { return aString ; } return aString . substring ( 0 , end + 1 ) ; } | Copies this String removing white space characters from the end of the string . |
18,624 | public static String leftTrim ( final String aString ) { if ( aString == null ) { return null ; } int start = 0 ; while ( ( start < aString . length ( ) ) && ( aString . charAt ( start ) <= ' ' ) ) { start ++ ; } if ( start == 0 ) { return aString ; } return aString . substring ( start ) ; } | Copies this String removing white space characters from the beginning of the string . |
18,625 | public static UIContext getCurrent ( ) { Stack < UIContext > stack = CONTEXT_STACK . get ( ) ; if ( stack == null || stack . isEmpty ( ) ) { return null ; } return getStack ( ) . peek ( ) ; } | Retrieves the current effective UIContext . Note that this method will return null if called from outside normal request processing for example during the intial application UI construction . |
18,626 | private static Stack < UIContext > getStack ( ) { Stack < UIContext > stack = CONTEXT_STACK . get ( ) ; if ( stack == null ) { stack = new Stack < > ( ) ; CONTEXT_STACK . set ( stack ) ; } return stack ; } | Retrieves the internal stack creating it if necessary . |
18,627 | public static List getAllFields ( final Object obj , final boolean excludeStatic , final boolean excludeTransient ) { List fieldList = new ArrayList ( ) ; for ( Class clazz = obj . getClass ( ) ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { Field [ ] declaredFields = clazz . getDeclaredFields ( ) ; for ( int i... | Retrieves all the fields contained in the given object and its superclasses . |
18,628 | public static void setProperty ( final Object object , final String property , final Class propertyType , final Object value ) { Class [ ] paramTypes = new Class [ ] { propertyType } ; Object [ ] params = new Object [ ] { value } ; String methodName = "set" + property . substring ( 0 , 1 ) . toUpperCase ( ) + property ... | This method sets a property on an object via reflection . |
18,629 | public static Object getProperty ( final Object object , final String property ) { Class [ ] paramTypes = new Class [ ] { } ; Object [ ] params = new Object [ ] { } ; String methodName = "get" + property . substring ( 0 , 1 ) . toUpperCase ( ) + property . substring ( 1 ) ; return ReflectionUtil . invokeMethod ( object... | This method gets a property from an object via reflection . |
18,630 | public int createRating ( Reference reference , RatingType type , int value ) { return getResourceFactory ( ) . getApiResource ( "/rating/" + reference . toURLFragment ( ) + type ) . entity ( Collections . singletonMap ( "value" , value ) , MediaType . APPLICATION_JSON_TYPE ) . post ( RatingCreateResponse . class ) . g... | Add a new rating of the user to the object . The rating can be one of many different types . For more details see the area . |
18,631 | public void deleteRating ( Reference reference , RatingType type ) { getResourceFactory ( ) . getApiResource ( "/rating/" + reference . toURLFragment ( ) + type ) . delete ( ) ; } | Deletes the rating of the given type on the object by the active user |
18,632 | public RatingValuesMap getAllRatings ( Reference reference ) { return getResourceFactory ( ) . getApiResource ( "/rating/" + reference . toURLFragment ( ) ) . get ( RatingValuesMap . class ) ; } | Returns all the ratings for the given object . It will only return the ratings that are enabled for the object . |
18,633 | public int getRating ( Reference reference , RatingType type , int userId ) { return getResourceFactory ( ) . getApiResource ( "/rating/" + reference . toURLFragment ( ) + type + "/" + userId ) . get ( SingleRatingValue . class ) . getValue ( ) ; } | Returns the rating value for the given rating type object and user . |
18,634 | private String getMenuType ( final WSubMenu submenu ) { WMenu menu = WebUtilities . getAncestorOfClass ( WMenu . class , submenu ) ; switch ( menu . getType ( ) ) { case BAR : return "bar" ; case FLYOUT : return "flyout" ; case TREE : return "tree" ; case COLUMN : return "column" ; default : throw new IllegalStateExcep... | Get the string value of a WMenu . MenuType . |
18,635 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSubMenu menu = ( WSubMenu ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:submenu" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( ... | Paints the given WSubMenu . |
18,636 | protected List getNewSelections ( final Request request ) { List selections = super . getNewSelections ( request ) ; if ( selections != null ) { for ( int i = 0 ; i < selections . size ( ) ; i ++ ) { Object selection = selections . get ( i ) ; for ( int j = i + 1 ; j < selections . size ( ) ; j ++ ) { if ( Util . equal... | Override getNewSelections to ensure that the max number of inputs is honoured and that there are no duplicates . This should not normally occur as the client side js should prevent it . |
18,637 | public static String rowIndexListToString ( final List < Integer > row ) { if ( row == null || row . isEmpty ( ) ) { return null ; } StringBuffer index = new StringBuffer ( ) ; boolean addDelimiter = false ; for ( Integer lvl : row ) { if ( addDelimiter ) { index . append ( INDEX_DELIMITER ) ; } index . append ( lvl ) ... | Convert the row index to its string representation . |
18,638 | public static List < Integer > rowIndexStringToList ( final String row ) { if ( row == null ) { return null ; } List < Integer > rowIndex = new ArrayList < > ( ) ; try { String [ ] rowIdString = row . split ( INDEX_DELIMITER ) ; for ( int i = 0 ; i < rowIdString . length ; i ++ ) { rowIndex . add ( Integer . parseInt (... | Convert the string representation of a row index to a list . |
18,639 | public static void sortData ( final Object [ ] data , final Comparator < Object > comparator , final boolean ascending , final int lowIndex , final int highIndex , final int [ ] sortIndices ) { if ( lowIndex >= highIndex ) { return ; } Object midValue = data [ sortIndices [ ( lowIndex + highIndex ) >>> 1 ] ] ; int i = ... | Sorts the data using the given comparator using a quick - sort . |
18,640 | private static Date parse ( final String dateString ) { try { return new SimpleDateFormat ( "dd/mm/yyyy" ) . parse ( dateString ) ; } catch ( ParseException e ) { LOG . error ( "Error parsing date: " + dateString , e ) ; return null ; } } | Parses a date string . |
18,641 | private TableDataModel createTableModel ( ) { return new AbstractTableDataModel ( ) { private static final int FIRST_NAME = 0 ; private static final int LAST_NAME = 1 ; private static final int DOB = 2 ; private static final int BUTTON = 3 ; private final List < Person > data = Arrays . asList ( new Person [ ] { new Pe... | Creates a table data model containing some dummy person data . |
18,642 | public static void addAllHeadlines ( final PrintWriter writer , final Headers headers ) { PageContentHelper . addHeadlines ( writer , headers . getHeadLines ( ) ) ; PageContentHelper . addJsHeadlines ( writer , headers . getHeadLines ( Headers . JAVASCRIPT_HEADLINE ) ) ; PageContentHelper . addCssHeadlines ( writer , h... | Shortcut method for adding all the headline entries stored in the WHeaders . |
18,643 | private void paintAjax ( final WButton button , final XmlStringBuilder xml ) { xml . appendTagOpen ( "ui:ajaxtrigger" ) ; xml . appendAttribute ( "triggerId" , button . getId ( ) ) ; xml . appendClose ( ) ; xml . appendTagOpen ( "ui:ajaxtargetid" ) ; xml . appendAttribute ( "targetId" , button . getAjaxTarget ( ) . get... | Paints the AJAX information for the given WButton . |
18,644 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WDialog dialog = ( WDialog ) component ; int state = dialog . getState ( ) ; if ( state == WDialog . ACTIVE_STATE || dialog . getTrigger ( ) != null ) { int width = dialog . getWidth ( ) ; int height = dialog . getHeight ( )... | Paints the given WDialog . |
18,645 | public void paint ( final RenderContext renderContext ) { if ( ! DebugUtil . isDebugFeaturesEnabled ( ) || ! ( renderContext instanceof WebXmlRenderContext ) ) { getBackingComponent ( ) . paint ( renderContext ) ; return ; } AjaxOperation operation = AjaxHelper . getCurrentOperation ( ) ; if ( operation == null ) { get... | Override paint to only output the debugging info for the current targets . |
18,646 | public void setParameter ( final String key , final String value ) { parameters . put ( key , new String [ ] { value } ) ; } | Sets a parameter . |
18,647 | public void addParameterForButton ( final UIContext uic , final WButton button ) { UIContextHolder . pushContext ( uic ) ; try { setParameter ( button . getId ( ) , "x" ) ; } finally { UIContextHolder . popContext ( ) ; } } | Convenience method that adds a parameter emulating a button press . |
18,648 | public void setFileContents ( final String key , final byte [ ] contents ) { MockFileItem fileItem = new MockFileItem ( ) ; fileItem . set ( contents ) ; files . put ( key , new FileItem [ ] { fileItem } ) ; } | Sets mock file upload contents . |
18,649 | private void addMessage ( final WMessageBox box , final Message message , final boolean encode ) { String code = message . getMessage ( ) ; if ( ! Util . empty ( code ) ) { box . addMessage ( encode , code , message . getArgs ( ) ) ; } } | Convenience method to add a message to a message box . |
18,650 | protected static MessageContainer getMessageContainer ( final WComponent component ) { for ( WComponent c = component ; c != null ; c = c . getParent ( ) ) { if ( c instanceof MessageContainer ) { return ( MessageContainer ) c ; } } return null ; } | Searches the WComponent tree of the given component for an ancestor that implements the MessageContainer interface . |
18,651 | public int addItem ( int appId , ItemCreate create , boolean silent ) { return getResourceFactory ( ) . getApiResource ( "/item/app/" + appId + "/" ) . queryParam ( "silent" , silent ? "1" : "0" ) . entity ( create , MediaType . APPLICATION_JSON_TYPE ) . post ( ItemCreateResponse . class ) . getId ( ) ; } | Adds a new item to the given app . |
18,652 | public void updateItem ( int itemId , ItemUpdate update , boolean silent , boolean hook ) { getResourceFactory ( ) . getApiResource ( "/item/" + itemId ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entity ( update , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Updates the entire item . Only fields which have values specified will be updated . To delete the contents of a field pass an empty array for the value . |
18,653 | public void updateItemValues ( int itemId , List < FieldValuesUpdate > values , boolean silent , boolean hook ) { getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/value/" ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entity ( values , MediaType . APPLICATIO... | Updates all the values for an item |
18,654 | public void updateItemFieldValues ( int itemId , int fieldId , List < Map < String , Object > > values , boolean silent , boolean hook ) { getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/value/" + fieldId ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entit... | Update the item values for a specific field . |
18,655 | public List < Map < String , Object > > getItemFieldValues ( int itemId , int fieldId ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/value/" + fieldId ) . get ( new GenericType < List < Map < String , Object > > > ( ) { } ) ; } | Returns the values for a specified field on an item |
18,656 | public List < FieldValuesView > getItemValues ( int itemId ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/value/" ) . get ( new GenericType < List < FieldValuesView > > ( ) { } ) ; } | Returns all the values for an item with the additional data provided by the get item operation . |
18,657 | public List < ItemMini > getItemsByFieldAndTitle ( int fieldId , String text , List < Integer > notItemIds , Integer limit ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/item/field/" + fieldId + "/find" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit . toString ( ) ... | Used to find possible items for a given application field . It searches the relevant items for the title given . |
18,658 | public List < ItemReference > getItemReference ( int itemId ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/reference/" ) . get ( new GenericType < List < ItemReference > > ( ) { } ) ; } | Returns the items that have a reference to the given item . The references are grouped by app . Both the apps and the items are sorted by title . |
18,659 | public ItemRevision getItemRevision ( int itemId , int revisionId ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/revision/" + revisionId ) . get ( ItemRevision . class ) ; } | Returns the data about the specific revision on an item |
18,660 | public List < ItemFieldDifference > getItemRevisionDifference ( int itemId , int revisionFrom , int revisionTo ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/revision/" + revisionFrom + "/" + revisionTo ) . get ( new GenericType < List < ItemFieldDifference > > ( ) { } ) ; } | Returns the difference in fields values between the two revisions . |
18,661 | public List < ItemRevision > getItemRevisions ( int itemId ) { return getResourceFactory ( ) . getApiResource ( "/item/" + itemId + "/revision/" ) . get ( new GenericType < List < ItemRevision > > ( ) { } ) ; } | Returns all the revisions that have been made to an item |
18,662 | public ItemsResponse getItems ( int appId , Integer limit , Integer offset , SortBy sortBy , Boolean sortDesc , FilterByValue < ? > ... filters ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/item/app/" + appId + "/v2/" ) ; if ( limit != null ) { resource = resource . queryParam ( "limit" , limit... | Returns the items on app matching the given filters . |
18,663 | public ItemsResponse getItemsByExternalId ( int appId , String externalId ) { return getItems ( appId , null , null , null , null , new FilterByValue < String > ( new ExternalIdFilterBy ( ) , externalId ) ) ; } | Utility method to get items matching an external id |
18,664 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WAjaxControl ajaxControl = ( WAjaxControl ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WComponent trigger = ajaxControl . getTrigger ( ) == null ? ajaxControl : ajaxControl . getTrigger ( ) ; int dela... | Paints the given AjaxControl . |
18,665 | public void setNameAction ( final Action action ) { LinkComponent linkComponent = new LinkComponent ( ) ; linkComponent . setNameAction ( action ) ; repeater . setRepeatedComponent ( linkComponent ) ; } | Sets the action to execute when the name link is invoked . |
18,666 | protected Object getNewSelection ( final Request request ) { String paramValue = request . getParameter ( getId ( ) ) ; if ( paramValue == null ) { return null ; } List < ? > options = getOptions ( ) ; if ( options == null || options . isEmpty ( ) ) { if ( ! isEditable ( ) ) { return null ; } options = Collections . EM... | Determines which selection has been included in the given request . |
18,667 | public static Object pipe ( final Object in ) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream os = new ObjectOutputStream ( bos ) ; os . writeObject ( in ) ; os . close ( ) ; byte [ ] bytes = bos . toByteArray ( ) ; ByteArrayInputStream bis = new ByteArrayInputStream ( bytes ) ; O... | Takes a copy of an input object via serialization . |
18,668 | public void markAsViewed ( int notificationId ) { getResourceFactory ( ) . getApiResource ( "/notification/" + notificationId + "/viewed" ) . entity ( new Empty ( ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ) ; } | Mark the notification as viewed . This will move the notification from the inbox to the viewed archive . |
18,669 | protected void afterPaint ( final RenderContext renderContext ) { if ( renderContext instanceof WebXmlRenderContext ) { PrintWriter writer = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; writer . println ( WebUtilities . encode ( message ) ) ; if ( error != null ) { writer . println ( "\n<br/>\n<pre>\n" )... | Override in order to paint the component . Real applications should not emit HTML directly . |
18,670 | protected void serviceInt ( final HttpServletRequest request , final HttpServletResponse response ) throws ServletException , IOException { boolean continueProcess = ServletUtil . checkResourceRequest ( request , response ) ; if ( ! continueProcess ) { return ; } WServletHelper helper = createServletHelper ( request , ... | Service internal . This method does the real work in servicing the http request . It integrates wcomponents into a servlet environment via a servlet specific helper class . |
18,671 | protected WServletHelper createServletHelper ( final HttpServletRequest httpServletRequest , final HttpServletResponse httpServletResponse ) { LOG . debug ( "Creating a new WServletHelper instance" ) ; WServletHelper helper = new WServletHelper ( this , httpServletRequest , httpServletResponse ) ; return helper ; } | Create a support class to coordinate the web request . |
18,672 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WPanel panel = ( WPanel ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WButton submitButton = panel . getDefaultSubmitButton ( ) ; String submitId = submitButton == null ? null : submitButton . getId ( ... | Paints the given container . |
18,673 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSubordinateControl subordinate = ( WSubordinateControl ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; if ( ! subordinate . getRules ( ) . isEmpty ( ) ) { int seq = 0 ; for ( Rule rule : subordinate . g... | Paints the given SubordinateControl . |
18,674 | private void paintRule ( final Rule rule , final XmlStringBuilder xml ) { if ( rule . getCondition ( ) == null ) { throw new SystemException ( "Rule cannot be painted as it has no condition" ) ; } paintCondition ( rule . getCondition ( ) , xml ) ; for ( Action action : rule . getOnTrue ( ) ) { paintAction ( action , "u... | Paints a single rule . |
18,675 | private void paintCondition ( final Condition condition , final XmlStringBuilder xml ) { if ( condition instanceof And ) { xml . appendTag ( "ui:and" ) ; for ( Condition operand : ( ( And ) condition ) . getConditions ( ) ) { paintCondition ( operand , xml ) ; } xml . appendEndTag ( "ui:and" ) ; } else if ( condition i... | Paints a condition . |
18,676 | private void paintAction ( final Action action , final String elementName , final XmlStringBuilder xml ) { switch ( action . getActionType ( ) ) { case SHOW : case HIDE : case ENABLE : case DISABLE : case OPTIONAL : case MANDATORY : paintStandardAction ( action , elementName , xml ) ; break ; case SHOWIN : case HIDEIN ... | Paints an action . |
18,677 | private void paintStandardAction ( final Action action , final String elementName , final XmlStringBuilder xml ) { xml . appendTagOpen ( elementName ) ; xml . appendAttribute ( "action" , getActionTypeName ( action . getActionType ( ) ) ) ; xml . appendClose ( ) ; xml . appendTagOpen ( "ui:target" ) ; SubordinateTarget... | Paint a standard action - where a single item or single group is targeted . |
18,678 | private void paintInGroupAction ( final Action action , final String elementName , final XmlStringBuilder xml ) { xml . appendTagOpen ( elementName ) ; xml . appendAttribute ( "action" , getActionTypeName ( action . getActionType ( ) ) ) ; xml . appendClose ( ) ; xml . appendTagOpen ( "ui:target" ) ; xml . appendAttrib... | Paint an inGroup action - where a single item is being targeted out of a group of items . |
18,679 | private String getCompareTypeName ( final CompareType type ) { String compare = null ; switch ( type ) { case EQUAL : break ; case NOT_EQUAL : compare = "ne" ; break ; case LESS_THAN : compare = "lt" ; break ; case LESS_THAN_OR_EQUAL : compare = "le" ; break ; case GREATER_THAN : compare = "gt" ; break ; case GREATER_T... | Helper method to determine the compare type name . |
18,680 | private String getActionTypeName ( final ActionType type ) { String action = null ; switch ( type ) { case SHOW : action = "show" ; break ; case SHOWIN : action = "showIn" ; break ; case HIDE : action = "hide" ; break ; case HIDEIN : action = "hideIn" ; break ; case ENABLE : action = "enable" ; break ; case ENABLEIN : ... | Helper method to determine the action name . |
18,681 | private void buildUI ( ) { add ( messages ) ; add ( tabset ) ; container . add ( new WText ( "Select an example from the menu" ) ) ; container . setIdName ( "eg" ) ; tabset . addTab ( container , "(no selection)" , WTabSet . TAB_MODE_CLIENT ) ; WImage srcImage = new WImage ( new ImageResource ( "/image/text-x-source.pn... | Add the controls to the section in the right order . |
18,682 | private void addToTail ( final WComponent component ) { WContainer tail = ( WContainer ) getDecoratedLabel ( ) . getTail ( ) ; if ( null != tail ) { tail . add ( component ) ; } } | Add a component to the WDecoratedLabel s tail container . |
18,683 | public void selectExample ( final WComponent example , final String exampleName ) { WComponent currentExample = container . getChildAt ( 0 ) . getParent ( ) ; if ( currentExample != null && currentExample . getClass ( ) . equals ( example . getClass ( ) ) ) { return ; } resetExample ( ) ; container . removeAll ( ) ; th... | Selects an example . |
18,684 | public void selectExample ( final ExampleData example ) { try { StringBuilder exampleName = new StringBuilder ( ) ; if ( example . getExampleGroupName ( ) != null && ! example . getExampleGroupName ( ) . equals ( "" ) ) { exampleName . append ( example . getExampleGroupName ( ) ) . append ( " - " ) ; } exampleName . ap... | Selects an example . If there is an error instantiating the component an error message will be displayed . |
18,685 | private static String getSource ( final String className ) { String sourceName = '/' + className . replace ( '.' , '/' ) + ".java" ; InputStream stream = null ; try { stream = ExampleSection . class . getResourceAsStream ( sourceName ) ; if ( stream != null ) { byte [ ] sourceBytes = StreamUtil . getBytes ( stream ) ; ... | Tries to obtain the source file for the given class . |
18,686 | protected String optionToCode ( final Object option , final int index ) { if ( index < 0 ) { List < ? > options = getOptions ( ) ; if ( options == null || options . isEmpty ( ) ) { Integrity . issue ( this , "No options available, so cannot convert the option \"" + option + "\" to a code." ) ; } else { StringBuffer mes... | Retrieves the code for the given option . Will return null if there is no matching option . |
18,687 | protected int getOptionIndex ( final Object option ) { int optionCount = 0 ; List < ? > options = getOptions ( ) ; if ( options != null ) { for ( Object obj : getOptions ( ) ) { if ( obj instanceof OptionGroup ) { List < ? > groupOptions = ( ( OptionGroup ) obj ) . getOptions ( ) ; int groupIndex = groupOptions . index... | Retrieves the index of the given option . The index is not necessarily the index of the option in the options list as there may be options nested in OptionGroups . |
18,688 | public String getListCacheKey ( ) { Object table = getLookupTable ( ) ; if ( table != null && ConfigurationProperties . getDatalistCaching ( ) ) { String key = APPLICATION_LOOKUP_TABLE . getCacheKeyForTable ( table ) ; return key ; } return null ; } | Retrieves the data list cache key for this component . |
18,689 | public List < ? > getOptions ( ) { if ( getLookupTable ( ) == null ) { SelectionModel model = getComponentModel ( ) ; return model . getOptions ( ) ; } else { return APPLICATION_LOOKUP_TABLE . getTable ( getLookupTable ( ) ) ; } } | Returns the complete list of options available for selection for this user s session . |
18,690 | public void setOptions ( final Object [ ] aArray ) { setOptions ( aArray == null ? null : Arrays . asList ( aArray ) ) ; } | Set the complete list of options available for selection for this users session . |
18,691 | protected void preparePaintComponent ( final Request request ) { super . preparePaintComponent ( request ) ; if ( isAjax ( ) && UIContextHolder . getCurrent ( ) . getUI ( ) != null ) { AjaxTarget target = getAjaxTarget ( ) ; AjaxHelper . registerComponent ( target . getId ( ) , getId ( ) ) ; } String cacheKey = getList... | Override preparePaintComponent to register an AJAX operation if this list is AJAX enabled . |
18,692 | public String getDesc ( final Object option , final int index ) { String desc = "" ; if ( option instanceof Option ) { String optDesc = ( ( Option ) option ) . getDesc ( ) ; if ( optDesc != null ) { desc = optDesc ; } } else { String tableDesc = APPLICATION_LOOKUP_TABLE . getDescription ( getLookupTable ( ) , option ) ... | Retrieves the description for the given option . Intended for use by Renderers . |
18,693 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WSingleSelect listBox = ( WSingleSelect ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String dataKey = listBox . getListCacheKey ( ) ; boolean readOnly = listBox . isReadOnly ( ) ; int rows = listBox .... | Paints the given WSingleSelect . |
18,694 | private void initialiseInstanceVariables ( ) { backing = new HashMap < > ( ) ; booleanBacking = new HashSet < > ( ) ; locations = new HashMap < > ( ) ; subcontextCache = Collections . synchronizedMap ( new HashMap ( ) ) ; runtimeProperties = new IncludeProperties ( "Runtime: added at runtime" ) ; } | This method initialises most of the instance variables . |
18,695 | @ SuppressWarnings ( "checkstyle:emptyblock" ) private void load ( ) { recordMessage ( "Loading parameters" ) ; File cwd = new File ( "." ) ; String workingDir ; try { workingDir = cwd . getCanonicalPath ( ) ; } catch ( IOException ex ) { workingDir = "UNKNOWN" ; } recordMessage ( "Working directory is " + workingDir )... | Load the backing from the properties file visible to our classloader plus the filesystem . |
18,696 | @ SuppressWarnings ( "checkstyle:emptyblock" ) private void loadTop ( final String resourceName ) { try { resources . push ( resourceName ) ; load ( resourceName ) ; String includes = get ( INCLUDE_AFTER ) ; if ( includes != null ) { do { } while ( substitute ( INCLUDE_AFTER ) ) ; String [ ] includeAfter = getString ( ... | Loading of top level resources is different to the general recursive case since it is only at the top level that we check for the includeAfter parameter . |
18,697 | private void load ( final String resourceName ) { boolean found = false ; try { resources . push ( resourceName ) ; ClassLoader classloader = getParamsClassLoader ( ) ; List < URL > urls = new ArrayList < > ( ) ; for ( Enumeration < URL > res = classloader . getResources ( resourceName ) ; res . hasMoreElements ( ) ; )... | Try loading the given resource name . There may be several resources corresponding to that name ... |
18,698 | private String filename ( final File aFile ) { try { return aFile . getCanonicalPath ( ) ; } catch ( IOException ex ) { recordException ( ex ) ; return "UNKNOWN FILE" ; } } | Retrieves the canonical path for a given file . |
18,699 | private void load ( final Properties properties , final String location , final boolean overwriteOnly ) { for ( Map . Entry < Object , Object > entry : properties . entrySet ( ) ) { String key = ( String ) entry . getKey ( ) ; String already = get ( key ) ; if ( overwriteOnly && already == null && ! INCLUDE . equals ( ... | Load the properties from the given Properties object recording the origin on those properties as being from the given location . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.