/
DataView.java
80 lines (67 loc) · 2.72 KB
/
DataView.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
* Copyright (c) 2016, 2020 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.data.client;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Element;
import org.eclipse.kapua.app.console.module.api.client.ui.view.AbstractView;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
import org.eclipse.kapua.app.console.module.data.client.messages.ConsoleDataMessages;
import org.eclipse.kapua.app.console.module.device.shared.model.permission.DeviceSessionPermission;
public class DataView extends AbstractView {
private TopicsTabItem channelTabItem;
private DeviceTabItem deviceTabItem;
private AssetTabItem assetTabItem;
private static final ConsoleDataMessages MSGS = GWT.create(ConsoleDataMessages.class);
DataView(GwtSession currentGwtSession) {
currentSession = currentGwtSession;
}
public static String getName() {
return MSGS.data();
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setBorders(false);
TabPanel tabsPanel = new TabPanel();
tabsPanel.setPlain(false);
tabsPanel.setBorders(false);
tabsPanel.setBodyBorder(true);
channelTabItem = new TopicsTabItem(currentSession);
tabsPanel.add(channelTabItem);
if(currentSession.hasPermission(DeviceSessionPermission.read())) {
deviceTabItem = new DeviceTabItem(currentSession);
tabsPanel.add(deviceTabItem);
assetTabItem = new AssetTabItem(currentSession);
tabsPanel.add(assetTabItem);
}
add(tabsPanel);
}
@Override
public void onUserChange() {
channelTabItem.refreshTables();
deviceTabItem.refreshTables();
assetTabItem.refreshTables();
}
// --------------------------------------------------------------------------------------
//
// Unload of the GXT Component
//
// --------------------------------------------------------------------------------------
@Override
public void onUnload() {
super.onUnload();
}
}