com.ccg.swing
Class LogEditor

java.lang.Object
  extended by com.ccg.swing.LogEditor

public class LogEditor
extends Object

Provides a graphical user interface component to a LogModel.

This class provides a graphical interface which the user can interact with to view/control the log and/or debug verbosity levels of a LogModel object.

Typically use of this object involves:

To see a working example of using the LogModel, DefaultLogModel, SystemLogModel and LogEditor objects in combination, take a look at LogTest.java.

Since:
1.0
Version:
$Revision: 1.4 $
Author:
$Author: pkb $
See Also:
LogTest.java, LogModel, DefaultLogModel, SystemLogModel.getInstance()

Constructor Summary
LogEditor(LogModel lm)
          Construct the object and associate a LogModel object.
 
Method Summary
 void addChangeListener(ChangeListener cl)
          Add a new listener which is notified if the state of the object is changed by the user.
 void apply()
          Applies the current values of the graphical object to the associated LogModel.
 JComponent getComponent()
          Get the graphical component used to view and control the state of the associated LogModel.
 LogModel getLogModel()
          Access the LogModel associated with the editor.
 boolean isAutoApplyEnabled()
          Are changes to the interface automatically applied as soon as the user chooses them set?
 void removeChangeListener(ChangeListener cl)
          Remove a change listener (stop it from being notified of change events).
 void reset()
          Resets the current values of the graphical object to match the associated LogModel.
 void setAutoApplyEnabled(boolean val)
          Specify whether changes to the interface automatically applied as soon as the user chooses them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogEditor

public LogEditor(LogModel lm)
Construct the object and associate a LogModel object.

Parameters:
lm - The LogModel to be associated with the graphical component. Must NOT be null.
Since:
1.0
See Also:
setAutoApplyEnabled(boolean), getComponent()
Method Detail

getLogModel

public LogModel getLogModel()
Access the LogModel associated with the editor.

Returns:
Returns a reference to the LogModel which this editor allows the user to adjust.
Since:
1.0

getComponent

public JComponent getComponent()
Get the graphical component used to view and control the state of the associated LogModel.

This method returns the graphical component which the user will use to view the state of the log/debug levels and to adjust these states.

The first invocation constructs and returns the graphical component, all subsequent invocations will return the same reference as the first invocation (only one graphical component is ever created by a instance of this object).

Returns:
The graphical representation which the user interacts with to view and control the state of the associated LogModel.
Since:
1.0

reset

public void reset()
Resets the current values of the graphical object to match the associated LogModel.

Since:
1.0

apply

public void apply()
Applies the current values of the graphical object to the associated LogModel.

Since:
1.0

setAutoApplyEnabled

public void setAutoApplyEnabled(boolean val)
Specify whether changes to the interface automatically applied as soon as the user chooses them.

Parameters:
val - true if you want user choices applied as soon as they are made, false if not.
See Also:
isAutoApplyEnabled()

isAutoApplyEnabled

public boolean isAutoApplyEnabled()
Are changes to the interface automatically applied as soon as the user chooses them set?

Returns:
Current boolean value assigned.
See Also:
setAutoApplyEnabled(boolean)

addChangeListener

public void addChangeListener(ChangeListener cl)
Add a new listener which is notified if the state of the object is changed by the user.

Once registered, your change listener will be notified if the user changes EITHER the debug or log level. The source associated with the ChangeEvent will be the LogEditor object associated.

Parameters:
cl - The ChangeListener to register - should not be null.
Since:
1.0
See Also:
removeChangeListener(javax.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(ChangeListener cl)
Remove a change listener (stop it from being notified of change events).

Parameters:
cl - The ChangeListener to de-register - should not be null.
Since:
1.0
See Also:
addChangeListener(javax.swing.event.ChangeListener)


Copyright 1998-1998-2006 null. All Rights Reserved.