Package org.mcarthur.sandy.gwt.table.client

Examples of org.mcarthur.sandy.gwt.table.client.TableCell


            final String[] rgs = ptm.getRowGroupSpec().split(" ");

            final TableRow tr = rowGroup.newTableRow();
            for (int i=0; i < rgs.length; i++) {
                final PropertyDescriptor pd = (PropertyDescriptor)propertyDescriptorsMap.get(rgs[i]);
                final TableCell tc = tr.newTableDataCell();
                tc.add(pd.createWidget(obj));
                tr.add(tc);
            }
            rowGroup.add(tr);
        }
View Full Code Here


        public void render(final Object obj, final TableBodyGroup rowGroup) {
            final Person person = (Person)obj;

            final TableRow tr = rowGroup.newTableRow();

            final TableCell a = tr.newTableDataCell();
            final CheckBox checkBox = new CheckBox();
            checkBox.setEnabled(false);
            checkBox.setTitle("Doesn't do anything.");
            a.add(checkBox);
            a.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            a.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            a.setRowSpan(2);
            tr.add(a);

            final TableCell nameCell = tr.newTableDataCell();
            nameCell.addStyleName("name");
            final TextBox tb = new TextBox();
            tb.addChangeListener(new ChangeListener() {
                public void onChange(final Widget sender) {
                    final TextBox tb = (TextBox)sender;
                    person.setName(tb.getText());
                }
            });
            tb.addKeyboardListener(new KeyboardListenerAdapter() {
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        final TextBox tb = (TextBox)sender;
                        tb.setFocus(false);
                    }
                }
            });
            tb.addFocusListener(new FocusListenerAdapter() {
                public void onFocus(final Widget sender) {
                    tb.setSelectionRange(0, tb.getText().length());
                }
            });
            tb.setText(person.getName());
            nameCell.add(tb);
            tr.add(nameCell);

            final TableCell ageCell = tr.newTableDataCell();
            ageCell.addStyleName("age");
            //ageCell.add(new Label(Integer.toString(person.getAge())));
            ageCell.add(new AgeLabel(person.getAge()));
            ageCell.setWidth("5em");
            ageCell.setAlignment(HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
            tr.add(ageCell);

            final TableCell removeCell = tr.newTableDataCell();
            removeCell.addStyleName("remove");
            final Button button = new Button("Remove");
            button.addClickListener(new ClickListener() {
                public void onClick(final Widget sender) {
                    ot.getObjects().remove(person);
                }
            });
            removeCell.add(button);
            tr.add(removeCell);

            rowGroup.add(tr);

            final TableRow tr2 = rowGroup.newTableRow();
            final TableCell tc2 = tr2.newTableDataCell();
            tc2.addStyleName("random");
            tc2.add(new Label("Something " + Math.random()));
            //tc2.add(makeMenuBar());
            tc2.setColSpan(3);

            tc2.setAxis("summary");
            tr2.add(tc2);
            rowGroup.add(tr2);
        }
View Full Code Here

TOP

Related Classes of org.mcarthur.sandy.gwt.table.client.TableCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.