void login() {
    try {
      logoutBtn.setEnabled(true);
      contactList.setEditable(false);
      loginBtn.setEnabled(false);
      loginId.setEnabled(false);
      password.setEnabled(false);

      //
      plugin.login(
          getMyLoginId(), password.getText(), getContactList(), MessagingNetwork.STATUS_ONLINE);
      logoutBtn.setEnabled(true);
    } catch (Throwable tr) {
      printException(tr);
      boolean loggedIn = false;
      try {
        loggedIn = plugin.getClientStatus(getMyLoginId()) != MessagingNetwork.STATUS_OFFLINE;
      } catch (Throwable tr2) {
        printException(tr2);
      }
      if (!loggedIn) {
        enableLoginUI();
      }
    }
  }
Exemplo n.º 2
0
 /** Returns the contents of the next text field. */
 public String getNextString() {
   String theText;
   if (stringField == null) return "";
   TextField tf = (TextField) (stringField.elementAt(sfIndex));
   theText = tf.getText();
   if (macro) {
     String label = (String) labels.get((Object) tf);
     theText = Macro.getValue(macroOptions, label, theText);
     if (theText != null
         && (theText.startsWith("&") || label.toLowerCase(Locale.US).startsWith(theText))) {
       // Is the value a macro variable?
       if (theText.startsWith("&")) theText = theText.substring(1);
       Interpreter interp = Interpreter.getInstance();
       String s = interp != null ? interp.getVariableAsString(theText) : null;
       if (s != null) theText = s;
     }
   }
   if (recorderOn) {
     String s = theText;
     if (s != null
         && s.length() >= 3
         && Character.isLetter(s.charAt(0))
         && s.charAt(1) == ':'
         && s.charAt(2) == '\\')
       s = s.replaceAll("\\\\", "\\\\\\\\"); // replace "\" with "\\" in Windows file paths
     if (!smartRecording || !s.equals((String) defaultStrings.elementAt(sfIndex)))
       recordOption(tf, s);
     else if (Recorder.getCommandOptions() == null) Recorder.recordOption(" ");
   }
   sfIndex++;
   return theText;
 }
  public void init() {
    try {
      // data init
      loginId.setText("" + cfg.REQPARAM_SRC_LOGIN_ID);
      password.setText("" + cfg.REQPARAM_SRC_PASSWORD);

      // ui init
      setLayout(new GridLayout(2, 1));
      Panel inputArea = new Panel(new BorderLayout(2, 2));
      inputArea.add(contactList, "Center");
      Panel bottomR = new Panel(new FlowLayout(FlowLayout.RIGHT));
      bottomR.add(loginBtn);
      bottomR.add(logoutBtn);
      bottomR.add(closeBtn);
      Panel bottomL = new Panel(new FlowLayout());
      bottomL.add(new Label("status:"));
      bottomL.add(clientStatus);
      bottomL.add(new Label("  contact:"));
      bottomL.add(contactListEntry);
      bottomL.add(addToContactList);
      bottomL.add(removeFromContactList);
      bottomL.add(getUserDetailsButton());
      bottomL.add(getSendContactsButton());
      Panel bottom = new Panel(new BorderLayout());
      bottom.add("Center", bottomR);
      bottom.add("West", bottomL);
      inputArea.add(bottom, "South");
      Panel leftTop = new Panel(new GridLayout(10, 1));
      leftTop.add(new Label("login id:")); // 1
      leftTop.add(loginId); // 2
      leftTop.add(new Label("password:"******""));
      leftTop.add(new Label("")); // 6

      leftTop.add(new Label("send msg"));
      leftTop.add(sendMsg); // 8
      leftTop.add(new Label("to"));
      leftTop.add(dstLoginId); // 10

      Panel left = new Panel(new FlowLayout());
      left.add(leftTop);
      inputArea.add(left, "West");
      Panel eventLogPanel = new Panel(new BorderLayout());
      eventLogPanel.add("Center", eventLog);
      Panel eventLogPanelButtons = new Panel(new FlowLayout(FlowLayout.RIGHT));
      eventLogPanelButtons.add(clearEventLogBtn);
      eventLogPanel.add("South", eventLogPanelButtons);
      add(inputArea);
      add(eventLogPanel);
      setBackground(SystemColor.control);
      doLayout();
      sendMsg.requestFocus();
    } catch (Throwable tr) {
      CAT.error("exception", tr);
      System.exit(1);
    }
  }
 /** Initializes the controller class. */
 @Override
 public void initialize(URL url, ResourceBundle rb) {
   logger.entry();
   OkButton.disableProperty()
       .bind(
           Bindings.isEmpty(FederationExecutionName.textProperty())
               .or(Bindings.isEmpty(FederateType.textProperty())));
   logger.exit();
 }
 void enableLoginUI() {
   try {
     logoutBtn.setEnabled(false);
     contactList.setEditable(true);
     loginBtn.setEnabled(true);
     loginId.setEnabled(true);
     password.setEnabled(true);
   } catch (Throwable tr) {
     CAT.error("exception", tr);
   }
 }
Exemplo n.º 6
0
 public synchronized void adjustmentValueChanged(AdjustmentEvent e) {
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     if (source == slider.elementAt(i)) {
       Scrollbar sb = (Scrollbar) source;
       TextField tf = (TextField) numberField.elementAt(sliderIndexes[i]);
       int digits = sliderScales[i] == 1.0 ? 0 : 2;
       tf.setText("" + IJ.d2s(sb.getValue() / sliderScales[i], digits));
     }
   }
 }
Exemplo n.º 7
0
 /**
  * Returns the contents of the next numeric field, or NaN if the field does not contain a number.
  */
 public double getNextNumber() {
   if (numberField == null) return -1.0;
   TextField tf = (TextField) numberField.elementAt(nfIndex);
   String theText = tf.getText();
   String label = null;
   if (macro) {
     label = (String) labels.get((Object) tf);
     theText = Macro.getValue(macroOptions, label, theText);
     // IJ.write("getNextNumber: "+label+"  "+theText);
   }
   String originalText = (String) defaultText.elementAt(nfIndex);
   double defaultValue = ((Double) (defaultValues.elementAt(nfIndex))).doubleValue();
   double value;
   boolean skipRecording = false;
   if (theText.equals(originalText)) {
     value = defaultValue;
     if (smartRecording) skipRecording = true;
   } else {
     Double d = getValue(theText);
     if (d != null) value = d.doubleValue();
     else {
       // Is the value a macro variable?
       if (theText.startsWith("&")) theText = theText.substring(1);
       Interpreter interp = Interpreter.getInstance();
       value = interp != null ? interp.getVariable2(theText) : Double.NaN;
       if (Double.isNaN(value)) {
         invalidNumber = true;
         errorMessage = "\"" + theText + "\" is an invalid number";
         value = Double.NaN;
         if (macro) {
           IJ.error(
               "Macro Error",
               "Numeric value expected in run() function\n \n"
                   + "   Dialog box title: \""
                   + getTitle()
                   + "\"\n"
                   + "   Key: \""
                   + label.toLowerCase(Locale.US)
                   + "\"\n"
                   + "   Value or variable name: \""
                   + theText
                   + "\"");
         }
       }
     }
   }
   if (recorderOn && !skipRecording) {
     recordOption(tf, trim(theText));
   }
   nfIndex++;
   return value;
 }
Exemplo n.º 8
0
 public void paint(Graphics g) {
   super.paint(g);
   if (firstPaint) {
     if (numberField != null && IJ.isMacOSX()) {
       // work around for bug on Intel Macs that caused 1st field to be un-editable
       TextField tf = (TextField) (numberField.elementAt(0));
       tf.setEditable(false);
       tf.setEditable(true);
     }
     if (numberField == null && stringField == null) okay.requestFocus();
     firstPaint = false;
   }
 }
 public void addSkillFilter(ActionEvent event) {
   final Skill skill = skillFilterComboBox.getSelectionModel().getSelectedItem();
   SkillFilter skillFilter = new SkillFilter();
   skillFilter.setSkill(skill);
   String minValueText = skillFilterMinValueComponent.getText();
   skillFilter.setMinValue(
       (minValueText == null || minValueText.isEmpty()) ? null : Integer.parseInt(minValueText));
   String maxValueText = skillFilterMaxValueComponent.getText();
   skillFilter.setMaxValue(
       (maxValueText == null || maxValueText.isEmpty()) ? null : Integer.parseInt(maxValueText));
   skillFiltersTableView.getItems().add(skillFilter);
   // We don't need to update #skillFiltersMatcher because of the biding
   // betwen skillFiltersMatcher' matchers and the items of
   // skillFiltersTableView
   updateOfficialFiltersResult();
 }
Exemplo n.º 10
0
  // we define the method for getting a video link when pressing enter
  public String getvidlink() {
    try {
      System.setSecurityManager(new SecurityManager());

      ipadd = tfIP.getText();
      Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid");

      // Get the String entered into the TextField tfInput, convert to int
      link = tfInput.getText();
      vlink = client.getvid(link);

    } catch (Exception e) {
      System.out.println("[System] Server failed: " + e);
    }
    return vlink;
  }
Exemplo n.º 11
0
  public static EventHandler<ActionEvent> getBrowseHandler(
      FXController controller, TextField filePath) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Select a file to upload...");

    return e -> {
      if (AESCTR.secretKey == null) {
        new Alert(Alert.AlertType.INFORMATION, "Please generate or choose a key", ButtonType.OK)
            .showAndWait();
        return;
      }

      selectedFiles = fileChooser.showOpenMultipleDialog(null);
      if (selectedFiles != null) {
        controller.writeLog("Selected files: ");
        StringBuilder sb = new StringBuilder(1024);

        for (int i = 0; i < selectedFiles.size(); i++) {
          if (i == selectedFiles.size() - 1) {
            sb.append(selectedFiles.get(i).getAbsolutePath());
          } else {
            sb.append(selectedFiles.get(i).getAbsolutePath() + ", ");
          }
          controller.writeLog(selectedFiles.get(i).getName());
        }
        filePath.setText(sb.toString());
      }
    };
  }
Exemplo n.º 12
0
  public void commandAction(Command c, Displayable d) {
    if (c == cmdCancel) {
      destroyView();
      return;
    }
    if (c == cmdOk) {
      try {
        int type = choiseType.getSelectedIndex();
        String value = textValue.getString();
        if (type == 2) value = PrivacyItem.subscrs[choiceSubscr.getSelectedIndex()];
        if (type != PrivacyItem.ITEM_ANY) if (value.length() == 0) return;
        // int order=Integer.parseInt(textOrder.getString());

        item.action = choiceAction.getSelectedIndex();
        item.type = type;
        item.value = value;
        // item.order=order;
        choiseStanzas.getSelectedFlags(item.stanzasSet);

        if (targetList != null)
          if (!targetList.rules.contains(item)) {
            targetList.addRule(item);
            item.order = targetList.rules.indexOf(item) * 10;
          }
        destroyView();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    urlField.setOnAction(
        event -> {
          String text = urlField.getText();
          urlField.setText("tetetetetetetete");
          webView.getEngine().load(text);
        });

    webView
        .getEngine()
        .getLoadWorker()
        .stateProperty()
        .addListener(
            (ov, oldState, newState) -> {
              if (newState == State.SUCCEEDED) {
                String url = webView.getEngine().getLocation();
                urlField.setText(url);
                if (Pattern.compile("http://item.rakuten.co.jp/.*").matcher(url).find()) {
                  try {
                    Elements tmp;
                    Document document = Jsoup.connect(url).get();
                    tmp = document.select("input");
                    tmp = tmp.select("#etime");
                    if (tmp.size() != 0) {
                      if (!(Long.parseLong(tmp.first().val()) < new Date().getTime())) {
                        entryButton.setDisable(false);
                      }
                    } else {
                      entryButton.setDisable(false);
                    }
                  } catch (Exception e) {
                    // TODO 自動生成された catch ブロック
                    e.printStackTrace();
                  }
                }
              }
              ;
            });

    entryButton.setOnAction(
        event -> {
          urlField.setText("webView disable");
          sendEntryTaskController();
        });
  }
Exemplo n.º 14
0
 public void textValueChanged(TextEvent e) {
   notifyListeners(e);
   if (slider == null) return;
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     int index = sliderIndexes[i];
     if (source == numberField.elementAt(index)) {
       TextField tf = (TextField) numberField.elementAt(index);
       double value = Tools.parseDouble(tf.getText());
       if (!Double.isNaN(value)) {
         Scrollbar sb = (Scrollbar) slider.elementAt(i);
         sb.setValue((int) (value * sliderScales[i]));
       }
       // IJ.log(i+" "+tf.getText());
     }
   }
 }
Exemplo n.º 15
0
  public void newFile() {
    infoTa.setText("");
    selectProviderCb.setValue(providers.get(0).getName());
    weightTf.setText("0.0");

    for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
      String propertyName = entry.getKey();
      TextField tf = entry.getValue();
      CheckBox cb = propertiesCb.get(propertyName);

      tf.setText("0.0");
      tf.setDisable(true);
      cb.setSelected(false);
    }

    file = null;
    mainStage.setTitle("unknown");
  }
Exemplo n.º 16
0
 private void setInterfaceDisabled(boolean disabled) {
   playlistsView.setDisable(disabled);
   searchButton.setDisable(disabled);
   searchText.setDisable(disabled);
   addButton.setDisable(disabled);
   renameButton.setDisable(disabled);
   deleteButton.setDisable(disabled);
   refreshButton.setDisable(disabled);
   interfaceDisabled = disabled;
 }
 {
   ActionListener al =
       new ActionListener() {
         public void actionPerformed(ActionEvent ev) {
           if (!(StringUtil.isNullOrTrimmedEmpty(dstLoginId.getText()))
               && !(StringUtil.isNullOrTrimmedEmpty(sendMsg.getText()))) {
             try {
               plugin.sendMessage(getMyLoginId(), dstLoginId.getText(), sendMsg.getText());
               sendMsg.setText("msg " + Math.random());
             } catch (Throwable tr) {
               printException(tr);
             }
           }
         }
       };
   sendMsg.selectAll();
   sendMsg.addActionListener(al);
   dstLoginId.addActionListener(al);
 }
 void fetchUserDetails() {
   try {
     UserDetails d = plugin.getUserDetails(getMyLoginId(), contactListEntry.getText());
     String s =
         getMyLoginId()
             + " reports: user details for "
             + contactListEntry.getText()
             + " are:\r\n  nick="
             + StringUtil.toPrintableString(d.getNick())
             + ",\r\n  real name="
             + StringUtil.toPrintableString(d.getRealName())
             + ",\r\n  email="
             + StringUtil.toPrintableString(d.getEmail())
             + ".";
     CAT.info(s);
     log(s);
   } catch (Exception ex) {
     printException(ex);
   }
 }
Exemplo n.º 19
0
  public void open(File f) {
    Properties open = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream(f);
      open.load(input);

      selectProviderCb.setValue(open.getProperty("provider"));
      selectGrainCb.setValue(open.getProperty("grain"));
      weightTf.setText(open.getProperty("weight"));
      infoTa.setText(open.getProperty("info"));

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        String propertyName = entry.getKey();
        TextField tf = entry.getValue();
        CheckBox cb = propertiesCb.get(propertyName);

        tf.setText(open.getProperty(propertyName));
        if (open.getProperty(propertyName + "_ENABLED").equals("ON")) {
          tf.setDisable(false);
          cb.setSelected(true);
        } else {
          tf.setDisable(true);
          cb.setSelected(false);
        }
      }

      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу открыть файл");
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
Exemplo n.º 20
0
 /**
  * Adds a numeric field. The first word of the label must be unique or command recording will not
  * work.
  *
  * @param label the label
  * @param defaultValue value to be initially displayed
  * @param digits number of digits to right of decimal point
  * @param columns width of field in characters
  * @param units a string displayed to the right of the field
  */
 public void addNumericField(
     String label, double defaultValue, int digits, int columns, String units) {
   String label2 = label;
   if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' ');
   Label theLabel = makeLabel(label2);
   c.gridx = 0;
   c.gridy = y;
   c.anchor = GridBagConstraints.EAST;
   c.gridwidth = 1;
   if (firstNumericField) c.insets = getInsets(5, 0, 3, 0);
   else c.insets = getInsets(0, 0, 3, 0);
   grid.setConstraints(theLabel, c);
   add(theLabel);
   if (numberField == null) {
     numberField = new Vector(5);
     defaultValues = new Vector(5);
     defaultText = new Vector(5);
   }
   if (IJ.isWindows()) columns -= 2;
   if (columns < 1) columns = 1;
   String defaultString = IJ.d2s(defaultValue, digits);
   if (Double.isNaN(defaultValue)) defaultString = "";
   TextField tf = new TextField(defaultString, columns);
   if (IJ.isLinux()) tf.setBackground(Color.white);
   tf.addActionListener(this);
   tf.addTextListener(this);
   tf.addFocusListener(this);
   tf.addKeyListener(this);
   numberField.addElement(tf);
   defaultValues.addElement(new Double(defaultValue));
   defaultText.addElement(tf.getText());
   c.gridx = 1;
   c.gridy = y;
   c.anchor = GridBagConstraints.WEST;
   tf.setEditable(true);
   // if (firstNumericField) tf.selectAll();
   firstNumericField = false;
   if (units == null || units.equals("")) {
     grid.setConstraints(tf, c);
     add(tf);
   } else {
     Panel panel = new Panel();
     panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
     panel.add(tf);
     panel.add(new Label(" " + units));
     grid.setConstraints(panel, c);
     add(panel);
   }
   if (Recorder.record || macro) saveLabel(tf, label);
   y++;
 }
Exemplo n.º 21
0
 public void textValueChanged(TextEvent e) {
   Object source = e.getSource();
   double newXScale = xscale;
   double newYScale = yscale;
   if (source == xField && fieldWithFocus == xField) {
     String newXText = xField.getText();
     newXScale = Tools.parseDouble(newXText, 0);
     if (newXScale == 0) return;
     if (newXScale != xscale) {
       int newWidth = (int) (newXScale * r.width);
       widthField.setText("" + newWidth);
       if (constainAspectRatio) {
         yField.setText(newXText);
         int newHeight = (int) (newXScale * r.height);
         heightField.setText("" + newHeight);
       }
     }
   } else if (source == yField && fieldWithFocus == yField) {
     String newYText = yField.getText();
     newYScale = Tools.parseDouble(newYText, 0);
     if (newYScale == 0) return;
     if (newYScale != yscale) {
       int newHeight = (int) (newYScale * r.height);
       heightField.setText("" + newHeight);
     }
   } else if (source == widthField && fieldWithFocus == widthField) {
     int newWidth = (int) Tools.parseDouble(widthField.getText(), 0.0);
     if (newWidth != 0) {
       int newHeight = (int) (newWidth * (double) r.height / r.width);
       heightField.setText("" + newHeight);
       xField.setText("-");
       yField.setText("-");
       newXScale = 0.0;
       newYScale = 0.0;
     }
   }
   xscale = newXScale;
   yscale = newYScale;
 }
Exemplo n.º 22
0
  public void itemStateChanged(Item item) {
    if (item == tGrpList) {
      int index = tGrpList.getSelectedIndex();
      if (index == tGrpList.size() - 1) {
        f.set(grpFIndex, tGroup);
      }
      // tGroup.setString(group(index));
    }

    // if (item==tGroup) {
    //    updateChoise(tGroup.getString(), tGrpList);
    // }

    if (item == tTranspList) {
      int index = tTranspList.getSelectedIndex();
      if (index == tTranspList.size() - 1) return;

      String transport = tTranspList.getString(index);

      String jid = tJid.getString();
      StringBuffer jidBuf = new StringBuffer(jid);

      int at = jid.indexOf('@');
      if (at < 0) at = tJid.size();

      jidBuf.setLength(at);
      jidBuf.append('@');
      jidBuf.append(transport);
      tJid.setString(jidBuf.toString());
    }
    if (item == tJid) {
      String s1 = tJid.getString();
      int at = tJid.getString().indexOf('@');
      try {
        updateChoise(s1.substring(at + 1), tTranspList);
      } catch (Exception e) {
      }
    }
  }
Exemplo n.º 23
0
  private void switchType() {
    int index = choiseType.getSelectedIndex();
    try {
      Object rfocus = StaticData.getInstance().roster.getFocusedObject();
      switch (index) {
        case 0: // jid
          if (targetList != null)
            if (rfocus instanceof Contact) {
              textValue.setString(((Contact) rfocus).getBareJid());
            }
          form.set(2, textValue);
          break;
        case 1: // group
          if (targetList != null)
            textValue.setString(
                ((rfocus instanceof Group) ? (Group) rfocus : ((Contact) rfocus).getGroup())
                    .getName());

          form.set(2, textValue);
          break;
        case 2: // subscription
          form.set(2, choiceSubscr);
          break;

        case 3:
          form.set(2, new StringItem(null, "(ANY)"));
      }
      /*if (index==2) {
          form.set(2, choiceSubscr);
      } else {
          textValue.setLabel(PrivacyItem.types[index]);
          form.set(2, textValue);
      }
       */
    } catch (Exception e) {
      /* При смене на самого себя */
    }
  }
Exemplo n.º 24
0
  // we define the method for downloading when pressing on the download button
  public void qrvidlink() {
    try {
      System.setSecurityManager(new SecurityManager());

      ipadd = tfIP.getText();
      Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid");

      // Get the String entered into the TextField tfInput, convert to int
      link = tfInput.getText();
      vlink = client.getvid(link);

      // here we receive the image serialized into bytes from the server and
      // saved it on the client as png image
      byte[] bytimg = client.qrvid(vlink);
      BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytimg));
      File outputfile = new File("qrcode.png");
      ImageIO.write(img, "png", outputfile);

      // img= new ImageIcon(bytimg.toByteArray());
    } catch (Exception e) {
      System.out.println("[System] Server failed: " + e);
    }
  }
Exemplo n.º 25
0
  public void save(File f) {
    Properties save = new Properties();
    OutputStream output = null;

    try {
      save.setProperty("provider", selectProviderCb.getValue());
      save.setProperty("grain", selectGrainCb.getValue());
      save.setProperty("weight", weightTf.getText());
      save.setProperty("info", infoTa.getText());

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        TextField tf = entry.getValue();
        String propertyName = entry.getKey();

        save.setProperty(propertyName, tf.getText());
        if (tf.isDisable()) {
          save.setProperty(propertyName + "_ENABLED", "OFF");
        } else {
          save.setProperty(propertyName + "_ENABLED", "ON");
        }
      }

      output = new FileOutputStream(f);
      save.store(output, null);
      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу сохранить в файл");
    } finally {
      if (output != null) {
        try {
          output.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
Exemplo n.º 26
0
  /** Action listener for the Buttons. */
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd.equals("ok")) {
      Truline.userProps.put("RecencyDays", recency.getText());
      Truline.userProps.put("MaxDays", maxdays.getText());
      Truline.userProps.put("MaxVariant", maxvariant.getText());
      Truline.userProps.put("UseMaiden", maiden.getText());
      Truline.userProps.put("BetFactorVersion", betFactorVersion.getText());
      Truline.userProps.put("DATADIR", datadir.getText());
      Truline.userProps.put("FontSize", fontsize.getText());
      Truline.userProps.put("PrintProgram", printProgram.getText());
      // Truline.userProps.put("Shell", shell.getText());

      try {
        FileOutputStream out = new FileOutputStream("c:/truline2012/truline.ini");
        if (Truline.userProps.getProperty("TL2013", "N").equals("Yes"))
          Truline.userProps.store(out, "Truline2013 configuration");
        else Truline.userProps.store(out, "Truline2012 configuration");
      } catch (Exception ef) {
      }

      // Make it affective
      m_gui.clear();
      if (Truline.userProps.getProperty("DATATYPE", "DRF").equals("MCP")) {
        for (Enumeration el = m_gui.m_brisMCP.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_brisMCP, m_gui, m_gui.m_raceNbr);
      } else {
        for (Enumeration el = m_gui.m_bris.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_bris, m_gui, m_gui.m_raceNbr);
      }
      dispose();
    } else if (cmd.equals("cancel")) {
      dispose();
    }
  }
Exemplo n.º 27
0
  // load the images when the applet begins executing
  public void init() {
    int i;

    this.processHTMLParameters();

    if (totalImages == 0 || imageName == null) {
      this.showStatus("Invalid parameters");
      this.destroy();
    }

    images = new Vector(totalImages, 1);

    imageTracker = new MediaTracker(this);

    for (i = 0; i < totalImages; i++) {
      images.addElement(this.getImage(this.getDocumentBase(), "images/" + imageName + i + ".gif"));
      // track loading image
      imageTracker.addImage((Image) images.elementAt(i), i);
    }

    // wait for the first image,
    //   must use a Joos version of tracker to avoid catching
    //   interruped exception
    new JoosMediaTracker(imageTracker).waitForID(0);

    width = ((Image) images.elementAt(0)).getWidth(this);
    height = ((Image) images.elementAt(0)).getHeight(this);
    this.resize(width, height + 30);

    buffer = this.createImage(width, height);
    gContext = buffer.getGraphics();

    // set background of buffer to white
    gContext.setColor(c.white());
    gContext.fillRect(0, 0, 160, 80);

    this.setLayout(new BorderLayout(10, 10));
    sleepLabel = new Label("Sleep time", c.LABEL_CENTER());
    sleepDisplay = new TextField("", 5);
    sleepDisplay.setText(new Integer(sleepTime).toString());
    sleepStuff = new Panel();
    sleepStuff.add(sleepLabel);
    sleepStuff.add(sleepDisplay);
    new JoosContainer(this).addString("South", sleepStuff);
  }
Exemplo n.º 28
0
 @FXML
 void search() {
   searching = true;
   new Thread(
           () -> {
             List<Track> tracks = Cache.search(searchText.getText());
             tracksView.setPlaceholder(searchPlaceholder);
             Platform.runLater(
                 () -> {
                   if (tracksView.getItems().size() > 0) {
                     tracksView.scrollTo(0);
                   }
                   tracksView.getItems().clear();
                   tracksView.getItems().addAll(tracks.toArray());
                 });
           })
       .start();
 }
 @FXML
 private void Ok_click(ActionEvent event) {
   logger.entry();
   LogEntry log = new LogEntry("6.16", "Local Delete Object Instance service");
   try {
     ObjectInstanceHandle instanceHandle =
         rtiAmb
             .getObjectInstanceHandleFactory()
             .decode(
                 ByteBuffer.allocate(4)
                     .putInt(Integer.parseInt(ObjectInstanceDesignator.getText()))
                     .array(),
                 0);
     log.getSuppliedArguments()
         .add(
             new ClassValuePair(
                 "Object instance designator",
                 ObjectInstanceHandle.class,
                 instanceHandle.toString()));
     rtiAmb.localDeleteObjectInstance(instanceHandle);
     log.setDescription("Local Object instance deleted successfully");
     log.setLogType(LogEntryType.REQUEST);
   } catch (FederateNotExecutionMember
       | NotConnected
       | NumberFormatException
       | CouldNotDecode
       | RTIinternalError
       | OwnershipAcquisitionPending
       | FederateOwnsAttributes
       | ObjectInstanceNotKnown
       | SaveInProgress
       | RestoreInProgress ex) {
     log.setException(ex);
     log.setLogType(LogEntryType.ERROR);
     logger.log(Level.ERROR, ex.getMessage(), ex);
   } catch (Exception ex) {
     log.setException(ex);
     log.setLogType(LogEntryType.FATAL);
     logger.log(Level.FATAL, ex.getMessage(), ex);
   }
   logEntries.add(log);
   ((Stage) OkButton.getScene().getWindow()).close();
   logger.exit();
 }
  void sendContacts() {
    try {
      int n = (int) (7 * Math.random());
      if (n < 1) n = 2;

      String[] nicks = new String[n];
      String[] loginIds = new String[n];

      int i = 0;
      while (i < n) {
        nicks[i] = "random uin #" + i;
        loginIds[i] = "" + (22222 + (int) (10000000 * Math.random()));
        i++;
      }
      plugin.sendContacts(getMyLoginId(), contactListEntry.getText(), nicks, loginIds);
    } catch (Exception ex) {
      printException(ex);
    }
  }