com.mindtree.techworks.insight
Class Controller

java.lang.Object
  extended by com.mindtree.techworks.insight.Controller
All Implemented Interfaces:
IMutatorListener

public class Controller
extends java.lang.Object
implements IMutatorListener

The Controller class is the Mediator between the various Presentation instances in the GUI. It also acts as the bridge between the GUI components and the control and model components such as the Appender implementation(s). All Presentation instances must register with this Controller using

#regsiterPresentation(Presentation presentation)

Version:
1.0, 04/10/25
Author:
Regunath B
See Also:
Presentation

Constructor Summary
Controller(Insight insight)
          Constructor for this class
 
Method Summary
 void actionPerformed(int actionType)
          Informs this Controller that an action of the specified type has been performed.
 void clearCurrentModel()
          Clears the current event model.
 void endMutating(int infoFlag)
          Call back method using which the controller will be notifed by any LogEventModelMutators ends mutating the LogEventModel
 void firePageChanged()
          Informs this Controller that the current page has changed.
 void firePageChanged(long selectedEventIndex)
          Informs this Controller that the current page has changed.
 void fireWidgetChanged(Presentation sourcePresentation, int widgetId, java.lang.Object data)
          Called by registered Presentation instances when widgets in them undergo a change
 LogEventModel getCurrentLogEventModel()
           
 Insight getInsight()
           
 int getMutatorType()
          Returns the type of the active mutator, if any
 Presentation getPresentation(java.lang.String className)
          Gets the Presentation identified by the specified cllass name
 LogEventModel getRootLogEventModel()
           
 boolean isScrollLock()
          Returns the status of the scroll lock
 void notifyLogEventOccurred(LogEvent event)
          Notifies this Controller that an event was processed by the Appender.
 void registerAction(IAction action)
          Regsiters the specified IAction with this Controller
 void registerPresentation(Presentation presentation)
          Regsiters the specified Presentation with this Controller
 void registerWidgetChangeListener(Presentation sourcePresentation, Presentation listener)
          Registers the specified listener Presentation for call back when widgets on the source Presentation change.
 void resetPresentations()
          Notifies this Controller to reset the displays of all registered Presentation implementations.
 void setCurrentLogEventModel(LogEventModel logEventModel)
          Sets the specified LogEventModel as the current model
 void setCurrentLogEventModel(LogEventModel logEventModel, long pageNumber, long selectedEventIndex)
          Sets the specified LogEventModel as the current model
 void setRootLogEventModel(LogEventModel rootLogEventModel)
           
 void setScrollLock(boolean lock)
          Sets the status of the scroll lock.
 void setSelectedEvent(long pageNumber, long selectedEventIndex)
          Sets the selection to the indicated log event
 void setStatus()
          Sets the status display for Insight
 void startMutating(int mutatorType)
          Call back method using which the controller will be notifed by any LogEventModelMutators starts mutating the LogEventModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller(Insight insight)
Constructor for this class

Parameters:
insight - the Insight instance that created this Controller
Method Detail

registerPresentation

public void registerPresentation(Presentation presentation)
Regsiters the specified Presentation with this Controller

Parameters:
presentation - the Presentation instance to be registered with this Controller

registerAction

public void registerAction(IAction action)
Regsiters the specified IAction with this Controller

Parameters:
action - the IAction instance to be registered with this Controller

getPresentation

public Presentation getPresentation(java.lang.String className)
Gets the Presentation identified by the specified cllass name

Parameters:
className - the Class name of the Presentation required
Returns:
the registered Presentation identified by the specified class name
Throws:
java.lang.RuntimeException - in case the Presentation is not found or has not been registered yet

registerWidgetChangeListener

public void registerWidgetChangeListener(Presentation sourcePresentation,
                                         Presentation listener)
Registers the specified listener Presentation for call back when widgets on the source Presentation change.

Parameters:
sourcePresentation - the source Presentation where the widget change would occur
listener - the listener Presentation that is interested in widget changes on the source

fireWidgetChanged

public void fireWidgetChanged(Presentation sourcePresentation,
                              int widgetId,
                              java.lang.Object data)
Called by registered Presentation instances when widgets in them undergo a change

Parameters:
sourcePresentation - the Presentation where the change occurred
widgetId - unique id that identifies the widget in the Presentation
data - optional data returned by the Presentation in the context of the widget change

notifyLogEventOccurred

public void notifyLogEventOccurred(LogEvent event)
Notifies this Controller that an event was processed by the Appender. This Controller passes this event to registered Presentation instances that can handle run-time updates of event data.

Parameters:
event - data describing the event that was processed by the Appender

resetPresentations

public void resetPresentations()
Notifies this Controller to reset the displays of all registered Presentation implementations.


getInsight

public Insight getInsight()
Returns:
Returns the insight.

getCurrentLogEventModel

public LogEventModel getCurrentLogEventModel()
Returns:
Returns the currentLogEventModel.

setCurrentLogEventModel

public void setCurrentLogEventModel(LogEventModel logEventModel,
                                    long pageNumber,
                                    long selectedEventIndex)
Sets the specified LogEventModel as the current model

Parameters:
logEventModel - The currentLogEventModel to set.
pageNumber - the page number to be loaded as the current page
selectedEventIndex - the index of the selected LogEvent

setSelectedEvent

public void setSelectedEvent(long pageNumber,
                             long selectedEventIndex)
Sets the selection to the indicated log event

Parameters:
pageNumber - the page number to be loaded as the current page
selectedEventIndex - the index of the selected LogEvent

setCurrentLogEventModel

public void setCurrentLogEventModel(LogEventModel logEventModel)
Sets the specified LogEventModel as the current model

Parameters:
logEventModel - The currentLogEventModel to set.

clearCurrentModel

public void clearCurrentModel()
Clears the current event model. Replaces the current model with its predecessor model. Also resets the presentations.


getRootLogEventModel

public LogEventModel getRootLogEventModel()
Returns:
Returns the rootLogEventModel.

setRootLogEventModel

public void setRootLogEventModel(LogEventModel rootLogEventModel)
Parameters:
rootLogEventModel - The rootLogEventModel to set.

firePageChanged

public void firePageChanged()
Informs this Controller that the current page has changed. All presentations are notified to reflect the page change


firePageChanged

public void firePageChanged(long selectedEventIndex)
Informs this Controller that the current page has changed. All presentations sre notified to reflect the page change and LogEvent at the specified selectedEventIndex is highlighted

Parameters:
selectedEventIndex - the index of the selected LogEvent

setStatus

public void setStatus()
Sets the status display for Insight


startMutating

public void startMutating(int mutatorType)
Call back method using which the controller will be notifed by any LogEventModelMutators starts mutating the LogEventModel

Specified by:
startMutating in interface IMutatorListener
Parameters:
mutatorType - specifies if the mutator this listener is registered with is tailing
See Also:
IMutatorListener#startMutating()

endMutating

public void endMutating(int infoFlag)
Call back method using which the controller will be notifed by any LogEventModelMutators ends mutating the LogEventModel

Specified by:
endMutating in interface IMutatorListener
Parameters:
infoFlag - flag identifier that denotes the status of the mutate operation
See Also:
IMutatorListener.endMutating(int)

actionPerformed

public void actionPerformed(int actionType)
Informs this Controller that an action of the specified type has been performed. This Controller controls enabling and disabling of affected action widgets based on the specified action type

Parameters:
actionType - the valid action type as defined in IAction
See Also:
IAction

getMutatorType

public int getMutatorType()
Returns the type of the active mutator, if any

Returns:
Returns the mutatorType.

setScrollLock

public void setScrollLock(boolean lock)
Sets the status of the scroll lock.

Parameters:
lock - boolean true for scroll lock, false otherwise

isScrollLock

public boolean isScrollLock()
Returns the status of the scroll lock

Returns:
Returns the scrollLock.


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.