List of usage examples for java.awt EventQueue invokeLater
public static void invokeLater(Runnable runnable)
From source file:org.zaproxy.zap.extension.zest.ExtensionZest.java
private void addWindowHandle(ScriptNode node, String handle, String url) { ZestScriptWrapper sw = this.getZestTreeModel().getScriptWrapper(node); if (!sw.getZestScript().getClientWindowHandles().contains(handle)) { final ZestClientWindowHandle winHandle = new ZestClientWindowHandle(handle, url, false); EventQueue.invokeLater(new Runnable() { @Override// w ww .j a v a2 s .c o m public void run() { try { addToParent(getRecordingNode(), winHandle); } catch (Exception e) { logger.error(e.getMessage(), e); } } }); } }
From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java
private void updateHistoricalDateChooser(final Date date) { EventQueue.invokeLater(new Runnable() { @Override//from w w w . j a v a2 s . c om public void run() { synchronized (GenericObjectCollectController.this) { unregisterHistoricalDateChooserListener(); clctdatechooserHistorical.getDateChooser().setDate(date); registerHistoricalDateChooserListener(); } } }); }
From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java
/** * Method is used to show the appropriate add column gui. This method can display the add factor gui, * add parameter gui, add characteristic gui, or add comment gui depending on the value of toShow. * * @param toShow can be any one of four static values from the AddColumnGUI class, e.g. ADD_FACTOR_COLUMN, or ADD_COMMENT_COLUMN. *///from w ww .ja v a 2s .c o m protected void showAddColumnsGUI(final int toShow) { EventQueue.invokeLater(new Runnable() { public void run() { AddColumnGUI goingToDisplay; switch (toShow) { case AddColumnGUI.ADD_FACTOR_COLUMN: goingToDisplay = new AddColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_FACTOR_COLUMN); break; case AddColumnGUI.ADD_CHARACTERISTIC_COLUMN: goingToDisplay = new AddColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_CHARACTERISTIC_COLUMN); break; case AddColumnGUI.ADD_PARAMETER_COLUMN: goingToDisplay = new AddColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_PARAMETER_COLUMN); break; case AddColumnGUI.ADD_COMMENT_COLUMN: goingToDisplay = new AddColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_COMMENT_COLUMN); break; default: goingToDisplay = null; } if (goingToDisplay != null) { goingToDisplay.createGUI(); // do this to ensure that the gui is fully created before displaying it. parentFrame.showJDialogAsSheet(goingToDisplay); } } }); }
From source file:net.rptools.maptool.client.ui.MapToolFrame.java
public void close() { ServerDisconnectHandler.disconnectExpected = true; MapTool.disconnect();//from w w w .ja va 2s. c o m getDockingManager().saveLayoutDataToFile(AppUtil.getAppHome("config").getAbsolutePath() + "/layout.dat"); // If closing cleanly, remove the autosave file MapTool.getAutoSaveManager().purge(); setVisible(false); EventQueue.invokeLater(new Runnable() { public void run() { dispose(); } }); }
From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java
protected void showRenameColumnsGUI(final TableColumn column) { EventQueue.invokeLater(new Runnable() { public void run() { RenameColumnGUI goingToDisplay = null; String toShow = column.getHeaderValue().toString().substring(0, column.getHeaderValue().toString().indexOf("[")); if (toShow.contains("Characteristics")) { goingToDisplay = new RenameColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_CHARACTERISTIC_COLUMN, column);/* w w w . ja v a 2 s . co m*/ } else if (toShow.contains("Parameter Value")) { goingToDisplay = new RenameColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_PARAMETER_COLUMN, column); } else if (toShow.contains("Comment")) { goingToDisplay = new RenameColumnGUI(Spreadsheet.this, AddColumnGUI.ADD_COMMENT_COLUMN, column); } if (goingToDisplay != null) { goingToDisplay.createGUI(); // do this to ensure that the gui is fully created before displaying it. parentFrame.showJDialogAsSheet(goingToDisplay); } } }); }
From source file:org.zaproxy.zap.extension.zest.ExtensionZest.java
public void clientMessageReceived(JSONObject clientMessage, String windowId, String url) { ZestStatement stmt = null;//from w ww.ja v a2 s .c om String windowHandle; final ScriptNode clientRecordingNode = getRecordingNode(); if (clientMessage.getString("type").equals("heartbeat")) { // If this is a new window, get a handle to it this.getWindowHandle(clientMessage, getRecordingNode(), windowId, url); return; } if (!clientMessage.containsKey("data")) { return; } try { String data = clientMessage.getString("data"); windowHandle = this.getWindowHandle(clientMessage, clientRecordingNode, windowId, url); if ("a click event happened!".equals(data)) { ZestClientElementClick clientStmt = new ZestClientElementClick(); clientStmt.setWindowHandle(windowHandle); clientStmt.setType("xpath"); clientStmt.setElement(clientMessage.getString("originalTargetPath")); stmt = clientStmt; } else if ("a keypress event happened!".equals(data)) { String element = clientMessage.getString("originalTargetPath"); String eventDataStr = clientMessage.getString("eventData"); JSONObject eventDataObj = JSONObject.fromObject(eventDataStr); String key = eventDataObj.getString("key"); boolean appended = false; if (key.length() > 1) { // Ignore all 'control' keys, at least initially logger.debug("Client recording, ignoring " + key); } else { if (getRecordingNode().getChildCount() > 0) { // We get key presses one at a time - try to combine them up where possible ScriptNode lastChild = (ScriptNode) clientRecordingNode.getLastChild(); ZestElement lastElement = ZestZapUtils.getElement(lastChild); if (lastElement != null && lastElement instanceof ZestClientElementSendKeys) { ZestClientElementSendKeys sk = (ZestClientElementSendKeys) lastElement; if (sk.getWindowHandle().equals(windowHandle) && sk.getType().equals("xpath") && sk.getElement().equals(element)) { sk.setValue(sk.getValue() + key); getZestTreeModel().nodeChanged(lastChild); this.refreshNode(clientRecordingNode); appended = true; } } } if (!appended) { ZestClientElementSendKeys sk = new ZestClientElementSendKeys(); sk.setWindowHandle(windowHandle); sk.setType("xpath"); sk.setElement(clientMessage.getString("originalTargetPath")); sk.setValue(key); stmt = sk; } } } } catch (Exception e1) { logger.error(e1.getMessage(), e1); } if (stmt != null) { final ZestStatement stmtFinal = stmt; EventQueue.invokeLater(new Runnable() { @Override public void run() { try { addToParent(clientRecordingNode, stmtFinal, false); } catch (Exception e) { logger.error(e.getMessage(), e); } } }); } }
From source file:net.rptools.maptool.launcher.MapToolLauncher.java
/** * @param args// w ww.java 2 s . co m * the command line arguments */ public static void main(String args[]) { log.setLevel(Level.WARNING); EventQueue.invokeLater(new Runnable() { @Override public void run() { try { new MapToolLauncher().setVisible(true); } catch (final IOException e) { logMsg(Level.SEVERE, "IOException starting MapToolLauncher", "msg.error.startingMapTool", e); //$NON-NLS-1$ $NON-NLS-2$ } catch (final URISyntaxException e) { logMsg(Level.SEVERE, "URISyntaxException starting MapToolLauncher", "msg.error.startingMapTool", //$NON-NLS-1$ e); //$NON-NLS-2$ } } }); }
From source file:org.apache.log4j.chainsaw.LogUI.java
void removeWelcomePanel() { EventQueue.invokeLater(new Runnable() { public void run() { if (getTabbedPane().containsWelcomePanel()) { getTabbedPane().remove(getTabbedPane() .getComponentAt(getTabbedPane().indexOfTab(ChainsawTabbedPane.WELCOME_TAB))); }/*from ww w.j a v a2 s.co m*/ } }); }
From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java
private JPopupMenu createDataviewPopup() { JPopupMenu menu = new JPopupMenu(); JMenuItem addColGroup = new JMenuItem("Group Column"); JMenuItem addGroup = new JMenuItem("Group series"); JMenuItem addData = new JMenuItem("Edit dataset.."); menu.add(addColGroup);//from w w w . ja v a 2s .c o m menu.add(addGroup); menu.add(addData); addColGroup.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { groupCategoryByCol(); refreshData(); } }); addGroup.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { groupCategory(); refreshData(); } }); addData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new DatasetEditor(table, datasetTable, table.getName(), new IDataRefreshListener() { @Override public void refreshDataset() { refreshData(); } }).setVisible(true); } }); } }); return menu; }
From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java
License:asdf
/** * Set status message. Separate thread necessary or UI hangs * @param message// ww w .ja va 2 s . co m */ public void setMessage(String message) { if (EventQueue.isDispatchThread()) { if (null == message || 0 == message.length()) message = " "; if (message.length() > 500) message = message.substring(0, 500); messageLabel.setText(message); } else { final String msg = message; EventQueue.invokeLater(new Runnable() { public void run() { setMessage(msg); } }); } statusPanel.updateUI(); }