Package edu.wpi.first.smartdashboard.state

Examples of edu.wpi.first.smartdashboard.state.Record


                break;

            case PacketReader.UPDATE:
                Object rawValue = data.get(UpdateReader.DATA_INDEX);
                Integer field_id = (Integer) data.get(UpdateReader.ID_INDEX);
                Record record = m_state.getRecord(field_id);
                Types.Type field_type_id = record.getType();

                try {
                Object parsedValue = Types.parse((byte[]) rawValue, field_type_id);
                record.setValue(parsedValue);
                } catch (Exception e) {
                  System.out.println("Error: "+record.getName()+", "+e.getMessage());
                  e.printStackTrace();
                }
                break;
        }
    }
View Full Code Here


    }
  }

  private void setupChangeToPopupMenu() {
    List<Class> choices;
    Record record = selectedElement.getRecord();
    try {
      choices = DisplayElementRegistry.elementsForType(record.getType());
    } catch (NoElementsRegisteredForType ex) {
      Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE,
          null, ex);
      changeToMenu.setEnabled(false);
      return; // no choices - make the ChangeTo menu item insensitive
View Full Code Here

      super(string);
    }

    public void actionPerformed(ActionEvent ae) {
      List<Class> choices;
      Record record = selectedElement.getRecord();
      try {
        choices = DisplayElementRegistry.elementsForType(record
            .getType());
      } catch (NoElementsRegisteredForType ex) {
        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE,
            null, ex);
        return;
      }
      for (Class c : choices) {
        System.out.println("Type choice: " + c.getSimpleName());
      }
      final Point location = new Point(selectedElement.getLocation());
      selectedElement.disconnect();
      selectedElement.getLayoutAllocation().deallocate();
      selectedElement.getParent().remove(selectedElement);
      final FormattedField newElement = new FormattedField();
      newElement.setFieldName(record.getName());
      newElement.setRecord(record);
      addField(newElement);
      // queue up request to set location so it happens after addField
      SwingUtilities.invokeLater(new Runnable() {

        public void run() {
          newElement.setLocation(location);
        }
      });
      record.addStateReceiver(newElement);
    }
View Full Code Here

      this.elementClass = elementClass;
    }

    public void actionPerformed(ActionEvent e) {
      final StatefulDisplayElement newElement;
      Record record = selectedElement.getRecord();
      final Point location = new Point(selectedElement.getLocation());
      selectedElement.disconnect();
      selectedElement.getLayoutAllocation().deallocate();
      selectedElement.getParent().remove(selectedElement);
      try {
        newElement = (StatefulDisplayElement) elementClass
            .newInstance();
      } catch (InstantiationException ex) {
        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE,
            null, ex);
        return;
      } catch (IllegalAccessException ex) {
        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE,
            null, ex);
        return;
      }

      // final FormattedField newElement = new FormattedField();
      newElement.setFieldName(record.getName());
      newElement.setRecord(record);
      addField(newElement);
      // queue up request to set location so it happens after addField
      SwingUtilities.invokeLater(new Runnable() {

        public void run() {
          newElement.setLocation(location);
        }
      });
      record.addStateReceiver(newElement);
    }
View Full Code Here

TOP

Related Classes of edu.wpi.first.smartdashboard.state.Record

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.