EMMA Coverage Report (generated Sat Apr 14 15:01:05 EDT 2012)
[all classes][org.deduced.viewer.web.serializer]

COVERAGE SUMMARY FOR SOURCE FILE [ComboBoxModelSerializer.java]

nameclass, %method, %block, %line, %
ComboBoxModelSerializer.java100% (1/1)100% (4/4)88%  (44/50)87%  (13/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComboBoxModelSerializer100% (1/1)100% (4/4)88%  (44/50)87%  (13/15)
fillComboBoxModel (PropertyCollection, ComboBoxModel, MasterWebSerializer): void 100% (1/1)81%  (26/32)80%  (8/10)
ComboBoxModelSerializer (): void 100% (1/1)100% (3/3)100% (1/1)
createSerializedObject (PropertyCollection): Model 100% (1/1)100% (4/4)100% (1/1)
fillSerializedObject (Serializable, PropertyCollection, MasterWebSerializer):... 100% (1/1)100% (11/11)100% (3/3)

1/**
2 *    Copyright 2005-2011 Steve McDuff d-duff@users.sourceforge.net
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 */
16package org.deduced.viewer.web.serializer;
17 
18import java.io.Serializable;
19 
20import org.deduced.PropertyCollection;
21import org.deduced.viewer.model.combobox.implementation.ComboBoxImplementation;
22import org.deduced.viewer.model.implementation.FocusComponentImplementation;
23import org.deduced.viewer.web.shared.ComboBoxModel;
24import org.deduced.viewer.web.shared.Model;
25import org.deduced.viewer.web.shared.OrderedComboBoxItemModel;
26import org.deduced.viewer.web.shared.OrderedListModel;
27 
28/**
29 * ComboBoxModel Serializer
30 * 
31 * @author Steve McDuff
32 * 
33 */
34public class ComboBoxModelSerializer extends WidgetModelSerializer
35{
36        /**
37         * fill ComboBox Model
38         * 
39         * @param model the model to serialize
40         * @param comboBoxModel the model to fill
41         * @param masterSerializer the master serializer used to serialize child
42         *            objects
43         */
44        @SuppressWarnings("unchecked")
45        public static void fillComboBoxModel(
46                PropertyCollection<?, ?> model, ComboBoxModel comboBoxModel,
47                MasterWebSerializer masterSerializer)
48        {
49                PropertyCollection<?, ?> widgetList =
50                        ComboBoxImplementation.getOrderedComboBoxItemList(model);
51 
52                OrderedListModel<OrderedComboBoxItemModel> serializedList =
53                        (OrderedListModel<OrderedComboBoxItemModel>) masterSerializer
54                                .serialize(widgetList);
55 
56                comboBoxModel.setOrderedComboBoxItemList(serializedList);
57 
58                PropertyCollection selectedUserInterfaceElement =
59                        ComboBoxImplementation.getSelection(model);
60                if (selectedUserInterfaceElement != null)
61                {
62                        String selectedUserElementID = getID(selectedUserInterfaceElement);
63                        comboBoxModel.setSelection(selectedUserElementID);
64                }
65 
66                comboBoxModel.setVisibleRowCount(ComboBoxImplementation
67                        .getVisibleRowCount(model));
68 
69                comboBoxModel.setEnabled(FocusComponentImplementation.isEnabled(model)
70                        .booleanValue());
71        }
72 
73        /**
74         * (non-JSDoc)
75         * 
76         * @see org.deduced.viewer.web.serializer.WidgetModelSerializer#createSerializedObject(org.deduced.PropertyCollection)
77         */
78        @Override
79        public Model createSerializedObject(
80                PropertyCollection<?, ?> collection)
81        {
82                return new ComboBoxModel();
83        }
84 
85        /**
86         * (non-JSDoc)
87         * 
88         * @see org.deduced.viewer.web.serializer.UserInterfaceModelSerializer#fillSerializedObject(java.io.Serializable,
89         *      org.deduced.PropertyCollection,
90         *      org.deduced.viewer.web.serializer.MasterWebSerializer)
91         */
92        @Override
93        public void fillSerializedObject(
94                Serializable serializedObject, PropertyCollection<?, ?> collection,
95                MasterWebSerializer masterSerializer)
96        {
97                fillComboBoxModel(collection, (ComboBoxModel) serializedObject,
98                        masterSerializer);
99 
100                super.fillSerializedObject(serializedObject, collection,
101                        masterSerializer);
102        }
103}

[all classes][org.deduced.viewer.web.serializer]
EMMA 2.0.9525 (unsupported private build) (C) Vladimir Roubtsov