Ejemplo n.º 1
0
 @Override
 public void keyReleased(KeyEvent e) {
   if (e.getSource() == msgChoice) {
     if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_TAB) {
       messageToListen = msgChoice.getText();
       reset();
     }
   }
   if (e.getSource() == systemField) {
     if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_TAB) {
       changeListenedSystem(systemField.getText());
       reset();
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public void initSubPanel() {

    JMenuItem item =
        addMenuItem(I18n.text("Advanced") + ">" + I18n.text("IMC Inspector"), null, action);
    item.setAccelerator(KeyStroke.getKeyStroke("control B"));
    possibleValues.add("");
    for (String s : IMCDefinition.getInstance().getMessageNames()) {
      possibleValues.add(s);
    }

    msgChoice = new Java2sAutoTextField(possibleValues);

    // Initialize Inspector dialog
    inspector = getInspectorDialog();

    msgChoice.setText("EstimatedState");
  }
Ejemplo n.º 3
0
  private JDialog getInspectorDialog() {
    final JDialog dialog =
        new JDialog(getConsole()) {

          @Override
          public void setVisible(boolean b) {
            super.setVisible(b);
          }
        };

    JButton btnClose =
        new JButton(
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                dialog.dispose();
              }
            });
    JButton btnPlot =
        new JButton(
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                ArrayList<String> msgs = new ArrayList<String>();
                ArrayList<String> vars = new ArrayList<String>();

                for (JTextArea jta : new PlotConfigDialog().getConfig()) {
                  String s[] = jta.getText().split("\\.");

                  if (s == null || s.length != 2) // Dummy fix/safeguard //FIXME jqcorreia
                  continue;

                  msgs.add(s[0]);
                  vars.add(s[1]);
                }

                final ImcChart chart =
                    new ImcChart(
                        systemField.getText(),
                        msgs,
                        vars,
                        EntitiesResolver.getEntities(systemField.getText()));

                JDialog plotDialog = new JDialog(getConsole());
                plotDialog.setSize(640, 480);
                plotDialog.add(chart);
                plotDialog.setVisible(true);
                // dialog.setTitle(msgChoice.getText() + "." + field + " (" + systemField.getText()
                // + ")");
                plotDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

                plotDialog.addWindowListener(
                    new WindowAdapter() {
                      @Override
                      public void windowClosing(WindowEvent e) {
                        chart.stop();
                      }
                    });
              }
            });

    btnPlot.setText("Plot Data");
    JButton btnPlotXY =
        new JButton(
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                final ImcChartXY chart = new ImcChartXY(systemField.getText());

                JDialog dialog = new JDialog(getConsole());
                dialog.setTitle(systemField.getText());
                dialog.setSize(640, 480);
                dialog.add(chart);
                dialog.setVisible(true);
                dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

                dialog.addWindowListener(
                    new WindowAdapter() {
                      @Override
                      public void windowClosing(WindowEvent e) {
                        chart.stop();
                      }
                    });
              }
            });

    btnPlot.setText("Plot Data");
    btnPlotXY.setText("Plot XY Data");
    btnClose.setText("Close");

    dialog.setLayout(new MigLayout());
    dialog.setSize(640, 500);
    dialog.setTitle("IMC Inspector");
    jsp = new JScrollPane(pane);
    jsp.getVerticalScrollBar().setUnitIncrement(10);
    systemField.setText(getConsole().getMainSystem());
    dialog.add(systemLabel);
    dialog.add(systemField, "grow, wrap");
    dialog.add(msgLabel);
    dialog.add(msgChoice, "grow, wrap");

    dialog.add(btnPlot);
    dialog.add(btnPlotXY, "wrap");
    dialog.add(jsp, "w 100%, h 100%, grow, span 2, wrap");
    dialog.add(btnClose);

    msgChoice.addKeyListener(this);
    systemField.addKeyListener(this);
    dialog.addKeyListener(this);
    dialog.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    return dialog;
  }
Ejemplo n.º 4
0
 @Override
 public void actionPerformed(ActionEvent e) {
   changeListenedSystem(getConsole().getMainSystem());
   inspector.setVisible(true);
   msgChoice.requestFocus();
 }