com.google.gwt.user.client.ui.Grid Java Examples

The following examples show how to use com.google.gwt.user.client.ui.Grid. 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: WordCloudLatestApp.java    From swcv with MIT License 6 votes vote down vote up
private Grid createStatTable(DBStatistics result)
{
    Grid table = new Grid(3, 2);
    table.addStyleName("stat");

    table.setHTML(0, 0, "the number of clouds <b>in total</b>");
    table.setHTML(1, 0, "the number of clouds constructed <b>last month</b>");
    table.setHTML(2, 0, "the number of clouds constructed <b>last week</b>");

    table.setHTML(0, 1, "" + result.getTotal());
    table.setHTML(1, 1, "" + result.getLastMonth());
    table.setHTML(2, 1, "" + result.getLastWeek());

    CellFormatter cf = table.getCellFormatter();
    cf.setWidth(0, 0, "65%");
    cf.setWidth(0, 1, "35%");
    return table;
}
 
Example #2
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 #3
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 #4
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 #5
Source File: ProjectList.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ProjectList
 */
public ProjectList() {
  projects = new ArrayList<Project>();
  selectedProjects = new ArrayList<Project>();
  projectWidgets = new HashMap<Project, ProjectWidgets>();

  sortField = SortField.DATE_MODIFIED;
  sortOrder = SortOrder.DESCENDING;

  // Initialize UI
  table = new Grid(1, 5); // The table initially contains just the header row.
  table.addStyleName("ode-ProjectTable");
  table.setWidth("100%");
  table.setCellSpacing(0);
  nameSortIndicator = new Label("");
  dateCreatedSortIndicator = new Label("");
  dateModifiedSortIndicator = new Label("");
  publishedSortIndicator = new Label("");
  refreshSortIndicators();
  setHeaderRow();

  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");

  panel.add(table);
  initWidget(panel);

  // It is important to listen to project manager events as soon as possible.
  Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);

  gallery = GalleryClient.getInstance();
}
 
Example #6
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 #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 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 #9
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 #10
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 #11
Source File: TrashProjectList.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new TrashProjectList
 */
public TrashProjectList() {
  projects = new ArrayList<Project>();
  selectedProjects = new ArrayList<Project>();
  projectWidgets = new HashMap<Project, ProjectWidgets>();

  sortField = SortField.DATE_MODIFIED;
  sortOrder = SortOrder.DESCENDING;

  // Initialize UI
  table = new Grid(1, 5); // The table initially contains just the header row.
  table.addStyleName("ode-ProjectTable");
  table.setWidth("100%");
  table.setCellSpacing(0);
  nameSortIndicator = new Label("");
  dateCreatedSortIndicator = new Label("");
  dateModifiedSortIndicator = new Label("");
  publishedSortIndicator = new Label("");
  refreshSortIndicators();
  setHeaderRow();

  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");

  panel.add(table);
  initWidget(panel);

  // It is important to listen to project manager events as soon as possible.
  Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);

  gallery = GalleryClient.getInstance();
}
 
Example #12
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 #13
Source File: PropertyTable.java    From EasyML with Apache License 2.0 5 votes vote down vote up
public PropertyTable(int rows, int cols) {
	super();

	grid = new Grid(rows, cols);
	vp = new VerticalPanel();
	this.setAlwaysShowScrollBars(false);
	this.setSize("100%", "80%");
	vp.setBorderWidth(0);
	vp.add(grid);
	this.add(vp);
	properties = new HashMap<Property, Label>();
}
 
Example #14
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 #15
Source File: GeneralView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {

        columns = new Column[]{
                new TextColumn("Status", "OFF"),
                new NumberColumn("average-commit-time", "Average Commit Time"),
                new NumberColumn("number-of-inflight-transactions", "Inflight Transactions"),
                new NumberColumn("number-of-nested-transactions", "Nested Transactions")
        };
        grid = new Grid(columns.length, 2);
        grid.addStyleName("metric-grid");

        for (int row = 0; row < columns.length; ++row) {
            grid.getCellFormatter().addStyleName(row, 0, "nominal");
            grid.getCellFormatter().addStyleName(row, 1, "numerical");
        }
        grid.setText(0, 0, "Status");

        HorizontalPanel header = new HorizontalPanel();
        header.addStyleName("fill-layout-width");
        header.add(new HTML("<h3 class='metric-label'>General Statistics</h3>"));

        final HelpSystem.AddressCallback addressCallback = () -> {
            ModelNode address = new ModelNode();
            address.get(ModelDescriptionConstants.ADDRESS).set(RuntimeBaseAddress.get());
            address.get(ModelDescriptionConstants.ADDRESS).add("subsystem", "transactions");
            return address;
        };

        MetricHelpPanel helpPanel = new MetricHelpPanel(addressCallback, this.columns);

        VerticalPanel metricsPanel = new VerticalPanel();
        metricsPanel.addStyleName("metric-container");
        metricsPanel.add(header);
        metricsPanel.add(helpPanel.asWidget());
        metricsPanel.add(grid);

        return metricsPanel.asWidget();
    }
 
Example #16
Source File: BulletGraphView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Widget asWidget() {

    VerticalPanel desc = new VerticalPanel();
    desc.addStyleName("metric-container");
    if(embeddedUse)
        desc.add(new HTML("<h3 class='metric-label-embedded'>" + title + "</h3>"));
    else
        desc.add(new HTML("<h3 class='metric-label'>" + title + "</h3>"));

    container = new HorizontalPanel();
    container.setStyleName("fill-layout-width");
    container.addStyleName("metric-panel");


    grid = new Grid(columns.length, 2);
    grid.addStyleName("metric-grid");

    // format
    for (int row = 0; row < columns.length; ++row) {
        grid.getCellFormatter().addStyleName(row, 0,  "nominal");
        grid.getCellFormatter().addStyleName(row, 1, "numerical");
    }

    int baselineIndex = getBaseLineIndex();
    if(baselineIndex>=0)
        grid.getRowFormatter().addStyleName(baselineIndex, "baseline");

    // init
    for(int i=0; i<columns.length;i++)
    {
        grid.setText(i, 0, columns[i].label);
        grid.setText(i, 1, "0");
    }


    container.add(grid);

    ProtovisWidget graphWidget = new ProtovisWidget();
    graphWidget.initPVPanel();
    vis = createVisualization(graphWidget);

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            renderDefault();    // the 'empty' display
        }
    });

    if (address != null) {
        MetricHelpPanel helpPanel = new MetricHelpPanel(address, this.columns);
        desc.add(helpPanel.asWidget());
    }

    container.add(graphWidget);
    graphWidget.getElement().getParentElement().setAttribute("align", "center");
    graphWidget.getElement().getParentElement().setAttribute("width", "80%");

    desc.add(container);

    return desc;
}
 
Example #17
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldBeAbleToSetTextInGrids() {
  Grid grid = new Grid();
  grid.setText(0, 0, "foo");
}
 
Example #18
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public Grid getProgGrid(){
	return progGrid;
}
 
Example #19
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;
}
 
Example #20
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 #21
Source File: UrlImportWizard.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public UrlImportWizard(final FolderNode assetsFolder, OnImportListener listener) {
  super(MESSAGES.urlImportWizardCaption(), true, false);

  listeners.add(listener);

  final Grid urlGrid = createUrlGrid();
  VerticalPanel panel = new VerticalPanel();
  panel.add(urlGrid);

  addPage(panel);

  getConfirmButton().setText("Import");

  setPagePanelHeight(150);
  setPixelSize(200, 150);
  setStylePrimaryName("ode-DialogBox");

  initFinishCommand(new Command() {
    @Override
    public void execute() {
      Ode ode = Ode.getInstance();
      final long projectId = ode.getCurrentYoungAndroidProjectId();
      final Project project = ode.getProjectManager().getProject(projectId);

      TextBox urlTextBox = (TextBox) urlGrid.getWidget(1, 0);
      String url = urlTextBox.getText();
      if (url.trim().isEmpty()) {
        Window.alert(MESSAGES.noUrlError());
        return;
      }

      ode.getProjectService().importMedia(ode.getSessionId(), projectId, url, true, new OdeAsyncCallback<TextFile>() {
        @Override
        public void onSuccess(TextFile file) {
          ProjectNode node = new YoungAndroidAssetNode(assetsFolder.getFileId(), file.getFileName().replaceFirst("assets/", ""));
          project.addNode(assetsFolder, node);
          byte[] content = Base64Util.decodeLines(file.getContent());
          for (OnImportListener l : listeners) {
            l.onSuccess(content);
          }
          listeners.clear();
        }
      });
    }
  });
}
 
Example #22
Source File: Pagination.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public Pagination(Grid grid, int pageSize, PageType pageType){
	this.grid = grid;
	this.pageSize = pageSize;
	this.lastPage = pageSize;
	this.pageType = pageType.getType();
}
 
Example #23
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public Grid getCateGrid(){
	return cateGrid;
}
 
Example #24
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public Grid getUserGrid(){
	return userGrid;
}
 
Example #25
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public Grid getDataGrid(){
	return dataGrid;
}
 
Example #26
Source File: Guestbook.java    From appengine-gwtguestbook-namespaces-java with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the guest entries display grid.
 * 
 * @return the guest entries display grid
 */
public Grid getGuestEntries() {
  return guestEntries;
}