com.tensegrity.gui.swing.control.preview
Class AbstractPreview

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.tensegrity.gui.swing.control.preview.AbstractPreview
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, Preview, java.io.Serializable
Direct Known Subclasses:
DefaultPreview

public abstract class AbstractPreview
extends javax.swing.JPanel
implements Preview

This abstract class is meant to ease the implementation of a Preview control based on a JPanel. It covers the set and get methods for format parameters and is limited to a fixed size, which is suitable for most cases.

Version:
$Id: AbstractPreview.java,v 1.14 2005/09/06 16:11:18 BurkhardWick Exp $
Author:
Gilles Iachelini
See Also:
StrokeFormat, PaintFormat, FontFormat, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int fontColor
          The font color.
protected  java.lang.String fontFamily
          The family name of the font.
protected  boolean fontItalic
          The flag that indicates italic style.
protected  int fontSize
          The size of the Font.
protected  boolean fontStrikethrough
          The flag that indicates strikethrough.
protected  boolean fontUnderline
          The flag that indicates underlining.
protected  int fontWeight
          The weight of the font.
protected  int markerSize
          The size of the marker.
protected  int markerType
          The type of a marker.
protected  int paintColorback
          The background color.
protected  int paintColorfore
          The foreground color.
protected  int paintGradientType
          The gradient type.
protected  int paintPatternType
          The pattern type.
protected  int paintStyle
          The style of a Paint.
protected  java.lang.String paintTextureKey
          The texture raster key for the raster
protected  int paintTransparency
          The level of transparency.
protected  boolean paintTransparent
          The flag that indicates whether to use transparency or not.
protected  java.awt.Dimension pSize
          Fixed size for Preview elements.
protected  StrokeFormat strikethroughStroke
          The stroke format for the strikethrough
protected  int strokeColor
          Color of a Stroke.
protected  double[] strokePattern
          Pattern of a Stroke.
protected  int strokeStyle
          Style of a Stroke.
protected  int strokeWeight
          Weight of a Stroke.
protected  StrokeFormat underlineStroke
          The stroke format for the underline
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractPreview()
          Constructor for AbstractPreview.
 
Method Summary
 int getFontColor()
          Method getFontColor returns the color of the currently previewed font.
 java.lang.String getFontFamily()
          Method getFontFamily returns the name of the currently previewed font.
 boolean getFontItalic()
          Method getFontItalic returns the flag that indicates that the previewed font is italic.
 int getFontSize()
          Method getFontSize returns the size of the currently previewed font.
 boolean getFontStrikethrough()
          Method getFontStrikethrough returns the flag that indicates that the previewed font is strikethrough.
 boolean getFontUnderline()
          Method getFontUnderline returns the flag that indicates that the previewed font is underlined.
 int getFontWeight()
          Method getFontWeight returns the weight of the currently previewed font.
 int getMarkerSize()
          Returns the size of the marker.
 int getMarkerType()
          Returns the type of the marker.
 int getPaintColorback()
          Method getPaintColorback returns the current background color of the previewed paint.
 int getPaintColorfore()
          Method getPaintColorfore returns the current foreground color of the previewed paint.
 int getPaintGradientType()
          Method getPaintGradientType returns the gradient type as int.
 int getPaintPatternType()
          Method getPaintPatternType returns pattern type as int.
 int getPaintStyle()
          Method getPaintStyle returns the current style of the previewed paint.
 java.lang.String getPaintTextureKey()
          Returns the texture raster key that is used to get the raster from the pool.
 int getPaintTransparency()
          Method getPaintTransparency returns the level of transparency as an int between zero and 100.
 boolean getPaintTransparent()
          Method getPaintTransparent returns the flag that indicates whether to use transparency.
 java.awt.Dimension getPreferredSize()
           
 int getStrokeColor()
          Method getStrokeColor returns the current color of the previewed stroke.
 int getStrokeStyle()
          Method getStrokeStyle returns the current style of the previewed stroke.
 int getStrokeWeight()
          Method getStrokeWeight returns the current weight of the previewed stroke.
 void setFontFormat(int fontSize, int fontWeight, java.lang.String fontFamily, int fontColor, boolean fontItalic, boolean fontUnderline, boolean fontStrikethrough, StrokeFormat underlineStroke, StrokeFormat strikethroughStroke)
          Method setFontFormat sets all font relevant values.
 void setMarkerFormat(int type, int size, int paintStyle, int paintColorback, int paintColorfore, int paintGradientType, int paintPatternType, java.lang.String textureKey, int paintTransparency, boolean paintTransparent, int strokeStyle, int strokeWeight, int strokeColor)
          Sets the MarkerFormat based on the given parameters.
 void setPaintFormat(int paintStyle, int paintColorback, int paintColorfore, int paintGradientType, int paintPatternType, java.lang.String paintTextureKey, int paintTransparency, boolean paintTransparent)
          Method setPaintFormat sets all PaintFormat relevant values.
 void setStrokeFormat(int strokeStyle, int strokeWeight, int strokeColor, double[] strokePattern)
          Method setStrokeFormat sets all stroke related values.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

strokeStyle

protected int strokeStyle
Style of a Stroke.

See Also:
StrokeFormat

strokeWeight

protected int strokeWeight
Weight of a Stroke.

See Also:
StrokeFormat

strokeColor

protected int strokeColor
Color of a Stroke.

See Also:
StrokeFormat

strokePattern

protected double[] strokePattern
Pattern of a Stroke.

See Also:
StrokeFormat

paintStyle

protected int paintStyle
The style of a Paint.

See Also:
PaintFormat

paintColorback

protected int paintColorback
The background color.

See Also:
PaintFormat

paintColorfore

protected int paintColorfore
The foreground color.

See Also:
PaintFormat

paintGradientType

protected int paintGradientType
The gradient type.

See Also:
PaintFormat

paintPatternType

protected int paintPatternType
The pattern type.

See Also:
PaintFormat

paintTextureKey

protected java.lang.String paintTextureKey
The texture raster key for the raster


paintTransparency

protected int paintTransparency
The level of transparency.

See Also:
PaintFormat

paintTransparent

protected boolean paintTransparent
The flag that indicates whether to use transparency or not.

See Also:
PaintFormat

fontSize

protected int fontSize
The size of the Font.

See Also:
FontFormat

fontWeight

protected int fontWeight
The weight of the font.

See Also:
FontFormat

fontFamily

protected java.lang.String fontFamily
The family name of the font.

See Also:
FontFormat

fontColor

protected int fontColor
The font color.

See Also:
FontFormat

fontItalic

protected boolean fontItalic
The flag that indicates italic style.

See Also:
FontFormat

fontUnderline

protected boolean fontUnderline
The flag that indicates underlining.

See Also:
FontFormat

fontStrikethrough

protected boolean fontStrikethrough
The flag that indicates strikethrough.

See Also:
FontFormat

markerType

protected int markerType
The type of a marker.

See Also:
MarkerFormat

markerSize

protected int markerSize
The size of the marker.

See Also:
MarkerFormat

pSize

protected java.awt.Dimension pSize
Fixed size for Preview elements.


underlineStroke

protected StrokeFormat underlineStroke
The stroke format for the underline


strikethroughStroke

protected StrokeFormat strikethroughStroke
The stroke format for the strikethrough

Constructor Detail

AbstractPreview

public AbstractPreview()
Constructor for AbstractPreview. Sets this Preview to be not opaque.

Method Detail

getStrokeStyle

public int getStrokeStyle()
Description copied from interface: Preview
Method getStrokeStyle returns the current style of the previewed stroke.

Specified by:
getStrokeStyle in interface Preview
Returns:
int the style as int.
See Also:
StrokeFormat

getStrokeWeight

public int getStrokeWeight()
Description copied from interface: Preview
Method getStrokeWeight returns the current weight of the previewed stroke.

Specified by:
getStrokeWeight in interface Preview
Returns:
int the weight as int.
See Also:
StrokeFormat

getStrokeColor

public int getStrokeColor()
Description copied from interface: Preview
Method getStrokeColor returns the current color of the previewed stroke.

Specified by:
getStrokeColor in interface Preview
Returns:
int the color as rgb int.
See Also:
StrokeFormat

setStrokeFormat

public void setStrokeFormat(int strokeStyle,
                            int strokeWeight,
                            int strokeColor,
                            double[] strokePattern)
Description copied from interface: Preview
Method setStrokeFormat sets all stroke related values.

Specified by:
setStrokeFormat in interface Preview
Parameters:
strokeStyle - the style as int.
strokeWeight - the weight as int.
strokeColor - the color as int.
strokePattern - the pattern as double array
See Also:
StrokeFormat

getPaintStyle

public int getPaintStyle()
Description copied from interface: Preview
Method getPaintStyle returns the current style of the previewed paint.

Specified by:
getPaintStyle in interface Preview
Returns:
int the style as int.
See Also:
PaintFormat

getPaintColorback

public int getPaintColorback()
Description copied from interface: Preview
Method getPaintColorback returns the current background color of the previewed paint.

Specified by:
getPaintColorback in interface Preview
Returns:
int the style as int.
See Also:
PaintFormat

getPaintColorfore

public int getPaintColorfore()
Description copied from interface: Preview
Method getPaintColorfore returns the current foreground color of the previewed paint.

Specified by:
getPaintColorfore in interface Preview
Returns:
int the color as rgb int.
See Also:
PaintFormat

getPaintGradientType

public int getPaintGradientType()
Description copied from interface: Preview
Method getPaintGradientType returns the gradient type as int.

Specified by:
getPaintGradientType in interface Preview
Returns:
int the gradient type.
See Also:
PaintFormat

getPaintPatternType

public int getPaintPatternType()
Description copied from interface: Preview
Method getPaintPatternType returns pattern type as int.

Specified by:
getPaintPatternType in interface Preview
Returns:
int the pattern type as int.
See Also:
PaintFormat

getPaintTransparency

public int getPaintTransparency()
Description copied from interface: Preview
Method getPaintTransparency returns the level of transparency as an int between zero and 100.

Specified by:
getPaintTransparency in interface Preview
Returns:
int the level of transparency.
See Also:
PaintFormat

getPaintTextureKey

public java.lang.String getPaintTextureKey()
Description copied from interface: Preview
Returns the texture raster key that is used to get the raster from the pool.

Specified by:
getPaintTextureKey in interface Preview
Returns:
the texture raster key that is used to get the raster from the pool.
See Also:
PaintFormat

getPaintTransparent

public boolean getPaintTransparent()
Description copied from interface: Preview
Method getPaintTransparent returns the flag that indicates whether to use transparency.

Specified by:
getPaintTransparent in interface Preview
Returns:
boolean true, if the paint uses transparency, otherwise false.
See Also:
PaintFormat

setPaintFormat

public void setPaintFormat(int paintStyle,
                           int paintColorback,
                           int paintColorfore,
                           int paintGradientType,
                           int paintPatternType,
                           java.lang.String paintTextureKey,
                           int paintTransparency,
                           boolean paintTransparent)
Description copied from interface: Preview
Method setPaintFormat sets all PaintFormat relevant values.

Specified by:
setPaintFormat in interface Preview
Parameters:
paintStyle - the style.
paintColorback - the background color as rgb int.
paintColorfore - the foregound color as rgb int.
paintGradientType - the gradient type.
paintPatternType - the pattern type.
paintTextureKey - the texture raster key.
paintTransparency - the level of transparency.
paintTransparent - the transparent flag.
See Also:
PaintFormat

getFontSize

public int getFontSize()
Description copied from interface: Preview
Method getFontSize returns the size of the currently previewed font.

Specified by:
getFontSize in interface Preview
Returns:
int the size as int.
See Also:
FontFormat

getFontWeight

public int getFontWeight()
Description copied from interface: Preview
Method getFontWeight returns the weight of the currently previewed font.

Specified by:
getFontWeight in interface Preview
Returns:
int the weight as int.
See Also:
FontFormat

getFontFamily

public java.lang.String getFontFamily()
Description copied from interface: Preview
Method getFontFamily returns the name of the currently previewed font.

Specified by:
getFontFamily in interface Preview
Returns:
String the name of the font.
See Also:
FontFormat

getFontColor

public int getFontColor()
Description copied from interface: Preview
Method getFontColor returns the color of the currently previewed font.

Specified by:
getFontColor in interface Preview
Returns:
int the color as rgb int.
See Also:
FontFormat

getFontItalic

public boolean getFontItalic()
Description copied from interface: Preview
Method getFontItalic returns the flag that indicates that the previewed font is italic.

Specified by:
getFontItalic in interface Preview
Returns:
boolean true, if the font is italic, otherwise false.
See Also:
FontFormat

getFontUnderline

public boolean getFontUnderline()
Description copied from interface: Preview
Method getFontUnderline returns the flag that indicates that the previewed font is underlined.

Specified by:
getFontUnderline in interface Preview
Returns:
boolean true, if the font is underlined, otherwise false.
See Also:
FontFormat

getFontStrikethrough

public boolean getFontStrikethrough()
Description copied from interface: Preview
Method getFontStrikethrough returns the flag that indicates that the previewed font is strikethrough.

Specified by:
getFontStrikethrough in interface Preview
Returns:
boolean true, if the font is strikethrough, otherwise false.
See Also:
FontFormat

setFontFormat

public void setFontFormat(int fontSize,
                          int fontWeight,
                          java.lang.String fontFamily,
                          int fontColor,
                          boolean fontItalic,
                          boolean fontUnderline,
                          boolean fontStrikethrough,
                          StrokeFormat underlineStroke,
                          StrokeFormat strikethroughStroke)
Description copied from interface: Preview
Method setFontFormat sets all font relevant values.

Specified by:
setFontFormat in interface Preview
Parameters:
fontSize - the size as int.
fontWeight - the weight as int.
fontFamily - the name of the font family as String.
fontColor - the color as rgb int.
fontItalic - the flag that indicates italic.
fontUnderline - the flag that indicates underline.
fontStrikethrough - the flag that indicates strikethrough.
See Also:
FontFormat

getMarkerType

public int getMarkerType()
Returns the type of the marker.

Returns:
the Type of the Marker as integer.

getMarkerSize

public int getMarkerSize()
Returns the size of the marker.

Returns:
the size of the marker as integer.

setMarkerFormat

public void setMarkerFormat(int type,
                            int size,
                            int paintStyle,
                            int paintColorback,
                            int paintColorfore,
                            int paintGradientType,
                            int paintPatternType,
                            java.lang.String textureKey,
                            int paintTransparency,
                            boolean paintTransparent,
                            int strokeStyle,
                            int strokeWeight,
                            int strokeColor)
Sets the MarkerFormat based on the given parameters. Uses the existing setter concerning stroke and paint. No separate ones for Marker's paint and stroke.

Parameters:
type - Type of the marker.
size - its size.
paintStyle - style for the paint.
paintColorback - background color.
paintColorfore - foreground color.
paintGradientType - gradient type, if style is set properly.
paintPatternType - pattern type, if style is set properly.
textureKey - The texture raster key or PaintFormat.TEXTURE_NONE
paintTransparency - transparency level.
paintTransparent - flag to indicate transparency.
strokeStyle - style of the stroke.
strokeWeight - weight of the stroke.
strokeColor - color of the stroke.

getPreferredSize

public java.awt.Dimension getPreferredSize()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.