idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
40,200
private String applyPattern ( String key , Object [ ] messageArguments ) { String message = getString ( key ) ; String output = MessageFormat . format ( message , messageArguments ) ; return output ; }
Helper function that applies the messageArguments to a message from the resource object
40,201
private synchronized void logEvent ( int level , String string , Throwable throwable ) { if ( level > _loggingLevel ) { return ; } if ( _logFile != null ) { PrintWriter pw = null ; try { pw = new PrintWriter ( new FileWriter ( _logFile , true ) ) ; pw . println ( _servletName + "(" + level + "): " + string ) ; if ( thr...
The method that actually does the logging
40,202
public boolean artifactContainsClass ( Artifact artifact , final String mainClass ) throws MojoExecutionException { boolean containsClass = true ; URL url ; try { url = artifact . getFile ( ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Could not get artifact url: ...
Tests if the given fully qualified name exists in the given artifact .
40,203
public static void main ( String [ ] args ) throws IOException { boolean diff = true ; boolean minimal = true ; String outputFile = "out.jardiff" ; for ( int counter = 0 ; counter < args . length ; counter ++ ) { if ( args [ counter ] . equals ( "-nonminimal" ) || args [ counter ] . equals ( "-n" ) ) { minimal = false ...
- creatediff - applydiff - debug - output file
40,204
private void processDependencies ( ) throws MojoExecutionException { processDependency ( getProject ( ) . getArtifact ( ) ) ; AndArtifactFilter filter = new AndArtifactFilter ( ) ; if ( dependencies != null && dependencies . getIncludes ( ) != null && ! dependencies . getIncludes ( ) . isEmpty ( ) ) { filter . add ( ne...
Iterate through all the top level and transitive dependencies declared in the project and collect all the runtime scope dependencies for inclusion in the . zip and signing .
40,205
protected File getResourcesDirectory ( ) { if ( resourcesDirectory == null ) { resourcesDirectory = new File ( getProject ( ) . getBasedir ( ) , DEFAULT_RESOURCES_DIR ) ; } return resourcesDirectory ; }
Returns the location of the directory containing non - jar resources that are to be included in the JNLP bundle .
40,206
protected void signOrRenameJars ( ) throws MojoExecutionException { if ( sign != null ) { try { ClassLoader loader = getCompileClassLoader ( ) ; sign . init ( getWorkDirectory ( ) , getLog ( ) . isDebugEnabled ( ) , signTool , securityDispatcher , loader ) ; } catch ( MalformedURLException e ) { throw new MojoExecution...
If sign is enabled sign the jars otherwise rename them into final jars
40,207
protected void verboseLog ( String msg ) { if ( isVerbose ( ) ) { getLog ( ) . info ( msg ) ; } else { getLog ( ) . debug ( msg ) ; } }
Log as info when verbose or info is enabled as debug otherwise .
40,208
private int removeExistingSignatures ( File workDirectory ) throws MojoExecutionException { getLog ( ) . info ( "-- Remove existing signatures" ) ; File tempDir = new File ( workDirectory , "temp_extracted_jars" ) ; ioUtil . removeDirectory ( tempDir ) ; ioUtil . makeDirectoryIfNecessary ( tempDir ) ; File [ ] jarFiles...
Removes the signature of the files in the specified directory which satisfy the specified filter .
40,209
private void checkConfiguration ( ) throws MojoExecutionException { checkDependencyFilenameStrategy ( ) ; if ( CollectionUtils . isEmpty ( jnlpFiles ) ) { throw new MojoExecutionException ( "Configuration error: At least one <jnlpFile> element must be specified" ) ; } if ( jnlpFiles . size ( ) == 1 && StringUtils . isE...
Confirms that all plugin configuration provided by the user in the pom . xml file is valid .
40,210
private void checkJnlpFileConfiguration ( JnlpFile jnlpFile ) throws MojoExecutionException { if ( StringUtils . isBlank ( jnlpFile . getOutputFilename ( ) ) ) { throw new MojoExecutionException ( "Configuration error: An outputFilename must be specified for each jnlpFile element" ) ; } if ( StringUtils . isNotBlank ( ...
Checks the validity of a single jnlpFile configuration element .
40,211
private void generateVersionXml ( Set < ResolvedJarResource > jarResources ) throws MojoExecutionException { VersionXmlGenerator generator = new VersionXmlGenerator ( getEncoding ( ) ) ; generator . generate ( getLibDirectory ( ) , jarResources ) ; }
Generates a version . xml file for all the jarResources configured either in jnlpFile elements or in the commonJarResources element .
40,212
private String getUrlPrefix ( HttpServletRequest req ) { StringBuilder url = new StringBuilder ( ) ; String scheme = req . getScheme ( ) ; int port = req . getServerPort ( ) ; url . append ( scheme ) ; url . append ( "://" ) ; url . append ( req . getServerName ( ) ) ; if ( ( scheme . equals ( "http" ) && port != 80 ) ...
This code is heavily inspired by the stuff in HttpUtils . getRequestURL
40,213
private void validateRequest ( DownloadRequest dreq ) throws ErrorResponseException { String path = dreq . getPath ( ) ; if ( path . endsWith ( ResourceCatalog . VERSION_XML_FILENAME ) || path . indexOf ( "__" ) != - 1 ) { throw new ErrorResponseException ( DownloadResponse . getNoContentResponse ( ) ) ; } }
Make sure that it is a valid request . This is also the place to implement the reverse IP lookup
40,214
private JnlpResource locateResource ( DownloadRequest dreq ) throws IOException , ErrorResponseException { if ( dreq . getVersion ( ) == null ) { return handleBasicDownload ( dreq ) ; } else { return handleVersionRequest ( dreq ) ; } }
Interprets the download request and convert it into a resource that is part of the Web Archive .
40,215
private DownloadResponse constructResponse ( JnlpResource jnlpres , DownloadRequest dreq ) throws IOException { String path = jnlpres . getPath ( ) ; if ( jnlpres . isJnlpFile ( ) ) { boolean supportQuery = JarDiffHandler . isJavawsVersion ( dreq , "1.5+" ) ; _log . addDebug ( "SupportQuery in Href: " + supportQuery ) ...
Given a DownloadPath and a DownloadRequest it constructs the data stream to return to the requester
40,216
private boolean matchTuple ( Object o ) { if ( o == null || ! ( o instanceof VersionID ) ) { return false ; } VersionID vid = ( VersionID ) o ; String [ ] t1 = normalize ( _tuple , vid . _tuple . length ) ; String [ ] t2 = normalize ( vid . _tuple , _tuple . length ) ; for ( int i = 0 ; i < t1 . length ; i ++ ) { Objec...
Compares if two version IDs are equal
40,217
private boolean isGreaterThanOrEqualHelper ( VersionID vid , boolean allowEqual ) { if ( _isCompound ) { if ( ! _rest . isGreaterThanOrEqualHelper ( vid , allowEqual ) ) { return false ; } } String [ ] t1 = normalize ( _tuple , vid . _tuple . length ) ; String [ ] t2 = normalize ( vid . _tuple , _tuple . length ) ; for...
Compares if this is greater than vid
40,218
public boolean isPrefixMatch ( VersionID vid ) { if ( _isCompound ) { if ( ! _rest . isPrefixMatch ( vid ) ) { return false ; } } String [ ] t2 = normalize ( vid . _tuple , _tuple . length ) ; for ( int i = 0 ; i < _tuple . length ; i ++ ) { Object e1 = _tuple [ i ] ; Object e2 = t2 [ i ] ; if ( e1 . equals ( e2 ) ) { ...
Checks if this is a prefix of vid
40,219
private String [ ] normalize ( String [ ] list , int minlength ) { if ( list . length < minlength ) { String [ ] newlist = new String [ minlength ] ; System . arraycopy ( list , 0 , newlist , 0 , list . length ) ; Arrays . fill ( newlist , list . length , newlist . length , "0" ) ; return newlist ; } else { return list...
Normalize an array to a certain length
40,220
private Manifest createManifest ( File jar , Map < String , String > manifestentries ) throws MojoExecutionException { JarFile jarFile = null ; try { jarFile = new JarFile ( jar ) ; Manifest manifest = jarFile . getManifest ( ) ; if ( manifest == null || manifest . getMainAttributes ( ) . isEmpty ( ) ) { manifest = new...
Create the new manifest from the existing jar file and the new entries .
40,221
public boolean contains ( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = ( VersionID ) _versionId ; boolean check = vi . match ( m ) ; if ( check ) { return true ; } } return false ; }
Check if this VersionString object contains the VersionID m
40,222
public boolean containsGreaterThan ( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = ( VersionID ) _versionId ; boolean check = vi . isGreaterThan ( m ) ; if ( check ) { return true ; } } return false ; }
Check if this VersionString object contains anything greater than m
40,223
public JarSignerRequest createSignRequest ( File jarToSign , File signedJar ) throws MojoExecutionException { JarSignerSignRequest request = new JarSignerSignRequest ( ) ; request . setAlias ( getAlias ( ) ) ; request . setKeystore ( getKeystore ( ) ) ; request . setSigfile ( getSigfile ( ) ) ; request . setStoretype (...
Creates a jarsigner request to do a sign operation .
40,224
public JarSignerRequest createVerifyRequest ( File jarFile , boolean certs ) { JarSignerVerifyRequest request = new JarSignerVerifyRequest ( ) ; request . setCerts ( certs ) ; request . setWorkingDirectory ( workDirectory ) ; request . setMaxMemory ( getMaxMemory ( ) ) ; request . setVerbose ( isVerbose ( ) ) ; request...
Creates a jarsigner request to do a verify operation .
40,225
public KeyToolGenerateKeyPairRequest createKeyGenRequest ( File keystoreFile ) { KeyToolGenerateKeyPairRequest request = new KeyToolGenerateKeyPairRequest ( ) ; request . setAlias ( getAlias ( ) ) ; request . setDname ( getDname ( ) ) ; request . setKeyalg ( getKeyalg ( ) ) ; request . setKeypass ( getKeypass ( ) ) ; r...
Creates a keytool request to do a key store generation operation .
40,226
public void onBrowserEvent ( Context context , Element elem , final T object , NativeEvent event ) { final int index = context . getIndex ( ) ; ValueUpdater < C > valueUpdater = ( fieldUpdater == null ) ? null : ( ValueUpdater < C > ) value -> { fieldUpdater . update ( index , object , value ) ; } ; cell . onBrowserEve...
Handle a browser event that took place within the column .
40,227
public void render ( Context context , T object , SafeHtmlBuilder sb ) { cell . render ( context , getValue ( object ) , sb ) ; }
Render the object into the cell .
40,228
public final void setStyleProperty ( StyleName styleName , String value ) { if ( styleProps == null ) { styleProps = new HashMap < > ( ) ; } styleProps . put ( styleName , value ) ; }
Set a style property using its name as the key . Please ensure the style name and value are appropriately configured or it may result in unexpected behavior .
40,229
public final String getStyleProperty ( StyleName styleName ) { return styleProps != null ? styleProps . get ( styleName ) : null ; }
Get a styles property .
40,230
public final void setWidth ( String width ) { this . width = width ; this . dynamicWidth = width != null && width . contains ( "%" ) ; }
Set the columns header width .
40,231
public void loaded ( int startIndex , List < T > data , boolean cacheData ) { loaded ( startIndex , data , getTotalRows ( ) , cacheData ) ; }
Provide the option to load data with a cache parameter .
40,232
public int getVisibleRowCapacity ( ) { int rh = getCalculatedRowHeight ( ) ; double visibleHeight = getVisibleHeight ( ) ; int rows = ( int ) ( ( visibleHeight < 1 ) ? 0 : Math . floor ( visibleHeight / rh ) ) ; int calcHeight = rh * rows ; while ( calcHeight < visibleHeight ) { rows ++ ; calcHeight = rh * rows ; } log...
Returns the total number of rows that are visible given the current grid height .
40,233
public FrozenProperties setHeaderStyleProperty ( StyleName styleName , String value ) { headerStyleProps . put ( styleName , value ) ; return this ; }
Set a header style property using its name as the key . Please ensure the style name and value are appropriately configured or it may result in unexpected behavior .
40,234
public boolean isFocusable ( Element elem ) { return focusableTypes . contains ( elem . getTagName ( ) . toLowerCase ( Locale . ROOT ) ) || elem . getTabIndex ( ) >= 0 ; }
Check if an element is focusable . If an element is focusable the cell widget should not steal focus from it .
40,235
public final void sinkEvents ( Widget widget , Set < String > typeNames ) { if ( typeNames == null ) { return ; } int eventsToSink = 0 ; for ( String typeName : typeNames ) { int typeInt = Event . getTypeInt ( typeName ) ; if ( typeInt < 0 ) { widget . sinkBitlessEvent ( typeName ) ; } else { typeInt = sinkEvent ( widg...
Sink events on the widget .
40,236
public void delay ( int delay ) { timer . cancel ( ) ; if ( delay > 0 ) { timer . schedule ( delay ) ; } else { timer . run ( ) ; } }
Cancels any running timers and starts a new one .
40,237
public void apply ( HasWidgets container ) { container . clear ( ) ; container . add ( topPanel ) ; container . add ( tableBody ) ; container . add ( xScrollPanel ) ; topPanel . add ( infoPanel ) ; topPanel . add ( toolPanel ) ; tableBody . add ( wrapInnerScroll ( table ) ) ; table . addHead ( new MaterialWidget ( DOM ...
Apply the scaffolding together .
40,238
public final TableSubHeader render ( int columnCount ) { TableSubHeader element = getWidget ( ) ; if ( element == null ) { element = new TableSubHeader ( this , columnCount ) ; setWidget ( element ) ; } render ( element , columnCount ) ; return element ; }
Render the data category row element .
40,239
protected void onLoad ( ) { super . onLoad ( ) ; if ( limit == 0 ) { limit = limitOptions [ 0 ] ; } add ( actionsPanel ) ; add ( rowSelection ) ; if ( pageSelection == null ) { pageSelection = new PageNumberBox ( this ) ; } add ( pageSelection ) ; firstPage ( ) ; }
Initialize the data pager for navigation
40,240
protected void doLoad ( int offset , int limit ) { dataSource . load ( new LoadConfig < > ( offset , limit , table . getView ( ) . getSortContext ( ) , table . getView ( ) . getOpenCategories ( ) ) , new LoadCallback < T > ( ) { public void onSuccess ( LoadResult < T > loadResult ) { setOffset ( loadResult . getOffset ...
Load the datasource within a given offset and limit
40,241
protected void updateUi ( ) { pageSelection . updatePageNumber ( currentPage ) ; pageSelection . updateTotalPages ( getTotalPages ( ) ) ; int firstRow = offset + 1 ; int lastRow = ( isExcess ( ) & isLastPage ( ) ) ? totalRows : ( offset + limit ) ; actionsPanel . getActionLabel ( ) . setText ( ( firstRow == lastRow ? l...
Set and update the ui fields of the pager after the datasource load callback
40,242
public void setSize ( final int X , final int Y , final int WIDTH , final int HEIGHT ) { bounds . setBounds ( X , Y , WIDTH , HEIGHT ) ; fireStateChanged ( ) ; }
Sets the width and height of the gauge
40,243
public void setMinValue ( final double MIN_VALUE ) { if ( Double . compare ( MIN_VALUE , maxValue ) == 0 ) { throw new IllegalArgumentException ( "Min value cannot be equal to max value" ) ; } if ( Double . compare ( MIN_VALUE , maxValue ) > 0 ) { minValue = maxValue ; maxValue = MIN_VALUE ; } else { minValue = MIN_VAL...
Sets the minium value that will be used for the calculation of the nice minimum value for the scale .
40,244
public void setMaxValue ( final double MAX_VALUE ) { if ( Double . compare ( MAX_VALUE , minValue ) == 0 ) { throw new IllegalArgumentException ( "Max value cannot be equal to min value" ) ; } if ( Double . compare ( MAX_VALUE , minValue ) < 0 ) { maxValue = minValue ; minValue = MAX_VALUE ; } else { maxValue = MAX_VAL...
Sets the maximum value that will be used for the calculation of the nice maximum vlaue for the scale .
40,245
public void setRange ( final double MIN_VALUE , final double MAX_VALUE ) { maxValue = MAX_VALUE ; minValue = MIN_VALUE ; calculate ( ) ; validate ( ) ; calcAngleStep ( ) ; fireStateChanged ( ) ; }
Sets the minimum and maximum value for the calculation of the nice minimum and nice maximum values .
40,246
public void setValue ( final double VALUE ) { oldValue = value ; value = VALUE < niceMinValue ? niceMinValue : ( VALUE > niceMaxValue ? niceMaxValue : VALUE ) ; fireStateChanged ( ) ; }
Sets the current value of the gauge
40,247
public void setRedrawTolerance ( final double REDRAW_TOLERANCE ) { redrawTolerance = REDRAW_TOLERANCE < 0 ? 0 : ( REDRAW_TOLERANCE > 1 ? 1.0 : REDRAW_TOLERANCE ) ; redrawFactor = redrawTolerance * getRange ( ) ; fireStateChanged ( ) ; }
Sets the redraw tolerance
40,248
public void setThreshold ( final double THRESHOLD ) { if ( Double . compare ( THRESHOLD , minValue ) >= 0 && Double . compare ( THRESHOLD , maxValue ) <= 0 ) { threshold = THRESHOLD ; } else { if ( THRESHOLD < niceMinValue ) { threshold = niceMinValue ; } if ( THRESHOLD > niceMaxValue ) { threshold = niceMaxValue ; } }...
Sets the value for the threshold of the gauge
40,249
public void setMinMeasuredValue ( final double MIN_MEASURED_VALUE ) { if ( Double . compare ( MIN_MEASURED_VALUE , niceMinValue ) >= 0 && Double . compare ( MIN_MEASURED_VALUE , niceMaxValue ) <= 0 ) { minMeasuredValue = MIN_MEASURED_VALUE ; } else { if ( MIN_MEASURED_VALUE < niceMinValue ) { minMeasuredValue = niceMin...
Sets the minimum measured value of the gauge to the given value
40,250
public void resetMinMeasuredValue ( final double MIN_MEASURED_VALUE ) { minMeasuredValue = MIN_MEASURED_VALUE < niceMinValue ? niceMinValue : ( MIN_MEASURED_VALUE > niceMaxValue ? niceMaxValue : MIN_MEASURED_VALUE ) ; createRadialShapeOfMeasureValuesArea ( ) ; fireStateChanged ( ) ; }
Resets the minimum measured value of the gauge to the given value
40,251
public void setMaxMeasuredValue ( final double MAX_MEASURED_VALUE ) { if ( Double . compare ( MAX_MEASURED_VALUE , niceMinValue ) >= 0 && Double . compare ( MAX_MEASURED_VALUE , niceMaxValue ) <= 0 ) { maxMeasuredValue = MAX_MEASURED_VALUE ; } else { if ( MAX_MEASURED_VALUE < niceMinValue ) { maxMeasuredValue = niceMin...
Sets the maximum measured value of the gauge to the given value
40,252
public void resetMaxMeasuredValue ( final double MAX_MEASURED_VALUE ) { maxMeasuredValue = MAX_MEASURED_VALUE < niceMinValue ? niceMinValue : ( MAX_MEASURED_VALUE > niceMaxValue ? niceMaxValue : MAX_MEASURED_VALUE ) ; createRadialShapeOfMeasureValuesArea ( ) ; fireStateChanged ( ) ; }
Resets the maximum measured value of the gauge to the given value
40,253
public void setTrackStart ( final double TRACK_START ) { if ( Double . compare ( TRACK_START , trackStop ) == 0 ) { throw new IllegalArgumentException ( "Track start value cannot equal track stop value" ) ; } trackStart = TRACK_START ; validate ( ) ; fireStateChanged ( ) ; }
Sets the track start value of the gauge to the given value
40,254
public void setTrackStop ( final double TRACK_STOP ) { if ( Double . compare ( trackStart , TRACK_STOP ) == 0 ) { throw new IllegalArgumentException ( "Track stop value cannot equal track start value" ) ; } trackStop = TRACK_STOP ; validate ( ) ; fireStateChanged ( ) ; }
Sets the track stop value of the gauge to the given value
40,255
public void setSections ( Section ... SECTIONS_ARRAY ) { sections . clear ( ) ; for ( Section section : SECTIONS_ARRAY ) { sections . add ( new Section ( section . getStart ( ) , section . getStop ( ) , section . getColor ( ) ) ) ; } validate ( ) ; fireStateChanged ( ) ; }
Sets the sections of the gauge to the given array of section objects
40,256
public List < Section > getAreas ( ) { List < Section > areasCopy = new ArrayList < Section > ( 10 ) ; areasCopy . addAll ( areas ) ; return areasCopy ; }
Returns a list of section objects that will used to display the areas of a gauge with their colors .
40,257
public void setAreas ( Section ... AREAS_ARRAY ) { areas . clear ( ) ; for ( Section area : AREAS_ARRAY ) { areas . add ( new Section ( area . getStart ( ) , area . getStop ( ) , area . getColor ( ) ) ) ; } validate ( ) ; fireStateChanged ( ) ; }
Sets the areas of the gauge to the given array of section objects
40,258
public List < Section > getTickmarkSections ( ) { List < Section > tickmarkSectionsCopy = new ArrayList < Section > ( 10 ) ; tickmarkSectionsCopy . addAll ( tickmarkSections ) ; return tickmarkSectionsCopy ; }
Returns a list of section objects that will be used to display to display the tickmark sections of a gauge with their different colors .
40,259
public void setTickmarkSections ( final Section ... TICKMARK_SECTIONS_ARRAY ) { tickmarkSections . clear ( ) ; for ( Section tickmarkSection : TICKMARK_SECTIONS_ARRAY ) { tickmarkSections . add ( new Section ( tickmarkSection . getStart ( ) , tickmarkSection . getStop ( ) , tickmarkSection . getColor ( ) ) ) ; } valida...
Sets the tickmark sections of the gauge to the given array of section objects
40,260
public void setMinMaxAndNoOfTicks ( final double MIN_VALUE , final double MAX_VALUE , final int NO_OF_MINOR_TICKS , final int NO_OF_MAJOR_TICKS ) { this . maxNoOfMinorTicks = NO_OF_MINOR_TICKS ; this . maxNoOfMajorTicks = NO_OF_MAJOR_TICKS ; this . minValue = MIN_VALUE ; this . maxValue = MAX_VALUE ; calculate ( ) ; }
Sets the minimum and maximum values and the number of minor and major tickmarks of the gauge dial
40,261
public void setMaxNoOfMajorTicks ( final int MAX_NO_OF_MAJOR_TICKS ) { if ( MAX_NO_OF_MAJOR_TICKS > 20 ) { this . maxNoOfMajorTicks = 20 ; } else if ( MAX_NO_OF_MAJOR_TICKS < 2 ) { this . maxNoOfMajorTicks = 2 ; } else { this . maxNoOfMajorTicks = MAX_NO_OF_MAJOR_TICKS ; } calculate ( ) ; fireStateChanged ( ) ; }
Sets the maximum number of major tickmarks we re comfortable with
40,262
public void setMaxNoOfMinorTicks ( final int MAX_NO_OF_MINOR_TICKS ) { if ( MAX_NO_OF_MINOR_TICKS > 10 ) { this . maxNoOfMinorTicks = 10 ; } else if ( MAX_NO_OF_MINOR_TICKS < 1 ) { this . maxNoOfMinorTicks = 1 ; } else { this . maxNoOfMinorTicks = MAX_NO_OF_MINOR_TICKS ; } calculate ( ) ; fireStateChanged ( ) ; }
Sets the maximum number of minor tickmarks we re comfortable with
40,263
public void setCustomLayer ( final BufferedImage CUSTOM_LAYER ) { if ( customLayer != null ) { customLayer . flush ( ) ; } customLayer = CUSTOM_LAYER ; fireStateChanged ( ) ; }
Sets the given buffered image as the custom layer of the gauge
40,264
private void calcAngleStep ( ) { final double angleRange = getAngleRange ( ) ; angleStep = angleRange / range ; logAngleStep = angleRange / ( Util . INSTANCE . logOfBase ( BASE , range ) ) ; }
Calculates the stepsize in rad for the given gaugetype and range
40,265
private void calculate ( ) { if ( niceScale ) { this . niceRange = calcNiceNumber ( maxValue - minValue , false ) ; this . majorTickSpacing = calcNiceNumber ( niceRange / ( maxNoOfMajorTicks - 1 ) , true ) ; this . niceMinValue = Math . floor ( minValue / majorTickSpacing ) * majorTickSpacing ; this . niceMaxValue = Ma...
Calculate and update values for majro and minor tick spacing and nice minimum and maximum values on the axis .
40,266
private double calcNiceNumber ( final double RANGE , final boolean ROUND ) { final double EXPONENT = Math . floor ( Math . log10 ( RANGE ) ) ; final double FRACTION = RANGE / Math . pow ( 10 , EXPONENT ) ; final double NICE_FRACTION ; if ( ROUND ) { if ( FRACTION < 1.5 ) { NICE_FRACTION = 1 ; } else if ( FRACTION < 3 )...
Returns a nice number approximately equal to the range . Rounds the number if ROUND == true . Takes the ceiling if ROUND = false .
40,267
public void addChangeListener ( javax . swing . event . ChangeListener LISTENER ) { LISTENER_LIST . add ( javax . swing . event . ChangeListener . class , LISTENER ) ; }
Adds the given listener to the listener list
40,268
public void removeChangeListener ( javax . swing . event . ChangeListener LISTENER ) { LISTENER_LIST . remove ( javax . swing . event . ChangeListener . class , LISTENER ) ; }
Removes all listeners from the listener list
40,269
protected void fireStateChanged ( ) { Object [ ] listeners = LISTENER_LIST . getListenerList ( ) ; for ( int i = listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( listeners [ i ] == javax . swing . event . ChangeListener . class ) { if ( changeEvent == null ) { changeEvent = new javax . swing . event . ChangeEvent ( th...
Fires an state change event every time the data model changes
40,270
public void setBarGraphColor ( final ColorDef BARGRAPH_COLOR ) { getModel ( ) . setValueColor ( BARGRAPH_COLOR ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . width ) ; repaint ( getInnerBounds ( ) ) ; }
Sets the current bargraph color to the given enum colordef
40,271
public void setCustomBarGraphColor ( final Color COLOR ) { getModel ( ) . setCustomValueColorObject ( new CustomColorDef ( COLOR ) ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . width ) ; repaint ( getInnerBounds ( ) ) ; }
Sets the color that will be used to calculate the custom bargraph color
40,272
public Color getColorAt ( final float FRACTION ) { float fraction = FRACTION < 0f ? 0f : ( FRACTION > 1f ? 1f : FRACTION ) ; float lowerLimit = 0f ; int lowerIndex = 0 ; float upperLimit = 1f ; int upperIndex = 1 ; int index = 0 ; for ( float currentFraction : fractions ) { if ( Float . compare ( currentFraction , frac...
Returns the color that is defined by the given fraction in the linear gradient paint
40,273
private void copyArrays ( final float [ ] FRACTIONS , final Color [ ] colors ) { fractions = new float [ FRACTIONS . length ] ; System . arraycopy ( FRACTIONS , 0 , fractions , 0 , FRACTIONS . length ) ; this . colors = colors . clone ( ) ; }
Just create a local copy of the fractions and colors array
40,274
protected BufferedImage create_BARGRAPH_LED_Image ( final int WIDTH , final int HEIGHT , final ColorDef COLOR , final Color [ ] CUSTOM_COLORS ) { if ( WIDTH <= 20 || HEIGHT <= 20 ) { return UTIL . createImage ( 1 , 1 , Transparency . TRANSLUCENT ) ; } final int IMAGE_WIDTH ; final int IMAGE_HEIGHT ; if ( getOrientation...
Returns a buffered image of a bargraph led with the given color
40,275
public void setSectionsVisible ( final boolean SECTIONS_VISIBLE ) { sectionsVisible = SECTIONS_VISIBLE ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ; }
Sets the visibility of the sections . The sections could be defined by a start value a stop value and a color . One has to create a Section object from the class Section . The sections are stored in a ArrayList so there could be multiple . This might be a useful feature if you need to have exactly defined areas that yo...
40,276
public List < Section > getSections ( ) { List < Section > sectionsCopy = new ArrayList < Section > ( sections . size ( ) ) ; sectionsCopy . addAll ( sections ) ; return sectionsCopy ; }
Returns a copy of the ArrayList that stores the sections . The sections could be defined by a start value a stop value and a color . One has to create a Section object from the class Section . The sections are stored in a ArrayList so there could be multiple . This might be a useful feature if you need to have exactly ...
40,277
public void addSection ( final Section SECTION ) { sections . add ( SECTION ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ; }
Adds a given section to the list of sections The sections could be defined by a start value a stop value and a color . One has to create a Section object from the class Section . The sections are stored in a ArrayList so there could be multiple . This might be a useful feature if you need to have exactly defined areas ...
40,278
public void resetSections ( ) { sections . clear ( ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ; }
Clear the SECTIONS arraylist
40,279
public void setValue ( final double VALUE ) { if ( isEnabled ( ) ) { this . value100 = ( VALUE % 1000 ) / 100 ; this . value1000 = ( VALUE % 10000 ) / 100 ; this . value10000 = ( VALUE % 100000 ) / 100 ; if ( isValueCoupled ( ) ) { setLcdValue ( VALUE ) ; } fireStateChanged ( ) ; this . oldValue = VALUE ; repaint ( ) ;...
Sets the current height in feet
40,280
public void setDirection ( final int DIRECTION ) { switch ( DIRECTION ) { case SwingUtilities . SOUTH : direction = SwingUtilities . SOUTH ; break ; case SwingUtilities . EAST : direction = SwingUtilities . EAST ; break ; case SwingUtilities . WEST : direction = SwingUtilities . WEST ; break ; case SwingUtilities . NOR...
Sets the direction of the lightbulb . Use the constants defined in SwingUtilities SwingUtilities . NORTH SwingUtilities . EAST SwingUtiltites . SOUTH SwingUtilities . WEST
40,281
private BufferedImage createImage ( final int WIDTH , final int HEIGHT , final int TRANSPARENCY ) { final GraphicsConfiguration GFX_CONF = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) . getDefaultScreenDevice ( ) . getDefaultConfiguration ( ) ; if ( WIDTH <= 0 || HEIGHT <= 0 ) { return GFX_CONF . createCompati...
Returns a compatible image of the given size and transparency
40,282
private java . util . HashMap < Float , Color > recalculate ( final List < Float > fractionList , final List < Color > colorList , final float OFFSET ) { final int MAX_FRACTIONS = fractionList . size ( ) ; final HashMap < Float , Color > fractionColors = new HashMap < Float , Color > ( MAX_FRACTIONS ) ; for ( int i = 0...
Recalculates the fractions in the FRACTION_LIST and their associated colors in the COLOR_LIST with a given OFFSET . Because the conical gradients always starts with 0 at the top and clockwise direction you could rotate the defined conical gradient from - 180 to 180 degrees which equals values from - 0 . 5 to + 0 . 5
40,283
public void setValue ( final double VALUE ) { if ( isEnabled ( ) ) { if ( ! isLogScale ( ) ) { model . setValue ( VALUE ) ; } else { if ( VALUE > 0 ) { model . setValue ( VALUE ) ; } else { model . setValue ( 1 ) ; } } if ( ! isAutoResetToZero ( ) ) { if ( ! model . isThresholdBehaviourInverted ( ) ) { if ( Double . co...
Sets the value of the gauge . This method is primarly used for static gauges or if you really have measurement results that are occuring within the range of a second . If you have slow changing values you should better use the method setValueAnimated .
40,284
public void setLedColor ( final LedColor LED_COLOR ) { model . setLedColor ( LED_COLOR ) ; final boolean LED_WAS_ON = currentLedImage . equals ( ledImageOn ) ? true : false ; switch ( getOrientation ( ) ) { case HORIZONTAL : recreateLedImages ( getHeight ( ) ) ; break ; case VERTICAL : recreateLedImages ( getWidth ( ) ...
Sets the color of the threshold led dependend on the orientation of a component . This is only important for the linear gauges where the width and the height are different . The LedColor is not a standard color but defines a color scheme for the led . The default ledcolor is RED
40,285
public void setCustomLedColor ( final Color COLOR ) { model . setCustomLedColor ( new CustomLedColor ( COLOR ) ) ; final boolean LED_WAS_ON = currentLedImage . equals ( ledImageOn ) ? true : false ; switch ( getOrientation ( ) ) { case HORIZONTAL : recreateLedImages ( getHeight ( ) ) ; break ; case VERTICAL : recreateL...
Sets the color from which the custom ledcolor will be calculated
40,286
public void setLedBlinking ( final boolean LED_BLINKING ) { ledBlinking = LED_BLINKING ; if ( LED_BLINKING ) { LED_BLINKING_TIMER . start ( ) ; } else { setCurrentLedImage ( getLedImageOff ( ) ) ; LED_BLINKING_TIMER . stop ( ) ; } }
Sets the state of the threshold led . The led could blink which will be triggered by a javax . swing . Timer that triggers every 500 ms . The blinking will be done by switching between two images .
40,287
protected void recreateLedImages ( final int SIZE ) { if ( ledImageOff != null ) { ledImageOff . flush ( ) ; } ledImageOff = create_LED_Image ( SIZE , 0 , model . getLedColor ( ) ) ; if ( ledImageOn != null ) { ledImageOn . flush ( ) ; } ledImageOn = create_LED_Image ( SIZE , 1 , model . getLedColor ( ) ) ; }
Recreates the current threshold led images due to the given width
40,288
protected void setCurrentLedImage ( final BufferedImage CURRENT_LED_IMAGE ) { if ( currentLedImage != null ) { currentLedImage . flush ( ) ; } currentLedImage = CURRENT_LED_IMAGE ; repaint ( getInnerBounds ( ) ) ; }
Sets the image of the currently used led image .
40,289
public void setUserLedColor ( final LedColor LED_COLOR ) { model . setUserLedColor ( LED_COLOR ) ; final boolean LED_WAS_ON = currentUserLedImage . equals ( userLedImageOn ) ? true : false ; switch ( getOrientation ( ) ) { case HORIZONTAL : recreateUserLedImages ( getHeight ( ) ) ; break ; case VERTICAL : recreateUserL...
Sets the color of the user led dependend on the orientation of a component . This is only important for the linear gauges where the width and the height are different . The LedColor is not a standard color but defines a color scheme for the led . The default ledcolor is RED
40,290
public void setCustomUserLedColor ( final Color COLOR ) { model . setCustomUserLedColor ( new CustomLedColor ( COLOR ) ) ; final boolean LED_WAS_ON = currentUserLedImage . equals ( ledImageOn ) ? true : false ; switch ( getOrientation ( ) ) { case HORIZONTAL : recreateUserLedImages ( getHeight ( ) ) ; break ; case VERT...
Sets the color from which the custom user ledcolor will be calculated
40,291
public void setUserLedBlinking ( final boolean USER_LED_BLINKING ) { this . userLedBlinking = USER_LED_BLINKING ; if ( USER_LED_BLINKING ) { USER_LED_BLINKING_TIMER . start ( ) ; } else { setCurrentUserLedImage ( getUserLedImageOff ( ) ) ; USER_LED_BLINKING_TIMER . stop ( ) ; } }
Sets the state of the user led . The led could blink which will be triggered by a javax . swing . Timer that triggers every 500 ms . The blinking will be done by switching between two images .
40,292
protected void recreateUserLedImages ( final int SIZE ) { if ( userLedImageOff != null ) { userLedImageOff . flush ( ) ; } userLedImageOff = create_LED_Image ( SIZE , 0 , model . getUserLedColor ( ) ) ; if ( userLedImageOn != null ) { userLedImageOn . flush ( ) ; } userLedImageOn = create_LED_Image ( SIZE , 1 , model ....
Recreates the current user led images due to the given width
40,293
protected void setCurrentUserLedImage ( final BufferedImage CURRENT_USER_LED_IMAGE ) { if ( currentUserLedImage != null ) { currentUserLedImage . flush ( ) ; } currentUserLedImage = CURRENT_USER_LED_IMAGE ; repaint ( getInnerBounds ( ) ) ; }
Sets the image of the currently used user led image .
40,294
public void setTextureColor ( final Color TEXTURE_COLOR ) { model . setTextureColor ( TEXTURE_COLOR ) ; BACKGROUND_FACTORY . recreatePunchedSheetTexture ( TEXTURE_COLOR ) ; reInitialize ( ) ; }
Sets the color that will be used to render textures like Carbon PunchedSheet Linen etc .
40,295
public void setCustomBackground ( final Paint CUSTOM_BACKGROUND ) { model . setCustomBackground ( CUSTOM_BACKGROUND ) ; if ( model . getBackgroundColor ( ) == BackgroundColor . CUSTOM ) { reInitialize ( ) ; } }
Sets the custom background paint that will be used instead of the predefined backgroundcolors like DARK_GRAY BEIGE etc .
40,296
protected final BufferedImage create_LED_Image ( final int SIZE , final int STATE , final LedColor LED_COLOR ) { return LED_FACTORY . create_LED_Image ( SIZE , STATE , LED_COLOR , model . getCustomLedColor ( ) ) ; }
Returns an image of a led with the given size state and color . If the LED_COLOR parameter equals CUSTOM the userLedColor will be used to calculate the custom led colors
40,297
public void setRunning ( final boolean RUNNING ) { running = RUNNING ; if ( RUNNING ) { if ( ! CLOCK_TIMER . isRunning ( ) ) { CLOCK_TIMER . start ( ) ; start = System . currentTimeMillis ( ) ; repaint ( INNER_BOUNDS ) ; } } else { if ( CLOCK_TIMER . isRunning ( ) ) { CLOCK_TIMER . stop ( ) ; } } }
Start or stop the stopwatch
40,298
private void calcInnerBounds ( ) { final Insets INSETS = getInsets ( ) ; if ( yellowVisible ) { final int PREF_HEIGHT = getWidth ( ) < ( int ) ( getHeight ( ) * 0.4 ) ? ( int ) ( getWidth ( ) * 2.5 ) : getHeight ( ) ; INNER_BOUNDS . setBounds ( INSETS . left , INSETS . top , ( int ) ( PREF_HEIGHT * 0.4 ) - INSETS . lef...
Calculates the area that is available for painting the display
40,299
public void setLedType ( final LedType LED_TYPE ) { if ( ledType == LED_TYPE ) { return ; } ledType = LED_TYPE ; final boolean LED_WAS_ON = currentLedImage . equals ( ledImageOn ) ? true : false ; flushImages ( ) ; ledImageOff = create_LED_Image ( getWidth ( ) , 0 , ledColor , ledType ) ; ledImageOn = create_LED_Image ...
Sets the type of LED .