KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > core > sync > Representation


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.core.sync;
20
21 import org.openide.nodes.*;
22
23 /**
24  * Same data may have multiple representations. A representation can
25  * be described using this interface.
26  *
27  * @author Petr Kuzel
28  * @version
29  */

30 public interface Representation {
31
32     /**
33      * @return select button diplay name used during notifying concurent modification
34      * conflict.
35      */

36     public String JavaDoc getDisplayName();
37
38     /**
39      * Is this representation modified since last update?
40      * Warning isModified() does not equals representationChanged().
41      */

42     public boolean isModified();
43
44     /**
45      * Determine whether given representation is valid. E.g. tree
46      * represnattion is valid just if parsed successfully.
47      */

48     public boolean isValid();
49     
50     /**
51      * Update the representation without marking it as modified.
52      */

53     public void update(Object JavaDoc change);
54
55     /**
56      * Return prefered update class or null if does not matter.
57      * //??? Could return <codE>Class[]</code> in future.
58      */

59     public Class JavaDoc getUpdateClass();
60
61     /**
62      * Return modification passed as update parameter to all slave representations.
63      * @param type if null return arbitrary representation
64      * @return Change or null if change of given type can not be returned
65      */

66     public Object JavaDoc getChange(Class JavaDoc type);
67
68     /**
69      * Does this representation wraps given model?
70      */

71     public boolean represents(Class JavaDoc type);
72
73     /**
74      * Returnrepresentation level: 0 = file, 1 = byte buffer [text],
75      * 2 = structural model, 3 = semantics model ... A higher level
76      * representaion requires that lower level representation is
77      * loaded too.
78      *
79      * @return
80      */

81     public int level();
82 }
83
Popular Tags