Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IDevice


        // check deviceList is correct: for each element in deviceList we check
        // it's in
        // salsaConfiguration
        iterator = salsaDevice.listIterator();
        while (iterator.hasNext() && !found) {
            IDevice device = iterator.next();
            if (device.getName().equalsIgnoreCase(userDevice)) {
                found = true;
                device.setEnabled(enable);
            }
        }
    }
View Full Code Here


        // check deviceList is correct: for each element in deviceList we check
        // it's in
        // salsaConfiguration
        iterator = salsaDevice.listIterator();
        while (iterator.hasNext()) {
            IDevice device = iterator.next();
            if (device.getName().equalsIgnoreCase(userDevice)) {
                return device.isEnabled();
            }
        }

        return enabled;
    }
View Full Code Here

                // System.out.println("DeviceName = " + deviceList.get(table.getSelectedRow()).getName());

                int row = table.getSelectedRow();
                // System.out.println("mouseClicked col=" + col);
                if ((row > -1) && (row < deviceList.size())) {
                    IDevice device = deviceList.get(row);
                    String completeAttributeName = device.getName();
                    bean.setCompleteAttributeName(completeAttributeName);
                    cardLayout.show(controlPanel, "DEVICE");
                    int col = table.getSelectedColumn();
                    if (col == 0) {
                        table.setValueAt(!device.isEnabled(), row, col);
                    }
                } else {
                    bean.setModel(null);
                    cardLayout.show(controlPanel, "NONE");
                }

                addToAllButton.setEnabled(false);
                removeFromAllButton.setEnabled(false);
                int[] rows = table.getSelectedRows();
                if ((rows != null) && (rows.length > 0)) {
                    removeFromAllButton.setEnabled(true);
                    for (int singleRow : rows) {
                        Object value = table.getValueAt(singleRow, 1);
                        if (value instanceof IDevice) {
                            if(!((IDevice)value).isCommon()) {
                                addToAllButton.setEnabled(true);
                                break;
                            }
                        }
                    }
                }
            }
        });

        tableModel = new AbstractTableModel() {
            private static final long serialVersionUID = 4480875677500863631L;

            @Override
            public int getRowCount() {
                if (deviceList != null) {
                    return deviceList.size();
                }
                return 0;
            }

            @Override
            public int getColumnCount() {
                return 2;
            }

            @Override
            public String getColumnName(int column) {
                if (column == 0) {
                    return "Enable";
                }
                return "Device";
            }

            @Override
            public Class<?> getColumnClass(int columnIndex) {
                if (columnIndex == 0) {
                    return Boolean.class;
                }
                return IDevice.class;

            }

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                boolean isEditable = false;
                if (columnIndex == 0) {
                    isEditable = editable;
                } else {
                    isEditable = management;
                }
                // System.out.println("isCellEditable=" + isEditable);
                return isEditable;
            }

            @Override
            public Object getValueAt(int rowIndex, int columnIndex) {
                Object value = null;
                if ((deviceList != null) && (deviceList.size() > rowIndex)) {
                    IDevice device = deviceList.get(rowIndex);
                    if (columnIndex == 0) {
                        value = device.isEnabled();
                    } else {
                        value = device;
                    }
                }
                return value;
            }

            @Override
            public void setValueAt(Object value, int rowIndex, int columnIndex) {
                // System.out.println("setValueAt=" + rowIndex + "," + columnIndex);
                //                System.out.println("deviceList=" + deviceList.size());
                if ((value != null) && (deviceList != null) && (deviceList.size() > rowIndex)) {
                    IDevice device = deviceList.get(rowIndex);
                    if (columnIndex == 0) {
                        device.setEnabled((Boolean) value);
                        // System.out.println("setValueAt=" + value + "=> " + device);
                        if (listener != null) {
                            listener.deviceEnabled(device.getName(), (Boolean) value);
                        }
                    } else {
                        String oldName = device.getName();
                        String newName = value.toString().toLowerCase();
                        device.setName(newName);
                        //                        System.out.println("oldName=" + oldName);
                        //                        System.out.println("newName=" + newName);
                        if (listener != null) {
                            listener.deviceRenamed(oldName, newName);
                        }
View Full Code Here

    /**
     * Refresh trajectories views.
     */
    public void refreshViewComponents() {
        IDevice device = null;
        String deviceName = null;
        for (int i = 0; i < this.actuatorModelsList.size(); i++) {
            device = actuatorModelsList.get(i);
            deviceName = device.getName();
            this.notifyAddActuator(deviceName, false);
            if (this.view != null) {
                view.setDeviceEnable(deviceName, device.isEnabled());
            }
        }

        if (view != null) {
            for (int i = 0; i < this.rangeModelsList.size(); i++) {
View Full Code Here

        super.notifyDeviceEnabled(deviceName, selected);
    }

    @Override
    public void notifyDeviceRenamed(int deviceIndex, String newDeviceName) {
        IDevice oldTimebase = getDeviceName(deviceIndex);
        if ((oldTimebase != null) && !ObjectUtils.sameObject(oldTimebase.getName(), newDeviceName)) {
            String oldTimebaseName = oldTimebase.getName();
            if (listener != null) {
                listener.deviceRenamed(oldTimebaseName, newDeviceName);
            }
            if (config != null) {
                config.renameTimeBase(oldTimebaseName, newDeviceName);
View Full Code Here

            @Override
            public Object getValueAt(int rowIndex, int columnIndex) {
                Object value = null;
                if (deviceList != null && deviceList.size() > rowIndex) {
                    IDevice device = deviceList.get(rowIndex);
                    if (columnIndex == 0) {
                        value = device.isEnabled();
                    } else {
                        value = device.getName();
                    }
                }
                return value;
            }

            public void setValueAt(Object value, int rowIndex, int columnIndex) {
                if (value != null && deviceList != null && deviceList.size() > rowIndex) {
                    IDevice device = deviceList.get(rowIndex);
                    device.setEnabled((Boolean) value);
                }
            }

        };
        checkAll.addActionListener(new ActionListener() {
View Full Code Here

    /**
     * Refresh trajectories views.
     */
    public void refreshViewComponents() {
        IDevice device = null;
        String deviceName = null;
        for (int i = 0; i < this.actuatorModelsList.size(); i++) {
            device = actuatorModelsList.get(i);
            deviceName = device.getName();
            this.notifyAddActuator(deviceName, false);
        }

        if (view != null) {
            for (int i = 0; i < this.rangeModelsList.size(); i++) {
View Full Code Here

                // Add only if necessary
                if (super.getDevice(oldActuatorName, tmpActuatorList) != null) {
                    config.renameActuator(oldActuatorName, newActuatorName);
                }
            }
            IDevice device = super.getDevice(oldActuatorName, actuatorList);
            if (device != null) {
                device.setName(newActuatorName);
            }
        }
    }
View Full Code Here

                // Add only if necessary
                if (super.getDevice(actuatorName, tmpActuatorList) == null) {
                    config.addActuator(actuatorName, yActuator);
                }
            }
            IDevice device = super.getDevice(actuatorName, actuatorList);
            if (device != null) {
                device.setCommon(true);
            } else {
                device = new ActuatorModel();
                actuatorList.add((IActuator) device);
                IDimension tmpDimension = null;
                if (!yActuator && !dimensionList.isEmpty()) {
View Full Code Here

                    //                    System.out.println("newSensorName=" + newSensorName);
                    //                    System.out.println("config=" + config.getFullPath());
                    config.renameSensor(oldSensorName, newSensorName);
                }
            }
            IDevice device = super.getDevice(oldSensorName, getSensorsList());
            if (device != null) {
                device.setName(newSensorName);
            }
        }
    }
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.entity.IDevice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.