本文整理汇总了Java中com.google.gwt.i18n.client.HasDirection.Direction类的典型用法代码示例。如果您正苦于以下问题:Java Direction类的具体用法?Java Direction怎么用?Java Direction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Direction类属于com.google.gwt.i18n.client.HasDirection包,在下文中一共展示了Direction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertItem
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
/**
* Inserts an item into the list box, specifying its direction and an initial value for the item. If the index is less than zero, or greater than or equal
* to the length of the list, then the item will be appended to the end of the list.
*
* @param item the text of the item to be inserted
* @param dir the item's direction. If {@code null}, the item is displayed in the widget's overall direction, or, if a direction estimator has been set, in
* the item's estimated direction.
* @param value the item's value, to be submitted if it is part of a {@link FormPanel}.
* @param index the index at which to insert it
*/
public void insertItem(String item, Direction dir, String value, int index) {
SelectElement select = getSelectElement();
OptionElement option = Document.get().createOptionElement();
setOptionText(option, item, dir);
option.setValue(value);
int itemCount = select.getLength();
if (index < 0 || index > itemCount) {
index = itemCount;
}
if (index == itemCount) {
select.add(option, null);
} else {
OptionElement before = select.getOptions().getItem(index);
select.add(option, before);
}
}
示例2: setOptionText
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
/**
* Sets the text of an option element. If the direction of the text is opposite to the page's direction, also wraps it with Unicode bidi formatting
* characters to prevent garbling, and indicates that this was done by setting the option's <code>BIDI_ATTR_NAME</code> custom attribute.
*
* @param option an option element
* @param text text to be set to the element
* @param dir the text's direction. If {@code null} and direction estimation is turned off, direction is ignored.
*/
protected void setOptionText(OptionElement option, String text, Direction dir) {
if (dir == null && estimator != null) {
dir = estimator.estimateDirection(text);
}
if (dir == null) {
option.setText(text);
option.removeAttribute(BIDI_ATTR_NAME);
} else {
String formattedText = BidiFormatter.getInstanceForCurrentLocale().unicodeWrapWithKnownDir(dir, text, false /* isHtml */, false /* dirReset */);
option.setText(formattedText);
if (formattedText.length() > text.length()) {
option.setAttribute(BIDI_ATTR_NAME, "");
} else {
option.removeAttribute(BIDI_ATTR_NAME);
}
}
}
示例3: createUrlToShare
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
return new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
urlToShareAnchor.setHref(getHref());
urlToShareAnchor.setText(
UIMessages.INSTANCE.seeOtherWindow("GeoWE Project"),
Direction.LTR);
urlShared.setText(getHref());
urlPanel.setVisible(true);
urlShared.setVisible(true);
}
private String getHref() {
String baseUrl = GWT.getHostPageBaseURL();
baseUrl += "?projectUrl="
+ URL.encodeQueryString(urlTextField.getValue());
return baseUrl;
}
};
}
示例4: insertItem
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
@Override
public void insertItem(String item, Direction dir, String value, int index) {
SelectElement select = getElement().cast();
OptionElement option = Document.get().createOptionElement();
setOptionText(option, item, dir);
option.setValue(value);
option.setTitle(item);
int itemCount = select.getLength();
if (index < 0 || index > itemCount) {
index = itemCount;
}
if (index == itemCount) {
select.add(option, null);
} else {
OptionElement before = select.getOptions().getItem(index);
select.add(option, before);
}
}
示例5: showSourceFile
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
/**
* Show a source file based on the selection in the source list.
*/
private void showSourceFile() {
if (content == null) {
return;
}
// Set the highlighted tab.
tabExample.getElement().getStyle().clearColor();
tabStyle.getElement().getStyle().clearColor();
tabSource.getElement().getStyle().setColor(SELECTED_TAB_COLOR);
contentSource.setHTML(loadingHtml, Direction.LTR);
contentPanel.setWidget(new ScrollPanel(contentSource));
if (!tabSourceList.isVisible() || tabSourceList.getSelectedIndex() == 0) {
// If the source list isn't visible or the first item is selected, load
// the source for the example.
content.getSource(new CustomCallback());
} else {
// Load a raw file.
String filename = tabSourceList.getItemText(
tabSourceList.getSelectedIndex());
content.getRawSource(filename, new CustomCallback());
}
}
示例6: createUrlToShare
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
return new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
urlToShareAnchor.setHref(getHref());
urlToShareAnchor.setText(
UIMessages.INSTANCE.seeOtherWindow(getLayerName()),
Direction.LTR);
urlShared.setText(getHref());
urlPanel.setVisible(true);
urlShared.setVisible(true);
}
private String getHref() {
String baseUrl = GWT.getHostPageBaseURL();
baseUrl += "?layerUrl="
+ URL.encodeQueryString(urlTextField.getValue())
+ "&layerName=" + getLayerName() + "&layerProj="
+ getProjectionName() + "&layerFormat="
+ getDataFormat();
return baseUrl;
}
};
}
示例7: setText
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
/**
* Sets the text in the text box.
*
* @param text
* the text to set in the text box
*/
public void setText(final String text) {
/**
* To leave caret in the beginning of the line. SetSelectionRange
* wouldn't work on IE (see #13477)
*/
Direction previousDirection = this.tb.getDirection();
this.tb.setDirection(Direction.RTL);
this.tb.setText(text);
this.tb.setDirection(previousDirection);
}
示例8: showSourceStyles
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
/**
* Show the source CSS style.
*/
private void showSourceStyles() {
if (content == null) {
return;
}
// Set the highlighted tab.
tabExample.getElement().getStyle().clearColor();
tabStyle.getElement().getStyle().setColor(SELECTED_TAB_COLOR);
tabSource.getElement().getStyle().clearColor();
contentSource.setHTML(loadingHtml, Direction.LTR);
contentPanel.setWidget(new ScrollPanel(contentSource));
content.getStyle(new CustomCallback());
}
示例9: getTextDirection
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
@Override
public Direction getTextDirection() {
return directionalTextHelper.getTextDirection();
}
示例10: setHTML
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
@Override
public void setHTML(SafeHtml html, Direction dir) {
directionalTextHelper.setTextOrHtml(html.asString(), dir, true);
}
示例11: setText
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
@Override
public void setText(String text, Direction dir) {
directionalTextHelper.setTextOrHtml(text, dir, false);
}
示例12: MaterialCheckBox
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
public MaterialCheckBox(SafeHtml label, Direction dir) {
super(label, dir);
}
示例13: MaterialRadioButton
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
public MaterialRadioButton(String name, SafeHtml label, Direction dir) {
super(name, label, dir);
}
示例14: onError
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
public void onError() {
if (id == nextCallbackId) {
contentSource.setHTML("Cannot find resource", Direction.LTR);
}
}
示例15: onSuccess
import com.google.gwt.i18n.client.HasDirection.Direction; //导入依赖的package包/类
public void onSuccess(String value) {
if (id == nextCallbackId) {
contentSource.setHTML(value, Direction.LTR);
}
}