Ejemplo n.º 1
1
 @Override
 public void paintChildren(Graphics g) {
   super.paintChildren(g);
   if (exitAfterFirstPaint) {
     System.exit(0);
   }
 }
Ejemplo n.º 2
0
 private ClassLoaderStrategy getClassLoaderStrategy(String fullyQualifiedClassName)
     throws Exception {
   try {
     // Get just the package name
     StringBuffer sb = new StringBuffer(fullyQualifiedClassName);
     sb.delete(sb.lastIndexOf("."), sb.length());
     currentPackage = sb.toString();
     // Retrieve the Java classpath from the system properties
     String cp = System.getProperty("java.class.path");
     String sepChar = System.getProperty("path.separator");
     String[] paths = StringUtils.pieceList(cp, sepChar.charAt(0));
     ClassLoaderStrategy cl =
         ClassLoaderUtil.getClassLoader(ClassLoaderUtil.FILE_SYSTEM_CLASS_LOADER, new String[] {});
     // Iterate through paths until class with the specified name is found
     String classpath = StringUtils.replaceChar(currentPackage, '.', File.separatorChar);
     for (int i = 0; i < paths.length; i++) {
       Class[] classes = cl.getClasses(paths[i] + File.separatorChar + classpath, currentPackage);
       for (int j = 0; j < classes.length; j++) {
         if (classes[j].getName().equals(fullyQualifiedClassName)) {
           return ClassLoaderUtil.getClassLoader(
               ClassLoaderUtil.FILE_SYSTEM_CLASS_LOADER, new String[] {paths[i]});
         }
       }
     }
     throw new Exception("Class could not be found.");
   } catch (Exception e) {
     System.err.println("Exception creating class loader strategy.");
     System.err.println(e.getMessage());
     throw e;
   }
 }
  /** Updates Jitsi icon notification to reflect current global status. */
  public void updateJitsiIconNotification() {
    String status;
    if (getGlobalStatus().isOnline()) {
      // At least one provider is online
      status = JitsiApplication.getResString(R.string.service_gui_ONLINE);
    } else {
      // There are no active providers so we consider to be in
      // the offline state
      status = JitsiApplication.getResString(R.string.service_gui_OFFLINE);
    }

    int notificationID = OSGiService.getGeneralNotificationId();
    if (notificationID == -1) {
      logger.debug(
          "Not displaying status notification because"
              + " there's no global notification icon available.");
      return;
    }

    AndroidUtils.updateGeneralNotification(
        JitsiApplication.getGlobalContext(),
        notificationID,
        JitsiApplication.getResString(R.string.app_name),
        status,
        System.currentTimeMillis());
  }
  /**
   * Sets the time in milliseconds of the last activity related to this <tt>Conference</tt> to the
   * current system time.
   */
  public void touch() {
    long now = System.currentTimeMillis();

    synchronized (this) {
      if (getLastActivityTime() < now) lastActivityTime = now;
    }
  }
 /** Cancel all active downloads. */
 public void cancelActiveDownloads() {
   for (Component c : this.monitorPanel.getComponents()) {
     if (c instanceof DownloadMonitorPanel) {
       if (((DownloadMonitorPanel) c).thread.isAlive()) {
         DownloadMonitorPanel panel = (DownloadMonitorPanel) c;
         panel.cancelButtonActionPerformed(null);
         try {
           // Wait for thread to die before moving on
           long t0 = System.currentTimeMillis();
           while (panel.thread.isAlive() && System.currentTimeMillis() - t0 < 500) {
             Thread.sleep(10);
           }
         } catch (Exception ignore) {
         }
       }
     }
   }
 }
Ejemplo n.º 6
0
    public final String[] getTags() {
      final String[] parents = super.getTags();
      final String[] newS = new String[parents.length + 2];

      System.arraycopy(parents, 0, newS, 0, parents.length);
      newS[parents.length] = "'T+' SSS";
      newS[parents.length + 1] = "'T+' MM:SS";

      return newS;
    }
Ejemplo n.º 7
0
    private void getFileList() {
      myMessage.stateChanged("REMOTEFILELIST");
      URL theURL = null;
      ;
      try {
        theURL = new URL(myProperties.getProperty("BASEURL"));
      } catch (MalformedURLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
      ;

      String theRemoteBaseDir = myProperties.getProperty("REMOTEBASEDIR");
      Properties props = System.getProperties();
      props.put("http.proxyHost", myProperties.getProperty("PROXYHOST"));
      props.put("http.proxyPort", myProperties.getProperty("PROXYPORT"));
      String data = "";
      try {
        data =
            URLEncoder.encode("filelocation", "UTF-8")
                + "="
                + URLEncoder.encode(theRemoteBaseDir, "UTF-8");
        data +=
            "&"
                + URLEncoder.encode("fileprocess", "UTF-8")
                + "="
                + URLEncoder.encode("REMOTEFILELIST", "UTF-8");

        URLConnection conn = theURL.openConnection();
        conn.setDoOutput(true);
        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();
        myMessage.messageChanged(0, "Get the File List");
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line2;
        myFileList = new HashMap<String, List>();
        while (((line2 = rd.readLine()) != null) && !isCancelled()) {
          CSV parser = new CSV('|');
          List theFileList = parser.parse(line2);
          // myFileList.put((String)theFileList.get(1), theFileList);
          for (int i = 0; i < theFileList.size(); i++) {
            if (i == 1) {
              myFileList.put((String) theFileList.get(i), theFileList);
            }
          }
        }
        rd.close();
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
Ejemplo n.º 8
0
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }
Ejemplo n.º 9
0
 /**
  * Gets the list of the vnmrj users(operators) for the current unix user logged in
  *
  * @return the list of vnmrj users
  */
 protected Object[] getOperators() {
   String strUser = System.getProperty("user.name");
   User user = LoginService.getDefault().getUser(strUser);
   ArrayList<String> aListOperators = user.getOperators();
   if (aListOperators == null || aListOperators.isEmpty())
     aListOperators = new ArrayList<String>();
   Collections.sort(aListOperators);
   if (aListOperators.contains(strUser)) aListOperators.remove(strUser);
   aListOperators.add(0, strUser);
   return (aListOperators.toArray());
 }
Ejemplo n.º 10
0
 /**
  * Checks that there are enough security permissions to make popup "always on top", which allows
  * to show it above the task bar.
  */
 static boolean canPopupOverlapTaskBar() {
   boolean result = true;
   try {
     SecurityManager sm = System.getSecurityManager();
     if (sm != null) {
       sm.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
     }
   } catch (SecurityException se) {
     // There is no permission to show popups over the task bar
     result = false;
   }
   return result;
 }
Ejemplo n.º 11
0
 public void manageThreads() {
   try {
     DDTP request = new DDTP();
     request.setRequestID(String.valueOf(System.currentTimeMillis()));
     DDTP response = channel.sendRequest("ThreadProcessor", "manageThreadsLoad", request);
     if (response != null) {
       DialogThreadManager dlg =
           new DialogThreadManager(this, channel, response.getVector("vtTableData"));
       dlg.setComboStartupType(response.getVector("vtStartupType"), "");
       WindowManager.centeredWindow(dlg);
     }
   } catch (Exception e) {
     e.printStackTrace();
     MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
   }
 }
  protected void setupPortEditors() {
    viewer.setCellEditors(new CellEditor[] {null, new TextCellEditor(ports)});

    ICellModifier cellModifier =
        new ICellModifier() {
          public Object getValue(Object element, String property) {
            ServerPort sp = (ServerPort) element;
            if (sp.getPort() < 0) return "-";
            return sp.getPort() + "";
          }

          public boolean canModify(Object element, String property) {
            if ("port".equals(property)) return true;

            return false;
          }

          public void modify(Object element, String property, Object value) {
            try {
              Item item = (Item) element;
              ServerPort sp = (ServerPort) item.getData();
              int port = Integer.parseInt((String) value);
              execute(new ModifyPortCommand(tomcatConfiguration, sp.getId(), port));
            } catch (Exception ex) {
              // ignore
            }
          }
        };
    viewer.setCellModifier(cellModifier);

    // preselect second column (Windows-only)
    String os = System.getProperty("os.name");
    if (os != null && os.toLowerCase().indexOf("win") >= 0) {
      ports.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
              try {
                int n = ports.getSelectionIndex();
                viewer.editElement(ports.getItem(n).getData(), 1);
              } catch (Exception e) {
                // ignore
              }
            }
          });
    }
  }
Ejemplo n.º 13
0
  ////////////////////////////////////////////////////////
  // Purpose: send message stop server
  // Author: TrungDD
  // Date: 10/2003
  ////////////////////////////////////////////////////////
  public void stopServer() {
    if (MessageBox.showConfirmDialog(
            this,
            MonitorDictionary.getString("Confirm.Shutdown"),
            Global.APP_NAME,
            MessageBox.YES_NO_OPTION)
        == MessageBox.NO_OPTION) return;

    try {
      DDTP request = new DDTP();
      request.setRequestID(String.valueOf(System.currentTimeMillis()));
      channel.sendRequest("ThreadProcessor", "closeServer", request);
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }
Ejemplo n.º 14
0
  static {
    Real mLfc = null;

    try {
      mLfc =
          (Real)
              RealType.getRealType(
                      "LevelOfFreeConvection", AirPressure.getRealType().getDefaultUnit())
                  .missingData();
    } catch (Exception e) {
      System.err.print("Couldn't initialize class: ");
      e.printStackTrace();
      System.exit(1);
    }

    missingLfc = mLfc;
  }
Ejemplo n.º 15
0
 public final BeanInfo[] getAdditionalBeanInfo() {
   BeanInfo[] res = null;
   if (_thePainterManager != null) {
     // see if the painter manager has any additionals aswell
     final BeanInfo pm = _thePainterManager.getInfo();
     final BeanInfo[] adds = pm.getAdditionalBeanInfo();
     if (adds != null) {
       final BeanInfo[] res3 = new BeanInfo[adds.length + 1];
       System.arraycopy(adds, 0, res3, 0, adds.length);
       res3[res3.length - 1] = pm;
       res = res3;
     } else {
       final BeanInfo[] res2 = {_thePainterManager.getInfo()};
       res = res2;
     }
   }
   return res;
 }
Ejemplo n.º 16
0
  public boolean startDownload(final FrostDownloadItem dlItem) {

    if (dlItem == null || dlItem.getState() != FrostDownloadItem.STATE_WAITING) {
      return false;
    }

    dlItem.setDownloadStartedTime(System.currentTimeMillis());

    dlItem.setState(FrostDownloadItem.STATE_PROGRESS);

    final String gqid = dlItem.getGqIdentifier();
    final File targetFile = new File(dlItem.getDownloadFilename());
    boolean isDda =
        fcpTools.startPersistentGet(dlItem.getKey(), gqid, targetFile, dlItem.getPriority());
    dlItem.setDirect(!isDda);

    return true;
  }
Ejemplo n.º 17
0
  /**
   * Returns an instance of the default toolkit. The default toolkit is the subclass of <code>
   * Toolkit</code> specified in the system property <code>awt.toolkit</code>, or <code>
   * gnu.java.awt.peer.gtk.GtkToolkit</code> if the property is not set.
   *
   * @return An instance of the system default toolkit.
   * @error AWTError If the toolkit cannot be loaded.
   */
  public static Toolkit getDefaultToolkit() {
    if (toolkit != null) return (toolkit);

    String toolkit_name = System.getProperty("awt.toolkit", default_toolkit_name);

    try {
      Class cls = Class.forName(toolkit_name);
      Object obj = cls.newInstance();

      if (!(obj instanceof Toolkit))
        throw new AWTError(toolkit_name + " is not a subclass of " + "java.awt.Toolkit");

      toolkit = (Toolkit) obj;
      return (toolkit);
    } catch (Exception e) {
      throw new AWTError("Cannot load AWT toolkit: " + e.getMessage());
    }
  }
Ejemplo n.º 18
0
  public boolean play() {

    try {
      if (playState != STOPPED) playStop();

      if (audioBytes == null) return false;

      DataLine.Info info = new DataLine.Info(Clip.class, format);

      clip = (Clip) AudioSystem.getLine(info);
      clip.addLineListener(new ClipListener());

      long clipStart = (long) (audioBytes.length * getStartTime() / (getDuration() * 1000.0));
      long clipEnd = (long) (audioBytes.length * getEndTime() / (getDuration() * 1000.0));
      if ((clipEnd - clipStart) > MAX_CLIP_LENGTH) clipEnd = clipStart + MAX_CLIP_LENGTH;
      byte[] clipBytes = new byte[(int) (clipEnd - clipStart)];
      System.arraycopy(audioBytes, (int) clipStart, clipBytes, 0, clipBytes.length);
      clip.open(format, clipBytes, 0, clipBytes.length);

      FloatControl panControl = (FloatControl) clip.getControl(FloatControl.Type.PAN);

      panControl.setValue((float) panSetting / 100.0f);

      double value = (double) gainSetting;

      FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
      float dB = (float) (Math.log(value == 0.0 ? 0.0001 : value) / Math.log(10.0) * 20.0);
      gainControl.setValue(dB);
      double playStartTime = (player.getSeekTime() / 100) * (playGetLength());
      clip.setMicrosecondPosition((long) playStartTime);

      clip.start();

      playState = PLAYING;

      return true;

    } catch (Exception ex) {
      ex.printStackTrace();
      playState = STOPPED;
      clip = null;
      return false;
    }
  }
Ejemplo n.º 19
0
  static {
    Real mdp = null;
    Real mp = null;
    Real mws = null;

    try {
      mdp = (Real) DewPoint.getRealType().missingData();
      mp = (Real) AirPressure.getRealType().missingData();
      mws = (Real) WaterVaporMixingRatio.getRealType().missingData();
    } catch (Exception e) {
      System.err.print("Couldn't initialize class: ");
      e.printStackTrace();
      System.exit(1);
    }

    missingDewPoint = mdp;
    missingPres = mp;
    missingWsat = mws;
  }
Ejemplo n.º 20
0
  // Called on EDT
  public void propertyChange(PropertyChangeEvent ev) {
    String prop = ev.getPropertyName();

    if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
      ConnectionState newState = (ConnectionState) ev.getNewValue();

      switch (newState) {
        case DISCONNECTED:
          synchronized (this) {
            long time = System.currentTimeMillis();
            times.add(time);
            for (Sequence seq : seqs) {
              seq.add(Long.MIN_VALUE);
            }
          }
          break;
      }
    }
  }
Ejemplo n.º 21
0
  /**
   * Called with a DjVuBean property has changed.
   *
   * @param e the PropertyChangeEvent.
   */
  public void propertyChange(final PropertyChangeEvent e) {
    try {
      final String name = e.getPropertyName();

      if ("page".equalsIgnoreCase(name)) {
        final Object object = e.getNewValue();

        if (object instanceof Number) {
          setCheckedPage(((Number) object).intValue() - 1);
        }
      } else if ("propertyName".equalsIgnoreCase(name)) {
        final String propertyName = (String) e.getNewValue();

        if ("navpane".equalsIgnoreCase(propertyName)) {
          setVisible("Outline".equalsIgnoreCase(djvuBean.properties.getProperty(propertyName)));
        }
      }
    } catch (final Throwable exp) {
      exp.printStackTrace(DjVuOptions.err);
      System.gc();
    }
  }
Ejemplo n.º 22
0
  public boolean startUpload(final FrostUploadItem ulItem) {
    if (ulItem == null || ulItem.getState() != FrostUploadItem.STATE_WAITING) {
      return false;
    }

    ulItem.setUploadStartedMillis(System.currentTimeMillis());

    ulItem.setState(FrostUploadItem.STATE_PROGRESS);

    // start the upload
    final boolean doMime;
    final boolean setTargetFileName;
    if (ulItem.isSharedFile()) {
      doMime = false;
      setTargetFileName = false;
    } else {
      doMime = true;
      setTargetFileName = true;
    }

    // try to start using DDA
    boolean isDda =
        fcpTools.startPersistentPutUsingDda(
            ulItem.getGqIdentifier(),
            ulItem.getFile(),
            ulItem.getFileName(),
            doMime,
            setTargetFileName,
            ulItem.getCompress(),
            ulItem.getFreenetCompatibilityMode(),
            ulItem.getPriority());

    if (!isDda) {
      // upload was not startet because DDA is not allowed...
      // if UploadManager selected this file then it is not already in progress!
      directTransferQueue.appendItemToQueue(ulItem);
    }
    return true;
  }
Ejemplo n.º 23
0
  public boolean writeSequence(NoteList noteList) {

    this.noteList = noteList;

    toneMap = toneMapFrame.getToneMap();
    timeSet = toneMap.getTimeSet();
    pitchSet = toneMap.getPitchSet();
    timeRange = timeSet.getRange();
    pitchRange = pitchSet.getRange();

    if (!buildNoteSequence()) return false;

    try {
      sequence = new Sequence(Sequence.PPQ, 10);
    } catch (Exception ex) {
      ex.printStackTrace();
      return false;
    }

    track = sequence.createTrack();
    startTime = System.currentTimeMillis();

    // add a program change right at the beginning of
    // the track for the current instrument

    createEvent(PROGRAM, cc.program + 1, 1);

    for (int i = 0; i < noteSequence.size(); i++) {
      noteSequenceElement = noteSequence.get(i);
      if (noteSequenceElement.state == ON)
        if (!createEvent(NOTEON, noteSequenceElement.note, noteSequenceElement.tick)) return false;
      if (noteSequenceElement.state == OFF)
        if (!createEvent(NOTEOFF, noteSequenceElement.note, noteSequenceElement.tick)) return false;
    }
    return true;
  }
 public void quit() {
   System.exit(0);
 }
Ejemplo n.º 25
0
 private static Object extendArray(Object a1) {
   int n = Array.getLength(a1);
   Object a2 = Array.newInstance(a1.getClass().getComponentType(), n + ARRAY_SIZE_INCREMENT);
   System.arraycopy(a1, 0, a2, 0, n);
   return a2;
 }
Ejemplo n.º 26
0
    public void actionPerformed(ActionEvent e) {
      if (isDirectorySelected()) {
        File dir = getDirectory();
        if (dir != null) {
          try {
            // Strip trailing ".."
            dir = ShellFolder.getNormalizedFile(dir);
          } catch (IOException ex) {
            // Ok, use f as is
          }
          changeDirectory(dir);
          return;
        }
      }

      JFileChooser chooser = getFileChooser();

      String filename = getFileName();
      FileSystemView fs = chooser.getFileSystemView();
      File dir = chooser.getCurrentDirectory();

      if (filename != null) {
        // Remove whitespaces from end of filename
        int i = filename.length() - 1;

        while (i >= 0 && filename.charAt(i) <= ' ') {
          i--;
        }

        filename = filename.substring(0, i + 1);
      }

      if (filename == null || filename.length() == 0) {
        // no file selected, multiple selection off, therefore cancel the approve action
        resetGlobFilter();
        return;
      }

      File selectedFile = null;
      File[] selectedFiles = null;

      // Unix: Resolve '~' to user's home directory
      if (File.separatorChar == '/') {
        if (filename.startsWith("~/")) {
          filename = System.getProperty("user.home") + filename.substring(1);
        } else if (filename.equals("~")) {
          filename = System.getProperty("user.home");
        }
      }

      if (chooser.isMultiSelectionEnabled()
          && filename.length() > 1
          && filename.charAt(0) == '"'
          && filename.charAt(filename.length() - 1) == '"') {
        List<File> fList = new ArrayList<File>();

        String[] files = filename.substring(1, filename.length() - 1).split("\" \"");
        // Optimize searching files by names in "children" array
        Arrays.sort(files);

        File[] children = null;
        int childIndex = 0;

        for (String str : files) {
          File file = fs.createFileObject(str);
          if (!file.isAbsolute()) {
            if (children == null) {
              children = fs.getFiles(dir, false);
              Arrays.sort(children);
            }
            for (int k = 0; k < children.length; k++) {
              int l = (childIndex + k) % children.length;
              if (children[l].getName().equals(str)) {
                file = children[l];
                childIndex = l + 1;
                break;
              }
            }
          }
          fList.add(file);
        }

        if (!fList.isEmpty()) {
          selectedFiles = fList.toArray(new File[fList.size()]);
        }
        resetGlobFilter();
      } else {
        selectedFile = fs.createFileObject(filename);
        if (!selectedFile.isAbsolute()) {
          selectedFile = fs.getChild(dir, filename);
        }
        // check for wildcard pattern
        FileFilter currentFilter = chooser.getFileFilter();
        if (!selectedFile.exists() && isGlobPattern(filename)) {
          changeDirectory(selectedFile.getParentFile());
          if (globFilter == null) {
            globFilter = new GlobFilter();
          }
          try {
            globFilter.setPattern(selectedFile.getName());
            if (!(currentFilter instanceof GlobFilter)) {
              actualFileFilter = currentFilter;
            }
            chooser.setFileFilter(null);
            chooser.setFileFilter(globFilter);
            return;
          } catch (PatternSyntaxException pse) {
            // Not a valid glob pattern. Abandon filter.
          }
        }

        resetGlobFilter();

        // Check for directory change action
        boolean isDir = (selectedFile != null && selectedFile.isDirectory());
        boolean isTrav = (selectedFile != null && chooser.isTraversable(selectedFile));
        boolean isDirSelEnabled = chooser.isDirectorySelectionEnabled();
        boolean isFileSelEnabled = chooser.isFileSelectionEnabled();
        boolean isCtrl =
            (e != null
                && (e.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0);

        if (isDir && isTrav && (isCtrl || !isDirSelEnabled)) {
          changeDirectory(selectedFile);
          return;
        } else if ((isDir || !isFileSelEnabled)
            && (!isDir || !isDirSelEnabled)
            && (!isDirSelEnabled || selectedFile.exists())) {
          selectedFile = null;
        }
      }

      if (selectedFiles != null || selectedFile != null) {
        if (selectedFiles != null || chooser.isMultiSelectionEnabled()) {
          if (selectedFiles == null) {
            selectedFiles = new File[] {selectedFile};
          }
          chooser.setSelectedFiles(selectedFiles);
          // Do it again. This is a fix for bug 4949273 to force the
          // selected value in case the ListSelectionModel clears it
          // for non-existing file names.
          chooser.setSelectedFiles(selectedFiles);
        } else {
          chooser.setSelectedFile(selectedFile);
        }
        chooser.approveSelection();
      } else {
        if (chooser.isMultiSelectionEnabled()) {
          chooser.setSelectedFiles(null);
        } else {
          chooser.setSelectedFile(null);
        }
        chooser.cancelSelection();
      }
    }
Ejemplo n.º 27
0
  public void login() {
    mbAutoLogIn = false;
    while (!mbAutoLogIn) {
      try {
        // Confirm logout
        if (isOpen()) {
          if (MessageBox.showConfirmDialog(
                  this,
                  MonitorDictionary.getString("Confirm.Exit"),
                  Global.APP_NAME,
                  MessageBox.YES_NO_OPTION)
              == MessageBox.NO_OPTION) return;

          // Disconnect from server
          disconnect();
        }

        // Login
        DialogLogin dlgLogin = new DialogLogin(this);
        WindowManager.centeredWindow(dlgLogin);

        if (dlgLogin.miReturn == JOptionPane.OK_OPTION) {
          // Update UI
          SwingUtilities.updateComponentTreeUI(pnlUser);
          SwingUtilities.updateComponentTreeUI(pnlThread);

          // Request to connect
          Socket sck = new Socket(dlgLogin.mstrHost, Integer.parseInt(dlgLogin.mstrPort));
          sck.setSoLinger(true, 0);

          // Start up a channel thread that reads messages from the server
          channel =
              new SocketTransmitter(sck) {
                public void close() {
                  if (msckMain != null) {
                    super.close();
                    closeAll();
                    if (mbAutoLogIn) login();
                  }
                }
              };
          channel.setUserName(dlgLogin.mstrUserName);
          channel.setPackage("com.fss.thread.");
          channel.start();

          // Request to Server
          DDTP request = new DDTP();
          request.setRequestID(String.valueOf(System.currentTimeMillis()));
          request.setString("UserName", dlgLogin.mstrUserName);
          request.setString("Password", dlgLogin.mstrPassword);

          // Response from Server
          DDTP response = channel.sendRequest("ThreadProcessor", "login", request);
          mstrThreadAppName = response.getString("strThreadAppName");
          mstrThreadAppVersion = response.getString("strThreadAppVersion");
          mstrAppName = response.getString("strAppName");
          mstrAppVersion = response.getString("strAppVersion");
          if (response != null) {
            if (response.getString("PasswordExpired") != null) {
              DialogChangePassword frm = new DialogChangePassword(this, channel);
              WindowManager.centeredWindow(frm);
              if (frm.miReturnValue != JOptionPane.OK_OPTION) throw new AppException("FSS-10003");
            }
            String strLog = StringUtil.nvl(response.getString("strLog"), "");
            showResult(txtBoard, strLog);
            Vector vtThread = response.getVector("vtThread");
            updateTabBar(vtThread);

            mstrChannel = response.getString("strChannel");
            if (mstrChannel != null) removeUser(mstrChannel);
          }
          btnRefresh.doClick();
          pnlThread.setVisible(true);
          pnlUser.setVisible(true);
          setResizeWeight(1);
          setDividerLocation((int) (getSize().getHeight() - 160));
        }
        mbAutoLogIn = true;
        updateLanguage();
      } catch (Exception e) {
        e.printStackTrace();
        MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);

        // Disconnect from server
        mstrChannel = null;
        disconnect();
      }
    }
  }
Ejemplo n.º 28
0
 static {
   System.setProperty("org.openide.windows.DummyWindowManager.VISIBLE", "false");
 }
Ejemplo n.º 29
0
 @Override
 public void windowClosing(WindowEvent e) {
   System.exit(0);
 }
Ejemplo n.º 30
0
 public void actionPerformed(ActionEvent e) {
   System.exit(0);
 }