public class MakeColorPage
extends com.physpics.tools.ui.blox.Blox
Modifier and Type | Class and Description |
---|---|
static class |
MakeColorPage.Bucket
A class that bundles together the parameters for output.
|
com.physpics.tools.ui.blox.Blox.AccessibleBlox, com.physpics.tools.ui.blox.Blox.BaseAlignNote, com.physpics.tools.ui.blox.Blox.BkgdColorNote, com.physpics.tools.ui.blox.Blox.CrossSizeFull, com.physpics.tools.ui.blox.Blox.DebugNote, com.physpics.tools.ui.blox.Blox.Filler, com.physpics.tools.ui.blox.Blox.GlueNote, com.physpics.tools.ui.blox.Blox.NameNote, com.physpics.tools.ui.blox.Blox.Note, com.physpics.tools.ui.blox.Blox.Scroller, com.physpics.tools.ui.blox.Blox.StrutNote
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
DEFAULT_HEIGHT, DEFAULT_WIDTH, DIM_ZERO, PIXELS_PER_POINT
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MakeColorPage()
Construct a MakeColorPages screen image.
|
Modifier and Type | Method and Description |
---|---|
void |
addColor(java.lang.String rgb,
java.lang.String varDigit,
java.lang.String name,
java.lang.String ref)
Add a color to the table.The table will be recreated without
this color whenever parseColorStream succeeds.
|
void |
genPage(MakeColorPage.Bucket buck,
java.io.File dest,
java.io.InputStream tplstr)
Create output file by copying the template and inserting color data.
|
java.io.InputStream |
getTplStream()
Interpret templateLocator to produce an InputStream reading the template.
|
static javax.swing.JFrame[] |
go(java.lang.String[] args)
Create a MakeColorPage window, process arguments, and open the window.
|
static void |
main(java.lang.String[] args)
Main program started from command line.
|
static javax.swing.JFrame[] |
openWindows()
Initiate the MakeColorPage window.
|
java.util.ArrayList<PCASortColors.PCAColor> |
parseColorStream(java.io.InputStream istr)
Parse CSV entries from a given input stream.
|
PCASortColors.PCAColor[] |
prepareColorList(java.lang.String button)
Read the colors list and make/sort a copy for the given button.
|
void |
processArgs(java.lang.String[] args)
Process command-line-like arguments.
|
boolean |
readColorList()
Read the colorlist designated in colorListLocator.
|
java.util.ArrayList<PCASortColors.PCAColor> |
setColorTable(java.util.ArrayList<PCASortColors.PCAColor> tbl)
Set the table of colors to be ouput.
|
PCASortColors.PCAColor[] |
sortByButton(java.lang.String button)
Apply a sorting method from PCASortColors.
|
addImpl, addMany, baseAlign, color, componentOrientationFactory, createGlue, createHorizontalBlox, createHorizontalBlox, createHorizontalGlue, createHorizontalStrut, createRigidArea, createVerticalBlox, createVerticalBlox, createVerticalGlue, createVerticalStrut, crossSizeFull, debug, getAccessibleContext, getBaseline, getFrame, glue, name, openWindow, openWindow, openWindow, paintComponent, pixelsToPoints, pointsToPixels, setLayout, setOpaque, setTransparent, strut, wrapFrame
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public MakeColorPage()
public boolean readColorList()
IOUtils.getInputStream(java.lang.Class, java.lang.String)
,
including especially a local file or a web page URL.
The algorithm first checks if the name has not changed and, if so, does not reread the color list. Otherwise it tries to read from the named location. If that fails, the existing table--if any-- is retained. As a last resort, the the colors are read from //physpics.com/pictools/colorlist.csv
public void addColor(java.lang.String rgb, java.lang.String varDigit, java.lang.String name, java.lang.String ref)
rgb
- String in form #rrggbb, where r,g,and b are hexdigitsvarDigit
- A digit cjharacter to distinguish thi color from others of thje same namename
- The human-readable nameref
- The URL of a page defining the color.public java.util.ArrayList<PCASortColors.PCAColor> setColorTable(java.util.ArrayList<PCASortColors.PCAColor> tbl)
tbl
- New list of colorspublic java.util.ArrayList<PCASortColors.PCAColor> parseColorStream(java.io.InputStream istr)
RGB,NAME,VARIANT,SOURCE,LINKSubsequent lines each have five fields separated by commas:
istr
- the input stream to be read.public java.io.InputStream getTplStream()
public PCASortColors.PCAColor[] prepareColorList(java.lang.String button)
Possible sources of colorlist: use current if colorListLocator equals existinglistlocation as located with colorListLocator most recent successfull colorlist fallback list from the website
button
- which button to sort for. One of: byHue, byLightness,
byGrayScale, byPCA, byHueAndPCA, byHueAndLightness, byHueAndGrayScale,
byHueAndSaturation, byHueAndSplitLightness, blockspublic PCASortColors.PCAColor[] sortByButton(java.lang.String button)
button
- one of the names accepted by the switch statement below:
byHue, byLightness, byGrayScale, byPCA, byHueAndPCA, byHueAndLightness,
byHueAndGrayScale, byHueAndSaturation, byHueAndSplitLightness, blockspublic void genPage(MakeColorPage.Bucket buck, java.io.File dest, java.io.InputStream tplstr)
Lines displaying colors chromatically are inserted in template between Lines in alphabetic order are inserted in templateLocator between
buck
- a standard set of parameters passed to methods that write output pagesdest
- where to write the output.tplstr
- from whence to read the templatepublic void processArgs(java.lang.String[] args)
args
- If present, arg[0] is a locator for a CSV list of colors
as described in parseCSV. Default is website/pictools/colorlist.csv
If present, arg[1] is a locator for the name of the template
as described in genpage. Default: ./colorPageTemplate.php.
fallback is website/Java/tutorials/javanotes/colorpageTemplate.php
If present, arg[2] is the outputstem. Default is "colorrows". filename is ./stem-buttonname.phppublic static javax.swing.JFrame[] openWindows()
public static javax.swing.JFrame[] go(java.lang.String[] args)
args
- as described for method processArgs.public static void main(java.lang.String[] args)
args
- the command line arguments. processed in the go
method