com.google.gwt.user.client.ui.Grid类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(14.0k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.google.gwt.user.client.ui.Grid类的一些代码示例,展示了Grid类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grid类的具体详情如下:
包路径:com.google.gwt.user.client.ui.Grid
类名称:Grid

Grid介绍

[英]A rectangular grid that can contain text, html, or a child com.google.gwt.user.client.ui.Widget within its cells. It must be resized explicitly to the desired number of rows and columns.

Example

com.google.gwt.examples.GridExample

Use in UiBinder Templates

Grid widget consists of <g:row> elements. Each <g:row> element can contain one or more <g:cell> or <g:customCell> elements. Using <g:cell> attribute it is possible to place pure HTML content. <g:customCell> is used as a container for com.google.gwt.user.client.ui.Widget type objects. (Note that the tags of the row, cell and customCell elements are not capitalized. This is meant to signal that the item is not a runtime object, and so cannot have a ui:field attribute.)

For example:

<g:Grid> 
<g:row styleName="optionalHeaderStyle"> 
<g:customCell styleName="optionalFooCellStyle"> 
<g:Label>foo</g:Label> 
</g:customCell> 
<g:customCell styleName="optionalBarCellStyle"> 
<g:Label>bar</g:Label> 
</g:customCell> 
</g:row> 
<g:row> 
<g:cell> 
<div>foo</div> 
</g:cell> 
<g:cell> 
<div>bar</div> 
</g:cell> 
</g:row> 
</g:Grid>

[中]

代码示例

代码示例来源:origin: fjfd/microscope

/**
 * Additional styling options.
 */
private Grid makeStylePanel() {
  final Grid grid = new Grid(5, 3);
  grid.setText(0, 1, "Smooth");
  grid.setWidget(0, 2, smooth);
  return grid;
}

代码示例来源:origin: stackoverflow.com

Grid grid = new Grid();
HTMLTable.CellFormatter formatter = grid.getCellFormatter();
formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
formatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);

代码示例来源:origin: com.google.gwt/gwt-servlet

removeCell(i, j);
   insertCell(i, j);
getColumnFormatter().resizeColumnGroup(columns, false);

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Resizes the grid to the specified number of rows.
 * 
 * @param rows the number of rows
 * @throws IndexOutOfBoundsException
 */
public void resizeRows(int rows) {
 if (numRows == rows) {
  return;
 }
 if (rows < 0) {
  throw new IndexOutOfBoundsException("Cannot set number of rows to "
    + rows);
 }
 if (numRows < rows) {
  addRows(getBodyElement(), rows - numRows, numColumns);
  numRows = rows;
 } else {
  while (numRows > rows) {
   // Fewer rows. Remove extraneous ones.
   removeRow(numRows - 1);
  }
 }
}

代码示例来源:origin: com.ebmwebsourcing.geasytools/model-manager

@Override
public void onBind(IWidgetProvider widgetProvider) {
    
Label lbl = new Label();
  
  lbl.getElement().setAttribute("style", "font-weight:bold;font-size:14px;");
  lbl.setText(getTitle());
  vp.add(lbl);
  
  ArrayList<LabelWidgetPair> allLabelWidgetPair     = new ArrayList<LabelWidgetPair>();
  allLabelWidgetPair.addAll(getPairs(widgetProvider));
  
  Grid grid = new Grid(allLabelWidgetPair.size(),2);
  
  for(int i=0;i<=allLabelWidgetPair.size()-1;i++){
    
    LabelWidgetPair lwp = allLabelWidgetPair.get(i);
    
      grid.setWidget(i, 0, new Label(lwp.getLabel()));
      grid.setWidget(i, 1, lwp.getWidget());
    
  }
  
  vp.add(grid);
}

代码示例来源:origin: OpenNMS/opennms

m_grid = new Grid(5, 3);
m_grid.setStyleName("topoHudDisplay");
m_grid.setWidget(0,0, m_providerLabel);
Label vertexLabel = new Label("Vertices");
m_grid.setWidget(0,1, vertexLabel);
Label edgeLabel = new Label("Edges");
m_grid.setWidget(0,2, edgeLabel);
Label focusLabel = new Label("Focus");
m_grid.setWidget(1, 0, focusLabel);
m_grid.setWidget(1, 1, m_vertexFocusLabel);
m_grid.setWidget(1, 2, m_edgeFocusLabel);
Label selectionLabel = new Label("Selection");
m_grid.setWidget(2, 0, selectionLabel);
m_grid.setWidget(2, 1, m_vertexSelectionLabel);
m_grid.setWidget(2, 2, m_edgeSelectionLabel);
Label contextLabel = new Label("Context");
m_grid.setWidget(3, 0, contextLabel);
m_grid.setWidget(3, 1, m_vertexContextLabel);
m_grid.setWidget(3, 2, m_edgeContextLabel);
Label totalLabel = new Label("Total");
m_grid.setWidget(4, 0, totalLabel);
m_grid.setWidget(4, 1, m_vertexTotalLabel);
m_grid.setWidget(4, 2, m_edgeTotalLabel);

代码示例来源:origin: org.jboss.errai/errai-widgets

private void initReset() {
 for (int i = 0; i < fieldNames.length; i++) {
  Label label = new Label(fieldNames[i]);
  label.setStyleName("soa-prop-grid-label");
  grid.setWidget(i, 0, label);
  grid.setWidget(i, 1, new HTML(""));
  String style = (i % 2 == 0) ? "soa-prop-grid-even" : "soa-prop-grid-odd";
  grid.getRowFormatter().setStyleName(i, style);
  grid.getColumnFormatter().setWidth(0, "20%");
  grid.getColumnFormatter().setWidth(1, "80%");
 }
}

代码示例来源:origin: org.jboss.errai/errai-widgets

public void update(String[] fieldValues) {
 if (fieldValues.length != fieldNames.length)
  throw new IllegalArgumentException("fieldValues.length doesn't match fieldName.length: " + fieldNames);
 for (int i = 0; i < fieldNames.length; i++) {
  Label label = new Label(fieldNames[i]);
  label.setStyleName("soa-prop-grid-label");
  grid.setWidget(i, 0, label);
  grid.setWidget(i, 1, new HTML(fieldValues[i]));
 }
}

代码示例来源:origin: com.ebmwebsourcing.geasytools/geasy-widgets

this.mainGrid = new Grid(3,3);
this.messageTypeImg.setStyleName("message-type");
this.titleLbl 		= new Label();
this.titleLbl.setStyleName("title");
this.mainGrid.getCellFormatter().getElement(0, 0).addClassName("notification-topleft");
this.mainGrid.getCellFormatter().getElement(0, 1).addClassName("notification-top");
this.mainGrid.getCellFormatter().getElement(0, 2).addClassName("notification-topright");
this.mainGrid.getCellFormatter().getElement(1, 0).addClassName("notification-left");
this.mainGrid.getCellFormatter().getElement(1, 2).addClassName("notification-right");
this.mainGrid.getCellFormatter().getElement(1, 1).addClassName("notification-content");
this.mainGrid.getCellFormatter().getElement(2, 2).addClassName("notification-bottomright");
this.mainGrid.getCellFormatter().getElement(2, 0).addClassName("notification-bottomleft");
this.mainGrid.getCellFormatter().getElement(2, 1).addClassName("notification-bottom");
this.mainGrid.setWidget(1, 1, contentLayout);

代码示例来源:origin: de.esoco/gewt

/***************************************
 * {@inheritDoc}
 */
@Override
public void addPage(Component rGroupComponent,
          String    sGroupTitle,
          boolean   bCloseable)
{
  Widget rTabContent = rGroupComponent.getWidget();
  sGroupTitle = rContext.expandResource(sGroupTitle);
  if (bCloseable)
  {
    Grid   aTabWidgets  = new Grid(1, 2);
    Button aCloseButton = new Button("x");
    aTabWidgets.setWidget(0, 0, new Label(sGroupTitle));
    aTabWidgets.setWidget(0, 1, aCloseButton);
    aCloseButton.addClickHandler(new TabCloseHandler(rTabContent));
    aTabPanel.add(rTabContent, aTabWidgets);
  }
  else
  {
    aTabPanel.add(rTabContent, sGroupTitle);
  }
  if (aTabPanel.getWidgetCount() == 1)
  {
    aTabPanel.selectTab(0);
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client

/**
 * @param rfl List<VeryfyRuleFired>
 * @param scenario = the scenario to add/remove from
 */
public VerifyRulesFiredWidget(final FixtureList rfl,
               final Scenario scenario,
               boolean showResults) {
  outer = new Grid( 2,
      1 );
  this.showResults = showResults;
  outer.getCellFormatter().setStyleName( 0,
      0,
      "modeller-fact-TypeHeader" ); //NON-NLS
  outer.getCellFormatter().setAlignment( 0,
      0,
      HasHorizontalAlignment.ALIGN_CENTER,
      HasVerticalAlignment.ALIGN_MIDDLE );
  outer.setStyleName( "modeller-fact-pattern-Widget" ); //NON-NLS
  outer.setWidget( 0,
      0,
      new SmallLabel( TestScenarioConstants.INSTANCE.ExpectRules() ) );
  initWidget( outer );
  FlexTable data = render( rfl,
      scenario );
  outer.setWidget( 1,
      0,
      data );
}

代码示例来源:origin: org.drools/drools-wb-guided-scorecard-editor-client

private Widget getRuleAttributesPanel() {
  ruleAttributesGrid = new Grid(2, 4);
  ruleAttributesGrid.setCellSpacing(5);
  ruleAttributesGrid.setCellPadding(5);
  ruleAttributesGrid.setText(0, 0, GuidedScoreCardConstants.INSTANCE.ruleFlowGroup());
  ruleAttributesGrid.setText(0, 1, GuidedScoreCardConstants.INSTANCE.agendaGroup());
  final String ruleFlowGroup = model.getRuleFlowGroup();
  final String agendaGroup = model.getAgendaGroup();
  tbRuleFlowGroup = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
  if (!(ruleFlowGroup == null || ruleFlowGroup.isEmpty())) {
    tbRuleFlowGroup.setText(ruleFlowGroup);
  }
  tbAgendaGroup = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
  if (!(agendaGroup == null || agendaGroup.isEmpty())) {
    tbAgendaGroup.setText(agendaGroup);
  }
  ruleAttributesGrid.setWidget(1, 0, tbRuleFlowGroup);
  ruleAttributesGrid.setWidget(1, 1, tbAgendaGroup);
  return ruleAttributesGrid;
}

代码示例来源:origin: de.esoco/gewt

aNextYearButton.addClickHandler(new MonthChangeClickHandler(12));
aMonthLabel.setStyleName("datePickerMonth");
aMonthLabel.addDoubleClickHandler(new DoubleClickHandler()
Grid aGrid = new Grid(1, 5);
aGrid.setStyleName(CSS.datePickerMonthSelector());
aGrid.setWidget(0, COL_PREV_YEAR, aPrevYearButton);
aGrid.setWidget(0, COL_PREV_MONTH, aPrevMonthButton);
aGrid.setWidget(0, COL_MONTH, aMonthLabel);
aGrid.setWidget(0, COL_NEXT_MONTH, aNextMonthButton);
aGrid.setWidget(0, COL_NEXT_YEAR, aNextYearButton);
CellFormatter rFormatter = aGrid.getCellFormatter();
  Grid aPanel = new Grid(2, 1);
  aPanel.setWidth("100%");
  aPanel.setWidget(0, 0, aTimePicker);
  aPanel.setWidget(1, 0, aGrid);
  aPanel.getCellFormatter()
     .addStyleName(0, 0, CSS.ewtTimePicker());
  aPanel.getCellFormatter()
     .setHorizontalAlignment(0,
                 0,

代码示例来源:origin: fjfd/microscope

/**
 * Builds the panel containing customizations for the axes of the graph.
 */
private Grid makeAxesPanel() {
  final Grid grid = new Grid(5, 3);
  grid.setText(0, 1, "Y");
  grid.setText(0, 2, "Y2");
  setTextAlignCenter(grid.getRowFormatter().getElement(0));
  grid.setText(1, 0, "Label");
  grid.setWidget(1, 1, ylabel);
  grid.setWidget(1, 2, y2label);
  grid.setText(2, 0, "Format");
  grid.setWidget(2, 1, yformat);
  grid.setWidget(2, 2, y2format);
  grid.setText(3, 0, "Range");
  grid.setWidget(3, 1, yrange);
  grid.setWidget(3, 2, y2range);
  grid.setText(4, 0, "Log scale");
  grid.setWidget(4, 1, ylog);
  grid.setWidget(4, 2, y2log);
  setTextAlignCenter(grid.getCellFormatter().getElement(4, 1));
  setTextAlignCenter(grid.getCellFormatter().getElement(4, 2));
  return grid;
}

代码示例来源:origin: stackoverflow.com

var myGrid = new Grid("#grid1");

$('#actionPopupButton').click(function(){

  myGrid.popup("ajax/test.html", function(data){
    // do instance-specific stuff here
  });

});

代码示例来源:origin: jbossas/console

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()));
  }
 });
}

代码示例来源:origin: org.kie.guvnor/guvnor-drl-text-editor-client

final Grid layout = new Grid( 1,
               2 );
layout.setWidget( 0,
         0,
         browser );
layout.setWidget( 0,
         1,
         ruleContentWidget );
layout.getColumnFormatter().setWidth( 0,
                   "10%" );
layout.getColumnFormatter().setWidth( 1,
                   "90%" );
layout.getCellFormatter().setAlignment( 0,
                    0,
                    HasHorizontalAlignment.ALIGN_LEFT,
                    HasVerticalAlignment.ALIGN_TOP );
layout.getCellFormatter().setAlignment( 0,
                    1,
                    HasHorizontalAlignment.ALIGN_LEFT,
                    HasVerticalAlignment.ALIGN_TOP );
layout.setWidth( "95%" );

代码示例来源:origin: com.extjs/gxt

days = new Grid(1, 7);
days.setStyleName("x-date-days");
days.setCellPadding(0);
days.setCellSpacing(0);
days.setBorderWidth(0);
days.setHTML(0, 0, "<span>" + dn[(0 + firstDOW) % 7] + "</span>");
days.setHTML(0, 1, "<span>" + dn[(1 + firstDOW) % 7] + "</span>");
days.setHTML(0, 2, "<span>" + dn[(2 + firstDOW) % 7] + "</span>");
days.setHTML(0, 3, "<span>" + dn[(3 + firstDOW) % 7] + "</span>");
days.setHTML(0, 4, "<span>" + dn[(4 + firstDOW) % 7] + "</span>");
days.setHTML(0, 5, "<span>" + dn[(5 + firstDOW) % 7] + "</span>");
days.setHTML(0, 6, "<span>" + dn[(6 + firstDOW) % 7] + "</span>");
days.getRowFormatter().getElement(0).setAttribute("role", "row");
 days.getCellFormatter().getElement(0, i).setAttribute("role", "columnheader");
 days.getCellFormatter().getElement(0, i).setAttribute("aria-label", longdn[i]);
grid = new Grid(6, 7);
grid.setStyleName("x-date-inner");
grid.setCellSpacing(0);
grid.setCellPadding(0);
grid.addClickHandler(new ClickHandler() {
for (int row = 0; row < 6; row++) {
 if (GXT.isAriaEnabled()) {
  grid.getRowFormatter().getElement(row).setAttribute("role", "row");

代码示例来源:origin: ltearno/hexa.tools

@Override
  public void setWidget( Widget widget )
  {
    table.setWidget( row, column, widget );
  }
}

代码示例来源:origin: fjfd/microscope

final Grid grid = new Grid(2, 9);
grid.setWidget(0, 0, newShiftDateButton(-3600, "1h"));
grid.setWidget(0, 1, newShiftDateButton(-600, "10m"));
grid.setWidget(0, 2, newShiftDateButton(-60, "1m"));
grid.setWidget(0, 3, new InlineHTML("&lsaquo;"));
grid.setWidget(0, 4, now);
grid.setWidget(0, 5, new InlineHTML("&rsaquo;"));
grid.setWidget(0, 6, newShiftDateButton(+60, "1m"));
grid.setWidget(0, 7, newShiftDateButton(+600, "10m"));
grid.setWidget(0, 8, newShiftDateButton(+3600, "1h"));
grid.setWidget(1, 0, newShiftDateButton(-86400 * 30, "30d"));
grid.setWidget(1, 1, newShiftDateButton(-86400 * 7, "1w"));
grid.setWidget(1, 2, newShiftDateButton(-86400, "1d"));
grid.setWidget(1, 3, new InlineHTML("&laquo;"));
grid.setWidget(1, 4, new InlineHTML("&nbsp;"));
grid.setWidget(1, 5, new InlineHTML("&raquo;"));
grid.setWidget(1, 6, newShiftDateButton(+86400, "1d"));
grid.setWidget(1, 7, newShiftDateButton(+86400 * 7, "1w"));
grid.setWidget(1, 8, newShiftDateButton(+86400 * 30, "30d"));
final CellFormatter formatter = grid.getCellFormatter();
formatter.setWidth(0, 4, "100%");
formatter.setWidth(1, 4, "100%");
hours_minutes = new Grid(4, 8);
setupAmUI();
hours_minutes.setWidget(0, 0, new InlineLabel("HH"));
final PushButton set_am = new PushButton("AM");
set_am.addClickHandler(new ClickHandler() {

相关文章