Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/com/google/gwt/sample/dynatable/client
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23230/input/javasrc/com/google/gwt/sample/dynatable/client
Added Files:
SchoolCalendarWidget.java Student.java Person.java
DynaTableDataProvider.java Schedule.java DynaTableWidget.java
SchoolCalendarServiceAsync.java Professor.java
SchoolCalendarService.java DynaTable.java TimeSlot.java
DayFilterWidget.java
Log Message:
first commit of gwtmocklib module.
--- NEW FILE: DayFilterWidget.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class DayFilterWidget extends Composite {
private class DayCheckBox extends CheckBox {
public DayCheckBox(String caption, int day) {
super(caption);
// Remember custom data for this widget.
this.day = day;
// Use a shared listener to save memory.
addClickListener(dayCheckBoxListener);
// Initialize based on the calendar's current value.
setChecked(calendar.getDayIncluded(day));
}
public final int day;
}
private class DayCheckBoxListener implements ClickListener {
public void onClick(Widget sender) {
DayCheckBox dayCheckBox = ((DayCheckBox) sender);
calendar.setDayIncluded(dayCheckBox.day, dayCheckBox.isChecked());
}
}
public DayFilterWidget(SchoolCalendarWidget calendar) {
this.calendar = calendar;
setWidget(outer);
setStyleName("DynaTable-DayFilterWidget");
outer.add(new DayCheckBox("Sunday", 0));
outer.add(new DayCheckBox("Monday", 1));
outer.add(new DayCheckBox("Tuesday", 2));
outer.add(new DayCheckBox("Wednesday", 3));
outer.add(new DayCheckBox("Thursday", 4));
outer.add(new DayCheckBox("Friday", 5));
outer.add(new DayCheckBox("Saturday", 6));
Button buttonAll = new Button("All", new ClickListener() {
public void onClick(Widget sender) {
setAllCheckBoxes(true);
}
});
Button buttonNone = new Button("None", new ClickListener() {
public void onClick(Widget sender) {
setAllCheckBoxes(false);
}
});
HorizontalPanel hp = new HorizontalPanel();
hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
hp.add(buttonAll);
hp.add(buttonNone);
outer.add(hp);
outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM);
outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER);
}
private void setAllCheckBoxes(boolean checked) {
for (int i = 0, n = outer.getWidgetCount(); i < n; ++i) {
Widget w = outer.getWidget(i);
if (w instanceof DayCheckBox) {
((DayCheckBox) w).setChecked(checked);
dayCheckBoxListener.onClick(w);
}
}
}
private final SchoolCalendarWidget calendar;
private final VerticalPanel outer = new VerticalPanel();
private final DayCheckBoxListener dayCheckBoxListener = new DayCheckBoxListener();
}
--- NEW FILE: Schedule.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Schedule implements IsSerializable {
public Schedule() {
}
public void addTimeSlot(TimeSlot timeSlot) {
timeSlots.add(timeSlot);
}
public String getDescription(boolean[] daysFilter) {
String s = null;
boolean anyDays;
for (Iterator iter = timeSlots.iterator(); iter.hasNext();) {
TimeSlot timeSlot = (TimeSlot) iter.next();
if (daysFilter[timeSlot.getDayOfWeek()]) {
if (s == null) {
s = timeSlot.getDescription();
} else {
s += ", " + timeSlot.getDescription();
}
}
}
if (s != null) {
return s;
} else {
return "";
}
}
public String toString() {
return getDescription(null);
}
/**
* @gwt.typeArgs <com.google.gwt.sample.dynatable.client.TimeSlot>
*/
private List timeSlots = new ArrayList();
}
--- NEW FILE: Person.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.rpc.IsSerializable;
public abstract class Person implements IsSerializable {
public Person() {
}
public String getDescription() {
return description;
}
public String getName() {
return name;
}
public abstract String getSchedule(boolean[] daysFilter);
public void setDescription(String description) {
this.description = description;
}
public void setName(String name) {
this.name = name;
}
private String description = "DESC";
private String name;
}
--- NEW FILE: Professor.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
public class Professor extends Person {
public Professor() {
}
public String getSchedule(boolean[] daysFilter) {
return teachingSchedule.getDescription(daysFilter);
}
public Schedule getTeachingSchedule() {
return teachingSchedule;
}
private Schedule teachingSchedule = new Schedule();
}
--- NEW FILE: SchoolCalendarService.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface SchoolCalendarService extends RemoteService {
Person[] getPeople(int startIndex, int maxCount);
}
--- NEW FILE: Student.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
public class Student extends Person {
public Schedule getClassSchedule() {
return classSchedule;
}
public String getSchedule(boolean[] daysFilter) {
return classSchedule.getDescription(daysFilter);
}
private Schedule classSchedule = new Schedule();
}
--- NEW FILE: SchoolCalendarServiceAsync.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface SchoolCalendarServiceAsync {
void getPeople(int startIndex, int maxCount, AsyncCallback callback);
}
--- NEW FILE: TimeSlot.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.user.client.rpc.IsSerializable;
public class TimeSlot implements IsSerializable, Comparable {
private static final transient String[] DAYS = new String[]{
"Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"};
public TimeSlot() {
}
public TimeSlot(int zeroBasedDayOfWeek, int startMinutes, int endMinutes) {
this.zeroBasedDayOfWeek = zeroBasedDayOfWeek;
this.startMinutes = startMinutes;
this.endMinutes = endMinutes;
}
public int compareTo(Object o) {
TimeSlot other = (TimeSlot) o;
if (zeroBasedDayOfWeek < other.zeroBasedDayOfWeek) {
return -1;
} else if (zeroBasedDayOfWeek > other.zeroBasedDayOfWeek) {
return 1;
} else {
if (startMinutes < other.startMinutes) {
return -1;
} else if (startMinutes > other.startMinutes) {
return 1;
}
}
return 0;
}
public int getDayOfWeek() {
return zeroBasedDayOfWeek;
}
public String getDescription() {
return DAYS[zeroBasedDayOfWeek] + " " + getHrsMins(startMinutes) + "-"
+ getHrsMins(endMinutes);
}
public int getEndMinutes() {
return endMinutes;
}
public int getStartMinutes() {
return startMinutes;
}
public void setDayOfWeek(int zeroBasedDayOfWeek) {
if (0 <= zeroBasedDayOfWeek && zeroBasedDayOfWeek < 7) {
this.zeroBasedDayOfWeek = zeroBasedDayOfWeek;
} else {
throw new IllegalArgumentException("day must be in the range 0-6");
}
}
public void setEndMinutes(int endMinutes) {
this.endMinutes = endMinutes;
}
public void setStartMinutes(int startMinutes) {
this.startMinutes = startMinutes;
}
private String getHrsMins(int mins) {
int hrs = mins / 60;
boolean am = true;
if (hrs > 12) {
hrs -= 12;
}
int remainder = mins % 60;
String remain = String.valueOf(remainder);
if(remainder < 10)
remain = "0"+remainder;
return hrs + ":" + remain;
}
private int endMinutes;
private int startMinutes;
private int zeroBasedDayOfWeek;
}
--- NEW FILE: SchoolCalendarWidget.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Composite;
public class SchoolCalendarWidget extends Composite {
public class CalendarProvider implements DynaTableDataProvider {
public CalendarProvider() {
// Initialize the service.
//
calService = (SchoolCalendarServiceAsync) GWT
.create(SchoolCalendarService.class);
// By default, we assume we'll make RPCs to a servlet, but see
// updateRowData(). There is special support for canned RPC responses.
// (Which is a totally demo hack, by the way :-)
//
ServiceDefTarget target = (ServiceDefTarget) calService;
target.setServiceEntryPoint("/gwtrpc/calendar");
}
public void updateRowData(final int startRow, final int maxRows,
final RowDataAcceptor acceptor) {
// Check the simple cache first.
//
if (startRow == lastStartRow) {
if (maxRows == lastMaxRows) {
// Use the cached batch.
//
pushResults(acceptor, startRow, lastPeople);
return;
}
}
// Decide where to get the data.
// This is very unusual. Normally, you'd set the service entry point
// only once. But since this demo runs without servlet support, we
// play a game with URLs to fetch canned RPC responses from static files.
// So, as you might guess, this is really fragile: changing the number
// of visible rows in the table will cause different batch sizes, and
// the URL naming trick below will *definitely* break.
//
if (USE_STATIC_RPC_ANSWERS) {
ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();
staticResponseURL += "/calendar" + startRow + ".txt";
target.setServiceEntryPoint(staticResponseURL);
}
// Actually fetch the data remotely.
//
calService.getPeople(startRow, maxRows, new AsyncCallback() {
public void onFailure(Throwable caught) {
acceptor.failed(caught);
}
public void onSuccess(Object result) {
Person[] people = (Person[]) result;
lastStartRow = startRow;
lastMaxRows = maxRows;
lastPeople = people;
pushResults(acceptor, startRow, people);
}
});
}
private void pushResults(RowDataAcceptor acceptor, int startRow,
Person[] people) {
String[][] rows = new String[people.length][];
for (int i = 0, n = rows.length; i < n; i++) {
Person person = people[i];
rows[i] = new String[3];
rows[i][0] = person.getName();
rows[i][1] = person.getDescription();
rows[i][2] = person.getSchedule(daysFilter);
}
acceptor.accept(startRow, rows);
}
private final SchoolCalendarServiceAsync calService;
private int lastStartRow = -1;
private int lastMaxRows = -1;
private Person[] lastPeople;
}
public SchoolCalendarWidget(int visibleRows) {
String[] columns = new String[]{"Name", "Description", "Schedule"};
String[] styles = new String[]{"name", "desc", "sched"};
dynaTable = new DynaTableWidget(calProvider, columns, styles, visibleRows);
setWidget(dynaTable);
}
protected boolean getDayIncluded(int day) {
return daysFilter[day];
}
protected void onLoad() {
dynaTable.refresh();
}
protected void setDayIncluded(int day, boolean included) {
if (daysFilter[day] == included) {
// No change.
//
return;
}
daysFilter[day] = included;
if (pendingRefresh == null) {
pendingRefresh = new Command() {
public void execute() {
pendingRefresh = null;
dynaTable.refresh();
}
};
DeferredCommand.add(pendingRefresh);
}
}
private final CalendarProvider calProvider = new CalendarProvider();
private final boolean[] daysFilter = new boolean[]{
true, true, true, true, true, true, true};
private final DynaTableWidget dynaTable;
private Command pendingRefresh;
private final static boolean USE_STATIC_RPC_ANSWERS = false;
}
--- NEW FILE: DynaTableDataProvider.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
public interface DynaTableDataProvider {
interface RowDataAcceptor {
void accept(int startRow, String[][] rows);
void failed(Throwable caught);
}
void updateRowData(int startRow, int maxRows, RowDataAcceptor acceptor);
}
--- NEW FILE: DynaTableWidget.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.sample.dynatable.client.DynaTableDataProvider.RowDataAcceptor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class DynaTableWidget extends Composite {
private class NavBar extends Composite implements ClickListener {
public NavBar() {
setWidget(bar);
bar.setStyleName("navbar");
status.setStyleName("status");
HorizontalPanel buttons = new HorizontalPanel();
buttons.add(gotoFirst);
buttons.add(gotoPrev);
buttons.add(gotoNext);
bar.add(buttons, DockPanel.EAST);
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
bar.add(status, DockPanel.CENTER);
bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
bar.setCellHorizontalAlignment(status, HasAlignment.ALIGN_RIGHT);
bar.setCellVerticalAlignment(status, HasAlignment.ALIGN_MIDDLE);
bar.setCellWidth(status, "100%");
// Initialize prev & first button to disabled.
//
gotoPrev.setEnabled(false);
gotoFirst.setEnabled(false);
}
public void onClick(Widget sender) {
if (sender == gotoNext) {
startRow += getDataRowCount();
refresh();
} else if (sender == gotoPrev) {
startRow -= getDataRowCount();
if (startRow < 0) {
startRow = 0;
}
refresh();
} else if (sender == gotoFirst) {
startRow = 0;
refresh();
}
}
public final DockPanel bar = new DockPanel();
public final Button gotoFirst = new Button("<<", this);
public final Button gotoNext = new Button(">", this);
public final Button gotoPrev = new Button("<", this);
public final HTML status = new HTML();
}
private class RowDataAcceptorImpl implements RowDataAcceptor {
public void accept(int startRow, String[][] data) {
int destRowCount = getDataRowCount();
int destColCount = grid.getCellCount(0);
assert (data.length <= destRowCount) : "Too many rows";
int srcRowIndex = 0;
int srcRowCount = data.length;
int destRowIndex = 1; // skip navbar row
for (; srcRowIndex < srcRowCount; ++srcRowIndex, ++destRowIndex) {
String[] srcRowData = data[srcRowIndex];
assert (srcRowData.length == destColCount) : " Column count mismatch";
for (int srcColIndex = 0; srcColIndex < destColCount; ++srcColIndex) {
String cellHTML = srcRowData[srcColIndex];
grid.setText(destRowIndex, srcColIndex, cellHTML);
}
}
// Clear remaining table rows.
//
boolean isLastPage = false;
for (; destRowIndex < destRowCount + 1; ++destRowIndex) {
isLastPage = true;
for (int destColIndex = 0; destColIndex < destColCount; ++destColIndex) {
grid.clearCell(destRowIndex, destColIndex);
}
}
// Synchronize the nav buttons.
//
navbar.gotoNext.setEnabled(!isLastPage);
navbar.gotoFirst.setEnabled(startRow > 0);
navbar.gotoPrev.setEnabled(startRow > 0);
// Update the status message.
//
setStatusText((startRow + 1) + " - " + (startRow + srcRowCount));
}
public void failed(Throwable caught) {
String msg = "Failed to access data";
if (caught != null) {
msg += ": " + caught.getMessage();
}
setStatusText(msg);
}
}
public DynaTableWidget(DynaTableDataProvider provider, String[] columns,
String[] columnStyles, int rowCount) {
if (columns.length == 0) {
throw new IllegalArgumentException(
"expecting a positive number of columns");
}
if (columnStyles != null && columns.length != columnStyles.length) {
throw new IllegalArgumentException("expecting as many styles as columns");
}
this.provider = provider;
setWidget(outer);
grid.setStyleName("table");
outer.add(navbar, DockPanel.NORTH);
outer.add(grid, DockPanel.CENTER);
initTable(columns, columnStyles, rowCount);
setStyleName("DynaTable-DynaTableWidget");
}
private void initTable(String[] columns, String[] columnStyles, int rowCount) {
// Set up the header row. It's one greater than the number of visible rows.
//
grid.resize(rowCount+1, columns.length);
for (int i = 0, n = columns.length; i < n; i++) {
String caption = columns[i];
final int colIndex = i;
grid.setText(0, i, columns[i]);
if (columnStyles != null) {
grid.getCellFormatter().setStyleName(0, i, columnStyles[i] + " header");
}
}
}
public void setStatusText(String text) {
navbar.status.setText(text);
}
public void clearStatusText() {
navbar.status.setHTML(" ");
}
public void refresh() {
// Disable buttons temporarily to stop the user from running off the end.
//
navbar.gotoFirst.setEnabled(false);
navbar.gotoPrev.setEnabled(false);
navbar.gotoNext.setEnabled(false);
setStatusText("Please wait...");
provider.updateRowData(startRow, grid.getRowCount() - 1, acceptor);
}
public void setRowCount(int rows) {
grid.resizeRows(rows);
}
private int getDataRowCount() {
return grid.getRowCount() - 1;
}
private final RowDataAcceptor acceptor = new RowDataAcceptorImpl();
private final NavBar navbar = new NavBar();
private final DockPanel outer = new DockPanel();
private final DynaTableDataProvider provider;
private int startRow = 0;
private final Grid grid = new Grid();
}
--- NEW FILE: DynaTable.java ---
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.dynatable.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class DynaTable implements EntryPoint {
public void onModuleLoad() {
// Find the slot for the calendar widget.
//
RootPanel slot = RootPanel.get("calendar");
if (slot != null) {
SchoolCalendarWidget calendar = new SchoolCalendarWidget(15);
slot.add(calendar);
// Find the slot for the days filter widget.
//
slot = RootPanel.get("days");
if (slot != null) {
DayFilterWidget filter = new DayFilterWidget(calendar);
slot.add(filter);
}
}
}
}
|