ilog.cpl.table
Class IlpTableController

java.lang.Object
  extended by ilog.cpl.graphic.IlpAbstractGraphicController
      extended by ilog.cpl.table.IlpTableController
All Implemented Interfaces:
IlpGraphicController, IlpInteractorManager, IlpMutableInteractorManager, FocusListener, KeyListener, MouseListener, MouseMotionListener, EventListener, MouseInputListener

public class IlpTableController
extends IlpAbstractGraphicController

A Table Controller gives behavior to an IlpTableView (and only one).

It must be connected to the table view using its method IlpTableView.setController(ilog.cpl.graphic.IlpGraphicController) or set in an IlpTable.

It uses by default an IlpListModelSorter chained to an IlpListModelFilter which are automatically interposed between an IlpDefaultListModel and the table model when the controller is used with an IlpTable.

Since:
JTGO 3.0

Field Summary
 
Fields inherited from class ilog.cpl.graphic.IlpAbstractGraphicController
lastInteractedObject, lastInteractionStates
 
Constructor Summary
IlpTableController()
          Constructs a default controller for a table, instantiating a model filter and a model sorter.
IlpTableController(IlpContext context)
          Constructs a default controller for a table, instantiating a model filter and a model sorter.
 
Method Summary
 void addSortingCriteria(IlpAttribute attribute, int order, boolean ascendingOrder, boolean useDisplayValue)
          Adds sorting criteria for an attribute.
protected  IlpViewInteractionContext createViewInteractionContext(IlpGraphicView view)
          Returns a new view interaction context for the given view.
 IlpFilter getFilter()
          Returns the filter used to filter the underlying model.
 IlpDefaultTableHeaderInteractor getHeaderInteractor()
          Returns the header interactor used to manage events that occur in the table header.
 IlpAbstractTableInteractorRenderer getInteractorRenderer()
          Accesses the interactor renderer.
 IlpListModelFilter getModelFilter()
          Returns the object used to filter the representation objects in the table the controller controls.
 IlpListModelSorter getModelSorter()
          Returns the object used to sort the representation objects in the table the controller controls.
 int getSortedAttributesCount()
          Returns the number of attributes used to sort the table view.
 int getSortingOrder(IlpAttribute attribute)
          Gets the position of the specified attribute in the sorting operation.
protected  ilog.cpl.table.internal.IlpTableViewSupport getTableViewSupport()
          Access to the table view support, used internally.
 IlpAbstractTableViewRenderer getViewRenderer()
          Accesses the view renderer.
 boolean isUsingAscendingOrder(IlpAttribute attribute)
          Returns true if the given attribute is sorted and the sort is in ascending order.
 boolean isUsingDisplayValue(IlpAttribute attribute)
          Returns true if the given attribute is sorted and the sort uses display values.
 void refilter()
          Reapplies the filter to the current objects.
 void removeAllSortingCriteria()
          Clears the current sorting.
 void removeSortingCriteria(IlpAttribute attribute)
          Removes an attribute from the sorted attributes in the table.
 void setFilter(IlpFilter filter)
          Sets the filter to use to filter the underlying model.
 void setHeaderInteractor(IlpDefaultTableHeaderInteractor headerInteractor)
          Sets the header interactor that will be used to manage events that occur in the table header.
 void setViewInteractor(IlpViewInteractor interactor)
          Sets the interactor associated with the view.
 
Methods inherited from class ilog.cpl.graphic.IlpAbstractGraphicController
attach, attachView, createGraphicViewStyleManager, detach, focusGained, focusLost, getCompleteObjectInteractor, getContext, getDefaultInteractorManager, getDefaultViewInteractor, getFocusEventComponent, getKeyEventComponent, getMouseEventComponent, getObjectInteractionState, getObjectInteractor, getObjectInteractor, getObjectInteractor, getObjectInteractor, getObjectInteractor, getView, getViewInteractionContext, getViewInteractor, initGraphicViewStyleManager, initInteractorManager, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, removeObjectInteractors, removeObjectInteractors, removeObjectInteractors, setDefaultInteractorManager, setDefaultViewInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpTableController

public IlpTableController()
Constructs a default controller for a table, instantiating a model filter and a model sorter. This controller is initialized using the default IlpContext set on IlpSystem.

See Also:
IlpSystem.GetDefaultContext()

IlpTableController

public IlpTableController(IlpContext context)
Constructs a default controller for a table, instantiating a model filter and a model sorter.

Parameters:
context - The context to use to initialize this controller; cannot be null.
See Also:
IlpSystem.GetDefaultContext()
Method Detail

setViewInteractor

public void setViewInteractor(IlpViewInteractor interactor)
Sets the interactor associated with the view.

In the table component, the view interactor must be an instance of IlpDefaultTableViewInteractor or of any of its subclasses. This default view interactor implementation supports interactions that are specific to:


getHeaderInteractor

public IlpDefaultTableHeaderInteractor getHeaderInteractor()
Returns the header interactor used to manage events that occur in the table header.


setHeaderInteractor

public void setHeaderInteractor(IlpDefaultTableHeaderInteractor headerInteractor)
Sets the header interactor that will be used to manage events that occur in the table header.

Parameters:
headerInteractor - Interactor that handles events that occur in the table header.
See Also:
IlpDefaultTableHeaderInteractor

getModelFilter

public IlpListModelFilter getModelFilter()
Returns the object used to filter the representation objects in the table the controller controls.

Returns:
The object used to filter the representation objects.

getModelSorter

public IlpListModelSorter getModelSorter()
Returns the object used to sort the representation objects in the table the controller controls.

Returns:
The object used to sort the representation objects.

getViewRenderer

public IlpAbstractTableViewRenderer getViewRenderer()
Accesses the view renderer.

Since:
JTGO 4.0

getInteractorRenderer

public IlpAbstractTableInteractorRenderer getInteractorRenderer()
Accesses the interactor renderer.

Since:
JTGO 4.0

setFilter

public void setFilter(IlpFilter filter)
Sets the filter to use to filter the underlying model.

Parameters:
filter - The filter. May be null. In this case, the underlying model is not filtered, that is, this model will provide all the data from the underlying model.
See Also:
getFilter()

getFilter

public IlpFilter getFilter()
Returns the filter used to filter the underlying model.

Returns:
The filter. May be null.
See Also:
setFilter(IlpFilter)

refilter

public void refilter()
Reapplies the filter to the current objects.

When filter properties have changed, this method enables you to reapply the current filter without having to set a new filter instance.

Since:
JTGO 4.0

getSortedAttributesCount

public int getSortedAttributesCount()
Returns the number of attributes used to sort the table view.

Returns:
The number of attributes used to sort the table view.

removeSortingCriteria

public void removeSortingCriteria(IlpAttribute attribute)
Removes an attribute from the sorted attributes in the table. The method has no effect if the given attribute is null or does not belong to the sorted attributes.

Parameters:
attribute - The attribute to remove.

removeAllSortingCriteria

public void removeAllSortingCriteria()
Clears the current sorting. The controller no longer sorts the columns.


getSortingOrder

public int getSortingOrder(IlpAttribute attribute)
Gets the position of the specified attribute in the sorting operation.

Parameters:
attribute - The attribute concerned.
Returns:
The sorting order of the attribute; 0 means that the attribute is not used to sort the list.

isUsingAscendingOrder

public boolean isUsingAscendingOrder(IlpAttribute attribute)
Returns true if the given attribute is sorted and the sort is in ascending order.

Parameters:
attribute - The attribute concerned.

isUsingDisplayValue

public boolean isUsingDisplayValue(IlpAttribute attribute)
Returns true if the given attribute is sorted and the sort uses display values.

Parameters:
attribute - The attribute concerned.

addSortingCriteria

public void addSortingCriteria(IlpAttribute attribute,
                               int order,
                               boolean ascendingOrder,
                               boolean useDisplayValue)
Adds sorting criteria for an attribute.

Parameters:
attribute - The attribute to sort.
order - The sorting order of the attribute. If order is less than or equal to 0, the attribute is put in the first position. If order is greater than the current number of attributes used for the sort, the column is put in the last position. If the attribute is already sorted, its index or sorting direction is changed.
ascendingOrder - Specifies whether the attribute will be sorted in ascending (true) or descending order.
useDisplayValue - Specifies whether the attribute will be sorted using display values or raw values.
Throws:
IllegalArgumentException - if the given attribute equals null.

createViewInteractionContext

protected IlpViewInteractionContext createViewInteractionContext(IlpGraphicView view)
Description copied from class: IlpAbstractGraphicController
Returns a new view interaction context for the given view. This method is called each time this controller is attached to a new view. It may be redefined in subclasses to provide a new type of view interactor.

Overrides:
createViewInteractionContext in class IlpAbstractGraphicController
Parameters:
view - The view for which to create a view interaction context.

getTableViewSupport

protected ilog.cpl.table.internal.IlpTableViewSupport getTableViewSupport()
Access to the table view support, used internally.

Internal method or field: do not use!


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.