přejmenována třída ObjectType na DeviceType
parent
6347f1996f
commit
3b8eb87cc7
|
|
@ -9,8 +9,8 @@ import jnet.lib.ApacheConfig;
|
|||
import jnet.lib.BuilddDate;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.DeviceType;
|
||||
import jnet.lib.object.Event;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.OnlineClients;
|
||||
import jnet.lib.object.ServerConfig;
|
||||
import jnet.lib.object.Site;
|
||||
|
|
@ -32,7 +32,7 @@ public class Client {
|
|||
|
||||
public static ArrayList<OnlineClients> onlineClients = new ArrayList<>();
|
||||
public static ArrayList<Site> site = new ArrayList<>();
|
||||
public static ArrayList<ObjectType> objectType = new ArrayList<>();
|
||||
public static ArrayList<DeviceType> deviceType = new ArrayList<>();
|
||||
public static ArrayList<SnmpProfile> snmpProfile = new ArrayList<>();
|
||||
public static ArrayList<User> users = new ArrayList<>();
|
||||
public static ServerConfig serverConfig;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import jnet.client.gui.Window;
|
|||
import jnet.client.gui.serversettings.ServerSettingsPanel;
|
||||
import jnet.client.client.NettyClientManager;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
|
|
@ -124,7 +124,7 @@ public class DialogDeviceType extends JDialog {
|
|||
info.setText("Musíte vybrat obrázek.");
|
||||
return;
|
||||
}
|
||||
NettyClientManager.sendMessage(new Message(Message.NODE_ICON_NEW, new ObjectType(name, imgStr)));
|
||||
NettyClientManager.sendMessage(new Message(Message.NODE_ICON_NEW, new DeviceType(name, imgStr)));
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
Window.showServerSettings(ServerSettingsPanel.TAB_DEVICE_TYPE);
|
||||
dispose();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import javax.swing.JTextField;
|
|||
import jnet.client.Client;
|
||||
import jnet.client.client.NettyClientManager;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
import jnet.lib.object.SnmpTemplate;
|
||||
import jnet.lib.object.SnmpValueMap;
|
||||
import org.snmp4j.smi.SMIConstants;
|
||||
|
|
@ -59,8 +59,8 @@ public class DialogSnmpTemplate extends JFrame {
|
|||
conversionTypeComBox.addItem(new TypeItem(SnmpTemplate.CONVERSION_TYPE_NONE, "Žádný"));
|
||||
conversionTypeComBox.addItem(new TypeItem(SnmpTemplate.CONVERSION_TYPE_OFFSET, "Offset"));
|
||||
|
||||
for (ObjectType objectType : Client.objectType) {
|
||||
DeviceTypeItem item = new DeviceTypeItem(objectType.getId(), objectType.getName());
|
||||
for (DeviceType devicType : Client.deviceType) {
|
||||
DeviceTypeItem item = new DeviceTypeItem(devicType.getId(), devicType.getName());
|
||||
deviceTypeComBox.addItem(item);
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +80,8 @@ public class DialogSnmpTemplate extends JFrame {
|
|||
conversionValueField.setText(String.valueOf(template.getConversionValue()));
|
||||
conversionExpressionField.setText(template.getConversionExpression());
|
||||
unitField.setText(template.getUnit());
|
||||
for (int i = 0; i < Client.objectType.size(); i++) {
|
||||
if (Client.objectType.get(i).getId() == template.getDeviceType()) {
|
||||
for (int i = 0; i < Client.deviceType.size(); i++) {
|
||||
if (Client.deviceType.get(i).getId() == template.getDeviceType()) {
|
||||
deviceTypeComBox.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class DialogNodeDevice extends JFrame {
|
|||
obj.setIp(ip);
|
||||
obj.setUser(tabSettings.getUser());
|
||||
obj.setPassword(new String(tabSettings.getPassword()));
|
||||
obj.setIcon(Client.objectType.get(tabSettings.getObjType()).getId());
|
||||
obj.setIcon(Client.deviceType.get(tabSettings.getObjType()).getId());
|
||||
obj.setSnmpProfile(Client.snmpProfile.get(tabSettings.getSnmpProfile()).getId());
|
||||
obj.setPing(tabSettings.isActive());
|
||||
obj.setDescription(tabSettings.getDesc());
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import javax.swing.JTextArea;
|
|||
import javax.swing.JTextField;
|
||||
import jnet.client.Client;
|
||||
import jnet.lib.object.Node;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
import jnet.lib.object.SnmpProfile;
|
||||
|
||||
public class TabSettings extends JPanel {
|
||||
|
|
@ -69,7 +69,7 @@ public class TabSettings extends JPanel {
|
|||
this.add(typLabel);
|
||||
|
||||
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
|
||||
for (ObjectType ot : Client.objectType) {
|
||||
for (DeviceType ot : Client.deviceType) {
|
||||
model.addElement(ot.getName());
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +133,8 @@ public class TabSettings extends JPanel {
|
|||
ipText.setText(obj.getIp());
|
||||
userText.setText(obj.getUser());
|
||||
hesloText.setText(obj.getPassword());
|
||||
for (int i = 0; i < Client.objectType.size() - 1; i++) {
|
||||
if (obj.getIcon()== Client.objectType.get(i).getId()) {
|
||||
for (int i = 0; i < Client.deviceType.size() - 1; i++) {
|
||||
if (obj.getIcon()== Client.deviceType.get(i).getId()) {
|
||||
typeComboBox.setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import jnet.client.SnmpResponseParser;
|
|||
import jnet.lib.LogFile;
|
||||
import jnet.lib.object.Node;
|
||||
import jnet.lib.object.NodeProbe;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
|
||||
public class NodeView {
|
||||
|
||||
|
|
@ -62,10 +62,10 @@ public class NodeView {
|
|||
|
||||
private Image loadIcon(int typeId) {
|
||||
return iconCache.computeIfAbsent(typeId, id -> {
|
||||
for (ObjectType objectType : Client.objectType) {
|
||||
if (objectType.getId() == id) {
|
||||
for (DeviceType devicType : Client.deviceType) {
|
||||
if (devicType.getId() == id) {
|
||||
try {
|
||||
byte[] decoded = Base64.getDecoder().decode(objectType.getImgStr());
|
||||
byte[] decoded = Base64.getDecoder().decode(devicType.getImgStr());
|
||||
try (ByteArrayInputStream bis = new ByteArrayInputStream(decoded)) {
|
||||
return ImageIO.read(bis);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package jnet.client.gui.mapview;
|
|||
import jnet.client.Client;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.object.Node;
|
||||
import jnet.lib.object.ObjectType;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
|
|
@ -14,6 +13,7 @@ import java.io.IOException;
|
|||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import jnet.lib.object.DeviceType;
|
||||
|
||||
public class PaintSiteObject {
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ public class PaintSiteObject {
|
|||
|
||||
private BufferedImage loadIcon(int typeId) {
|
||||
return iconCache.computeIfAbsent(typeId, id -> {
|
||||
for (ObjectType objectType : Client.objectType) {
|
||||
if (objectType.getId() == id) {
|
||||
for (DeviceType devicType : Client.deviceType) {
|
||||
if (devicType.getId() == id) {
|
||||
try {
|
||||
byte[] decoded = Base64.getDecoder().decode(objectType.getImgStr());
|
||||
byte[] decoded = Base64.getDecoder().decode(devicType.getImgStr());
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(decoded);
|
||||
return ImageIO.read(bis);
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package jnet.client.gui.serversettings;
|
||||
|
||||
import jnet.client.Client;
|
||||
import jnet.lib.object.ObjectType;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
|
|
@ -18,6 +17,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import jnet.client.client.NettyClientManager;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.DeviceType;
|
||||
|
||||
public class TableDeviceType extends JTable {
|
||||
|
||||
|
|
@ -69,18 +69,18 @@ public class TableDeviceType extends JTable {
|
|||
private void loadData() {
|
||||
model.setRowCount(0);
|
||||
|
||||
for (ObjectType obj : Client.objectType) {
|
||||
for (DeviceType obj : Client.deviceType) {
|
||||
model.addRow(new Object[]{obj.getId(), getIcon(obj), obj.getName()});
|
||||
}
|
||||
}
|
||||
|
||||
// -------- Získání vybraného zarizeni --------
|
||||
private ObjectType getSelectedDeviceType() {
|
||||
private DeviceType getSelectedDeviceType() {
|
||||
int viewRow = getSelectedRow();
|
||||
if (viewRow == -1) return null;
|
||||
int modelRow = convertRowIndexToModel(viewRow);
|
||||
int id = (int) model.getValueAt(modelRow, 0);
|
||||
return Client.objectType.stream()
|
||||
return Client.deviceType.stream()
|
||||
.filter(st -> st.getId() == id)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
|
@ -92,7 +92,7 @@ public class TableDeviceType extends JTable {
|
|||
|
||||
// JMenuItem editItem = new JMenuItem("Upravit");
|
||||
// editItem.addActionListener(e -> {
|
||||
// ObjectType st = getSelectedDeviceType();
|
||||
// devicType st = getSelectedDeviceType();
|
||||
// if (st != null) {
|
||||
// // Zde zavolejte metodu pro otevření editace
|
||||
// new DialogSnmpProfile(st, false).show();
|
||||
|
|
@ -102,7 +102,7 @@ public class TableDeviceType extends JTable {
|
|||
|
||||
JMenuItem deleteItem = new JMenuItem("Smazat");
|
||||
deleteItem.addActionListener(e -> {
|
||||
ObjectType ot = getSelectedDeviceType();
|
||||
DeviceType ot = getSelectedDeviceType();
|
||||
if (ot != null) {
|
||||
// Zde zavolejte metodu pro smazání
|
||||
if (ot.getId() != 1) {
|
||||
|
|
@ -129,7 +129,7 @@ public class TableDeviceType extends JTable {
|
|||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
|
||||
ObjectType st = getSelectedDeviceType();
|
||||
DeviceType st = getSelectedDeviceType();
|
||||
if (st != null) {
|
||||
// Dvojklik = editace
|
||||
// new DialogSnmpProfile(st, false).show();
|
||||
|
|
@ -164,7 +164,7 @@ public class TableDeviceType extends JTable {
|
|||
SwingUtilities.invokeLater(this::loadData);
|
||||
}
|
||||
|
||||
private ImageIcon getIcon(ObjectType obj) {
|
||||
private ImageIcon getIcon(DeviceType obj) {
|
||||
return iconCache.computeIfAbsent(obj.getImgStr(), key -> {
|
||||
try {
|
||||
byte[] decoded = Base64.getDecoder().decode(key);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import jnet.client.Client;
|
|||
import jnet.client.client.NettyClientManager;
|
||||
import jnet.client.gui.dialog.DialogSnmpTemplate;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
import jnet.lib.object.SnmpTemplate;
|
||||
|
||||
public class TableSnmpTemplate extends JTable {
|
||||
|
|
@ -54,13 +54,13 @@ public class TableSnmpTemplate extends JTable {
|
|||
model.setRowCount(0);
|
||||
|
||||
for (SnmpTemplate st : Client.snmpTemplate) {
|
||||
ObjectType objectType = Client.objectType.stream()
|
||||
DeviceType devicType = Client.deviceType.stream()
|
||||
.filter(type -> type.getId() == st.getDeviceType())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
model.addRow(new Object[]{
|
||||
st.getId(), // skrytý sloupec
|
||||
objectType.getName(),
|
||||
devicType.getName(),
|
||||
st.getName()
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class RegisterDeviceTypeDeleteResult implements Register{
|
|||
int id = (int) msg.getMsg();
|
||||
|
||||
// odebere ze seznamu
|
||||
Client.objectType.removeIf(obj -> obj.getId() == id);
|
||||
Client.deviceType.removeIf(obj -> obj.getId() == id);
|
||||
|
||||
Window.refreshDeviceTypes();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import io.netty.channel.ChannelHandlerContext;
|
|||
import java.util.ArrayList;
|
||||
import jnet.client.Client;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.ObjectType;
|
||||
import jnet.lib.object.DeviceType;
|
||||
|
||||
|
||||
public class RegisterNodeIconList implements Register{
|
||||
|
|
@ -14,7 +14,7 @@ public class RegisterNodeIconList implements Register{
|
|||
|
||||
@Override
|
||||
public void processing(ChannelHandlerContext ctx, Message msg) {
|
||||
Client.objectType = (ArrayList<ObjectType>) msg.getMsg();
|
||||
Client.deviceType = (ArrayList<DeviceType>) msg.getMsg();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue