org.opensubsystems.patterns.thickclient.application.swt
Class ToggleButtonSelectionAdapter

java.lang.Object
  extended by org.eclipse.swt.events.SelectionAdapter
      extended by org.opensubsystems.patterns.thickclient.application.swt.ToggleButtonSelectionAdapter
All Implemented Interfaces:
java.util.EventListener, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.internal.SWTEventListener

public class ToggleButtonSelectionAdapter
extends org.eclipse.swt.events.SelectionAdapter

This adapter make sure that the toggle button is displayed when user wants to edit the table cell content.

Version:
$Id: ToggleButtonSelectionAdapter.java,v 1.3 2007/01/07 06:14:15 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.1 2006/02/17 03:37:04 bastafidli

Field Summary
protected  org.eclipse.swt.custom.TableEditor m_editor
          Editor used to edit the table.
protected  int m_iColumn
          Which column is edited by this editor.
protected  java.util.Set m_setListeners
          Set where all listeners listening to the event notifications specific to this object are stored.
protected  java.lang.String m_strButtonText
          Text on the toggle button.
protected  org.eclipse.swt.widgets.Table m_table
          Table this adapter is attached to.
protected  org.eclipse.swt.widgets.Button m_toggleButton
          Button used to toggle the content.
 
Constructor Summary
ToggleButtonSelectionAdapter(org.eclipse.swt.widgets.Table editableTable, int iColumn)
          Construct new adapter.
ToggleButtonSelectionAdapter(org.eclipse.swt.widgets.Table editableTable, int iColumn, java.lang.String strToggleButtonText)
          Construct new adapter.
 
Method Summary
 void addToggleListener(ToggleButtonListener listener)
          Add listener for this object.
 void hideEditor()
          Hide editor if it is displayed in current table.
 boolean isVisible()
          Check if the editor is visble
protected  void notifyToggleListeners(org.eclipse.swt.widgets.TableItem item, int iColumn, java.lang.Object objData, java.lang.String strValue)
          Notify all listeners about event.
 void removeToggleListener(ToggleButtonListener listener)
          Remove listener from this object.
 void widgetSelected(org.eclipse.swt.events.SelectionEvent event)
          
 
Methods inherited from class org.eclipse.swt.events.SelectionAdapter
widgetDefaultSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_setListeners

protected java.util.Set m_setListeners
Set where all listeners listening to the event notifications specific to this object are stored.


m_table

protected org.eclipse.swt.widgets.Table m_table
Table this adapter is attached to.


m_editor

protected org.eclipse.swt.custom.TableEditor m_editor
Editor used to edit the table.


m_iColumn

protected int m_iColumn
Which column is edited by this editor.


m_toggleButton

protected org.eclipse.swt.widgets.Button m_toggleButton
Button used to toggle the content.


m_strButtonText

protected java.lang.String m_strButtonText
Text on the toggle button.

Constructor Detail

ToggleButtonSelectionAdapter

public ToggleButtonSelectionAdapter(org.eclipse.swt.widgets.Table editableTable,
                                    int iColumn)
Construct new adapter.

Parameters:
editableTable - - table this adapter is attached to.
iColumn - - 0 based index of column toggled by this editor.

ToggleButtonSelectionAdapter

public ToggleButtonSelectionAdapter(org.eclipse.swt.widgets.Table editableTable,
                                    int iColumn,
                                    java.lang.String strToggleButtonText)
Construct new adapter.

Parameters:
editableTable - - table this adapter is attached to.
iColumn - - 0 based index of column toggled by this editor.
strToggleButtonText - - text to display on the toggle button, if null is passed in, no button will be displayed and the toggle will occur just by clicking on the row
Method Detail

widgetSelected

public void widgetSelected(org.eclipse.swt.events.SelectionEvent event)

Specified by:
widgetSelected in interface org.eclipse.swt.events.SelectionListener
Overrides:
widgetSelected in class org.eclipse.swt.events.SelectionAdapter

addToggleListener

public void addToggleListener(ToggleButtonListener listener)
Add listener for this object.

Parameters:
listener - - listener to add

removeToggleListener

public void removeToggleListener(ToggleButtonListener listener)
Remove listener from this object.

Parameters:
listener - - listener to remove

hideEditor

public void hideEditor()
Hide editor if it is displayed in current table.


isVisible

public boolean isVisible()
Check if the editor is visble

Returns:
true if editor is visible

notifyToggleListeners

protected void notifyToggleListeners(org.eclipse.swt.widgets.TableItem item,
                                     int iColumn,
                                     java.lang.Object objData,
                                     java.lang.String strValue)
Notify all listeners about event.

Parameters:
item - - table item which was toggled
iColumn - - column which was toggled
objData - - data represented by the control
strValue - - what was the value and the moment of modification


Copyright © 2003 - 2006 OpenSubsystems s.r.o.