aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/web/client/DevicePanel.java
blob: ba30fefb788409d3fddcbfe5fae3ecd2d2e29d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package org.traccar.web.client;

import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;

/**
 * Device list widget
 */
public class DevicePanel extends SectionStack {

    private ToolStrip toolbar;
    private ListGrid list;

    public DevicePanel() {
        SectionStackSection section = new SectionStackSection("Devices");  
        section.setCanCollapse(false);
        section.setExpanded(true);

        toolbar = new ToolStrip();
        toolbar.setWidth100();

        ToolStripButton button = new ToolStripButton();
        button.setTitle("Add");
        toolbar.addButton(button);
        button = new ToolStripButton();
        button.setTitle("Remove");
        toolbar.addButton(button);
        button = new ToolStripButton();
        button.setTitle("Edit");
        toolbar.addButton(button);
        toolbar.addFill();
        toolbar.addSeparator();
        button = new ToolStripButton();
        button.setTitle("Settings");
        toolbar.addButton(button);

        list = new ListGrid();
        list.setFields(
                new ListGridField("id", "Id"),
                new ListGridField("imei", "IMEI"));

        list.setCanSort(false);
        list.setShowHeaderContextMenu(false);
        list.setShowHeaderMenuButton(false);

        section.setItems(toolbar, list);
        setSections(section);
    }

}