/
DevicesTagTabItem.java
61 lines (52 loc) · 2.21 KB
/
DevicesTagTabItem.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
/*******************************************************************************
* Copyright (c) 2018, 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.device.client.device.tag;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.IconSet;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.KapuaIcon;
import org.eclipse.kapua.app.console.module.api.client.ui.tab.KapuaTabItem;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
import org.eclipse.kapua.app.console.module.tag.client.messages.ConsoleTagMessages;
import org.eclipse.kapua.app.console.module.tag.shared.model.GwtTag;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Element;
public class DevicesTagTabItem extends KapuaTabItem<GwtTag> {
private static final ConsoleTagMessages MSGS = GWT.create(ConsoleTagMessages.class);
TagSubjectGrid tagPermissionGrid;
public DevicesTagTabItem(GwtSession currentSession) {
super(currentSession, MSGS.tagsTabSubjectGridTitle(), new KapuaIcon(IconSet.SUPPORT));
tagPermissionGrid = new TagSubjectGrid(null, currentSession);
tagPermissionGrid.setRefreshOnRender(false);
setEnabled(false);
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setBorders(false);
add(tagPermissionGrid);
}
@Override
public void setEntity(GwtTag gwtTag) {
super.setEntity(gwtTag);
if (gwtTag != null) {
setEnabled(true);
} else {
setEnabled(false);
}
tagPermissionGrid.setEntity(gwtTag);
}
@Override
protected void doRefresh() {
if (selectedEntity != null){
tagPermissionGrid.refresh();
}
}
}