Java Code Examples for org.openide.xml.XMLUtil#toElementContent()
The following examples show how to use
org.openide.xml.XMLUtil#toElementContent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BootCPNodeFactory.java From netbeans with Apache License 2.0 | 6 votes |
@Override public String getHtmlDisplayName() { final Pair<String, JavaPlatform> platHolder = pp.getPlatform(); if (platHolder == null) { return null; } final JavaPlatform jp = platHolder.second(); if (jp == null || !jp.isValid()) { String displayName = this.getDisplayName(); try { displayName = XMLUtil.toElementContent(displayName); } catch (CharConversionException ex) { // OK, no annotation in this case return null; } return "<font color=\"#A40000\">" + displayName + "</font>"; //NOI18N } else { return null; } }
Example 2
Source File: PlatformNode.java From netbeans with Apache License 2.0 | 6 votes |
@Override public String getHtmlDisplayName () { final Pair<String,JavaPlatform> platHolder = pp.getPlatform(); if (platHolder == null) { return null; } final JavaPlatform jp = platHolder.second(); if (jp == null || !jp.isValid()) { String displayName = this.getDisplayName(); try { displayName = XMLUtil.toElementContent(displayName); } catch (CharConversionException ex) { // OK, no annotation in this case return null; } return "<font color=\"#A40000\">" + displayName + "</font>"; //NOI18N } else { return null; } }
Example 3
Source File: Utilities.java From netbeans with Apache License 2.0 | 6 votes |
public static String target2String(TypeElement target) { final Name qualifiedName = target.getQualifiedName(); //#130759 if (qualifiedName == null) { Logger.getLogger(Utilities.class.getName()).warning("Target qualified name could not be resolved."); //NOI18N return ""; //NOI18N } else { String qnString = qualifiedName.toString(); if (qnString.length() == 0) { //probably an anonymous class qnString = target.asType().toString(); } try { qnString = XMLUtil.toElementContent(qnString); } catch (CharConversionException ex) { Logger.getLogger(Utilities.class.getName()).log(Level.FINE, null, ex); } return qnString; } }
Example 4
Source File: AdjustConfigurationPanel.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { AnalyzerFactory a = (AnalyzerFactory) value; String text = SPIAccessor.ACCESSOR.getAnalyzerDisplayName(a); boolean isErroneous; synchronized (errors) { isErroneous = errors.containsKey(a); } if (isErroneous) { try { text = "<html><font color='ref'>" + XMLUtil.toElementContent(text); } catch (CharConversionException ex) { LOG.log(Level.FINE, null, ex); } } return super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus); }
Example 5
Source File: DataEditorSupport.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected String messageHtmlName() { if (! obj.isValid()) { return null; } String name = obj.getNodeDelegate().getHtmlDisplayName(); if (name == null) { try { name = XMLUtil.toElementContent(obj.getNodeDelegate().getDisplayName()); } catch (CharConversionException ex) { return null; } } return annotateName(name, true, isModified(), !obj.getPrimaryFile().canWrite()); }
Example 6
Source File: ProjectsRootNode.java From netbeans with Apache License 2.0 | 6 votes |
public @Override String getHtmlDisplayName() { String htmlName = getOriginal().getHtmlDisplayName(); if (htmlName == null) { try { htmlName = XMLUtil.toElementContent(getOriginal().getDisplayName()); } catch (CharConversionException ex) { // ignore } } if (htmlName == null) { return null; } if (files != null && files.iterator().hasNext()) { try { String annotatedMagic = files.iterator().next().getFileSystem(). getDecorator().annotateNameHtml(MAGIC, files); if (annotatedMagic != null) { htmlName = annotatedMagic.replace(MAGIC, htmlName); } } catch (FileStateInvalidException e) { LOG.log(Level.INFO, null, e); } } return isMainAsync()? "<b>" + htmlName + "</b>" : htmlName; }
Example 7
Source File: NotificationImpl.java From netbeans with Apache License 2.0 | 6 votes |
private JComponent createDetails( String text, ActionListener action ) { if( null == action ) { return new JLabel(text); } try { text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N } catch( CharConversionException ex ) { throw new IllegalArgumentException(ex); } JButton btn = new JButton(text); btn.setFocusable(false); btn.setBorder(BorderFactory.createEmptyBorder()); btn.setBorderPainted(false); btn.setFocusPainted(false); btn.setOpaque(false); btn.setContentAreaFilled(false); btn.addActionListener(action); btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N if (c != null) { btn.setForeground(c); } return btn; }
Example 8
Source File: NotificationDisplayerImpl.java From netbeans with Apache License 2.0 | 5 votes |
private NotificationImpl createNotification(String title, Icon icon, Priority priority) { Parameters.notNull("title", title); //NOI18N Parameters.notNull("icon", icon); //NOI18N Parameters.notNull("priority", priority); //NOI18N try { title = XMLUtil.toElementContent(title); } catch( CharConversionException ex ) { throw new IllegalArgumentException(ex); } return new NotificationImpl(title, icon, priority); }
Example 9
Source File: AbstractLogicalViewProvider.java From netbeans with Apache License 2.0 | 5 votes |
@Override public String getHtmlDisplayName() { String dispName = super.getDisplayName(); try { dispName = XMLUtil.toElementContent(dispName); } catch (CharConversionException ex) { return dispName; } return isBroken() ? "<font color=\"#A40000\">" + dispName + "</font>" : null; //NOI18N }
Example 10
Source File: LibrariesNode.java From netbeans with Apache License 2.0 | 5 votes |
public @Override String getHtmlDisplayName() { if (dep.getModuleEntry().isDeprecated()) { try { return "<s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N } catch (CharConversionException x) { // ignore } } return null; }
Example 11
Source File: NotificationDisplayerImpl.java From netbeans with Apache License 2.0 | 5 votes |
private NotificationImpl createNotification(String title, Icon icon, Priority priority, Category category) { Parameters.notNull("title", title); //NOI18N Parameters.notNull("icon", icon); //NOI18N Parameters.notNull("priority", priority); //NOI18N Parameters.notNull("category", category); //NOI18N try { title = XMLUtil.toElementContent(title); } catch (CharConversionException ex) { throw new IllegalArgumentException(ex); } return new NotificationImpl(title, icon, priority, category, Calendar.getInstance()); }
Example 12
Source File: SuiteCustomizerLibraries.java From netbeans with Apache License 2.0 | 5 votes |
public @Override String getHtmlDisplayName() { if (isDeprecated()) { try { return "<html><s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N } catch (CharConversionException ex) {} } return null; }
Example 13
Source File: DashboardUtils.java From netbeans with Apache License 2.0 | 5 votes |
private static String escapeXmlChars(String text) { String result = text; try { result = XMLUtil.toElementContent(text); } catch (CharConversionException ex) { } return result; }
Example 14
Source File: RefactoringUtils.java From netbeans with Apache License 2.0 | 5 votes |
public static String htmlize(String input) { try { return XMLUtil.toElementContent(input); } catch (CharConversionException cce) { Exceptions.printStackTrace(cce); return input; } }
Example 15
Source File: DiffTreeTable.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component comp = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (comp instanceof JComponent) { JComponent c = (JComponent) comp; if (value == null) { c.setToolTipText(null); } else { String val = value.toString(); String tooltip = tooltips.get(val); if (tooltip == null) { tooltip = val.replace("\r\n", "\n").replace("\r", "\n"); //NOI18N try { tooltip = XMLUtil.toElementContent(tooltip); } catch (CharConversionException e1) { Logger.getLogger(DiffTreeTable.class.getName()).log(Level.INFO, "Can not HTML escape: ", tooltip); //NOI18N } if (tooltip.contains("\n")) { tooltip = "<html><body><p>" + tooltip.replace("\n", "<br>") + "</p></body></html>"; //NOI18N c.setToolTipText(tooltip); } tooltips.put(val, tooltip); } c.setToolTipText(tooltip); } } return comp; }
Example 16
Source File: UiUtils.java From netbeans with Apache License 2.0 | 5 votes |
/** * Escape HTML special characters in string. */ public static String escapeHtml(String s) { if (s == null) { return null; } else { try { return XMLUtil.toElementContent(s); } catch (CharConversionException cce) { return s; } } }
Example 17
Source File: FormEditorSupport.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns display name of the multiview top component. * The first item of the array is normal display name, * the second item of the array is HTML display name. * * @param formDataObject form data object representing the multiview tc. * @return display names of the MVTC. The second item can be <code>null</code>. */ private static String[] getMVTCDisplayName(FormDataObject formDataObject) { Node node = formDataObject.getNodeDelegate(); String title = node.getDisplayName(); String htmlTitle = node.getHtmlDisplayName(); if (htmlTitle == null) { try { htmlTitle = XMLUtil.toElementContent(title); } catch (CharConversionException x) { htmlTitle = "???"; } } FormEditorSupport fes = (FormEditorSupport)formDataObject.getFormEditorSupport(); if (fes != null) { FormDesignerTC designerTC = fes.getFormDesignerTC(); if (designerTC != null && designerTC.isShowing()) { FormModel fm = fes.getFormModel(); if (fm != null) { FormDesigner fd = FormEditor.getFormDesigner(fes.getFormModel()); if (fd != null && fd.getFormModel() != null && !fd.isTopRADComponent() && fd.getTopDesignComponent() != null) { title = FormUtils.getFormattedBundleString( "FMT_FormTitleWithContainerName", // NOI18N new Object[] {title, fd.getTopDesignComponent().getName()}); htmlTitle = FormUtils.getFormattedBundleString( "FMT_FormTitleWithContainerName", // NOI18N new Object[] {htmlTitle, fd.getTopDesignComponent().getName()}); } } } } boolean modified = formDataObject.isModified(); boolean readOnly = readOnly(formDataObject); return new String[] { DataEditorSupport.annotateName(title, false, modified, readOnly), DataEditorSupport.annotateName(htmlTitle, true, modified, readOnly) }; }
Example 18
Source File: DashboardUtils.java From netbeans with Apache License 2.0 | 5 votes |
private static String getTopLvlDisplayText(boolean containsActiveTask, String name, boolean isOpened) { String displayName; try { name = XMLUtil.toElementContent(name); } catch (CharConversionException ex) { } String activeText = containsActiveTask ? "<b>" + name + "</b>" : name; //NOI18N if (!isOpened) { displayName = "<html><strike>" + activeText + "</strike><html>"; //NOI18N } else { displayName = "<html>" + activeText + "<html>"; } return displayName; }
Example 19
Source File: LogicalViewProviders.java From netbeans with Apache License 2.0 | 5 votes |
@Override public String getHtmlDisplayName() { String dispName = super.getDisplayName(); try { dispName = XMLUtil.toElementContent(dispName); } catch (CharConversionException ex) { return dispName; } return broken ? "<font color=\"#"+Integer.toHexString(getErrorForeground().getRGB() & 0xffffff) +"\">" + dispName + "</font>" : null; //NOI18N }
Example 20
Source File: PackageViewFilterNode.java From netbeans with Apache License 2.0 | 5 votes |
@Override public String getHtmlDisplayName() { if (trueSource) { return super.getHtmlDisplayName(); } String htmlName = getOriginal().getHtmlDisplayName(); if (htmlName == null) { try { htmlName = XMLUtil.toElementContent(super.getDisplayName()); } catch (CharConversionException x) { return null; // never mind } } return "<font color='!controlShadow'>" + htmlName + "</font>"; // NOI18N }