KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > common > widgets > BinaryEncodingInput


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.browser.common.widgets;
22
23
24 import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
25
26
27 /**
28  * The BinaryEncodingInput is an OptionInput with fixed options.
29  * It is used to select the encoding of binary attributes. The default
30  * value is always {@link BrowserCoreConstants#BINARYENCODING_IGNORE}.
31  * The other options are always {@link BrowserCoreConstants#BINARYENCODING_IGNORE},
32  * {@link BrowserCoreConstants#BINARYENCODING_BASE64} and
33  * {@link BrowserCoreConstants#BINARYENCODING_HEX}. No custom input is allowed.
34  *
35  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
36  * @version $Rev$, $Date$
37  */

38 public class BinaryEncodingInput extends OptionsInput
39 {
40
41     /**
42      * Creates a new instance of BinaryEncodingInput.
43      *
44      * @param initialRawValue the initial raw value
45      * @param asGroup the asGroup flag
46      */

47     public BinaryEncodingInput( String JavaDoc initialRawValue, boolean asGroup )
48     {
49         super( "Binary Encoding", getDefaultDisplayValue(), getDefaultRawValue(), getOtherDisplayValues(),
50             getOtherRawValues(), initialRawValue, asGroup, false );
51
52     }
53
54
55     /**
56      * Gets the default display value, always "Ignore".
57      *
58      * @return the default display value
59      */

60     private static String JavaDoc getDefaultDisplayValue()
61     {
62         return "Ignore";
63     }
64
65
66     /**
67      * Gets the default raw value, always
68      * {@link BrowserCoreConstants.BINARYENCODING_IGNORE}.
69      *
70      * @return the default raw value
71      */

72     private static String JavaDoc getDefaultRawValue()
73     {
74         return Integer.toString( BrowserCoreConstants.BINARYENCODING_IGNORE );
75     }
76
77
78     /**
79      * Gets the other display values.
80      *
81      * @return the other display values
82      */

83     private static String JavaDoc[] getOtherDisplayValues()
84     {
85         return new String JavaDoc[]
86             { "Ignore", "BASE-64", "HEX" };
87     }
88
89
90     /**
91      * Gets the other raw values.
92      *
93      * @return the other raw values
94      */

95     private static String JavaDoc[] getOtherRawValues()
96     {
97         return new String JavaDoc[]
98             { Integer.toString( BrowserCoreConstants.BINARYENCODING_IGNORE ),
99                 Integer.toString( BrowserCoreConstants.BINARYENCODING_BASE64 ),
100                 Integer.toString( BrowserCoreConstants.BINARYENCODING_HEX ) };
101     }
102
103 }
104
Popular Tags