Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jbpm.formbuilder.client.effect.scriptviews;
 
 import  org.jbpm.formbuilder.client.messages.I18NConstants;
 
public class ToggleScriptHelperView extends FlexTable {
    private final I18NConstants i18n = FormBuilderGlobals.getInstance().getI18n();
    private final TextBox idField = new TextBox();
    private final ListBox actionOnEvent = new ListBox();
    private final ListBox hidingStrategy = new ListBox();
    
    public ToggleScriptHelperView(ToggleScriptHelper helper) {
        populateActionOnEventList();
        populateHidingStrategyList();
        readDataFrom(helper);
        setWidget(0, 0, new Label(.ToggleScriptHelperIdField()));
        setWidget(0, 1, );
        setWidget(1, 0, new Label(.ToggleScriptHelperActionOnEvent()));
        setWidget(1, 1, );
        setWidget(2, 0, new Label(.ToggleScriptHelperHidingStrategy()));
        setWidget(2, 1, );
    }
    
    private void populateActionOnEventList() {
        .addItem(.ToggleScriptHelperToggleAction(), .);
        .addItem(.ToggleScriptHelperHideAction(), .);
        .addItem(.ToggleScriptHelperShowAction(), .);
        .setSelectedIndex(0);
    }
    
    private void populateHidingStrategyList() {
        .addItem(.ToggleScriptHelperHiddenStrategy(), .);
        .addItem(.ToggleScriptHelperCollapseStrategy(), .);
    }
    public void writeDataTo(ToggleScriptHelper helper) {
        helper.setIdField(this..getValue());
    }
    public void readDataFrom(ToggleScriptHelper helper) {
        for (int index = 0; index < this..getItemCount(); index++) {
            if (this..getValue(index).equals(helper.getHidingStrategy())) {
                this..setSelectedIndex(index);
                break;
            }
        }
        for (int index = 0; index < this..getItemCount(); index++) {
            if (this..getValue(index).equals(helper.getActionOnEvent())) {
                this..setSelectedIndex(index);
                break;
            }
        }
        this..setValue(helper.getIdField());
    }
New to GrepCode? Check out our FAQ X