/** Write file with position and size of the login box */ public static void writePersistence() { Messages.postDebug("LoginBox", "LoginBox.writePersistence"); // If the panel has not been created, don't try to write a file if (position == null) return; String filepath = FileUtil.savePath("USER/PERSISTENCE/LoginPanel"); FileWriter fw; PrintWriter os; try { File file = new File(filepath); fw = new FileWriter(file); os = new PrintWriter(fw); os.println("Login Panel"); os.println(height); os.println(width); double xd = position.getX(); int xi = (int) xd; os.println(xi); double yd = position.getY(); int yi = (int) yd; os.println(yi); os.close(); } catch (Exception er) { Messages.postError("Problem creating " + filepath); Messages.writeStackTrace(er); } }
protected String getSampleName(String strDir, String strTray) { String strSampleName = ""; String strSample; int nTray = 0; try { nTray = Integer.parseInt(strTray); } catch (Exception e) { } if (nTray <= 0) return strSampleName; String cmd = "SELECT loc_,studystatus from study WHERE (autodir=\'" + strDir + "\') AND (hostname=\'" + getHost() + "\')"; // NB: bArrSample[0] is not used; array implicitly initialized false boolean[] bArrSample = new boolean[nTray + 1]; m_dbResult = null; try { m_dbResult = getdbmanager().executeQuery(cmd); } catch (Exception e) { return strSampleName; } if (m_dbResult == null) return strSampleName; try { while (m_dbResult.next()) { strSample = m_dbResult.getString(1); int nSample = 0; nSample = Integer.parseInt(strSample); try { bArrSample[nSample] = true; } catch (IndexOutOfBoundsException ioobe) { Messages.postDebug("getSampleName: index out of bounds: " + nSample); } } for (int i = 1; i < bArrSample.length; i++) { if (!bArrSample[i]) { strSampleName = String.valueOf(i); break; } } } catch (Exception e) { // e.printStackTrace(); Messages.writeStackTrace(e); } return strSampleName; }
protected void enterLogin() { char[] password = m_passwordField.getPassword(); String strUser = (String) m_cmbUser.getSelectedItem(); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean blogin = WUserUtil.isOperatorNameok(strUser, false); if (blogin) { blogin = vnmrjPassword(strUser, password); if (!blogin) blogin = unixPassword(strUser, password); } if (blogin) { m_lblLogin.setForeground(Color.black); m_lblLogin.setText("Login Successful"); m_lblLogin.setVisible(true); // Get the Email column string for access to the operator data String emStr = vnmr.util.Util.getLabel("_admin_Email"); String stremail = WUserUtil.getOperatordata(strUser, emStr); // Get the Panel Level column string for access to the operator data String plStr = vnmr.util.Util.getLabel("_admin_Panel_Level"); String strPanel = WUserUtil.getOperatordata(strUser, plStr); if (stremail == null || stremail.equals("null")) stremail = ""; try { Integer.parseInt(strPanel); } catch (Exception e) { strPanel = WGlobal.PANELLEVEL; } m_trayTimer.stop(); Messages.postDebug(" Login: "******"appdir('reset','") .append(strUser) .append("','") .append(stremail) .append("',") .append(strPanel) .append(")") .toString()); exp.sendToVnmr("vnmrjcmd('util', 'bgReady')\n"); } setVisible(false); // Save the current position and size of this panel in case it // was changed Dimension size = getSize(); width = size.width; height = size.height; position = getLocation(); writePersistence(); // Call the macro to update this operator's // ExperimentSelector_operatorName.xml file // from the protocols themselves. This macro will // cause an update of the ES when it is finished // Util.getAppIF().sendToVnmr("updateExpSelector"); // I am not sure why we need to force updates since updateExpSelector // should have caused an update by writing to ES_op.xml file. // However, it works better if we do the force update. // ExpSelector.setForceUpdate(true); } else { m_lblLogin.setForeground(DisplayOptions.getColor("Error")); // m_lblLogin.setText("<HTML>Incorrect username/password <p> Please try again </HTML>"); m_lblLogin.setVisible(true); } setCursor(Cursor.getDefaultCursor()); }