protected KeyValueWidget getKeyValueWidget(final String keyName) { for (KeyValueWidget keyValueWidget : this._listKeyValue) { if (keyValueWidget.getKeyName().equals(keyName)) { return keyValueWidget; } } return null; }
protected void changeValueOfKey(KeyValueWidget item) { if (this._itemListener != null) { this._itemListener.changeItemValue( item.getKeyName(), item.getKeyValue(), item.isSelected(), item.isRegex(), item.isRemove()); } }
/** * Get datas from beans and apply to widget * * @param paramsLineRuleBean */ public void applyDatas(final ListKeyValueBean listKeyValueBean, boolean clearWidget) { if (clearWidget) { this._listKeyValue.clear(); this._main.clear(); } for (KeyValueBean keyValueBean : listKeyValueBean) { log.config("create widget"); final KeyValueWidget keyValueWidget = this.createKeyValue(keyValueBean.getKeyName(), true); keyValueWidget.applyDatas(keyValueBean); } }
// --------------------------------------------- privates methods protected KeyValueWidget createKeyValue(final String keyName, boolean informListener) { final KeyValueWidget item = new KeyValueWidget(keyName, this, this._showOption, this._withAnchor); this._listKeyValue.add(item); this._main.add(this.getWrapper(item)); if (informListener && this._itemListener != null) { this._itemListener.addItem(item.getKeyName()); } return item; }
// ------------------------------------- package methods public void removeAllKeyValueWidget() { final Iterator<KeyValueWidget> iter = this._listKeyValue.iterator(); while (iter.hasNext()) { final KeyValueWidget item = iter.next(); this._main.remove(this.getWrapper(item)); iter.remove(); if (this._itemListener != null) { this._itemListener.removeItem(item.getKeyName()); } } }
protected void removeKeyValueWidget(KeyValueWidget item, boolean informListener) { this._main.remove(this.getWrapper(item)); this._listKeyValue.remove(item); if (informListener && this._itemListener != null) { this._itemListener.removeItem(item.getKeyName()); } }
/** Get datas from widget and populate Beans */ public void populate( final IListKeyValuesBean paramKeyValuesBean, final Integer viewId, boolean clearList) { if (clearList) { paramKeyValuesBean.clearList(); } for (int i = 0; i < _listKeyValue.size(); i++) { final KeyValueWidget keyValueWidget = this._listKeyValue.get(i); final KeyValueBean keyValueBean = new KeyValueBean(keyValueWidget.getKeyName()); if (viewId != null) { keyValueBean.setViewId(viewId); } keyValueWidget.populate(keyValueBean); log.config("KeyValuePanel > add KeyValueBean : " + keyValueBean.getKeyValue()); paramKeyValuesBean.addKeyValue(keyValueBean); } }
public void addKeyValue() { final KeyValueWidget item = this.createKeyValue(null, true); item.setFocus(true); }