idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
8,400 | protected void loadConfigs ( ) { configs = new Properties ( ) ; if ( ClassPathUtil . testRunMainInJar ( ) ) { String [ ] classPathsInFileSystem = ClassPathUtil . getAllClassPathNotInJar ( ) ; String workDir = System . getProperty ( "user.dir" ) ; String mainJarRelativePath = ClassPathUtil . getClassPathsInSystemProperty ( ) [ 0 ] ; File mainJar = new File ( workDir , mainJarRelativePath ) ; File mainJarDir = mainJar . getParentFile ( ) ; for ( String classPath : classPathsInFileSystem ) { File classPathFile = new File ( classPath ) ; File configFile ; if ( classPathFile . isAbsolute ( ) ) { configFile = new File ( classPathFile , propertiesAbsoluteClassPath ) ; } else { configFile = new File ( new File ( mainJarDir , classPath ) , propertiesAbsoluteClassPath ) ; } if ( configFile . exists ( ) && configFile . isFile ( ) ) { InputStream is = null ; try { is = new FileInputStream ( configFile ) ; loadConfigsFromStream ( is ) ; } catch ( FileNotFoundException e ) { LOGGER . warn ( "Load config file " + configFile . getPath ( ) + " error!" , e ) ; } return ; } } } if ( propertiesFilePath == null ) { if ( propertiesAbsoluteClassPath == null ) { return ; } InputStream is = OneProperties . class . getResourceAsStream ( propertiesAbsoluteClassPath ) ; loadConfigsFromStream ( is ) ; } else { configs = PropertiesIO . load ( propertiesFilePath ) ; } } | Load properties . Will refresh configs every time . |
8,401 | protected void modifyConfig ( IConfigKey key , String value ) throws IOException { if ( propertiesFilePath == null ) { LOGGER . warn ( "Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library." ) ; } if ( configs == null ) { loadConfigs ( ) ; } configs . setProperty ( key . getKeyString ( ) , value ) ; PropertiesIO . store ( propertiesFilePath , configs ) ; } | Modify one config and write new config into properties file . |
8,402 | protected boolean insertToCollection ( IQueueMessage < ID , DATA > msg ) { getCollection ( ) . insertOne ( toDocument ( msg ) ) ; return true ; } | Insert a new message to collection . |
8,403 | public T get ( final int key ) { final int hash = hashOf ( key ) ; int index = hash & mask ; if ( containsKey ( key , index ) ) { return ( T ) values [ index ] ; } if ( states [ index ] == FREE ) { return missingEntries ; } int j = index ; for ( int perturb = perturb ( hash ) ; states [ index ] != FREE ; perturb >>= PERTURB_SHIFT ) { j = probe ( perturb , j ) ; index = j & mask ; if ( containsKey ( key , index ) ) { return ( T ) values [ index ] ; } } return missingEntries ; } | Get the stored value associated with the given key |
8,404 | private T doRemove ( int index ) { keys [ index ] = 0 ; states [ index ] = REMOVED ; final Object previous = values [ index ] ; values [ index ] = missingEntries ; -- size ; ++ count ; return ( T ) previous ; } | Remove an element at specified index . |
8,405 | protected byte [ ] serialize ( IQueueMessage < ID , DATA > queueMsg ) { return queueMsg != null ? SerializationUtils . toByteArray ( queueMsg ) : null ; } | Serialize a queue message to bytes . |
8,406 | private RRBudget10Document getRRBudget10 ( ) { deleteAutoGenNarratives ( ) ; RRBudget10Document rrBudgetDocument = RRBudget10Document . Factory . newInstance ( ) ; RRBudget10 rrBudget = RRBudget10 . Factory . newInstance ( ) ; rrBudget . setFormVersion ( FormVersion . v1_1 . getVersion ( ) ) ; if ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) != null ) { rrBudget . setDUNSID ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getDunsNumber ( ) ) ; rrBudget . setOrganizationName ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getOrganizationName ( ) ) ; } rrBudget . setBudgetType ( BudgetTypeDataType . PROJECT ) ; List < BudgetPeriodDto > budgetperiodList ; BudgetSummaryDto budgetSummary = null ; try { validateBudgetForForm ( pdDoc ) ; budgetperiodList = s2sBudgetCalculatorService . getBudgetPeriods ( pdDoc ) ; budgetSummary = s2sBudgetCalculatorService . getBudgetInfo ( pdDoc , budgetperiodList ) ; } catch ( S2SException e ) { LOG . error ( e . getMessage ( ) , e ) ; return rrBudgetDocument ; } rrBudget . setBudgetSummary ( getBudgetSummary ( budgetSummary ) ) ; for ( BudgetPeriodDto budgetPeriodData : budgetperiodList ) { setBudgetYearDataType ( rrBudget , budgetPeriodData ) ; } AttachedFileDataType attachedFileDataType = AttachedFileDataType . Factory . newInstance ( ) ; for ( NarrativeContract narrative : pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) ) { if ( narrative . getNarrativeType ( ) . getCode ( ) != null && Integer . parseInt ( narrative . getNarrativeType ( ) . getCode ( ) ) == 132 ) { attachedFileDataType = getAttachedFileType ( narrative ) ; if ( attachedFileDataType != null ) { break ; } } } rrBudget . setBudgetJustificationAttachment ( attachedFileDataType ) ; rrBudgetDocument . setRRBudget10 ( rrBudget ) ; return rrBudgetDocument ; } | This method returns RRBudget10Document object based on proposal development document which contains the informations such as DUNSID OrganizationName BudgetType BudgetYear and BudgetSummary . |
8,407 | private IndirectCosts getIndirectCosts ( BudgetPeriodDto periodInfo ) { IndirectCosts indirectCosts = null ; if ( periodInfo != null && periodInfo . getIndirectCosts ( ) != null && periodInfo . getIndirectCosts ( ) . getIndirectCostDetails ( ) != null ) { List < IndirectCosts . IndirectCost > indirectCostList = new ArrayList < > ( ) ; int IndirectCostCount = 0 ; for ( IndirectCostDetailsDto indirectCostDetails : periodInfo . getIndirectCosts ( ) . getIndirectCostDetails ( ) ) { IndirectCosts . IndirectCost indirectCost = IndirectCosts . IndirectCost . Factory . newInstance ( ) ; if ( indirectCostDetails . getBase ( ) != null ) { indirectCost . setBase ( indirectCostDetails . getBase ( ) . bigDecimalValue ( ) ) ; } indirectCost . setCostType ( indirectCostDetails . getCostType ( ) ) ; if ( indirectCostDetails . getFunds ( ) != null ) { indirectCost . setFundRequested ( indirectCostDetails . getFunds ( ) . bigDecimalValue ( ) ) ; } if ( indirectCostDetails . getRate ( ) != null ) { indirectCost . setRate ( indirectCostDetails . getRate ( ) . bigDecimalValue ( ) ) ; } indirectCostList . add ( indirectCost ) ; IndirectCostCount ++ ; if ( IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA ) { LOG . warn ( "Stopping iteration over indirect cost details because array limit in schema is only 4" ) ; break ; } } if ( IndirectCostCount > 0 ) { indirectCosts = IndirectCosts . Factory . newInstance ( ) ; IndirectCosts . IndirectCost indirectCostArray [ ] = new IndirectCosts . IndirectCost [ 0 ] ; indirectCosts . setIndirectCostArray ( indirectCostList . toArray ( indirectCostArray ) ) ; if ( periodInfo . getIndirectCosts ( ) . getTotalIndirectCosts ( ) != null ) { indirectCosts . setTotalIndirectCosts ( periodInfo . getIndirectCosts ( ) . getTotalIndirectCosts ( ) . bigDecimalValue ( ) ) ; } } } return indirectCosts ; } | This method returns IndirectCosts details such as Base CostType FundRequested Rate and TotalIndirectCosts in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10 . |
8,408 | private void setOthersForOtherDirectCosts ( OtherDirectCosts otherDirectCosts , BudgetPeriodDto periodInfo ) { if ( periodInfo != null && periodInfo . getOtherDirectCosts ( ) != null ) { for ( OtherDirectCostInfoDto otherDirectCostInfo : periodInfo . getOtherDirectCosts ( ) ) { gov . grants . apply . forms . rrBudget10V11 . BudgetYearDataType . OtherDirectCosts . Other other = otherDirectCosts . addNewOther ( ) ; if ( otherDirectCostInfo . getOtherCosts ( ) != null && otherDirectCostInfo . getOtherCosts ( ) . size ( ) > 0 ) { other . setCost ( new BigDecimal ( otherDirectCostInfo . getOtherCosts ( ) . get ( 0 ) . get ( CostConstants . KEY_COST ) ) ) ; } other . setDescription ( OTHERCOST_DESCRIPTION ) ; } } } | This method is to set Other type description and total cost OtherDirectCosts details in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10 . |
8,409 | private PostDocAssociates getPostDocAssociates ( OtherPersonnelDto otherPersonnel ) { PostDocAssociates postDocAssociates = PostDocAssociates . Factory . newInstance ( ) ; if ( otherPersonnel != null ) { postDocAssociates . setNumberOfPersonnel ( otherPersonnel . getNumberPersonnel ( ) ) ; postDocAssociates . setProjectRole ( otherPersonnel . getRole ( ) ) ; CompensationDto sectBCompType = otherPersonnel . getCompensation ( ) ; postDocAssociates . setRequestedSalary ( sectBCompType . getRequestedSalary ( ) . bigDecimalValue ( ) ) ; postDocAssociates . setFringeBenefits ( sectBCompType . getFringe ( ) . bigDecimalValue ( ) ) ; postDocAssociates . setAcademicMonths ( sectBCompType . getAcademicMonths ( ) . bigDecimalValue ( ) ) ; postDocAssociates . setCalendarMonths ( sectBCompType . getCalendarMonths ( ) . bigDecimalValue ( ) ) ; postDocAssociates . setFundsRequested ( sectBCompType . getFundsRequested ( ) . bigDecimalValue ( ) ) ; postDocAssociates . setSummerMonths ( sectBCompType . getSummerMonths ( ) . bigDecimalValue ( ) ) ; } return postDocAssociates ; } | This method gets the PostDocAssociates details ProjectRole NumberOfPersonnel Compensation based on OtherPersonnelInfo for the RRBudget10 if it is a PostDocAssociates type . |
8,410 | private GraduateStudents getGraduateStudents ( OtherPersonnelDto otherPersonnel ) { GraduateStudents graduate = GraduateStudents . Factory . newInstance ( ) ; if ( otherPersonnel != null ) { graduate . setNumberOfPersonnel ( otherPersonnel . getNumberPersonnel ( ) ) ; graduate . setProjectRole ( otherPersonnel . getRole ( ) ) ; CompensationDto sectBCompType = otherPersonnel . getCompensation ( ) ; graduate . setRequestedSalary ( sectBCompType . getRequestedSalary ( ) . bigDecimalValue ( ) ) ; graduate . setFringeBenefits ( sectBCompType . getFringe ( ) . bigDecimalValue ( ) ) ; graduate . setAcademicMonths ( sectBCompType . getAcademicMonths ( ) . bigDecimalValue ( ) ) ; graduate . setCalendarMonths ( sectBCompType . getCalendarMonths ( ) . bigDecimalValue ( ) ) ; graduate . setFundsRequested ( sectBCompType . getFundsRequested ( ) . bigDecimalValue ( ) ) ; graduate . setSummerMonths ( sectBCompType . getSummerMonths ( ) . bigDecimalValue ( ) ) ; } return graduate ; } | This method gets the GraduateStudents details ProjectRole NumberOfPersonnel Compensation based on OtherPersonnelInfo for the RRBudget10 if it is a GraduateStudents type . |
8,411 | private UndergraduateStudents getUndergraduateStudents ( OtherPersonnelDto otherPersonnel ) { UndergraduateStudents undergraduate = UndergraduateStudents . Factory . newInstance ( ) ; if ( otherPersonnel != null ) { undergraduate . setNumberOfPersonnel ( otherPersonnel . getNumberPersonnel ( ) ) ; undergraduate . setProjectRole ( otherPersonnel . getRole ( ) ) ; CompensationDto sectBCompType = otherPersonnel . getCompensation ( ) ; undergraduate . setRequestedSalary ( sectBCompType . getRequestedSalary ( ) . bigDecimalValue ( ) ) ; undergraduate . setFringeBenefits ( sectBCompType . getFringe ( ) . bigDecimalValue ( ) ) ; undergraduate . setAcademicMonths ( sectBCompType . getAcademicMonths ( ) . bigDecimalValue ( ) ) ; undergraduate . setCalendarMonths ( sectBCompType . getCalendarMonths ( ) . bigDecimalValue ( ) ) ; undergraduate . setFundsRequested ( sectBCompType . getFundsRequested ( ) . bigDecimalValue ( ) ) ; undergraduate . setSummerMonths ( sectBCompType . getSummerMonths ( ) . bigDecimalValue ( ) ) ; } return undergraduate ; } | This method is to get the UndergraduateStudents details ProjectRole NumberOfPersonnel Compensation based on OtherPersonnelInfo for the RRBudget10 if it is a UndergraduateStudents type . |
8,412 | private SecretarialClerical getSecretarialClerical ( OtherPersonnelDto otherPersonnel ) { SecretarialClerical secretarialClerical = SecretarialClerical . Factory . newInstance ( ) ; if ( otherPersonnel != null ) { secretarialClerical . setNumberOfPersonnel ( otherPersonnel . getNumberPersonnel ( ) ) ; secretarialClerical . setProjectRole ( otherPersonnel . getRole ( ) ) ; CompensationDto sectBCompType = otherPersonnel . getCompensation ( ) ; secretarialClerical . setRequestedSalary ( sectBCompType . getRequestedSalary ( ) . bigDecimalValue ( ) ) ; secretarialClerical . setFringeBenefits ( sectBCompType . getFringe ( ) . bigDecimalValue ( ) ) ; secretarialClerical . setAcademicMonths ( sectBCompType . getAcademicMonths ( ) . bigDecimalValue ( ) ) ; secretarialClerical . setCalendarMonths ( sectBCompType . getCalendarMonths ( ) . bigDecimalValue ( ) ) ; secretarialClerical . setFundsRequested ( sectBCompType . getFundsRequested ( ) . bigDecimalValue ( ) ) ; secretarialClerical . setSummerMonths ( sectBCompType . getSummerMonths ( ) . bigDecimalValue ( ) ) ; } return secretarialClerical ; } | This method is to get the SecretarialClerical details ProjectRole NumberOfPersonnel Compensation based on OtherPersonnelInfo for the RRBudget10 if it is a SecretarialClerical type . |
8,413 | private List < File > listFiles ( File file , List < File > files ) { File [ ] children = file . listFiles ( ) ; if ( children != null ) { for ( File child : children ) { files . add ( child ) ; listFiles ( child , files ) ; } } return files ; } | Recurse over entire directory subtree adding entries to the file list . |
8,414 | public static void associateCommand ( String commandName , BaseUIComponent component , IAction action ) { getCommand ( commandName , true ) . bind ( component , action ) ; } | Associates a UI component with a command and action . |
8,415 | public static void dissociateCommand ( String commandName , BaseUIComponent component ) { Command command = getCommand ( commandName , false ) ; if ( command != null ) { command . unbind ( component ) ; } } | Dissociate a UI component with a command . |
8,416 | public static void dissociateAll ( BaseUIComponent component ) { for ( Command command : CommandRegistry . getInstance ( ) ) { command . unbind ( component ) ; } } | Removes all command bindings for a component . |
8,417 | public static Command getCommand ( String commandName , boolean forceCreate ) { return CommandRegistry . getInstance ( ) . get ( commandName , forceCreate ) ; } | Returns a command from the command registry . |
8,418 | private static void addShortcut ( StringBuilder sb , Set < String > shortcuts ) { if ( sb . length ( ) > 0 ) { String shortcut = validateShortcut ( sb . toString ( ) ) ; if ( shortcut != null ) { shortcuts . add ( shortcut ) ; } sb . delete ( 0 , sb . length ( ) ) ; } } | Adds a parsed shortcut to the set of shortcuts . Only valid shortcuts are added . |
8,419 | private File resolveIndexDirectoryPath ( ) throws IOException { if ( StringUtils . isEmpty ( indexDirectoryPath ) ) { indexDirectoryPath = System . getProperty ( "java.io.tmpdir" ) + appContext . getApplicationName ( ) ; } File dir = new File ( indexDirectoryPath , getClass ( ) . getPackage ( ) . getName ( ) ) ; if ( ! dir . exists ( ) && ! dir . mkdirs ( ) ) { throw new IOException ( "Failed to create help search index directory." ) ; } log . info ( "Help search index located at " + dir ) ; return dir ; } | Resolves the index directory path . If a path is not specified one is created within temporary storage . |
8,420 | public void indexHelpModule ( HelpModule helpModule ) { try { if ( indexTracker . isSame ( helpModule ) ) { return ; } unindexHelpModule ( helpModule ) ; log . info ( "Indexing help module " + helpModule . getLocalizedId ( ) ) ; int i = helpModule . getUrl ( ) . lastIndexOf ( '/' ) ; String pattern = "classpath:" + helpModule . getUrl ( ) . substring ( 0 , i + 1 ) + "*.htm*" ; for ( Resource resource : appContext . getResources ( pattern ) ) { indexDocument ( helpModule , resource ) ; } writer . commit ( ) ; indexTracker . add ( helpModule ) ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } } | Index all HTML files within the content of the help module . |
8,421 | public void unindexHelpModule ( HelpModule helpModule ) { try { log . info ( "Removing index for help module " + helpModule . getLocalizedId ( ) ) ; Term term = new Term ( "module" , helpModule . getLocalizedId ( ) ) ; writer . deleteDocuments ( term ) ; writer . commit ( ) ; indexTracker . remove ( helpModule ) ; } catch ( IOException e ) { MiscUtil . toUnchecked ( e ) ; } } | Removes the index for a help module . |
8,422 | private void indexDocument ( HelpModule helpModule , Resource resource ) throws Exception { String title = getTitle ( resource ) ; try ( InputStream is = resource . getInputStream ( ) ) { Document document = new Document ( ) ; document . add ( new TextField ( "module" , helpModule . getLocalizedId ( ) , Store . YES ) ) ; document . add ( new TextField ( "source" , helpModule . getTitle ( ) , Store . YES ) ) ; document . add ( new TextField ( "title" , title , Store . YES ) ) ; document . add ( new TextField ( "url" , resource . getURL ( ) . toString ( ) , Store . YES ) ) ; document . add ( new TextField ( "content" , tika . parseToString ( is ) , Store . NO ) ) ; writer . addDocument ( document ) ; } } | Index an HTML text file resource . |
8,423 | private String getTitle ( Resource resource ) { String title = null ; try ( InputStream is = resource . getInputStream ( ) ) { Iterator < String > iter = IOUtils . lineIterator ( is , "UTF-8" ) ; while ( iter . hasNext ( ) ) { String line = iter . next ( ) . trim ( ) ; String lower = line . toLowerCase ( ) ; int i = lower . indexOf ( "<title>" ) ; if ( i > - 1 ) { i += 7 ; int j = lower . indexOf ( "</title>" , i ) ; title = line . substring ( i , j == - 1 ? line . length ( ) : j ) . trim ( ) ; title = title . replace ( "_no" , "" ) . replace ( '_' , ' ' ) ; break ; } } } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } return title ; } | Extract the title of the document if any . |
8,424 | public void search ( String words , Collection < IHelpSet > helpSets , IHelpSearchListener listener ) { try { if ( queryBuilder == null ) { initQueryBuilder ( ) ; } Query searchForWords = queryBuilder . createBooleanQuery ( "content" , words , Occur . MUST ) ; Query searchForModules = queryBuilder . createBooleanQuery ( "module" , StrUtil . fromList ( helpSets , " " ) ) ; BooleanQuery query = new BooleanQuery ( ) ; query . add ( searchForModules , Occur . MUST ) ; query . add ( searchForWords , Occur . MUST ) ; TopDocs docs = indexSearcher . search ( query , 9999 ) ; List < HelpSearchHit > hits = new ArrayList < > ( docs . totalHits ) ; for ( ScoreDoc sdoc : docs . scoreDocs ) { Document doc = indexSearcher . doc ( sdoc . doc ) ; String source = doc . get ( "source" ) ; String title = doc . get ( "title" ) ; String url = doc . get ( "url" ) ; HelpTopic topic = new HelpTopic ( new URL ( url ) , title , source ) ; HelpSearchHit hit = new HelpSearchHit ( topic , sdoc . score ) ; hits . add ( hit ) ; } listener . onSearchComplete ( hits ) ; } catch ( Exception e ) { MiscUtil . toUnchecked ( e ) ; } } | Performs a search query using the specified string on each registered query handler calling the listener for each set of results . |
8,425 | public void init ( ) throws IOException { File path = resolveIndexDirectoryPath ( ) ; indexTracker = new IndexTracker ( path ) ; indexDirectory = FSDirectory . open ( path ) ; tika = new Tika ( null , new HtmlParser ( ) ) ; Analyzer analyzer = new StandardAnalyzer ( ) ; IndexWriterConfig config = new IndexWriterConfig ( Version . LATEST , analyzer ) ; writer = new IndexWriter ( indexDirectory , config ) ; } | Initialize the index writer . |
8,426 | private synchronized void initQueryBuilder ( ) throws IOException { if ( queryBuilder == null ) { indexReader = DirectoryReader . open ( indexDirectory ) ; indexSearcher = new IndexSearcher ( indexReader ) ; queryBuilder = new QueryBuilder ( writer . getAnalyzer ( ) ) ; } } | Performs a delayed initialization of the query builder to ensure that the index has been fully created . |
8,427 | public static AlertContainer render ( BaseComponent parent , BaseComponent child ) { AlertContainer container = new AlertContainer ( child ) ; parent . addChild ( container , 0 ) ; return container ; } | Renders an alert in its container . |
8,428 | public void doAction ( Action action ) { BaseComponent parent = getParent ( ) ; switch ( action ) { case REMOVE : ActionListener . unbindActionListeners ( this , actionListeners ) ; detach ( ) ; break ; case HIDE : case COLLAPSE : setVisible ( false ) ; break ; case SHOW : case EXPAND : setVisible ( true ) ; break ; case TOP : parent . addChild ( this , 0 ) ; break ; } if ( parent != null ) { EventUtil . post ( MainController . ALERT_ACTION_EVENT , parent , action ) ; } } | Perform the specified action on the drop container . Also notifies the container s parent that an action has occurred . |
8,429 | public void assertSubscriptions ( ) { for ( String channel : subscribers . keySet ( ) ) { try { subscribers . put ( channel , null ) ; subscribe ( channel ) ; } catch ( Throwable e ) { break ; } } } | Reassert subscriptions . |
8,430 | public void removeSubscriptions ( ) { for ( TopicSubscriber subscriber : subscribers . values ( ) ) { try { subscriber . close ( ) ; } catch ( Throwable e ) { log . debug ( "Error closing subscriber" , e ) ; } } subscribers . clear ( ) ; } | Remove all remote subscriptions . |
8,431 | public String getCaption ( ) { return caption != null && caption . toLowerCase ( ) . startsWith ( "label:" ) ? StrUtil . getLabel ( caption . substring ( 6 ) ) : caption ; } | Returns the value of the button s caption text . |
8,432 | public Element createDOMNode ( Element parent ) { Element domNode = parent . getOwnerDocument ( ) . createElement ( tagName ) ; LayoutUtil . copyAttributes ( attributes , domNode ) ; parent . appendChild ( domNode ) ; return domNode ; } | Creates a DOM node from this layout node . |
8,433 | public void reset ( ) throws IOException { if ( t1 == null || t2 == null ) { throw new IllegalStateException ( "Cannot reset after close." ) ; } if ( ! isEmpty ( getOutput ( ) ) ) { toggle = ! toggle ; PathTools . deleteRecursive ( getOutput ( ) , false ) ; } else { throw new IOException ( "Cannot swap to an empty folder." ) ; } } | Resets the input and output folder before writing to the output again |
8,434 | public void close ( ) throws IOException { if ( t1 == null || t2 == null ) { return ; } try { if ( ! isEmpty ( getOutput ( ) ) ) { Optional < ? extends IOException > ex = output . apply ( getOutput ( ) ) ; if ( ex . isPresent ( ) ) { throw ex . get ( ) ; } } else if ( ! isEmpty ( getInput ( ) ) ) { Optional < ? extends IOException > ex = output . apply ( getInput ( ) ) ; if ( ex . isPresent ( ) ) { throw ex . get ( ) ; } } else { throw new IOException ( "Corrupted state." ) ; } } finally { PathTools . deleteRecursive ( t1 ) ; PathTools . deleteRecursive ( t2 ) ; t1 = null ; t2 = null ; } } | Process the result with the output function and then closes the temporary folders . Closing the TempFolderHandler is a mandatory last step after which no other calls to the object should be made . |
8,435 | public void setDetail ( String name , Object value ) { if ( value == null ) { details . remove ( name ) ; } else { details . put ( name , value ) ; } if ( log . isDebugEnabled ( ) ) { if ( value == null ) { log . debug ( "Detail removed: " + name ) ; } else { log . debug ( "Detail added: " + name + " = " + value ) ; } } } | Sets the specified detail element to the specified value . |
8,436 | public Object getDetail ( String name ) { return name == null ? null : details . get ( name ) ; } | Returns the specified detail element . |
8,437 | public void init ( ) { IUser user = SecurityUtil . getAuthenticatedUser ( ) ; publisherInfo . setUserId ( user == null ? null : user . getLogicalId ( ) ) ; publisherInfo . setUserName ( user == null ? "" : user . getFullName ( ) ) ; publisherInfo . setAppName ( getAppName ( ) ) ; publisherInfo . setConsumerId ( consumer . getNodeId ( ) ) ; publisherInfo . setProducerId ( producer . getNodeId ( ) ) ; publisherInfo . setSessionId ( sessionId ) ; localEventDispatcher . setGlobalEventDispatcher ( this ) ; pingEventHandler = new PingEventHandler ( ( IEventManager ) localEventDispatcher , publisherInfo ) ; pingEventHandler . init ( ) ; } | Initialize after setting all requisite properties . |
8,438 | public void fireRemoteEvent ( String eventName , Serializable eventData , Recipient ... recipients ) { Message message = new EventMessage ( eventName , eventData ) ; producer . publish ( EventUtil . getChannelName ( eventName ) , message , recipients ) ; } | Queues the specified event for delivery via the messaging service . |
8,439 | protected String getAppName ( ) { if ( appName == null && FrameworkUtil . isInitialized ( ) ) { setAppName ( FrameworkUtil . getAppName ( ) ) ; } return appName ; } | Returns the application name . |
8,440 | public static HelpViewerMode getViewerMode ( Page page ) { return page == null || ! page . hasAttribute ( EMBEDDED_ATTRIB ) ? defaultMode : ( HelpViewerMode ) page . getAttribute ( EMBEDDED_ATTRIB ) ; } | Returns the help viewer mode for the specified page . |
8,441 | public static void setViewerMode ( Page page , HelpViewerMode mode ) { if ( getViewerMode ( page ) != mode ) { removeViewer ( page , true ) ; } page . setAttribute ( EMBEDDED_ATTRIB , mode ) ; } | Sets the help viewer mode for the specified page . If different from the previous mode and a viewer for this page exists the viewer will be removed and recreated on the next request . |
8,442 | public static IHelpViewer getViewer ( boolean forceCreate ) { Page page = getPage ( ) ; IHelpViewer viewer = ( IHelpViewer ) page . getAttribute ( VIEWER_ATTRIB ) ; return viewer != null ? viewer : forceCreate ? createViewer ( page ) : null ; } | Returns an instance of the viewer for the current page . If no instance yet exists and forceCreate is true one is created . |
8,443 | private static IHelpViewer createViewer ( Page page ) { IHelpViewer viewer ; if ( getViewerMode ( page ) == HelpViewerMode . POPUP ) { viewer = new HelpViewerProxy ( page ) ; } else { BaseComponent root = PageUtil . createPage ( VIEWER_URL , page ) . get ( 0 ) ; viewer = ( IHelpViewer ) root . getAttribute ( "controller" ) ; } page . setAttribute ( VIEWER_ATTRIB , viewer ) ; return viewer ; } | Creates an instance of the help viewer associating it with the specified page . |
8,444 | protected static void removeViewer ( Page page , boolean close ) { IHelpViewer viewer = ( IHelpViewer ) page . removeAttribute ( VIEWER_ATTRIB ) ; if ( viewer != null && close ) { viewer . close ( ) ; } } | Remove and optionally close the help viewer associated with the specified page . |
8,445 | protected static void removeViewer ( Page page , IHelpViewer viewer , boolean close ) { if ( viewer != null && viewer == page . getAttribute ( VIEWER_ATTRIB ) ) { removeViewer ( page , close ) ; } } | Remove and optionally close the specified help viewer if is the active viewer for the specified page . |
8,446 | public static String getUrl ( String path ) { if ( path == null ) { return path ; } ServletContext sc = ExecutionContext . getSession ( ) . getServletContext ( ) ; if ( path . startsWith ( "jar:" ) ) { int i = path . indexOf ( "!" ) ; path = i < 0 ? path : path . substring ( ++ i ) ; } path = sc . getContextPath ( ) + path ; return path ; } | Returns a URL string representing the root path and context path . |
8,447 | public static void show ( String module , String topic , String label ) { getViewer ( true ) . show ( module , topic , label ) ; } | Show help for the given module and optional topic . |
8,448 | public static void showCSH ( BaseComponent component ) { while ( component != null ) { HelpContext target = ( HelpContext ) component . getAttribute ( CSH_TARGET ) ; if ( target != null ) { HelpUtil . show ( target ) ; break ; } component = component . getParent ( ) ; } } | Display context - sensitive help associated with the specified component . If none is associated with the component its parent is examined and so on . If no help association is found no action is taken . |
8,449 | public static void associateCSH ( BaseUIComponent component , HelpContext helpContext , BaseUIComponent commandTarget ) { if ( component != null ) { component . setAttribute ( CSH_TARGET , helpContext ) ; CommandUtil . associateCommand ( "help" , component , commandTarget ) ; } } | Associates context - sensitive help topic with a component . Any existing association is replaced . |
8,450 | public static void dissociateCSH ( BaseUIComponent component ) { if ( component != null && component . hasAttribute ( CSH_TARGET ) ) { CommandUtil . dissociateCommand ( "help" , component ) ; component . removeAttribute ( CSH_TARGET ) ; } } | Dissociates context - sensitive help from a component . |
8,451 | public static void subtract ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] -= array2 [ i ] ; } } | Each element of the second array is subtracted from each element of the first . |
8,452 | public static void multiply ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] *= array2 [ i ] ; } } | Each element of the second array is multiplied with each element of the first . |
8,453 | public static void divide ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] /= array2 [ i ] ; } } | Each element of the first array is divided by each element of the second . |
8,454 | public static int indexOf ( double [ ] array , double val ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == val ) { return i ; } } return - 1 ; } | Gets the first index of a given value in an array or - 1 if not present . |
8,455 | public static int lastIndexOf ( double [ ] array , double val ) { for ( int i = array . length - 1 ; i >= 0 ; i -- ) { if ( array [ i ] == val ) { return i ; } } return - 1 ; } | Gets the last index of a given value in an array or - 1 if not present . |
8,456 | public static Provider < String > getPropertyProvider ( Binder binder , String propertyName ) { return binder . getProvider ( getPropertyKey ( propertyName ) ) ; } | Obtains property provider |
8,457 | public static Provider < String > bindDefault ( Binder binder , String propertyName , String defaultValue ) { Key < String > propertyKey = getPropertyKey ( propertyName ) ; OptionalBinder < String > optionalBinder = OptionalBinder . newOptionalBinder ( binder , propertyKey ) ; optionalBinder . setDefault ( ) . toInstance ( defaultValue ) ; return binder . getProvider ( propertyKey ) ; } | Binds default value to specified property |
8,458 | public static < T > Collector < T , List < T > > toList ( ) { return new Collector < T , List < T > > ( ) { public List < T > collect ( Stream < ? extends T > stream ) { return Lists . newArrayList ( stream . iterator ( ) ) ; } } ; } | Collect to array list . |
8,459 | public static < T > Collector < T , Set < T > > toSet ( ) { return new Collector < T , Set < T > > ( ) { public Set < T > collect ( Stream < ? extends T > stream ) { return Sets . newHashSet ( stream . iterator ( ) ) ; } } ; } | Collect to hash set |
8,460 | public void transform ( InputStream inputStream , OutputStream outputStream ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream , CS_WIN1252 ) ) ) { String line ; String closingTag = null ; Stack < String > stack = new Stack < > ( ) ; String id = null ; String url = null ; String label = null ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; int i = line . indexOf ( '>' , 1 ) ; int j = line . indexOf ( ' ' , 1 ) ; int end = i == - 1 ? j : j == - 1 ? i : i < j ? i : j ; int token = ArrayUtils . indexOf ( TOKENS , end < 1 ? "" : line . substring ( 1 , end ) . toLowerCase ( ) ) ; if ( stack . isEmpty ( ) && token != 0 ) { continue ; } switch ( token ) { case 0 : if ( closingTag != null ) { write ( outputStream , ">" , true , 0 ) ; closingTag = "</topic>" ; } stack . push ( closingTag ) ; closingTag = null ; break ; case 1 : write ( outputStream , closingTag , true , 0 ) ; closingTag = stack . pop ( ) ; writeClosingTag ( outputStream , closingTag , stack . size ( ) ) ; closingTag = null ; break ; case 2 : writeClosingTag ( outputStream , closingTag , 0 ) ; write ( outputStream , "<topic" , false , stack . size ( ) ) ; closingTag = " />" ; break ; case 3 : String name = extractAttribute ( "name" , line ) ; String value = extractAttribute ( "value" , line ) ; if ( "name" . equalsIgnoreCase ( name ) ) { if ( label == null ) { label = value ; } else { id = value ; } } else if ( "local" . equalsIgnoreCase ( name ) ) { url = value ; } break ; case 4 : writeAttribute ( outputStream , "id" , id ) ; writeAttribute ( outputStream , "label" , label ) ; writeAttribute ( outputStream , "url" , url ) ; id = label = url = null ; break ; } } } } | Transforms the input to well - formed XML . |
8,461 | public void registerDestructionCallback ( String name , Runnable callback ) { synchronized ( this ) { destructionCallbacks . put ( name , callback ) ; } } | Register a bean destruction callback . |
8,462 | public void destroy ( ) { for ( Entry < String , Runnable > entry : destructionCallbacks . entrySet ( ) ) { try { entry . getValue ( ) . run ( ) ; } catch ( Throwable t ) { log . error ( "Error during destruction callback for bean " + entry . getKey ( ) , t ) ; } } beans . clear ( ) ; destructionCallbacks . clear ( ) ; } | Calls all registered destruction callbacks and removes all bean references from the container . |
8,463 | public String getProperty ( String name ) { return name . startsWith ( LABEL_PREFIX ) ? StrUtil . getLabel ( name . substring ( LABEL_PREFIX . length ( ) ) ) : null ; } | Label names must be prefixed with |
8,464 | private void setAddress ( Address address , RolodexContract rolodex ) { if ( rolodex != null ) { address . setStreet1 ( rolodex . getAddressLine1 ( ) ) ; address . setStreet2 ( rolodex . getAddressLine2 ( ) ) ; address . setCity ( checkNull ( rolodex . getCity ( ) ) ) ; address . setCounty ( rolodex . getCounty ( ) ) ; address . setState ( rolodex . getState ( ) ) ; address . setZipCode ( rolodex . getPostalCode ( ) ) ; if ( rolodex . getCountryCode ( ) != null ) { CountryCodeType . Enum country = CountryCodeType . Enum . forString ( rolodex . getCountryCode ( ) ) ; address . setCountry ( country ) ; } } else { address . setStreet1 ( "" ) ; address . setCity ( "" ) ; } } | This method is to set the rolodex details to AddressType |
8,465 | private Set < ChmEntry > buildEntryList ( ) throws TikaException { Set < ChmEntry > entries = new TreeSet < > ( ) ; for ( DirectoryListingEntry entry : chmExtractor . getChmDirList ( ) . getDirectoryListingEntryList ( ) ) { String name = entry . getName ( ) ; if ( name . startsWith ( "/" ) && ! name . equals ( "/" ) && ! name . startsWith ( "/$" ) ) { entries . add ( new ChmEntry ( entry ) ) ; } } return entries ; } | Builds the list of archive file entries . |
8,466 | private ChmEntry findEntry ( String file ) { for ( ChmEntry entry : entries ) { if ( file . equals ( entry . getSourcePath ( ) ) ) { return entry ; } } return null ; } | Returns the chm entry that references the specified file name . |
8,467 | public boolean hasChanged ( ) { Object currentValue = getValue ( ) ; return value == null || currentValue == null ? value != currentValue : ! value . equals ( currentValue ) ; } | Returns true if the property value has been changed since the last commit . |
8,468 | protected void init ( Object target , PropertyInfo propInfo , PropertyGrid propGrid ) { this . target = target ; this . propInfo = propInfo ; this . propGrid = propGrid ; this . index = propGrid . getEditorCount ( ) ; wireController ( ) ; } | Initializes the property editor . |
8,469 | public boolean commit ( ) { try { setWrongValueMessage ( null ) ; propInfo . setPropertyValue ( target , getValue ( ) ) ; updateValue ( ) ; return true ; } catch ( Exception e ) { setWrongValueException ( e ) ; return false ; } } | Commit the changed value . |
8,470 | public boolean revert ( ) { try { setWrongValueMessage ( null ) ; setValue ( propInfo . getPropertyValue ( target ) ) ; updateValue ( ) ; return true ; } catch ( Exception e ) { setWrongValueException ( e ) ; return false ; } } | Revert changes to the property value . |
8,471 | public List < String > nextParagraphs ( ) { return nextParagraphs ( Math . min ( Math . max ( 4 + ( int ) ( random . nextGaussian ( ) * 3d ) , 1 ) , 8 ) ) ; } | Returns a random list of paragraphs . The number of paragraphs will be between 1 and 8 . |
8,472 | public List < String > nextParagraphs ( int num ) { List < String > paragraphs = new ArrayList < String > ( num ) ; for ( int i = 0 ; i < num ; i ++ ) { paragraphs . add ( nextParagraph ( ) ) ; } return paragraphs ; } | Returns the given number of randomly generated paragraphs . |
8,473 | public String nextParagraph ( int totalSentences ) { StringBuilder out = new StringBuilder ( ) ; List < String > lastWords = new ArrayList < String > ( ) ; lastWords . add ( null ) ; lastWords . add ( null ) ; int numSentences = 0 ; boolean inSentence = false ; boolean inQuote = false ; while ( numSentences < totalSentences ) { List < String > words = pairTable . get ( lastWords ) ; if ( words == null ) { words = singleWordTable . get ( lastWords . get ( 1 ) ) ; } if ( words == null ) { words = pairTable . get ( Arrays . < String > asList ( null , null ) ) ; } String nextWord = words . get ( random . nextInt ( words . size ( ) ) ) ; if ( nextWord . length ( ) == 1 && sentenceEndChars . indexOf ( nextWord . charAt ( 0 ) ) != - 1 ) { out . append ( nextWord ) ; if ( inQuote ) { out . append ( '"' ) ; } numSentences ++ ; inSentence = false ; inQuote = false ; lastWords . remove ( 0 ) ; lastWords . add ( null ) ; } else { if ( ! inSentence ) { if ( out . length ( ) > 0 ) { out . append ( " " ) ; } inSentence = true ; } else { out . append ( " " ) ; } out . append ( nextWord ) ; if ( nextWord . indexOf ( '"' ) != - 1 ) { inQuote = true ; } } lastWords . remove ( 0 ) ; lastWords . add ( nextWord ) ; } return out . toString ( ) ; } | Returns a paragraph of text with the given number of sentences . |
8,474 | public Map < String , String > getEOStateReview ( ProposalDevelopmentDocumentContract pdDoc ) { Map < String , String > stateReview = new HashMap < > ( ) ; List < ? extends AnswerHeaderContract > answerHeaders = propDevQuestionAnswerService . getQuestionnaireAnswerHeaders ( pdDoc . getDevelopmentProposal ( ) . getProposalNumber ( ) ) ; if ( ! answerHeaders . isEmpty ( ) ) { for ( AnswerContract answers : answerHeaders . get ( 0 ) . getAnswers ( ) ) { Integer questionSeqId = getQuestionAnswerService ( ) . findQuestionById ( answers . getQuestionId ( ) ) . getQuestionSeqId ( ) ; if ( questionSeqId != null && questionSeqId . equals ( PROPOSAL_YNQ_QUESTION_129 ) ) { stateReview . putIfAbsent ( YNQ_ANSWER , answers . getAnswer ( ) ) ; } if ( questionSeqId != null && questionSeqId . equals ( PROPOSAL_YNQ_QUESTION_130 ) ) { stateReview . putIfAbsent ( YNQ_REVIEW_DATE , answers . getAnswer ( ) ) ; } if ( questionSeqId != null && questionSeqId . equals ( PROPOSAL_YNQ_QUESTION_131 ) ) { stateReview . putIfAbsent ( YNQ_STATE_REVIEW_DATA , answers . getAnswer ( ) ) ; } } } if ( stateReview . size ( ) == 0 ) { stateReview . put ( YNQ_ANSWER , YNQ_NOT_REVIEWED ) ; stateReview . put ( YNQ_REVIEW_DATE , null ) ; } return stateReview ; } | This method returns a map containing the answers related to EOState REview for a given proposal |
8,475 | public String getDivisionName ( ProposalDevelopmentDocumentContract pdDoc ) { String divisionName = null ; if ( pdDoc != null && pdDoc . getDevelopmentProposal ( ) . getOwnedByUnit ( ) != null ) { UnitContract ownedByUnit = pdDoc . getDevelopmentProposal ( ) . getOwnedByUnit ( ) ; while ( ownedByUnit . getParentUnit ( ) != null ) { ownedByUnit = ownedByUnit . getParentUnit ( ) ; } divisionName = ownedByUnit . getUnitName ( ) ; if ( divisionName . length ( ) > DIVISION_NAME_MAX_LENGTH ) { divisionName = divisionName . substring ( 0 , DIVISION_NAME_MAX_LENGTH ) ; } } return divisionName ; } | This method is to get division name using the OwnedByUnit and traversing through the parent units till the top level |
8,476 | public void registerTransform ( String pattern , AbstractTransform transform ) { transforms . add ( new Transform ( new WildcardFileFilter ( pattern . split ( "\\," ) ) , transform ) ) ; } | Registers a file transform . |
8,477 | public String replaceURLs ( String line ) { StringBuffer sb = new StringBuffer ( ) ; Matcher matcher = URL_PATTERN . matcher ( line ) ; String newPath = "web/" + getResourceBase ( ) + "/" ; while ( matcher . find ( ) ) { char dlm = line . charAt ( matcher . start ( ) - 1 ) ; int i = line . indexOf ( dlm , matcher . end ( ) ) ; String url = i > 0 ? line . substring ( matcher . start ( ) , i ) : null ; if ( url == null || ( ! mojo . isExcluded ( url ) && getTransform ( url ) != null ) ) { matcher . appendReplacement ( sb , newPath ) ; } } matcher . appendTail ( sb ) ; return sb . toString ( ) ; } | Adjust any url references in the line to use new root path . |
8,478 | protected boolean transform ( IResource resource ) throws Exception { String name = StringUtils . trimToEmpty ( resource . getSourcePath ( ) ) ; if ( resource . isDirectory ( ) || mojo . isExcluded ( name ) ) { return false ; } AbstractTransform transform = getTransform ( name ) ; String targetPath = transform == null ? null : transform . getTargetPath ( resource ) ; if ( targetPath != null ) { File out = mojo . newStagingFile ( relocateResource ( targetPath ) , resource . getTime ( ) ) ; try ( OutputStream outputStream = new FileOutputStream ( out ) ; ) { transform . transform ( resource , outputStream ) ; return true ; } } return false ; } | Finds and executes the transform appropriate for the file resource . |
8,479 | private AbstractTransform getTransform ( String fileName ) { File file = new File ( fileName ) ; for ( Transform transform : transforms ) { if ( transform . filter . accept ( file ) ) { return transform . transform ; } } return null ; } | Returns the transform for the file or null if none registered . |
8,480 | public static String substringBefore ( final String str , final String separator ) { if ( Strings . isNullOrEmpty ( str ) ) { return str ; } final int pos = str . indexOf ( separator ) ; if ( pos == - 1 ) { return str ; } return str . substring ( 0 , pos ) ; } | Returns substring before provided string |
8,481 | public static IAction getRegisteredAction ( String id ) { IAction action = getRegistry ( false ) . get ( id ) ; return action == null ? getRegistry ( true ) . get ( id ) : action ; } | Attempt to locate in local registry first then global . |
8,482 | public static Collection < IAction > getRegisteredActions ( ActionScope scope ) { Map < String , IAction > actions = new HashMap < > ( ) ; if ( scope == ActionScope . BOTH || scope == ActionScope . GLOBAL ) { actions . putAll ( getRegistry ( true ) . map ) ; } if ( scope == ActionScope . BOTH || scope == ActionScope . LOCAL ) { actions . putAll ( getRegistry ( false ) . map ) ; } return actions . values ( ) ; } | Returns a collection of actions registered to the specified scope . |
8,483 | private static ActionRegistry getRegistry ( boolean global ) { if ( global ) { return instance ; } Page page = ExecutionContext . getPage ( ) ; ActionRegistry registry = ( ActionRegistry ) page . getAttribute ( ATTR_LOCAL_REGISTRY ) ; if ( registry == null ) { page . setAttribute ( ATTR_LOCAL_REGISTRY , registry = new ActionRegistry ( ) ) ; } return registry ; } | Returns a reference to the registry for global or local actions . |
8,484 | ProgressEvent updateProgress ( double val , long now ) { if ( val < 0 || val > 1 ) { throw new IllegalArgumentException ( "Value out of range [0, 1]: " + val ) ; } if ( val <= progress . getProgress ( ) ) { reset ( start ) ; } double pD = val - progress . getProgress ( ) ; long tD = now - tstamp ; if ( step > 0 ) { step = step * 0.3 + ( tD / pD ) * 0.7 ; } else { step = ( tD / pD ) ; } double etcMs = step * ( 1 - val ) ; progress = new ProgressEvent ( val , new Date ( now + ( long ) Math . round ( etcMs ) ) ) ; tstamp = now ; return progress ; } | allows setting the current time for testing |
8,485 | private boolean connect ( ) { if ( this . factory == null ) { return false ; } if ( isConnected ( ) ) { return true ; } try { this . connection = this . factory . createConnection ( ) ; this . session = ( TopicSession ) this . connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; this . connection . start ( ) ; return true ; } catch ( Exception e ) { log . error ( "Error communicating with JMS server: " + e . getMessage ( ) ) ; disconnect ( ) ; return false ; } } | Connect to the JMS server . |
8,486 | private void disconnect ( ) { if ( this . session != null ) { try { this . session . close ( ) ; } catch ( Exception e ) { log . error ( "Error closing JMS topic session." , e ) ; } } if ( this . connection != null ) { try { this . connection . stop ( ) ; this . connection . close ( ) ; } catch ( Exception e ) { log . error ( "Error closing JMS topic connection." , e ) ; } } this . session = null ; this . connection = null ; } | Disconnect from the JMS server . |
8,487 | public static ElementUI getAssociatedElement ( BaseComponent component ) { return component == null ? null : ( ElementUI ) component . getAttribute ( ASSOC_ELEMENT ) ; } | Returns the UI element that registered the CWF component . |
8,488 | public static Menupopup getDesignContextMenu ( BaseComponent component ) { return component == null ? null : ( Menupopup ) component . getAttribute ( CONTEXT_MENU ) ; } | Returns the design context menu currently bound to the component . |
8,489 | protected String getTemplateUrl ( ) { return "web/" + getClass ( ) . getPackage ( ) . getName ( ) . replace ( "." , "/" ) + "/" + StringUtils . uncapitalize ( getClass ( ) . getSimpleName ( ) ) + ".fsp" ; } | Returns the URL of the default template to use in createFromTemplate . Override this method to provide an alternate default URL . |
8,490 | public void setDesignMode ( boolean designMode ) { super . setDesignMode ( designMode ) ; for ( ElementTrigger trigger : triggers ) { trigger . setDesignMode ( designMode ) ; } setDesignContextMenu ( designMode ? DesignContextMenu . getInstance ( ) . getMenupopup ( ) : null ) ; mask . update ( ) ; } | Sets design mode status for this component and all its children and triggers . |
8,491 | protected void afterParentChanged ( ElementBase oldParent ) { if ( getParent ( ) != null ) { if ( ! getDefinition ( ) . isInternal ( ) ) { bind ( ) ; } setDesignMode ( getParent ( ) . isDesignMode ( ) ) ; } } | Called after the parent has been changed . |
8,492 | private ElementUI getVisibleChild ( boolean first ) { int count = getChildCount ( ) ; int start = first ? 0 : count - 1 ; int inc = first ? 1 : - 1 ; for ( int i = start ; i >= 0 && i < count ; i += inc ) { ElementUI child = ( ElementUI ) getChild ( i ) ; if ( child . isVisible ( ) ) { return child ; } } return null ; } | Returns first or last visible child . |
8,493 | public ElementUI getNextSibling ( boolean visibleOnly ) { ElementUI parent = getParent ( ) ; if ( parent != null ) { int count = parent . getChildCount ( ) ; for ( int i = getIndex ( ) + 1 ; i < count ; i ++ ) { ElementUI child = ( ElementUI ) parent . getChild ( i ) ; if ( ! visibleOnly || child . isVisible ( ) ) { return child ; } } } return null ; } | Returns this element s next sibling . |
8,494 | protected void afterMoveChild ( ElementBase child , ElementBase before ) { moveChild ( ( ( ElementUI ) child ) . getOuterComponent ( ) , ( ( ElementUI ) before ) . getOuterComponent ( ) ) ; updateMasks ( ) ; } | Element has been moved to a different position under this parent . Adjust wrapped components accordingly . |
8,495 | protected void applyColor ( BaseUIComponent comp ) { if ( comp instanceof BaseLabeledComponent ) { comp . invoke ( comp . sub ( "lbl" ) , "css" , "color" , getColor ( ) ) ; } else if ( comp != null ) { comp . addStyle ( "background-color" , getColor ( ) ) ; } } | Applies the current color setting to the target component . If the target implements a custom method for performing this operation that method will be invoked . Otherwise the background color of the target is set . Override this method to provide alternate implementations . |
8,496 | protected boolean hasVisibleElements ( BaseUIComponent component ) { for ( BaseUIComponent child : component . getChildren ( BaseUIComponent . class ) ) { ElementUI ele = getAssociatedElement ( child ) ; if ( ele != null && ele . isVisible ( ) ) { return true ; } if ( hasVisibleElements ( child ) ) { return true ; } } return false ; } | Returns true if any associated UI elements in the component subtree are visible . |
8,497 | public void set ( int i , byte value ) { if ( i < 0 || i >= size ) { throw new IndexOutOfBoundsException ( ) ; } elements [ i ] = value ; } | Sets the i th element of the array list to the given value . |
8,498 | public void add ( byte [ ] values ) { ensureCapacity ( size + values . length ) ; for ( byte element : values ) { this . add ( element ) ; } } | Adds all the elements in the given array to the array list . |
8,499 | public static double normalizeProps ( double [ ] props ) { double propSum = DoubleArrays . sum ( props ) ; if ( propSum == 0 ) { for ( int d = 0 ; d < props . length ; d ++ ) { props [ d ] = 1.0 / ( double ) props . length ; } } else if ( propSum == Double . POSITIVE_INFINITY ) { int count = DoubleArrays . count ( props , Double . POSITIVE_INFINITY ) ; if ( count == 0 ) { throw new RuntimeException ( "Unable to normalize since sum is infinite but contains no infinities: " + Arrays . toString ( props ) ) ; } double constant = 1.0 / ( double ) count ; for ( int d = 0 ; d < props . length ; d ++ ) { if ( props [ d ] == Double . POSITIVE_INFINITY ) { props [ d ] = constant ; } else { props [ d ] = 0.0 ; } } } else { for ( int d = 0 ; d < props . length ; d ++ ) { props [ d ] /= propSum ; assert ( ! Double . isNaN ( props [ d ] ) ) ; } } return propSum ; } | Normalize the proportions and return their sum . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.