@Override public void onSelectionChanged(SelectionEvent event) { ListGridRecord[] records = event.getSelection(); for (ListGridRecord record : records) { if (record != null) { listGrid.expandRecord(record); } } } });
/** * Fires a open event on all registered handlers in the handler manager.If no * such handlers exist, this method will do nothing. * * @param <S> The event source * @param source the source of the handlers * @param jsObj the native event */ public static <S extends HasSelectionChangedHandlers & HasHandlers> void fire( S source, JavaScriptObject jsObj) { if (TYPE != null) { SelectionEvent event = new SelectionEvent(jsObj); source.fireEvent(event); } }
@Override public void onSelectionChanged(SelectionEvent selectionEvent) { String geodeskId = getGeodeskIdOfSelectionEvent(selectionEvent); boolean selected = selectionEvent.getState(); // Only react on selection, not deselection. // Smartgwt always seems to throw both selection and deselection event for SAME record! if (selected && !sameGeodesk(selectedGeodeskId, geodeskId)) { selectedGeodeskId = geodeskId; Whiteboard.fireSelectionChangeEvent(new GeodeskSelectionEvent(getGeodeskDto(geodeskId))); //} else if (geodeskId != null && geodeskId.equals(selectedGeodeskId)) { // current geodesk deselected // selectedGeodeskId = null; // Whiteboard.fireSelectionChangeEvent(new GeodeskSelectionEvent(null)); } }
/** * Return the first selected record in this component.<br><br> This method is appropriate if <code>{@link * com.smartgwt.client.widgets.grid.ListGrid#getSelectionType selectionType}</code> is <code>"single"</code>, or if you * only care about the first selected record in a multiple-record selection. To access all selected records, use * <code>{@link com.smartgwt.client.widgets.grid.ListGrid#getSelection ListGrid.getSelection}</code> instead. * * @return first selected record, or null if nothing selected */ public ListGridRecord getSelectedRecord() { return ((ListGrid) getSource()).getSelectedRecord(); }
/** * Add a selectionChanged handler. * <p> * Called when (row-based) selection changes within this grid. Note this method fires for each record for which selection * is modified - so when a user clicks inside a grid this method will typically fire twice (once for the old record being * deselected, and once for the new record being selected). <P> NOTE: For updating other components based on selections or * triggering selection-oriented events within an application, see the {@link * com.smartgwt.client.widgets.DataBoundComponent#selectionUpdated selectionUpdated} event which is likely more suitable. * * @param handler the selectionChanged handler * @return {@link HandlerRegistration} used to remove this handler */ public HandlerRegistration addSelectionChangedHandler(com.smartgwt.client.widgets.grid.events.SelectionChangedHandler handler) { if(getHandlerCount(com.smartgwt.client.widgets.grid.events.SelectionEvent.getType()) == 0) setupSelectionChangedEvent(); return doAddHandler(handler, com.smartgwt.client.widgets.grid.events.SelectionEvent.getType()); }
private String getGeodeskIdOfSelectionEvent(SelectionEvent selectionEvent) { ListGridRecord record = selectionEvent.getRecord(); if (record != null && record.getAttributeAsString(FLD_ID) != null && record.getAttributeAsString(FLD_ID).length() != 0) { return record.getAttributeAsString(GeodeskGrid.FLD_ID); } return null; }
/** * The selection associated with the listGrid. Alias for {@link #getRecord()} * * @return the selection */ public ListGridRecord[] getSelection() { return ((ListGrid) getSource()).getSelection(); }
@Override public void onSelectionChanged(SelectionEvent event) { if (event.getState()) { // true == selected ListGridRecord record = (ListGridRecord) event.getRecord(); if (record != null && record.getAttributeAsObject(FLD_OBJECT) != null) { handler.onSelect((UserDto) record.getAttributeAsObject(FLD_OBJECT)); } else { handler.onSelect(null); } } } });
public void onSelectionChanged(SelectionEvent event) { int count = event.getSelection().length; if (count == 0) { focusButton.setDisabled(true); showButton.setDisabled(true); } else if (count == 1) { focusButton.setDisabled(false); showButton.setDisabled(false); } else { focusButton.setDisabled(false); showButton.setDisabled(true); } for (ToolStripButton button : extraButtons) { button.setDisabled(count == 0); } }
@Override public void onSelectionChanged(SelectionEvent event) { if (event.getState()) { // true == selected ListGridRecord record = (ListGridRecord) event.getRecord(); if (record != null && record.getAttributeAsObject(FLD_OBJECT) != null) { handler.onSelect((TerritoryDto) record.getAttributeAsObject(FLD_OBJECT)); } else { handler.onSelect(null); } } } });
public void onSelectionChanged(SelectionEvent event) { setDisabled(true); if (event.getState()) { // true == selected ListGridRecord record = (ListGridRecord) event.getRecord(); if (record != null && record.getAttributeAsString(ID_ATTRIBUTE) != null && record.getAttributeAsString(ID_ATTRIBUTE).length() != 0) { loadRecord(record.getAttributeAsString(BlueprintGrid.FLD_ID)); } else { setBlueprint(null); } } }
public void onSelectionChanged(SelectionEvent event) { setDisabled(true); if (event.getState()) { // true == selected ListGridRecord record = (ListGridRecord) event.getRecord(); if (record != null && record.getAttributeAsLong(UserGrid.FLD_ID) != null) { loadUser(record.getAttributeAsLong(BlueprintGrid.FLD_ID)); } else { setObject(null); } } }
public void onSelectionChanged(SelectionEvent event) { setDisabled(true); if (event.getState()) { // true == selected ListGridRecord record = (ListGridRecord) event.getRecord(); if (record != null && record.getAttributeAsString(ID_ATTRIBUTE) != null && record.getAttributeAsString(ID_ATTRIBUTE).length() != 0) { loadRecord(record.getAttributeAsString(DatalayerGrid.FLD_ID)); } else { setLayerModel(null); } } }