public void init() { trustActionCache = TrustActionCache.getInstance(constants, messages); posttypeCache = PosttypeCache.getInstance(constants, messages); idHolder.init(); while (table.getRowCount() > 1) { table.removeRow(1); } int row = 1; for (JSONObject object : trustActionCache.getAll()) { addRow(object, row); row++; } helpPanel.resize(this); }
private void addRow(JSONObject object, int row) { String desc = Util.str(object.get("description")); String id = Util.str(object.get("id")); String trust = Util.str(object.get("fond")); String defaultdesc = Util.str(object.get("defaultdesc")); String actionclub = Util.str(object.get("actionclub")); String actiontrust = Util.str(object.get("actionfond")); String debetpost = Util.strSkipNull(object.get("debetpost")); String creditpost = Util.strSkipNull(object.get("creditpost")); table.setText(row, 0, trustActionCache.trustGivesDesc(trust)); table.setText(row, 1, desc); table.setText(row, 2, defaultdesc); table.setText(row, 3, Util.debkred(elements, actionclub)); table.setText(row, 4, Util.debkred(elements, actiontrust)); if (!("".equals(debetpost))) { table.setText(row, 5, posttypeCache.getDescriptionWithType(debetpost)); } if (!("".equals(creditpost))) { table.setText(row, 6, posttypeCache.getDescriptionWithType(creditpost)); } table.getCellFormatter().setStyleName(row, 0, "desc"); table.getCellFormatter().setStyleName(row, 1, "desc"); table.getCellFormatter().setStyleName(row, 2, "desc"); table.getCellFormatter().setStyleName(row, 5, "desc"); table.getCellFormatter().setStyleName(row, 6, "desc"); Image editImage = ImageFactory.editImage("projectEditView_editImage"); editImage.addClickHandler(me); idHolder.add(id, editImage); table.setWidget(row, 7, editImage); String style = (((row + 1) % 6) < 3) ? "line2" : "line1"; table.getRowFormatter().setStyleName(row, style); }
@Override public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (editFields == null) { editFields = new TrustActionEditFields(); } int left = 0; if (sender == newButton) { left = sender.getAbsoluteLeft() + 10; } else { left = sender.getAbsoluteLeft() - 250; } int top = sender.getAbsoluteTop() + 10; editFields.setPopupPosition(left, top); if (sender == newButton) { editFields.init(); } else { editFields.init(idHolder.findId(sender)); } editFields.show(); }