Java Code Examples for com.google.gwt.user.client.ui.Grid#setWidget()

The following examples show how to use com.google.gwt.user.client.ui.Grid#setWidget() . 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
Source File: JobDescPopupPanel.java    From EasyML with Apache License 2.0 6 votes vote down vote up
/**
 * Create a Grid that describes the job
 */
@SuppressWarnings("deprecation")
private Grid createGrid() {
	Grid grid = new Grid(2, 2);
	grid.setWidth("280px");
	grid.setWidget(0, 0, new Label(Constants.studioUIMsg.jobName()));
	/**
	 * Panel information
	 */

	namebox.setStyleName("boxstyle");
	grid.setWidget(0, 1, namebox);
	grid.setWidget(1, 0, new Label(Constants.studioUIMsg.jobDescription()));

	SubmitListener sl = new SubmitListener();
	namebox.addKeyboardListener(sl);

	descArea.setStyleName("boxstyle");
	descArea.setHeight("auto");
	grid.setWidget(1, 1, descArea);
	grid.setStyleName("bda-newjob-grid");
	return grid;
}
 
Example 2
Source File: ParameterPanel.java    From EasyML with Apache License 2.0 6 votes vote down vote up
protected void initGridHead(int size){
	this.setSpacing(3);
	paramsGrid = new Grid(size, 3);

	paramsGrid.setStyleName("gridstyle");
	paramsGrid.setBorderWidth(1);
	paramsGrid.setWidth("250px");
	Label nameLabel = new Label(Constants.studioUIMsg.parameter());
	nameLabel.setWidth("65px");
	paramsGrid.setWidget(0, 0, nameLabel);

	Label typeLabel = new Label(Constants.studioUIMsg.type());
	typeLabel.setWidth("40px");
	paramsGrid.setWidget(0, 1, typeLabel);

	Label valueLabel = new Label(Constants.studioUIMsg.value());
	paramsGrid.setWidget(0, 2, valueLabel);
	paramsGrid.setVisible(false);
}
 
Example 3
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public TimeFilterConfig() {
  grid = new Grid(2, 4);
  grid.setWidget(0, 0, createFormLabel("Start"));
  grid.setWidget(0, 1, startDate = createTextBox(12));
  grid.setWidget(0, 2, createComment("hh:mm:ss.SSS"));
  grid.setWidget(0, 3, createNowLink(startDate));
  grid.setWidget(1, 0, createFormLabel("End"));
  grid.setWidget(1, 1, endDate = createTextBox(12));
  grid.setWidget(1, 2, createComment("hh:mm:ss.SSS"));
  grid.setWidget(1, 3, createNowLink(endDate));
  addValueChangeHandler(new ValueChangeHandler<Config>() {
    //@Override
    public void onValueChange(ValueChangeEvent<Config> event) {
      Date date = getStart();
      startDate.setText(date == null ? "" : FORMAT.format(date));
      date = getEnd();
      endDate.setText(date == null ? "" : FORMAT.format(date));
    }
  });
}
 
Example 4
Source File: CopyYoungAndroidProjectCommand.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private Widget createPreviousCheckpointsTable(List<Project> checkpointProjects) {
  Grid table = new Grid(1 + checkpointProjects.size(), 3);
  table.addStyleName("ode-ProjectTable");

  // Set the widgets for the header row.
  table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
  table.setWidget(0, 0, new Label(MESSAGES.projectNameHeader()));
  table.setWidget(0, 1, new Label(MESSAGES.projectDateCreatedHeader()));
  table.setWidget(0, 2, new Label(MESSAGES.projectDateModifiedHeader()));

  // Set the widgets for the rows representing previous checkpoints
  DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
  int row = 1;
  for (Project checkpointProject : checkpointProjects) {
    table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
    Label nameLabel = new Label(checkpointProject.getProjectName());
    table.setWidget(row, 0, nameLabel);

    Date dateCreated = new Date(checkpointProject.getDateCreated());
    table.setWidget(row, 1, new Label(dateTimeFormat.format(dateCreated)));

    Date dateModified = new Date(checkpointProject.getDateModified());
    table.setWidget(row, 2, new Label(dateTimeFormat.format(dateModified)));
    row++;
  }

  return table;
}
 
Example 5
Source File: ComponentImportWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: UrlImportWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private static 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;
}
 
Example 7
Source File: LoadingMessagePopupPanel.java    From demo-gwt-springboot with Apache License 2.0 5 votes vote down vote up
@Inject
public LoadingMessagePopupPanel(Messages messages, Asset asset) {
	final Image ajaxImage = new Image(asset.loadingIcon());
	final Grid grid = new Grid(1, 3);
	grid.setWidget(0, 0, ajaxImage);
	grid.setText(0, 2, messages.loadingMessage_message());
	this.container.add(grid);
	add(this.container);
}
 
Example 8
Source File: SimpleColorPicker.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new simple color picker.
 *
 * @param colopicker the colopicker
 */
public SimpleColorPicker(ComplexColorPicker colopicker) {
  super(colopicker);
  style.ensureInjected();

  final Grid grid = new Grid(ROWS, COLS);
  grid.setCellSpacing(0);
  grid.getRowFormatter().getElement(0).addClassName(style.firstRow());
  grid.getRowFormatter().getElement(1).addClassName(style.firstRow());
  int row;
  int col;
  int num = 0;
  for (final String c : COLORS) {
    row = num / COLS;
    col = num % COLS;
    grid.setWidget(row, col, createCell(c));
    num++;
  }
  grid.addClickHandler(new ClickHandler() {
    public void onClick(final ClickEvent event) {
      Cell cell = grid.getCellForEvent(event);
      if (cell != null) {
        String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()];
        onColorChoose(color);
      }
    }
  });
  grid.addStyleName(style.grid());
  initWidget(grid);
}
 
Example 9
Source File: SimpleColorPicker.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new simple color picker.
 *
 * @param colopicker the colopicker
 */
public SimpleColorPicker(ComplexColorPicker colopicker) {
  super(colopicker);
  style.ensureInjected();

  final Grid grid = new Grid(ROWS, COLS);
  grid.setCellSpacing(0);
  grid.getRowFormatter().getElement(0).addClassName(style.firstRow());
  grid.getRowFormatter().getElement(1).addClassName(style.firstRow());
  int row;
  int col;
  int num = 0;
  for (final String c : COLORS) {
    row = num / COLS;
    col = num % COLS;
    grid.setWidget(row, col, createCell(c));
    num++;
  }
  grid.addClickHandler(new ClickHandler() {
    public void onClick(final ClickEvent event) {
      Cell cell = grid.getCellForEvent(event);
      if (cell != null) {
        String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()];
        onColorChoose(color);
      }
    }
  });
  grid.addStyleName(style.grid());
  initWidget(grid);
}
 
Example 10
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public DurationFilterConfig() {
  grid = new Grid(2, 2);
  grid.setWidget(0, 0, createFormLabel("Minimum"));
  grid.setWidget(0, 1, min = createTextBox(5));
  grid.setWidget(1, 0, createFormLabel("Maximum"));
  grid.setWidget(1, 1, max = createTextBox(5));
  addValueChangeHandler(new ValueChangeHandler<Config>() {
    //@Override
    public void onValueChange(ValueChangeEvent<Config> event) {
      min.setText(Integer.toString(getMinDuration()));
      max.setText(Integer.toString(getMaxDuration()));
    }
  });
}
 
Example 11
Source File: Ode.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a dialog box to show empty trash list message.
 * @param showDialog Convenience variable to show the created DialogBox.
 * @return The created and optionally displayed Dialog box.
 */

public DialogBox createEmptyTrashDialog(boolean showDialog) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, false); //DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.createNoProjectsDialogText());

  Grid mainGrid = new Grid(2, 2);
  mainGrid.getCellFormatter().setAlignment(0,
          0,
          HasHorizontalAlignment.ALIGN_CENTER,
          HasVerticalAlignment.ALIGN_MIDDLE);
  mainGrid.getCellFormatter().setAlignment(0,
          1,
          HasHorizontalAlignment.ALIGN_CENTER,
          HasVerticalAlignment.ALIGN_MIDDLE);
  mainGrid.getCellFormatter().setAlignment(1,
          1,
          HasHorizontalAlignment.ALIGN_RIGHT,
          HasVerticalAlignment.ALIGN_MIDDLE);

  Image dialogImage = new Image(Ode.getImageBundle().codiVert());

  Grid messageGrid = new Grid(2, 1);
  messageGrid.getCellFormatter().setAlignment(0,
          0,
          HasHorizontalAlignment.ALIGN_JUSTIFY,
          HasVerticalAlignment.ALIGN_MIDDLE);
  messageGrid.getCellFormatter().setAlignment(1,
          0,
          HasHorizontalAlignment.ALIGN_LEFT,
          HasVerticalAlignment.ALIGN_MIDDLE);


  Label messageChunk2 = new Label(MESSAGES.showEmptyTrashMessage());
  messageGrid.setWidget(1, 0, messageChunk2);
  mainGrid.setWidget(0, 0, dialogImage);
  mainGrid.setWidget(0, 1, messageGrid);

  dialogBox.setWidget(mainGrid);
  dialogBox.center();

  if (showDialog) {
    dialogBox.show();
  }

  return dialogBox;
}
 
Example 12
Source File: WordCloudLatestApp.java    From swcv with MIT License 4 votes vote down vote up
private Grid createTable(List<WordCloud> clouds, boolean debug)
{
    Grid table = new Grid(clouds.size() + 1, debug ? 4 : 3);
    table.addStyleName("latest");
    CellFormatter cf = table.getCellFormatter();

    table.setHTML(0, 0, "<b>id</b>");
    table.setHTML(0, 1, "<b>creation date</b>");
    table.setHTML(0, 2, "<b>source</b>");
    cf.setWidth(0, 0, "10%");
    cf.setWidth(0, 1, "25%");
    cf.setWidth(0, 2, "65%");
    cf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    cf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
    cf.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);

    if (debug)
    {
        table.setHTML(0, 3, "<b>ip</b>");
        cf.setWidth(0, 1, "20%");
        cf.setWidth(0, 2, "60%");
        cf.setWidth(0, 3, "10%");
        cf.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER);
    }

    for (int i = 0; i < clouds.size(); i++)
    {
        WordCloud cloud = clouds.get(i);

        table.setHTML(i + 1, 0, "<a href='/cloud.html?id=" + cloud.getId() + "'>" + cloud.getId() + "</a>");
        Date dt = cloud.getCreationDateAsDate();
        table.setHTML(i + 1, 1, DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dt));
        table.setWidget(i + 1, 2, createSourceField(cloud, debug));
        cf.setHorizontalAlignment(i + 1, 2, HasHorizontalAlignment.ALIGN_LEFT);

        if (debug)
        {
            table.setHTML(i + 1, 3, cloud.getCreatorIP());
        }
    }

    return table;
}