本文整理汇总了Java中com.google.gwt.user.client.ui.TextBox.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextBox.setWidth方法的具体用法?Java TextBox.setWidth怎么用?Java TextBox.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextBox
的用法示例。
在下文中一共展示了TextBox.setWidth方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LabeledTextBox
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* Use this TextBox if you want to have text validation while a user is typing
*
* @param caption caption for leading label
* @param validator The validator to use for a specific textBox
*/
public LabeledTextBox(String caption, Validator validator) {
this.validator = validator;
HorizontalPanel panel = new HorizontalPanel();
Label label = new Label(caption);
panel.add(label);
textbox = new TextBox();
defaultTextBoxColor = textbox.getElement().getStyle().getBorderColor();
textbox.setWidth("100%");
panel.add(textbox);
panel.setCellWidth(label, "40%");
HorizontalPanel errorPanel = new HorizontalPanel();
errorLabel = new Label("");
errorPanel.add(errorLabel);
VerticalPanel vp = new VerticalPanel();
vp.add(panel);
vp.add(errorPanel);
vp.setHeight("85px");
initWidget(vp);
setWidth("100%");
}
示例2: createUrlGrid
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private Grid createUrlGrid() {
TextBox urlTextBox = new TextBox();
urlTextBox.setWidth("100%");
Grid grid = new Grid(2, 1);
grid.setWidget(0, 0, new Label("Url:"));
grid.setWidget(1, 0, urlTextBox);
return grid;
}
示例3: LatLonWidget
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* Constructs an empty widget.
*/
public LatLonWidget() {
panel = new Grid(1,3);
middle = new VerticalPanel();
rose = new Image(GWT.getModuleBaseURL()+"../images/compass_rose.png");
rose.addStyleName("OL_MAP-middle");
southLat = new TextBox();
northLat = new TextBox();
southLat.setWidth(boxWidth);
northLat.setWidth(boxWidth);
eastLon = new TextBox();
westLon = new TextBox();
eastLon.setWidth(boxWidth);
westLon.setWidth(boxWidth);
panel.setWidget(0, 0, westLon);
middle.add(northLat);
middle.add(rose);
middle.add(southLat);
panel.setWidget(0, 1, middle);
panel.setWidget(0, 2, eastLon);
// panel.getFlexCellFormatter().setColSpan(2, 0, 2);
initWidget(panel);
}
示例4: addTextBox
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* To add Text Box.
*
* @param row int
* @param dto BatchClassPluginConfigDTO
* @param readOnly boolean
* @return ValidatableWidget<TextBox>
*/
public ValidatableWidget<TextBox> addTextBox(int row, final BatchClassPluginConfigDTO dto, boolean readOnly) {
TextBox fieldValue = new TextBox();
fieldValue.setReadOnly(readOnly);
fieldValue.setWidth("160px");
fieldValue.setName(dto.getPluginConfig().getFieldName());
fieldValue.setText(dto.getValue());
final ValidatableWidget<TextBox> validatableTextBox = new ValidatableWidget<TextBox>(fieldValue);
if (!readOnly && dto.getPluginConfig() != null) {
validatableTextBox.addValidator((Validator) ValidatorFactory.getValidator(dto.getDataType(), fieldValue));
validatableTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
if (!dto.isMandatory() && validatableTextBox.getWidget().getText().isEmpty()) {
validatableTextBox.getWidget().removeStyleName(AdminConstants.DATE_BOX_FORMAT_ERROR);
} else {
validatableTextBox.toggleValidDateBox();
}
}
});
if (!dto.isMandatory() && validatableTextBox.getWidget().getText().isEmpty()) {
validatableTextBox.getWidget().removeStyleName(AdminConstants.DATE_BOX_FORMAT_ERROR);
} else {
validatableTextBox.toggleValidDateBox();
}
if (dto.isMandatory()) {
validatableTextBox.addValidator(new EmptyStringValidator(validatableTextBox.getWidget()));
}
}
return validatableTextBox;
}
示例5: ChangeLocationWidget
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
@Inject
public ChangeLocationWidget(TextBox textBox, Label label, CoreLocalizationConstant locale) {
this.textBox = textBox;
label.setText(locale.locationIncorrect());
textBox.setWidth("420px");
add(label);
add(textBox);
}
示例6: linkTo
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private void linkTo() {
// Create URL
String url = new PlannerState(getPlanRequestBean()).getUrl();
// Display dialog box
final DialogBox dialogBox = new DialogBox(true, true);
VerticalPanel dialogBoxContents = new VerticalPanel();
dialogBoxContents.setWidth("100%");
dialogBox.setText(I18nUtils.tr("link.to.this.page"));
Label message = new Label(I18nUtils.tr("copy.paste.link.hint"));
dialogBoxContents.add(message);
final TextBox urlTextBox = new TextBox();
urlTextBox.setText(url);
urlTextBox.setWidth("100%");
dialogBoxContents.add(urlTextBox);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
urlTextBox.selectAll();
urlTextBox.setFocus(true);
}
});
Button button = new Button(I18nUtils.tr("ok"), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
dialogBox.hide();
}
});
dialogBoxContents.add(button);
dialogBox.setWidth("400px");
dialogBox.setWidget(dialogBoxContents);
dialogBox.center();
}
示例7: NavBar
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public NavBar(final Table table) {
super();
initWidget(BINDER.createAndBindUi(this));
this.table = table;
Images images = GWT.create(Images.class);
DOM.setInnerHTML(newerButton.getElement(), AbstractImagePrototype.create(images.previousPage()).getHTML());
DOM.setInnerHTML(olderButton.getElement(), AbstractImagePrototype.create(images.nextPage()).getHTML());
DOM.setInnerHTML(upButton.getElement(), AbstractImagePrototype.create(images.upRecord()).getHTML());
DOM.setInnerHTML(downButton.getElement(), AbstractImagePrototype.create(images.downRecord()).getHTML());
//countString = new String();
newerButton.setTitle(LocaleDictionary.get().getConstantValue(LocaleCommonConstants.TITLE_PREVIOUS));
olderButton.setTitle(LocaleDictionary.get().getConstantValue(LocaleCommonConstants.TITLE_NEXT));
upButton.setTitle(LocaleDictionary.get().getConstantValue(LocaleCommonConstants.UP_RECORD));
downButton.setTitle(LocaleDictionary.get().getConstantValue(LocaleCommonConstants.DOWN_RECORD));
searchPageTextBox = new TextBox();
pageNumberValidatableWidget = new ValidatableWidget<TextBox>(searchPageTextBox, true);
pageNumberValidatableWidget.addValidator(new NumberValidator(searchPageTextBox, false, true));
searchPageTextBox.setText("1");
searchPageTextBox.setWidth("30px");
searchPageTextBox.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
String pageNo = searchPageTextBox.getText();
char keyCode = event.getCharCode();
pageNumberValidatableWidget.toggleValidDateBox();
if (keyCode == KeyCodes.KEY_ENTER && checkTextEntered(pageNo) && pageNumberValidatableWidget.validate()) {
moveToEnteredPage(pageNo);
}
}
});
searchPageTextBox.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> arg0) {
pageNumberValidatableWidget.toggleValidDateBox();
}
});
}
示例8: CreateChangeDialog
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public CreateChangeDialog(Project.NameKey project) {
super(Util.C.dialogCreateChangeTitle(), Util.C.dialogCreateChangeHeading());
ProjectApi.getBranches(
project,
new GerritCallback<JsArray<BranchInfo>>() {
@Override
public void onSuccess(JsArray<BranchInfo> result) {
branches = Natives.asList(result);
}
});
topic = new TextBox();
topic.setWidth("100%");
topic.getElement().getStyle().setProperty("boxSizing", "border-box");
FlowPanel newTopicPanel = new FlowPanel();
newTopicPanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
newTopicPanel.add(topic);
panel.insert(newTopicPanel, 0);
panel.insert(new SmallHeading(Util.C.newChangeTopicSuggestion()), 0);
newChange =
new SuggestBox(
new HighlightSuggestOracle() {
@Override
protected void onRequestSuggestions(Request request, Callback done) {
List<BranchSuggestion> suggestions = new ArrayList<>();
for (BranchInfo b : branches) {
if (b.ref().contains(request.getQuery())) {
suggestions.add(new BranchSuggestion(b));
}
}
done.onSuggestionsReady(request, new Response(suggestions));
}
});
newChange.setWidth("100%");
newChange.getElement().getStyle().setProperty("boxSizing", "border-box");
FlowPanel newChangePanel = new FlowPanel();
newChangePanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
newChangePanel.add(newChange);
panel.insert(newChangePanel, 0);
panel.insert(new SmallHeading(Util.C.newChangeBranchSuggestion()), 0);
message.setCharacterWidth(70);
}
示例9: fill
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private void fill( MultiLayerInputMatrixGrid matrix, JMissingData md ) {
int col = matrix.addColumn( md.getEntity() );
for( JDataItem item : md.items() ) {
int row = matrix.getRow( item.getId() );
if( row == -1 ) {
row = matrix.addRow( item.getId() );
}
MultiLayerInputMatrixCell cell = matrix.getCell( row, col );
cell.id = item.getId();
cell.entity = md.getEntity();
TextBox txt = new TextBox();
txt.setText( item.getValue() );
cell.textBox = txt;
txt.setWidth( "32px" );
matrix.grid.setWidget( row, col, txt );
}
for( JMissingData child : md.children() ) {
fill( child );
}
}