use of org.eclipse.kapua.app.console.shared.model.GwtDeviceQueryPredicates in project kapua by eclipse.
the class DeviceFilterPanel method onRender.
protected void onRender(final Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
ContentPanel formPanel = new ContentPanel();
formPanel.setScrollMode(Scroll.AUTOY);
formPanel.setBorders(false);
formPanel.setHeaderVisible(false);
formPanel.setLayout(new RowLayout(Orientation.VERTICAL));
formPanel.setBodyStyle("background-color:#F0F0F0");
//
// Top explanation
final Text infoLabel = new Text(MSGS.deviceFilteringPanelInfo());
infoLabel.setWidth(WIDTH + 5);
infoLabel.setStyleAttribute("margin", "5px");
formPanel.add(infoLabel);
//
// ClientId
final Label clientIdLabel = new Label(MSGS.deviceFilteringPanelClientId());
clientIdLabel.setWidth(WIDTH);
clientIdLabel.setStyleAttribute("margin", "5px");
formPanel.add(clientIdLabel);
final TextField<String> clientIdField = new TextField<String>();
clientIdField.setName("clientId");
clientIdField.setWidth(WIDTH);
clientIdField.setStyleAttribute("margin-top", "0px");
clientIdField.setStyleAttribute("margin-left", "5px");
clientIdField.setStyleAttribute("margin-right", "5px");
clientIdField.setStyleAttribute("margin-bottom", "10px");
formPanel.add(clientIdField);
//
// DisplayName
final Label displayNameLabel = new Label(MSGS.deviceFilteringPanelDisplayName());
displayNameLabel.setWidth(WIDTH);
displayNameLabel.setStyleAttribute("margin", "5px");
formPanel.add(displayNameLabel);
final TextField<String> displayNameField = new TextField<String>();
displayNameField.setName("displayName");
displayNameField.setWidth(WIDTH);
displayNameField.setStyleAttribute("margin-top", "0px");
displayNameField.setStyleAttribute("margin-left", "5px");
displayNameField.setStyleAttribute("margin-right", "5px");
displayNameField.setStyleAttribute("margin-bottom", "10px");
formPanel.add(displayNameField);
//
// Serial Number
final Label serialNumberLabel = new Label(MSGS.deviceFilteringPanelSerialNumber());
serialNumberLabel.setWidth(WIDTH);
serialNumberLabel.setStyleAttribute("margin", "5px");
formPanel.add(serialNumberLabel);
final TextField<String> serialNumberField = new TextField<String>();
serialNumberField.setName("serialNumber");
serialNumberField.setWidth(WIDTH);
serialNumberField.setStyleAttribute("margin-top", "0px");
serialNumberField.setStyleAttribute("margin-left", "5px");
serialNumberField.setStyleAttribute("margin-right", "5px");
serialNumberField.setStyleAttribute("margin-bottom", "10px");
formPanel.add(serialNumberField);
//
// Status
final Label statusLabel = new Label(MSGS.deviceFilteringPanelStatus());
statusLabel.setWidth(WIDTH);
statusLabel.setStyleAttribute("margin", "5px");
formPanel.add(statusLabel);
final SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceStatus> statusCombo = new SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceStatus>();
statusCombo.setName("status");
statusCombo.setWidth(WIDTH);
statusCombo.setStyleAttribute("margin-top", "0px");
statusCombo.setStyleAttribute("margin-left", "5px");
statusCombo.setStyleAttribute("margin-right", "5px");
statusCombo.setStyleAttribute("margin-bottom", "10px");
statusCombo.setEmptyText(MSGS.deviceFilteringPanelStatusEmptyText());
statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.ENABLED);
statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.DISABLED);
statusCombo.setEditable(false);
statusCombo.setTriggerAction(TriggerAction.ALL);
statusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
formPanel.add(statusCombo);
//
// Connection Status
final Label connectionStatusLabel = new Label(MSGS.deviceFilteringPanelConnectionStatus());
connectionStatusLabel.setWidth(WIDTH);
connectionStatusLabel.setStyleAttribute("margin", "5px");
formPanel.add(connectionStatusLabel);
final SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceConnectionStatus> connectionStatusCombo = new SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceConnectionStatus>();
connectionStatusCombo.setName("status");
connectionStatusCombo.setWidth(WIDTH);
connectionStatusCombo.setStyleAttribute("margin-top", "0px");
connectionStatusCombo.setStyleAttribute("margin-left", "5px");
connectionStatusCombo.setStyleAttribute("margin-right", "5px");
connectionStatusCombo.setStyleAttribute("margin-bottom", "10px");
connectionStatusCombo.setEmptyText(MSGS.deviceFilteringPanelConnectionStatusEmptyText());
connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.CONNECTED);
connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.MISSING);
connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.DISCONNECTED);
connectionStatusCombo.setEditable(false);
connectionStatusCombo.setTriggerAction(TriggerAction.ALL);
connectionStatusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
formPanel.add(connectionStatusCombo);
//
// Esf Version
final Label esfVersionLabel = new Label(MSGS.deviceFilteringPanelESFVersion());
esfVersionLabel.setWidth(WIDTH);
esfVersionLabel.setStyleAttribute("margin", "5px");
formPanel.add(esfVersionLabel);
final TextField<String> esfVersionField = new TextField<String>();
esfVersionField.setName("esfVersion");
esfVersionField.setWidth(WIDTH);
esfVersionField.setStyleAttribute("margin-top", "0px");
esfVersionField.setStyleAttribute("margin-left", "5px");
esfVersionField.setStyleAttribute("margin-right", "5px");
esfVersionField.setStyleAttribute("margin-bottom", "10px");
formPanel.add(esfVersionField);
//
// Application Identifiers
final Label applicationIdentifiersLabel = new Label(MSGS.deviceFilteringPanelApplications());
applicationIdentifiersLabel.setWidth(WIDTH);
applicationIdentifiersLabel.setStyleAttribute("margin", "5px");
formPanel.add(applicationIdentifiersLabel);
final TextField<String> applicationIdentifiersField = new TextField<String>();
applicationIdentifiersField.setName("applicationIdentifiers");
applicationIdentifiersField.setWidth(WIDTH);
applicationIdentifiersField.setStyleAttribute("margin-top", "0px");
applicationIdentifiersField.setStyleAttribute("margin-left", "5px");
applicationIdentifiersField.setStyleAttribute("margin-right", "5px");
applicationIdentifiersField.setStyleAttribute("margin-bottom", "10px");
formPanel.add(applicationIdentifiersField);
//
// Custom Attribute 1
final Label customAttribute1Label = new Label(MSGS.deviceFilteringPanelCustomAttribute1());
customAttribute1Label.setWidth(WIDTH);
customAttribute1Label.setStyleAttribute("margin", "5px");
formPanel.add(customAttribute1Label);
final TextField<String> customAttribute1Field = new TextField<String>();
customAttribute1Field.setName("customAttribute1");
customAttribute1Field.setWidth(WIDTH);
customAttribute1Field.setStyleAttribute("margin-top", "0px");
customAttribute1Field.setStyleAttribute("margin-left", "5px");
customAttribute1Field.setStyleAttribute("margin-right", "5px");
customAttribute1Field.setStyleAttribute("margin-bottom", "10px");
formPanel.add(customAttribute1Field);
//
// Custom Attribute 2
final Label customAttribute2Label = new Label(MSGS.deviceFilteringPanelCustomAttribute2());
customAttribute2Label.setWidth(WIDTH);
customAttribute2Label.setStyleAttribute("margin", "5px");
formPanel.add(customAttribute2Label);
final TextField<String> customAttribute2Field = new TextField<String>();
customAttribute2Field.setName("customAttribute1");
customAttribute2Field.setWidth(WIDTH);
customAttribute2Field.setStyleAttribute("margin-top", "0px");
customAttribute2Field.setStyleAttribute("margin-left", "5px");
customAttribute2Field.setStyleAttribute("margin-right", "5px");
customAttribute2Field.setStyleAttribute("margin-bottom", "5px");
formPanel.add(customAttribute2Field);
//
// Buttons
HorizontalPanel buttonPanel = new HorizontalPanel();
buttonPanel.setBorders(false);
buttonPanel.setStyleAttribute("background-color", "#F0F0F0");
buttonPanel.setStyleAttribute("margin-left", "5px");
buttonPanel.setStyleAttribute("margin-top", "5px");
buttonPanel.setHorizontalAlign(HorizontalAlignment.RIGHT);
buttonPanel.setHeight(50);
final Button searchButton = new Button(MSGS.deviceFilteringPanelSearch());
searchButton.setStyleAttribute("margin-left", "5px");
searchButton.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
GwtDeviceQueryPredicates predicates = new GwtDeviceQueryPredicates();
if (clientIdField.getValue() != null && !clientIdField.getValue().trim().isEmpty()) {
predicates.setClientId(unescapeValue(clientIdField.getValue()));
}
if (displayNameField.getValue() != null && !displayNameField.getValue().trim().isEmpty()) {
predicates.setDisplayName(unescapeValue(displayNameField.getValue()));
}
if (serialNumberField.getValue() != null && !serialNumberField.getValue().trim().isEmpty()) {
predicates.setSerialNumber(unescapeValue(serialNumberField.getValue()));
}
if (!statusCombo.getValue().getValue().equals(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY)) {
predicates.setDeviceStatus(statusCombo.getValue().getValue().name());
}
if (!connectionStatusCombo.getValue().getValue().equals(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY)) {
predicates.setDeviceConnectionStatus(connectionStatusCombo.getValue().getValue().name());
}
if (esfVersionField.getValue() != null && !esfVersionField.getValue().trim().isEmpty()) {
predicates.setEsfVersion(unescapeValue(esfVersionField.getValue()));
}
if (applicationIdentifiersField.getValue() != null && !applicationIdentifiersField.getValue().trim().isEmpty()) {
predicates.setApplicationIdentifiers(unescapeValue(applicationIdentifiersField.getValue()));
}
if (customAttribute1Field.getValue() != null && !customAttribute1Field.getValue().trim().isEmpty()) {
predicates.setCustomAttribute1(unescapeValue(customAttribute1Field.getValue()));
}
if (customAttribute2Field.getValue() != null && !customAttribute2Field.getValue().trim().isEmpty()) {
predicates.setCustomAttribute2(unescapeValue(customAttribute2Field.getValue()));
}
m_deviceTable.refreshAll(predicates);
}
});
final Button resetButton = new Button(MSGS.deviceFilteringPanelReset());
resetButton.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
clientIdField.setValue("");
displayNameField.setValue("");
serialNumberField.setValue("");
statusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
connectionStatusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
esfVersionField.setValue("");
applicationIdentifiersField.setValue("");
customAttribute1Field.setValue("");
customAttribute2Field.setValue("");
m_deviceTable.refreshAll(new GwtDeviceQueryPredicates());
}
});
buttonPanel.add(resetButton);
buttonPanel.add(searchButton);
formPanel.add(buttonPanel);
add(formPanel);
}
use of org.eclipse.kapua.app.console.shared.model.GwtDeviceQueryPredicates in project kapua by eclipse.
the class DevicesView method onRender.
protected void onRender(final Element parent, int index) {
super.onRender(parent, index);
// FitLayout that expands to the whole screen
setLayout(new FitLayout());
setBorders(false);
LayoutContainer mf = new LayoutContainer();
mf.setBorders(false);
mf.setLayout(new BorderLayout());
// East Panel: Filtering menu
BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 220);
eastData.setMargins(new Margins(0, 0, 0, 0));
eastData.setCollapsible(false);
eastData.setSplit(false);
m_deviceFilterPanel = new DeviceFilterPanel(m_currentSession);
ContentPanel panel = new ContentPanel();
panel.setLayout(new FitLayout());
panel.setBorders(false);
panel.setBodyBorder(false);
panel.setHeading(MSGS.deviceFilteringPanelHeading());
panel.add(m_deviceFilterPanel);
mf.add(panel, eastData);
// Center Main panel:
BorderLayoutData centerMainPanel = new BorderLayoutData(LayoutRegion.CENTER);
centerMainPanel.setMargins(new Margins(0, 5, 0, 0));
centerMainPanel.setSplit(false);
LayoutContainer resultContainer = new LayoutContainer(new BorderLayout());
resultContainer.setBorders(false);
mf.add(resultContainer, centerMainPanel);
//
// North Panel: Devices Table and Map Tabs
m_deviceTable = new DevicesTable(this, m_currentSession, panel);
m_deviceFilterPanel.setDeviceTable(m_deviceTable);
m_deviceMap = new DevicesMap(this, m_currentSession);
m_tabsPanel = new TabPanel();
m_tabsPanel.setPlain(false);
m_tabsPanel.setBorders(false);
m_tabsPanel.setBodyBorder(true);
m_tabTable = new TabItem(MSGS.tabTable());
m_tabTable.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.table()));
m_tabTable.setBorders(false);
m_tabTable.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
m_deviceTable.refresh(new GwtDeviceQueryPredicates());
}
});
m_tabTable.setLayout(new FitLayout());
m_tabTable.add(m_deviceTable);
m_tabsPanel.add(m_tabTable);
m_tabMap = new TabItem(MSGS.tabMap());
m_tabMap.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.deviceMap()));
m_tabMap.setBorders(false);
m_tabMap.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
m_deviceMap.refresh(new GwtDeviceQueryPredicates());
}
});
m_tabMap.setLayout(new FitLayout());
m_tabMap.add(m_deviceMap);
m_tabsPanel.add(m_tabMap);
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, .45F);
northData.setMargins(new Margins(0, 0, 0, 0));
northData.setSplit(true);
northData.setMinSize(0);
resultContainer.add(m_tabsPanel, northData);
//
// Center Panel: Profile and History Tabs
BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER, .55F);
centerData.setMargins(new Margins(5, 0, 0, 0));
centerData.setCollapsible(true);
centerData.setHideCollapseTool(true);
centerData.setSplit(true);
m_deviceTabs = new DeviceTabs(m_deviceTable, m_deviceFilterPanel, m_currentSession);
resultContainer.add(m_deviceTabs, centerData);
add(mf);
}
Aggregations