KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > markup > attr > EditorAttributes


1 /*
2  * $Id: EditorAttributes.java,v 1.1.1.1 2004/06/16 01:43:40 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc.markup.attr;
9
10 import java.net.URL JavaDoc;
11
12 import org.jdesktop.jdnc.JNEditor;
13 import org.jdesktop.jdnc.markup.RealizationUtils;
14 import net.openmarkup.ApplierException;
15 import net.openmarkup.AttributeApplier;
16 import net.openmarkup.Realizable;
17
18 /**
19  * Attribute appliers for the Editor element
20  *
21  * @author Mark Davidson
22  */

23 public class EditorAttributes {
24
25     public static final AttributeApplier sourceApplier = new AttributeApplier() {
26         public void apply(Realizable target, String JavaDoc namespaceURI,
27                           String JavaDoc attributeName, String JavaDoc attributeValue) throws
28             ApplierException {
29             // Validate the URL before we do anything else.
30
URL JavaDoc url = target.getResolvedURL(attributeValue);
31             // An invalid URL not not really serious
32
RealizationUtils.validateURL(url, false);
33
34             JNEditor editor = (JNEditor) target.getObject();
35             if (url != null) {
36                 editor.setInputURL(url);
37             }
38             else {
39                 editor.setInputURL(attributeValue);
40             }
41         }
42     };
43 }
Popular Tags