/*
* Copyright (c) 2010, Michael Grossmann
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the jo-widgets.org nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.jowidgets.spi.impl.swt.common.widgets;
import org.eclipse.swt.widgets.Control;
import org.jowidgets.common.color.IColorConstant;
import org.jowidgets.common.types.Cursor;
import org.jowidgets.common.types.Dimension;
import org.jowidgets.common.types.Position;
import org.jowidgets.common.widgets.controller.IComponentListener;
import org.jowidgets.common.widgets.controller.IFocusListener;
import org.jowidgets.common.widgets.controller.IKeyListener;
import org.jowidgets.common.widgets.controller.IMouseListener;
import org.jowidgets.common.widgets.controller.IMouseMotionListener;
import org.jowidgets.common.widgets.controller.IPopupDetectionListener;
import org.jowidgets.spi.impl.swt.common.image.SwtImageRegistry;
import org.jowidgets.spi.widgets.IActionWidgetSpi;
import org.jowidgets.spi.widgets.IComponentSpi;
import org.jowidgets.spi.widgets.IPopupMenuSpi;
public abstract class AbstractActionComponent extends AbstractActionWidget implements IActionWidgetSpi, IComponentSpi {
private final SwtComponent swtComponentDelegate;
public AbstractActionComponent(final Control control, final SwtImageRegistry imageRegistry) {
super(control);
this.swtComponentDelegate = new SwtComponent(control, imageRegistry);
}
@Override
public void redraw() {
swtComponentDelegate.redraw();
}
@Override
public void setRedrawEnabled(final boolean enabled) {
swtComponentDelegate.setRedrawEnabled(enabled);
}
@Override
public void setForegroundColor(final IColorConstant colorValue) {
swtComponentDelegate.setForegroundColor(colorValue);
}
@Override
public void setBackgroundColor(final IColorConstant colorValue) {
swtComponentDelegate.setBackgroundColor(colorValue);
}
@Override
public IColorConstant getForegroundColor() {
return swtComponentDelegate.getForegroundColor();
}
@Override
public IColorConstant getBackgroundColor() {
return swtComponentDelegate.getBackgroundColor();
}
@Override
public void setCursor(final Cursor cursor) {
swtComponentDelegate.setCursor(cursor);
}
@Override
public void setVisible(final boolean visible) {
swtComponentDelegate.setVisible(visible);
}
@Override
public boolean isVisible() {
return swtComponentDelegate.isVisible();
}
@Override
public Dimension getSize() {
return swtComponentDelegate.getSize();
}
@Override
public void setSize(final Dimension size) {
swtComponentDelegate.setSize(size);
}
@Override
public Position getPosition() {
return swtComponentDelegate.getPosition();
}
@Override
public void setPosition(final Position position) {
swtComponentDelegate.setPosition(position);
}
@Override
public IPopupMenuSpi createPopupMenu() {
return swtComponentDelegate.createPopupMenu();
}
@Override
public boolean requestFocus() {
return swtComponentDelegate.requestFocus();
}
@Override
public void addFocusListener(final IFocusListener listener) {
swtComponentDelegate.addFocusListener(listener);
}
@Override
public void removeFocusListener(final IFocusListener listener) {
swtComponentDelegate.removeFocusListener(listener);
}
@Override
public void addKeyListener(final IKeyListener listener) {
swtComponentDelegate.addKeyListener(listener);
}
@Override
public void removeKeyListener(final IKeyListener listener) {
swtComponentDelegate.removeKeyListener(listener);
}
@Override
public void addMouseListener(final IMouseListener mouseListener) {
swtComponentDelegate.addMouseListener(mouseListener);
}
@Override
public void removeMouseListener(final IMouseListener mouseListener) {
swtComponentDelegate.removeMouseListener(mouseListener);
}
@Override
public void addMouseMotionListener(final IMouseMotionListener listener) {
swtComponentDelegate.addMouseMotionListener(listener);
}
@Override
public void removeMouseMotionListener(final IMouseMotionListener listener) {
swtComponentDelegate.addMouseMotionListener(listener);
}
@Override
public void addComponentListener(final IComponentListener componentListener) {
swtComponentDelegate.addComponentListener(componentListener);
}
@Override
public void removeComponentListener(final IComponentListener componentListener) {
swtComponentDelegate.removeComponentListener(componentListener);
}
@Override
public void addPopupDetectionListener(final IPopupDetectionListener listener) {
swtComponentDelegate.addPopupDetectionListener(listener);
}
@Override
public void removePopupDetectionListener(final IPopupDetectionListener listener) {
swtComponentDelegate.removePopupDetectionListener(listener);
}
}