1 /*
2 * Copyright 2003 - 2013 The eFaps Team
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * Revision: $Rev$
17 * Last Changed: $Date$
18 * Last Changed By: $Author$
19 */
20
21 package org.efaps.admin.datamodel.ui;
22
23 import org.efaps.util.EFapsException;
24
25 /**
26 * Interface for all classes used to evaluate value for presentation in an user
27 * interface.
28 *
29 * @author The eFaps Team
30 * @version $Id$
31 */
32 public interface UIInterface
33 {
34 /**
35 * Used as a temporary tag inside html. It is used to set e.g. the id or add
36 * javascript during the rendering;
37 */
38 String EFAPSTMPTAG = " eFapsTempTag ";
39
40 /**
41 * Should be moved to the webapp.
42 * Method to get the Value for creation in an html document.
43 *
44 * @param _fieldValue Fieldvalue the representation is requested
45 * @return String representation of the object for creation
46 * @throws EFapsException on error
47 */
48 String getHiddenHtml(final FieldValue _fieldValue)
49 throws EFapsException;
50
51 /**
52 * Should be moved to the webapp.
53 * Method to get the Value for editing in an html document.
54 *
55 * @param _fieldValue Fieldvalue the representation is requested
56 * @return String representation of the object for editing
57 * @throws EFapsException on error
58 */
59 String getEditHtml(final FieldValue _fieldValue)
60 throws EFapsException;
61
62 /**
63 * Should be moved to the webapp.
64 * Method to get the Value for viewing in an html document.
65 *
66 * @param _fieldValue Fieldvalue the representation is requested
67 * @return String representation of the object for viewing
68 * @throws EFapsException on error
69 */
70 String getReadOnlyHtml(final FieldValue _fieldValue)
71 throws EFapsException;
72
73
74
75 /**
76 * Method to get a String representation of the value. This is used e.g. for
77 * labels and Phrases.
78 *
79 * @param _fieldValue Fieldvalue the representation is requested
80 * @return String representation of the object for viewing
81 * @throws EFapsException on error
82 */
83 String getStringValue(final FieldValue _fieldValue)
84 throws EFapsException;
85
86 /**
87 * Method to get the Object for use in case of comparison.
88 *
89 * @param _fieldValue Fieldvalue the representation is requested
90 * @return Object for comparison
91 * @throws EFapsException on error
92 */
93 Object getObject4Compare(final FieldValue _fieldValue)
94 throws EFapsException;
95
96 /**
97 * Method to compare the values.
98 *
99 * @param _fieldValue first Value
100 * @param _fieldValue2 second Value
101 * @return int
102 * @throws EFapsException on error
103 */
104 int compare(final FieldValue _fieldValue,
105 final FieldValue _fieldValue2)
106 throws EFapsException;
107
108 /**
109 * Method to format the given Object.
110 *
111 * @param _object the object to be formated
112 * @param _pattern pattern to be used by the formatter
113 * @return formated object
114 * @throws EFapsException on error
115 */
116 Object format(final Object _object,
117 final String _pattern)
118 throws EFapsException;
119 }