本文整理了Java中com.extjs.gxt.ui.client.widget.grid.Grid.getColumnModel()
方法的一些代码示例,展示了Grid.getColumnModel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grid.getColumnModel()
方法的具体详情如下:
包路径:com.extjs.gxt.ui.client.widget.grid.Grid
类名称:Grid
方法名:getColumnModel
[英]Returns the column model.
[中]返回列模型。
代码示例来源:origin: com.extjs/gxt
protected boolean isSelectable(int row, int cell, boolean acceptsNav) {
if (acceptsNav) {
return !grid.getColumnModel().isHidden(cell) && grid.getColumnModel().isCellEditable(cell);
} else {
return !grid.getColumnModel().isHidden(cell);
}
}
代码示例来源:origin: com.extjs/gxt
@SuppressWarnings({"unchecked", "rawtypes"})
public void bind(Grid grid) {
this.grid = grid;
this.store = grid.getStore();
this.cm = grid.getColumnModel();
}
代码示例来源:origin: com.extjs/gxt
protected String getErrorText() {
StringBuffer sb = new StringBuffer();
sb.append("<ul>");
for (int i = 0; i < getItemCount(); i++) {
Field<?> f = (Field<?>) getItem(i);
if (!f.isValid(true)) {
sb.append("<li><b>");
sb.append(grid.getColumnModel().getColumn(i).getHeaderHtml());
sb.append("</b>: ");
sb.append(f.getErrorMessage());
sb.append("</li>");
}
}
sb.append("</ul>");
return sb.toString();
}
代码示例来源:origin: com.extjs/gxt
protected int getTargetColumnIndex(Point pt) {
for (int i = 0, j = 0; i < grid.getColumnModel().getColumnCount(); i++) {
ColumnConfig c = grid.getColumnModel().getColumn(i);
if (!c.isHidden()) {
if (El.fly(grid.getView().getHeaderCell(i)).getRegion().right >= pt.x) {
return j;
}
j++;
}
}
return -1;
}
代码示例来源:origin: com.extjs/gxt
private Head getHead(int index, boolean back) {
ColumnHeader header = grid.getView().getHeader();
int cols = grid.getColumnModel().getColumnCount();
if (!back) {
for (int i = index; i < cols; i++) {
ColumnConfig config = grid.getColumnModel().getColumn(i);
if (!config.isHidden() && !config.ariaIgnore) {
return header.getHead(i);
}
}
} else {
for (int i = index; i > -1; i--) {
ColumnConfig config = grid.getColumnModel().getColumn(i);
if (!config.isHidden() && !config.ariaIgnore) {
return header.getHead(i);
}
}
}
return null;
}
代码示例来源:origin: com.extjs/gxt
protected Filter getMenuFilter(MenuEvent me) {
MenuItem item = (MenuItem) me.getItem();
ColumnConfig config = grid.getColumnModel().getColumn((Integer) item.getData("index"));
return getFilter(config.getDataIndex());
}
代码示例来源:origin: com.extjs/gxt
protected void onReconfigure() {
bindStore(getStore());
bindColumnModel(grid.getColumnModel());
updateColumnHeadings();
if ((autoReload || local)) {
deferredUpdate.delay(updateBuffer);
}
}
代码示例来源:origin: com.extjs/gxt
protected void renderWidgets(int startRow, int endRow) {
if (grid.isViewReady()) {
if (endRow == -1) {
endRow = widgetList.size() - 1;
}
for (int i = startRow; i <= endRow; i++) {
List<Widget> m = i < widgetList.size() ? widgetList.get(i) : null;
if (m != null) {
for (int j = 0; j < grid.getColumnModel().getColumnCount(); j++) {
Widget w = j < m.size() ? m.get(j) : null;
if (w != null) {
Element cell = getWidgetCell(i, j);
if (cell != null) {
if (w.getElement().getParentElement() != cell) {
fly(cell).removeChildren();
cell.appendChild(w.getElement());
}
if (grid.isAttached()) {
ComponentHelper.doAttach(w);
}
}
}
}
}
}
}
}
代码示例来源:origin: com.extjs/gxt
@SuppressWarnings("unchecked")
public void init(Component component) {
assert component instanceof Grid<?> : "GridFilters can only be used with a Grid.";
this.grid = (Grid<ModelData>) component;
grid.addListener(Events.HeaderContextMenu, new Listener<GridEvent<?>>() {
public void handleEvent(GridEvent<?> be) {
onContextMenu(be);
}
});
grid.addListener(Events.Reconfigure, new Listener<GridEvent<?>>() {
public void handleEvent(GridEvent<?> be) {
onReconfigure();
}
});
bindStore(getStore());
bindColumnModel(grid.getColumnModel());
}
代码示例来源:origin: geoserver/geofence
public void handleEvent(GridEvent<RuleModel> be) {
Dispatcher.forwardEvent(GeofenceEvents.SEND_INFO_MESSAGE,
new String[]{"DEBUG","Resizing " + be.getGrid().getColumnModel().getColumnId(be.getColIndex())});
for (int i = 0; i < be.getGrid().getStore().getCount(); i++) { // there should be only 1 row
// let's force a resize on all the columns
for (int col = 0; col < be.getGrid().getColumnModel().getColumnCount(); col++) {
// final Widget widget = be.getGrid().getView().getWidget(i, be.getColIndex());
final Widget widget = be.getGrid().getView().getWidget(i, col);
// Dispatcher.forwardEvent(GeofenceEvents.SEND_INFO_MESSAGE,
// new String[]{"DEBUG","Resizing " + widget.getClass().getName() + "--" + widget.getTitle()});
int colWidth = be.getGrid().getColumnModel().getColumn(col).getWidth();
if ((widget != null) && (widget instanceof BoxComponent)) {
// ((BoxComponent) widget).setWidth(be.getWidth() - offset);
((BoxComponent) widget).setWidth(colWidth - offset);
}
}
}
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public void go(UserDatabaseDTO db) {
this.db = db;
store.removeAll();
actions = new DbUserEditorActions(this, dispatcher, loader, store, grid, db);
toolBar.setActionEnabled(UIActions.SAVE, false);
toolBar.setActionEnabled(UIActions.ADD, db.isManageUsersAllowed());
toolBar.setActionEnabled(UIActions.DELETE, false);
grid.getColumnModel().getColumnById(PermissionType.VIEW_ALL.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.CREATE_ALL.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.EDIT_ALL.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.DELETE_ALL.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.MANAGE_USERS.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.MANAGE_ALL_USERS.name()).setHidden(!db.isManageAllUsersAllowed());
grid.getColumnModel().getColumnById(PermissionType.DESIGN.name()).setHidden(!db.isDesignAllowed());
grid.getColumnModel().getColumnById(PermissionType.EXPORT_RECORDS.name()).setHidden(!db.isExportAllowed());
loader.load();
setModified(false);
}
代码示例来源:origin: com.extjs/gxt
public void updateColumnHeadings() {
int cols = grid.getColumnModel().getColumnCount();
for (int i = 0; i < cols; i++) {
ColumnConfig config = grid.getColumnModel().getColumn(i);
if (!config.isHidden()) {
ColumnHeader header = grid.getView().getHeader();
if (header != null) {
Head h = header.getHead(i);
if (h != null && h.isRendered()) {
Filter f = getFilter(config.getDataIndex());
if (f != null) {
h.el().setStyleName(filterStyle, f.isActive());
}
}
}
}
}
}
代码示例来源:origin: com.extjs/gxt
protected void doFocus(int colIndex) {
if (isVisible()) {
ColumnModel cm = this.grid.getColumnModel();
for (int i = colIndex, len = cm.getColumnCount(); i < len && i >= 0; i++) {
ColumnConfig c = cm.getColumn(i);
if (!c.isHidden() && c.getEditor() != null) {
c.getEditor().getField().focus();
break;
}
}
}
}
代码示例来源:origin: com.extjs/gxt
/**
* Initializes the view.
*
* @param grid the grid
*/
@SuppressWarnings({"unchecked", "rawtypes"})
protected void init(final Grid grid) {
this.grid = grid;
this.cm = grid.getColumnModel();
selectable = !grid.isDisableTextSelection();
initListeners();
initTemplates();
initData(grid.getStore(), cm);
initUI(grid);
newColumnHeader();
if (cm.getAggregationRows().size() > 0) {
footer = new ColumnFooter(grid, cm);
}
}
代码示例来源:origin: com.extjs/gxt
protected void onKeyLeft(GridEvent<M> ce) {
if (GXT.isFocusManagerEnabled() && selectedHeader != null) {
ColumnHeader ch = grid.getView().getHeader();
int idx = ch.indexOf(selectedHeader) - 1;
ColumnConfig config = grid.getColumnModel().getColumn(idx);
while (config != null) {
if (!config.isHidden()) {
Head h = getHead(idx, false);
selectedHeader = h;
grid.getView().getHeader().selectHeader(idx);
break;
} else {
idx--;
config = grid.getColumnModel().getColumn(idx);
}
}
}
if (GXT.isFocusManagerEnabled() && selectedGroup != null) {
groupingView.toggleGroup(selectedGroup, false);
}
}
代码示例来源:origin: com.extjs/gxt
protected void onKeyRight(GridEvent<M> ce) {
if (GXT.isFocusManagerEnabled() && selectedHeader != null) {
ColumnHeader ch = grid.getView().getHeader();
int idx = ch.indexOf(selectedHeader) + 1;
ColumnConfig config = grid.getColumnModel().getColumn(idx);
while (config != null) {
if (!config.isHidden()) {
Head h = getHead(idx, false);
selectedHeader = h;
grid.getView().getHeader().selectHeader(idx);
break;
} else {
idx++;
config = grid.getColumnModel().getColumn(idx);
}
}
}
if (GXT.isAriaEnabled() && selectedGroup != null) {
groupingView.toggleGroup(selectedGroup, true);
}
}
代码示例来源:origin: com.extjs/gxt
public void handleEvent(BaseEvent be) {
int columnIndex = grid.getColumnModel().getIndexById(RowNumberer.this.getId());
ColumnData columnData = grid.getView().getColumnData().get(columnIndex);
ListStore<ModelData> store = (ListStore<ModelData>) grid.getStore();
String property = RowNumberer.this.getDataIndex();
for (int i = 0; i < grid.getStore().getCount(); i++) {
Element cell = grid.getView().getCell(i, columnIndex);
if (cell != null) {
cell.getFirstChildElement().setInnerHTML(
RowNumberer.this.getRenderer().render((ModelData) grid.getStore().getAt(i), property, columnData, i,
columnIndex, store, (Grid<ModelData>) grid).toString());
}
}
}
});
代码示例来源:origin: com.extjs/gxt
protected void onHeaderClick(GridEvent<M> e) {
ColumnConfig c = grid.getColumnModel().getColumn(e.getColIndex());
if (c == config) {
El hd = e.getTargetEl().getParent();
boolean isChecked = hd.hasStyleName("x-grid3-hd-checker-on");
hd.dom.getFirstChildElement().setAttribute("aria-selected", isChecked ? "false" : "true");
if (isChecked) {
setChecked(false);
deselectAll();
} else {
setChecked(true);
selectAll();
}
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
protected void onMouseDown(GridEvent<ModelData> ge) {
El el = ge.getTargetEl();
if (el != null && el.hasStyleName("x-grid3-cc-" + getId()) &&
!el.hasStyleName("x-grid3-check-col-disabled")) {
ge.stopEvent();
UserPermissionDTO m = (UserPermissionDTO) ge.getModel();
PermissionType permission = PermissionType.valueOf(grid.getColumnModel().getColumnId(ge.getColIndex()));
Record r = store.getRecord(m);
Boolean b = m.get(getDataIndex());
if (validateChange(m, permission)) {
boolean newValue = b == null ? true : !b;
r.set(getDataIndex(), newValue);
onRowEdit(permission, newValue, r);
}
}
}
}
代码示例来源:origin: com.extjs/gxt
protected void verifyLayout(boolean force) {
if (initialized && (isVisible() || force)) {
Element row = (Element) grid.getView().getRow(rowIndex);
setSize(El.fly(row).getWidth(false), renderButtons ? btns.getHeight() : 0);
syncSize();
ColumnModel cm = grid.getColumnModel();
for (int i = 0, len = cm.getColumnCount(); i < len; i++) {
if (!cm.isHidden(i)) {
Field<?> f = (Field<?>) getItem(i);
f.show();
f.getElement().setAttribute("gxt-dindex", "" + cm.getDataIndex(i));
MarginData md = (MarginData) ComponentHelper.getLayoutData(f);
f.setWidth(cm.getColumnWidth(i) - md.getMargins().left - md.getMargins().right);
} else {
getItem(i).hide();
}
}
layout(true);
positionButtons();
}
}
内容来源于网络,如有侵权,请联系作者删除!