Commit c8065ae7 authored by Simon Barner's avatar Simon Barner
Browse files

GREEN

refs 795
parent 5f042221
......@@ -17,11 +17,17 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.refinement.ui.editor;
import static org.eclipse.jface.databinding.swt.SWTObservables.observeSelection;
import static org.eclipse.jface.databinding.swt.SWTObservables.observeVisible;
import static org.eclipse.jface.layout.GridDataFactory.fillDefaults;
import static org.eclipse.jface.layout.GridDataFactory.swtDefaults;
import static org.eclipse.ui.forms.widgets.ExpandableComposite.NO_TITLE;
import static org.fortiss.af3.refinement.model.RefinementPackage.Literals.REFINEMENT_PORT_PROFILE__USE_RANDOM_VALUE;
import static org.fortiss.af3.refinement.ui.utils.RefinementUtils.openComponentDialog;
import static org.fortiss.af3.testing.ui.method.random.editor.DataProfileViewer.createProfileControl;
import static org.fortiss.tooling.base.ui.utils.TableViewerUtils.createWeightedColumn;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
......@@ -35,7 +41,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.InputPort;
......@@ -44,28 +49,26 @@ import org.fortiss.af3.refinement.model.MSCRefinement;
import org.fortiss.af3.refinement.model.RefinementSpecification;
import org.fortiss.af3.refinement.ui.action.GenerateRefinedTestSuiteAction;
import org.fortiss.af3.refinement.ui.action.LayoutFunctionComponentsAction;
import org.fortiss.af3.testing.ui.method.random.editor.DataProfileViewer;
import org.fortiss.tooling.base.ui.contentprovider.TableContentProviderBase;
import org.fortiss.tooling.base.ui.editor.FormsEditorBase;
import org.fortiss.tooling.kernel.ui.util.ObservableUtils;
/**
* Editor to edit a {@link RefinementSpecification}
* Editor to edit a {@link RefinementSpecification}.
*
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: E5325A18741D23174679EBE7B135B734
* @ConQAT.Rating GREEN Hash: EFD4398853418DB61DD307C8BC00DFBD
*/
public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpecification> {
/** single line label grid data factory */
private static GridDataFactory singleLineLabelFactory = GridDataFactory.swtDefaults()
.align(SWT.RIGHT, SWT.CENTER).grab(false, false);
/** Single line label grid data factory. */
private static GridDataFactory singleLineLabelFactory = swtDefaults().align(SWT.RIGHT,
SWT.CENTER).grab(false, false);
/** single line input grid data factory */
private static GridDataFactory singleLineInputFactory = GridDataFactory.swtDefaults()
.align(SWT.FILL, SWT.CENTER).grab(true, false);
/** Single line input grid data factory. */
private static GridDataFactory singleLineInputFactory = swtDefaults().align(SWT.FILL,
SWT.CENTER).grab(true, false);
/** The table viewer. */
private TableViewer mscsTableViewer;
......@@ -95,14 +98,15 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
toolkit.createLabel(refinedComponentComposite, "Refined Component: ");
singleLineLabelFactory.applyTo(refinedComponentLabel);
// text field showing the name of the refined component
// Text field showing the name of the refined component
final Text refinedComponentText =
toolkit.createText(refinedComponentComposite, "", SWT.READ_ONLY);
singleLineInputFactory.applyTo(refinedComponentText);
if(editedObject.getRefinedComponent() != null)
if(editedObject.getRefinedComponent() != null) {
refinedComponentText.setText(editedObject.getRefinedComponent().getName());
}
// button to select the refined component
// Button to select the refined component
Button chooseButton = toolkit.createButton(refinedComponentComposite, "Choose", SWT.FLAT);
chooseButton.addSelectionListener(new SelectionAdapter() {
......@@ -122,7 +126,7 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
});
}
/** Set up section to set the input port settings */
/** Set up section to set the input port settings. */
private void createInputPortSettingsSection() {
final Composite inputPortSettingsComposite = createNewSection("Input port settings", "");
inputPortSettingsComposite.setLayout(new GridLayout(2, false));
......@@ -138,27 +142,27 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
final Button randomValueCheckBox =
toolkit.createButton(inputPortSettingsComposite, "Use random value", SWT.CHECK);
dbc.bindValue(SWTObservables.observeSelection(randomValueCheckBox), ObservableUtils
.observeValue(editedObject.getPortProfileMap().get(inputPort),
dbc.bindValue(
observeSelection(randomValueCheckBox),
observeValue(editedObject.getPortProfileMap().get(inputPort),
REFINEMENT_PORT_PROFILE__USE_RANDOM_VALUE));
// Composite that has the controls for the probability distribution
// etc.
// Composite that has the controls for the probability distribution, etc.
final Composite profileControlsComposite =
toolkit.createComposite(inputPortSettingsComposite);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1)
.applyTo(profileControlsComposite);
fillDefaults().grab(true, false).span(2, 1).applyTo(profileControlsComposite);
DataProfileViewer.createProfileControl(profileControlsComposite, toolkit, dbc,
editedObject.getPortProfileMap().get(inputPort).getDataProfile(),
inputPort.getName(), ExpandableComposite.NO_TITLE);
createProfileControl(profileControlsComposite, toolkit, dbc, editedObject
.getPortProfileMap().get(inputPort).getDataProfile(), inputPort.getName(),
NO_TITLE);
// for a proper presentation we have to set both, the visible flag
// For a proper presentation we have to set both, the visible flag
// and the GridData exclude flag to control if the the
// profileControlsComposite is visible/hidden
dbc.bindValue(SWTObservables.observeVisible(profileControlsComposite),
SWTObservables.observeSelection(randomValueCheckBox));
dbc.bindValue(observeVisible(profileControlsComposite),
observeSelection(randomValueCheckBox));
randomValueCheckBox.addSelectionListener(new SelectionAdapter() {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
((GridData)profileControlsComposite.getLayoutData()).exclude =
......@@ -178,16 +182,17 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
@Override
protected void createColumns(final TableViewer viewer) {
createWeightedColumn(viewer, 50, "MSC", "The refined MSC.", new ColumnLabelProvider() {
/** {@inheritDoc} */
@Override
public String getText(Object element) {
return ((MSCRefinement)element).getRefinedMSCObject().getName();
}
});
// last check date column
// Last check date column
createWeightedColumn(viewer, 50, "Last Check Date", "The date of the last check.",
new ColumnLabelProvider() {
/** {@inheritDoc} */
@Override
public String getText(Object element) {
MSCRefinement refinement = (MSCRefinement)element;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment