Examples of IDevice


Examples of fr.soleil.salsa.entity.IDevice

     *            for duplicates.
     */
    protected void updateDeviceList(boolean checkForDuplicates) {
        if ((this.deviceList != null) && (this.view.getModel().getRowCount() > 0)) {
            ArrayList<String> canceledNames = new ArrayList<String>();
            IDevice deviceInModel = null;
            IDevice deviceInView = null;
            String deviceNameInModel = null;
            String deviceNameInView = null;
            Boolean isEnabledInView = false;
            boolean isCommonInView = false;
            boolean addDevice = false;
            for (int i = 0; i < this.view.getModel().getRowCount(); i++) {
                addDevice = false;
                if(i < deviceList.size()) {
                    deviceInModel = deviceList.get(i);
                    deviceNameInModel = deviceInModel.getName();
                }
                else {
                    addDevice = true;
                    deviceInModel = generateDevice();
                }

                deviceInView = (IDevice) this.view.getModel().getValueAt(i, 1);
                deviceNameInView = deviceInView.getName();
                isEnabledInView = (Boolean) this.view.getModel().getValueAt(i, 0);
                isCommonInView = deviceInView.isCommon();

                deviceInModel.setName(deviceNameInView);
                deviceInModel.setEnabled(isEnabledInView);
                deviceInModel.setCommon(isCommonInView);

View Full Code Here

Examples of fr.soleil.salsa.entity.IDevice

            }
        }
    }

    protected IDevice getDeviceForName(String deviceName) {
        IDevice device = null;
        if ((this.deviceList != null) && (deviceName != null)) {
            for (IDevice tmpDevice : deviceList) {
                if (tmpDevice.getName().equalsIgnoreCase(deviceName)) {
                    device = tmpDevice;
                    break;
View Full Code Here

Examples of fr.soleil.salsa.entity.IDevice

        if (list1 == null && list2 == null) {
            equals = true;
        } else if ((list1 != null && list2 != null) && (list1.size() == list2.size())) {
            boolean listEquals = true;
            for (int i = 0; i < list1.size(); i++) {
                IDevice device1 = list1.get(i);
                IDevice device2 = list2.get(i);
                if (!deviceEquals(device1, device2)) {
                    listEquals = false;
                    break;
                }
            }
View Full Code Here

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

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()) {
            IDevice device = iterator.next();
            if (device.getName().equalsIgnoreCase(userDevice)) {
                return device.isEnabled();
            }
        }

        return enabled;
    }
View Full Code Here

Examples of fr.soleil.salsa.entity.IDevice

                // 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

Examples of fr.soleil.salsa.entity.IDevice

    /**
     * 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

Examples of fr.soleil.salsa.entity.IDevice

        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

Examples of fr.soleil.salsa.entity.IDevice

            @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

Examples of fr.soleil.salsa.entity.IDevice

    /**
     * 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
TOP
Copyright © 2018 www.massapi.com. 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.