Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 7800 invoked from network); 5 Sep 2004 15:33:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Sep 2004 15:33:00 -0000 Received: (qmail 7993 invoked by uid 500); 5 Sep 2004 15:32:56 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 7972 invoked by uid 500); 5 Sep 2004 15:32:56 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 7959 invoked by uid 500); 5 Sep 2004 15:32:56 -0000 Received: (qmail 7956 invoked by uid 99); 5 Sep 2004 15:32:56 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 05 Sep 2004 08:32:56 -0700 Received: (qmail 7780 invoked by uid 1431); 5 Sep 2004 15:32:55 -0000 Date: 5 Sep 2004 15:32:55 -0000 Message-ID: <20040905153255.7779.qmail@minotaur.apache.org> From: dion@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt GCTag.java SwtTagLibrary.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N dion 2004/09/05 08:32:55 Modified: jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt SwtTagLibrary.java Added: jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt GCTag.java Log: Jelly-126 Revision Changes Path 1.12 +3 -2 jakarta-commons/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java Index: SwtTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- SwtTagLibrary.java 5 Sep 2004 15:25:18 -0000 1.11 +++ SwtTagLibrary.java 5 Sep 2004 15:32:54 -0000 1.12 @@ -142,10 +142,11 @@ registerTag("onEvent", OnEventTag.class); // other tags - registerTag("image", ImageTag.class); - registerTag("font", FontTag.class); registerTag("color", ColorTag.class); registerTag("colour", FontTag.class); + registerTag("font", FontTag.class); + registerTag("gc", GCTag.class); + registerTag("image", ImageTag.class); } 1.1 jakarta-commons/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/GCTag.java Index: GCTag.java =================================================================== /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jelly.tags.swt; import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; import org.eclipse.swt.graphics.Drawable; import org.eclipse.swt.graphics.GC; /** * Class to create a {@link GC} instance within Jelly SWT. * * @author Marcus Crafter * @version CVS $Id: GCTag.java,v 1.1 2004/09/05 15:32:54 dion Exp $ */ public class GCTag extends TagSupport { /** Drawable name */ private Drawable drawable; /** Variable name */ private String var; /** * Obtain the {@link Drawable} name for this {@link GC}. * * @return a {@link GC} {@link Drawable} */ public Drawable getDrawable() { return this.drawable; } /** * Set the {@link Drawable} name for this {@link GC}. * * @param drawable a {@link GC} {@link Drawable} */ public void setDrawable(final Drawable drawable) { this.drawable = drawable; } /** * Sets the variable name. * * @param var the variable name of this {@link GC} instance */ public void setVar(final String var) { this.var = var; } /** * Obtain the variable name. * * @return the variable name of this {@link GC} instance */ public String getVar() { return this.var; } // Tag interface //------------------------------------------------------------------------- /** * Creates a {@link GC} instance and stores it in the Context under a * particular variable name. Note, {@link GC} objects can only be created on * {@link Drawable} objects. * * @param output {@link XMLOutput} reference * @throws JellyTagException if an error occurs * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput) */ public void doTag(final XMLOutput output) throws JellyTagException { // invoke by body just in case some nested tag configures me invokeBody(output); final boolean nullDrawable = drawable == null; final boolean drawableParent = drawable instanceof Drawable; if (nullDrawable || !drawableParent) { throw new JellyTagException( "This tag must specify a Drawable attribute (ie. Image or Control)" ); } if (var == null) { throw new JellyTagException("This tag requires a context variable name"); } // store the GC in the context context.setVariable(var, new GC(drawable)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org