Search in sources :

Example 1 with Layout

use of org.openforis.collect.metamodel.ui.UIOptions.Layout in project collect by openforis.

the class EditableListOfNodesVM method hasLayout.

public boolean hasLayout(EntityDefinition entityDefn, String layout) {
    UIOptions uiOpts = getUIOptions();
    Layout nodeLayout = uiOpts.getLayout(entityDefn);
    return nodeLayout.name().equals(layout);
}
Also used : Layout(org.openforis.collect.metamodel.ui.UIOptions.Layout) UIOptions(org.openforis.collect.metamodel.ui.UIOptions)

Example 2 with Layout

use of org.openforis.collect.metamodel.ui.UIOptions.Layout in project collect by openforis.

the class EditableListOfNodesVM method setLayout.

@Command
@NotifyChange({ "nodesPerTab" })
public void setLayout(@BindingParam("type") String type, @BindingParam("node") EntityDefinition node) {
    UIOptions uiOpts = getUIOptions();
    Layout layout = Layout.valueOf(type);
    uiOpts.setLayout(node, layout);
}
Also used : Layout(org.openforis.collect.metamodel.ui.UIOptions.Layout) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 3 with Layout

use of org.openforis.collect.metamodel.ui.UIOptions.Layout in project collect by openforis.

the class EntityDefinitionFormObject method saveTo.

@Override
public void saveTo(T dest, String languageCode) {
    super.saveTo(dest, languageCode);
    dest.setVirtual(virtual);
    dest.setGeneratorExpression(virtual ? generatorExpression : null);
    CollectSurvey survey = (CollectSurvey) dest.getSurvey();
    dest.setEnumerate(survey.getTarget() == SurveyTarget.COLLECT_EARTH || enumerate);
    UIOptions uiOptions = getUIOptions(dest);
    Layout layout = Layout.valueOf(layoutType);
    uiOptions.setLayout(dest, layout);
    uiOptions.setCountInSummaryListValue(dest, countInRecordSummary);
    uiOptions.setShowRowNumbersValue(dest, showRowNumbers);
    Direction directionEnum = super.isMultiple() && layout == Layout.TABLE && Direction.BY_COLUMNS.getValue().equals(this.direction) ? Direction.BY_COLUMNS : null;
    direction = directionEnum == null ? null : directionEnum.getValue();
    uiOptions.setDirection(dest, directionEnum);
}
Also used : Layout(org.openforis.collect.metamodel.ui.UIOptions.Layout) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey) Direction(org.openforis.collect.metamodel.ui.UIOptions.Direction)

Example 4 with Layout

use of org.openforis.collect.metamodel.ui.UIOptions.Layout in project collect by openforis.

the class EntityDefinitionProxy method getLayout.

@ExternalizedProperty
public String getLayout() {
    CollectSurvey survey = (CollectSurvey) entityDefinition.getSurvey();
    UIOptions uiOpts = survey.getUIOptions();
    Layout layout = uiOpts.getLayout(entityDefinition);
    return layout.name().toLowerCase(Locale.ENGLISH);
}
Also used : Layout(org.openforis.collect.metamodel.ui.UIOptions.Layout) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Example 5 with Layout

use of org.openforis.collect.metamodel.ui.UIOptions.Layout in project collect by openforis.

the class EntityDefinitionFormObject method loadFrom.

@Override
public void loadFrom(T source, String languageCode) {
    super.loadFrom(source, languageCode);
    virtual = source.isVirtual();
    generatorExpression = source.getGeneratorExpression();
    enumerate = source.isEnumerate();
    UIOptions uiOptions = getUIOptions(source);
    Layout layout = uiOptions.getLayout(source);
    layoutType = layout.name();
    countInRecordSummary = uiOptions.getCountInSumamryListValue(source);
    showRowNumbers = uiOptions.getShowRowNumbersValue(source);
    direction = uiOptions.getDirection(source).getValue();
}
Also used : Layout(org.openforis.collect.metamodel.ui.UIOptions.Layout) UIOptions(org.openforis.collect.metamodel.ui.UIOptions)

Aggregations

UIOptions (org.openforis.collect.metamodel.ui.UIOptions)10 Layout (org.openforis.collect.metamodel.ui.UIOptions.Layout)10 CollectSurvey (org.openforis.collect.model.CollectSurvey)5 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)4 ArrayList (java.util.ArrayList)1 ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)1 Direction (org.openforis.collect.metamodel.ui.UIOptions.Direction)1 UITab (org.openforis.collect.metamodel.ui.UITab)1 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)1 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)1 KeyAttributeDefinition (org.openforis.idm.metamodel.KeyAttributeDefinition)1 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)1 NumericAttributeDefinition (org.openforis.idm.metamodel.NumericAttributeDefinition)1 TaxonAttributeDefinition (org.openforis.idm.metamodel.TaxonAttributeDefinition)1 Command (org.zkoss.bind.annotation.Command)1 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)1 NotifyChange (org.zkoss.bind.annotation.NotifyChange)1