Refine search
var contacts = new ContactsModel(); var users = new UsersModel(); var view = new GridView({model: contacts, users: users})
Element rowEl = getRow(row); Element cellEl = null; if (!(!hscroll && col == 0)) { col++; cellEl = getCell(row, col); Element p = rowEl, stope = el.dom; while (p != null && p != stope) { ctop += p.getOffsetTop(); p = p.getOffsetParent().cast(); return cellEl != null ? fly(cellEl).getXY() : new Point(c.getScrollLeft(), fly(rowEl).getY());
protected void onRowSelect(int rowIndex) { Element row = getRow(rowIndex); if (row != null) { onRowOut(row); addRowStyle(row, "x-grid3-row-selected"); if (GXT.isAriaEnabled()) { row.setAttribute("aria-selected", "true"); grid.getElement().setAttribute("aria-activedescendant", row.getId()); } } }
switch (ge.getEventTypeInt()) { case Event.ONMOUSEMOVE: Element row = getRow(ge.getRowIndex()); if (overRow != null && row == null) { onRowOut(overRow); } else if (row != null && overRow != row) { if (overRow != null) { onRowOut(overRow); onRowOver(row); EventTarget from = ge.getEvent().getRelatedEventTarget(); if (from == null || (Element.is(from) && !DOM.isOrHasChild(grid.getElement(), (com.google.gwt.user.client.Element) Element.as(from)))) { Element r = getRow(ge.getRowIndex()); if (r != null) { onRowOver(r); EventTarget to = ge.getEvent().getRelatedEventTarget(); if (to == null || (Element.is(to) && !DOM.isOrHasChild(grid.getElement(), (com.google.gwt.user.client.Element) Element.as(to)))) { if (overRow != null) { onRowOut(overRow); onMouseDown(ge); break; case Event.ONSCROLL:
if (from == null || (Element.is(from) && !grid.getElement().isOrHasChild(Element.as(from)))) { cell = getCell(ge.getRowIndex(), ge.getColIndex()); if (cell != null) { case Event.ONMOUSEOUT: EventTarget to = ge.getEvent().getRelatedEventTarget(); if (to == null || (Element.is(to) && !grid.getElement().isOrHasChild(Element.as(to)))) { if (overCell != null) { onCellOut(overCell); case Event.ONMOUSEDOWN: case Event.ONSCROLL: super.handleComponentEvent(ge); break;
protected void handleInsert(DNDEvent event, final TreeNode item) { int height = treeGrid.getView().getRow(item.getModel()).getOffsetHeight(); int mid = height / 2; int top = treeGrid.getView().getRow(item.getModel()).getAbsoluteTop(); mid += top; int y = event.getClientY(); showInsert(event, (Element) treeGrid.getView().getRow(item.getModel()), true); } else { showInsert(event, (Element) treeGrid.getView().getRow(item.getModel()), false);
protected void onRowDeselect(int rowIndex) { Element row = getRow(rowIndex); if (row != null) { removeRowStyle(row, "x-grid3-row-selected"); removeRowStyle(row, "x-grid3-highlightrow"); if (GXT.isAriaEnabled()) { row.setAttribute("aria-selected", "false"); } } }
@Override protected void showFeedback(DNDEvent event) { event.getStatus().setStatus(true); if (feedback == Feedback.INSERT) { Element row = grid.getView().findRow(event.getTarget()).cast(); if (row == null && grid.getStore().getCount() > 0) { row = grid.getView().getRow(grid.getStore().getCount() - 1).cast(); } if (row != null) { int height = row.getOffsetHeight(); int mid = height / 2; mid += row.getAbsoluteTop(); int y = event.getClientY(); before = y < mid; int idx = grid.getView().findRowIndex(row); activeItem = grid.getStore().getAt(idx); insertIndex = adjustIndex(event, idx); showInsert(event, row); } else { insertIndex = 0; } } }
protected void onHighlightRow(int rowIndex, boolean highlight) { Element row = getRow(rowIndex); if (row != null) { if (highlight) { addRowStyle(row, "x-grid3-highlightrow"); if (GXT.isAriaEnabled()) { grid.setAriaState("aria-activedescendant", row.getId()); } } else { removeRowStyle(row, "x-grid3-highlightrow"); } } }
/** * Returns the grid's <TD> HtmlElement at the specified coordinates. * * @param row the row index in which to find the cell * @param col the column index of the cell * @return the <TD> at the specified coordinates */ public Element getCell(int row, int col) { // ROW DIV TABLE TR TD Element rowEl = getRow(row); return (Element) ((rowEl != null && rowEl.hasChildNodes()) ? rowEl.getFirstChild().getFirstChild().getFirstChild().getChildNodes().getItem(col) : null); }
@SuppressWarnings("unchecked") protected void refreshRow(int row) { if (grid != null && grid.isViewReady()) { ModelData m = ds.getAt(row); if (m != null) { // do not change focus on refresh // handles situation with changing cell value with field binding focusEnabled = false; insertRows(ds, row, row, true); getRow(row).setPropertyInt("rowIndex", row); onRemove(ds, m, row + 1, true); renderWidgets(row, row); GridEvent<ModelData> e = (GridEvent<ModelData>) createComponentEvent(null); e.setRowIndex(row); e.setModel(ds.getAt(row)); fireEvent(Events.RowUpdated, e); focusEnabled = true; } } }
stopEditing(); detachWidgets(0, -1, true); scrollToTop(); mainBody.setInnerHtml(renderRows(0, -1)); if (headerToo) { sortState = null; header.release(); newColumnHeader(); renderHeader(); if (grid.isAttached()) { ComponentHelper.doAttach(header); processRows(0, true); renderWidgets(0, -1); renderFooter(); if (grid.isAttached()) { ComponentHelper.doAttach(footer); calculateVBar(true); updateHeaderSortState(); applyEmptyText(); constrainFocusElement();
resize(); fitColumns(false, false, -1); header.updateTotalWidth(getOffsetWidth(), getTotalWidth()); if (footer != null) { footer.updateTotalWidth(getOffsetWidth(), getTotalWidth()); autoExpand(false); header.updateTotalWidth(getOffsetWidth(), getTotalWidth()); if (footer != null) { footer.updateTotalWidth(getOffsetWidth(), getTotalWidth()); syncHeaderScroll(); templateOnLayout(vw, vh);
public class SomeClass implements GridView.OnClickListener { public void SomeMethod() { GridView gv = new GridView(this); gv.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub } }
protected void insertRows(ListStore<ModelData> store, int firstRow, int lastRow, boolean isUpdate) { Element e = mainBody.dom.getFirstChildElement(); if (e != null && !hasRows()) { mainBody.dom.setInnerHTML(""); } String html = renderRows(firstRow, lastRow); Element before = getRow(firstRow); if (before != null) { DomHelper.insertBefore((com.google.gwt.user.client.Element) before, html); } else { DomHelper.insertHtml("beforeEnd", mainBody.dom, html); } if (!isUpdate) { processRows(firstRow, false); } }
protected void afterRender() { mainBody.setInnerHtml(renderRows(0, -1)); renderWidgets(0, -1); processRows(0, true); if (footer != null && grid.getLazyRowRender() > 0) { footer.refresh(); } int sh = scroller.getHeight(); int dh = mainBody.getHeight(); boolean vbar = dh < sh; if (vbar) { this.vbar = !vbar; lastViewWidth = -1; layout(); } applyEmptyText(); }
/** * Return the <TR> HtmlElement which represents a Grid row for the * specified model. * * @param m the model * @return the <TR> element */ public Element getRow(ModelData m) { return getRow(ds.indexOf(m)); }
GridView gridView = new GridView(this) { Parcelable state = savedInstanceState.getParcelable("state"); if (state != null) { gridView.onRestoreInstanceState(state); Log.d(this.getClass().getName(), "state restored!"); Parcelable state = gridView.onSaveInstanceState(); outState.putParcelable("state", state);
protected void onClear(StoreEvent<ModelData> se) { refresh(false); }
protected void onColumnMove(int newIndex) { boolean pScroll = preventScrollToTopOnRefresh; preventScrollToTopOnRefresh = true; refresh(true); preventScrollToTopOnRefresh = pScroll; templateAfterMove(newIndex); }