PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/v3.2/nimbits-tds/src/com/nimbits/client/model/GxtPointModel.java

http://nimbits-server.googlecode.com/
Java | 82 lines | 50 code | 14 blank | 18 comment | 2 complexity | 3520a6c6411a4e4969529e450a2d1856 MD5 | raw file
 1/*
 2 * Copyright (c) 2010 Tonic Solutions LLC.
 3 *
 4 * http://www.nimbits.com
 5 *
 6 *
 7 * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 8 *
 9 * http://www.gnu.org/licenses/gpl.html
10 *
11 * Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
12 */
13
14package com.nimbits.client.model;
15
16import com.extjs.gxt.ui.client.data.BaseModelData;
17import com.nimbits.client.model.point.Point;
18import com.nimbits.client.model.point.PointName;
19import com.nimbits.client.model.value.AlertType;
20
21
22/**
23 * Created by bsautner
24 * User: benjamin
25 * Date: 7/8/11
26 * Time: 5:35 PM
27 */
28public class GxtPointModel extends BaseModelData {
29    private final long id;
30    private PointName name;
31    private final boolean readOnly;
32    private boolean isDirty;
33
34    public void setAlertState(AlertType alertState) {
35        this.alertState = alertState;
36    }
37
38    private AlertType alertState;
39
40    public GxtPointModel(Point point) {
41        this.id = point.getId();
42        String lastNote = point.getLastNote();
43        this.name = point.getName();
44        this.readOnly = point.getReadOnly();
45        this.alertState = point.getAlertState();
46        set(Const.PARAM_ID, this.id);
47        set(Const.PARAM_NAME, this.name.getValue());
48        set(Const.PARAM_ICON, Const.PARAM_POINT);
49        set(Const.PARAM_NOTE, lastNote);
50    }
51
52    public long getId() {
53        return id;
54    }
55
56    public PointName getName() {
57        return name;
58    }
59
60    public void setName(PointName name) {
61        this.name = name;
62    }
63
64    public boolean isReadOnly() {
65        return readOnly;
66    }
67
68    public boolean isDirty() {
69        return isDirty;
70    }
71
72    public void setDirty(final boolean dirty) {
73        isDirty = dirty;
74    }
75
76    public AlertType getAlertState() {
77        if (alertState == null) {
78            alertState = AlertType.OK;
79        }
80        return alertState;
81    }
82}