示例#1
0
  /**
   * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
   *     <p>de-selected view retires to Background
   */
  public void stateChanged(ChangeEvent e) {

    if (viewontop != null & !MainGUI.isSelectedView(viewontop)) {
      viewontop.toBackground();
      new Deb(debug, viewontop.getName() + "<>" + MainGUI.getSelectedView().getName());
    }
    viewontop = MainGUI.getSelectedView();
    viewontop.toFront();
  }
示例#2
0
 public synchronized void newEvent(Object source, SelectedEventType id, Ean ean, int wildcards) {
   UCCase activeview = MainGUI.getSelectedView();
   new Deb(debug, activeview.getName() + "->" + id + "->" + switchusecases.get(id));
   new Deb(debug, activeview.getName() + ": " + UCUseCases.getUsecase(activeview).ConsumedEvents);
   if (!(UCUseCases.getUsecase(activeview).ConsumedEvents == null)) {
     if (!UCUseCases.getUsecase(activeview).ConsumedEvents.contains(id)) {
       // activeview.toBackground();
       MainGUI.selectView(switchusecases.get(id));
     }
   }
   SelectedEvent.makeEvent(source, id, ean, wildcards);
 }
 // Rescale the canvas when the range of shown freqency changes
 public void changeFreqRange(int freq) {
   if (freq < this.maxFreq) {
     double scaler = (double) freq / this.maxFreq;
     this.maxFreq = freq;
     for (int i = winWidth - 1; i >= 0; i--) {
       int index = (int) Math.round(i * scaler);
       amps[i] = amps[index];
       amps1[i] = amps1[index];
       amps2[i] = amps2[index];
     }
     repaint();
   } else if (freq > this.maxFreq) {
     double multiplier = (double) freq / this.maxFreq;
     this.maxFreq = freq;
     for (int i = 0; i < (int) (winWidth * (1 / multiplier)); i++) {
       amps[i] = amps[(int) Math.round(i * multiplier)];
       amps1[i] = amps1[(int) Math.round(i * multiplier)];
       amps2[i] = amps2[(int) Math.round(i * multiplier)];
     }
     for (int j = (int) (winWidth * (1 / multiplier)); j < winWidth; j++) {
       amps[j] = winHeight / 2;
       amps1[j] = winHeight / 2;
       amps2[j] = winHeight / 2;
     }
     repaint();
   }
   recalc();
   parent.requestUpdateWaveform();
 }
示例#4
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed

    user = jTextField1.getText();
    pass = jPasswordField1.getText();
    ps.setBenutzer(user);
    try {
      ps.connect(host, port, user, pass);
    } catch (XMPPException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    dispose();
    MainGUI mg = new MainGUI();
    mg.setPubSub(ps);
    mg.setVisible(true);
  } // GEN-LAST:event_jButton1ActionPerformed
 public void blend(double ratio) {
   if (haveSet1 && haveSet2) {
     for (int i = 0; i < amps.length; i++)
       amps[i] = (int) ((1 - ratio) * amps1[i] + ratio * amps2[i]);
     repaint();
     recalc();
     parent.requestUpdateWaveform();
   }
 }
示例#6
0
  public void actionPerformed(ActionEvent evt) {
    int nr = -1;

    String[][] commandString = {
      {"Drucken", "Schliessen"},
      {"Rangliste", "Verein", "Schiedsrichter", "Turnierdaten"},
      {"Person erstellen/suchen"},
      {"Tabelleninfo"}
    };

    for (int i = 0; i < commandString.length; i++)
      for (int j = 0; j < commandString[i].length; j++)
        if (commandString[i][j].equals(evt.getActionCommand())) {
          nr = i * 10 + j;
          break;
        }

    switch (nr) {
      case 0:
        aMainGUI.callBackPrintJMenueItem();
        break;
      case 1:
        aMainGUI.exitMainGUI();
        break;
      case 10:
        aMainGUI.callBackSelectJMenuItem("spieler");
        break;
      case 11:
        aMainGUI.callBackSelectJMenuItem("verein");
        break;
      case 12:
        aMainGUI.callBackSelectJMenuItem("schiedsrichter");
        break;
      case 13:
        aMainGUI.callBackSelectJMenuItem("turnierdaten");
        break;
      case 20:
        aMainGUI.callBackEditJMenuItem();
        break;
      case 30:
        aMainGUI.callBackInfoTablesJMenuItem();
        break;

      default:
        System.out.println("Nicht definiertes Ereignis !");
        break;
    }
  }
示例#7
0
文件: Slices.java 项目: EICT/C-BAS
  private void showAddMemberDialog() {
    Slice slice = (Slice) sliceList.getSelectedValue();
    HashSet<String> existingMembers = new HashSet<String>();
    for (int i = 0; i < slice.members.size(); i++) existingMembers.add(slice.members.get(i).urn);

    HashSet<String> nonMembers = new HashSet<String>();
    Object[] allMembers = mainGUI.getMembersArray();

    for (int i = 0; i < allMembers.length; i++) {
      Member m = (Member) allMembers[i];

      // Ignore Revoked members
      if (MemberAuthorityAPI.crl.getRevokedCertificate(m.cert) != null) continue;

      String urn = m.urn;
      if (!existingMembers.contains(urn)) nonMembers.add(urn);
    }

    String[] choiceArray = nonMembers.toArray(new String[0]);
    if (choiceArray.length == 0) {
      JOptionPane.showMessageDialog(
          Slices.this,
          "There are no more active members to add to this slice.",
          "Add Member",
          JOptionPane.INFORMATION_MESSAGE);
    } else {
      String newMember =
          (String)
              JOptionPane.showInputDialog(
                  null,
                  "Select new member for slice " + slice.name + "\n",
                  "Add Member",
                  JOptionPane.PLAIN_MESSAGE,
                  null,
                  choiceArray,
                  choiceArray[0]);
      if (newMember != null) {
        Membership mem = SliceAuthorityAPI.addMember(slice.urn, newMember, "SLICE");
        if (mem != null) {
          tableModel.add(newMember, "MEMBER");
          slice.members.add(mem);
        } else showErrorMessage();
      }
    }
  }
示例#8
0
    @Override
    public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub
      JFileChooser chooser = new JFileChooser(fi);

      int returnVal = chooser.showOpenDialog(getParent());
      if (returnVal == JFileChooser.APPROVE_OPTION) {

        // hole dir das gewählte File vom chooser , wandle es in eine path string um und rufe von
        // Zentralverwltung die laden methode auf mit diesem path string
        this.fi = chooser.getSelectedFile();
        Zentralverwaltung.getInstance().laden(this.fi.getPath());

        myArea.append("\nDaten wurden erfolgreich eingelesen aus:" + "\n" + this.fi.getPath());
      }

      // aktualisiere tabelle
      MainGUI.getInstance().x.myTable.getModel().fireTableDataChanged();
    }
示例#9
0
 private void showMonomeDisplay() {
   if (monomeDisplayFrame == null || monomeDisplayFrame.isClosed()) {
     MonomeConfiguration monomeConfiguration =
         MonomeConfigurationFactory.getMonomeConfiguration(index);
     monomeDisplayFrame =
         new MonomeDisplayFrame(monomeConfiguration.sizeX, monomeConfiguration.sizeY);
     MainGUI.getDesktopPane().add(monomeDisplayFrame);
     try {
       monomeDisplayFrame.setSelected(true);
     } catch (PropertyVetoException e) {
       e.printStackTrace();
     }
   } else {
     try {
       monomeDisplayFrame.setSelected(true);
     } catch (PropertyVetoException e) {
       e.printStackTrace();
     }
   }
 }
示例#10
0
 // Drawing are implemented here
 private void paintPoint(int x, int y) {
   if (x < 0 && x > -10) x = 0;
   else if (x >= winWidth && x < winWidth + 10) x = winWidth - 1;
   if (y < 0) y = 0;
   if (y > winHeight) y = winHeight;
   if (x >= 0 && x < winWidth) {
     amps[x] = y;
     if (oldX < x) {
       for (int i = oldX; i < x; i++)
         amps[i] = (int) (amps[oldX] + (double) (i - oldX) / (x - oldX) * (amps[x] - amps[oldX]));
     } else {
       for (int i = x; i < oldX; i++)
         amps[i] = (int) (amps[x] + (double) (i - x) / (oldX - x) * (amps[oldX] - amps[x]));
     }
     repaint();
     oldX = x;
     recalc();
     parent.requestUpdateWaveform();
   }
 }
示例#11
0
  public Control() {
    app_settings_pane =
        new FLGProperties(
            app_settings, propertyfilename, new File(defaultfilename), significantstring);
    app_settings = app_settings_pane.getProperties();
    new Deb(debug, "fetched properties");
    if (!UDataBaseConnect.getDataBankDrivers(app_settings))
      javax.swing.JOptionPane.showMessageDialog(
          null,
          "'sun.jdbc.odbc.JdbcOdbcDriver' or 'com.mysql.jdbc.Driver' nicht gefunden.\nDas Programm wird jetzt beendet");

    do {

      connection = UDataBaseConnect.getConnection(app_settings);
      if (connection == null) {
        VPVDialog.showSettingsDialog(app_settings_pane);
      }
      new Deb(debug, "connecting");
    } while (connection == null);
    new Deb(debug, "connected");
    thecontrol = this;
    // USQLQuery.setParams(this,connection);
    // new Deb(debug,"initialized UtilsParams");
    bvs = new UStorage(this, connection);
    new Deb(debug, "initialized bvs");
    OBUBookUse.init();
    new Deb(debug, "initialized OBUBuukUse");
    EtikettDruck.setPropertyFileStrings(
        propertyfilenameett, defaultfilenameett, significantstringett);
    new Deb(debug, "set EtikettDruck.setPropertyFileStrings");
    mainGUI = new MainGUI(this);
    new Deb(debug, "initialized mainGUI");
    ((VBVCSVImporterView) (UCUseCases.Datenimport.view)).init(mainGUI);
    new Deb(debug, "initialized BVCSV");
    switchusecases = UCUseCases.getSelected2Usecases();
    new Deb(debug, "initialized switchusecases");
    scanner = new ScanAdapter(this);
    new Deb(debug, "initialized SCANNER");
    MainGUI.selectView(UCUseCases.Ausleihe); // default usecase
    new Deb(debug, "End of Constructor of Control");
  }
示例#12
0
  public void run() {
    currencies();
    if (key.isExits()) {

      InputStream is;
      try {
        is =
            new URL("https://openexchangerates.org/api/latest.json?app_id=" + key.getKey())
                .openStream();
        if (Rate.exists()) {
          Rate.delete();
        }

        Files.copy(is, Rate.toPath(), REPLACE_EXISTING);
        MainGUI.PrintStatus("Download successful.");
        is.close();
      } catch (MalformedURLException ex) {
        Logger.getLogger(DownloadJSON.class.getName()).log(Level.SEVERE, null, ex);
      } catch (IOException ex) {
        Logger.getLogger(DownloadJSON.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
示例#13
0
    @Override
    public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub
      String infomessage = new String();

      infomessage =
          ("\n### Status ###"
              + "\nUSB-Port :    "
              + COMport.getInstance().getSelectedPort()
              + "\nExecution-status: "
              + MainGUI.getInstance().getExecutor()
              + "\n(für BedienungsInformationen oder sonstige Hinweise öffnen sie bitte die Bedienungsanleitung"
              + "\nunter Information -> show manual)"
              + "\n#############");

      myArea.append(infomessage);

      /*myArea.append("\nDieses kleine Tool dient zur Erzeugung und zur Verwaltung von Steuercommands.\n"
      				+"Der Linke Teil der Oberfläche stellt Prototypen für zu erzeugenede Commands bereit.\n"
      				+"Der mittlere teil der Oberfläche stellt den Command Vector in einer Tabelle dar.\n"
      				+"Der rechte Teil der Oberfläche stellt je nach markiertem ListenElement die benötigten Konfigurationsfenster bereit.\n"
      				+"Falls Sie eine Benutzer-Anleitung suchen drücken Sie bitte in der Menüleiste auf Info und anschließend auf 'show manual'. \n" );
      */
    }
示例#14
0
 public static void main(String[] args) {
   main = new MainGUI();
   main.init();
 }
示例#15
0
文件: Slices.java 项目: EICT/C-BAS
  private Slice showNewSliceDialog() {
    Object[] allProjects = mainGUI.getProjectsArray();

    if (allProjects.length == 0) {
      JOptionPane.showMessageDialog(
          this, "Please first create a project.", "Create Slice", JOptionPane.INFORMATION_MESSAGE);
      return null;
    }

    String[] projectNames = new String[allProjects.length];
    for (int i = 0; i < projectNames.length; i++) projectNames[i] = ((Project) allProjects[i]).name;

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(10, 0, 0, 0); // top padding
    c.weightx = 0.1;
    c.gridx = 0;
    c.gridy = 0;
    infoPanel.add(new JLabel("Name:"), c);
    c.gridy = 1;
    infoPanel.add(new JLabel("Project:"), c);
    c.gridy = 2;
    infoPanel.add(new JLabel("Description:"), c);

    JComboBox projectBox = new JComboBox(projectNames);
    JTextField name = new JTextField("");
    AbstractDocument doc = (AbstractDocument) name.getDocument();
    doc.setDocumentFilter(new PatternFilter("^[a-zA-Z0-9][-a-zA-Z0-9]{0,18}"));

    name.setColumns(30);
    JTextArea desc = new JTextArea("");

    c.weightx = 0.9;
    c.gridx = 1;
    c.gridy = 0;
    infoPanel.add(name, c);
    c.gridy = 1;
    infoPanel.add(projectBox, c);
    c.gridy = 2;
    c.ipady = 100;
    infoPanel.add(new JScrollPane(desc), c);

    int response;
    do {
      response =
          JOptionPane.showConfirmDialog(
              this,
              infoPanel,
              "New Slice",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.PLAIN_MESSAGE);
      name.setBackground(name.getText().trim().length() == 0 ? Color.pink : Color.white);
      desc.setBackground(desc.getText().trim().length() == 0 ? Color.pink : Color.white);
    } while ((name.getText().length() == 0 || desc.getText().length() == 0)
        && response == JOptionPane.OK_OPTION);

    if (response != JOptionPane.OK_OPTION) return null;
    else {
      Slice d = new Slice();
      d.name = name.getText().trim();
      d.desc = desc.getText().trim();
      d.urnProject = ((Project) allProjects[projectBox.getSelectedIndex()]).urn;
      return d;
    }
  }
示例#16
0
 // Clear the frame
 public void clear() {
   for (int i = 0; i < winWidth; i++) amps[i] = winHeight / 2;
   repaint();
   recalc();
   parent.requestUpdateWaveform();
 }