All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.page.EventAdapter Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

package at.spardat.xma.page;

import org.eclipse.swt.*;
import org.eclipse.swt.events.*;

/**
 * Adapter for SWT-Events
 * It forwards all supported Events to the PageClient.
 * It is used to prevent the event-Methods from appearing in the public interface
 * of PageClient.
 *
 * @author s2877
 */
public class EventAdapter implements SelectionListener, ModifyListener, VerifyListener, FocusListener, HelpListener, TreeListener {
    
    /** the page this adapter belongs to */
    PageClient page;
    
    /**
     * Constructor for EventAdapter.
     */
    public EventAdapter(PageClient page) {
        this.page=page;
    }

    /**
     * Eventhandler called by SWT every time, a List, Table or Tree 
     * on the PageClient gets selected.
     * 
     * @param event the SWT-Event that happended.
     */
    public void widgetSelected(SelectionEvent event) {
        page.widgetEvent(event,SWT.Selection);
    }

    /**
     * Eventhandler called by SWT every time, a List, Table or Tree
     * on the PageClient receives a double-click.
     * 
     * @param event the SWT-Event that happended.
     */
    public void widgetDefaultSelected(SelectionEvent event) {
        page.widgetEvent(event,SWT.DefaultSelection);
    }

    /**
     * Eventhandler called by SWT every time, the contents of a Text on
     * the PageClient will be modified. This happens on every Keystroke delivered to such a Control.
     * The Event is delivered bevor the change takes place. The Eventhandler may prevent
     * the change from actually taking place.
     * 
     * @param event the SWT-Event that happended.
     */
    public void verifyText(VerifyEvent event) {
        page.widgetEvent(event,SWT.Verify);
    }

    /**
     * Eventhandler called by SWT every time, the contents of a Text or Combo on 
     * the PageClient was modified. This happens on every Keystroke delivered to such a Control.
     * 
     * @param event the SWT-Event that happended.
     */
    public void modifyText(ModifyEvent event) {
        page.widgetEvent(event,SWT.Modify);
    }

    /**
     * Eventhandler called by SWT every time, a Control on the PageClient
     * gets the focus. Only the Message in the StatusBar is updated.
     * 
     * @param event the SWT-Event that happended.
     */
    public void focusGained(FocusEvent event) {
        page.focusEvent(event,SWT.FocusIn);
    }

    /**
     * Eventhandler called by SWT every time, a Control on the PageClient
     * has lost the focus.
     * 
     * @param event the SWT-Event that happended.
     */
    public void focusLost(FocusEvent event) {
        page.focusEvent(event,SWT.FocusOut);
    }

    /**
     * Eventhandler called by SWT every time, help is requested for a Control.
     * 
     * @param event the SWT-Event that happended.
     */
    public void helpRequested(HelpEvent event) {
        page.helpEvent(event,SWT.Help);
    }

    /**
     * Eventhandler called by SWT every time, a TreeNode on 
     * the PageClient was modified. Sent when a tree branch is collapsed. 
     * 
     * @param event the SWT-Event that happended.
     */
    public void treeCollapsed(TreeEvent event) {
        page.widgetEvent(event,SWT.Collapse);
        
    }

    /**
     * Eventhandler called by SWT every time, a TreeNode on 
     * the PageClient was modified. Sent when a tree branch is expanded. 
     * 
     * @param event the SWT-Event that happended.
     */
    public void treeExpanded(TreeEvent event) {
        page.widgetEvent(event,SWT.Expand);        
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy