idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
18,400 | @ SuppressWarnings ( "unchecked" ) private void loadServlets ( Map < String , ServletConfiguration > servlets , Environment environment ) throws ClassNotFoundException { if ( servlets != null ) { for ( Map . Entry < String , ServletConfiguration > servletEntry : servlets . entrySet ( ) ) { ServletConfiguration servlet ... | Load all servlets . |
18,401 | private String getPart ( int pos ) { String value = this . getValue ( ) ; if ( value == null ) { return null ; } String [ ] parts = value . split ( "/" ) ; return parts . length >= pos + 1 ? parts [ pos ] : null ; } | Extracts the given part from the unique identifier . |
18,402 | public NeedleRule withOuter ( final MethodRule rule ) { if ( rule instanceof InjectionProvider ) { addInjectionProvider ( ( InjectionProvider < ? > ) rule ) ; } methodRuleChain . add ( 0 , rule ) ; return this ; } | Encloses the added rule . |
18,403 | private List < String > buildCommand ( ) { List < String > command = new ArrayList < String > ( ) ; command . add ( cmd ) ; command . add ( "thin" ) ; command . add ( "--sourceAppPath=" + getSourceAppPath ( ) ) ; command . add ( "--targetLibCachePath=" + getTargetLibCachePath ( ) ) ; command . add ( "--targetThinAppPat... | Build up a command string to launch in new process |
18,404 | @ SuppressWarnings ( "unchecked" ) public < X > X resetToNice ( final Object mock ) { EasyMock . resetToNice ( mock ) ; return ( X ) mock ; } | Resets the given mock object and turns them to a mock with nice behavior . For details see the EasyMock documentation . |
18,405 | @ SuppressWarnings ( "unchecked" ) public < X > X resetToStrict ( final Object mock ) { EasyMock . resetToStrict ( mock ) ; return ( X ) mock ; } | Resets the given mock object and turns them to a mock with strict behavior . For details see the EasyMock documentation . |
18,406 | @ SuppressWarnings ( "unchecked" ) public < X > X resetToDefault ( final Object mock ) { EasyMock . resetToDefault ( mock ) ; return ( X ) mock ; } | Resets the given mock object and turns them to a mock with default behavior . For details see the EasyMock documentation . |
18,407 | protected void deleteContent ( final List < String > tables , final Statement statement ) throws SQLException { final ArrayList < String > tempTables = new ArrayList < String > ( tables ) ; while ( ! tempTables . isEmpty ( ) ) { final int sizeBefore = tempTables . size ( ) ; for ( final ListIterator < String > iterator... | Deletes all contents from the given tables . |
18,408 | private List < String > initCommand ( ) { List < String > command = new ArrayList < String > ( ) ; command . add ( cmd ) ; command . add ( "install" ) ; if ( acceptLicense ) { command . add ( "--acceptLicense" ) ; } else { command . add ( "--viewLicenseAgreement" ) ; } if ( to != null ) { command . add ( "--to=" + to )... | Generate a String list containing all the parameter for the command . |
18,409 | private < T extends XSString > T createXSString ( Class < T > clazz , String value ) { if ( value == null ) { return null ; } QName elementName = null ; String localName = null ; try { elementName = ( QName ) clazz . getDeclaredField ( "DEFAULT_ELEMENT_NAME" ) . get ( null ) ; localName = ( String ) clazz . getDeclared... | Utility method for creating an OpenSAML object given its type and assigns the value . |
18,410 | public Annotation [ ] getAnnotations ( ) { final Annotation [ ] accessibleObjectAnnotations = accessibleObject . getAnnotations ( ) ; final Annotation [ ] annotations = new Annotation [ accessibleObjectAnnotations . length + parameterAnnotations . length ] ; System . arraycopy ( accessibleObjectAnnotations , 0 , annota... | Returns an array of all annotations present on the injection target . |
18,411 | public static final MetadataServiceListVersion valueOf ( final int majorVersion , final int minorVersion ) { if ( majorVersion == 1 && minorVersion == 0 ) { return MetadataServiceListVersion . VERSION_10 ; } return new MetadataServiceListVersion ( majorVersion , minorVersion ) ; } | Gets the version given the major and minor version number . |
18,412 | public static final MetadataServiceListVersion valueOf ( String version ) { String [ ] components = version . split ( "\\." ) ; return valueOf ( Integer . valueOf ( components [ 0 ] ) , Integer . valueOf ( components [ 1 ] ) ) ; } | Gets the version for a given version string such as 1 . 0 . |
18,413 | public static < T > InjectionProvider < T > providerForQualifiedInstance ( final Class < ? extends Annotation > qualifier , final T instance ) { return new QualifiedInstanceInjectionProvider < T > ( qualifier , instance ) ; } | InjectionProvider that provides a singleton instance of type T for every injection point that is annotated with the given qualifier . |
18,414 | private static Set < InjectionProvider < ? > > newProviderSet ( final InjectionProvider < ? > ... providers ) { final Set < InjectionProvider < ? > > result = new LinkedHashSet < InjectionProvider < ? > > ( ) ; if ( providers != null && providers . length > 0 ) { for ( final InjectionProvider < ? > provider : providers... | Creates a new Set . |
18,415 | private static InjectionProviderInstancesSupplier mergeSuppliers ( final InjectionProviderInstancesSupplier ... suppliers ) { final Set < InjectionProvider < ? > > result = new LinkedHashSet < InjectionProvider < ? > > ( ) ; if ( suppliers != null && suppliers . length > 0 ) { for ( final InjectionProviderInstancesSupp... | Creates new supplier containing all providers in a new set . |
18,416 | public static InjectionProvider < ? > [ ] providersForInstancesSuppliers ( final InjectionProviderInstancesSupplier ... suppliers ) { final InjectionProviderInstancesSupplier supplier = mergeSuppliers ( suppliers ) ; return supplier . get ( ) . toArray ( new InjectionProvider < ? > [ supplier . get ( ) . size ( ) ] ) ;... | Create array of providers from given suppliers . |
18,417 | public static InjectionProvider < ? > [ ] providersToArray ( final Collection < InjectionProvider < ? > > providers ) { return providers == null ? new InjectionProvider < ? > [ 0 ] : providers . toArray ( new InjectionProvider < ? > [ providers . size ( ) ] ) ; } | Create array of InjectionProviders for given collection . |
18,418 | public final < T > T saveObject ( final T obj ) throws Exception { return executeInTransaction ( new Runnable < T > ( ) { public T run ( final EntityManager entityManager ) { return persist ( obj , entityManager ) ; } } ) ; } | Saves the given object in the database . |
18,419 | public final < T > T loadObject ( final Class < T > clazz , final Object id ) throws Exception { return executeInTransaction ( new Runnable < T > ( ) { public T run ( final EntityManager entityManager ) { return loadObject ( entityManager , clazz , id ) ; } } ) ; } | Finds and returns the object of the given id in the persistence context . |
18,420 | public final < T > List < T > loadAllObjects ( final Class < T > clazz ) throws Exception { final Entity entityAnnotation = clazz . getAnnotation ( Entity . class ) ; if ( entityAnnotation == null ) { throw new IllegalArgumentException ( "Unknown entity: " + clazz . getName ( ) ) ; } return executeInTransaction ( new R... | Returns all objects of the given class in persistence context . |
18,421 | public XMLObject unmarshall ( Element domElement ) throws UnmarshallingException { Document newDocument = null ; Node childNode = domElement . getFirstChild ( ) ; while ( childNode != null ) { if ( childNode . getNodeType ( ) != Node . TEXT_NODE ) { log . info ( "Ignoring node {} - it is not a text node" , childNode . ... | Special handling of the Base64 encoded value that represents the address elements . |
18,422 | private static Map < String , String > getNamespaceBindings ( Element element ) { Map < String , String > namespaceMap = new HashMap < String , String > ( ) ; getNamespaceBindings ( element , namespaceMap ) ; return namespaceMap ; } | Returns a map holding all registered namespace bindings where the key is the qualified name of the namespace and the value part is the URI . |
18,423 | public String waitForStringInLog ( String regexp , long timeout , File outputFile ) { int waited = 0 ; final int waitIncrement = 500 ; log ( MessageFormat . format ( messages . getString ( "info.search.string" ) , regexp , outputFile . getAbsolutePath ( ) , timeout / 1000 ) ) ; try { while ( waited <= timeout ) { Strin... | Check for a number of strings in a potentially remote file |
18,424 | public void bootstrap ( ) throws ConfigurationException { XMLConfigurator configurator = new XMLConfigurator ( ) ; for ( String config : configs ) { log . debug ( "Loading XMLTooling configuration " + config ) ; configurator . load ( Configuration . class . getResourceAsStream ( config ) ) ; } } | Bootstrap method for this library . |
18,425 | public static InputStream loadResource ( final String resource ) throws FileNotFoundException { final boolean hasLeadingSlash = resource . startsWith ( "/" ) ; final String stripped = hasLeadingSlash ? resource . substring ( 1 ) : resource ; InputStream stream = null ; final ClassLoader classLoader = Thread . currentTh... | Returns an input stream for reading the specified resource . |
18,426 | public OperationResult operate ( TestStep testStep ) { String testStepName = testStep . getLocator ( ) . getValue ( ) ; LogRecord log = LogRecord . info ( LOG , testStep , "script.execute" , testStepName ) ; current . backup ( ) ; TestScript testScript = dao . load ( new File ( pm . getPageScriptDir ( ) , testStepName ... | OperationLog opelog ; |
18,427 | public OperationResult operate ( TestStep testStep ) { String value = testStep . getValue ( ) ; LogRecord record = LogRecord . info ( log , testStep , "test.step.execute" , value ) ; TestScript testScript = current . getTestScript ( ) ; int nextIndex = testScript . getIndexByScriptNo ( value ) - 1 ; current . setCurren... | protected OperationLog opelog ; |
18,428 | private WMenu buildTreeMenu ( final WText selectedMenuText ) { WMenu menu = new WMenu ( WMenu . MenuType . TREE ) ; menu . setSelectMode ( SelectMode . SINGLE ) ; mapTreeHierarchy ( menu , createExampleHierarchy ( ) , selectedMenuText ) ; return menu ; } | Builds up a tree menu for inclusion in the example . |
18,429 | private void mapTreeHierarchy ( final WComponent currentComponent , final StringTreeNode currentNode , final WText selectedMenuText ) { if ( currentNode . isLeaf ( ) ) { WMenuItem menuItem = new WMenuItem ( currentNode . getData ( ) , new ExampleMenuAction ( selectedMenuText ) ) ; menuItem . setActionObject ( currentNo... | Recursively maps a tree hierarchy to a hierarchical menu . |
18,430 | private static StringTreeNode createExampleHierarchy ( ) { StringTreeNode root = new StringTreeNode ( Object . class . getName ( ) ) ; Map < String , StringTreeNode > nodeMap = new HashMap < > ( ) ; nodeMap . put ( root . getData ( ) , root ) ; Class < ? > [ ] classes = new Class [ ] { WMenu . class , WMenuItem . class... | Creates an example hierarchy showing the WMenu API . |
18,431 | public void addTerm ( final String term , final WComponent ... data ) { for ( WComponent component : data ) { if ( component != null ) { content . add ( component , term ) ; } } if ( getComponentsForTerm ( term ) . isEmpty ( ) ) { content . add ( new DefaultWComponent ( ) , term ) ; } } | Adds a term to this definition list . If there is an existing term the component is added to the list of data for the term . |
18,432 | public List < Duplet < String , ArrayList < WComponent > > > getTerms ( ) { Map < String , Duplet < String , ArrayList < WComponent > > > componentsByTerm = new HashMap < > ( ) ; List < Duplet < String , ArrayList < WComponent > > > result = new ArrayList < > ( ) ; List < WComponent > childList = content . getComponent... | Groups a definition list s child components by their term for rendering . |
18,433 | private List < WComponent > getComponentsForTerm ( final String term ) { List < WComponent > childList = content . getComponentModel ( ) . getChildren ( ) ; List < WComponent > result = new ArrayList < > ( ) ; if ( childList != null ) { for ( int i = 0 ; i < childList . size ( ) ; i ++ ) { WComponent child = childList ... | Retrieves the components for the given term . |
18,434 | public void setArgs ( final Serializable ... args ) { this . args = args == null || args . length == 0 ? null : args ; } | Sets the message format arguments . |
18,435 | public int addSpaceContact ( int spaceId , ContactCreate create , boolean silent ) { return getResourceFactory ( ) . getApiResource ( "/contact/space/" + spaceId + "/" ) . queryParam ( "silent" , silent ? "1" : "0" ) . entity ( create , MediaType . APPLICATION_JSON_TYPE ) . post ( ContactCreateResponse . class ) . getI... | Adds a new contact to the given space . |
18,436 | public void updateSpaceContact ( int profileId , ContactUpdate update , boolean silent , boolean hook ) { getResourceFactory ( ) . getApiResource ( "/contact/" + profileId ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entity ( update , MediaType . APPLICATION_JSON_TYPE ) ... | Updates the entire space contact . Only fields which have values specified will be updated . To delete the contents of a field pass an empty array for the value . |
18,437 | public < T , F , R > List < T > getContacts ( ProfileField < F , R > key , F value , Integer limit , Integer offset , ProfileType < T > type , ContactOrder order , ContactType contactType ) { WebResource resource = getResourceFactory ( ) . getApiResource ( "/contact/" ) ; return getContactsCommon ( resource , key , val... | Used to get a list of contacts for the user . |
18,438 | public void handleRequest ( final Request request ) { super . handleRequest ( request ) ; String targ = request . getParameter ( Environment . TARGET_ID ) ; boolean contentReqested = ( targ != null && targ . equals ( getTargetId ( ) ) ) ; if ( contentReqested ) { ContentEscape escape = new ContentEscape ( getImage ( ) ... | When an img element is included in the html output of a page the browser will make a second request to get the image contents . The handleRequest method has been overridden to detect whether the request is the image content fetch request by looking for the parameter that we encode in the image url . |
18,439 | public void setImage ( final Image image ) { ImageModel model = getOrCreateComponentModel ( ) ; model . image = image ; model . imageUrl = null ; } | Sets the image . |
18,440 | public void setImageUrl ( final String imageUrl ) { ImageModel model = getOrCreateComponentModel ( ) ; model . imageUrl = imageUrl ; model . image = null ; } | Sets the image to an external URL . |
18,441 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WRadioButtonSelect rbSelect = ( WRadioButtonSelect ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int cols = rbSelect . getButtonColumns ( ) ; boolean readOnly = rbSelect . isReadOnly ( ) ; xml . append... | Paints the given WRadioButtonSelect . |
18,442 | private void paintAjax ( final WRadioButtonSelect rbSelect , final XmlStringBuilder xml ) { xml . appendTagOpen ( "ui:ajaxtrigger" ) ; xml . appendAttribute ( "triggerId" , rbSelect . getId ( ) ) ; xml . appendClose ( ) ; xml . appendTagOpen ( "ui:ajaxtargetid" ) ; xml . appendAttribute ( "targetId" , rbSelect . getAja... | Paints the AJAX information for the given WRadioButtonSelect . |
18,443 | public void setBean ( final Object bean ) { BeanAndProviderBoundComponentModel model = getOrCreateComponentModel ( ) ; model . setBean ( bean ) ; if ( getBeanProperty ( ) == null ) { setBeanProperty ( "." ) ; } removeBeanFromScratchMap ( ) ; } | Sets the bean associated with this WBeanComponent . This method of bean association is discouraged as the bean will be stored in the user s session . A better alternative is to provide a BeanProvider and a Bean Id . |
18,444 | public void setBeanId ( final Object beanId ) { BeanAndProviderBoundComponentModel model = getOrCreateComponentModel ( ) ; model . setBeanId ( beanId ) ; removeBeanFromScratchMap ( ) ; } | Sets the bean id associated with this WBeanComponent . |
18,445 | public void setBeanProperty ( final String propertyName ) { String currBeanProperty = getBeanProperty ( ) ; if ( ! Objects . equals ( propertyName , currBeanProperty ) ) { getOrCreateComponentModel ( ) . setBeanProperty ( propertyName ) ; } } | Sets the bean property that this component is interested in . The bean property is expressed in Jakarta PropertyUtils bean notation with an extension of . to indicate that the bean itself should be used . |
18,446 | protected void doUpdateBeanValue ( final Object value ) { String beanProperty = getBeanProperty ( ) ; if ( beanProperty != null && beanProperty . length ( ) > 0 && ! "." . equals ( beanProperty ) ) { Object bean = getBean ( ) ; if ( bean != null ) { try { Object beanValue = getBeanValue ( ) ; if ( ! Util . equals ( bea... | Updates the bean value with the new value . |
18,447 | protected void removeBeanFromScratchMap ( ) { Map < Object , Object > scratchMap = getBeanScratchMap ( ) ; if ( scratchMap == null ) { return ; } scratchMap . remove ( SCRATCHMAP_BEAN_ID_KEY ) ; scratchMap . remove ( SCRATCHMAP_BEAN_OBJECT_KEY ) ; } | Remove the bean from the scratch maps . |
18,448 | public boolean isChanged ( ) { Object currentValue = getData ( ) ; Object sharedValue = ( ( BeanAndProviderBoundComponentModel ) getDefaultModel ( ) ) . getData ( ) ; if ( getBeanProperty ( ) != null ) { sharedValue = getBeanValue ( ) ; } return ! Util . equals ( currentValue , sharedValue ) ; } | Indicates whether this component s data has changed from the default value . |
18,449 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WTabSet tabSet = ( WTabSet ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:tabset" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "... | Paints the given WTabSet . |
18,450 | private void createUI ( ) { add ( new WHeading ( HeadingLevel . H2 , "Contacts" ) ) ; add ( repeater ) ; createButtonBar ( ) ; createAddContactSubForm ( ) ; createPrintContactsSubForm ( ) ; } | Creates the example UI . |
18,451 | private void createButtonBar ( ) { WPanel buttonPanel = new WPanel ( WPanel . Type . FEATURE ) ; buttonPanel . setMargin ( new Margin ( Size . MEDIUM , null , Size . LARGE , null ) ) ; buttonPanel . setLayout ( new BorderLayout ( ) ) ; WButton updateButton = new WButton ( "Update" ) ; updateButton . setImage ( "/image/... | Create the UI artefacts for the update and reset buttons . |
18,452 | private void createAddContactSubForm ( ) { add ( new WHeading ( HeadingLevel . H3 , "Add a new contact" ) ) ; WButton addBtn = new WButton ( "Add" ) ; addBtn . setAction ( new Action ( ) { public void execute ( final ActionEvent event ) { addNewContact ( ) ; } } ) ; addBtn . setImage ( "/image/address-book-new.png" ) ;... | Create the UI artefacts for the Add contact sub form . |
18,453 | private void createPrintContactsSubForm ( ) { add ( new WHeading ( HeadingLevel . H3 , "Print to CSV" ) ) ; WButton printBtn = new WButton ( "Print" ) ; printBtn . setAction ( new Action ( ) { public void execute ( final ActionEvent event ) { printDetails ( ) ; } } ) ; printBtn . setImage ( "/image/document-print.png" ... | Create the UI artefacts for the Print contacts sub form . |
18,454 | private void printDetails ( ) { StringBuilder builder = new StringBuilder ( "\"Name\",\"Phone\",\"Roles\",\"Identifier\"\n" ) ; for ( Object contact : repeater . getBeanList ( ) ) { builder . append ( contact ) . append ( '\n' ) ; } printOutput . setText ( builder . toString ( ) ) ; } | Write the list of contacts into the WTextArea printOutput . |
18,455 | private static List < ContactDetails > fetchDataList ( ) { List < ContactDetails > list = new ArrayList < > ( ) ; list . add ( new ContactDetails ( "David" , "1234" , new String [ ] { "a" , "b" } ) ) ; list . add ( new ContactDetails ( "Jun" , "1111" , new String [ ] { "c" } ) ) ; list . add ( new ContactDetails ( "Mar... | Retrieves dummy data used by this example . |
18,456 | private WFieldSet addFieldSet ( final String title , final WFieldSet . FrameType type ) { final WFieldSet fieldset = new WFieldSet ( title ) ; fieldset . setFrameType ( type ) ; fieldset . setMargin ( new Margin ( null , null , Size . LARGE , null ) ) ; final WFieldLayout layout = new WFieldLayout ( ) ; fieldset . add ... | Creates a WFieldSet with content and a given FrameType . |
18,457 | private void makeSimpleExample ( ) { add ( new WHeading ( HeadingLevel . H3 , "Simple WRadioButtonSelect" ) ) ; WPanel examplePanel = new WPanel ( ) ; examplePanel . setLayout ( new FlowLayout ( FlowLayout . VERTICAL , Size . MEDIUM ) ) ; add ( examplePanel ) ; final WRadioButtonSelect rbSelect = new WRadioButtonSelect... | Make a simple editable example . The label for this example is used to get the example for use in the unit tests . |
18,458 | private void makeFramelessExample ( ) { add ( new WHeading ( HeadingLevel . H3 , "WRadioButtonSelect without its frame" ) ) ; add ( new ExplanatoryText ( "When a WRadioButtonSelect is frameless it loses some of its coherence, especially when its WLabel is hidden or " + "replaced by a toolTip. Using a frameless WRadioBu... | Make a simple editable example without a frame . |
18,459 | private void addInsideAFieldLayoutExample ( ) { add ( new WHeading ( HeadingLevel . H3 , "WRadioButtonSelect inside a WFieldLayout" ) ) ; add ( new ExplanatoryText ( "When a WRadioButtonSelect is inside a WField its label is exposed in a way which appears and behaves like a regular HTML label." + " This allows WRadioBu... | When a WRadioButtonSelect is added to a WFieldLayout the legend is moved . The first CheckBoxSelect has a frame the second doesn t |
18,460 | private void addFlatSelectExample ( ) { add ( new WHeading ( HeadingLevel . H3 , "WRadioButtonSelect with flat layout" ) ) ; add ( new ExplanatoryText ( "Setting the layout to FLAT will make the radio buttons be rendered in a horizontal line. They will wrap when they" + " reach the edge of the parent container." ) ) ; ... | adds a WRadioButtonSelect with LAYOUT_FLAT . |
18,461 | private void addReadOnlyExamples ( ) { add ( new WHeading ( HeadingLevel . H3 , "Read-only WRadioButtonSelect examples" ) ) ; add ( new ExplanatoryText ( "These examples all use the same list of options: the states and territories list from the editable examples above. " + "When the readOnly state is specified only tha... | Examples of readonly states . When in a read only state only the selected option is output . Since a WRadioButtonSeelct can only have 0 or 1 selected option the LAYOUT and FRAME are ignored . |
18,462 | private void addContentRow ( final String contentDesc , final ContentAccess contentAccess , final MutableContainer target ) { WButton button = new WButton ( contentDesc ) ; final WContent buttonContent = new WContent ( ) ; button . setAction ( new Action ( ) { public void execute ( final ActionEvent event ) { buttonCon... | Adds components to the given container which demonstrate various ways of acessing the given content . |
18,463 | private void applySettings ( ) { linkContainer . reset ( ) ; WLink exampleLink = new WLink ( ) ; exampleLink . setText ( tfLinkLabel . getText ( ) ) ; final String url = tfUrlField . getValue ( ) ; if ( "" . equals ( url ) || ! isValidUrl ( url ) ) { tfUrlField . setText ( URL ) ; exampleLink . setUrl ( URL ) ; } else ... | this is were the majority of the work is done for building the link . Note that it is in a container that is reset effectively creating a new link . this is only done to enable to dynamically change the link to a button and back . |
18,464 | public void showDetails ( final ActionEvent event ) { MyData data = ( MyData ) event . getActionObject ( ) ; displayDialog . setData ( data ) ; dialog . display ( ) ; } | Handle show details . |
18,465 | private WMessages getWMessageInstance ( ) { MessageContainer container = getMessageContainer ( component ) ; WMessages result = null ; if ( container == null ) { LOG . warn ( "No MessageContainer as ancestor of " + component + ". Messages will not be added" ) ; } else { result = container . getMessages ( ) ; if ( resul... | Utility method that searches for the WMessages instance for the given component . If not found a warning will be logged and null returned . |
18,466 | public void error ( final String code ) { WMessages instance = getWMessageInstance ( ) ; if ( instance != null ) { instance . error ( code ) ; } } | Adds an error message . |
18,467 | public void setBeanList ( final List beanList ) { RepeaterModel model = getOrCreateComponentModel ( ) ; model . setData ( beanList ) ; HashSet rowIds = new HashSet ( beanList . size ( ) ) ; for ( Object bean : beanList ) { rowIds . add ( getRowId ( bean ) ) ; } cleanupStaleContexts ( rowIds ) ; UIContext uic = UIContex... | Remember the list of beans that hold the data object for each row . |
18,468 | protected void clearScratchMaps ( final WComponent node ) { UIContext uic = UIContextHolder . getCurrent ( ) ; uic . clearRequestScratchMap ( node ) ; uic . clearScratchMap ( node ) ; if ( node instanceof WRepeater ) { WRepeater repeater = ( WRepeater ) node ; List < UIContext > rowContextList = repeater . getRowContex... | Recursively clears cached component scratch maps . This is called when the bean list changes as the beans may have changed . |
18,469 | public List getBeanList ( ) { List beanList = ( List ) getData ( ) ; if ( beanList == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( beanList ) ; } | Retrieves the list of dataBeans that holds the data object for each row . The list returned will be the same instance as the one supplied via the setBeanList method . Will never return null but it can return an empty list . |
18,470 | public void validate ( final List < Diagnostic > diags ) { List beanList = this . getBeanList ( ) ; WComponent row = getRepeatedComponent ( ) ; for ( int i = 0 ; i < beanList . size ( ) ; i ++ ) { Object rowData = beanList . get ( i ) ; UIContext rowContext = getRowContext ( rowData , i ) ; UIContextHolder . pushContex... | Validates each row . |
18,471 | public void handleRequest ( final Request request ) { assertConfigured ( ) ; List beanList = getBeanList ( ) ; HashSet rowIds = new HashSet ( beanList . size ( ) ) ; WComponent row = getRepeatedComponent ( ) ; for ( int i = 0 ; i < beanList . size ( ) ; i ++ ) { Object rowData = beanList . get ( i ) ; rowIds . add ( ge... | Override handleRequest to process the request for each row . |
18,472 | protected void cleanupStaleContexts ( final Set < ? > rowIds ) { RepeaterModel model = getOrCreateComponentModel ( ) ; if ( model . rowContextMap != null ) { for ( Iterator < Map . Entry < Object , SubUIContext > > i = model . rowContextMap . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry < Object , Su... | Removes any stale contexts from the row context map . |
18,473 | protected void preparePaintComponent ( final Request request ) { assertConfigured ( ) ; List beanList = getBeanList ( ) ; List < Integer > used = new ArrayList < > ( ) ; for ( int i = 0 ; i < beanList . size ( ) ; i ++ ) { Object rowData = beanList . get ( i ) ; UIContext rowContext = getRowContext ( rowData , i ) ; In... | Override preparePaintComponent to prepare each row for painting . |
18,474 | protected void prepareRow ( final Request request , final int rowIndex ) { WComponent row = getRepeatedComponent ( ) ; row . preparePaint ( request ) ; } | Prepares a single row for painting . |
18,475 | public UIContext getRowContext ( final Object rowBean , final int rowIndex ) { RepeaterModel model = getOrCreateComponentModel ( ) ; Object rowId = getRowId ( rowBean ) ; if ( model . rowContextMap == null ) { model . rowContextMap = new HashMap < > ( ) ; } SubUIContext rowContext = model . rowContextMap . get ( rowId ... | Retrieves the UIContext for a row . |
18,476 | public Object getRowBeanForSubcontext ( final SubUIContext subContext ) { if ( subContext . repeatRoot != getRepeatRoot ( ) ) { throw new IllegalArgumentException ( "SubUIContext is not for this WRepeater instance." ) ; } UIContextHolder . pushContext ( subContext . getParentContext ( ) ) ; try { return getRowData ( su... | Returns the row data for the given row context . |
18,477 | private Object getRowData ( final Object rowId ) { Map dataByRowId = ( Map ) getScratchMap ( ) . get ( SCRATCHMAP_DATA_BY_ROW_ID_KEY ) ; if ( dataByRowId == null ) { dataByRowId = createRowIdCache ( ) ; } Object data = dataByRowId . get ( rowId ) ; if ( data == null && ! dataByRowId . containsKey ( rowId ) ) { dataByRo... | Returns the row data corresponding to the given id . |
18,478 | protected Object getRowId ( final Object rowBean ) { String rowIdProperty = getComponentModel ( ) . rowIdProperty ; if ( rowIdProperty == null || rowBean == null ) { return rowBean ; } try { return PropertyUtils . getProperty ( rowBean , rowIdProperty ) ; } catch ( Exception e ) { LOG . error ( "Failed to read row prop... | Retrieves the row id for the given row . |
18,479 | public List < UIContext > getRowContexts ( ) { List < ? > beanList = this . getBeanList ( ) ; List < UIContext > contexts = new ArrayList < > ( beanList . size ( ) ) ; for ( int i = 0 ; i < beanList . size ( ) ; i ++ ) { Object rowData = beanList . get ( i ) ; contexts . add ( this . getRowContext ( rowData , i ) ) ; }... | Retrieves the row contexts for all rows . |
18,480 | public void assignTask ( int taskId , int responsible ) { getResourceFactory ( ) . getApiResource ( "/task/" + taskId + "/assign" ) . entity ( new AssignValue ( responsible ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ) ; } | Assigns the task to another user . This makes the user responsible for the task and its completion . |
18,481 | public void completeTask ( int taskId ) { getResourceFactory ( ) . getApiResource ( "/task/" + taskId + "/complete" ) . entity ( new Empty ( ) , MediaType . APPLICATION_JSON_TYPE ) . post ( ) ; } | Mark the given task as completed . |
18,482 | public void updateDueDate ( int taskId , LocalDate dueDate ) { getResourceFactory ( ) . getApiResource ( "/task/" + taskId + "/due_date" ) . entity ( new TaskDueDate ( dueDate ) , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Updates the due date of the task to the given value |
18,483 | public void updatePrivate ( int taskId , boolean priv ) { getResourceFactory ( ) . getApiResource ( "/task/" + taskId + "/private" ) . entity ( new TaskPrivate ( priv ) , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Update the private flag on the given task . |
18,484 | public void updateText ( int taskId , String text ) { getResourceFactory ( ) . getApiResource ( "/task/" + taskId + "/text" ) . entity ( new TaskText ( text ) , MediaType . APPLICATION_JSON_TYPE ) . put ( ) ; } | Updates the text of the task . |
18,485 | public int createTask ( TaskCreate task , boolean silent , boolean hook ) { TaskCreateResponse response = getResourceFactory ( ) . getApiResource ( "/task/" ) . queryParam ( "silent" , silent ? "1" : "0" ) . queryParam ( "hook" , hook ? "1" : "0" ) . entity ( task , MediaType . APPLICATION_JSON_TYPE ) . post ( TaskCrea... | Creates a new task with no reference to other objects . |
18,486 | public List < Task > getTasksWithReference ( Reference reference ) { return getResourceFactory ( ) . getApiResource ( "/task/" + reference . getType ( ) . name ( ) . toLowerCase ( ) + "/" + reference . getId ( ) + "/" ) . get ( new GenericType < List < Task > > ( ) { } ) ; } | Gets a list of tasks with a reference to the given object . This will return both active and completed tasks . The reference will not be set on the individual tasks . |
18,487 | private Date convertDate ( final Object data ) { if ( data == null ) { return null ; } else if ( data instanceof Date ) { return ( Date ) data ; } else if ( data instanceof Long ) { return new Date ( ( Long ) data ) ; } else if ( data instanceof Calendar ) { return ( ( Calendar ) data ) . getTime ( ) ; } else if ( data... | Attempts to convert the given object to a date . Throws a SystemException on error . |
18,488 | protected void validateComponent ( final List < Diagnostic > diags ) { if ( isParseable ( ) ) { super . validateComponent ( diags ) ; validateDate ( diags ) ; } else { diags . add ( createErrorDiagnostic ( getComponentModel ( ) . errorMessage , this ) ) ; } } | Override WInput s validateComponent to perform further validation on the date . |
18,489 | public void setModel ( final WebComponent component , final WebModel model ) { map . put ( component , model ) ; } | Stores the extrinsic state information for the given component . |
18,490 | public void invokeLater ( final UIContext uic , final Runnable runnable ) { if ( invokeLaterRunnables == null ) { invokeLaterRunnables = new ArrayList < > ( ) ; } invokeLaterRunnables . add ( new UIContextImplRunnable ( uic , runnable ) ) ; } | Adds a runnable to the list of runnables to be invoked later . |
18,491 | public void setFocussed ( final WComponent component , final UIContext uic ) { this . focussed = component ; this . focussedUIC = uic ; } | Sets the component in this UIC which is to be the focus of the client browser cursor . The id of the component is used to find the focussed element in the rendered html . Since id could be different in different contexts the context of the component is also needed . |
18,492 | public Object getFwkAttribute ( final String name ) { if ( attribMap == null ) { return null ; } return attribMap . get ( name ) ; } | Reserved for internal framework use . Retrieves a framework attribute . |
18,493 | public void setFwkAttribute ( final String name , final Object value ) { if ( attribMap == null ) { attribMap = new HashMap < > ( ) ; } attribMap . put ( name , value ) ; } | Reserved for internal framework use . Sets a framework attribute . |
18,494 | public Map < Object , Object > getScratchMap ( final WComponent component ) { if ( scratchMaps == null ) { scratchMaps = new HashMap < > ( ) ; } Map < Object , Object > componentScratchMap = scratchMaps . get ( component ) ; if ( componentScratchMap == null ) { componentScratchMap = new HashMap < > ( 2 ) ; scratchMaps ... | Reserved for internal framework use . Retrieves a scratch area where data can be temporarily stored . WComponents must not rely on data being available in the scratch area after each phase . |
18,495 | private void setupLabel ( ) { WText textBody = new WText ( ) { public boolean isEncodeText ( ) { return WHeading . this . isEncodeText ( ) ; } public String getText ( ) { return WHeading . this . getText ( ) ; } } ; if ( label . getBody ( ) == null ) { label . setBody ( textBody ) ; } else { WComponent oldBody = label ... | Setup the label . |
18,496 | private void addNullLabelExample ( ) { add ( new WHeading ( HeadingLevel . H2 , "How to use accessible null WLabels" ) ) ; add ( new ExplanatoryText ( "These examples shows how sometime a null WLabel is the right thing to do." + "\n This example uses a WFieldSet as the labelled component and it has its own \"label\"." ... | Example of when and how to use a null WLabel . |
18,497 | public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WHeading heading = ( WHeading ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:heading" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute... | Paints the given WHeading . |
18,498 | protected boolean execute ( ) { if ( ( trigger instanceof Disableable ) && ( ( Disableable ) trigger ) . isDisabled ( ) && ! ( trigger instanceof Input && ( ( Input ) trigger ) . isReadOnly ( ) ) ) { return false ; } final Object triggerValue = getTriggerValue ( null ) ; final Object compareValue = getCompareValue ( ) ... | Compare the trigger and compare value . |
18,499 | public boolean isTabVisible ( final int idx ) { WTab tab = getTab ( idx ) ; Container tabParent = tab . getParent ( ) ; if ( tabParent instanceof WTabGroup ) { return tab . isVisible ( ) && tabParent . isVisible ( ) ; } else { return tab . isVisible ( ) ; } } | Indicates whether the tab at the given index is visible . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.