List of usage examples for java.awt Cursor DEFAULT_CURSOR
int DEFAULT_CURSOR
To view the source code for java.awt Cursor DEFAULT_CURSOR.
Click Source Link
From source file:com.floreantpos.jasperreport.swing.JRViewerPanel.java
void pnlLinksMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pnlLinksMouseReleased // Add your handling code here: pnlLinks.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:com.ssn.event.controller.SSNShareController.java
@Override public void mouseClicked(MouseEvent e) { Object mouseEventObj = e.getSource(); if (mouseEventObj != null && mouseEventObj instanceof JLabel) { JLabel label = (JLabel) mouseEventObj; getShareForm().setCursor(new Cursor(Cursor.WAIT_CURSOR)); // Tracking this sharing event in Google Analytics GoogleAnalyticsUtil.track(SSNConstants.SSN_APP_EVENT_SHARING); Thread thread = null;/*from w w w . j a va 2s .co m*/ switch (label.getName()) { case "FacebookSharing": thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); AccessGrant facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (InterruptedException ex) { logger.error(ex); } } FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); Connection<Facebook> connection = connectionFactory.createConnection(facebookAccessGrant); Facebook facebook = connection.getApi(); MediaOperations mediaOperations = facebook.mediaOperations(); if (!isAlreadyLoggedIn) { // SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); FacebookProfile userProfile = facebook.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = userProfile.getName() != null ? userProfile.getName() : userProfile.getFirstName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { AccessGrant facebookAccessGrant1 = null; if (facebookAccessGrant1 == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant1 = getHomeModel().getHomeForm() .getFacebookAccessGrant(); if (facebookAccessGrant1 == null) { Thread.sleep(10000); } else { processFurther = true; //isAlreadyLoggedIn = true; } } connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); connection = connectionFactory.createConnection(facebookAccessGrant); facebook = connection.getApi(); mediaOperations = facebook.mediaOperations(); } catch (InterruptedException ex) { logger.error(ex); } } } } String[] videoSupported = SSNConstants.SSN_VIDEO_FORMAT_SUPPORTED; final List<String> videoSupportedList = Arrays.asList(videoSupported); for (String file : sharedFileList) { String fileExtension = file.substring(file.lastIndexOf(".") + 1, file.length()); Resource resource = new FileSystemResource(file); if (!videoSupportedList.contains(fileExtension.toUpperCase())) { String output = mediaOperations.postPhoto(resource); } else { String output = mediaOperations.postVideo(resource); } } getShareForm().dispose(); } }; thread.start(); break; case "TwitterSharing": LoginWithTwitter.deniedPermission = false; thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); OAuthToken twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { if (LoginWithTwitter.deniedPermission) break; twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (IOException | InterruptedException ex) { logger.error(ex); } } if (!LoginWithTwitter.deniedPermission) { Twitter twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); TimelineOperations timelineOperations = twitter.timelineOperations(); if (!isAlreadyLoggedIn) { SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); TwitterProfile userProfile = twitter.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = twitter.userOperations().getScreenName() != null ? twitter.userOperations().getScreenName() : userProfile.getName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { twitterOAuthToken = null; if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { twitterOAuthToken = getHomeModel().getHomeForm() .getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; } } twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); timelineOperations = twitter.timelineOperations(); } catch (IOException | InterruptedException ex) { logger.error(ex); } } } } for (String file : sharedFileList) { Resource image = new FileSystemResource(file); TweetData tweetData = new TweetData("At " + new Date()); tweetData.withMedia(image); timelineOperations.updateStatus(tweetData); } } else { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Alert", "", "User denied for OurHive App permission on twitter."); messageDialogBox.setFocusable(true); } getShareForm().dispose(); } }; thread.start(); break; case "InstagramSharing": break; case "MailSharing": try { String OS = System.getProperty("os.name").toLowerCase(); Set<String> sharedFileList = getFiles(); Set<String> voiceNoteList = new HashSet<String>(); for (String sharedFile : sharedFileList) { String voiceNote = SSNDao.getVoiceCommandPath(new File(sharedFile).getAbsolutePath()); if (voiceNote != null && !voiceNote.isEmpty()) { voiceNoteList.add(voiceNote); } } sharedFileList.addAll(voiceNoteList); String fileFullPath = ""; String caption = ""; if (sharedFileList.size() == 1) { fileFullPath = sharedFileList.toArray(new String[0])[0]; caption = SSMMediaGalleryPanel.readMetaDataForTitle(new File(fileFullPath)); } else if (sharedFileList.size() > 1) { fileFullPath = SSNHelper.createZipFileFromMultipleFiles(sharedFileList); } if (OS.contains("win")) { // String subject = "SSN Subject"; String subject = caption.equals("") ? SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; String body = ""; String m = "&subject=%s&body=%s"; String outLookExeDir = "C:\\Program Files\\Microsoft Office\\Office14\\Outlook.exe"; String mailCompose = "/c"; String note = "ipm.note"; String mailBodyContent = "/m"; m = String.format(m, subject, body); String slashA = "/a"; String mailClientConfigParams[] = null; Process startMailProcess = null; mailClientConfigParams = new String[] { outLookExeDir, mailCompose, note, mailBodyContent, m, slashA, fileFullPath }; startMailProcess = Runtime.getRuntime().exec(mailClientConfigParams); OutputStream out = startMailProcess.getOutputStream(); File zipFile = new File(fileFullPath); zipFile.deleteOnExit(); } else if (OS.indexOf("mac") >= 0) { //Process p = Runtime.getRuntime().exec(new String[]{String.format("open -a mail ", fileFullPath)}); Desktop desktop = Desktop.getDesktop(); String mailTo = caption.equals("") ? "?SUBJECT=" + SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; URI uriMailTo = null; uriMailTo = new URI("mailto", mailTo, null); desktop.mail(uriMailTo); } this.getShareForm().dispose(); } catch (Exception ex) { logger.error(ex); } break; case "moveCopy": getShareForm().dispose(); File album = new File(SSNHelper.getSsnHiveDirPath()); File[] albumPaths = album.listFiles(); Vector albumNames = new Vector(); for (int i = 0; i < albumPaths.length; i++) { if (!(albumPaths[i].getName().equals("OurHive")) && SSNHelper.lastAlbum != null && !(albumPaths[i].getName().equals(SSNHelper.lastAlbum))) albumNames.add(albumPaths[i].getName()); } if (SSNHelper.lastAlbum != null && !SSNHelper.lastAlbum.equals("OurHive")) albumNames.insertElementAt("OurHive", 0); SSNInputDialogBox inputBox = new SSNInputDialogBox(true, albumNames); inputBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Copy Media", "Please Select Album Name"); String destAlbumName = inputBox.getTextValue(); if (StringUtils.isNotBlank(destAlbumName)) { homeModel.moveAlbum(destAlbumName, getFiles()); } } getShareForm().setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:com.smanempat.controller.ControllerEvaluation.java
public void proccessMining(JTable tableDataSetModel, JTable tableDataSetTesting, JTextField txtNumberOfK, JLabel labelPesanError, JTabbedPane jTabbedPane1, JTable tableResult, JTable tableConfMatrix, JTable tableTahunTesting, JLabel totalAccuracy, JPanel panelChart, JPanel panelChart1, JPanel panelChart2, JRadioButton singleTesting, JRadioButton multiTesting, JTextArea txtArea) throws SQLException { Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); modelEvaluation = new ModelEvaluation(); int rowCountModel = tableDataSetModel.getRowCount(); int rowCountTest = tableDataSetTesting.getRowCount(); int[] tempK;//from w w w. ja v a2 s. co m double[][] tempEval; double[][] evalValue; boolean valid = false; /*Validasi Dataset Model dan Dataset Uji*/ if (rowCountModel == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { valid = true; } /*Validasi Dataset Model dan Dataset Uji*/ if (valid == true) { if (multiTesting.isSelected()) { String iterasi = JOptionPane.showInputDialog("Input Jumlah Iterasi Pengujian :"); boolean validMulti = false; if (iterasi != null) { /*Validasi Jumlah Iterasi*/ if (Pattern.matches("[0-9]+", iterasi) == false && iterasi.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai iterasi terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (rowCountTest > rowCountModel) { JOptionPane.showMessageDialog(null, "Data Uji tidak boleh lebih besar daripada data Model!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; System.out.println("valiMulti = " + validMulti + " Kok"); } /*Validasi Jumlah Iterasi*/ } if (validMulti == true) { tempK = new int[Integer.parseInt(iterasi)]; evalValue = new double[3][tempK.length]; for (int i = 0; i < Integer.parseInt(iterasi); i++) { validMulti = false; String k = JOptionPane .showInputDialog("Input Nilai Nearest Neighbor (k) ke " + (i + 1) + " :"); if (k != null) { /*Validasi Nilai K Tiap Iterasi*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; } /*Validasi Nilai K Tiap Iterasi*/ } if (validMulti == true) { tempK[i] = Integer.parseInt(k); System.out.println(tempK[i]); } else { break; } } if (validMulti == true) { for (int i = 0; i < tempK.length; i++) { int kValue = tempK[i]; String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, i, tempK, panelChart); //Menampung nilai Accuracy evalValue[0][i] = tempEval[0][i]; //Menampung nilai Recall evalValue[1][i] = tempEval[1][i]; //Menampung nilai Precision evalValue[2][i] = tempEval[2][i]; jTabbedPane1.setSelectedIndex(1); txtArea.append( "Tingkat Keberhasilan Sistem dengan Nilai Number of Nearest Neighbor (K) = " + tempK[i] + "\n"); txtArea.append("Akurasi\t\t: " + evalValue[0][i] * 100 + " %\n"); txtArea.append("Recall\t\t: " + evalValue[1][i] * 100 + " %\n"); txtArea.append("Precision\t: " + evalValue[2][i] * 100 + " %\n"); txtArea.append( "=============================================================================\n"); } showChart(tempK, evalValue, panelChart, panelChart1, panelChart2); } } } else if (singleTesting.isSelected()) { boolean validSingle = false; String k = txtNumberOfK.getText(); int nilaiK = 0; evalValue = new double[3][1]; /*Validasi Nilai Number of Nearest Neighbor*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { labelPesanError.setText("Number of Nearest Neighbor tidak valid"); JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); labelPesanError.setText("Number of Nearest Neighbor tidak boleh kosong"); txtNumberOfK.requestFocus(); } else if (rowCountModel == 0 && Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0 && Integer.parseInt(k) >= rowCountTest) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + " !", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { validSingle = true; nilaiK = Integer.parseInt(k); } /*Validasi Nilai Number of Nearest Neighbor*/ if (validSingle == true) { int confirm; int i = 0; confirm = JOptionPane.showOptionDialog(null, "Yakin ingin memproses data?", "Proses Klasifikasi", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.OK_OPTION) { int kValue = Integer.parseInt(txtNumberOfK.getText()); String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, nilaiK, panelChart); evalValue[0][i] = tempEval[0][0]; evalValue[1][i] = tempEval[1][0]; evalValue[2][i] = tempEval[2][0]; jTabbedPane1.setSelectedIndex(1); } System.out.println("com.smanempat.controller.ControllerEvaluation.proccessMining()OKOKOK"); showChart(nilaiK, evalValue, panelChart, panelChart1, panelChart2); Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } } } }
From source file:com.vgi.mafscaling.ClosedLoop.java
protected void calculateMafScaling() { if (!polfTable.validate()) return;/* w ww . ja va 2 s . c o m*/ setCursor(new Cursor(Cursor.WAIT_CURSOR)); try { clearData(); clearChartData(); clearChartCheckBoxes(); if (!getMafTableData(voltArray, gsArray)) return; calculateCorrectedGS(); setCorrectedMafData(); smoothGsArray.addAll(gsCorrected); checkBoxCorrectedMaf.setSelected(true); setXYTable(mafSmoothingTable, voltArray, smoothGsArray); setRanges(); } catch (Exception e) { e.printStackTrace(); logger.error(e); JOptionPane.showMessageDialog(null, "Error: " + e, "Error", JOptionPane.ERROR_MESSAGE); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java
private void initGUI() { if (ajo == null) { try {/*from www. jav a 2 s. co m*/ setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } //JLabel l = new JLabel("No simulation running"); //this.add(l); //this.setEnabled(false); return; } System.out.println("I am not null: drawing the display job panel"); try { TableLayout thisLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL } }); thisLayout.setHGap(5); thisLayout.setVGap(5); this.setLayout(thisLayout); { jPanel1 = new JPanel(); TableLayout jPanel1Layout = new TableLayout(new double[][] { { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); jPanel1Layout.setHGap(5); jPanel1Layout.setVGap(5); jPanel1.setLayout(jPanel1Layout); jPanel1.setLayout(jPanel1Layout); jPanel1.setBorder(BorderFactory.createEtchedBorder()); this.add(jPanel1, "0, 0, 0, 2"); jPanel1.setPreferredSize(new java.awt.Dimension(630, 305)); jPanel1.setSize(630, 305); { dtails = new JPanel(); GridLayout dtailsLayout = new GridLayout(1, 1); dtailsLayout.setColumns(1); dtailsLayout.setHgap(5); dtailsLayout.setVgap(5); dtails.setBorder(BorderFactory.createTitledBorder("Job Details")); jPanel1.add(dtails, "0, 0, 2, 4"); dtails.setLayout(dtailsLayout); { jobDetailsSP = new JScrollPane(); dtails.add(jobDetailsSP); { jPanel3 = new JPanel(); TableLayout jPanel3Layout = new TableLayout( new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); jPanel3Layout.setHGap(5); jPanel3Layout.setVGap(5); jPanel3.setLayout(jPanel3Layout); jobDetailsSP.setViewportView(jPanel3); jPanel3.setBackground(new java.awt.Color(156, 199, 219)); { jLabel2 = new JLabel(); jPanel3.add(jLabel2, "0, 0"); jLabel2.setText("Job Start Time"); } { jLabel3 = new JLabel(); jPanel3.add(jLabel3, "0, 1"); jLabel3.setText("Resource ID"); } { jLabel4 = new JLabel(); jPanel3.add(jLabel4, "0, 2"); jLabel4.setText("Job Type"); } { jLabel5 = new JLabel(); jPanel3.add(jLabel5, "0, 3"); jLabel5.setText("Status"); } { jLabel6 = new JLabel(); jPanel3.add(jLabel6, "0, 4"); jLabel6.setText("Machine"); } { jLabel7 = new JLabel(); jPanel3.add(jLabel7, "0, 5"); jLabel7.setText("CPUs Requested"); } { jLabel8 = new JLabel(); jPanel3.add(jLabel8, "0, 6"); jLabel8.setText("Configuration File"); } { jLabel9 = new JLabel(); jPanel3.add(jLabel9, "0, 7"); jLabel9.setText("Job Arguments"); } { jLabel10 = new JLabel(); jPanel3.add(jLabel10, "0, 8"); jLabel10.setText("Job Stdout"); } { jLabel11 = new JLabel(); jPanel3.add(jLabel11, "0, 9"); jLabel11.setText("Job Stderr"); } { jLabel12 = new JLabel(); jPanel3.add(jLabel12, "0, 10"); jLabel12.setText("Job Stdin"); } { jLabel13 = new JLabel(); jPanel3.add(jLabel13, "0, 11"); jLabel13.setText("Resource Endpoint"); } { jobName = new JTextField(); jPanel3.add(jobName, "1, 0"); jobName.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobName.setOpaque(true); jobName.setBackground(new java.awt.Color(255, 255, 255)); jobName.setEditable(false); } { resourceID = new JTextField(); jPanel3.add(resourceID, "1, 1"); resourceID.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); resourceID.setOpaque(true); resourceID.setBackground(new java.awt.Color(255, 255, 255)); resourceID.setEditable(false); } { jobType = new JTextField(); jPanel3.add(jobType, "1, 2"); jobType.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobType.setBackground(new java.awt.Color(255, 255, 255)); jobType.setOpaque(true); jobType.setEditable(false); } { jobStatus = new JLabel(); jPanel3.add(jobStatus, "1, 3"); jobStatus.setOpaque(true); jobStatus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStatus.setBackground(new java.awt.Color(255, 255, 255)); } { rm = new JTextField(); jPanel3.add(rm, "1, 4"); rm.setBackground(new java.awt.Color(255, 255, 255)); rm.setOpaque(true); rm.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); rm.setEditable(false); } { jobCpus = new JTextField(); jPanel3.add(jobCpus, "1, 5"); jobCpus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobCpus.setOpaque(true); jobCpus.setBackground(new java.awt.Color(255, 255, 255)); jobCpus.setEditable(false); } { jobConf = new JTextField(); jPanel3.add(jobConf, "1, 6"); jobConf.setBackground(new java.awt.Color(255, 255, 255)); jobConf.setOpaque(true); jobConf.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobConf.setEditable(false); } { jobArgs = new JTextField(); jPanel3.add(jobArgs, "1, 7"); jobArgs.setBackground(new java.awt.Color(255, 255, 255)); jobArgs.setOpaque(true); jobArgs.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobArgs.setEditable(false); } { jobSdtout = new JTextField(); jPanel3.add(jobSdtout, "1, 8"); jobSdtout.setBackground(new java.awt.Color(255, 255, 255)); jobSdtout.setOpaque(true); jobSdtout.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobSdtout.setEditable(false); } { jobStderr = new JTextField(); jPanel3.add(jobStderr, "1, 9"); jobStderr.setBackground(new java.awt.Color(255, 255, 255)); jobStderr.setOpaque(true); jobStderr.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStderr.setEditable(false); } { jobStdin = new JTextField(); jPanel3.add(jobStdin, "1, 10"); jobStdin.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStdin.setBackground(new java.awt.Color(255, 255, 255)); jobStdin.setOpaque(true); jobStdin.setEditable(false); } { jobEPR = new JTextField(); jPanel3.add(jobEPR, "1, 11"); jobEPR.setOpaque(true); jobEPR.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobEPR.setBackground(new java.awt.Color(255, 255, 255)); jobEPR.setEditable(false); } } } } { controls = new JPanel(); TableLayout controlsLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); controlsLayout.setHGap(5); controlsLayout.setVGap(5); controls.setLayout(controlsLayout); controls.setBorder(BorderFactory.createTitledBorder("Operations")); jPanel1.add(controls, "3, 0, 4, 2"); { updateStatus = new JButton(); controls.add(updateStatus, "0, 0"); updateStatus.setText("Update Job Status"); updateStatus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (updateStatus.getText().equals("Start Job")) { StartCall sc = new StartCall(ajo, ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-lifetime"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-port"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-dn"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-server"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-pw"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-un")); ajo = sc.makeCall(); updatePanel(); } else { pollJobState(); } } }); } { teminateJob = new JButton(); controls.add(teminateJob, "0, 1"); teminateJob.setText("Terminate Job"); teminateJob.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { TerminateSimCall tsc = new TerminateSimCall(ajo.getEndPoint()); DisplayJobPanel.this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); boolean tcsstatus = tsc.makeCall(); DisplayJobPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if (tcsstatus) { ajo.setState(AHEJobObject.GRIDSAM_TERMINATING); updateState(); } else { ErrorMessage em = new ErrorMessage(DisplayJobPanel.this, "Error terminating job. Check log for details"); ; } } }); } { vizButton = new JButton(); controls.add(vizButton, "0, 2"); vizButton.setText("Visualize"); vizButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String h = "localhost"; int p = 65250; int w = 1024 * 1024; VizSteererWindow vs = new VizSteererWindow(h, p, w, (JFrame) DisplayJobPanel.this.getTopLevelAncestor()); } }); } { deleteFiles = new JCheckBox(); controls.add(deleteFiles, "0, 3"); deleteFiles.setText("Delete staged files when destroying job"); deleteFiles.setFont(new java.awt.Font("Sansserif", 0, 11)); deleteFiles.setSelected(true); } } { polling = new JPanel(); GridBagLayout pollingLayout = new GridBagLayout(); pollingLayout.rowWeights = new double[] { 0.1, 0.1, 0.1, 0.1 }; pollingLayout.rowHeights = new int[] { 7, 7, 7, 7 }; pollingLayout.columnWeights = new double[] { 0.0, 0.1 }; pollingLayout.columnWidths = new int[] { 109, 7 }; polling.setBorder(BorderFactory.createTitledBorder("Status Polling")); jPanel1.add(polling, "3, 3, 4, 4"); polling.setLayout(pollingLayout); { jLabel1 = new JLabel(); polling.add(jLabel1, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Set the polling interval "); jLabel1.setFont(new java.awt.Font("Sansserif", 0, 11)); } { jSlider1 = new JSlider(); polling.add(jSlider1, new GridBagConstraints(0, 1, 2, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jSlider1.setMaximum(60); jSlider1.setValue(0); //jSlider1.setMinorTickSpacing(1); //jSlider1.createStandardLabels(5); Hashtable lab = new Hashtable(); lab.put(new Integer(0), new JLabel("0")); lab.put(new Integer(20), new JLabel("10")); lab.put(new Integer(40), new JLabel("20")); lab.put(new Integer(60), new JLabel("30")); jSlider1.setLabelTable(lab); jSlider1.setPaintTicks(true); jSlider1.setPaintLabels(true); jSlider1.setSnapToTicks(false); jSlider1.setMajorTickSpacing(2); jSlider1.setFont(new java.awt.Font("Sansserif", 0, 11)); jSlider1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (jSlider1.getValue() != 0) { Integer i = new Integer(jSlider1.getValue()); time1.setText(Float.toString(i.floatValue() / 2)); if (pollingButton.getText().equals("Stop Polling")) { pollTimer.stop(); pollTimer.setInitialDelay(jSlider1.getValue() * 30000); pollTimer.setDelay(jSlider1.getValue() * 30000); pollTimer.start(); } } else { if (pollingButton.getText().equals("Stop Polling")) { pollTimer.stop(); pollingButton.setText("Start Polling"); } time1.setText("0.0"); } } }); } { pollingButton = new JButton(); polling.add(pollingButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); pollingButton.setText("Start Polling"); pollingButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (jSlider1.getValue() > 0) { if (pollingButton.getText().equals("Start Polling")) { pollTimer = new Timer(jSlider1.getValue() * 30000, new ActionListener() { public void actionPerformed(ActionEvent evt) { pollJobState(); } }); pollTimer.setInitialDelay(1); pollTimer.start(); pollingButton.setText("Stop Polling"); } else { pollTimer.stop(); pollingButton.setText("Start Polling"); } } } }); } { time = new JLabel(); polling.add(time, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); time.setBackground(new java.awt.Color(255, 255, 255)); time.setText("Every"); } { jLabel14 = new JLabel(); polling.add(jLabel14, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("mins"); } { time1 = new JLabel(); polling.add(time1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); time1.setText("0.0"); ; } } } { jPanel2 = new JPanel(); GridLayout jPanel2Layout = new GridLayout(1, 1); jPanel2Layout.setColumns(1); jPanel2Layout.setHgap(5); jPanel2Layout.setVgap(5); jPanel2.setLayout(jPanel2Layout); TitledBorder title2; title2 = BorderFactory.createTitledBorder("Job Output"); jPanel2.setBorder(title2); this.add(jPanel2, "0, 3, 0, 4"); jPanel2.setPreferredSize(new java.awt.Dimension(630, 254)); { jTabbedPane1 = new JTabbedPane(); jPanel2.add(jTabbedPane1); { gridsamStatus = new JPanel(); GridLayout gridsamStatusLayout = new GridLayout(1, 1); gridsamStatusLayout.setColumns(1); gridsamStatusLayout.setHgap(5); gridsamStatusLayout.setVgap(5); gridsamStatus.setLayout(gridsamStatusLayout); jTabbedPane1.addTab("AHE Job Status", null, gridsamStatus, null); { jScrollPane1 = new JScrollPane(); gridsamStatus.add(jScrollPane1); { gridsamStatusResults = new JTextArea(); jScrollPane1.setViewportView(gridsamStatusResults); gridsamStatusResults.setFont(new java.awt.Font("Monospaced", 0, 12)); } } } { stagedFiles = new JPanel(); TableLayout stagedFilesLayout = new TableLayout(new double[][] { { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED } }); stagedFilesLayout.setHGap(5); stagedFilesLayout.setVGap(5); stagedFiles.setLayout(stagedFilesLayout); jTabbedPane1.addTab("Staged Files", null, stagedFiles, null); { filesScrollPane = new JScrollPane(); stagedFiles.add(filesScrollPane, "0, 0, 5, 4"); { outputFilesTable = new JTable(); int col1 = 0, col2 = 0; int fsize = outputFilesTable.getFont().getSize() - 5; Object data[][] = new Object[ajo.getOutfiles().size() + ajo.getInfiles().size()][3]; int i = 0; if (ajo.getOutfiles() != null) { Iterator it = ajo.getOutfiles().iterator(); while (it.hasNext()) { JobFileElement je = (JobFileElement) it.next(); data[i][0] = new Boolean(true); data[i][1] = je.getName(); if (je.getName().length() > col1) { col1 = je.getName().length(); } String url = Tools.getUrlNoUP(je.getRemotepath()); data[i][2] = url; if (url.length() > col2) { col2 = url.length(); } i++; } } if (ajo.getInfiles() != null) { Iterator it = ajo.getInfiles().iterator(); while (it.hasNext()) { JobFileElement je = (JobFileElement) it.next(); data[i][0] = new Boolean(false); data[i][1] = je.getName(); if (je.getName().length() > col1) { col1 = je.getName().length(); } String url = Tools.getUrlNoUP(je.getRemotepath()); data[i][2] = url; if (url.length() > col2) { col2 = url.length(); } i++; } } String colNames[] = { "Download", "File Name", "File Location" }; TableModel outputFilesTableModel = new MyTableModel(data, colNames); outputFilesTable.setIntercellSpacing(new Dimension(3, 3)); outputFilesTable.setModel(outputFilesTableModel); outputFilesTable.getColumnModel().getColumn(0).setPreferredWidth(70); outputFilesTable.getColumnModel().getColumn(1).setPreferredWidth(col1 * fsize); outputFilesTable.getColumnModel().getColumn(2).setPreferredWidth(col2 * fsize); outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); filesScrollPane.setViewportView(outputFilesTable); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (outputFilesTable.getWidth() < filesScrollPane.getWidth()) { outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); } else { outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); } } }); } } { downloadButton = new JButton(); stagedFiles.add(downloadButton, "5, 5"); downloadButton.setText("Download"); downloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int outFileSize = ajo.getOutfiles().size(); for (int row = 0; row < outputFilesTable.getRowCount(); row++) { if (((Boolean) outputFilesTable.getValueAt(row, 0)) .booleanValue() == true) { if (row < outFileSize) { JobFileElement je = (JobFileElement) ajo.getOutfiles() .elementAt(row); if (fileLocation != null) { je.setLocalpath(Tools.checkURL(fileLocation) + je.getName()); } downloadFiles.add(je); } else { JobFileElement je = (JobFileElement) ajo.getInfiles() .elementAt(row - outFileSize); if (fileLocation != null) { je.setLocalpath(Tools.checkURL(fileLocation) + je.getName()); } downloadFiles.add(je); } } } StageFilesIn task = new StageFilesIn( ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavserver"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavuser"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavpasswd")); task.init(downloadFiles); ProgressMonitor progressMonitor = new ProgressMonitor(DisplayJobPanel.this, "Downloading Files", null, 0, task.getLength()); //progressMonitor.setMillisToDecideToPopup(1); progressMonitor.setMillisToPopup(100); //jProgressBar1.setMaximum(task.getLength()); //jProgressBar1.setValue(0); while (task.filesToStage()) { if (task.stageNext()) { progressMonitor.setProgress(task.getCurrent()); } else { cat.error(task.getError()); } } } }); } { changeLocationButton = new JButton(); stagedFiles.add(changeLocationButton, "4, 5"); changeLocationButton.setText("Local Dir"); changeLocationButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(DisplayJobPanel.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); fileLocation = file.getAbsolutePath(); //System.out.println(fileLocation); } } }); } } { if (ajo.getReGSWSEPR() != null) { regSteering = new JPanel(); TableLayout steerLayout = new TableLayout( new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); regSteering.setLayout(steerLayout); steeredApp = true; jTabbedPane1.addTab("ReG Steering", null, regSteering, null); { JLabel look = new JLabel("Steering address"); steerERP = new JTextField(); steer = new JButton("Start Steerer"); steer.setEnabled(false); steer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { vs = new VizSteererWindow(h, p, w, DisplayJobPanel.this.getTopLevelAncestor()); } }); regSteering.add(look, "0,1"); regSteering.add(steerERP, "0,2"); regSteering.add(steer, "0,3"); } } } } } updatePanel(); this.setPreferredSize(new java.awt.Dimension(630, 605)); this.setSize(630, 605); this.setOpaque(false); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.pegadi.client.ApplicationLauncher.java
void listerButton_actionPerformed(ActionEvent e) { if (lis == null) { this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); lis = new Lister(); lis.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { lis = null;/* w w w . j a v a2 s . c om*/ } public void windowClosed(WindowEvent e) { lis = null; } }); // Set a reasonable size and center the window Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); int x = Math.min(((size.width / 5) * 4), 810); int y = Math.min(((size.height / 5) * 4), 600); lis.setSize(x, y); lis.setLocation((size.width - x) / 2, (size.height - y) / 2); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); lis.setLocationRelativeTo(this); } lis.setVisible(true); }
From source file:com.netscape.admin.certsrv.Console.java
public Console(String adminURL, String localAdminURL, String language, String host, String uid, String passwd) { Vector<String> recentURLs = new Vector<>(); String lastUsedURL;/*from www. java 2s. co m*/ common_init(language); String userid = uid; String password = passwd; if (userid == null) { userid = _preferences.getString(PREFERENCE_UID); } lastUsedURL = _preferences.getString(PREFERENCE_URL); if (lastUsedURL != null) { recentURLs.addElement(lastUsedURL); if (adminURL == null) { adminURL = lastUsedURL; } } if (adminURL == null) { adminURL = localAdminURL; } for (int count = 1; count < MAX_RECENT_URLS; count++) { String temp; temp = _preferences.getString(PREFERENCE_URL + Integer.toString(count)); if (temp != null && temp.length() > 0) recentURLs.addElement(temp); } _frame = new JFrame(); // Set the icon image so that login dialog will inherit it _frame.setIconImage(new RemoteImage("com/netscape/management/client/images/logo16.gif").getImage()); ModalDialogUtil.setWindowLocation(_frame); //enable server auth UtilConsoleGlobals.setServerAuthEnabled(true); _splashScreen = new com.netscape.management.client.console.SplashScreen(_frame); _splashScreen.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); if (_showSplashScreen) _splashScreen.showWindow(); boolean fSecondTry = false; while (true) { LoginDialog dialog = null; _splashScreen.setStatusText(_resource.getString("splash", "PleaseLogin")); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if ((adminURL == null) || (userid == null) || (password == null) || (fSecondTry)) { dialog = new LoginDialog(_frame, userid, adminURL, recentURLs); Dimension paneSize = dialog.getSize(); Dimension screenSize = dialog.getToolkit().getScreenSize(); int centerX = (screenSize.width - paneSize.width) / 2; int centerY = (screenSize.height - paneSize.height) / 2; int x = _preferences.getInt(PREFERENCE_X, centerX); int y = _preferences.getInt(PREFERENCE_Y, centerY); UtilConsoleGlobals.setAdminURL(adminURL); UtilConsoleGlobals.setAdminHelpURL(adminURL); dialog.setInitialLocation(x, y); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); dialog.showModal(); if (dialog.isCancel()) System.exit(0); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); userid = dialog.getUsername(); adminURL = dialog.getURL(); if (!adminURL.startsWith("http://") && !adminURL.startsWith("https://")) adminURL = "http://" + adminURL; password = dialog.getPassword(); } fSecondTry = true; UtilConsoleGlobals.setAdminURL(adminURL); UtilConsoleGlobals.setAdminHelpURL(adminURL); _consoleAdminURL = adminURL; _splashScreen.setStatusText( MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[] { userid })); if (authenticate_user(adminURL, _info, userid, password)) { _splashScreen.setStatusText(_resource.getString("splash", "initializing")); /** * Initialize ldap. In the case config DS is down, the user can restart * the DS from the Console. The Console will need to re-authenticate * the user if that's the case. */ int ldapInitResult = LDAPinitialization(_info); if (ldapInitResult == LDAP_INIT_FAILED) { Debug.println("Console: LDAPinitialization() failed."); System.exit(1); } else if (ldapInitResult == LDAP_INIT_DS_RESTART) { Debug.println("Console: LDAPinitialization() DS restarted."); // Need to re-authenticate the user _splashScreen.setStatusText(MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[] { userid })); if (authenticate_user(adminURL, _info, userid, password)) { _splashScreen.setStatusText(_resource.getString("splash", "initializing")); if (LDAPinitialization(_info) == LDAP_INIT_FAILED) { Debug.println("Console: LDAPinitialization() failed."); System.exit(1); } } else { continue; // Autentication faled, try again } } else if (ldapInitResult == LDAP_INIT_BIND_FAIL) { continue; } boolean rememberUserid = _preferences.getBoolean(PREFERENCE_REMEMBER_UID, true); if (rememberUserid) { _preferences.set(PREFERENCE_UID, userid); _preferences.set(PREFERENCE_URL, adminURL); String recentlyUsedURL; int count = 1; Enumeration<String> urlEnum = recentURLs.elements(); while (urlEnum.hasMoreElements()) { recentlyUsedURL = urlEnum.nextElement(); if (!recentlyUsedURL.equals(adminURL)) _preferences.set(PREFERENCE_URL + Integer.toString(count++), recentlyUsedURL); } for (; count < MAX_RECENT_URLS; count++) { _preferences.remove(PREFERENCE_URL + Integer.toString(count)); } if (dialog != null) { Point p = dialog.getLocation(); _preferences.set(PREFERENCE_X, p.x); _preferences.set(PREFERENCE_Y, p.y); dialog.dispose(); dialog = null; } _preferences.save(); } initialize(_info); if (host == null) { Framework framework = createTopologyFrame(); UtilConsoleGlobals.setRootFrame(framework.getJFrame()); } else { // popup the per server configuration UI // first get the java class name createPerInstanceUI(host); } _frame.dispose(); _splashScreen.dispose(); com.netscape.management.client.console.SplashScreen.removeInstance(); _splashScreen = null; break; } } }
From source file:com.vgi.mafscaling.OpenLoop.java
public void loadData() { fileChooser.setMultiSelectionEnabled(false); if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this)) return;/*from ww w .j av a 2 s . c o m*/ File file = fileChooser.getSelectedFile(); int i, j, k, l; setCursor(new Cursor(Cursor.WAIT_CURSOR)); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file.getAbsoluteFile())); String line = br.readLine(); if (line == null || !line.equals(SaveDataFileHeader)) { JOptionPane.showMessageDialog(null, "Invalid saved data file!", "Error", JOptionPane.ERROR_MESSAGE); return; } line = br.readLine(); String[] elements; JTable table = null; i = k = l = 0; while (line != null) { elements = line.split(",", -1); switch (i) { case 0: Utils.ensureColumnCount(elements.length - 1, mafTable); for (j = 0; j < elements.length - 1; ++j) mafTable.setValueAt(elements[j], i, j); break; case 1: Utils.ensureColumnCount(elements.length - 1, mafTable); for (j = 0; j < elements.length - 1; ++j) mafTable.setValueAt(elements[j], i, j); break; default: int offset = runTables.length * 3 + mafTable.getRowCount(); if (i > 1 && i < offset) { if (l == 0) table = runTables[k++]; Utils.ensureRowCount(elements.length - 1, table); for (j = 0; j < elements.length - 1; ++j) table.setValueAt(elements[j], j, l); l += 1; if (l == 3) l = 0; } } i += 1; line = br.readLine(); } } catch (Exception e) { e.printStackTrace(); logger.error(e); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if (br != null) { try { br.close(); } catch (IOException e) { logger.error(e); } } } }
From source file:com.vgi.mafscaling.VECalc.java
protected void loadLogFile() { fileChooser.setMultiSelectionEnabled(true); if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this)) return;/*from w w w . j a va2s .c o m*/ File[] files = fileChooser.getSelectedFiles(); for (File file : files) { BufferedReader br = null; ArrayDeque<String[]> buffer = new ArrayDeque<String[]>(); try { br = new BufferedReader(new FileReader(file.getAbsoluteFile())); String line = br.readLine(); if (line != null) { String[] elements = line.split("(\\s*)?,(\\s*)?", -1); getColumnsFilters(elements); boolean resetColumns = false; if (logThrottleAngleColIdx >= 0 || logFfbColIdx >= 0 || logSdColIdx >= 0 || (logWbAfrColIdx >= 0 && isOl) || (logStockAfrColIdx >= 0 && !isOl) || (logAfLearningColIdx >= 0 && !isOl) || (logAfCorrectionColIdx >= 0 && !isOl) || logRpmColIdx >= 0 || logMafColIdx >= 0 || logIatColIdx >= 0 || logMpColIdx >= 0) { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE)) resetColumns = true; } if (resetColumns || logThrottleAngleColIdx < 0 || logFfbColIdx < 0 || logSdColIdx < 0 || (logWbAfrColIdx < 0 && isOl) || (logStockAfrColIdx < 0 && !isOl) || (logAfLearningColIdx < 0 && !isOl) || (logAfCorrectionColIdx < 0 && !isOl) || logRpmColIdx < 0 || logMafColIdx < 0 || logIatColIdx < 0 || logMpColIdx < 0) { ColumnsFiltersSelection selectionWindow = new VEColumnsFiltersSelection(false); if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements)) return; } if (logClOlStatusColIdx == -1) clValue = -1; String[] flds; String[] afrflds; boolean removed = false; int i = 2; int clol = -1; int row = getLogTableEmptyRow(); double thrtlMaxChange2 = thrtlMaxChange + thrtlMaxChange / 2.0; double throttle = 0; double pThrottle = 0; double ppThrottle = 0; double afr = 0; double rpm; double ffb; double iat; clearRunTables(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); for (int k = 0; k <= afrRowOffset && line != null; ++k) { line = br.readLine(); if (line != null) buffer.addFirst(line.split(",", -1)); } try { while (line != null && buffer.size() > afrRowOffset) { afrflds = buffer.getFirst(); flds = buffer.removeLast(); line = br.readLine(); if (line != null) buffer.addFirst(line.split(",", -1)); ppThrottle = pThrottle; pThrottle = throttle; throttle = Double.valueOf(flds[logThrottleAngleColIdx]); try { if (row > 0 && Math.abs(pThrottle - throttle) > thrtlMaxChange) { if (!removed) Utils.removeRow(row--, logDataTable); removed = true; } else if (row <= 0 || Math.abs(ppThrottle - throttle) <= thrtlMaxChange2) { // Filters afr = (isOl ? Double.valueOf(afrflds[logWbAfrColIdx]) : Double.valueOf(afrflds[logStockAfrColIdx])); rpm = Double.valueOf(flds[logRpmColIdx]); ffb = Double.valueOf(flds[logFfbColIdx]); iat = Double.valueOf(flds[logIatColIdx]); if (clValue != -1) clol = Integer.valueOf(flds[logClOlStatusColIdx]); boolean flag = isOl ? ((afr <= afrMax || throttle >= thrtlMin) && afr <= afrMax) : (afrMin <= afr); if (flag && clol == clValue && rpmMin <= rpm && ffbMin <= ffb && ffb <= ffbMax && iat <= iatMax) { removed = false; if (!isOl) trims.add(Double.valueOf(flds[logAfLearningColIdx]) + Double.valueOf(flds[logAfCorrectionColIdx])); Utils.ensureRowCount(row + 1, logDataTable); logDataTable.setValueAt(rpm, row, 0); logDataTable.setValueAt(iat, row, 1); logDataTable.setValueAt(Double.valueOf(flds[logMpColIdx]), row, 2); logDataTable.setValueAt(ffb, row, 3); logDataTable.setValueAt(afr, row, 4); logDataTable.setValueAt(Double.valueOf(flds[logMafColIdx]), row, 5); logDataTable.setValueAt(Double.valueOf(flds[logSdColIdx]), row, 6); row += 1; } else removed = true; } else removed = true; } catch (NumberFormatException e) { logger.error(e); JOptionPane.showMessageDialog(null, "Error parsing number at " + file.getName() + " line " + i + ": " + e, "Error processing file", JOptionPane.ERROR_MESSAGE); return; } i += 1; } } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } } catch (Exception e) { logger.error(e); JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE); } finally { if (br != null) { try { br.close(); } catch (IOException e) { logger.error(e); } } } } }
From source file:org.pegadi.client.ApplicationLauncher.java
void publicationButton_actionPerformed(ActionEvent e) { if (pub == null) { this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); pub = new PublicationControl(); pub.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { pub = null;// w w w . j a va 2s . c o m } public void windowClosed(WindowEvent e) { pub = null; } }); pub.pack(); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); pub.setLocationRelativeTo(this); } pub.setVisible(true); }