• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GridCellRenderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.extjs.gxt.ui.client.widget.grid.GridCellRenderer的典型用法代码示例。如果您正苦于以下问题:Java GridCellRenderer类的具体用法?Java GridCellRenderer怎么用?Java GridCellRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GridCellRenderer类属于com.extjs.gxt.ui.client.widget.grid包,在下文中一共展示了GridCellRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setRenderer

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
@Override
public void setRenderer(GridCellRenderer renderer) {
	this.specificRender = renderer;
	super.setRenderer(new GridCellRenderer<ModelData>() {

		public String render(ModelData model, String property,
				ColumnData config, int rowIndex, int colIndex,
				ListStore<ModelData> store) {
			String text = specificRender.render(model, property, config, rowIndex, colIndex, store);
			
			config.css = "x-grid3-popup-col-td";
			if (permissions.getCurrentState().equals(CMDBPermissions.PermissionState.READONLY)) {
				
				return "<div class='x-grid3-popup-col x-grid3-popup-" + getId() + "'>" +
				text +
				"</div>";
			} else {
				return(text);
			}
		}
		
	});
	
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:25,代码来源:PopupTextColumnConfig.java


示例2: init

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
protected void init() {
  setRenderer(new GridCellRenderer() {
    public String render(ModelData model, String property, ColumnData config, int rowIndex,
  		  int colIndex, ListStore store) {

  	  
  	  boolean v = getValue(model, property);
  	 
  	  String on = v ? "-on" : "";
  	  
  	  config.css = "x-grid3-check-col-td";
  	  if (readonly || !isModelEditable(model, property)) {
  	  		return "<div class='x-grid3-check-ro-col" + on + " x-grid3-cc-" +getId() + "'>&#160;</div>";
  	  } 
  	  		return "<div class='x-grid3-check-col" + on + " x-grid3-cc-" +getId() + "'>&#160;</div>";
  	  	
  	  }
  });
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:20,代码来源:MyCheckColumnConfig.java


示例3: init

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
protected void init() {
    setRenderer(new GridCellRenderer() {
      

	public String render(ModelData model, String property, ColumnData config, int rowIndex,
          int colIndex, ListStore store) {
    	  
    	String value = getStringValue(model, property);
	    
        config.css = "x-grid3-url-col-td";
        if (readonly) {
        	return "<div class='x-grid3-url-col x-grid3-url-" + getId() + "'>" +
        		"<a href='javascript:void()'>" + value + "</a>" +
        		"</div>";
        } else {
        	return(value);
        }
      }
    });
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:21,代码来源:URLColumnConfig.java


示例4: generatePossibleDuplicatesGrid

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private Grid<ContactDTO> generatePossibleDuplicatesGrid() {
  ColumnConfig nameColumn = new ColumnConfig(ContactDTO.FULLNAME, I18N.CONSTANTS.fullName(), 250);
  ColumnConfig emailColumn = new ColumnConfig(ContactDTO.EMAIL, I18N.CONSTANTS.email(), 250);
  ColumnConfig actionsColumn = new ColumnConfig();
  actionsColumn.setWidth(100);
  actionsColumn.setRenderer(new GridCellRenderer<ContactDTO>() {
    @Override
    public Object render(final ContactDTO contact, String property, ColumnData config, int rowIndex, int colIndex, ListStore store, Grid grid) {
      Button button = Forms.button(I18N.CONSTANTS.dedupeContactUpdateButton());
      button.addSelectionListener(new SelectionListener<ButtonEvent>() {
        @Override
        public void componentSelected(ButtonEvent ce) {
          cardLayout.setActiveItem(secondStepContainer);
          secondStepHandler.initialize(contact.getId(), duplicatedPropertiesGrid.getStore());
          selectedContact = contact;
        }
      });

      return button;
    }
  });

  ColumnModel columnModel = new ColumnModel(Arrays.asList(nameColumn, emailColumn, actionsColumn));
  return new Grid<ContactDTO>(new ListStore<ContactDTO>(), columnModel);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:26,代码来源:DedupeContactDialog.java


示例5: getGridCellRenderer

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private GridCellRenderer<ModelData> getGridCellRenderer(){
	
	GridCellRenderer<ModelData> r = new GridCellRenderer<ModelData>(){
		@Override	public Object render(ModelData model, String property,ColumnData config, int rowIndex, int colIndex,
				ListStore<ModelData> store, Grid<ModelData> grid) {
			if(model.get(property).toString().equals("true")){
				config.style = "background-image: url("+ GWT.getHostPageBaseURL().toString() + "resources/icons/add.gif) !important; background-repeat: no-repeat;";
			}else{
				config.style = "background-color: white;";
			}
			return "";
		}
	};
	
	return r;
	
	
}
 
开发者ID:treblereel,项目名称:Opensheet,代码行数:19,代码来源:PermissionFormGrid.java


示例6: init

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
protected void init() {
	setEditor(getCIEditor());
	setRenderer(new GridCellRenderer() {
		public String render(ModelData model, String property, ColumnData cfg, int rowIndex,
				int colIndex, ListStore store) {

			String text = "";
			if (model instanceof CIModel) {
				text = ((CIModel)model).getNameAndIcon();
			} else if (model instanceof AttributeModel) {
				Object o = model.get(property);
				if (o == null) {
					return("");
				}
				if (o instanceof String) {
					return((String)o);
				}
				if (o instanceof Boolean) {
					return(o.toString());
				}
				if (o instanceof CIModel) {
					CIModel m = (CIModel)o;
					text = m.getAlias();
					if (text == null) {
						text = m.getDisplayName();
					}
					String url = m.get(CIModel.CI_ICON_PATH);
					if (url != null) {
						url = CMDBSession.get().getContentRepositoryURL() + "/" + url;
						text = "<a style='background-image:url(" + url + ");background-repeat: no-repeat; background-position: left center; font-size:16px;'>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</a>" + text;
					}
				}
			} else {
				Object value = model.get(property);
				text = EditorFactory.renderObject(value);
			}
			return(text);
		}
	});
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:41,代码来源:CITemplateColumnConfig.java


示例7: createMappedColumn

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private ColumnConfig createMappedColumn() {
	ColumnConfig mapColumn = new ColumnConfig("x", "", 25);
       mapColumn.setRenderer(new GridCellRenderer<SiteDTO>() {
           @Override
           public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore listStore, Grid grid) {
               if(model.hasCoords()) {
                   return "<div class='mapped'>&nbsp;&nbsp;</div>";
               } else {
                   return "<div class='unmapped'>&nbsp;&nbsp;</div>";
               }
           }
       });
	return mapColumn;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:15,代码来源:SiteColumnModelBuilder.java


示例8: createMainSiteColumn

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private ColumnConfig createMainSiteColumn() {
      
       final ColumnConfig mainSiteColumn = new ColumnConfig("siteType", "", 25);
       mainSiteColumn.setRenderer(new GridCellRenderer<SiteDTO>() {

           @Override
           public Object render(SiteDTO model, String property, ColumnData config,
           		int rowIndex, int colIndex, ListStore listStore, Grid grid) {
           	
           	// Main site icon
               final Image icon;
                                            
               if (mainSiteId != null && mainSiteId.equals(model.getId())) {
               	//star
                   icon = IconImageBundle.ICONS.mainSite().createImage();
                   icon.setTitle("Main Site");
                   
                   icon.addStyleName("project-starred-icon");
               } else {
               	// Display no icon for simple sites
               	icon = null;
               }
               
               return icon;
           }
       });
       
       return mainSiteColumn;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:30,代码来源:SiteColumnModelBuilder.java


示例9: createIndicatorColumn

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
protected ColumnConfig createIndicatorColumn(IndicatorDTO indicator, String header) {

    	final NumberFormat format = IndicatorNumberFormats.getNumberFormat(indicator);
    	
        NumberField indicatorField = new NumberField();
       

        ColumnConfig indicatorColumn = new ColumnConfig(indicator.getPropertyName(),
                header, 50);

        indicatorColumn.setNumberFormat(format);
        indicatorColumn.setEditor(new CellEditor(indicatorField));
        indicatorColumn.setAlignment(Style.HorizontalAlignment.RIGHT);

        // For SUM indicators, don't show ZEROs in the Grid
        // (it looks better if we don't)
        if(indicator.getAggregation() == IndicatorDTO.AGGREGATE_SUM) {
            indicatorColumn.setRenderer(new GridCellRenderer() {
                @Override
                public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore listStore, Grid grid) {
                    Double value = model.get(property);
                    if(value != null && value != 0) {
                        return format.format(value);
                    } else {
                        return "";
                    }
                }
            });
        }

        return indicatorColumn;
    }
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:33,代码来源:SiteColumnModelBuilder.java


示例10: buildImportationSchemeModelsGrid

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private Grid<ImportationSchemeModelDTO> buildImportationSchemeModelsGrid() {

		final ColumnConfig importationSchemeColumn = new ColumnConfig("importationScheme", I18N.CONSTANTS.adminImportationScheme(), 250);

		importationSchemeColumn.setRenderer(new GridCellRenderer<ImportationSchemeModelDTO>() {

			@Override
			public Object render(final ImportationSchemeModelDTO model, String property, ColumnData config, int rowIndex, int colIndex,
					ListStore<ImportationSchemeModelDTO> store, Grid<ImportationSchemeModelDTO> grid) {

				final Anchor anchor = new Anchor(model.getImportationSchemeDTO().getName());
				anchor.addClickHandler(new ClickHandler() {

					@Override
					public void onClick(ClickEvent event) {
						importationSchemeModelsAdminPresenterHandler.onClick(model);
					}
				});
				
				final SimplePanel panel = new SimplePanel();
				panel.addStyleName("project-grid-code");
				panel.setWidget(anchor);

				return panel;
			}

		});

		final ColumnModel columnModel = new ColumnModel(Collections.singletonList(importationSchemeColumn));

		final Grid<ImportationSchemeModelDTO> importationSchemeModelGrid = new Grid<ImportationSchemeModelDTO>(new ListStore<ImportationSchemeModelDTO>(), columnModel);
		importationSchemeModelGrid.getView().setForceFit(true);
		importationSchemeModelGrid.setAutoHeight(true);
		importationSchemeModelGrid.getSelectionModel().setSelectionMode(Style.SelectionMode.SINGLE);
		return importationSchemeModelGrid;
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:37,代码来源:ImportationSchemeModelsAdminView.java


示例11: getColumnModel

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
private ColumnConfig[] getColumnModel() {
  final ColumnConfig typeColumn = new ColumnConfig(ContactDTO.TYPE, I18N.CONSTANTS.contactTypeLabel(), 75);
  typeColumn.setRenderer(new GridCellRenderer<ContactDTO>() {

    @Override
    public Object render(final ContactDTO model, final String property, final ColumnData config, final int rowIndex, final int colIndex,
                         final ListStore<ContactDTO> store, final Grid<ContactDTO> grid) {

      ContactModelType type = model.get(property);

      String typeLabel = I18N.CONSTANTS.contactTypeIndividualLabel();

      if (type == ContactModelType.ORGANIZATION) {
        typeLabel = I18N.CONSTANTS.contactTypeOrganizationLabel();
      }

      return typeLabel;
    }
  });

  ColumnConfig nameColumn = new ColumnConfig(ContactDTO.NAME, I18N.CONSTANTS.contactName(), 100);

  ColumnConfig firstNameColumn = new ColumnConfig(ContactDTO.FIRSTNAME, I18N.CONSTANTS.contactFirstName(), 75);

  ColumnConfig emailColumn = new ColumnConfig(ContactDTO.EMAIL, I18N.CONSTANTS.contactEmailAddress(), 150);

  ColumnConfig idColumn = new ColumnConfig(ContactDTO.ID, I18N.CONSTANTS.contactId(), 100);
  idColumn.setHidden(true);

  return new ColumnConfig[]{
          typeColumn,
          nameColumn,
          firstNameColumn,
          emailColumn,
          idColumn
  };
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:38,代码来源:ContactPicker.java


示例12: init

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
protected void init() {
	setEditor(getMultiEditor());
	setRenderer(new GridCellRenderer() {


		public String render(ModelData model, String property, ColumnData config, int rowIndex,
				int colIndex, ListStore store) {

			if (model instanceof CIModelCollection) {
				String split[] = property.split("\\.");
				String name = split[0];
				
				String text = "";
				CIModel ci = ((CIModelCollection)model).getCIModel(name);
				
				Object v = null;
				if (split.length > 1) {
					String attr = split[1];
					v = ci.get(attr);
				}
				 
				if (v != null) {
					if (v instanceof ValueListModel) {
						ValueListModel listModel = (ValueListModel)v;
						List<ValueModel> list = listModel.getValues();
						text = "[" + list.size() + "]";
						String sep = "";
						int count = 0;
						for (ValueModel val : list) {
							// Only add 5
							if (count > 4) {
								text = text + "...";
								break;
							}
							count++;
							text = text + sep + EditorFactory.renderValueModel(val);
							if (sep.length() == 0) {
								sep = ", ";
							}
						}
					}
				} else {
					text = "[0]";
				}
				
				config.css = "x-grid3-multi-col-td";
				return("<div class='x-grid3-multi-col x-grid3-multi-" + getId() + "'>" +
					text + 
					"</div>");
				
			}
			return("<Illgeal Value>");
		}
	});
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:56,代码来源:MultiColumnConfig.java


示例13: createLayersRenderer

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
     * Creates the workspaces layers combo box.
     *
     * @return the grid cell renderer
     */
    private GridCellRenderer<RuleModel> createLayersRenderer()
    {
        GridCellRenderer<RuleModel> comboRendered = new GridCellRenderer<RuleModel>()
            {

//                private boolean init;

                public Object render(final RuleModel model, String property, ColumnData config,
                    int rowIndex, int colIndex, ListStore<RuleModel> store, Grid<RuleModel> grid)
                {

//                    if (!init)
//                    {
//                        init = true;
//                        grid.addListener(Events.ColumnResize, new ResizeListener(10));
//                    }

                    // TODO: generalize this!
                    ComboBox<Layer> combo = new ComboBox<Layer>();
                    combo.setId("editRuleLayer");
                    combo.setName("editRuleLayer");

                    combo.setDisplayField(BeanKeyValue.LAYER.getValue());
                    combo.setStore(layers);
                    combo.setEditable(true);
                    combo.setTypeAhead(true);
                    combo.setTriggerAction(TriggerAction.ALL);
//                    workspaceLayersComboBox.setWidth(120);
                    combo.setWidth(COLUMN_LAYER_WIDTH - COLUMN_HEADER_OFFSET);
//                    combo.setAutoWidth(true);


                    if (model.getLayer() != null)
                    {
                        combo.setValue(new Layer(model.getLayer()));
                        combo.setSelection(Arrays.asList(new Layer(model.getLayer())));
                    }
                    combo.setEmptyText("(No layer available)");
                    combo.addListener(Events.Select, new Listener<FieldEvent>()
                        {

                            public void handleEvent(FieldEvent be)
                            {
                                final Layer layer = (Layer) be.getField().getValue();

                                model.setLayer(layer.getLayer());
                                Dispatcher.forwardEvent(GeofenceEvents.RULE_UPDATE_EDIT_GRID_COMBO, model);
                            }
                        });

                    return combo;
                }
            };

        return comboRendered;
    }
 
开发者ID:geoserver,项目名称:geofence,代码行数:62,代码来源:EditRuleWidget.java


示例14: createStyleTextBox

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Creates the style text box.
 * 
 * @return the grid cell renderer
 */
private GridCellRenderer<LayerStyle> createStyleTextBox() {

	GridCellRenderer<LayerStyle> textRendered = new GridCellRenderer<LayerStyle>() {

		private boolean init;

		public Object render(final LayerStyle model, String property,
				ColumnData config, int rowIndex, int colIndex,
				ListStore<LayerStyle> store, Grid<LayerStyle> grid) {

			if (!init) {
				init = true;
				grid.addListener(Events.ColumnResize,
						new Listener<GridEvent<LayerStyle>>() {

							public void handleEvent(GridEvent<LayerStyle> be) {
								for (int i = 0; i < be.getGrid().getStore()
										.getCount(); i++) {
									if ((be.getGrid().getView()
											.getWidget(i, be.getColIndex()) != null)
											&& (be.getGrid()
													.getView()
													.getWidget(
															i,
															be.getColIndex()) instanceof BoxComponent)) {
										((BoxComponent) be
												.getGrid()
												.getView()
												.getWidget(i,
														be.getColIndex()))
												.setWidth(be.getWidth() - 10);
									}
								}
							}
						});
			}

			LabelField styleName = new LabelField();
			styleName.setWidth(150);
			styleName.setReadOnly(true);
			styleName.setValue(model.getStyle());

			return styleName;
		}
	};

	return textRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:54,代码来源:RuleDetailsGridWidget.java


示例15: createNameTextBox

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Creates the name text box.
 *
 * @return the grid cell renderer
 */
private GridCellRenderer<LayerAttribUI> createNameTextBox()
{

    GridCellRenderer<LayerAttribUI> textRendered = new GridCellRenderer<LayerAttribUI>()
        {

            private boolean init;

            public Object render(final LayerAttribUI model, String property, ColumnData config,
                int rowIndex, int colIndex, ListStore<LayerAttribUI> store, Grid<LayerAttribUI> grid)
            {

                if (!init)
                {
                    init = true;
                    grid.addListener(Events.ColumnResize, new Listener<GridEvent<LayerAttribUI>>()
                        {

                            public void handleEvent(GridEvent<LayerAttribUI> be)
                            {
                                for (int i = 0; i < be.getGrid().getStore().getCount(); i++)
                                {
                                    if ((be.getGrid().getView().getWidget(i, be.getColIndex()) != null) &&
                                            (be.getGrid().getView().getWidget(i, be.getColIndex()) instanceof BoxComponent))
                                    {
                                        ((BoxComponent) be.getGrid().getView().getWidget(i,
                                                be.getColIndex())).setWidth(be.getWidth() - 10);
                                    }
                                }
                            }
                        });
                }

                LabelField attrName = new LabelField();
                attrName.setWidth(150);
                attrName.setReadOnly(true);
                attrName.setValue(model.getName());

                return attrName;
            }
        };

    return textRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:50,代码来源:LayerAttributesGridWidget.java


示例16: createTypeTextBox

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Creates the type text box.
 *
 * @return the grid cell renderer
 */
private GridCellRenderer<LayerAttribUI> createTypeTextBox()
{

    GridCellRenderer<LayerAttribUI> textRendered = new GridCellRenderer<LayerAttribUI>()
        {

            private boolean init;

            public Object render(final LayerAttribUI model, String property, ColumnData config,
                int rowIndex, int colIndex, ListStore<LayerAttribUI> store, Grid<LayerAttribUI> grid)
            {

                if (!init)
                {
                    init = true;
                    grid.addListener(Events.ColumnResize, new Listener<GridEvent<LayerAttribUI>>()
                        {

                            public void handleEvent(GridEvent<LayerAttribUI> be)
                            {
                                for (int i = 0; i < be.getGrid().getStore().getCount(); i++)
                                {
                                    if ((be.getGrid().getView().getWidget(i, be.getColIndex()) != null) &&
                                            (be.getGrid().getView().getWidget(i, be.getColIndex()) instanceof BoxComponent))
                                    {
                                        ((BoxComponent) be.getGrid().getView().getWidget(i,
                                                be.getColIndex())).setWidth(be.getWidth() - 10);
                                    }
                                }
                            }
                        });
                }

                LabelField attrType = new LabelField();
                attrType.setWidth(150);
                attrType.setReadOnly(true);
                attrType.setValue(model.getDataType());

                return attrType;
            }
        };

    return textRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:50,代码来源:LayerAttributesGridWidget.java


示例17: createProfileTextBox

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Creates the style text box.
 *
 * @return the grid cell renderer
 */
private GridCellRenderer<UserGroupModel> createProfileTextBox()
{

    GridCellRenderer<UserGroupModel> textRendered = new GridCellRenderer<UserGroupModel>()
        {

            private boolean init;

            public Object render(final UserGroupModel model, String property, ColumnData config,
                int rowIndex, int colIndex, ListStore<UserGroupModel> store, Grid<UserGroupModel> grid)
            {

                if (!init)
                {
                    init = true;
                    grid.addListener(Events.ColumnResize, new Listener<GridEvent<UserGroupModel>>()
                        {

                            public void handleEvent(GridEvent<UserGroupModel> be)
                            {
                                for (int i = 0; i < be.getGrid().getStore().getCount(); i++)
                                {
                                    if ((be.getGrid().getView().getWidget(i, be.getColIndex()) != null) &&
                                            (be.getGrid().getView().getWidget(i, be.getColIndex()) instanceof BoxComponent))
                                    {
                                        ((BoxComponent) be.getGrid().getView().getWidget(i,
                                                be.getColIndex())).setWidth(be.getWidth() - 10);
                                    }
                                }
                            }
                        });
                }

                LabelField profileName = new LabelField();
                profileName.setWidth(150);
                profileName.setReadOnly(true);
                profileName.setValue(model.getName());

                return profileName;
            }
        };

    return textRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:50,代码来源:ProfilesGridWidget.java


示例18: createGrantsCustomField

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Creates the grants custom field.
 * 
 * @return the grid cell renderer
 */
private GridCellRenderer<RuleModel> createGrantsCustomField() {
	GridCellRenderer<RuleModel> comboRendered = new GridCellRenderer<RuleModel>() {

		private boolean init;

		public Object render(final RuleModel model, String property,
				ColumnData config, int rowIndex, int colIndex,
				ListStore<RuleModel> store, Grid<RuleModel> grid) {

			if (!init) {
				init = true;
				grid.addListener(Events.ColumnResize,
						new Listener<GridEvent<RuleModel>>() {

							public void handleEvent(GridEvent<RuleModel> be) {
								for (int i = 0; i < be.getGrid().getStore()
										.getCount(); i++) {
									if ((be.getGrid().getView()
											.getWidget(i, be.getColIndex()) != null)
											&& (be.getGrid()
													.getView()
													.getWidget(
															i,
															be.getColIndex()) instanceof BoxComponent)) {
										((BoxComponent) be
												.getGrid()
												.getView()
												.getWidget(i,
														be.getColIndex()))
												.setWidth(be.getWidth() - 10);
									}
								}
							}
						});
			}

			// TODO: generalize this!
			LabelField field = new LabelField();
			field.setId("grantsCombo");
			field.setName("grantsCombo");

			field.setFieldLabel(BeanKeyValue.GRANT.getValue());
			field.setReadOnly(false);
			field.setWidth(COLUMN_GRANT_WIDTH - 10);

			if (model.getGrant() != null) {
				field.setValue(model.getGrant());
			} else {
				field.setValue("ALLOW");
			}

			field.setEmptyText("(No grant available)");

			return field;
		}

	};

	return comboRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:66,代码来源:RuleGridWidget.java


示例19: editRuleButton

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Edits the rule button.
 * 
 * @return the grid cell renderer
 */
private GridCellRenderer<RuleModel> editRuleButton() {
	buttonRendered = new GridCellRenderer<RuleModel>() {

		private boolean init;

		public Object render(final RuleModel model, String property,
				ColumnData config, int rowIndex, int colIndex,
				ListStore<RuleModel> store, final Grid<RuleModel> grid) {

			if (!init) {
				init = true;
				grid.addListener(Events.ColumnResize,
						new Listener<GridEvent<RuleModel>>() {

							public void handleEvent(GridEvent<RuleModel> be) {
								for (int i = 0; i < be.getGrid().getStore()
										.getCount(); i++) {
									if ((be.getGrid().getView()
											.getWidget(i, be.getColIndex()) != null)
											&& (be.getGrid()
													.getView()
													.getWidget(
															i,
															be.getColIndex()) instanceof BoxComponent)) {
										((BoxComponent) be
												.getGrid()
												.getView()
												.getWidget(i,
														be.getColIndex()))
												.setWidth(be.getWidth() - 10);
									}
								}
							}
						});
			}

			// TODO: generalize this!
			Button ruleDetailsButton = new Button("Edit rule");
			ruleDetailsButton.setIcon(Resources.ICONS.table());
			// TODO: add correct tooltip text here!
			ruleDetailsButton.setToolTip("Edit this rule");
			ruleDetailsButton.setEnabled(true);

			ruleDetailsButton.addListener(Events.OnClick,
					new Listener<ButtonEvent>() {

						public void handleEvent(ButtonEvent be) {
							Dispatcher.forwardEvent(
									GeofenceEvents.EDIT_RULE_UPDATE,
									new GridStatus(grid, model));
						}
					});

			return ruleDetailsButton;
		}

	};

	return buttonRendered;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:66,代码来源:RuleGridWidget.java


示例20: buildVariablesGrid

import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; //导入依赖的package包/类
/**
 * Variable Importation Scheme Grid
 * 
 * @return Grid<VariableDTO>
 */
private Grid<VariableDTO> buildVariablesGrid() {

	// Reference column.
	final ColumnConfig referenceColumn = new ColumnConfig("reference", I18N.CONSTANTS.importVariableReference(), 75);

	// Name column.
	final ColumnConfig nameColumn = new ColumnConfig("name", I18N.CONSTANTS.importVariableName(), 300);
	nameColumn.setRenderer(new GridCellRenderer<VariableDTO>() {

		@Override
		public Object render(final VariableDTO variable, String property, ColumnData config, int rowIndex, int colIndex, ListStore store, Grid grid) {
			final Anchor anchor = new Anchor(variable.getName());
			anchor.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event) {
					importationShemePresenterHandler.onVariableImportationSchemeEdit(variable);
				}
			});
			
			final SimplePanel panel = new SimplePanel();
			panel.addStyleName("project-grid-code");
			panel.setWidget(anchor);

			return panel;
		}
	});
	
	final List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
	configs.add(referenceColumn);
	configs.add(nameColumn);

	ColumnModel cm = new ColumnModel(configs);

	final Grid<VariableDTO> variablesDTOGrid = new Grid<VariableDTO>(new ListStore<VariableDTO>(), cm);
	variablesDTOGrid.getView().setForceFit(true);
	variablesDTOGrid.hide();
	return variablesDTOGrid;

}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:46,代码来源:ImportationSchemeAdminView.java



注:本文中的com.extjs.gxt.ui.client.widget.grid.GridCellRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSModelGroupDecl类代码示例发布时间:2022-05-23
下一篇:
Java Incubating类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap