KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > ICellModifier


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 /**
14  * A cell modifier is used to access the data model from a cell
15  * editor in an abstract way. It offers methods to:
16  * <ul>
17  * <li>to check if a a model element's property can be edited or not</li>
18  * <li>retrieve a value a model element's property</li>
19  * <li>to store a cell editor's value back into the model
20  * element's property</li>
21  * </ul>
22  * <p>
23  * This interface should be implemented by classes that wish to
24  * act as cell modifiers.
25  * </p>
26  */

27 public interface ICellModifier {
28     /**
29      * Checks whether the given property of the given element can be
30      * modified.
31      *
32      * @param element the element
33      * @param property the property
34      * @return <code>true</code> if the property can be modified,
35      * and <code>false</code> if it is not modifiable
36      */

37     public boolean canModify(Object JavaDoc element, String JavaDoc property);
38
39     /**
40      * Returns the value for the given property of the given element.
41      * Returns <code>null</code> if the element does not have the given property.
42      *
43      * @param element the element
44      * @param property the property
45      * @return the property value
46      */

47     public Object JavaDoc getValue(Object JavaDoc element, String JavaDoc property);
48
49     /**
50      * Modifies the value for the given property of the given element.
51      * Has no effect if the element does not have the given property,
52      * or if the property cannot be modified.
53      * <p>
54      * Note that it is possible for an SWT Item to be passed instead of
55      * the model element. To handle this case in a safe way, use:
56      * <pre>
57      * if (element instanceof Item) {
58      * element = ((Item) element).getData();
59      * }
60      * // modify the element's property here
61      * </pre>
62      * </p>
63      *
64      * @param element the model element or SWT Item (see above)
65      * @param property the property
66      * @param value the new property value
67      *
68      * @see org.eclipse.swt.widgets.Item
69      */

70     public void modify(Object JavaDoc element, String JavaDoc property, Object JavaDoc value);
71 }
72
Popular Tags