nl.coderight.jazz
Class View

java.lang.Object
  extended by nl.coderight.jazz.View
Direct Known Subclasses:
FormView

public abstract class View
extends Object

View is part of the HMVC pattern.

The view represents the user interface.

Default event-handlers:

See Also:
FormView, Controller.setView(View), Controller.showView(), Controller.closeView(), Controller.onBeforeShowView(), Controller.onAfterShowView()

Nested Class Summary
static class View.ToolBarPosition
          Enumeration of possible ToolBar positions.
static class View.ViewPosition
          Enumeration of possible View positions.
 
Constructor Summary
View()
          Default constructor.
 
Method Summary
 BufferedImage capture()
          Returns an Image (screenshot) of this View.
 void center()
          Center View on parent.
 void center(View.ViewPosition position)
          Center View with given position.
 void close()
           
protected  void dispose()
          Invoked when view is closed.
 void focus()
           
 JPanel getComponent()
           
 Cursor getCursor()
           
 JButton getDefaultButton()
           
protected  Model getModel()
           
 Point getPosition()
           
 ProgressMonitor getProgressMonitor()
           
 Object getResource(String name)
           
 Icon getResourceAsIcon(String name)
           
 Image getResourceAsImage(String name)
           
 Dimension getSize()
           
 String getTitle()
           
 void handleEvent(ModelEvent evt)
           
protected abstract  void init()
          Invoked after Controller.showView().
 boolean isEnabled()
           
 boolean isMaximizable()
           
 boolean isMinimizable()
           
 boolean isModal()
           
 boolean isOpaque()
           
 boolean isResizable()
           
 void maximize()
           
 void minimize()
           
protected  void onActivate()
          Invoked when view is activated.
protected  void onClose()
          Invoked when view is closed.
protected  void onDeactivate()
          Invoked when view is de-activated.
protected  void onMaximize()
          Invoked when view is de-iconified.
protected  void onMinimize()
          Invoked when view is iconified.
protected  void onOpen()
          Invoked when view is opened.
protected  void onShow()
          Invoked when view has been made visible.
 void postEvent(Event event)
           
 void print()
          Print the contents of this view.
 void propagateEvent(Event event)
           
 void registerKeyboardAction(Action action)
          Provides keyboard bindings for Actions.
protected abstract  void reset()
          Invoked after onOpen() and before onShow().
 void restore()
           
 void setBackground(Color color)
           
 void setBorder(Border border)
           
 void setCloseEvent(Event closeEvent)
          Sets a custom close Event.
 void setCursor(Cursor cursor)
           
 void setDefaultButton(JButton defaultButton)
           
 void setEnabled(boolean enabled)
           
 void setForeground(Color color)
           
 void setIcon(Icon icon)
           
 void setLayout(LayoutManager layoutManager)
           
 void setMaximizable(boolean maximizable)
           
 void setMenuBar(MenuBar menuBar)
          Sets a MenuBar for this view.
 void setMinimizable(boolean minimizable)
           
 void setOpacity(float opacity)
           
 void setOpaque(boolean opaque)
           
 void setPainter(Painter painter)
           
 void setPosition(int x, int y)
           
 void setPosition(Point position)
           
 void setProgressMonitor(ProgressMonitor progressMonitor)
           
 void setResizable(boolean resizable)
           
 void setSize(Dimension size)
           
 void setSize(int width, int height)
           
 void setStatusBar(StatusBar statusBar)
          Sets a StatusBar for this view.
 void setTimer(Timer timer)
           
 void setTitle(String title)
           
 void setToolBar(ToolBar toolBar)
          Sets a ToolBar for this view.
 void setToolBar(ToolBar toolBar, View.ToolBarPosition position)
          Sets a ToolBar for this view.
 void setViewPosition(View.ViewPosition position)
           
 String translate(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

View

public View()
Default constructor.

Default the following settings are used:

Method Detail

getComponent

public JPanel getComponent()

close

public void close()
See Also:
Controller.closeView()

setCloseEvent

public void setCloseEvent(Event closeEvent)
Sets a custom close Event.
 When a user closes a view by clicking the window close ('X') button
 default a ViewEvent ViewEvent.ViewEventType.CLOSE is sent and
 the view is closed.
 
 Sometimes this default behavior is not desired, for example with dialogs
 that have a cancel button, you want the cancel event.
 


setLayout

public void setLayout(LayoutManager layoutManager)
See Also:
Container.setLayout(LayoutManager)

setBorder

public void setBorder(Border border)
See Also:
JComponent.setBorder(Border)

setBackground

public void setBackground(Color color)
See Also:
JComponent.setBackground(Color)

setForeground

public void setForeground(Color color)
See Also:
JComponent.setForeground(Color)

setPainter

public void setPainter(Painter painter)
Since:
1.6

setOpacity

public void setOpacity(float opacity)
Since:
1.5

isOpaque

public boolean isOpaque()
Since:
1.5
See Also:
JComponent.isOpaque()

setOpaque

public void setOpaque(boolean opaque)
Since:
1.5
See Also:
JComponent.setOpaque(boolean)

setTitle

public final void setTitle(String title)
See Also:
Frame.setTitle(String)

getTitle

public final String getTitle()
See Also:
Frame.getTitle()

getSize

public Dimension getSize()
See Also:
Component.getSize()

setSize

public void setSize(int width,
                    int height)
See Also:
Component.setSize(int, int)

setSize

public void setSize(Dimension size)
See Also:
Component.setSize(Dimension)

isResizable

public boolean isResizable()
See Also:
Frame.isResizable()

setResizable

public void setResizable(boolean resizable)
See Also:
Frame.setResizable(boolean)

isModal

public final boolean isModal()
See Also:
Dialog.isModal()

center

public void center()
Center View on parent.


center

public void center(View.ViewPosition position)
Center View with given position.


focus

public void focus()
See Also:
JComponent.requestFocus()

restore

public void restore()
See Also:
Frame.NORMAL

isMinimizable

public boolean isMinimizable()
See Also:
JInternalFrame.isIconifiable()

setMinimizable

public void setMinimizable(boolean minimizable)
See Also:
JInternalFrame.setIconifiable(boolean)

minimize

public void minimize()
See Also:
Frame.ICONIFIED

isMaximizable

public boolean isMaximizable()
See Also:
JInternalFrame.isMaximizable()

setMaximizable

public void setMaximizable(boolean maximizable)
See Also:
JInternalFrame.setMaximizable(boolean)

maximize

public void maximize()
See Also:
Frame.MAXIMIZED_BOTH

capture

public BufferedImage capture()
Returns an Image (screenshot) of this View.

Since:
1.6

print

public void print()
Print the contents of this view.

Since:
1.6

setMenuBar

public void setMenuBar(MenuBar menuBar)
Sets a MenuBar for this view.


setToolBar

public void setToolBar(ToolBar toolBar)
Sets a ToolBar for this view.


setToolBar

public void setToolBar(ToolBar toolBar,
                       View.ToolBarPosition position)
Sets a ToolBar for this view.

Since:
1.2

setViewPosition

public void setViewPosition(View.ViewPosition position)
Since:
1.3

setStatusBar

public void setStatusBar(StatusBar statusBar)
Sets a StatusBar for this view.


getDefaultButton

public JButton getDefaultButton()
Since:
1.2
See Also:
JRootPane.getDefaultButton()

setDefaultButton

public void setDefaultButton(JButton defaultButton)
Since:
1.2
See Also:
JRootPane.setDefaultButton(JButton)

setIcon

public void setIcon(Icon icon)
See Also:
JFrame.setIconImage(Image)

getPosition

public Point getPosition()
See Also:
Component.getLocation()

setPosition

public void setPosition(int x,
                        int y)
See Also:
Component.setLocation(int, int)

setPosition

public void setPosition(Point position)
See Also:
Component.setLocation(Point)

isEnabled

public boolean isEnabled()
See Also:
Component.isEnabled()

setEnabled

public void setEnabled(boolean enabled)
See Also:
JComponent.setEnabled(boolean)

translate

public String translate(String key)
See Also:
JazzUtil.translate(String)

getProgressMonitor

public final ProgressMonitor getProgressMonitor()
Since:
1.2
See Also:
ProgressMonitor

setProgressMonitor

public void setProgressMonitor(ProgressMonitor progressMonitor)
Since:
1.2
See Also:
ProgressMonitor

getCursor

public Cursor getCursor()
Since:
1.3
See Also:
Component.getCursor()

setCursor

public void setCursor(Cursor cursor)
Since:
1.3
See Also:
Component.setCursor(java.awt.Cursor)

getResource

public Object getResource(String name)
Since:
1.1
See Also:
JazzUtil.getResource(String)

getResourceAsIcon

public Icon getResourceAsIcon(String name)
Since:
1.1
See Also:
JazzUtil.getResourceAsIcon(String)

getResourceAsImage

public Image getResourceAsImage(String name)
Since:
1.1
See Also:
JazzUtil.getResourceAsImage(String)

postEvent

public final void postEvent(Event event)

propagateEvent

public final void propagateEvent(Event event)

onOpen

protected void onOpen()
Invoked when view is opened.


onShow

protected void onShow()
Invoked when view has been made visible.


onClose

protected void onClose()
Invoked when view is closed.


onActivate

protected void onActivate()
Invoked when view is activated.


onDeactivate

protected void onDeactivate()
Invoked when view is de-activated.


onMinimize

protected void onMinimize()
Invoked when view is iconified.


onMaximize

protected void onMaximize()
Invoked when view is de-iconified.


init

protected abstract void init()
Invoked after Controller.showView().


reset

protected abstract void reset()
Invoked after onOpen() and before onShow().


dispose

protected void dispose()
Invoked when view is closed.


getModel

protected final Model getModel()

handleEvent

public final void handleEvent(ModelEvent evt)

registerKeyboardAction

public void registerKeyboardAction(Action action)
Provides keyboard bindings for Actions.

Performs the Action Event when the accelerator key is pressed.

Since:
1.3
See Also:
Action

setTimer

public void setTimer(Timer timer)
Since:
1.5
See Also:
Timer


Copyright 2010 CodeRight, All rights reserved.