This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When viewing data of a table containing strings values in the following format <HTML>...</HTML> will display the string formatting it in HTML. If no other HTML tags exists (<B>, <I>, ect.) the string is written in a way that makes it impossible to distinguish from a non-HTML string, thus letting the user think that the string is wrong (i.e. without the initial and final HTML tags). I suggest the renderer should use an icon to show the string is HTML-formatted (or/and use another color - i.e. blue - for HTML-formatted text). Claudio
Hi. Where are you viewing this table. In the SQL Query editor, or in an HTML page/table? Is this when designing/running a web application?
In the SQL Editor, after opening a connection with the DB. It was during the development of a stand-alone application.
OK. I'm going to change this to an enhancement request. Let me know if you disagree.
Today I have spent an hour before to understand that the data I wrote in the table was correct and that just its representation in NetBeans was wrong. And this only after having downloaded DBVisualizer and having discovered the data was right with it. I'm not sure it is an enhancement. I think is a bug, maybe of not high priority, but is a bug. What I think is that DB data must be visualized as is. Only under user request (a menu choice or a button pressed) it could be "rendered" somehow else. Claudio
OK, good argument. Pain in the b**t, I can see that, and it is definitely arguable whether it's an enhancement or a defect, so in the spirit of The Customer is Always Right let's make it a defect. If I understand you correctly, you're saying that NetBeans Query Editor should not be in the business of trying to render HTML, it should just print the data as it sees it, or at least have an option to do that. Let me know if I got that wrong, otherwise I'll assume that's the goal.
You are right. This is the goal. Moreover, being that any string starting with <HTML> and ending with </HTML> is automatically rendered in HTML by JLabel (or DefaultTableCellRenderer, that I think you're using), I think that if you are using a DefaultTableCellRenderer (or a sub-class) it should be enough call putClientProperty("html", null) to solve the problem, as in the following example. Claudio package test.swing; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JLabel; public class HTMLinJLabelsTest { public static void main ( String[] args ) { JFrame frame = new JFrame("HTML in JLabels Test"); JLabel l1 = new JLabel("<HTML>HTML <B>rendered</B> <I>label</I>.</HTML>", JLabel.CENTER); JLabel l2 = new JLabel("<HTML>No HTML <B>rendered</B> <I>label</I>.</HTML>", JLabel.CENTER); l2.putClientProperty("html", null); frame.setLayout(new BorderLayout()); frame.add(l1, BorderLayout.NORTH); frame.add(l2, BorderLayout.SOUTH); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); frame.setVisible(true); } }
Now that *is* helpful, thank you! I think the place to do this in the constructor for SQLResultPanel at db/core/src/org/netbeans/modules/db/sql/execute/ui/SQLResultPanel.java. If I understand correctly what you are saying, you should be able to disable the "html" property on the whole panel.
If you are using a single TableCellRenderer for the whole table (and not one for each column) it is enough disable the "html" just for the renderer component before to assign it to the table: TableCellRenderer tcr = ...; tcr.putClientProperty("html", null); table. setDefaultRenderer(Object.class, tcr); and what I think important is that should be the DEFAULT behaviour. Only AFTER seeing that a cell (or a column) contains HTML tagged strings (i.e. raw data) the user could have the possibility to choose a different rendering of the data (i.e. HTML one). Ciao, Claudio
Fixed, revision 6d035eaa25c3 See http://hg.netbeans.org/main?cmd=changeset;node=6d035eaa25c3
Fixed
Integrated into 'main-golden', available in build *200808201401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/a06cac2b5666 User: ahimanikya@netbeans.org Log: Ensure we don't regress for #124876, disable HTML