本文整理汇总了Java中com.google.gwt.safehtml.shared.SafeHtmlUtils.fromString方法的典型用法代码示例。如果您正苦于以下问题:Java SafeHtmlUtils.fromString方法的具体用法?Java SafeHtmlUtils.fromString怎么用?Java SafeHtmlUtils.fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.safehtml.shared.SafeHtmlUtils
的用法示例。
在下文中一共展示了SafeHtmlUtils.fromString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHTML
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml getHTML() {
SafeHtml result = null;
if (libraryLoaded && initialized) {
try {
String contentHtml = getContentHtml(elementId); // TinyMCE takes care of the sanitization.
if (contentHtml == null || contentHtml.trim().isEmpty()) {
return SafeHtmlUtils.fromSafeConstant("");
}
// Remove the root block <p></p> that gets added automatically by TinyMCE
if (contentHtml.startsWith("<p>") && contentHtml.endsWith("</p>")) {
contentHtml = contentHtml.substring(3, contentHtml.length() - 4);
}
result = SafeHtmlUtils.fromTrustedString(contentHtml);
} catch (JavaScriptException e) {
GWT.log("Unable to get the content from the TinyMCE editor.", e);
}
} else {
String text = super.getText();
if (text == null || text.trim().isEmpty()) {
return SafeHtmlUtils.fromSafeConstant("");
} else {
return SafeHtmlUtils.fromString(text);
}
}
return result;
}
示例2: changeHelpPanel
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/***********************************
****** HELP STUFF ******
***********************************/
private void changeHelpPanel(SubTabs subMenu) {
// change root item
rootItem.setText(subMenu + " Help");
rootItem.removeItems();
SubTabInterface subTabObj = getSubTab(subMenu);
if (subTabObj != null) {
HelpSliderConsts[] helpVals = subTabObj.getHelpSliderContent();
if (helpVals != null) {
for (int i = 0; i < helpVals.length; i++) {
TreeItem helpItem = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getTitle()));
TreeItem content = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getContent()));
helpItem.setState(false);
helpItem.addItem(content);
rootItem.addItem(helpItem);
}
}
}
rootItem.setState(true);
resize();
}
示例3: setPanels
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void setPanels() {
HTML titleHtml = new HTML(SafeHtmlUtils.fromString(title));
titleHtml.addStyleDependentName("bbsThreadTitle");
add(titleHtml);
add(bodyPanel);
{
HorizontalPanel panel = new HorizontalPanel();
panel.add(buttonAll);
panel.add(buttonWrite);
add(panel);
}
add(responseForm);
}
示例4: buildNavigation
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
@Override
protected final List<NavigationEntryInterface> buildNavigation() {
final List<NavigationEntryInterface> navigationEntries = new ArrayList<>();
final NavigationConstants navigationConstants = GWT.create(NavigationConstants.class);
navigationEntries
.add(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuPostalAddress()),
NameTokens.ADDRESS, null));
navigationEntries.add(new NavigationEntry(
SafeHtmlUtils.fromString(navigationConstants.menuSepa()), NameTokens.SEPA, null));
navigationEntries
.add(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuPhoneNumber()),
NameTokens.PHONE_NUMBER, null));
navigationEntries
.add(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuEmailList()),
NameTokens.EMAIL_LIST, null));
navigationEntries.add(new NavigationEntry(
SafeHtmlUtils.fromString(navigationConstants.menuSettings()), NameTokens.SETTINGS, null));
navigationEntries
.add(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuLogin()),
NameTokens.SECRET, this.loggedOutGatekeeper));
navigationEntries
.add(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuLogout()),
NameTokens.LOGOUT, this.loggedInGatekeeper));
final NavigationEntryFolder testFolder = new NavigationEntryFolder(
SafeHtmlUtils.fromString(navigationConstants.menuTestFolder()), true);
testFolder
.addSubEntry(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuSecret()),
NameTokens.SECRET, this.loggedInGatekeeper));
testFolder
.addSubEntry(new NavigationEntry(SafeHtmlUtils.fromString(navigationConstants.menuPerson()),
NameTokens.PERSON, this.loggedInGatekeeper));
navigationEntries.add(testFolder);
return navigationEntries;
}
示例5: MyMenuItem
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
@UiConstructor
public MyMenuItem(String text, ImageResource res) {
super(SafeHtmlUtils.fromString(text));
ImageResourceRenderer renderer = new ImageResourceRenderer();
setHTML(renderer.render(res).asString() + " " + text);
}
示例6: ExpressionView
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/**
* Instantiates a new expression view.
*/
public ExpressionView()
{
super();
setSpacing(5);
Button btnRefresh = new Button("Refresh");
btnRefresh.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
refreshButtonPressed();
}
});
add(btnRefresh);
HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel.setSpacing(10);
add(horizontalPanel);
horizontalPanel.setSize("517px", "279px");
Tree tree = new Tree();
tree.addSelectionHandler(this);
horizontalPanel.add(tree);
trtmByPerson = new TreeItem(SafeHtmlUtils.fromString("By Person"));
tree.addItem(trtmByPerson);
trtmByTable = new TreeItem(SafeHtmlUtils.fromString("By Table"));
tree.addItem(trtmByTable);
trtmByTarget = new TreeItem(SafeHtmlUtils.fromString("By Target"));
tree.addItem(trtmByTarget);
verticalPanel = new VerticalPanel();
horizontalPanel.add(verticalPanel);
}
示例7: addParallelHiddenEvent
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void addParallelHiddenEvent()
{
EbRegistration myRegistration = GameEngine.model().getMyRegistration();
if( myRegistration != null
&& !myRegistration.getTeam( GameEngine.model().getGame() ).getMyEvents().isEmpty() )
{
TreeItem turnTreeItem = new TreeItem( SafeHtmlUtils.fromString( myRegistration.getAccount().getPseudo() ) );
m_tree.addItem( turnTreeItem );
for( AnEvent event : myRegistration.getTeam( GameEngine.model().getGame() ).getMyEvents() )
{
turnTreeItem.addItem( new TreeItemEvent( event ) );
}
}
}
示例8: asResultSafeHtml
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml asResultSafeHtml() {
if (resultHtml == null) {
StringBuilder sb = new StringBuilder().append(level).append(' ').append(name);
resultHtml = SafeHtmlUtils.fromString(sb.toString());
}
return resultHtml;
}
示例9: UIEnabledActionCell
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public UIEnabledActionCell(String text, UIEnabledPredicate<T> isEnabledPredicate,
UIEnabledActionCell.Delegate<T> delegate) {
this(SafeHtmlUtils.fromString(text), null, isEnabledPredicate, delegate);
}
示例10: TreeItemAdditionalEvent
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/**
*
*/
public TreeItemAdditionalEvent(int p_eventCount)
{
super( SafeHtmlUtils.fromString( "" + p_eventCount + " events" ) );
m_additionalEventCount = p_eventCount;
}
示例11: addWarnings
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void addWarnings(String warning) {
HTML w = new HTML(SafeHtmlUtils.fromString(warning));
w.addStyleName("gwt-HTML-problemCreationWarning");
panelWarning.add(w);
}
示例12: addInfo
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void addInfo(String info) {
HTML w = new HTML(SafeHtmlUtils.fromString(info));
w.addStyleName("gwt-HTML-problemCreationInfo");
panelWarning.add(w);
}
示例13: setResponses
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void setResponses(List<PacketBbsResponse> responses) {
bodyPanel.clear();
if (!bodyPanel.isAttached()) {
setPanels();
}
for (PacketBbsResponse response : responses) {
VerticalPanel panel = new VerticalPanel();
{
String upper = "";
if (SharedData.get().isAdministoratorMode()) {
upper = response.id + ": " + response.name
+ Utility.makeTrip(response.userCode, response.remoteAddress) + " "
+ Utility.toDateFormat(new Date(response.postTime));
} else {
switch (response.dispInfo) {
case Constant.BBS_DISPLAY_INFO_ANONYMOUS:
upper = response.id + ": " + Utility.toDateFormat(new Date(response.postTime));
break;
case Constant.BBS_DISPLAY_INFO_NAME_ONLY:
upper = response.id + ": " + response.name + " "
+ Utility.toDateFormat(new Date(response.postTime));
break;
case Constant.BBS_DISPLAY_INFO_ALL_DATA:
upper = response.id + ": " + response.name
+ Utility.makeTrip(response.userCode, response.remoteAddress) + " "
+ Utility.toDateFormat(new Date(response.postTime));
break;
}
}
HTML upperHtml = new HTML(SafeHtmlUtils.fromString(upper));
upperHtml.addStyleDependentName("bbsResponseHeader");
panel.add(upperHtml);
}
HTML bodyHtml = new HTML(response.body);
bodyHtml.addStyleDependentName("bbsResponseBody");
panel.add(bodyHtml);
bodyPanel.add(panel);
}
setEnabled(true);
}
示例14: getDate
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml getDate() {
return SafeHtmlUtils.fromString(Utility.toDateFormat(date));
}
示例15: getPlayer
import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml getPlayer() {
return SafeHtmlUtils.fromString(name + Utility.makeTrip(userCode, ip));
}