當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。