/* * Copyright (c) 2007,2009 Declarative Engineering LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Declarative Engineering LLC * verson 1 which accompanies this distribution, and is available at * http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */ package com.foundation.view.swt; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import com.common.debug.Debug; public class Group extends Container implements Component.IComponentListener { public static final int STYLE_SHADOW_ETCHED_IN = SWT.SHADOW_ETCHED_IN; public static final int STYLE_SHADOW_ETCHED_OUT = SWT.SHADOW_ETCHED_OUT; public static final int STYLE_SHADOW_IN = SWT.SHADOW_IN; public static final int STYLE_SHADOW_OUT = SWT.SHADOW_OUT; public static final int STYLE_SHADOW_NONE = SWT.SHADOW_NONE; /** * Group default constructor. *

Warning: This is only for use by the framework. This should never be called to create a useable instance.

*/ public Group() { }//Group()// /** * Group constructor. * @param parent A composite control which will be the parent of the new instance (cannot be null). * @param name The unique component name. * @param style The style of control to construct. * @see #STYLE_SHADOW_ETCHED_IN * @see #STYLE_SHADOW_ETCHED_OUT * @see #STYLE_SHADOW_IN * @see #STYLE_SHADOW_OUT * @see #STYLE_SHADOW_NONE */ public Group(Container parent, String name, int style) { super(parent, name, style); }//Group()// /* (non-Javadoc) * @see com.foundation.view.swt.AbstractComponent#initializeControl(int) */ protected void initializeControl(int style, Object data) { setSwtWidget(new org.eclipse.swt.widgets.Group(((Container) getContainer()).getSwtParent(), style)); getSwtWidget().setData(this); }//initializeControl()// /** * Gets the SWT group that represents this component. * @return The group control providing visualization for this componnet. */ public org.eclipse.swt.widgets.Group getSwtGroup() { return (org.eclipse.swt.widgets.Group) getSwtControl(); }//getSwtGroup()// /* (non-Javadoc) * @see com.foundation.view.swt.Container#internalViewInitialize() */ protected void internalViewInitialize() { try { //Register for image and title changes. Note: it is not necessary to initialize the title & image since they will be updated on the container's refresh and an event will fire if they are anything other than null.// registerListener(this); if(getContainerTitle() != null) { getSwtGroup().setText(getContainerTitle()); }//if// super.internalViewInitialize(); }//try// catch(Throwable e) { Debug.log(e); }//catch// }//internalViewInitialize()// /* (non-Javadoc) * @see com.foundation.view.swt.Container#internalViewRefresh() */ protected void internalViewRefresh() { super.internalViewRefresh(); if(getContainerTitle() != null) { getSwtGroup().setText(getContainerTitle()); }//if// }//internalViewRefresh()// /* (non-Javadoc) * @see com.foundation.view.swt.Container#internalViewRelease() */ protected void internalViewRelease() { //Unregister for image and title changes.// unregisterListener(this); //Release the super class components.// super.internalViewRelease(); }//internalViewRelease()// /* (non-Javadoc) * @see com.foundation.view.swt.Component.IComponentListener#toolTipTextChanged(com.foundation.view.swt.Component, java.lang.String) */ public void toolTipTextChanged(Component component, String newToolTipText) { //Does nothing. The tool tip is already set by the caller.// }//toolTipTextChanged()// /* (non-Javadoc) * @see com.foundation.view.swt.Component.IComponentListener#imageChanged(com.foundation.view.swt.Component, org.eclipse.swt.graphics.Image) */ public void imageChanged(Component component, Image newImage) { //Group currently doesn't support an image.// //getSwtGroup().setImage(newImage); }//imageChanged()// /* (non-Javadoc) * @see com.foundation.view.swt.Component.IComponentListener#titleChanged(com.foundation.view.swt.Component, java.lang.String) */ public void titleChanged(Component component, String newTitle) { getSwtGroup().setText(newTitle); }//titleChanged()// }//Group//