/** Set up component. */ protected void initialize() { JComponent component = getComponent(); component.setToolTipText(label.getToolTipText()); component.setEnabled(editable); component.setOpaque(false); }
/** * DOCUMENT ME! * * @param evt DOCUMENT ME! */ private void lblDokumentLinkMouseClicked(final java.awt.event.MouseEvent evt) { final String url = lblDokumentLink.getToolTipText(); try { BrowserLauncher.openURL(url); } catch (Exception ex) { LOG.error("fehler beim öffnen der url", ex); } }
@Override public void mouseClicked(MouseEvent arg0) { if (arg0.getSource() instanceof JLabel) { JLabel source = (JLabel) arg0.getSource(); String[] temp = source.getToolTipText().split(","); setChanged(); notifyObservers(new Command(temp[0], temp[1])); } }
/** * Displays information about the attachment. * * @param invoker The component where the clicks occurred. * @param p The location of the mouse pressed. */ private void displayInformation(JComponent invoker, Point p) { String text = label.getToolTipText(); if (text == null || text.trim().length() == 0) return; JComponent comp; if (preview != null) { comp = preview; } else { JLabel l = new JLabel(); l.setText(text); comp = l; } TinyDialog d = new TinyDialog(null, comp, TinyDialog.CLOSE_ONLY); d.setModal(false); d.getContentPane().setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); SwingUtilities.convertPointToScreen(p, invoker); d.pack(); d.setLocation(p); d.setVisible(true); }
/* For enabling the renderer to handle icons. */ @Override protected void setValue(Object value) { if (value instanceof Icon) { setIcon((Icon) value); setText(null); } else if (value instanceof JLabel) { JLabel lab = (JLabel) value; setIcon(lab.getIcon()); setToolTipText(lab.getToolTipText()); if (lab.getIcon() != null) { setText(null); } } else { // this is plain text setIcon(null); setToolTipText(null); if (value != null) { setText(value.toString()); } else { setText(null); } } }
private void createComponents() { background = new JPanel(new GridBagLayout()); windowTitle = new JLabel("<html><h3>ATLAS CREATION IN PROGRESS...</h3></html>"); title = new JLabel("Processing maps of atlas:"); mapInfoLabel = new JLabel( "Processing map ABCDEFGHIJKLMNOPQRSTUVWXYZ-nn " + "of layer ABCDEFGHIJKLMNOPQRSTUVWXYZ from map source ABCDEFGHIJKLMNOPQRSTUVWXYZ"); atlasMapsDone = new JLabel("000 of 000 done"); atlasPercent = new JLabel(String.format(TEXT_TENTHPERCENT, 100.0)); atlasTimeLeft = new JLabel("Time remaining: 00000 minutes 00 seconds", JLabel.RIGHT); atlasProgressBar = new JProgressBar(); mapDownloadTitle = new JLabel(TEXT_MAP_DOWNLOAD + "000"); mapDownloadElementsDone = new JLabel("1000000 of 1000000 tiles done"); mapDownloadPercent = new JLabel(String.format(TEXT_PERCENT, 100)); mapDownloadTimeLeft = new JLabel("Time remaining: 00000 minutes 00 seconds", JLabel.RIGHT); mapDownloadProgressBar = new JProgressBar(); mapCreation = new JLabel("Map Creation"); mapCreationProgressBar = new JProgressBar(); nrOfDownloadedBytesPerSecond = new JLabel("Average download speed"); nrOfDownloadedBytesPerSecondValue = new JLabel(); nrOfDownloadedBytes = new JLabel("Downloaded"); nrOfDownloadedBytesValue = new JLabel(); nrOfCacheBytes = new JLabel("Loaded from tile store"); nrOfCacheBytesValue = new JLabel(); activeDownloads = new JLabel("Active tile fetcher threads"); activeDownloadsValue = new JLabel(); retryableDownloadErrors = new JLabel("Transient download errors"); retryableDownloadErrors.setToolTipText( "<html><h4>Download errors for the current map and for the total atlas (transient/unrecoverable)</h4>" + "<p>Mobile Atlas Creator retries failed tile downloads up to two times. <br>" + "If the tile downloads fails the second time the tile will be counted as <br>" + "<b>unrecoverable</b> error and not tried again during the current map creation run.<br></p></html>"); retryableDownloadErrorsValue = new JLabel(); retryableDownloadErrorsValue.setToolTipText(retryableDownloadErrors.getToolTipText()); permanentDownloadErrors = new JLabel("Unrecoverable download errors"); permanentDownloadErrors.setToolTipText(retryableDownloadErrors.getToolTipText()); permanentDownloadErrorsValue = new JLabel(); permanentDownloadErrorsValue.setToolTipText(permanentDownloadErrors.getToolTipText()); totalDownloadTime = new JLabel("Total creation time"); totalDownloadTimeValue = new JLabel(); ignoreDlErrors = new JCheckBox( "Ignore download errors and continue automatically", Settings.getInstance().ignoreDlErrors); ignoreDlErrors.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { downloadController.setIgnoreErrors(ignoreDlErrors.isSelected()); } }); statusLabel = new JLabel("Status:"); Font f = statusLabel.getFont(); statusLabel.setFont(f.deriveFont(Font.BOLD)); abortAtlasCreationButton = new JButton("Abort creation"); abortAtlasCreationButton.setToolTipText("Abort current Atlas download"); dismissWindowButton = new JButton("Close Window"); dismissWindowButton.setToolTipText("Atlas creation in progress..."); dismissWindowButton.setVisible(false); openProgramFolderButton = new JButton("Open Atlas Folder"); openProgramFolderButton.setToolTipText("Atlas creation in progress..."); openProgramFolderButton.setEnabled(false); pauseResumeDownloadButton = new JButton("Pause/Resume"); GBC gbcRIF = GBC.std().insets(0, 0, 20, 0).fill(GBC.HORIZONTAL); GBC gbcEol = GBC.eol(); GBC gbcEolFill = GBC.eol().fill(GBC.HORIZONTAL); GBC gbcEolFillI = GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 0); // background.add(windowTitle, gbcEolFill); // background.add(Box.createVerticalStrut(10), gbcEol); background.add(mapInfoLabel, gbcEolFill); background.add(Box.createVerticalStrut(20), gbcEol); background.add(title, gbcRIF); background.add(atlasMapsDone, gbcRIF); background.add(atlasPercent, gbcRIF); background.add(atlasTimeLeft, gbcEolFill); background.add(atlasProgressBar, gbcEolFillI); background.add(Box.createVerticalStrut(20), gbcEol); background.add(mapDownloadTitle, gbcRIF); background.add(mapDownloadElementsDone, gbcRIF); background.add(mapDownloadPercent, gbcRIF); background.add(mapDownloadTimeLeft, gbcEolFill); background.add(mapDownloadProgressBar, gbcEolFillI); background.add(Box.createVerticalStrut(20), gbcEol); background.add(mapCreation, gbcEol); background.add(mapCreationProgressBar, gbcEolFillI); background.add(Box.createVerticalStrut(10), gbcEol); JPanel infoPanel = new JPanel(new GridBagLayout()); GBC gbci = GBC.std().insets(0, 3, 3, 3); infoPanel.add(nrOfDownloadedBytes, gbci); infoPanel.add(nrOfDownloadedBytesValue, gbci.toggleEol()); infoPanel.add(nrOfCacheBytes, gbci.toggleEol()); infoPanel.add(nrOfCacheBytesValue, gbci.toggleEol()); infoPanel.add(nrOfDownloadedBytesPerSecond, gbci.toggleEol()); infoPanel.add(nrOfDownloadedBytesPerSecondValue, gbci.toggleEol()); infoPanel.add(activeDownloads, gbci.toggleEol()); infoPanel.add(activeDownloadsValue, gbci.toggleEol()); infoPanel.add(retryableDownloadErrors, gbci.toggleEol()); infoPanel.add(retryableDownloadErrorsValue, gbci.toggleEol()); infoPanel.add(permanentDownloadErrors, gbci.toggleEol()); infoPanel.add(permanentDownloadErrorsValue, gbci.toggleEol()); infoPanel.add(totalDownloadTime, gbci.toggleEol()); infoPanel.add(totalDownloadTimeValue, gbci.toggleEol()); JPanel bottomPanel = new JPanel(new GridBagLayout()); bottomPanel.add(infoPanel, GBC.std().gridheight(2).fillH()); bottomPanel.add(ignoreDlErrors, GBC.eol().anchor(GBC.EAST)); bottomPanel.add(statusLabel, GBC.eol().anchor(GBC.CENTER)); GBC gbcRight = GBC.std().anchor(GBC.SOUTHEAST).insets(5, 0, 0, 0); bottomPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); bottomPanel.add(abortAtlasCreationButton, gbcRight); bottomPanel.add(dismissWindowButton, gbcRight); bottomPanel.add(pauseResumeDownloadButton, gbcRight); bottomPanel.add(openProgramFolderButton, gbcRight); background.add(bottomPanel, gbcEolFillI); JPanel borderPanel = new JPanel(new GridBagLayout()); borderPanel.add(background, GBC.std().insets(10, 10, 10, 10).fill()); add(borderPanel, GBC.std().fill()); abortAtlasCreationButton.addActionListener(this); dismissWindowButton.addActionListener(this); openProgramFolderButton.addActionListener(this); pauseResumeDownloadButton.addActionListener(this); }