Example usage for javax.swing JLabel getToolTipText

List of usage examples for javax.swing JLabel getToolTipText

Introduction

In this page you can find the example usage for javax.swing JLabel getToolTipText.

Prototype

public String getToolTipText() 

Source Link

Document

Returns the tooltip string that has been set with setToolTipText.

Usage

From source file:Main.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    if (c instanceof JLabel) {
        JLabel label = (JLabel) c;
        editorPane.setText(label.getText());
        editorPane.setToolTipText(label.getToolTipText());
        editorPane.setOpaque(label.isOpaque());
        editorPane.setBackground(label.getBackground());
        editorPane.setBorder(label.getBorder());
    }/*  w ww.ja v a  2  s  . c  o  m*/
    return editorPane;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

/**
 * //  w  w  w  . j a va  2 s .c  o  m
 * <i>Description:</i> simple method that creates single/multi line label
 * with specified label width based on a source label. For more advanced
 * label attributes, it's the developer's responsibility to set them back.
 * 
 * @param source
 * @param wrap
 * @param maxWidth
 * @return
 */
public static JLabel deriveLabel(JLabel source, final boolean wrap, final int maxWidth) {
    JXLabel label = new JXLabel(source.getText(), source.getIcon(), source.getHorizontalAlignment()) {
        private static final long serialVersionUID = -4816144910055350011L;

        private Font cachedFont;

        private String chahedRawText, chahedText;

        /*
         * (non-Javadoc)
         * 
         * @see javax.swing.JLabel#getText()
         */
        @Override
        public String getText() {
            String text = super.getText();
            if (wrap || maxWidth <= 0 || text == null || text.isEmpty()) {
                return text;
            }

            if (getFont().equals(cachedFont) && text.equals(chahedRawText)) {
                return chahedText;
            }

            chahedRawText = text;
            cachedFont = getFont();
            FontMetrics fm = getFontMetrics(cachedFont);
            char[] chars = text.toCharArray();
            int width = fm.charsWidth(chars, 0, chars.length);
            if (width < maxWidth) {
                chahedText = text;
            } else {
                width += fm.charWidth('.') * 3;
                int pos = chars.length - 1;
                for (; pos >= 0 && width > maxWidth; pos--) {
                    width -= fm.charWidth(chars[pos]);
                }
                chahedText = new String(chars, 0, pos) + "...";
                if (getToolTipText() == null) {
                    setToolTipText(text);
                }
            }

            return chahedText;
        }

    };
    if (wrap) {
        label.setLineWrap(true);
    }
    if (maxWidth > 0) {
        label.setMaxLineSpan(maxWidth);
    }
    label.setEnabled(source.isEnabled());
    label.setForeground(source.getForeground());
    label.setOpaque(source.isOpaque());
    label.setBackground(source.getBackground());
    label.setFont(source.getFont());
    label.setBorder(source.getBorder());
    label.setToolTipText(source.getToolTipText());
    return label;
}

From source file:gui.EventReader.java

@Override
public void run() {

    RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10 * 1000).build();
    HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build();
    //HttpClient client = new DefaultHttpClient();

    HttpGet request = new HttpGet(
            //"https://api.guildwars2.com/v1/events.json?world_id="
            "http://gw2eventer.sourceforge.net/api/events.php?world_id=" + this.worldID);

    HttpResponse response;/*from   w  ww  .  j a v  a2s. c  o  m*/

    String line = "";
    String out = "";

    while (!isInterrupted()) {

        try {

            this.labelWorking.setText(this.workingString);

            try {

                response = client.execute(request);

                if (response.getStatusLine().toString().contains("200")) {

                    BufferedReader rd = new BufferedReader(
                            new InputStreamReader(response.getEntity().getContent(), Charset.forName("UTF-8")));

                    line = "";
                    out = "";

                    while ((line = rd.readLine()) != null) {

                        out = out + line;
                    }
                } else {
                    // http error
                    request.releaseConnection();

                    this.refreshSelector.setEnabled(false);
                    this.workingButton.setEnabled(false);
                    this.jComboBoxLanguage.setEnabled(false);
                    this.labelWorking.setText("connection error. retrying in... 10.");
                    this.labelWorking.setVisible(true);

                    Thread.sleep(10000);
                    continue;
                }
            } catch (IOException | IllegalStateException ex) {

                Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE, null, ex);

                request.releaseConnection();

                this.refreshSelector.setEnabled(false);
                this.workingButton.setEnabled(false);
                this.jComboBoxLanguage.setEnabled(false);
                this.labelWorking.setText("connection error. retrying in... 10.");
                this.labelWorking.setVisible(true);

                Thread.sleep(10000);
                continue;
                //this.interrupt();
            }

            request.releaseConnection();

            JSONParser parser = new JSONParser();

            Object obj;

            this.result.clear();

            HashMap mehrfachEvents = new HashMap();
            playSoundsList.clear();

            this.overlayGui.clearActive();
            String toolTip;

            try {

                obj = parser.parse(out);

                for (int i = 0; i < this.eventLabels.size(); i++) {

                    JLabel iter = (JLabel) this.eventLabels.get(i);
                    iter.setEnabled(false);
                    iter.setForeground(Color.green);
                }

                for (Iterator iterator = ((JSONObject) obj).values().iterator(); iterator.hasNext();) {

                    JSONArray arrayNew = (JSONArray) iterator.next();

                    for (int i = 0; i < arrayNew.size(); i++) {

                        JSONObject obj2 = (JSONObject) arrayNew.get(i);

                        if (obj2.get("event_id") != null) {

                            String event = (String) obj2.get("event_id");

                            if (this.events.containsKey(event)) {

                                //System.out.println("debug: " + event + "\n");
                                this.result.add(obj2.get("event_id"));

                                int indexEvent = Integer.parseInt(((String[]) this.events.get(event))[0]);
                                String eventPercent = ((String[]) this.events.get(event))[1];
                                String eventWav = ((String[]) this.events.get(event))[2];
                                String eventName = ((String[]) this.events.get(event))[3];

                                JLabel activeLabel = (JLabel) this.eventLabels.get(indexEvent - 1);
                                JLabel activeLabelTimer = (JLabel) this.eventLabelsTimer.get(indexEvent - 1);

                                int activeLabelInt = indexEvent - 1;
                                String tmpEventName = eventPercent.substring(0, 1);

                                Date dateNow = new Date();
                                long stampNow = dateNow.getTime();

                                if (this.timerStamps[activeLabelInt] != null) {

                                    long oldTimestamp = this.timerStamps[activeLabelInt].getTime();
                                    long minsdiff = ((stampNow - oldTimestamp) / 1000 / 60);

                                    if (minsdiff >= 30) {
                                        activeLabelTimer.setEnabled(true);
                                    } else {
                                        activeLabelTimer.setEnabled(false);
                                    }

                                    if (minsdiff >= 60) {
                                        activeLabelTimer.setForeground(Color.red);
                                    } else {
                                        activeLabelTimer.setForeground(Color.green);
                                    }

                                    activeLabelTimer.setText(minsdiff + " mins (B)");
                                }

                                /*
                                if (activeLabel != null) {
                                if (activeLabel.getToolTipText() != null) {
                                    if (activeLabel.getToolTipText().equals("")) { // null pointer??
                                        activeLabel.setToolTipText((String) this.allEvents.get(obj2.get("event_id")));
                                    }
                                }
                                }*/

                                if (obj2.get("state").equals("Active")) {

                                    activeLabel.setEnabled(true);

                                    //activeLabel.setToolTipText((String) this.allEvents.get(obj2.get("event_id")));

                                    toolTip = activeLabel.getToolTipText();

                                    if (toolTip != null) {

                                        if (toolTip.length() > 35) {
                                            toolTip = toolTip.substring(0, 35) + "...";
                                        }
                                    } else {
                                        toolTip = "";
                                    }

                                    if (tmpEventName.equals("B")) {

                                        this.markedBs[activeLabelInt] = true;
                                        activeLabelTimer.setVisible(false);
                                        this.timerStamps[activeLabelInt] = null;

                                        if (this.eventPlaySounds[activeLabelInt][2]) {
                                            if (!this.overlayGui.containsActiveB(eventName)) {
                                                this.overlayGui.addActiveB(eventName, "yellow", activeLabelInt);
                                            }
                                        } else {
                                            if (!this.overlayGui.containsActiveB(eventName)) {
                                                this.overlayGui.addActiveB(eventName, "green", activeLabelInt);
                                            }
                                        }
                                    } else {

                                        if (this.eventPlaySounds[activeLabelInt][2]) {
                                            if (!this.overlayGui.containsActivePre(eventName)) {
                                                this.overlayGui.addActivePreEvent(eventName, "yellow",
                                                        activeLabelInt);
                                            }
                                        } else {
                                            if (!this.overlayGui.containsActivePre(eventName)) {
                                                this.overlayGui.addActivePreEvent(eventName, "green",
                                                        activeLabelInt);
                                            }
                                        }
                                    }

                                    //activeLabel.setSize(100, activeLabel.getSize().height);
                                    //activeLabel.setText(eventPercent);

                                    URL url = this.getClass().getClassLoader()
                                            .getResource("media/sounds/" + eventWav + ".wav");

                                    if (!playSoundsList.containsKey(url)) {

                                        if (!this.eventPlaySounds[activeLabelInt][2]) {
                                            if (tmpEventName.equals("B")) {
                                                if (this.eventPlaySounds[activeLabelInt][1]) {

                                                    playSoundsList.put(url, activeLabel);
                                                }
                                            } else {
                                                if (this.eventPlaySounds[activeLabelInt][0]) {

                                                    playSoundsList.put(url, activeLabel);
                                                }
                                            }
                                        } else {
                                            activeLabel.setForeground(Color.YELLOW);
                                        }
                                    }

                                    if (mehrfachEvents.containsKey(activeLabel)) {
                                        ((ArrayList) mehrfachEvents.get(activeLabel)).add(tmpEventName);
                                    } else {
                                        ArrayList tmpListe = new ArrayList();
                                        tmpListe.add(tmpEventName);
                                        mehrfachEvents.put(activeLabel, tmpListe);
                                    }
                                } else {

                                    if (tmpEventName.equals("B")) {
                                        if (this.markedBs[activeLabelInt]) {

                                            this.timerStamps[activeLabelInt] = dateNow;
                                            this.markedBs[activeLabelInt] = false;

                                            activeLabelTimer.setVisible(true);
                                            activeLabelTimer.setText("0 mins (B)");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                Iterator it = mehrfachEvents.entrySet().iterator();

                while (it.hasNext()) {

                    Map.Entry pairs = (Map.Entry) it.next();

                    JLabel label = (JLabel) pairs.getKey();
                    ArrayList liste = (ArrayList) pairs.getValue();
                    String outString = null;

                    Collections.sort(liste, new Comparator<String>() {
                        public int compare(String f1, String f2) {
                            return -f1.toString().compareTo(f2.toString());
                        }
                    });

                    for (int i = 0; i < liste.size(); i++) {

                        if (outString == null) {
                            outString = (String) liste.get(i);
                        } else {
                            outString += ", " + (String) liste.get(i);
                        }
                    }

                    label.setText(outString);

                    it.remove();
                }

                this.labelServer.setOpaque(true);
                this.labelServer.setOpaque(false);
                this.labelServer.setEnabled(false);
                this.labelServer.setText("");
                this.labelServer.setText(this.worldName);

                this.labelWorking.setVisible(false);
                this.refreshSelector.setEnabled(true);
                this.workingButton.setEnabled(true);
                this.jComboBoxLanguage.setEnabled(true);

                this.overlayGui.renderActive();

                if (playSounds) {

                    this.playThread = new Thread() {

                        @Override
                        public void run() {

                            Iterator it = playSoundsList.entrySet().iterator();

                            while (it.hasNext() && !isInterrupted()) {

                                AudioInputStream audioIn;

                                Map.Entry pairs = (Map.Entry) it.next();

                                JLabel label = (JLabel) pairs.getValue();

                                try {

                                    playSoundsCurrent = (URL) pairs.getKey();
                                    audioIn = AudioSystem.getAudioInputStream(playSoundsCurrent);

                                    Clip clip = null;
                                    String tmp = label.getText();

                                    try {
                                        //label.setText(">" + tmp);
                                        //label.setText("<HTML><U>" + tmp + "<U><HTML>");
                                        label.setForeground(Color.red);

                                        //Font font = label.getFont();
                                        //Map attributes = font.getAttributes();
                                        //attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
                                        //label.setFont(font.deriveFont(attributes));

                                        clip = AudioSystem.getClip();
                                        clip.open(audioIn);

                                        clip.start();
                                    } catch (LineUnavailableException ex) {
                                        Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE, null,
                                                ex);
                                    } finally {
                                        try {
                                            audioIn.close();
                                        } catch (IOException ex) {
                                            Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE,
                                                    null, ex);
                                        }
                                    }

                                    try {
                                        Thread.sleep(2000);
                                        //label.setText(tmp);
                                        label.setForeground(Color.green);
                                    } catch (InterruptedException ex) {
                                        Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE, null,
                                                ex);
                                        this.interrupt(); //??
                                    }
                                } catch (UnsupportedAudioFileException ex) {
                                    Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE, null, ex);
                                } catch (IOException ex) {
                                    Logger.getLogger(EventReader.class.getName()).log(Level.SEVERE, null, ex);
                                }

                                it.remove();
                            }
                        }
                    };

                    this.playThread.start();
                    this.playThread.join();
                }

            } catch (ParseException ex) {

                Logger.getLogger(ApiManager.class.getName()).log(Level.SEVERE, null, ex);

                this.refreshSelector.setEnabled(false);
                this.workingButton.setEnabled(false);
                this.jComboBoxLanguage.setEnabled(false);
                this.labelWorking.setText("connection error. retrying in... 10.");
                this.labelWorking.setVisible(true);

                Thread.sleep(10000);
                continue;
            }

            if (this.autoRefresh) {

                Thread.sleep(this.sleepTime * 1000);
            } else {

                this.interrupt();
            }
        } catch (InterruptedException ex) {

            Logger.getLogger(ApiManager.class.getName()).log(Level.SEVERE, null, ex);

            this.interrupt();
        }
    }
}

From source file:util.program.ProgramTextCreator.java

/**
 *
 * @param prog/*from  w  w w  .j ava 2  s . c  om*/
 *          The Program to show
 * @param doc
 *          The HTMLDocument.
 * @param fieldArr
 *          The object array with the field types.
 * @param tFont
 *          The title Font.
 * @param bFont
 *          The body Font.
 * @param settings
 *          Settings of the ProgramPanel
 * @param showHelpLinks
 *          Show the Help-Links (Quality of Data, ShowView)
 * @param zoom
 *          The zoom value for the picture.
 * @param showPluginIcons
 *          If the plugin icons should be shown.
 * @return The HTML String.
 * @since 3.0
 */
public static String createInfoText(Program prog, ExtendedHTMLDocument doc, Object[] fieldArr, Font tFont,
        Font bFont, ProgramPanelSettings settings, boolean showHelpLinks, int zoom, boolean showPluginIcons,
        boolean showPersonLinks) {
    String debugTables = "0"; //set to "1" for debugging, to "0" for no debugging
    try {
        // NOTE: All field types are included until type 25 (REPETITION_ON_TYPE)
        StringBuilder buffer = new StringBuilder(1024);

        String titleFont, titleSize, bodyFont;

        int bodyStyle;
        int titleStyle;
        if (tFont == null && bFont != null) {
            titleFont = bodyFont = bFont.getFamily();
            titleSize = mBodyFontSize = String.valueOf(bFont.getSize());
            titleStyle = bodyStyle = bFont.getStyle();
        } else if (tFont != null && bFont != null) {
            titleFont = tFont.getFamily();
            bodyFont = bFont.getFamily();
            titleSize = String.valueOf(tFont.getSize());
            mBodyFontSize = String.valueOf(bFont.getSize());
            titleStyle = tFont.getStyle();
            bodyStyle = bFont.getStyle();
        } else {
            return null;
        }

        if (fieldArr == null) {
            return null;
        }

        buffer.append("<html>");
        buffer.append("<table width=\"100%\" border=\"" + debugTables + "\" style=\"font-family:");

        buffer.append(bodyFont);

        buffer.append(";").append(getCssStyle(bodyStyle)).append("\"><tr>");
        buffer.append("<td width=\"60\">");
        buffer.append("<p \"align=center\">");

        JLabel channelLogo = new JLabel(prog.getChannel().getIcon());
        channelLogo.setToolTipText(prog.getChannel().getName());
        buffer.append(doc.createCompTag(channelLogo));

        buffer.append(
                "</p></td><td><table width=\"100%\" border=\"" + debugTables + "\" cellpadding=\"0\"><tr><td>");
        buffer.append("<div style=\"color:#ff0000; font-size:");

        buffer.append(mBodyFontSize);

        buffer.append(";\"><b>");

        Date currentDate = Date.getCurrentDate();
        Date programDate = prog.getDate();
        if (programDate.equals(currentDate.addDays(-1))) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_YESTERDAY));
            buffer.append("  ");
        } else if (programDate.equals(currentDate)) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_TODAY));
            buffer.append("  ");
        } else if (programDate.equals(currentDate.addDays(1))) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_TOMORROW));
            buffer.append("  ");
        }
        buffer.append(prog.getDateString());

        buffer.append("  ");
        buffer.append(prog.getTimeString());
        if (prog.getLength() > 0) {
            buffer.append('-');
            buffer.append(prog.getEndTimeString());
        }
        buffer.append("  ");
        buffer.append(prog.getChannel());

        buffer.append("</b></div><div style=\"color:#003366; font-size:");

        buffer.append(titleSize);

        buffer.append("; line-height:2.5em; font-family:");
        buffer.append(titleFont).append(";").append(getCssStyle(titleStyle));
        buffer.append("\">");
        buffer.append(prog.getTitle());
        buffer.append("</div>");

        String episode = CompoundedProgramFieldType.EPISODE_COMPOSITION.getFormattedValueForProgram(prog);

        if (episode != null && episode.trim().length() > 0) {
            buffer.append("<div style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\">");
            buffer.append(episode);
            buffer.append("</div>");
        }

        buffer.append("</td><td align=\"right\" valign=\"top\"><table border=\"" + debugTables + "\"><tr><td>");
        JButton btn = new JButton(TVBrowserIcons.left(TVBrowserIcons.SIZE_SMALL));
        buffer.append(doc.createCompTag(btn));
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ProgramInfo.getInstance().historyBack();
            }
        });
        btn.setEnabled(ProgramInfo.getInstance().canNavigateBack());
        btn.setToolTipText(ProgramInfo.getInstance().navigationBackwardText());

        buffer.append("</td><td>");
        btn = new JButton(TVBrowserIcons.right(TVBrowserIcons.SIZE_SMALL));
        buffer.append(doc.createCompTag(btn));
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ProgramInfo.getInstance().historyForward();
            }
        });
        btn.setEnabled(ProgramInfo.getInstance().canNavigateForward());
        btn.setToolTipText(ProgramInfo.getInstance().navigationForwardText());

        buffer.append("</td></tr></table></td></tr></table></td></tr>");

        boolean show = false;

        if (settings.isShowingPictureForPlugins()) {
            String[] pluginIds = settings.getPluginIds();
            Marker[] markers = prog.getMarkerArr();

            if (markers != null && pluginIds != null) {
                for (Marker marker : markers) {
                    for (String pluginId : pluginIds) {
                        if (marker.getId().compareTo(pluginId) == 0) {
                            show = true;
                            break;
                        }
                    }
                }
            }
        }

        Color foreground = Color.black;//Settings.propProgramPanelForegroundColor.getColor();

        if (settings.isShowingPictureEver()
                || (settings.isShowingPictureInTimeRange()
                        && !ProgramUtilities.isNotInTimeRange(settings.getPictureTimeRangeStart(),
                                settings.getPictureTimeRangeEnd(), prog))
                || show
                || (settings.isShowingPictureForDuration() && settings.getDuration() <= prog.getLength())) {
            byte[] image = prog.getBinaryField(ProgramFieldType.PICTURE_TYPE);
            if (image != null) {
                String line = "<tr><td></td><td valign=\"top\" style=\"color:rgb(" + foreground.getRed() + ","
                        + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:0\">";
                buffer.append(line);
                try {
                    ImageIcon imageIcon = new ImageIcon(image);

                    if (zoom != 100) {
                        imageIcon = (ImageIcon) UiUtilities.scaleIcon(imageIcon,
                                imageIcon.getIconWidth() * zoom / 100);
                    }

                    StringBuilder value = new StringBuilder();

                    String textField = prog.getTextField(ProgramFieldType.PICTURE_COPYRIGHT_TYPE);
                    if (textField != null) {
                        value.append(textField);
                    }

                    if (settings.isShowingPictureDescription()) {
                        textField = prog.getTextField(ProgramFieldType.PICTURE_DESCRIPTION_TYPE);
                        if (textField != null) {
                            value.append("<br>").append(textField);
                        }
                    }

                    buffer.append(doc.createCompTag(new JLabel(imageIcon)));
                    buffer.append("<div style=\"font-size:");

                    buffer.append(mBodyFontSize);

                    buffer.append("\">");
                    buffer.append(value);
                    buffer.append("</div>");
                    buffer.append("</td></tr>");
                } catch (Exception e) {
                    // Picture was wrong;
                    buffer.delete(buffer.length() - line.length(), buffer.length());
                }
            }
        }

        Marker[] pluginArr = prog.getMarkerArr();
        if (showPluginIcons && (pluginArr != null) && (pluginArr.length != 0)) {
            addSeparator(doc, buffer);

            buffer.append("<tr><td valign=\"top\" style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer.append(mLocalizer.msg("markedBy", "Marked by"));
            buffer.append("</b></td><td valign=\"middle\" style=\"font-size:4\">");
            openPara(buffer, "info");

            // Workaround: Without the &nbsp; the component are not put in one line.
            buffer.append("&nbsp;");
            for (int markerCount = pluginArr.length - 1; markerCount >= 0; markerCount--) {
                Icon[] icons = pluginArr[markerCount].getMarkIcons(prog);

                if (icons != null) {
                    for (int i = icons.length - 1; i >= 0; i--) {
                        JLabel iconLabel = new JLabel(icons[i]);
                        PluginAccess plugin = Plugin.getPluginManager()
                                .getActivatedPluginForId(pluginArr[markerCount].getId());
                        if (plugin != null) {
                            iconLabel.setToolTipText(plugin.getInfo().getName());
                        } else {
                            InternalPluginProxyIf internalPlugin = InternalPluginProxyList.getInstance()
                                    .getProxyForId(pluginArr[markerCount].getId());
                            if (internalPlugin != null) {
                                iconLabel.setToolTipText(internalPlugin.getName());
                                if (internalPlugin.equals(FavoritesPluginProxy.getInstance())) {
                                    // if this is a favorite, add the names of the favorite
                                    String favTitles = "";
                                    for (Favorite favorite : FavoriteTreeModel.getInstance()
                                            .getFavoritesContainingProgram(prog)) {
                                        if (favTitles.length() > 0) {
                                            favTitles = favTitles + ", ";
                                        }
                                        favTitles = favTitles + favorite.getName();
                                    }
                                    if (favTitles.length() > 0) {
                                        iconLabel.setToolTipText(
                                                iconLabel.getToolTipText() + " (" + favTitles + ")");
                                    }
                                }
                            } else {
                                iconLabel.setToolTipText(pluginArr[markerCount].toString());
                            }
                        }

                        buffer.append(doc.createCompTag(iconLabel));
                        buffer.append("&nbsp;&nbsp;");
                    }
                }
            }
            closePara(buffer);
            buffer.append("</td></tr>");
        }

        PluginAccess[] plugins = Plugin.getPluginManager().getActivatedPlugins();
        ArrayList<JLabel> iconLabels = new ArrayList<JLabel>();
        for (PluginAccess plugin : plugins) {
            Icon[] icons = plugin.getProgramTableIcons(prog);

            if (icons != null) {
                for (Icon icon : icons) {
                    JLabel iconLabel = new JLabel(icon);
                    iconLabel.setToolTipText(plugin.getInfo().getName());
                    iconLabels.add(iconLabel);
                }
            }
        }

        if (showPluginIcons && iconLabels.size() > 0) {
            addSeparator(doc, buffer);

            buffer.append("<tr><td valign=\"middle\" style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer.append("Plugin-Icons");
            buffer.append("</b></td><td valign=\"top\" style=\"font-size:4\">");

            openPara(buffer, "info");
            // Workaround: Without the &nbsp; the component are not put in one line.
            buffer.append("&nbsp;");

            for (JLabel iconLabel : iconLabels) {
                buffer.append(doc.createCompTag(iconLabel));
                buffer.append("&nbsp;&nbsp;");
            }

            closePara(buffer);
            buffer.append("</td></tr>");
        }

        addSeparator(doc, buffer);

        for (Object id : fieldArr) {
            ProgramFieldType type = null;

            if (id instanceof String) {
                if (((String) id).matches("\\d+")) {
                    try {
                        type = ProgramFieldType.getTypeForId(Integer.parseInt((String) id, 10));
                    } catch (Exception e) {
                        // Empty Catch
                    }
                }

                if (type == null) {
                    int length = prog.getLength();
                    if (length > 0 && ((String) id).trim().length() > 0) {

                        buffer.append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\"><b>");
                        buffer.append(mLocalizer.msg("duration", "Program duration/<br>-end"));
                        buffer.append("</b></td><td style=\"color:rgb(" + foreground.getRed() + ","
                                + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\">");

                        openPara(buffer, "time");

                        String msg = mLocalizer.msg("minutes", "{0} min", length);
                        buffer.append(msg).append(" (");
                        buffer.append(mLocalizer.msg("until", "until {0}", prog.getEndTimeString()));

                        int netLength = prog.getIntField(ProgramFieldType.NET_PLAYING_TIME_TYPE);
                        if (netLength != -1) {
                            msg = mLocalizer.msg("netMinuted", "{0} min net", netLength);
                            buffer.append(" - ").append(msg);
                        }
                        buffer.append(')');

                        closePara(buffer);

                        buffer.append("</td></tr>");
                        addSeparator(doc, buffer);
                    }
                }
            } else if (id instanceof CompoundedProgramFieldType) {
                CompoundedProgramFieldType value = (CompoundedProgramFieldType) id;
                String entry = value.getFormattedValueForProgram(prog);

                if (entry != null) {
                    startInfoSection(buffer, value.getName());
                    buffer.append(HTMLTextHelper.convertTextToHtml(entry, false));

                    addSeparator(doc, buffer);
                }
            } else {
                type = (ProgramFieldType) id;

                if (type == ProgramFieldType.DESCRIPTION_TYPE) {
                    String description = checkDescription(prog.getDescription());
                    if (description != null && description.length() > 0) {
                        addEntry(doc, buffer, prog, ProgramFieldType.DESCRIPTION_TYPE, true, showHelpLinks,
                                showPersonLinks);
                    } else {
                        addEntry(doc, buffer, prog, ProgramFieldType.SHORT_DESCRIPTION_TYPE, true,
                                showHelpLinks, showPersonLinks);
                    }
                } else if (type == ProgramFieldType.INFO_TYPE) {
                    int info = prog.getInfo();
                    if ((info != -1) && (info != 0)) {
                        buffer.append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\"><b>");
                        buffer.append(type.getLocalizedName());
                        buffer.append("</b></td><td valign=\"middle\" style=\"font-size:5\">");

                        openPara(buffer, "info");
                        // Workaround: Without the &nbsp; the component are not put in one
                        // line.
                        buffer.append("&nbsp;");

                        int[] infoBitArr = ProgramInfoHelper.getInfoBits();
                        Icon[] infoIconArr = ProgramInfoHelper.getInfoIcons();
                        String[] infoMsgArr = ProgramInfoHelper.getInfoIconMessages();

                        for (int i = 0; i < infoBitArr.length; i++) {
                            if (ProgramInfoHelper.bitSet(info, infoBitArr[i])) {
                                JLabel iconLabel;

                                if (infoIconArr[i] != null) {
                                    iconLabel = new JLabel(infoIconArr[i]);
                                } else {
                                    iconLabel = new JLabel(infoMsgArr[i]);
                                }

                                iconLabel.setToolTipText(infoMsgArr[i]);
                                buffer.append(doc.createCompTag(iconLabel));

                                buffer.append("&nbsp;&nbsp;");
                            }
                        }

                        closePara(buffer);

                        buffer.append("</td></tr>");
                        addSeparator(doc, buffer);
                    }
                } else if (type == ProgramFieldType.URL_TYPE) {
                    addEntry(doc, buffer, prog, ProgramFieldType.URL_TYPE, true, showHelpLinks,
                            showPersonLinks);
                } else if (type == ProgramFieldType.ACTOR_LIST_TYPE) {
                    ArrayList<String> knownNames = new ArrayList<String>();
                    String[] recognizedActors = ProgramUtilities.getActorNames(prog);
                    if (recognizedActors != null) {
                        knownNames.addAll(Arrays.asList(recognizedActors));
                    }
                    String actorField = prog.getTextField(type);
                    if (actorField != null) {
                        ArrayList<String>[] lists = ProgramUtilities.splitActors(prog);
                        if (lists == null) {
                            lists = splitActorsSimple(prog);
                        }
                        if (lists != null && lists[0].size() > 0) {
                            startInfoSection(buffer, type.getLocalizedName());
                            buffer.append("<table border=\"0\" cellpadding=\"0\" style=\"font-family:");
                            buffer.append(bodyFont);
                            buffer.append(";\">");
                            for (int i = 0; i < lists[0].size(); i++) {
                                String[] parts = new String[2];
                                parts[0] = lists[0].get(i);
                                parts[1] = "";
                                if (i < lists[1].size()) {
                                    parts[1] = lists[1].get(i);
                                }
                                int actorIndex = 0;
                                if (showPersonLinks) {
                                    if (knownNames.contains(parts[0])) {
                                        parts[0] = addPersonLink(parts[0]);
                                    } else if (knownNames.contains(parts[1])) {
                                        parts[1] = addPersonLink(parts[1]);
                                        actorIndex = 1;
                                    }
                                }
                                buffer.append("<tr><td valign=\"top\">&#8226;&nbsp;</td><td valign=\"top\">");
                                buffer.append(parts[actorIndex]);
                                buffer.append("</td><td width=\"10\">&nbsp;</td>");

                                if (parts[1 - actorIndex].length() > 0) {
                                    buffer.append("<td valign=\"top\">");
                                    buffer.append(parts[1 - actorIndex]);
                                    buffer.append("</td>");
                                } else {
                                    // if roles are missing add next actor in the same line
                                    if (i + 1 < lists[0].size() && lists[1].size() == 0) {
                                        i++;
                                        buffer.append(
                                                "<td valign=\"top\">&#8226;&nbsp;</td><td valign=\"top\">");
                                        if (showPersonLinks) {
                                            buffer.append(addSearchLink(lists[0].get(i)));
                                        } else {
                                            buffer.append(lists[0].get(i));
                                        }
                                        buffer.append("</td>");
                                    }
                                }
                                buffer.append("</td></tr>");
                            }
                            buffer.append("</table>");
                            buffer.append("</td></tr>");
                            addSeparator(doc, buffer);
                        } else {
                            addEntry(doc, buffer, prog, type, showHelpLinks, showPersonLinks);
                        }
                    }
                } else {
                    addEntry(doc, buffer, prog, type, showHelpLinks, showPersonLinks);
                }
            }
        }

        if (showHelpLinks) {
            buffer.append(
                    "<tr><td colspan=\"2\" valign=\"top\" align=\"center\" style=\"color:#808080; font-size:");
            buffer.append(mBodyFontSize).append("\">");
            buffer.append("<a href=\"");
            buffer.append(
                    mLocalizer.msg("dataInfo", "http://wiki.tvbrowser.org/index.php/Qualit%C3%A4t_der_Daten"))
                    .append("\">");
            buffer.append(mLocalizer.msg("dataQuality", "Details of the data quality"));
            buffer.append("</a>");
            buffer.append("</td></tr>");
        }
        buffer.append("</table></html>");

        return buffer.toString();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}