Sha256: a3ca8415021245c3b89d745a012de735460fa20a77d5c1892f3a5752b475251e

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.4.0.pre2 generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java
ixtlan-0.4.0.pre generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java
ixtlan-0.3.0 generators/gwt_ixtlan_datamapper_rspec_scaffold/templates/Fields.java