use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class CoordinateReferenceSystemParameterPage method getConfiguration.
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create();
String crsAsString = null;
if (crsDef != null) {
crsAsString = CRSDefinitionManager.getInstance().asString(crsDef);
}
conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString));
return conf;
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class JoinTypeStructureTray method createToolItem.
/**
* Creates a tool item
*
* @param bar a toolbar
* @param page hale wizard page
* @param schemaSpace schema space
* @param types type provider
*/
public static void createToolItem(ToolBar bar, final HaleWizardPage<?> page, final SchemaSpaceID schemaSpace, final TypeProvider types) {
ToolItem item = new ToolItem(bar, SWT.PUSH);
item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SOURCE_SCHEMA));
item.setToolTipText("Show source structure");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (page.getContainer() instanceof TrayDialog) {
TrayDialog dialog = (TrayDialog) page.getContainer();
// close existing tray
if (dialog.getTray() != null) {
dialog.closeTray();
}
ParameterValue param = CellUtil.getFirstParameter(((GenericTypeFunctionWizard) page.getWizard()).getUnfinishedCell(), JoinFunction.PARAMETER_JOIN);
dialog.openTray(new JoinTypeStructureTray(param, types, schemaSpace));
} else {
// TODO show dialog instead?
}
}
});
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class IdentifierParameterPage method getConfiguration.
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> configuration = ArrayListMultimap.create(5, 1);
configuration.put(COUNTRY_PARAMETER_NAME, new ParameterValue(countryCode.getText()));
configuration.put(DATA_PROVIDER_PARAMETER_NAME, new ParameterValue(providerName.getText()));
configuration.put(PRODUCT_PARAMETER_NAME, new ParameterValue(productName.getText()));
configuration.put(VERSION, new ParameterValue(version.getText()));
configuration.put(VERSION_NIL_REASON, new ParameterValue(nilEditor.getAsText()));
return configuration;
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class MergeParameterPage method setParameter.
/**
* @see eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage#setParameter(java.util.Set,
* com.google.common.collect.ListMultimap)
*/
@Override
public void setParameter(Set<FunctionParameterDefinition> params, ListMultimap<String, ParameterValue> initialValues) {
if (params.size() > 1)
throw new IllegalArgumentException("MergeParameterPage is only for one parameter");
parameter = params.iterator().next();
if (parameter.getName().equals(PARAMETER_PROPERTY)) {
setTitle("Please select the properties that have to match");
setDescription("Instances that have equal values for these properties will be merged into one");
} else if (parameter.getName().equals(PARAMETER_ADDITIONAL_PROPERTY)) {
setTitle("Please select other equal properties to merge");
setDescription("For these properties only the unique values will be retained in the merged instance");
} else
throw new IllegalArgumentException("MergeParameterPage is only for property or additional_property parameters");
if (initialValues != null) {
// cell gets edited
List<ParameterValue> tmp = initialValues.get(parameter.getName());
if (tmp != null) {
initialSelection = new ArrayList<String>(tmp.size());
for (ParameterValue value : tmp) {
// TODO use MergeUtil helper function instead
// XXX needs selection to be QName based
initialSelection.add(value.as(String.class));
}
} else {
initialSelection = Collections.emptyList();
}
setPageComplete(true);
}
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class MergeParameterPage method onShowPage.
/**
* @see eu.esdihumboldt.hale.ui.HaleWizardPage#onShowPage(boolean)
*/
@Override
protected void onShowPage(boolean firstShow) {
super.onShowPage(firstShow);
setPageComplete(true);
Cell unfinishedCell = getWizard().getUnfinishedCell();
// selected target could've changed!
TypeDefinition newSourceType = (TypeDefinition) unfinishedCell.getSource().values().iterator().next().getDefinition().getDefinition();
if (!newSourceType.equals(sourceType)) {
selection = new HashSet<EntityDefinition>();
sourceType = newSourceType;
viewer.setInput(sourceType);
}
// for additional_property: selected properties can change!
if (parameter.getName().equals(PARAMETER_ADDITIONAL_PROPERTY)) {
filtered = new HashSet<EntityDefinition>();
List<ParameterValue> properties = unfinishedCell.getTransformationParameters().get(PARAMETER_PROPERTY);
boolean oldSelectionChanged = false;
for (ParameterValue propertyPath : properties) {
EntityDefinition def = getEntityDefinition(propertyPath.as(String.class), sourceType);
filtered.add(def);
if (selection.remove(def))
oldSelectionChanged = true;
}
if (oldSelectionChanged) {
viewer.setCheckedElements(selection.toArray());
}
viewer.refresh();
}
}
Aggregations