Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AfanemekGridView
- extends
- BaseGridViewWithPaging<AfanemekGridActivity, AfanemekDomainProxy, AfanemekDomainProxyProperties, AfanemekRequest> {
- public AfanemekGridView() {
- super();
- HashMap<String, Object> hashMap = new HashMap<String, Object>();
- hashMap.put(AbstractGridView.WITHCHECKCOLUMN, true);
- setOptions(hashMap);
- }
- @Override
- protected List<ColumnConfig<AfanemekDomainProxy, ?>> createColumns() {
- ColumnConfig<AfanemekDomainProxy, String> nevColumnConfig = new ColumnConfig<AfanemekDomainProxy, String>(
- properties.nev(), 50, "Név");
- ColumnConfig<AfanemekDomainProxy, BigDecimal> szazalekColumnConfig = new ColumnConfig<AfanemekDomainProxy, BigDecimal>(
- properties.szazalek(), 50, "Százalék");
- List<ColumnConfig<AfanemekDomainProxy, ?>> arrayList = new ArrayList<ColumnConfig<AfanemekDomainProxy, ?>>();
- arrayList.add(nevColumnConfig);
- arrayList.add(szazalekColumnConfig);
- return arrayList;
- }
- @Override
- protected ListStore<AfanemekDomainProxy> createNewListStore() {
- return new ListStore<AfanemekDomainProxy>(properties.id());
- }
- @Override
- protected boolean isChecked(AfanemekDomainProxy dp) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public void bind() {
- // TODO Auto-generated method stub
- }
- @Override
- protected void clickEditColumn(Object object) {
- presenter.clickEditColumn(object);
- }
- @Override
- protected void clickDeleteColumn(Object object) {
- presenter.clickDeleteColumn(object);
- }
- @Override
- protected VerticalLayoutContainer createGrid() {
- checkBoxSelectionModel = null;
- // create columns
- List<ColumnConfig<AfanemekDomainProxy, ?>> columns = createColumns();
- // ha kell checkboxcolumn akkor letrehozzuk
- if (options != null && options.containsKey(WITHCHECKCOLUMN)) {
- IdentityValueProvider<AfanemekDomainProxy> identityValueProvider = new IdentityValueProvider<AfanemekDomainProxy>(
- "szamlazoban_active");
- checkBoxSelectionModel = new CheckBoxSelectionModel<AfanemekDomainProxy>(identityValueProvider);
- columns.add(0, checkBoxSelectionModel.getColumn());
- }
- // extra columns
- createDeleteColumn(columns);
- createEditColumn(columns);
- ColumnModel<AfanemekDomainProxy> columnModel = new ColumnModel<AfanemekDomainProxy>(columns);
- final Grid<AfanemekDomainProxy> grid = new Grid<AfanemekDomainProxy>(listStore, columnModel) {
- @Override
- protected void onAfterFirstAttach() {
- super.onAfterFirstAttach();
- Scheduler.get().scheduleDeferred(new ScheduledCommand() {
- @Override
- public void execute() {
- handleAfterFirstAttachGrid();
- }
- });
- }
- };
- grid.getView().setForceFit(true);
- grid.getView().setAutoFill(true);
- grid.setLoadMask(true);
- grid.getView().setStripeRows(true);
- grid.setColumnReordering(true);
- grid.setColumnResize(true);
- if (checkBoxSelectionModel != null) {
- grid.setSelectionModel(checkBoxSelectionModel);
- }
- grid.addAttachHandler(new Handler() {
- @Override
- public void onAttachOrDetach(AttachEvent event) {
- // erre azert van szukseg mert mert ha mar egyszer megjelenitettuk akkor masodszorra
- // amikor csatoljuk a felulethez akkor azt csak igy tudjuk erzekelni
- if (event.isAttached() == true) {
- if (firstAttach == true) {
- firstAttach = false;
- } else {
- handleAttachGrid();
- }
- }
- }
- });
- VerticalLayoutContainer verticalLayoutContainer = new VerticalLayoutContainer();
- ToolBar createTopToolBar = createTopToolBar();
- createTopToolBar.setEnableOverflow(true);
- if (createTopToolBar != null) {
- verticalLayoutContainer.add(createTopToolBar, new VerticalLayoutData(1, -1));
- }
- verticalLayoutContainer.add(grid, new VerticalLayoutData(1, -1));
- verticalLayoutContainer.setScrollMode(ScrollMode.AUTO);
- verticalLayoutContainer.add(pagingToolBar, new VerticalLayoutData(1, -1));
- return verticalLayoutContainer;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement