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 | */ |
16 | package org.deduced.viewer.web.shared; |
17 | |
18 | import com.google.gwt.user.client.ui.CellPanel; |
19 | |
20 | /** |
21 | * Cell Panel Model |
22 | * |
23 | * @author Steve McDuff |
24 | * |
25 | */ |
26 | public abstract class CellPanelModel extends ComplexPanelModel |
27 | { |
28 | |
29 | /** |
30 | * serialVersionUID |
31 | */ |
32 | private static final long serialVersionUID = -6213574644458921802L; |
33 | |
34 | /** |
35 | * spacing between the cells in the panel |
36 | */ |
37 | private int spacing; |
38 | |
39 | /** |
40 | * (non-JSDoc) |
41 | * |
42 | * @see org.deduced.viewer.web.shared.UserInterfaceModel#internalSynchronizeWithUI() |
43 | */ |
44 | @Override |
45 | public void internalSynchronizeWithUI() |
46 | { |
47 | getCellPanel().setSpacing(getSpacing()); |
48 | super.internalSynchronizeWithUI(); |
49 | } |
50 | |
51 | /** |
52 | * get Cell Panel |
53 | * |
54 | * @return the cell panel |
55 | */ |
56 | public CellPanel getCellPanel() |
57 | { |
58 | return (CellPanel) getUIObject(); |
59 | } |
60 | |
61 | /** |
62 | * (non-JSDoc) |
63 | * |
64 | * @see org.deduced.viewer.web.shared.UserInterfaceModel#propertyChanged(org.deduced.viewer.web.shared.ChangeEvent) |
65 | */ |
66 | @Override |
67 | public void propertyChanged( |
68 | ChangeEvent event) |
69 | { |
70 | if (isEventNameEqual(event, "spacing")) |
71 | { |
72 | setSpacing(((Integer) event.getSerializableValue()).intValue()); |
73 | synchronizeWithUI(); |
74 | } |
75 | else |
76 | { |
77 | super.propertyChanged(event); |
78 | } |
79 | } |
80 | |
81 | /** |
82 | * @param setSpacing the spacing to set |
83 | */ |
84 | public void setSpacing( |
85 | int setSpacing) |
86 | { |
87 | spacing = setSpacing; |
88 | } |
89 | |
90 | /** |
91 | * @return the spacing |
92 | */ |
93 | public int getSpacing() |
94 | { |
95 | return spacing; |
96 | } |
97 | } |