public class DefaultLayoutControl extends JComponent implements LayoutControl
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
PERSISTENCE_DEFINITION_NAME |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DefaultLayoutControl()
Create a new object of LayoutControl.
|
Modifier and Type | Method and Description |
---|---|
int |
addGeometryAdapterPoint()
Add a new point to geometryAdapter.
|
void |
addLayoutTool(String name,
LayoutBehavior tool)
Add a new Layout tool.
|
protected AffineTransform |
calculateTransformFromViewport()
Calculates the affine transform using the viewport and the control size,
instead of calculating it from
rect . as usual. |
void |
clearMouseImage()
Clear the image of pointer of mouse.
|
void |
delLastPoint()
Remove last point of geometryAdapter.
|
void |
fullRect()
It obtains the rect that is adjusted to the size of the window,
to see the full extent of layout.
|
AffineTransform |
getAT()
Returns the AffineTransform that is applying in the Layout.
|
JComponent |
getComponent() |
LayoutBehavior |
getCurrentLayoutTool()
Returns the current Layout tool.
|
String |
getCurrentTool()
Returns the name of the current selected tool on this Layout
|
Point |
getFirstPoint()
It returns the first click point of mouse.
|
GeometryAdapter |
getGeometryAdapter()
It returns the current GeometryAdapter.
|
BufferedImage |
getImage()
Returns the current image of Layout.
|
BufferedImage |
getImgRuler()
Returns the image with the ruler.
|
Point |
getLastPoint()
Returns the last click point of mouse.
|
LayoutContext |
getLayoutContext()
Returns the LayoutContext.
|
FLayoutDraw |
getLayoutDraw()
Returns the object to draw the Layout.
|
FLayoutFunctions |
getLayoutFunctions()
Returns the object of FLayoutFunctions.
|
FLayoutZooms |
getLayoutZooms()
Returns the object to make zooms.
|
Point |
getPointAnt()
Returns the previous click of mouse.
|
Point |
getPosition()
Returns the position adjusted point.
|
Rectangle2D.Double |
getRect()
Returns a copy of the rectangle that represents the size
and position of the layout sheet (in pixels), relative to
the containing LayoutControl.
|
Point |
getRectOrigin()
It returns the point that represents the northwest corner of the Layout.
|
Rectangle |
getReSel()
Returns the rectangle of selection.
|
void |
initialize(LayoutPanel layoutPanel) |
boolean |
isDrawingCancelled()
It returns true if the drawing has been canceled.
|
boolean |
isReSel()
It returns true if should draw the rectangle of selection and does the
selection.
|
protected void |
paintComponent(Graphics g)
paintComponent of Layout.
|
void |
refresh()
Refres the Layout.
|
void |
setCancelDrawing(boolean b)
It cancels the drawing if the parameter is true.
|
void |
setDefaultTool()
Changes the currently selected tool to the default tool
|
void |
setFirstPoint()
Inserts the first click point of mouse.
|
void |
setGeometryAdapter(GeometryAdapter adapter)
Inserts the geometryAdapter.
|
void |
setGeometryAdapterPoinPosition()
Change the position of mousemoved point of geometryAdapter.
|
void |
setIsReSel(boolean b)
Insert true if should draw the rectangle of selection and does the
selection.
|
void |
setLastPoint()
Inserts the last click point of mouse.
|
void |
setLayoutContext(LayoutContext lc)
Inserts the LayoutContext.
|
void |
setMapCursor(Image image)
Changes the pointer of the mouse by the image of parameter.
|
void |
setPointAnt()
Inserts the previous click point of mouse.
|
void |
setPosition(Point point2)
Insert the position point and calculate the new position if the grid is
actived.
|
void |
setRect(Rectangle2D r)
Sets the size and position of the layout sheet in screen coordinates
(pixels), relative to the LayoutControl.
|
void |
setTool(String toolName)
It establishes as selected to the tool from its name of identification.
|
void |
startEdit()
Start the vertex edition of graphics.
|
void |
stopEdit()
Stop the vertex edition of graphics.
|
void |
update(Observable observable,
Object notification)
Called whenever a
Observable object is changed and this
Observer has registered on it to receive notifications. |
void |
viewFull()
It does a full extent of the layers that contains the view of the
FFrameView selected.
|
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, getPreferredSize, 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, 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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHeight, getWidth, repaint
public static final String PERSISTENCE_DEFINITION_NAME
public DefaultLayoutControl()
layout
- public void initialize(LayoutPanel layoutPanel)
public String getCurrentTool()
LayoutControl
getCurrentTool
in interface LayoutControl
public void addLayoutTool(String name, LayoutBehavior tool)
LayoutControl
addLayoutTool
in interface LayoutControl
name
- Name of tool.tool
- LayoutBehaviorpublic void setLayoutContext(LayoutContext lc)
LayoutControl
setLayoutContext
in interface LayoutControl
lc
- LayoutContext.protected void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- Graphics of Layout.public BufferedImage getImgRuler()
LayoutControl
getImgRuler
in interface LayoutControl
public void fullRect()
LayoutControl
fullRect
in interface LayoutControl
public Rectangle2D.Double getRect()
LayoutControl
Returns a copy of the rectangle that represents the size and position of the layout sheet (in pixels), relative to the containing LayoutControl.
Note: you must use LayoutControl.setRect(Rectangle2D)
to update
the rectangle, as this method only returns a copy of it.
getRect
in interface LayoutControl
LayoutControl.setRect(Rectangle2D)
public void setRect(Rectangle2D r)
LayoutControl
Sets the size and position of the layout sheet in screen coordinates (pixels), relative to the LayoutControl.
The size of the sheet is usually different from the bounds of the underlying UI control, for instance if we have zoomed in an area of the sheet then the paper size in pixels will be bigger than the actual control size.
setRect
in interface LayoutControl
public BufferedImage getImage()
LayoutControl
getImage
in interface LayoutControl
public void setMapCursor(Image image)
LayoutControl
setMapCursor
in interface LayoutControl
image
- Imagepublic void setTool(String toolName)
LayoutControl
setTool
in interface LayoutControl
toolName
- Name of identification tool.public void setDefaultTool()
LayoutControl
setDefaultTool
in interface LayoutControl
public void startEdit()
LayoutControl
startEdit
in interface LayoutControl
public void stopEdit()
LayoutControl
stopEdit
in interface LayoutControl
public Point getRectOrigin()
LayoutControl
getRectOrigin
in interface LayoutControl
public FLayoutDraw getLayoutDraw()
LayoutControl
getLayoutDraw
in interface LayoutControl
public LayoutBehavior getCurrentLayoutTool()
LayoutControl
getCurrentLayoutTool
in interface LayoutControl
public Point getFirstPoint()
LayoutControl
getFirstPoint
in interface LayoutControl
public Point getPointAnt()
LayoutControl
getPointAnt
in interface LayoutControl
public Point getLastPoint()
LayoutControl
getLastPoint
in interface LayoutControl
public void setFirstPoint()
LayoutControl
setFirstPoint
in interface LayoutControl
public void setPointAnt()
LayoutControl
setPointAnt
in interface LayoutControl
public void setLastPoint()
LayoutControl
setLastPoint
in interface LayoutControl
public void setPosition(Point point2)
LayoutControl
setPosition
in interface LayoutControl
point2
- Position.public Point getPosition()
LayoutControl
getPosition
in interface LayoutControl
public AffineTransform getAT()
LayoutControl
getAT
in interface LayoutControl
public GeometryAdapter getGeometryAdapter()
LayoutControl
getGeometryAdapter
in interface LayoutControl
public void delLastPoint()
LayoutControl
delLastPoint
in interface LayoutControl
public int addGeometryAdapterPoint()
LayoutControl
addGeometryAdapterPoint
in interface LayoutControl
public void setGeometryAdapterPoinPosition()
LayoutControl
setGeometryAdapterPoinPosition
in interface LayoutControl
public void clearMouseImage()
LayoutControl
clearMouseImage
in interface LayoutControl
public void refresh()
LayoutControl
refresh
in interface LayoutControl
protected AffineTransform calculateTransformFromViewport()
rect
. as usual. This is required when
the component size changes, as rect
. has to be recalculated using
the viewport, and thus we can't calculate the affine transform using
rect
.public boolean isDrawingCancelled()
LayoutControl
isDrawingCancelled
in interface LayoutControl
public void setCancelDrawing(boolean b)
LayoutControl
setCancelDrawing
in interface LayoutControl
b
- true if the drawing wants to be canceledpublic Rectangle getReSel()
LayoutControl
getReSel
in interface LayoutControl
public boolean isReSel()
LayoutControl
isReSel
in interface LayoutControl
public void setIsReSel(boolean b)
LayoutControl
setIsReSel
in interface LayoutControl
b
- boolean.public void viewFull() throws ReadException
LayoutControl
viewFull
in interface LayoutControl
ReadException
public FLayoutZooms getLayoutZooms()
LayoutControl
getLayoutZooms
in interface LayoutControl
public FLayoutFunctions getLayoutFunctions()
LayoutControl
getLayoutFunctions
in interface LayoutControl
public LayoutContext getLayoutContext()
LayoutControl
getLayoutContext
in interface LayoutControl
public void setGeometryAdapter(GeometryAdapter adapter)
LayoutControl
setGeometryAdapter
in interface LayoutControl
adapter
- GeometryAdapter.public JComponent getComponent()
getComponent
in interface LayoutControl
public void update(Observable observable, Object notification)
Observer
Observable
object is changed and this
Observer
has registered on it to receive notifications.
Implementations of this method will be called for each simple notification or, if a complex notification is created, for each of the child notifications.
In the latter case, don't assume any ordering in the notification between
this Observer
and other Observer
s listening to the same
Observable
.
In a complex notification scenario, if you want to receive only the
complex notification and not each of the child notifications, just
implement the ComplexObserver
and prepare this method
implementation to handle receiving DefaultComplexNotification
instances
as well as direct notification objects.