@UiHandler("flexTable") protected void onFlexTableClicked(ClickEvent event) { removeSelectedRowStyleFromTable(); Cell cell = flexTable.getCellForEvent(event); if (cell != null && totalCount != 0) { int row = cell.getRowIndex(); selectedIndex = row; flexTable.getRowFormatter().addStyleName(row, selectionStyle.rowHighlighted()); RadioButtonContainer radioButtonContainer = radioButtons.get(row); if (radioButtonContainer != null && radioButtonContainer.getRadioButton() != null) { clearRadioButtons(); radioButtonContainer.getRadioButton().setValue(true); selectedRowId = radioButtonContainer.getIdentifier(); if (listner != null) { listner.onRowSelected(selectedRowId); } } if (radioButtonContainer != null && radioButtonContainer.getRadioButton() == null && radioButtonContainer.getIdentifier() != null) { selectedRowId = radioButtonContainer.getIdentifier(); } } }
public GroupTable(String pointerId) { super(AdminConstants.I.groupItemHelp()); setSavePointerId(pointerId); table.setText(0, 1, AdminConstants.I.columnGroupName()); table.setText(0, 2, AdminConstants.I.columnGroupDescription()); table.setText(0, 3, AdminConstants.I.columnGroupVisibleToAll()); table.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final Cell cell = table.getCellForEvent(event); if (cell != null && cell.getCellIndex() != 1 && getRowItem(cell.getRowIndex()) != null) { movePointerTo(cell.getRowIndex()); } } }); final FlexCellFormatter fmt = table.getFlexCellFormatter(); for (int i = 1; i <= NUM_COLS; i++) { fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader()); } }
DocTable() { super(Util.C.docItemHelp()); table.setText(0, C_TITLE, Util.C.docTableColumnTitle()); FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(0, C_TITLE, Gerrit.RESOURCES.css().dataHeader()); table.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Cell cell = table.getCellForEvent(event); if (cell == null) { return; } if (getRowItem(cell.getRowIndex()) != null) { movePointerTo(cell.getRowIndex()); } } }); }
public ListTable() { initWidget( table ); setStylePrimaryName( Css.CSS.main() ); table.addClickHandler( new ClickHandler() { @Override public void onClick( ClickEvent event ) { Cell cell = table.getCellForEvent( event ); if( cell == null ) return; selected = rows.get( cell.getRowIndex() ); } } ); }
/** * 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); }
@UiHandler("files") public void fileTableClicked(ClickEvent clickEvent) { Cell cell = files.getCellForEvent(clickEvent); if (cell != null) { presenter.onRowClicked(cell.getRowIndex()); } }
/** {@inheritDoc} */ @Override public void onItemClickHandler(final ClickEvent event) { final Cell cell = getCellForEvent(event); LocationInfo location = m_locations.get(cell.getRowIndex() + (getCurrentPageIndex() * getTotalListItemsPerPage())); fireEvent(new LocationPanelSelectEvent(location.getName())); }
/** {@inheritDoc} */ @Override public void onItemClickHandler(final ClickEvent event) { final Cell cell = getCellForEvent(event); final ApplicationInfo appInfo = getApplications().get(cell.getRowIndex() + (getCurrentPageIndex() * getTotalListItemsPerPage())); m_eventBus.fireEvent(new ApplicationSelectedEvent(appInfo.getName())); }
@UiHandler("table") void onTableClicked(ClickEvent event) { // Select the row that was clicked (-1 to account for header row). Cell cell = table.getCellForEvent(event); if (cell != null) { int row = cell.getRowIndex(); selectRow(row); } }
public ChangeTable() { super(Util.C.changeItemHelp()); columns = BASE_COLUMNS; labelNames = Collections.emptyList(); showAssignee = Gerrit.info().change().showAssigneeInChangesTable(); showLegacyId = Gerrit.getUserPreferences().legacycidInChangeTable(); if (Gerrit.isSignedIn()) { keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); } sections = new ArrayList<>(); table.setText(0, C_STAR, ""); table.setText(0, C_ID, Util.C.changeTableColumnID()); table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); table.setText(0, C_STATUS, Util.C.changeTableColumnStatus()); table.setText(0, C_OWNER, Util.C.changeTableColumnOwner()); table.setText(0, C_ASSIGNEE, Util.C.changeTableColumnAssignee()); table.setText(0, C_PROJECT, Util.C.changeTableColumnProject()); table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch()); table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); table.setText(0, C_SIZE, Util.C.changeTableColumnSize()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(0, C_STAR, Gerrit.RESOURCES.css().iconHeader()); for (int i = C_ID; i < columns; i++) { fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader()); } if (!showLegacyId) { fmt.addStyleName(0, C_ID, Gerrit.RESOURCES.css().dataHeaderHidden()); } if (!showAssignee) { fmt.addStyleName(0, C_ASSIGNEE, Gerrit.RESOURCES.css().dataHeaderHidden()); } table.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final Cell cell = table.getCellForEvent(event); if (cell == null) { return; } if (cell.getCellIndex() == C_STAR) { // Don't do anything (handled by star itself). } else if (cell.getCellIndex() == C_STATUS) { // Don't do anything. } else if (cell.getCellIndex() == C_OWNER) { // Don't do anything. } else if (getRowItem(cell.getRowIndex()) != null) { movePointerTo(cell.getRowIndex()); } } }); }
/** * <p>getCellForEvent</p> * * @param event a {@link com.google.gwt.event.dom.client.ClickEvent} object. * @return a {@link com.google.gwt.user.client.ui.HTMLTable.Cell} object. */ protected Cell getCellForEvent(final ClickEvent event) { return getDataList().getCellForEvent(event); }