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


Java SafeHtmlUtils.fromString方法代码示例

本文整理汇总了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;        
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:27,代码来源:HFRichTextEditor.java

示例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();
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:25,代码来源:AggregateUI.java

示例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);
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:17,代码来源:PanelThread.java

示例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;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators-example,代码行数:40,代码来源:MyNavigationStructure.java

示例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() + "&nbsp;" + text);
}
 
开发者ID:wte4j,项目名称:wte4j,代码行数:8,代码来源:MyMenuItem.java

示例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);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:41,代码来源:ExpressionView.java

示例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 ) );
    }
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:15,代码来源:WgtGameLogs.java

示例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;
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:9,代码来源:PacketPlayerSummary.java

示例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);
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:5,代码来源:UIEnabledActionCell.java

示例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;
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:9,代码来源:TreeItemAdditionalEvent.java

示例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);
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:6,代码来源:CreationUi.java

示例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);
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:6,代码来源:CreationUi.java

示例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);
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:47,代码来源:PanelThread.java

示例14: getDate

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml getDate() {
  return SafeHtmlUtils.fromString(Utility.toDateFormat(date));
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:4,代码来源:PacketProblemCreationLog.java

示例15: getPlayer

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml getPlayer() {
  return SafeHtmlUtils.fromString(name + Utility.makeTrip(userCode, ip));
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:4,代码来源:PacketProblemCreationLog.java


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