/** * When a message is received determines whether to open a new chat window or chat window tab, or * to indicate that a message is received from a contact which already has an open chat. When the * chat is found checks if in mode "Auto popup enabled" and if this is the case shows the message * in the appropriate chat panel. * * @param evt the event containing details on the received message */ public void messageReceived(MessageReceivedEvent evt) { if (logger.isTraceEnabled()) logger.trace("MESSAGE RECEIVED from contact: " + evt.getSourceContact().getAddress()); Contact protocolContact = evt.getSourceContact(); ContactResource contactResource = evt.getContactResource(); Message message = evt.getSourceMessage(); int eventType = evt.getEventType(); MetaContact metaContact = GuiActivator.getContactListService().findMetaContactByContact(protocolContact); if (metaContact != null) { messageReceived( protocolContact, contactResource, metaContact, message, eventType, evt.getTimestamp(), evt.getCorrectedMessageUID(), evt.isPrivateMessaging(), evt.getPrivateMessagingContactRoom()); } else { if (logger.isTraceEnabled()) logger.trace("MetaContact not found for protocol contact: " + protocolContact + "."); } }
private void initLogger() { log = Logger.getLogger(this.getClass().getName()); log.setUseParentHandlers(false); log.setLevel(Level.ALL); try { new File(LOG_FILENAME).getParentFile().mkdirs(); StreamHandler handle = new StreamHandler(new FileOutputStream(LOG_FILENAME), new SimpleFormatter()) { @Override public boolean isLoggable(LogRecord record) { return true; // record.getLevel() == ENLevels.ERROR; } @Override public void publish(LogRecord record) { super.publish(record); } }; log.addHandler(handle); } catch (IOException e) { } }
private void handleResquest(String s) { Logger.info("@ClientMediator.handleResquest id=" + _id + " :s=" + s); if (s.indexOf("sync") > -1) { tellClient("sync " + s.split(" ")[1], 0); } else if (s.indexOf("get-status") > -1) { Integer[] ts = (Integer[]) tankStateProxy().getTanks(); Logger.debug("ClientMediator.handleResquest: ts.len=" + ts.length); for (int i = 0; i < ts.length; i++) { ClientMediator cm = (ClientMediator) appFacade().retrieveMediator(Const.CLIENT_MEDIATOR + ts[i].intValue()); TankState t = cm.getState(); if (t == null || cm.destroyd) continue; tellClient( "create tank " + t.tankID + " " + t.tankName + " 0 0 " + t.life + " 500 " + t.x + " " + t.y + " " + cm.getTankAngle() + " " + cm.getGunAngle(), 0); } } else if (s.indexOf("born") > -1) { if (_state == null) Arena.addReq(_id, s, null); } else if (s.indexOf("move-to") > -1) { if (_state != null) { Arena.addReq(_id, s, getState()); } } else if (s.indexOf("rotate-to") > -1) { // rotate gun if (_state != null) { Arena.addReq(_id, s, getState()); } } else if (s.indexOf("shoot") > -1) { if (_state != null) { Arena.addReq(_id, s, getState()); } } else if (s.indexOf("talk") > -1) { if (_state != null) s = "talk " + _state.tankName + " say: " + s.substring(5); this.sendNotification(Const.BROAD_CAST, s, null); } }
public void setCurrentContact(Contact contact, String resourceName) { if (contact == null) { this.otrContact = null; this.setPolicy(null); this.setStatus(ScSessionStatus.PLAINTEXT); return; } if (resourceName == null) { OtrContact otrContact = OtrContactManager.getOtrContact(contact, null); if (this.otrContact == otrContact) return; this.otrContact = otrContact; this.setStatus(OtrActivator.scOtrEngine.getSessionStatus(otrContact)); this.setPolicy(OtrActivator.scOtrEngine.getContactPolicy(contact)); return; } for (ContactResource resource : contact.getResources()) { if (resource.getResourceName().equals(resourceName)) { OtrContact otrContact = OtrContactManager.getOtrContact(contact, resource); if (this.otrContact == otrContact) return; this.otrContact = otrContact; this.setStatus(OtrActivator.scOtrEngine.getSessionStatus(otrContact)); this.setPolicy(OtrActivator.scOtrEngine.getContactPolicy(contact)); return; } } logger.debug("Could not find resource for contact " + contact); }
public void setViewportSize(Dimension _size) { mViewportSize = new Dimension(_size); int w = mViewportSize.width + 2 * INSET; int h = mViewportSize.height + 2 * INSET; // create an off screen buffer for drawing if (mBackBufferGfx != null) { mBackBufferGfx.dispose(); // free old one } mBackBufferImg = createImage(w, h); Logger.log("Create off-screen buffer of " + w + "x" + h + " (" + mBackBufferImg + ")"); mBackBufferGfx = mBackBufferImg.getGraphics(); // Determine the graphics context for the viewport mDrawGfx = mBackBufferGfx.create(INSET, INSET, mViewportSize.width, mViewportSize.height); mViewport.setActualSize(mViewportSize); Logger.log("Viewport resized"); }
public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand() == "timer") { if (counter >= imagePaths.length) { timer.stop(); counter = 0; PlayStopButton.setText("Play"); } else { try { // if the array contains URLs if (imagePaths[counter].contains("http://")) { scrollPane.setToolTipText(imagePaths[counter]); imageIcon = new ImageIcon((new URL(imagePaths[counter++]))); scrollPane.setViewportView(new JLabel(imageIcon)); } // if the array contains local images else { image.setIcon(new ImageIcon(imagePaths[counter])); image.setToolTipText(imagePaths[counter++]); } } catch (MalformedURLException ex) { Logger.getLogger(Slideshow.class.getName()).log(Level.SEVERE, null, ex); image = new JLabel("?" + imagePaths); } } } }
public void scrollToAttribute(Attribute a) { if (!a.getDescriptor().getConfig().equals(getConfig())) { logger.fine("Cannot scroll to attribute that isn't attached to this type of descriptor"); return; } int rowIndex = getCurrentModel().getRowForDescriptor(a.getDescriptor()); int colIndex = getCurrentModel().getColumnForAttribute(a); JScrollPane scrollPane = (JScrollPane) this.getComponent(0); JViewport viewport = (JViewport) scrollPane.getViewport(); EnhancedTable table = (EnhancedTable) viewport.getView(); // This rectangle is relative to the table where the // northwest corner of cell (0,0) is always (0,0). Rectangle rect = table.getCellRect(rowIndex, colIndex, true); // The location of the viewport relative to the table Point pt = viewport.getViewPosition(); // Translate the cell location so that it is relative // to the view, assuming the northwest corner of the // view is (0,0) rect.setLocation(rect.x - pt.x, rect.y - pt.y); // Scroll the area into view viewport.scrollRectToVisible(rect); }
/** * Main method. Begins the GUI, and the rest of the program. * * @param args the command line arguments */ public static void main(String args[]) { // playSound(); try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(mainForm.class.getName()).log(Level.SEVERE, null, ex); } // </editor-fold> /* Create and display the form */ EventQueue.invokeLater( new Runnable() { @Override public void run() { new mainForm().setVisible(true); } }); }
public void addClient() { client = new Canvas() { public void paint(Graphics g) { super.paint(g); } }; client.setBackground(new Color(30, 220, 40)); clientCont.add(client); clientCont.validate(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client); log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow()); Rectangle toFocusBounds = toFocus.getBounds(); toFocusBounds.setLocation(toFocus.getLocationOnScreen()); f.validate(); // KDE doesn't accept clicks on title as activation - click below title Rectangle fbounds = f.getBounds(); fbounds.y += f.getInsets().top; fbounds.height -= f.getInsets().top; Process proc = startClient( new Rectangle[] { fbounds, dummy.getBounds(), toFocusBounds, new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()), new Rectangle(10, 130, 20, 20) }, pid.getWindow()); new ClientWatcher(client, proc, clientCont).start(); }
public MainUI() { super("Neato Burrito"); dLog.trace("In MainUI: " + MainUI.class.getCanonicalName()); this.setBounds(0, 0, 500, 500); Container container = getContentPane(); container.add(theDesktop); setJMenuBar(menubar); JMenu fileMenu = new JMenu("File"); JMenuItem exitItem = new JMenuItem("Exit"); exitItem.setMnemonic('X'); exitItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); fileMenu.add(exitItem); menubar.add(fileMenu); StatusUI statUI = new StatusUI(); statUI.setVisible(true); theDesktop.add(statUI); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); }
// @Override public synchronized String getIP() { try { return NetUtils.getIPAddress(); } catch (ConnectException ex) { Logger.getLogger(Mapa.class.getName()).log(Level.SEVERE, null, ex); } return ""; }
public void actionPerformed(ActionEvent e) { try { undo.redo(); } catch (CannotRedoException ex) { Logger.getLogger(RedoAction.class.getName()).log(Level.SEVERE, "Unable to redo", ex); } update(); undoAction.update(); }
public void stop() { _thread.stop(); try { _socket.close(); } catch (Exception e) { Logger.error("@ClientMediator.stop error"); } // kill tank }
/** * stores the data to a HTML file * * @param aFile file object */ private void storeToHtmlFile(final File aFile, final UARTDataSet aDataSet) { try { toHtmlPage(aFile, aDataSet); } catch (final IOException exception) { // Make sure to handle IO-interrupted exceptions properly! if (!HostUtils.handleInterruptedException(exception)) { LOG.log(Level.WARNING, "HTML export failed!", exception); } } }
public void toberun() { if (_writer == null || _reader == null) { Logger.error("@ClientMediator.toberun: _writer or _reader null"); return; } String s; while (true) { s = null; try { s = _reader.readLine(); } catch (Exception e) { Logger.error("@ClientMediator.toberun: _read error, excep is " + e.toString()); break; } if (s != null && s.length() > 0) { handleResquest(new String(s)); } } Arena.addReq(_id, Const.LOSE_CONNECTION, null); }
/** * When a sent message is delivered shows it in the chat conversation panel. * * @param evt the event containing details on the message delivery */ public void messageDelivered(MessageDeliveredEvent evt) { Contact contact = evt.getDestinationContact(); MetaContact metaContact = GuiActivator.getContactListService().findMetaContactByContact(contact); if (logger.isTraceEnabled()) logger.trace("MESSAGE DELIVERED to contact: " + contact.getAddress()); ChatPanel chatPanel = chatWindowManager.getContactChat(metaContact, false); if (chatPanel != null) { Message msg = evt.getSourceMessage(); ProtocolProviderService protocolProvider = contact.getProtocolProvider(); if (logger.isTraceEnabled()) logger.trace( "MESSAGE DELIVERED: process message to chat for contact: " + contact.getAddress() + " MESSAGE: " + msg.getContent()); chatPanel.addMessage( this.mainFrame.getAccountAddress(protocolProvider), this.mainFrame.getAccountDisplayName(protocolProvider), evt.getTimestamp(), Chat.OUTGOING_MESSAGE, msg.getContent(), msg.getContentType(), msg.getMessageUID(), evt.getCorrectedMessageUID()); if (evt.isSmsMessage() && !ConfigurationUtils.isSmsNotifyTextDisabled()) { chatPanel.addMessage( contact.getDisplayName(), new Date(), Chat.ACTION_MESSAGE, GuiActivator.getResources().getI18NString("service.gui.SMS_SUCCESSFULLY_SENT"), "text"); } } }
public void unloadPlates() throws ChippingManagerException { seedChipperGUIController.getSeedChipperController().validateChangePriorToSave(); // List<Plate> platesToUnload = getFailedChiplates(); DefaultListModel destinationsListModel = (DefaultListModel) destinationsList.getModel(); int[] destinationsLoadCount = new int[destinationsListModel.getSize()]; // Assign destinations to the seed plates int destinationsListIndex = 0; updateSeedPlateStatus(); updateChipPlateStatus(); // Set the respective locations in the seed plates for (int i = 0; i < seedPlates.length; i++) { // todo: unload criteria to be refactored to plate object.... if (SCANNED.equals(seedPlates[i].getStatus()) && seedPlates[i].getPrescanStatus() != null) { destinationsListIndex = findDestinationListIndex( destinationsListModel, destinationsLoadCount, destinationsListIndex, i); // Decide the destination String seedPlateDestination = destinationsListModel.getElementAt(destinationsListIndex).toString(); logger.info( "assigning seed plates to plate " + seedPlates[i].getDeckNest() + " ->> " + seedPlateDestination); seedPlates[i].setStorageLocation(seedPlateDestination); destinationsLoadCount[destinationsListIndex]++; destinationsListIndex++; seedPlates[i].setPrescanStatus(CHIPPED); } } seedChipperGUIController .getSeedChipperController() .unloadChipperRun(userIDComboBox.getSelectedItem().toString()); // // seedChipperGUIController.getSeedChipperController().syncPrescannedPlatesList(platesToUnload, // seedPlates, chipPlates); seedChipperGUIController.drawDeck(); seedChipperGUIController.drawRunsOnDeck(); logger.info("Plates unloaded to seed store"); this.dispose(); }
/** * Shows a warning message to the user when message delivery has failed. * * @param evt the event containing details on the message delivery failure */ public void messageDeliveryFailed(MessageDeliveryFailedEvent evt) { logger.error(evt.getReason()); String errorMsg = null; Message sourceMessage = (Message) evt.getSource(); Contact sourceContact = evt.getDestinationContact(); MetaContact metaContact = GuiActivator.getContactListService().findMetaContactByContact(sourceContact); if (evt.getErrorCode() == MessageDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED) { errorMsg = GuiActivator.getResources() .getI18NString( "service.gui.MSG_DELIVERY_NOT_SUPPORTED", new String[] {sourceContact.getDisplayName()}); } else if (evt.getErrorCode() == MessageDeliveryFailedEvent.NETWORK_FAILURE) { errorMsg = GuiActivator.getResources().getI18NString("service.gui.MSG_NOT_DELIVERED"); } else if (evt.getErrorCode() == MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED) { errorMsg = GuiActivator.getResources().getI18NString("service.gui.MSG_SEND_CONNECTION_PROBLEM"); } else if (evt.getErrorCode() == MessageDeliveryFailedEvent.INTERNAL_ERROR) { errorMsg = GuiActivator.getResources().getI18NString("service.gui.MSG_DELIVERY_INTERNAL_ERROR"); } else { errorMsg = GuiActivator.getResources().getI18NString("service.gui.MSG_DELIVERY_ERROR"); } String reason = evt.getReason(); if (reason != null) errorMsg += " " + GuiActivator.getResources() .getI18NString("service.gui.ERROR_WAS", new String[] {reason}); ChatPanel chatPanel = chatWindowManager.getContactChat(metaContact, sourceContact); chatPanel.addMessage( sourceContact.getAddress(), metaContact.getDisplayName(), new Date(), Chat.OUTGOING_MESSAGE, sourceMessage.getContent(), sourceMessage.getContentType(), sourceMessage.getMessageUID(), evt.getCorrectedMessageUID()); chatPanel.addErrorMessage(metaContact.getDisplayName(), errorMsg); chatWindowManager.openChat(chatPanel, false); }
public static void closeActiveWindow() { for (int i = 0; i < windows.size(); i++) { try { AbstractWindow window = (AbstractWindow) windows.get(i); if (window != null && window.isActive()) { closeWindow(window); } } catch (Exception e) { logger.warning("Cannot close window: " + e.getMessage()); } } }
public void dispose() { super.dispose(); if (mViewport != null) { mViewport.terminate(); mViewport = null; } setUniverse(null); if (mBackBufferGfx != null) { mBackBufferGfx.dispose(); } Logger.log("FramedViewportContainer terminated"); }
/** * Parses the given http response. * * @param response the http response to parse * @return the new account */ private NewAccount parseHttpResponse(String response) { NewAccount newAccount = null; try { JSONObject jsonObject = (JSONObject) JSONValue.parseWithException(response); boolean isSuccess = (Boolean) jsonObject.get("success"); if (isSuccess) { newAccount = new NewAccount( (String) jsonObject.get("sip_address"), passField.getPassword(), null, (String) jsonObject.get("outbound_proxy")); String xcapRoot = (String) jsonObject.get("xcap_root"); // as sip2sip adds @sip2sip.info at the end of the // xcap_uri but doesn't report it in resullt after // creating account, we add it String domain = null; int delimIndex = newAccount.getUserName().indexOf("@"); if (delimIndex != -1) { domain = newAccount.getUserName().substring(delimIndex); } if (domain != null) { if (xcapRoot.endsWith("/")) xcapRoot = xcapRoot.substring(0, xcapRoot.length() - 1) + domain; else xcapRoot += domain; } newAccount.setXcapRoot(xcapRoot); } else { showErrorMessage((String) jsonObject.get("error_message")); } } catch (Throwable e1) { if (logger.isInfoEnabled()) logger.info("Failed Json parsing.", e1); } return newAccount; }
@Override @SuppressWarnings("SleepWhileHoldingLock") public void run() { try { // initialize the statusbar status.removeAll(); JProgressBar progress = new JProgressBar(); progress.setMinimum(0); progress.setMaximum(doc.getLength()); status.add(progress); status.revalidate(); // start writing Writer out = new FileWriter(f); Segment text = new Segment(); text.setPartialReturn(true); int charsLeft = doc.getLength(); int offset = 0; while (charsLeft > 0) { doc.getText(offset, Math.min(4096, charsLeft), text); out.write(text.array, text.offset, text.count); charsLeft -= text.count; offset += text.count; progress.setValue(offset); try { Thread.sleep(10); } catch (InterruptedException e) { Logger.getLogger(FileSaver.class.getName()).log(Level.SEVERE, null, e); } } out.flush(); out.close(); } catch (IOException e) { final String msg = e.getMessage(); SwingUtilities.invokeLater( new Runnable() { public void run() { JOptionPane.showMessageDialog( getFrame(), "Could not save file: " + msg, "Error saving file", JOptionPane.ERROR_MESSAGE); } }); } catch (BadLocationException e) { System.err.println(e.getMessage()); } // we are done... get rid of progressbar status.removeAll(); status.revalidate(); }
public PrintfEditor(Frame frame, String title) { super(frame, title, false); originalTemplate = new PrintfTemplate(); editableTemplate = new PrintfTemplate(); try { jbInit(); pack(); initMatches(); } catch (Exception exc) { String logMessage = "Could not set up the printf editor"; logger.critical(logMessage, exc); JOptionPane.showMessageDialog(frame, logMessage, "Printf Editor", JOptionPane.ERROR_MESSAGE); } }
/** * Create preview component. * * @param type type * @param comboBox the options. * @param prefSize the preferred size * @return the component. */ private static Component createPreview(int type, final JComboBox comboBox, Dimension prefSize) { JComponent preview = null; if (type == DeviceConfigurationComboBoxModel.AUDIO) { Object selectedItem = comboBox.getSelectedItem(); if (selectedItem instanceof AudioSystem) { AudioSystem audioSystem = (AudioSystem) selectedItem; if (!NoneAudioSystem.LOCATOR_PROTOCOL.equalsIgnoreCase(audioSystem.getLocatorProtocol())) { preview = new TransparentPanel(new GridBagLayout()); createAudioSystemControls(audioSystem, preview); } } } else if (type == DeviceConfigurationComboBoxModel.VIDEO) { JLabel noPreview = new JLabel( NeomediaActivator.getResources().getI18NString("impl.media.configform.NO_PREVIEW")); noPreview.setHorizontalAlignment(SwingConstants.CENTER); noPreview.setVerticalAlignment(SwingConstants.CENTER); preview = createVideoContainer(noPreview); preview.setPreferredSize(prefSize); Object selectedItem = comboBox.getSelectedItem(); CaptureDeviceInfo device = null; if (selectedItem instanceof DeviceConfigurationComboBoxModel.CaptureDevice) device = ((DeviceConfigurationComboBoxModel.CaptureDevice) selectedItem).info; Exception exception; try { createVideoPreview(device, preview); exception = null; } catch (IOException ex) { exception = ex; } catch (MediaException ex) { exception = ex; } if (exception != null) { logger.error("Failed to create preview for device " + device, exception); device = null; } } return preview; }
private void initPluginComponents() { // Search for plugin components registered through the OSGI bundle // context. ServiceReference[] serRefs = null; String osgiFilter = "(" + Container.CONTAINER_ID + "=" + Container.CONTAINER_CONTACT_LIST.getID() + ")"; try { serRefs = GuiActivator.bundleContext.getServiceReferences( PluginComponentFactory.class.getName(), osgiFilter); } catch (InvalidSyntaxException exc) { logger.error("Could not obtain plugin reference.", exc); } if (serRefs != null) { for (ServiceReference serRef : serRefs) { PluginComponentFactory factory = (PluginComponentFactory) GuiActivator.bundleContext.getService(serRef); PluginComponent component = factory.getPluginComponentInstance(this); Object selectedValue = getContactList().getSelectedValue(); if (selectedValue instanceof MetaContact) { component.setCurrentContact((MetaContact) selectedValue); } else if (selectedValue instanceof MetaContactGroup) { component.setCurrentContactGroup((MetaContactGroup) selectedValue); } String pluginConstraints = factory.getConstraints(); Object constraints; if (pluginConstraints != null) constraints = UIServiceImpl.getBorderLayoutConstraintsFromContainer(pluginConstraints); else constraints = BorderLayout.SOUTH; this.add((Component) component.getComponent(), constraints); this.repaint(); } } GuiActivator.getUIService().addPluginComponentListener(this); }
public void cancelUpdate(String window_name) { try { saveUpdateSettings(); if (!cmd.getQuiet()) { if (window_name == null) { window = new MainWindow(); } else { window = (AbstractWindow) newInstance(window_name); } addWindow(window); window.setVisible(window.getWindowSettings().getVisible()); window.postLoad(); } } catch (Exception ex) { ex.printStackTrace(); logger.severe("Could not start application: " + ex.getMessage()); } }
FramedViewportContainer(Universe _game, Viewport _viewport) { super("Foobar"); setBackground(BG_COLOR); show(); mTrigger = new TimerTrigger(this); mTrigger.setRepeat(true); setUniverse(_game); setViewport(_viewport); this.addWindowListener(this); this.addComponentListener(this); this.addMouseListener(this); this.addMouseMotionListener(this); Logger.log("FramedViewportContainer created"); }
public class MyFileListTable extends MyDefaultTable { private static Logger log = Logger.getLogger(MyFileListTable.class.getName()); public MyFileListTable() { super(); } public MyFileListTable(TableModel dm) { super(dm); } protected void init() { super.init(); setRowHeight(16); setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); enableAutoPack(true); } public TableCellRenderer getCellRenderer(int row, int column) { // log.info(row+", "+column); return super.getCellRenderer(row, column); } protected void resizeTable() { if (getColumnCount() > 1) { packColumn(this, 0); packColumn(this, 1); } } /** Overrides <code>JComponent</code>'s <code>getToolTipText</code> */ public String getToolTipText(MouseEvent e) { String tip = null; java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); // int colIndex = columnAtPoint(p); // int realColumnIndex = convertColumnIndexToModel(colIndex); TableModel model = getModel(); tip = (String) model.getValueAt(rowIndex, 1); return tip; } }
/** Complete for browser usage */ public HelpBrowserFrame( final String langlocale, final String zipfile, final String startpage, boolean plugin) { this.plugin = plugin; this.browser = new HelpBrowser(this, langlocale, zipfile, startpage); setIconImage(MiscToolkit.loadImageIcon("/data/toolbar/help-browser.png").getImage()); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { Init(); if (!plugin) { // standalone - fix size this.setSize(new Dimension(780, 550)); } else { loadWindowState(); } } catch (final Throwable e) { logger.log(Level.SEVERE, "Exception thrown in constructor", e); } }
// /home/jean/Área de Trabalho/Link para Dropbox/workspace/GSPAnalyzer/grails app // examples/rgms-master/grails-app/views/bookChapter/show.gsp private void process(String uri) { try { URL url; try { url = new URL(uri); } catch (java.net.MalformedURLException mfu) { int idx = uri.indexOf(':'); if (idx == -1 || idx == 1) { // try file url = new URL("file:" + uri); } else { throw mfu; } } // Call SimpleHtmlRendererContext.navigate() // which implements incremental rendering. this.rcontext.navigate(url, null); } catch (Exception err) { logger.log(Level.SEVERE, "Error trying to load URI=[" + uri + "].", err); } }