public YoVariableExtracter(File logFile) throws IOException { LogPropertiesReader logProperties = new LogPropertiesReader(new File(logFile, YoVariableLoggerListener.propertyFile)); File handshake = new File(logFile, logProperties.getVariables().getHandshakeAsString()); if (!handshake.exists()) { throw new RuntimeException("Cannot find " + logProperties.getVariables().getHandshakeAsString()); } DataInputStream handshakeStream = new DataInputStream(new FileInputStream(handshake)); byte[] handshakeData = new byte[(int) handshake.length()]; handshakeStream.readFully(handshakeData); handshakeStream.close(); YoVariableHandshakeParser parser = YoVariableHandshakeParser.create(logProperties.getVariables().getHandshakeFileType()); parser.parseFrom(handshakeData); YoVariableRegistry registry = parser.getRootRegistry(); File logdata = new File(logFile, logProperties.getVariables().getDataAsString()); if(!logdata.exists()) { throw new RuntimeException("Cannot find " + logProperties.getVariables().getDataAsString()); } @SuppressWarnings("resource") final FileChannel logChannel = new FileInputStream(logdata).getChannel(); List<YoVariable<?>> variables = parser.getYoVariablesList(); int jointStateOffset = variables.size(); int numberOfJointStates = JointState.getNumberOfJointStates(parser.getJointStates()); int bufferSize = (1 + jointStateOffset + numberOfJointStates) * 8; new YoVariableDialog(bufferSize, logChannel, variables, registry); }
public YoVariableDialog(int bufferSize, FileChannel logChannel, List<YoVariable<?>> variables, YoVariableRegistry registry) setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Select variable"); setLocationRelativeTo(null); setLocationByPlatform(true); setSize(300, 300); this.bufferSize = bufferSize; this.registry = registry; print.addActionListener(this); Container container = getContentPane(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.add(searchField); container.add(scroller); container.add(print); setVisible(true);
public YoVariableExtracter(File logFile) throws IOException { LogPropertiesReader logProperties = new LogPropertiesReader(new File(logFile, YoVariableLoggerListener.propertyFile)); File handshake = new File(logFile, logProperties.getHandshakeFile()); if (!handshake.exists()) { throw new RuntimeException("Cannot find " + logProperties.getHandshakeFile()); } DataInputStream handshakeStream = new DataInputStream(new FileInputStream(handshake)); byte[] handshakeData = new byte[(int) handshake.length()]; handshakeStream.readFully(handshakeData); handshakeStream.close(); YoVariableHandshakeParser parser = new YoVariableHandshakeParser("logged"); parser.parseFrom(handshakeData); YoVariableRegistry registry = parser.getRootRegistry(); File logdata = new File(logFile, logProperties.getVariableDataFile()); if(!logdata.exists()) { throw new RuntimeException("Cannot find " + logProperties.getVariableDataFile()); } @SuppressWarnings("resource") final FileChannel logChannel = new FileInputStream(logdata).getChannel(); List<YoVariable<?>> variables = parser.getYoVariablesList(); int jointStateOffset = variables.size(); int numberOfJointStates = JointState.getNumberOfJointStates(parser.getJointStates()); int bufferSize = (1 + jointStateOffset + numberOfJointStates) * 8; new YoVariableDialog(bufferSize, logChannel, variables, registry); }
public YoVariableDialog(int bufferSize, FileChannel logChannel, List<YoVariable<?>> variables, YoVariableRegistry registry) setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Select variable"); setLocationRelativeTo(null); setLocationByPlatform(true); setSize(300, 300); this.bufferSize = bufferSize; this.registry = registry; print.addActionListener(this); Container container = getContentPane(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.add(searchField); container.add(scroller); container.add(print); setVisible(true);
@Override public void insertUpdate(DocumentEvent e) { search(e); }
@Override public void changedUpdate(DocumentEvent e) { search(e); }
@Override public void actionPerformed(ActionEvent e) { List<YoVariable<?>> results = result.getSelectedValuesList(); printVariable(results); }
@Override public void removeUpdate(DocumentEvent e) { search(e); }
@Override public void actionPerformed(ActionEvent e) { List<YoVariable<?>> results = result.getSelectedValuesList(); printVariable(results); }
@Override public void changedUpdate(DocumentEvent e) { search(e); }
@Override public void insertUpdate(DocumentEvent e) { search(e); }
@Override public void removeUpdate(DocumentEvent e) { search(e); }