Package it.freedomotic.model.ds

Examples of it.freedomotic.model.ds.Config


            while ((line = myInput.readLine()) != null) {
                xml.append(line).append("\n");
            }

            Config c = null;
            xstream.alias("config", Config.class);
            c = (Config) xstream.fromXML(xml.toString());
            c.setXmlFile(file);

            return c;
        } catch (FileNotFoundException fileNotFoundException) {
            LOG.warning(fileNotFoundException.getLocalizedMessage());
        } finally {
            if (myInput != null) {
                myInput.close();
            }
        }

        return new Config();
    }
View Full Code Here


    public ObjectPluginPlaceholder(File example)
            throws DaoLayerException {
        this.example = example;
        object = EnvObjectPersistence.loadObject(example);
        config = new Config();
    }
View Full Code Here

        LOG.log(Level.CONFIG,
                "Sensors notification ''{0}'' has changed ''{1}'' behavior ''{2}'' to {3}",
                new Object[]{t.getName(), getPojo().getName(), behavior, valueStatement.getValue()});

        Config params = new Config();
        params.setProperty("value",
                valueStatement.getValue());
        getBehavior(behavior).filterParams(params, false); //false means not fire commands, only change behavior value

        return true;
    }
View Full Code Here

            public void hideGui() {
            }
        };

        placeholder.setDescription(description);
        placeholder.configuration = new Config();

        return placeholder;
    }
View Full Code Here

    @Override
    public void onMessage(ObjectMessage message) {
        try {
            //here a plugin manifest is expected
            Config manifest = (Config) message.getObject();
            Plugin plugin = new Plugin(manifest.getProperty("name"),
                    manifest);
            clientStorage.add(plugin);
            LOG.info("Enqueued remote plugin " + plugin.getName());
        } catch (JMSException ex) {
            LOG.severe("Join Plugin receives a not valid plugin manifest");
View Full Code Here

                tabControls.add(label);
                tabControls.add(button);
                button.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Config params = new Config();
                        params.setProperty("value",
                                new Boolean(!bb.getValue()).toString());
                        bb.filterParams(params, true);

                        if (bb.getValue()) {
                            button.setText(I18n.msg( "set_PROPERTY_VALUE", new Object[]{bb.getName(), I18n.msg("false")}));
                        } else {
                            button.setText(I18n.msg( "set_PROPERTY_VALUE", new Object[]{bb.getName(), I18n.msg("true")}));
                        }
                    }
                });
                button.setEnabled(!b.isReadOnly());
            }

            if (b instanceof RangedIntBehaviorLogic) {
                final RangedIntBehaviorLogic rb = (RangedIntBehaviorLogic) b;
                final JLabel doubleValue = new JLabel(rb.getValueAsString());
                final JPanel sliderPanel = new JPanel(new FlowLayout());
                final JSlider slider = new JSlider();

                slider.setValue(rb.getValue());
                slider.setMaximum(rb.getMax());
                slider.setMinimum(rb.getMin());
                slider.setPaintTicks(true);
                slider.setPaintTrack(true);
                slider.setPaintLabels(false);
                slider.setMajorTickSpacing(rb.getScale() * 10);
                slider.setMinorTickSpacing(rb.getStep());
                slider.setSnapToTicks(true);

                JLabel label = new JLabel(b.getName() + ":");
                tabControls.add(label);
                sliderPanel.add(slider);
                sliderPanel.add(doubleValue);
                tabControls.add(sliderPanel);
                slider.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        if (!slider.getValueIsAdjusting()) {
                            Config params = new Config();
                            params.setProperty("value",
                                    String.valueOf(slider.getValue()));
                            System.out.println("Slider value: " + slider.getValue());
                            rb.filterParams(params, true);
                        }

                        if (rb.getScale() != 1) {
                            doubleValue.setText(new Double((double) slider.getValue() / rb.getScale()).toString());
                        } else {
                            doubleValue.setText(new Integer(slider.getValue()).toString());
                        }
                    }
                });
                slider.setEnabled(!b.isReadOnly());
            }

            if (b instanceof ListBehaviorLogic) {
                final ListBehaviorLogic lb = (ListBehaviorLogic) b;
                final JComboBox comboBox = new JComboBox();

                for (String listValue : lb.getValuesList()) {
                    comboBox.addItem(listValue);
                }

                comboBox.setEditable(false);
                comboBox.setSelectedItem(lb.getSelected());

                JLabel label = new JLabel(b.getName() + ":");
//                controlPanel.addRow();
//                controlPanel.addElement(label, row, 0);
//                controlPanel.addElement(comboBox, row, 1);
                tabControls.add(label);
                tabControls.add(comboBox);
                comboBox.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Config params = new Config();
                        params.setProperty("value", (String) comboBox.getSelectedItem());
                        lb.filterParams(params, true);
                    }
                });
                comboBox.setEnabled(!b.isReadOnly());
            }
View Full Code Here

        btnAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (!newItem.getText().isEmpty()) {
                    refreshMultiselectionList(lb, list);

                    Config params = new Config();
                    params.setProperty("item",
                            newItem.getText());
                    params.setProperty("value", "add");
                    lb.filterParams(params, true);
                }
            }
        });

        JButton btnRemove = new JButton(I18n.msg("remove"));
        btnRemove.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (!newItem.getText().isEmpty()) {
                    Config params = new Config();
                    params.setProperty("item",
                            newItem.getText());
                    params.setProperty("value", "remove");
                    lb.filterParams(params, true);
                    refreshMultiselectionList(lb, list);
                }
            }
        });
View Full Code Here

            final JCheckBox box = new JCheckBox(item);

            if (!model.contains(box)) { //no duplicates allowed
                box.addChangeListener(new ChangeListener() {
                    public void stateChanged(ChangeEvent e) {
                        Config params = new Config();
                        params.setProperty("item",
                                box.getText());
                        params.setProperty("value",
                                new Boolean(box.isSelected()).toString());
                        source.filterParams(params, true);
                    }
                });
                box.setSelected(source.getSelected().contains(item));
View Full Code Here

//        private static int retries = 1;
    public ModbusMasterGateway() {
    }

    public static ModbusMaster getInstance() {
        return getInstance(new Config());
    }
View Full Code Here

     */
    public static void main(String[] args) throws Exception {

        System.out.println("\nTesting read method from modbus");

        Config config = new Config();
        config.setProperty("ModbusProtocol", "TCP");

        //Serial test
        config.setProperty("port", "/dev/ttyUSB0");
        config.setProperty("baudrate", String.valueOf(19200));
        config.setProperty("data-bits", String.valueOf(SerialPort.DATABITS_8));
        config.setProperty("parity", String.valueOf(SerialPort.PARITY_EVEN));
        config.setProperty("stop-bits", String.valueOf(SerialPort.STOPBITS_1));

        //TCP Test
        config.setProperty("host", "192.168.1.9");
        config.setProperty("tcpport", String.valueOf(502));




        ModbusMaster master = ModbusMasterGateway.getInstance(config);
View Full Code Here

TOP

Related Classes of it.freedomotic.model.ds.Config

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.