public class PlanComponent extends javax.swing.JComponent implements PlanView, javax.swing.Scrollable, java.awt.print.Printable
Modifier and Type | Class and Description |
---|---|
protected static class |
PlanComponent.PaintMode
The circumstances under which the home items displayed by this component will be painted.
|
class |
PlanComponent.PlanRulerComponent
A component displaying the plan horizontal or vertical ruler associated to this plan.
|
javax.swing.JComponent.AccessibleJComponent
java.awt.Container.AccessibleAWTContainer
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
PlanView.CursorType
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
PlanComponent(Home home,
UserPreferences preferences,
PlanController controller)
Creates a new plan that displays
home . |
Modifier and Type | Method and Description |
---|---|
boolean |
canImportDraggedItems(java.util.List<Selectable> items,
int x,
int y)
Returns
true . |
int |
convertXModelToScreen(float x)
Returns
x converted in screen coordinates space. |
float |
convertXPixelToModel(int x)
Returns
x converted in model coordinates space. |
int |
convertYModelToScreen(float y)
Returns
y converted in screen coordinates space. |
float |
convertYPixelToModel(int y)
Returns
y converted in model coordinates space. |
protected java.awt.Cursor |
createCustomCursor(java.net.URL smallCursorImageUrl,
java.net.URL largeCursorImageUrl,
float xCursorHotSpot,
float yCursorHotSpot,
java.lang.String cursorName,
java.awt.Cursor defaultCursor)
Returns a custom cursor created from images in parameters.
|
void |
deleteFeedback()
Deletes all elements shown as feedback.
|
void |
deleteToolTipFeedback()
Deletes tool tip text from screen.
|
void |
exportToSVG(java.io.OutputStream outputStream)
Writes this plan in the given output stream at SVG (Scalable Vector Graphics) format.
|
protected java.awt.Color |
getBackgroundColor(PlanComponent.PaintMode mode)
Returns the background color used to draw content.
|
java.awt.image.BufferedImage |
getClipboardImage()
Returns an image of the selected items displayed by this component
(camera excepted) with no outline at scale 1/1 (1 pixel = 1cm).
|
protected java.awt.Font |
getFont(java.awt.Font defaultFont,
TextStyle textStyle)
Returns the AWT font matching a given text style.
|
protected java.awt.FontMetrics |
getFontMetrics(java.awt.Font defaultFont,
TextStyle textStyle)
Returns the font metrics matching a given text style.
|
protected java.awt.Color |
getForegroundColor(PlanComponent.PaintMode mode)
Returns the foreground color used to draw content.
|
protected java.awt.Color |
getFurnitureOutlineColor()
Returns the color used to draw furniture outline of
the shape where a user can click to select a piece of furniture.
|
View |
getHorizontalRuler()
Returns the component used as an horizontal ruler for this plan.
|
protected java.awt.geom.Rectangle2D |
getItemBounds(java.awt.Graphics g,
Selectable item)
Returns the bounds of the given
item . |
protected java.util.List<Selectable> |
getPaintedItems()
Returns the collection of walls, furniture, rooms and dimension lines of the home
painted by this component wherever the level they belong to is selected or not.
|
float |
getPixelLength()
Returns the length in centimeters of a pixel with the current scale.
|
java.awt.Dimension |
getPreferredScrollableViewportSize() |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size of this component.
|
float |
getPrintPreferredScale(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat)
Returns the print preferred scale of the plan drawn in this component
to make it fill
pageFormat imageable size. |
float |
getScale()
Returns the scale used to display the plan.
|
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction) |
boolean |
getScrollableTracksViewportHeight() |
boolean |
getScrollableTracksViewportWidth() |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction) |
protected java.awt.Color |
getSelectionColor()
Returns the color used to draw selection outlines.
|
float[][] |
getTextBounds(java.lang.String text,
TextStyle style,
float x,
float y,
float angle)
Returns the coordinates of the bounding rectangle of the
text centered at
the point (x ,y ). |
View |
getVerticalRuler()
Returns the component used as a vertical ruler for this plan.
|
boolean |
isBackgroundPainted()
Returns
true if plan's background should be painted. |
boolean |
isSelectedItemsOutlinePainted()
Returns
true if the outline of home selected items should be painted. |
void |
makePointVisible(float x,
float y)
Ensures the point at (
x , y ) is visible,
moving scroll bars if needed. |
void |
makeSelectionVisible()
Ensures selected items are visible at screen and moves
scroll bars if needed.
|
void |
moveView(float dx,
float dy)
Moves the view from (dx, dy) unit in the scrolling zone it belongs to.
|
protected void |
paintComponent(java.awt.Graphics g)
Paints this component.
|
protected void |
paintHomeItems(java.awt.Graphics g,
float planScale,
java.awt.Color backgroundColor,
java.awt.Color foregroundColor,
PlanComponent.PaintMode paintMode)
Paints home items at the given scale, and with background and foreground colors.
|
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Prints this component plan at the scale given in the home print attributes or at a scale
that makes it fill
pageFormat imageable size if this attribute is null . |
void |
revalidate()
Revalidates and repaints this component and its rulers.
|
void |
setAlignmentFeedback(java.lang.Class<? extends Selectable> alignedObjectClass,
Selectable alignedObject,
float x,
float y,
boolean showPointFeedback)
Sets the location point for alignment feedback.
|
void |
setAngleFeedback(float xCenter,
float yCenter,
float x1,
float y1,
float x2,
float y2)
Sets the points used to draw an angle in plan view.
|
void |
setBackgroundPainted(boolean backgroundPainted)
Sets whether plan's background should be painted or not.
|
void |
setCursor(PlanView.CursorType cursorType)
Sets the cursor of this component as rotation cursor.
|
void |
setDimensionLinesFeedback(java.util.List<DimensionLine> dimensionLines)
Sets the given dimension lines to be drawn as feedback.
|
void |
setDraggedItemsFeedback(java.util.List<Selectable> draggedItems)
Sets the feedback of dragged items drawn during a drag and drop operation,
initiated from outside of plan view.
|
void |
setRectangleFeedback(float x0,
float y0,
float x1,
float y1)
Sets rectangle selection feedback coordinates.
|
void |
setResizeIndicatorVisible(boolean resizeIndicatorVisible)
Sets whether the resize indicator of selected wall or piece of furniture
should be visible or not.
|
void |
setScale(float scale)
Sets the scale used to display the plan.
|
void |
setSelectedItemsOutlinePainted(boolean selectedItemsOutlinePainted)
Sets whether the outline of home selected items should be painted or not.
|
void |
setToolTipEditedProperties(PlanController.EditableProperty[] toolTipEditedProperties,
java.lang.Object[] toolTipPropertyValues,
float x,
float y)
Set tool tip edition.
|
void |
setToolTipFeedback(java.lang.String toolTipFeedback,
float x,
float y)
Sets tool tip text displayed as feedback.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, 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, updateUI
add, add, add, add, add, addContainerListener, addImpl, 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, setLayout, 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 PlanComponent(Home home, UserPreferences preferences, PlanController controller)
home
.public void revalidate()
revalidate
in class javax.swing.JComponent
protected java.awt.Cursor createCustomCursor(java.net.URL smallCursorImageUrl, java.net.URL largeCursorImageUrl, float xCursorHotSpot, float yCursorHotSpot, java.lang.String cursorName, java.awt.Cursor defaultCursor)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
protected java.util.List<Selectable> getPaintedItems()
protected java.awt.geom.Rectangle2D getItemBounds(java.awt.Graphics g, Selectable item)
item
.public float[][] getTextBounds(java.lang.String text, TextStyle style, float x, float y, float angle)
text
centered at
the point (x
,y
).getTextBounds
in interface PlanView
protected java.awt.Font getFont(java.awt.Font defaultFont, TextStyle textStyle)
protected java.awt.FontMetrics getFontMetrics(java.awt.Font defaultFont, TextStyle textStyle)
public void setBackgroundPainted(boolean backgroundPainted)
public boolean isBackgroundPainted()
true
if plan's background should be painted.public void setSelectedItemsOutlinePainted(boolean selectedItemsOutlinePainted)
public boolean isSelectedItemsOutlinePainted()
true
if the outline of home selected items should be painted.protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public float getPrintPreferredScale(java.awt.Graphics g, java.awt.print.PageFormat pageFormat)
pageFormat
imageable size.public int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
pageFormat
imageable size if this attribute is null
.print
in interface java.awt.print.Printable
public java.awt.image.BufferedImage getClipboardImage()
public void exportToSVG(java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
protected java.awt.Color getForegroundColor(PlanComponent.PaintMode mode)
protected java.awt.Color getBackgroundColor(PlanComponent.PaintMode mode)
protected void paintHomeItems(java.awt.Graphics g, float planScale, java.awt.Color backgroundColor, java.awt.Color foregroundColor, PlanComponent.PaintMode paintMode) throws java.io.InterruptedIOException
PAINT
mode.java.io.InterruptedIOException
protected java.awt.Color getSelectionColor()
protected java.awt.Color getFurnitureOutlineColor()
public void setRectangleFeedback(float x0, float y0, float x1, float y1)
setRectangleFeedback
in interface PlanView
public void makeSelectionVisible()
makeSelectionVisible
in interface PlanView
public void makePointVisible(float x, float y)
x
, y
) is visible,
moving scroll bars if needed.makePointVisible
in interface PlanView
public void moveView(float dx, float dy)
public float getScale()
public void setScale(float scale)
public float convertXPixelToModel(int x)
x
converted in model coordinates space.convertXPixelToModel
in interface PlanView
public float convertYPixelToModel(int y)
y
converted in model coordinates space.convertYPixelToModel
in interface PlanView
public int convertXModelToScreen(float x)
x
converted in screen coordinates space.convertXModelToScreen
in interface PlanView
public int convertYModelToScreen(float y)
y
converted in screen coordinates space.convertYModelToScreen
in interface PlanView
public float getPixelLength()
getPixelLength
in interface PlanView
public void setCursor(PlanView.CursorType cursorType)
public void setToolTipFeedback(java.lang.String toolTipFeedback, float x, float y)
setToolTipFeedback
in interface PlanView
toolTipFeedback
- the text displayed in the tool tip
or null
to make tool tip disappear.public void setToolTipEditedProperties(PlanController.EditableProperty[] toolTipEditedProperties, java.lang.Object[] toolTipPropertyValues, float x, float y)
setToolTipEditedProperties
in interface PlanView
public void deleteToolTipFeedback()
deleteToolTipFeedback
in interface PlanView
public void setResizeIndicatorVisible(boolean resizeIndicatorVisible)
setResizeIndicatorVisible
in interface PlanView
public void setAlignmentFeedback(java.lang.Class<? extends Selectable> alignedObjectClass, Selectable alignedObject, float x, float y, boolean showPointFeedback)
setAlignmentFeedback
in interface PlanView
public void setAngleFeedback(float xCenter, float yCenter, float x1, float y1, float x2, float y2)
setAngleFeedback
in interface PlanView
public void setDraggedItemsFeedback(java.util.List<Selectable> draggedItems)
setDraggedItemsFeedback
in interface PlanView
public void setDimensionLinesFeedback(java.util.List<DimensionLine> dimensionLines)
setDimensionLinesFeedback
in interface PlanView
public void deleteFeedback()
deleteFeedback
in interface PlanView
public boolean canImportDraggedItems(java.util.List<Selectable> items, int x, int y)
true
.canImportDraggedItems
in interface PlanView
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface javax.swing.Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface javax.swing.Scrollable
public View getHorizontalRuler()
getHorizontalRuler
in interface PlanView
public View getVerticalRuler()
getVerticalRuler
in interface PlanView
© Copyrights 2006-2014 eTeks - All rights reserved
Distributed under GNU General Public License