cellEditors[1] = new TextCellEditor(_tblItemTextValues.getTable());
_tblItemTextValues.getTableViewer().setCellEditors(cellEditors);
_tblItemTextValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
if (_itemTextValuesModel.getBeans().size() > 0) {
_chkItemList.setSelection(true);
model.setList(true);
}
handleAdd(_tblItemTextValues, "");
}
});
_tblItemTextValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemove(_tblItemTextValues);
}
});
// item subform - boolean values
_initialBooleanValuesSectionClient = toolkit.createComposite(_initialValuesSection);
_initialBooleanValuesSectionClient.setLayout(new FillLayout());
_tblItemBooleanValues = new EditableTableControl<PrimitiveTypeBean<Boolean>>(_initialBooleanValuesSectionClient, SWT.NONE);
_itemBooleanValuesModel = new PrimitiveTypeBeanListTableModel<Boolean>(true);
_itemBooleanValuesModel.addListener(new BeanListTableModelListener() {
public void update(Object bean) {
_model.fireModelChanged();
}
public void remove(Object bean) {
_model.fireModelChanged();
}
public void refresh(List beans) {
}
public void add(Object bean) {
_model.fireModelChanged();
}
});
_tblItemBooleanValues.init(new String[] {"#", "Value"}, _itemBooleanValuesModel);
cellEditors = new CellEditor[2];
cellEditors[0] = null;
cellEditors[1] = new CheckboxCellEditor(_tblItemBooleanValues.getTable());
_tblItemBooleanValues.getTableViewer().setCellEditors(cellEditors);
_tblItemBooleanValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
if (_itemBooleanValuesModel.getBeans().size() > 0) {
_chkItemList.setSelection(true);
model.setList(true);
}
handleAdd(_tblItemBooleanValues, false);
}
});
_tblItemBooleanValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemove(_tblItemBooleanValues);
}
});
// item subform - number values
_initialNumberValuesSectionClient = toolkit.createComposite(_initialValuesSection);
_initialNumberValuesSectionClient.setLayout(new FillLayout());
_tblItemNumberValues = new EditableTableControl<PrimitiveTypeBean<Number>>(_initialNumberValuesSectionClient, SWT.NONE);
_itemNumberValuesModel = new PrimitiveTypeBeanListTableModel<Number>(true);
_itemNumberValuesModel.addListener(new BeanListTableModelListener() {
public void update(Object bean) {
_model.fireModelChanged();
}
public void remove(Object bean) {
_model.fireModelChanged();
}
public void refresh(List beans) {
}
public void add(Object bean) {
_model.fireModelChanged();
}
});
_tblItemNumberValues.init(new String[] {"#", "Value"}, _itemNumberValuesModel);
cellEditors = new CellEditor[2];
cellEditors[0] = null;
cellEditors[1] = new DoubleValueCellEditor(_tblItemNumberValues.getTable());
_tblItemNumberValues.getTableViewer().setCellEditors(cellEditors);
_tblItemNumberValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
if (_itemNumberValuesModel.getBeans().size() > 0) {
_chkItemList.setSelection(true);
model.setList(true);
}
handleAdd(_tblItemNumberValues, 0);
}
});
_tblItemNumberValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemove(_tblItemNumberValues);
}
});
itemTypeCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
WGContentItemDefinition.Type type = model.getType().getKey();
if (type.equals(WGContentItemDefinition.Type.TEXT)) {
_initialValuesSection.setVisible(true);
_lblInitialValues.setVisible(true);
_itemTextValuesModel.bind(model.getInitialValues());
_initialTextValuesSectionClient.setVisible(true);
_initialBooleanValuesSectionClient.setVisible(false);
_initialNumberValuesSectionClient.setVisible(false);
_initialValuesSection.setClient(_initialTextValuesSectionClient);
_initialValuesSection.layout();
} else if (type.equals(WGContentItemDefinition.Type.BOOLEAN)) {
_initialValuesSection.setVisible(true);
_lblInitialValues.setVisible(true);
_itemBooleanValuesModel.bind(model.getInitialValues());
_initialBooleanValuesSectionClient.setVisible(true);
_initialTextValuesSectionClient.setVisible(false);
_initialNumberValuesSectionClient.setVisible(false);
_initialValuesSection.setClient(_initialBooleanValuesSectionClient);
_initialValuesSection.layout();
} else if (type.equals(WGContentItemDefinition.Type.NUMBER)) {
_initialValuesSection.setVisible(true);
_lblInitialValues.setVisible(true);
_itemNumberValuesModel.bind(model.getInitialValues());
_initialNumberValuesSectionClient.setVisible(true);
_initialBooleanValuesSectionClient.setVisible(false);
_initialTextValuesSectionClient.setVisible(false);
_initialValuesSection.setClient(_initialNumberValuesSectionClient);
_initialValuesSection.layout();
} else {
_initialValuesSection.setVisible(false);
_lblInitialValues.setVisible(false);
}
}
});
WGContentItemDefinitionModel contentItemDefinitionModel = new WGContentItemDefinitionModel(_model);
contentItemDefinitionModel.addListener(new BeanChangedListener<WGContentItemDefinition>() {
public void changed(WGContentItemDefinition bean) {
_treeViewer.refresh(bean, true);
_model.fireModelChanged();
}
});