Java Code Examples for com.google.gwt.user.client.ui.TextBox#setVisibleLength()

The following examples show how to use com.google.gwt.user.client.ui.TextBox#setVisibleLength() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * File textBox
 */
public FileTextBox() {
	textBox = new TextBox();
	textBox.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			switch (event.getNativeKeyCode()) {
				case (char) KeyCodes.KEY_ENTER:
					switch (action) {
						case ACTION_RENAME:
							if (textBox.getText().length() > 0) {
								Main.get().mainPanel.desktop.browser.fileBrowser.rename(textBox.getText());
							} else {
								Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							}
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;

				case (char) KeyCodes.KEY_ESCAPE:
					switch (action) {
						case ACTION_RENAME:
							Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;
			}
		}
	});
	textBox.setVisibleLength(20);
	textBox.setStyleName("okm-FileBrowser-TextBox");
	initWidget(textBox);
}
 
Example 2
private ToolStrip toolstripButtons() {

        final TextBox filter = new TextBox();
        filter.setMaxLength(30);
        filter.setVisibleLength(20);
        filter.getElement().setAttribute("style", "float:right; width:120px;");
        filter.addKeyUpHandler(keyUpEvent -> {
            String word = filter.getText();
            if (word != null && word.trim().length() > 0) {
                filter(word);
            } else {
                clearFilter();
            }
        });

        ToolStrip topLevelTools = new ToolStrip();

        final HTML label = new HTML(Console.CONSTANTS.commom_label_filter()+": ");
        label.getElement().setAttribute("style", "padding-top:8px;");
        topLevelTools.addToolWidget(label);
        topLevelTools.addToolWidget(filter);

        enableBtn = new ToolButton(Console.CONSTANTS.common_label_enable(), event -> presenter.enable());
        disableBtn = new ToolButton(Console.CONSTANTS.common_label_disable(), event -> presenter.disable());
        refreshBtn = new ToolButton(Console.CONSTANTS.common_label_refresh(), event -> presenter.loadChanges());

        topLevelTools.addToolButtonRight(enableBtn);
        topLevelTools.addToolButtonRight(disableBtn);
        topLevelTools.addToolButtonRight(refreshBtn);

        return topLevelTools;
    }
 
Example 3
public Widget asWidget() {
    panel = new LayoutPanel();

    textBox = new TextBox();
    textBox.setMaxLength(30);
    textBox.setVisibleLength(20);
    textBox.addKeyUpHandler(keyUpEvent -> {

        String token = textBox.getText();
        if (token != null
                && !token.equals("")) {

            if (!token.equals(currentFilterExpression)) {  // prevent keyUp w/o value change
                currentFilterExpression = token;
                selection.clear();
                applyFilter(token);
            }

        } else {
            selection.clear();
            clear();
        }
    });

    HTML icon = new HTML("<i class=\"icon-search\"></i>");
    icon.getElement().setAttribute("style", "padding-top:5px");
    textBox.getElement().setAttribute("style", "padding-top:5px");
    panel.add(icon);
    panel.add(textBox);
    panel.setWidgetLeftWidth(icon, 5, Style.Unit.PX, 20, Style.Unit.PX);
    panel.setWidgetLeftWidth(textBox, 25, Style.Unit.PX, 205, Style.Unit.PX);

    panel.getElement().getStyle().setMargin(5, Style.Unit.PX);
    return panel;
}
 
Example 4
Source Project: gwt-traction   File: OpacityDemo.java    License: Apache License 2.0 4 votes vote down vote up
private static final TextBox createTextBox(String text) {
TextBox ret = new TextBox();
ret.setVisibleLength(10);
ret.setText(text);
return ret;
   }
 
Example 5
Source Project: gwt-traction   File: ColorDemo.java    License: Apache License 2.0 4 votes vote down vote up
private static final TextBox createTextBox(String text) {
TextBox ret = new TextBox();
ret.setVisibleLength(20);
ret.setText(text);
return ret;
   }
 
Example 6
protected static TextBox createTextBox(int visibleLength) {
  TextBox textbox = new TextBox();
  textbox.setVisibleLength(visibleLength);
  return textbox;
}
 
Example 7
private ToolStrip buttonsTool() {
    ToolStrip tools = new ToolStrip();

    final TextBox filter = new TextBox();
    filter.setMaxLength(30);
    filter.setVisibleLength(20);
    filter.getElement().setAttribute("style", "float:right; width:120px;");
    filter.addKeyUpHandler(keyUpEvent -> {
        String word = filter.getText();
        if(word != null && word.trim().length() > 0) {
            filter(word);
        }
        else {
            clearFilter();
        }
    });

    this.btnStart = new ToolButton(Console.CONSTANTS.common_label_start(),
            event -> {
                Job job = selectionModel.getSelectedObject();
                circuit.dispatch(
                        new StartJob(job.getDeploymentName(), job.getSubdeploymentName(),
                                job.getJobXmlName()));
            });

    this.btnStop = new ToolButton(Console.CONSTANTS.common_label_stop(),
            event -> {
                Job job = selectionModel.getSelectedObject();
                circuit.dispatch(
                        new StopJob(job.getDeploymentName(), job.getSubdeploymentName(),
                            job.getName(), job.getExecutionId()));
            });

    this.btnRestart = new ToolButton(Console.CONSTANTS.common_label_restart(),
            event -> {
                Job job = selectionModel.getSelectedObject();
                if ("COMPLETED".equals(job.getCurrentStatus())) {
                    Console.warning(Console.MESSAGES.batch_cannot_restart(job.getExecutionId()));
                } else {
                    circuit.dispatch(
                            new RestartJob(job.getDeploymentName(), job.getSubdeploymentName(),
                                    job.getName(), job.getExecutionId()));
                }
            });

    final HTML label = new HTML(Console.CONSTANTS.commom_label_filter()+":&nbsp;");
    label.getElement().setAttribute("style", "padding-top:8px;");
    tools.addToolWidget(label);
    tools.addToolWidget(filter);
    
    tools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_refresh(), 
            event -> circuit.dispatch(new LoadJobsMetrics())));

    tools.addToolButtonRight(btnStart);
    tools.addToolButtonRight(btnStop);
    tools.addToolButtonRight(btnRestart);
    return tools;
}