KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > junit > mock > c14 > ListEditResults


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

15 package org.apache.tapestry.junit.mock.c14;
16
17 import java.util.ArrayList JavaDoc;
18 import java.util.Collections JavaDoc;
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21 import java.util.ResourceBundle JavaDoc;
22
23 import org.apache.tapestry.html.BasePage;
24
25 /**
26  * Shows user's selected colors in a new page. A bit of duplication with ListEdit, but such is
27  * testing.
28  *
29  * @author Howard Lewis Ship
30  * @since 3.0
31  */

32 public abstract class ListEditResults extends BasePage
33 {
34     public abstract Map JavaDoc getColorMap();
35
36     public abstract void setColorMap(Map JavaDoc colorMap);
37
38     public abstract String JavaDoc getColorKey();
39
40     private ResourceBundle JavaDoc _colorStrings;
41
42     public List JavaDoc getSortedColorKeys()
43     {
44         Map JavaDoc map = getColorMap();
45         List JavaDoc result = new ArrayList JavaDoc(map.keySet());
46
47         Collections.sort(result);
48
49         return result;
50     }
51
52     public String JavaDoc getColorName()
53     {
54         String JavaDoc key = getColorKey();
55         String JavaDoc color = (String JavaDoc) getColorMap().get(key);
56
57         return _colorStrings.getString(color);
58     }
59
60     protected void finishLoad()
61     {
62         _colorStrings = ResourceBundle.getBundle(Color.class.getName() + "Strings", getLocale());
63     }
64
65 }
66
Popular Tags