当前位置: 首页>>代码示例>>Java>>正文


Java XMLUtil.toElementContent方法代码示例

本文整理汇总了Java中org.openide.xml.XMLUtil.toElementContent方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtil.toElementContent方法的具体用法?Java XMLUtil.toElementContent怎么用?Java XMLUtil.toElementContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.xml.XMLUtil的用法示例。


在下文中一共展示了XMLUtil.toElementContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDetails

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
    try {
        text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
    } catch (CharConversionException ex) {
        throw new IllegalArgumentException(ex);
    }
    if (null == action) {
        return new JLabel(text);
    }
    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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NotificationImpl.java

示例2: createDetails

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NotificationImpl.java

示例3: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProjectsRootNode.java

示例4: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:PlatformNode.java

示例5: messageHtmlName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DataEditorSupport.java

示例6: target2String

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Utilities.java

示例7: createNotification

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NotificationDisplayerImpl.java

示例8: createNotification

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NotificationDisplayerImpl.java

示例9: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
    if (isDeprecated()) {
        try {
            return "<html><s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N
        } catch (CharConversionException ex) {}
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SuiteCustomizerLibraries.java

示例10: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@Override
public String getHtmlDisplayName() {
    if (pp.getPlatform() == null) {
        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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:PlatformNode.java

示例11: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
    if (dep.getModuleEntry().isDeprecated()) {
        try {
            return "<s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N
        } catch (CharConversionException x) {
            // ignore
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:LibrariesNode.java

示例12: safeEncode

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private static String safeEncode(String text) { // #208432
    if (text.length() > 30) {
        text = text.substring(0, 30) + '…';
    }
    try {
        return XMLUtil.toElementContent(text.replaceAll("\\s+", " "));
    } catch (CharConversionException ex) {
        return text;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ProjectUtilities.java

示例13: getTopLvlDisplayText

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DashboardUtils.java

示例14: escapedSubstring

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private static String escapedSubstring(String str, int start, int end) {
    String substring = str.substring(start, end);

    try {
        return XMLUtil.toElementContent(substring);
    } catch (CharConversionException ex) {
        Exceptions.printStackTrace(ex);
        return substring;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:Utilities.java

示例15: getHtmlDisplayName

import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
    if (!project.isMavenProjectLoaded()) {
        return null;
    }
    String packaging = project.getOriginalMavenProject().getPackaging();
    if (project.getLookup().lookup(SpecialIcon.class) != null) {
        return null;
    }
    try {
        return XMLUtil.toElementContent(getDisplayName()) + " <font color='!controlShadow'>" + packaging + "</font>";
    } catch (CharConversionException x) {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:MavenProjectNode.java


注:本文中的org.openide.xml.XMLUtil.toElementContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。