Sha256: 29b84859999d7db400f7865b843ae85c0cc85c9bb8d9d8d34647ad9bf1319d47

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

/**
 *
 */
package <%= package %>.views.<%= plural_name %>;

import <%= package %>.models.<%= class_name %>;

import de.saumya.gwt.translation.common.client.GetTextController;
import de.saumya.gwt.translation.common.client.widget.ResourceBindings;
import de.saumya.gwt.translation.common.client.widget.ResourceFields;
import de.saumya.gwt.translation.gui.client.bindings.CheckBoxBinding;
import de.saumya.gwt.translation.gui.client.bindings.IntegerTextBoxBinding;
import de.saumya.gwt.translation.gui.client.bindings.TextBoxBinding;

public class <%= class_name %>Fields extends ResourceFields<<%= class_name %>> {

    public <%= class_name %>Fields(final GetTextController getTextController,
            final ResourceBindings<<%= class_name %>> bindings) {
        super(getTextController, bindings);
<% Array(attributes).each do |attribute| -%>
        add("<%= attribute.name %>", new <% if attribute.type == :integer %>IntegerText<% elsif attribute.type == :boolean %>Check<% else %>Text<% end -%>BoxBinding<<%= class_name %>>() {

            @Override
            public void pullFrom(final <%= class_name %> resource) {
<% if attribute.type == :boolean -%>
                setValue(resource.<%= attribute.name.javanize %>);
<% else -%>
                setText(resource.<%= attribute.name.javanize %>);
<% end -%>
            }

            @Override
            public void pushInto(final <%= class_name %> resource) {
<% if attribute.type == :boolean -%>
                resource.<%= attribute.name.javanize %> = getValue();
<% else -%>
                resource.<%= attribute.name.javanize %> = getText<% if attribute.type == :integer %>AsInt<% end -%>();
<% end -%>
            }
        }<% if attribute.type == :integer %>, 0, 123456<% elsif attribute.type == :boolean %><% else %>, true, 64<% end -%>);
<% end -%>
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ixtlan-0.2.4 generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java
ixtlan-0.2.3 generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java
ixtlan-0.2.2 generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java