File |
Line |
org/springframework/richclient/exceptionhandling/JXErrorDialogExceptionHandler.java |
72 |
org/springframework/richclient/util/RcpSupport.java |
166 |
}
/**
* Converts the incoming string to an escaped output string. This method is far from perfect, only
* escaping <, > and & characters
*/
private static String escapeXml(String input)
{
return input == null ? "" : input.replace("&", "&").replace("<", "<").replace(">", ">");
}
/**
* Creates and returns HTML representing the details of this incident info. This method is only called if
* the details needs to be generated: ie: the detailed error message property of the incident info is
* null.
*/
private static String getDetailsAsHTML(String title, Level level, Throwable e)
{
if (e != null)
{
// convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(title) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + escapeXml(e.toString()));
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + level);
html.append("</pre>");
html.append("<b>Stack Trace:</b>");
html.append("<pre>");
for (StackTraceElement el : e.getStackTrace())
{
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
if (e.getCause() != null)
{
html.append("</pre>");
html.append("<b>Cause:</b>");
html.append("<pre>");
html.append(e.getCause().getMessage());
html.append("</pre><pre>");
for (StackTraceElement el : e.getCause().getStackTrace())
{
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
}
html.append("</pre></html>");
return html.toString();
}
else
{
return null;
}
}
|
File |
Line |
org/springframework/richclient/taskpane/JTaskPaneBuilder.java |
75 |
org/springframework/richclient/taskpane/JTaskPaneBuilder.java |
112 |
final JTaskPane parent = (JTaskPane) parentComponent;
final JTaskPaneGroup group = new JTaskPaneGroup();
group.setTitle(command.getText());
group.setIcon(icon);
group.setExpanded(false);
if (hasOnlyOneExpanded())
{
group.addPropertyChangeListener(JTaskPaneGroup.EXPANDED_CHANGED_KEY, new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
if ((Boolean) evt.getNewValue())
{
Component[] comps = parent.getComponents();
for (int i = 0; i < comps.length; i++)
{
if (comps[i] instanceof JTaskPaneGroup && comps[i] != group)
{
JTaskPaneGroup g = ((JTaskPaneGroup) comps[i]);
if (g.isExpanded())
{
g.setExpanded(false);
}
}
}
}
}
});
}
parent.add(group);
return group;
}
|
File |
Line |
org/springframework/richclient/util/SeparatorUtils.java |
82 |
org/springframework/richclient/util/SeparatorUtils.java |
137 |
if (menuComponent instanceof JSeparator) {
menuComponent.setVisible(true);
}
// Separator should be invisible if
// - previous visible item one is a separator
// - it is the first one visible item (ie everything invisible
// before)
if (menuComponent instanceof JSeparator && everythingInvisibleSoFar) {
menuComponent.setVisible(false);
}
else if (menuComponent instanceof JSeparator && previousVisibleComponent instanceof JSeparator) {
previousVisibleComponent.setVisible(false);
}
if (menuComponent instanceof JSeparator) {
previousVisibleComponent = menuComponent;
}
else if (menuComponent.isVisible()) {
everythingInvisibleSoFar = false;
previousVisibleComponent = menuComponent;
}
if (menuComponent instanceof JMenu) {
consolidateSeparators((JMenu) menuComponent);
}
}
// and if the last item on the menu is a separator -> make it invisible.
if (previousVisibleComponent instanceof JSeparator) {
previousVisibleComponent.setVisible(false);
}
}
/**
* Consolidates separators in a menubar. This essentialy calls
* {@link #consolidateSeparators(JMenu)} for each menu in the menubar.
* @param menuBar the menu bar (cannot be null)
* @see #consolidateSeparators(JMenu)
*/
public static void consolidateSeparators(JMenuBar menuBar) {
|