mirror of
https://github.com/atlanticbiomedical/portal.git
synced 2025-07-01 18:17:26 -04:00
Initial Commit
This commit is contained in:
46
src/com/biomed/Biomed.gwt.xml
Normal file
46
src/com/biomed/Biomed.gwt.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="biomed" >
|
||||
|
||||
|
||||
<inherits name="com.allen_sauer.gwt.dnd.gwt-dnd" />
|
||||
<inherits name="com.bradrydzewski.gwt.calendar.Calendar" />
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<inherits name="com.github.gwtbootstrap.datepicker.Datepicker" />
|
||||
<inherits name="com.google.common.base.Base" />
|
||||
<inherits name="com.google.common.collect.Collect" />
|
||||
<inherits name="com.google.gwt.activity.Activity" />
|
||||
<inherits name="com.google.gwt.inject.Inject"/>
|
||||
<inherits name="com.google.gwt.json.JSON" />
|
||||
<inherits name="com.google.gwt.i18n.I18N"/>
|
||||
<inherits name="com.google.gwt.user.User" />
|
||||
<inherits name="com.google.gwt.useragent.UserAgent" />
|
||||
<inherits name="com.google.maps.gwt.GoogleMaps" />
|
||||
|
||||
<set-property name="user.agent" value="safari,gecko1_8"/>
|
||||
<extend-property name="locale" values="en"/>
|
||||
<set-property name="locale" value="en" />
|
||||
|
||||
<entry-point class="com.biomed.client.BiomedEntryPoint" />
|
||||
|
||||
<source path="client" />
|
||||
<source path="shared" />
|
||||
<source path="resources" />
|
||||
|
||||
<public path="resources">
|
||||
<exclude name="**/*.java"/>
|
||||
<exclude name="**/*.class"/>
|
||||
</public>
|
||||
|
||||
|
||||
<script src="http://maps.google.com/maps/api/js?sensor=false" />
|
||||
|
||||
<replace-with class="com.biomed.resources.BiomedConfigurator">
|
||||
<when-type-is class="com.github.gwtbootstrap.client.ui.config.Configurator" />
|
||||
</replace-with>
|
||||
<replace-with class="com.biomed.client.resources.BiomedMonthViewStyleManager">
|
||||
<when-type-is class="com.bradrydzewski.gwt.calendar.client.monthview.MonthViewStyleManager"/>
|
||||
</replace-with>
|
||||
<replace-with class="com.biomed.client.resources.BiomedDayViewStyleManager">
|
||||
<when-type-is class="com.bradrydzewski.gwt.calendar.client.dayview.DayViewStyleManager"/>
|
||||
</replace-with>
|
||||
</module>
|
26
src/com/biomed/client/AbstractBiomedActivity.java
Normal file
26
src/com/biomed/client/AbstractBiomedActivity.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import com.biomed.client.place.BiomedPlace;
|
||||
|
||||
public abstract class AbstractBiomedActivity implements BiomedActivity {
|
||||
|
||||
protected BiomedPlace place;
|
||||
|
||||
@Override
|
||||
public String mayStop() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlace(BiomedPlace place) {
|
||||
this.place = place;
|
||||
}
|
||||
}
|
46
src/com/biomed/client/BiomedActivity.java
Normal file
46
src/com/biomed/client/BiomedActivity.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.place.BiomedPlace;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public interface BiomedActivity {
|
||||
/**
|
||||
* Called when the user is trying to navigate away from this activity.
|
||||
*
|
||||
* @return A message to display to the user, e.g. to warn of unsaved work, or
|
||||
* null to say nothing
|
||||
*/
|
||||
String mayStop();
|
||||
|
||||
/**
|
||||
* Called when {@link #start} has not yet replied to its callback, but the
|
||||
* user has lost interest.
|
||||
*/
|
||||
void onCancel();
|
||||
|
||||
/**
|
||||
* Called when the Activity's widget has been removed from view. All event
|
||||
* handlers it registered will have been removed before this method is called.
|
||||
*/
|
||||
void onStop();
|
||||
|
||||
/**
|
||||
* Called when the Activity should ready its widget for the user. When the
|
||||
* widget is ready (typically after an RPC response has been received),
|
||||
* receiver should present it by calling
|
||||
* {@link AcceptsOneWidget#setWidget} on the given panel.
|
||||
* <p>
|
||||
* Any handlers attached to the provided event bus will be de-registered when
|
||||
* the activity is stopped, so activities will rarely need to hold on to the
|
||||
* {@link com.google.gwt.event.shared.HandlerRegistration HandlerRegistration}
|
||||
* instances returned by {@link EventBus#addHandler}.
|
||||
*
|
||||
* @param panel the panel to display this activity's widget when it is ready
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
void start(SiteContainer panel, EventBus eventBus);
|
||||
|
||||
void setPlace(BiomedPlace place);
|
||||
}
|
266
src/com/biomed/client/BiomedActivityManager.java
Normal file
266
src/com/biomed/client/BiomedActivityManager.java
Normal file
@ -0,0 +1,266 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.biomed.client.place.BiomedPlace;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gwt.event.shared.UmbrellaException;
|
||||
import com.google.gwt.place.shared.PlaceChangeEvent;
|
||||
import com.google.gwt.place.shared.PlaceChangeRequestEvent;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import com.google.web.bindery.event.shared.ResettableEventBus;
|
||||
|
||||
public class BiomedActivityManager implements PlaceChangeEvent.Handler,
|
||||
PlaceChangeRequestEvent.Handler {
|
||||
/**
|
||||
* Wraps our real display to prevent an Activity from taking it over if it is
|
||||
* not the currentActivity.
|
||||
*/
|
||||
public class SiteContainer {
|
||||
private final BiomedActivity activity;
|
||||
|
||||
SiteContainer(BiomedActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public void setWidget(BiomedSite site, IsWidget view) {
|
||||
if (this.activity == BiomedActivityManager.this.currentActivity) {
|
||||
startingNext = false;
|
||||
showWidget(site, view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final BiomedActivity NULL_ACTIVITY = new AbstractBiomedActivity() {
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
}
|
||||
};
|
||||
|
||||
private final BiomedActivityMapper mapper;
|
||||
|
||||
private final EventBus eventBus;
|
||||
|
||||
/*
|
||||
* Note that we use the legacy class from com.google.gwt.event.shared, because
|
||||
* we can't change the Activity interface.
|
||||
*/
|
||||
private final ResettableEventBus stopperedEventBus;
|
||||
|
||||
private BiomedActivity currentActivity = NULL_ACTIVITY;
|
||||
|
||||
private Map<BiomedSite, AcceptsOneWidget> sites = Maps.newHashMap();
|
||||
|
||||
private boolean startingNext = false;
|
||||
|
||||
private HandlerRegistration handlerRegistration;
|
||||
|
||||
/**
|
||||
* Create an ActivityManager. Next call {@link #setDisplay}.
|
||||
*
|
||||
* @param mapper
|
||||
* finds the {@link BiomedActivity} for a given
|
||||
* {@link com.google.gwt.place.shared.Place}
|
||||
* @param eventBus
|
||||
* source of {@link PlaceChangeEvent} and
|
||||
* {@link PlaceChangeRequestEvent} events.
|
||||
*/
|
||||
public BiomedActivityManager(BiomedActivityMapper mapper, EventBus eventBus) {
|
||||
this.mapper = mapper;
|
||||
this.eventBus = eventBus;
|
||||
this.stopperedEventBus = new ResettableEventBus(eventBus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an event bus which is in use by the currently running activity.
|
||||
* <p>
|
||||
* Any handlers attached to the returned event bus will be de-registered when
|
||||
* the current activity is stopped.
|
||||
*
|
||||
* @return the event bus used by the current activity
|
||||
*/
|
||||
public EventBus getActiveEventBus() {
|
||||
return stopperedEventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate the current activity, find the next one from our ActivityMapper,
|
||||
* and start it.
|
||||
* <p>
|
||||
* The current activity's widget will be hidden immediately, which can cause
|
||||
* flicker if the next activity provides its widget asynchronously. That can
|
||||
* be minimized by decent caching. Perenially slow activities might mitigate
|
||||
* this by providing a widget immediately, with some kind of "loading"
|
||||
* treatment.
|
||||
*/
|
||||
public void onPlaceChange(PlaceChangeEvent event) {
|
||||
BiomedActivity nextActivity = getNextActivity(event);
|
||||
|
||||
Throwable caughtOnStop = null;
|
||||
Throwable caughtOnCancel = null;
|
||||
Throwable caughtOnStart = null;
|
||||
|
||||
if (nextActivity == null) {
|
||||
nextActivity = NULL_ACTIVITY;
|
||||
}
|
||||
|
||||
if (currentActivity.equals(nextActivity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (startingNext) {
|
||||
// The place changed again before the new current activity showed its
|
||||
// widget
|
||||
caughtOnCancel = tryStopOrCancel(false);
|
||||
currentActivity = NULL_ACTIVITY;
|
||||
startingNext = false;
|
||||
} else if (!currentActivity.equals(NULL_ACTIVITY)) {
|
||||
for (AcceptsOneWidget display : sites.values()) {
|
||||
display.setWidget(null);
|
||||
}
|
||||
|
||||
/*
|
||||
* Kill off the activity's handlers, so it doesn't have to worry about
|
||||
* them accidentally firing as a side effect of its tear down
|
||||
*/
|
||||
stopperedEventBus.removeHandlers();
|
||||
caughtOnStop = tryStopOrCancel(true);
|
||||
}
|
||||
|
||||
currentActivity = nextActivity;
|
||||
|
||||
if (currentActivity.equals(NULL_ACTIVITY)) {
|
||||
for (AcceptsOneWidget display : sites.values()) {
|
||||
display.setWidget(null);
|
||||
}
|
||||
} else {
|
||||
startingNext = true;
|
||||
caughtOnStart = tryStart();
|
||||
}
|
||||
|
||||
if (caughtOnStart != null || caughtOnCancel != null || caughtOnStop != null) {
|
||||
Set<Throwable> causes = new LinkedHashSet<Throwable>();
|
||||
if (caughtOnStop != null) {
|
||||
causes.add(caughtOnStop);
|
||||
}
|
||||
if (caughtOnCancel != null) {
|
||||
causes.add(caughtOnCancel);
|
||||
}
|
||||
if (caughtOnStart != null) {
|
||||
causes.add(caughtOnStart);
|
||||
}
|
||||
|
||||
throw new UmbrellaException(causes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject the place change if the current activity is not willing to stop.
|
||||
*
|
||||
* @see com.google.gwt.place.shared.PlaceChangeRequestEvent.Handler#onPlaceChangeRequest(PlaceChangeRequestEvent)
|
||||
*/
|
||||
public void onPlaceChangeRequest(PlaceChangeRequestEvent event) {
|
||||
event.setWarning(currentActivity.mayStop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display for the receiver, and has the side effect of starting or
|
||||
* stopping its monitoring the event bus for place change events.
|
||||
* <p>
|
||||
* If you are disposing of an ActivityManager, it is important to call
|
||||
* setDisplay(null) to get it to deregister from the event bus, so that it can
|
||||
* be garbage collected.
|
||||
*/
|
||||
public void setSiteDisplay(BiomedSite site, AcceptsOneWidget display) {
|
||||
boolean wasActive = sites.size() > 0;
|
||||
|
||||
if (display != null) {
|
||||
sites.put(site, display);
|
||||
} else {
|
||||
sites.remove(site);
|
||||
}
|
||||
|
||||
boolean willBeActive = sites.size() > 0;
|
||||
|
||||
if (wasActive != willBeActive) {
|
||||
updateHandlers(willBeActive);
|
||||
}
|
||||
}
|
||||
|
||||
private BiomedActivity getNextActivity(PlaceChangeEvent event) {
|
||||
if (sites.size() == 0) {
|
||||
/*
|
||||
* Display may have been nulled during PlaceChangeEvent dispatch. Don't
|
||||
* bother the mapper, just return a null to ensure we shut down the
|
||||
* current activity
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
return mapper.getActivity((BiomedPlace) event.getNewPlace());
|
||||
}
|
||||
|
||||
private void showWidget(BiomedSite site, IsWidget view) {
|
||||
if (sites.containsKey(site)) {
|
||||
sites.get(site).setWidget(view);
|
||||
}
|
||||
}
|
||||
|
||||
private Throwable tryStart() {
|
||||
Throwable caughtOnStart = null;
|
||||
try {
|
||||
/*
|
||||
* Wrap the actual display with a per-call instance that protects the
|
||||
* display from canceled or stopped activities, and which maintains our
|
||||
* startingNext state.
|
||||
*/
|
||||
currentActivity.start(new SiteContainer(currentActivity), stopperedEventBus);
|
||||
} catch (Throwable t) {
|
||||
caughtOnStart = t;
|
||||
}
|
||||
return caughtOnStart;
|
||||
}
|
||||
|
||||
private Throwable tryStopOrCancel(boolean stop) {
|
||||
Throwable caughtOnStop = null;
|
||||
try {
|
||||
if (stop) {
|
||||
currentActivity.onStop();
|
||||
} else {
|
||||
currentActivity.onCancel();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
caughtOnStop = t;
|
||||
} finally {
|
||||
/*
|
||||
* Kill off the handlers again in case it was naughty and added new ones
|
||||
* during onstop or oncancel
|
||||
*/
|
||||
stopperedEventBus.removeHandlers();
|
||||
}
|
||||
return caughtOnStop;
|
||||
}
|
||||
|
||||
private void updateHandlers(boolean activate) {
|
||||
if (activate) {
|
||||
final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE, this);
|
||||
final HandlerRegistration placeRequestReg = eventBus.addHandler(PlaceChangeRequestEvent.TYPE,
|
||||
this);
|
||||
|
||||
this.handlerRegistration = new HandlerRegistration() {
|
||||
public void removeHandler() {
|
||||
placeReg.removeHandler();
|
||||
placeRequestReg.removeHandler();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (handlerRegistration != null) {
|
||||
handlerRegistration.removeHandler();
|
||||
handlerRegistration = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
src/com/biomed/client/BiomedActivityMapper.java
Normal file
97
src/com/biomed/client/BiomedActivityMapper.java
Normal file
@ -0,0 +1,97 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.client.activity.EditClientDevicesActivity;
|
||||
import com.biomed.client.activity.EditClientFrequencyActivity;
|
||||
import com.biomed.client.activity.EditClientOverviewActivity;
|
||||
import com.biomed.client.activity.EditClientWorkordersActivity;
|
||||
import com.biomed.client.activity.EditWorkorderActivity;
|
||||
import com.biomed.client.activity.NewClientActivity;
|
||||
import com.biomed.client.activity.NewMessageActivity;
|
||||
import com.biomed.client.activity.ViewClientsActivity;
|
||||
import com.biomed.client.activity.ViewScheduleActivity;
|
||||
import com.biomed.client.activity.ViewWorkordersActivity;
|
||||
import com.biomed.client.place.BiomedPlace;
|
||||
import com.biomed.client.place.EditClientDevicesPlace;
|
||||
import com.biomed.client.place.EditClientFrequencyPlace;
|
||||
import com.biomed.client.place.EditClientOverviewPlace;
|
||||
import com.biomed.client.place.EditClientWorkordersPlace;
|
||||
import com.biomed.client.place.EditWorkorderPlace;
|
||||
import com.biomed.client.place.NewClientPlace;
|
||||
import com.biomed.client.place.NewMessagePlace;
|
||||
import com.biomed.client.place.ViewClientsPlace;
|
||||
import com.biomed.client.place.ViewSchedulePlace;
|
||||
import com.biomed.client.place.ViewWorkordersPlace;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
@Singleton
|
||||
public class BiomedActivityMapper {
|
||||
|
||||
@Inject Provider<EditClientOverviewActivity> editClientOverviewActivityProvider;
|
||||
@Inject Provider<EditClientDevicesActivity> editClientDevicesActivityProvider;
|
||||
@Inject Provider<EditClientFrequencyActivity> editClientFrequencyActivityProvider;
|
||||
@Inject Provider<EditClientWorkordersActivity> editClientWorkordersActivityProvider;
|
||||
@Inject Provider<EditWorkorderActivity> editWorkorderActivityProvider;
|
||||
@Inject Provider<NewClientActivity> newClientActivityProvider;
|
||||
@Inject Provider<NewMessageActivity> newMessageActivityProvider;
|
||||
@Inject Provider<ViewClientsActivity> viewClientsActivityProvider;
|
||||
@Inject Provider<ViewScheduleActivity> viewScheduleActivityProvider;
|
||||
@Inject Provider<ViewWorkordersActivity> viewWorkordersActivityProvider;
|
||||
|
||||
|
||||
public BiomedActivity getActivity(BiomedPlace place) {
|
||||
BiomedActivity activity = getActivityInternal(place);
|
||||
if (activity != null) {
|
||||
activity.setPlace(place);
|
||||
}
|
||||
|
||||
return activity;
|
||||
}
|
||||
|
||||
|
||||
private BiomedActivity getActivityInternal(BiomedPlace place) {
|
||||
if (place instanceof EditClientOverviewPlace) {
|
||||
return editClientOverviewActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof EditClientDevicesPlace) {
|
||||
return editClientDevicesActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof EditClientFrequencyPlace) {
|
||||
return editClientFrequencyActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof EditClientWorkordersPlace) {
|
||||
return editClientWorkordersActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof EditWorkorderPlace) {
|
||||
return editWorkorderActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof NewClientPlace) {
|
||||
return newClientActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof NewMessagePlace) {
|
||||
return newMessageActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof ViewClientsPlace) {
|
||||
return viewClientsActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof ViewSchedulePlace) {
|
||||
return viewScheduleActivityProvider.get();
|
||||
}
|
||||
|
||||
if (place instanceof ViewWorkordersPlace) {
|
||||
return viewWorkordersActivityProvider.get();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
18
src/com/biomed/client/BiomedEntryPoint.java
Normal file
18
src/com/biomed/client/BiomedEntryPoint.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
public class BiomedEntryPoint implements EntryPoint {
|
||||
|
||||
private final BiomedGinjector injector = GWT.create(BiomedGinjector.class);
|
||||
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
DOM.getElementById("loading").removeFromParent();
|
||||
RootPanel.get().add(injector.getAppWidget());
|
||||
injector.getPlaceHistoryHandler().handleCurrentHistory();
|
||||
}
|
||||
}
|
44
src/com/biomed/client/BiomedGinModule.java
Normal file
44
src/com/biomed/client/BiomedGinModule.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.client.dispatch.ClientDispatchGinModule;
|
||||
import com.biomed.client.place.ViewSchedulePlace;
|
||||
import com.biomed.client.services.ServicesGinModule;
|
||||
import com.google.gwt.inject.client.AbstractGinModule;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.place.shared.PlaceHistoryHandler;
|
||||
import com.google.gwt.place.shared.PlaceHistoryMapper;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||
|
||||
public class BiomedGinModule extends AbstractGinModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
install(new ClientDispatchGinModule());
|
||||
install(new ServicesGinModule());
|
||||
|
||||
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
|
||||
bind(PlaceHistoryMapper.class).to(BiomedPlaceHistoryMapper.class).in(Singleton.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public PlaceHistoryHandler getHistoryHandler(PlaceController placeController,
|
||||
PlaceHistoryMapper historyMapper, EventBus eventBus) {
|
||||
|
||||
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
|
||||
historyHandler.register(placeController, eventBus, ViewSchedulePlace.INSTANCE);
|
||||
|
||||
return historyHandler;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public PlaceController providesPlaceController(EventBus eventBus) {
|
||||
return new PlaceController(eventBus);
|
||||
}
|
||||
|
||||
}
|
14
src/com/biomed/client/BiomedGinjector.java
Normal file
14
src/com/biomed/client/BiomedGinjector.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import com.biomed.client.ui.MainPanel;
|
||||
import com.google.gwt.inject.client.GinModules;
|
||||
import com.google.gwt.inject.client.Ginjector;
|
||||
import com.google.gwt.place.shared.PlaceHistoryHandler;
|
||||
|
||||
@GinModules(BiomedGinModule.class)
|
||||
public interface BiomedGinjector extends Ginjector {
|
||||
|
||||
PlaceHistoryHandler getPlaceHistoryHandler();
|
||||
|
||||
MainPanel getAppWidget();
|
||||
}
|
29
src/com/biomed/client/BiomedPlaceHistoryMapper.java
Normal file
29
src/com/biomed/client/BiomedPlaceHistoryMapper.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.biomed.client;
|
||||
|
||||
import com.biomed.client.place.EditClientDevicesPlace;
|
||||
import com.biomed.client.place.EditClientFrequencyPlace;
|
||||
import com.biomed.client.place.EditClientOverviewPlace;
|
||||
import com.biomed.client.place.EditClientWorkordersPlace;
|
||||
import com.biomed.client.place.EditWorkorderPlace;
|
||||
import com.biomed.client.place.NewClientPlace;
|
||||
import com.biomed.client.place.NewMessagePlace;
|
||||
import com.biomed.client.place.ViewClientsPlace;
|
||||
import com.biomed.client.place.ViewSchedulePlace;
|
||||
import com.biomed.client.place.ViewWorkordersPlace;
|
||||
import com.google.gwt.place.shared.PlaceHistoryMapper;
|
||||
import com.google.gwt.place.shared.WithTokenizers;
|
||||
|
||||
|
||||
@WithTokenizers({
|
||||
EditClientDevicesPlace.Tokenizer.class,
|
||||
EditClientFrequencyPlace.Tokenizer.class,
|
||||
EditClientOverviewPlace.Tokenizer.class,
|
||||
EditClientWorkordersPlace.Tokenizer.class,
|
||||
EditWorkorderPlace.Tokenizer.class,
|
||||
NewClientPlace.Tokenizer.class,
|
||||
NewMessagePlace.Tokenizer.class,
|
||||
ViewClientsPlace.Tokenizer.class,
|
||||
ViewSchedulePlace.Tokenizer.class,
|
||||
ViewWorkordersPlace.Tokenizer.class
|
||||
})
|
||||
public interface BiomedPlaceHistoryMapper extends PlaceHistoryMapper { }
|
9
src/com/biomed/client/BiomedSection.java
Normal file
9
src/com/biomed/client/BiomedSection.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.biomed.client;
|
||||
|
||||
public enum BiomedSection {
|
||||
DASHBOARD,
|
||||
CLIENTS,
|
||||
MESSAGES,
|
||||
WORKORDERS,
|
||||
SCHEDULE
|
||||
}
|
6
src/com/biomed/client/BiomedSite.java
Normal file
6
src/com/biomed/client/BiomedSite.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.biomed.client;
|
||||
|
||||
public enum BiomedSite {
|
||||
CONTENT,
|
||||
SIDEBAR
|
||||
}
|
116
src/com/biomed/client/activity/BaseClientActivity.java
Normal file
116
src/com/biomed/client/activity/BaseClientActivity.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.place.EditClientDevicesPlace;
|
||||
import com.biomed.client.place.EditClientFrequencyPlace;
|
||||
import com.biomed.client.place.EditClientOverviewPlace;
|
||||
import com.biomed.client.place.EditClientWorkordersPlace;
|
||||
import com.biomed.client.place.HasClientId;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel.Tabs;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class BaseClientActivity extends AbstractBiomedActivity implements
|
||||
ValueChangeHandler {
|
||||
|
||||
@Inject
|
||||
Provider<ClientEditorSidebarPanel> sidebarProvider;
|
||||
|
||||
@Inject
|
||||
PlaceController placeController;
|
||||
|
||||
private boolean isDirty;
|
||||
|
||||
protected abstract boolean showNavigationPanel();
|
||||
|
||||
protected Tabs getTab() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void createContentPanel(SiteContainer panel);
|
||||
|
||||
@Override
|
||||
public final void start(SiteContainer panel, EventBus eventBus) {
|
||||
if (showNavigationPanel()) {
|
||||
ClientEditorSidebarPanel sidebar = sidebarProvider.get();
|
||||
sidebar.setActive(getTab());
|
||||
addSidebarEventHandlers(sidebar);
|
||||
panel.setWidget(BiomedSite.SIDEBAR, sidebar);
|
||||
}
|
||||
|
||||
createContentPanel(panel);
|
||||
}
|
||||
|
||||
private void addSidebarEventHandlers(ClientEditorSidebarPanel sidebar) {
|
||||
Tabs tab = getTab();
|
||||
|
||||
if (tab != Tabs.OVERVIEW) {
|
||||
sidebar.getOverviewTab().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
placeController.goTo(EditClientOverviewPlace.getPlace(getClientId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (tab != Tabs.FREQUENCY) {
|
||||
sidebar.getFrequencyTab().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
placeController.goTo(EditClientFrequencyPlace.getPlace(getClientId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (tab != Tabs.DEVICES) {
|
||||
sidebar.getDevicesTab().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
placeController.goTo(EditClientDevicesPlace.getPlace(getClientId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (tab != Tabs.WORKORDERS) {
|
||||
sidebar.getWorkordersTab().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
placeController.goTo(EditClientWorkordersPlace.getPlace(getClientId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected int getClientId() {
|
||||
return ((HasClientId) place).getId();
|
||||
}
|
||||
|
||||
protected void resetDirtyFlag() {
|
||||
isDirty = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mayStop() {
|
||||
if (isDirty) {
|
||||
return "You have unsaved changed, are you sure?";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent event) {
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
102
src/com/biomed/client/activity/BaseClientOverviewActivity.java
Normal file
102
src/com/biomed/client/activity/BaseClientOverviewActivity.java
Normal file
@ -0,0 +1,102 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.clienteditor.ClientOverviewEditorPanel;
|
||||
import com.biomed.shared.api.EmptyResult;
|
||||
import com.biomed.shared.api.SaveClientAction;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
||||
public abstract class BaseClientOverviewActivity extends BaseClientActivity {
|
||||
|
||||
@Inject
|
||||
ClientOverviewEditorPanel view;
|
||||
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
ClientDTO client;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void setupEvents() {
|
||||
view.getIdentifierField().addValueChangeHandler(this);
|
||||
view.getNameField().addValueChangeHandler(this);
|
||||
view.getPrimaryAddressField().addValueChangeHandler(this);
|
||||
view.getPrimaryAddress2Field().addValueChangeHandler(this);
|
||||
view.getPrimaryCityField().addValueChangeHandler(this);
|
||||
view.getPrimaryStateField().addValueChangeHandler(this);
|
||||
view.getPrimaryZipField().addValueChangeHandler(this);
|
||||
view.getPrimaryContactField().addValueChangeHandler(this);
|
||||
view.getPrimaryPhoneField().addValueChangeHandler(this);
|
||||
view.getPrimaryEmailField().addValueChangeHandler(this);
|
||||
view.getSecondaryContactField().addValueChangeHandler(this);
|
||||
view.getSecondaryPhoneField().addValueChangeHandler(this);
|
||||
view.getSecondaryEmailField().addValueChangeHandler(this);
|
||||
view.getNotesField().addValueChangeHandler(this);
|
||||
|
||||
view.getSaveButton().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
saveClient();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setView(ClientDTO client) {
|
||||
view.getIdentifierField().setValue(client.getIdentifier());
|
||||
view.getNameField().setValue(client.getName());
|
||||
view.getPrimaryAddressField().setValue(client.getPrimaryAddress());
|
||||
view.getPrimaryAddress2Field().setValue(client.getPrimaryAddress2());
|
||||
view.getPrimaryCityField().setValue(client.getPrimaryCity());
|
||||
view.getPrimaryStateField().setValue(client.getPrimaryState());
|
||||
view.getPrimaryZipField().setValue(client.getPrimaryZip());
|
||||
view.getPrimaryContactField().setValue(client.getPrimaryContactName());
|
||||
view.getPrimaryPhoneField().setValue(client.getPrimaryPhone());
|
||||
view.getPrimaryEmailField().setValue(client.getPrimaryEmail());
|
||||
view.getSecondaryContactField().setValue(client.getSecondaryContactName());
|
||||
view.getSecondaryPhoneField().setValue(client.getSecondaryPhone());
|
||||
view.getSecondaryEmailField().setValue(client.getSecondaryEmail());
|
||||
view.getNotesField().setValue(client.getNotes());
|
||||
}
|
||||
|
||||
protected void getView(ClientDTO client) {
|
||||
client.setIdentifier(view.getIdentifierField().getValue());
|
||||
client.setName(view.getNameField().getValue());
|
||||
client.setPrimaryAddress(view.getPrimaryAddressField().getValue());
|
||||
client.setPrimaryAddress2(view.getPrimaryAddress2Field().getValue());
|
||||
client.setPrimaryCity(view.getPrimaryCityField().getValue());
|
||||
client.setPrimaryState(view.getPrimaryStateField().getValue());
|
||||
client.setPrimaryZip(view.getPrimaryZipField().getValue());
|
||||
client.setPrimaryContactName(view.getPrimaryContactField().getValue());
|
||||
client.setPrimaryPhone(view.getPrimaryPhoneField().getValue());
|
||||
client.setPrimaryEmail(view.getPrimaryEmailField().getValue());
|
||||
client.setSecondaryContactName(view.getSecondaryContactField().getValue());
|
||||
client.setSecondaryPhone(view.getSecondaryPhoneField().getValue());
|
||||
client.setSecondaryEmail(view.getSecondaryEmailField().getValue());
|
||||
client.setNotes(view.getNotesField().getValue());
|
||||
}
|
||||
|
||||
private void saveClient() {
|
||||
getView(client);
|
||||
|
||||
SaveClientAction action = new SaveClientAction();
|
||||
action.setClient(client);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
resetDirtyFlag();
|
||||
onSaveComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void onSaveComplete() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.clienteditor.ClientDevicesEditorPanel;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel.Tabs;
|
||||
import com.biomed.shared.api.GetDevicesAction;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.dto.DeviceDTO;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class EditClientDevicesActivity extends BaseClientActivity {
|
||||
|
||||
@Inject
|
||||
ClientDevicesEditorPanel view;
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
private ListDataProvider<DeviceDTO> dataProvider;
|
||||
|
||||
@Override
|
||||
protected boolean showNavigationPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Tabs getTab() {
|
||||
return Tabs.DEVICES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContentPanel(SiteContainer panel) {
|
||||
dataProvider = new ListDataProvider<DeviceDTO>();
|
||||
dataProvider.addDataDisplay(view.getTable());
|
||||
|
||||
panel.setWidget(BiomedSite.CONTENT, view);
|
||||
|
||||
view.showLoading();
|
||||
|
||||
GetDevicesAction action = new GetDevicesAction();
|
||||
action.setClientId(getClientId());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<DeviceDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ListResult<DeviceDTO> result) {
|
||||
dataProvider.setList(result.getResult());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel.Tabs;
|
||||
import com.biomed.client.ui.clienteditor.ClientFrequencyEditorPanel;
|
||||
import com.biomed.shared.api.EmptyResult;
|
||||
import com.biomed.shared.api.GetClientFrequencyAction;
|
||||
import com.biomed.shared.api.SaveClientFrequenciesAction;
|
||||
import com.biomed.shared.api.SingleResult;
|
||||
import com.biomed.shared.api.dto.FrequencyDTO;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class EditClientFrequencyActivity extends BaseClientActivity {
|
||||
|
||||
@Inject
|
||||
ClientFrequencyEditorPanel view;
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
@Override
|
||||
protected boolean showNavigationPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Tabs getTab() {
|
||||
return Tabs.FREQUENCY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContentPanel(SiteContainer panel) {
|
||||
panel.setWidget(BiomedSite.CONTENT, view);
|
||||
|
||||
GetClientFrequencyAction action = new GetClientFrequencyAction();
|
||||
action.setClientId(getClientId());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<SingleResult<FrequencyDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(SingleResult<FrequencyDTO> result) {
|
||||
view.setFrequencies(result.getResult());
|
||||
}
|
||||
});
|
||||
|
||||
view.getSaveButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SaveClientFrequenciesAction action = new SaveClientFrequenciesAction();
|
||||
action.setClientId(getClientId());
|
||||
action.setFrequencies(view.getFrequencies());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel.Tabs;
|
||||
import com.biomed.shared.api.GetClientAction;
|
||||
import com.biomed.shared.api.SingleResult;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
|
||||
public class EditClientOverviewActivity extends BaseClientOverviewActivity {
|
||||
|
||||
@Override
|
||||
protected boolean showNavigationPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Tabs getTab() {
|
||||
return Tabs.OVERVIEW;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContentPanel(final SiteContainer panel) {
|
||||
setupEvents();
|
||||
fetchClient(panel, getClientId());
|
||||
}
|
||||
|
||||
private void fetchClient(final SiteContainer panel, int id) {
|
||||
GetClientAction action = new GetClientAction();
|
||||
action.setClientId(id);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<SingleResult<ClientDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(SingleResult<ClientDTO> result) {
|
||||
panel.setWidget(BiomedSite.CONTENT, view);
|
||||
client = result.getResult();
|
||||
setView(client);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.place.EditWorkorderPlace;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.clienteditor.ClientEditorSidebarPanel.Tabs;
|
||||
import com.biomed.client.ui.clienteditor.ClientWorkordersEditorPanel;
|
||||
import com.biomed.shared.api.GetWorkordersAction;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.dto.WorkorderDTO;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class EditClientWorkordersActivity extends BaseClientActivity {
|
||||
|
||||
@Inject
|
||||
ClientWorkordersEditorPanel view;
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
private ListDataProvider<WorkorderDTO> dataProvider;
|
||||
|
||||
@Override
|
||||
protected boolean showNavigationPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Tabs getTab() {
|
||||
return Tabs.WORKORDERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContentPanel(SiteContainer panel) {
|
||||
dataProvider = new ListDataProvider<WorkorderDTO>();
|
||||
dataProvider.addDataDisplay(view.getTable());
|
||||
|
||||
view.activity = this;
|
||||
|
||||
panel.setWidget(BiomedSite.CONTENT, view);
|
||||
|
||||
view.showLoading();
|
||||
|
||||
GetWorkordersAction action = new GetWorkordersAction();
|
||||
action.setClientId(getClientId());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<WorkorderDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ListResult<WorkorderDTO> result) {
|
||||
dataProvider.setList(result.getResult());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onWorkorderClicked(int id) {
|
||||
placeController.goTo(EditWorkorderPlace.getPlace(id));
|
||||
}
|
||||
}
|
136
src/com/biomed/client/activity/EditWorkorderActivity.java
Normal file
136
src/com/biomed/client/activity/EditWorkorderActivity.java
Normal file
@ -0,0 +1,136 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.place.EditWorkorderPlace;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.workorders.EditWorkorderPanel;
|
||||
import com.biomed.shared.api.DeleteWorkorderAction;
|
||||
import com.biomed.shared.api.EmptyResult;
|
||||
import com.biomed.shared.api.GetUsersAction;
|
||||
import com.biomed.shared.api.GetWorkorderViewAction;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.SaveWorkorderAction;
|
||||
import com.biomed.shared.api.SingleResult;
|
||||
import com.biomed.shared.api.dto.EditWorkorderViewDTO;
|
||||
import com.biomed.shared.api.dto.ScheduleTime;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class EditWorkorderActivity extends AbstractBiomedActivity {
|
||||
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
@Inject
|
||||
EditWorkorderPanel view;
|
||||
|
||||
private List<UserDTO> techs;
|
||||
|
||||
@Override
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
container.setWidget(BiomedSite.CONTENT, view);
|
||||
|
||||
view.getStartTimeField().setValue(ScheduleTime.H8M00A);
|
||||
view.getStartTimeField().setAcceptableValues(ScheduleTime.getValues());
|
||||
|
||||
view.getEndTimeField().setValue(ScheduleTime.H5M00P);
|
||||
view.getEndTimeField().setAcceptableValues(ScheduleTime.getValues());
|
||||
|
||||
view.getSaveButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SaveWorkorderAction action = new SaveWorkorderAction();
|
||||
action.setWorkorderReason(view.getWorkorderReasonField().getValue());
|
||||
action.setWorkorderStatus(view.getWorkorderStatusField().getValue());
|
||||
action.setActionTaken(view.getActionTakenField().getValue());
|
||||
action.setRemarks(view.getRemarksField().getValue());
|
||||
action.setId(getWorkorderId());
|
||||
action.setTechId(view.getTechField().getValue().getId());
|
||||
action.setJobDate(view.getWorkorderJobDateField().getValue());
|
||||
action.setStartTime(view.getStartTimeField().getValue());
|
||||
action.setEndTime(view.getEndTimeField().getValue());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
view.getDeleteButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (Window.confirm("Are you sure you wish to delete this workorder?")) {
|
||||
DeleteWorkorderAction action = new DeleteWorkorderAction();
|
||||
action.setWorkorderId(getWorkorderId());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
History.back();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
loadTechList();
|
||||
}
|
||||
|
||||
private void loadTechList() {
|
||||
GetUsersAction action = new GetUsersAction();
|
||||
action.setUserTypeId(1);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<UserDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ListResult<UserDTO> result) {
|
||||
techs = result.getResult();
|
||||
view.getTechField().setAcceptableValues(techs);
|
||||
loadWorkorder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadWorkorder() {
|
||||
GetWorkorderViewAction action = new GetWorkorderViewAction();
|
||||
action.setWorkorderId(getWorkorderId());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<SingleResult<EditWorkorderViewDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(SingleResult<EditWorkorderViewDTO> result) {
|
||||
EditWorkorderViewDTO data = result.getResult();
|
||||
view.setStaticValues(data);
|
||||
view.getStartTimeField().setValue(data.getWorkorderStartTime());
|
||||
view.getEndTimeField().setValue(data.getWorkorderEndTime());
|
||||
view.getWorkorderJobDateField().setValue(data.getWorkorderJobDate());
|
||||
|
||||
for (UserDTO tech : techs) {
|
||||
if (tech.getId() == data.getTechId()) {
|
||||
view.getTechField().setValue(tech);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected int getWorkorderId() {
|
||||
return ((EditWorkorderPlace) place).getId();
|
||||
}
|
||||
|
||||
}
|
36
src/com/biomed/client/activity/NewClientActivity.java
Normal file
36
src/com/biomed/client/activity/NewClientActivity.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.place.ViewClientsPlace;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
|
||||
public class NewClientActivity extends BaseClientOverviewActivity {
|
||||
|
||||
@Inject PlaceController placeController;
|
||||
@Inject BiomedService biomedService;
|
||||
|
||||
@Override
|
||||
protected boolean showNavigationPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContentPanel(final SiteContainer panel) {
|
||||
setupEvents();
|
||||
|
||||
client = new ClientDTO();
|
||||
setView(client);
|
||||
|
||||
panel.setWidget(BiomedSite.CONTENT, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveComplete() {
|
||||
placeController.goTo(ViewClientsPlace.INSTANCE);
|
||||
}
|
||||
}
|
63
src/com/biomed/client/activity/NewMessageActivity.java
Normal file
63
src/com/biomed/client/activity/NewMessageActivity.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.messages.MessageFor;
|
||||
import com.biomed.client.ui.messages.MessagesPanel;
|
||||
import com.biomed.shared.api.EmptyResult;
|
||||
import com.biomed.shared.api.SendMessageAction;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class NewMessageActivity extends AbstractBiomedActivity {
|
||||
|
||||
@Inject BiomedService biomedService;
|
||||
@Inject MessagesPanel view;
|
||||
|
||||
@Override
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
container.setWidget(BiomedSite.CONTENT, view);
|
||||
|
||||
view.getMessageForField().setValue(MessageFor.ChrisEndres);
|
||||
view.getMessageForField().setAcceptableValues(Arrays.asList(MessageFor.values()));
|
||||
|
||||
view.getSendButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SendMessageAction action = new SendMessageAction();
|
||||
action.setUserId(view.getMessageForField().getValue().getId());
|
||||
action.setName(view.getNameField().getValue());
|
||||
action.setCompany(view.getCompanyField().getValue());
|
||||
action.setPhone(view.getPhoneField().getValue());
|
||||
action.setPhoneExtension(view.getPhoneExtensionField().getValue());
|
||||
action.setTimeToReturnCall(view.getTimeToReturnCallField().getValue());
|
||||
action.setTelephoned(view.getTelephonedField().getValue());
|
||||
action.setCameToSeeYou(view.getCameToSeeYouField().getValue());
|
||||
action.setWantsToSeeYou(view.getWantsToSeeYouField().getValue());
|
||||
action.setReturnedYourCall(view.getReturnedYourCallField().getValue());
|
||||
action.setPleaseCall(view.getPleaseCallField().getValue());
|
||||
action.setWillCallAgain(view.getWillCallAgainField().getValue());
|
||||
action.setRush(view.getRushField().getValue());
|
||||
action.setSpecialAttention(view.getSpecialAttentionField().getValue());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
History.back();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
72
src/com/biomed/client/activity/ViewClientsActivity.java
Normal file
72
src/com/biomed/client/activity/ViewClientsActivity.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.place.EditClientOverviewPlace;
|
||||
import com.biomed.client.place.NewClientPlace;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.clientlist.ClientListPanel;
|
||||
import com.biomed.client.ui.clientlist.ClientListSidebarPanel;
|
||||
import com.biomed.shared.api.GetClientsAction;
|
||||
import com.biomed.shared.api.GetClientsAction.View;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class ViewClientsActivity extends AbstractBiomedActivity {
|
||||
|
||||
@Inject ClientListPanel view;
|
||||
@Inject ClientListSidebarPanel sidebar;
|
||||
@Inject PlaceController placeController;
|
||||
@Inject BiomedService biomedService;
|
||||
|
||||
private ListDataProvider<ClientDTO> dataProvider;
|
||||
private String filter;
|
||||
|
||||
@Override
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
view.activity = this;
|
||||
sidebar.activity = this;
|
||||
|
||||
dataProvider = new ListDataProvider<ClientDTO>();
|
||||
dataProvider.addDataDisplay(view.getTable());
|
||||
|
||||
container.setWidget(BiomedSite.CONTENT, view);
|
||||
container.setWidget(BiomedSite.SIDEBAR, sidebar);
|
||||
requestData();
|
||||
}
|
||||
|
||||
public void onNewClientClicked() {
|
||||
placeController.goTo(NewClientPlace.INSTANCE);
|
||||
}
|
||||
|
||||
public void onClientClicked(int id) {
|
||||
placeController.goTo(EditClientOverviewPlace.getPlace(id));
|
||||
}
|
||||
|
||||
private void requestData() {
|
||||
view.showLoading();
|
||||
|
||||
GetClientsAction action = new GetClientsAction();
|
||||
action.setView(View.CLIENT_PREVIEW);
|
||||
action.setFilter(filter);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<ClientDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ListResult<ClientDTO> result) {
|
||||
dataProvider.setList(result.getResult());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void filterTable(String filter) {
|
||||
this.filter = filter;
|
||||
requestData();
|
||||
}
|
||||
}
|
214
src/com/biomed/client/activity/ViewScheduleActivity.java
Normal file
214
src/com/biomed/client/activity/ViewScheduleActivity.java
Normal file
@ -0,0 +1,214 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.schedule.DateUtil;
|
||||
import com.biomed.client.ui.schedule.SchedulePanel;
|
||||
import com.biomed.client.ui.schedule.ScheduleSidebarPanel;
|
||||
import com.biomed.client.ui.schedule.Workorder;
|
||||
import com.biomed.shared.api.EmptyResult;
|
||||
import com.biomed.shared.api.GetClientsAction;
|
||||
import com.biomed.shared.api.GetClientsAction.View;
|
||||
import com.biomed.shared.api.GetUsersAction;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.PropertyBag;
|
||||
import com.biomed.shared.api.ScheduleAction;
|
||||
import com.biomed.shared.api.SendTechScheduleEmailAction;
|
||||
import com.biomed.shared.api.SqlResultSet;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.biomed.shared.api.dto.ScheduleTime;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderReasonDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.i18n.shared.DateTimeFormat;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class ViewScheduleActivity extends AbstractBiomedActivity {
|
||||
|
||||
private static final DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
@Inject
|
||||
SchedulePanel view;
|
||||
@Inject
|
||||
ScheduleSidebarPanel sidebar;
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
|
||||
int colorIndex = 0;
|
||||
private Map<Integer, Integer> techColorMap;
|
||||
|
||||
private Date currentDate = new Date();
|
||||
private int techId = 0;
|
||||
|
||||
@Override
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
sidebar.activity = this;
|
||||
|
||||
container.setWidget(BiomedSite.CONTENT, view);
|
||||
container.setWidget(BiomedSite.SIDEBAR, sidebar);
|
||||
|
||||
loadTechList();
|
||||
loadClients();
|
||||
|
||||
sidebar.getWorkorderStatusField().setValue(WorkorderStatusDTO.PM_DUE);
|
||||
sidebar.getWorkorderStatusField().setAcceptableValues(WorkorderStatusDTO.VALUES);
|
||||
|
||||
sidebar.getStartTimeField().setValue(ScheduleTime.H8M00A);
|
||||
sidebar.getStartTimeField().setAcceptableValues(ScheduleTime.getValues());
|
||||
|
||||
sidebar.getEndTimeField().setValue(ScheduleTime.H5M00P);
|
||||
sidebar.getEndTimeField().setAcceptableValues(ScheduleTime.getValues());
|
||||
|
||||
sidebar.getReasonField().setValue(WorkorderReasonDTO.PM_RESCHEDULE);
|
||||
sidebar.getReasonField().setAcceptableValues(WorkorderReasonDTO.VALUES);
|
||||
|
||||
sidebar.getSaveButton().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
saveWorkorder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTechId(int techId) {
|
||||
this.techId = techId;
|
||||
updateView();
|
||||
}
|
||||
|
||||
public void setDate(Date currentDate) {
|
||||
this.currentDate = currentDate;
|
||||
updateView();
|
||||
}
|
||||
|
||||
private void saveWorkorder() {
|
||||
ScheduleAction action = new ScheduleAction();
|
||||
action.setJobDate(sidebar.getJobDateField().getValue());
|
||||
action.setClientId(sidebar.getClientField().getValue().getId());
|
||||
action.setTechId(sidebar.getTechField().getValue().getId());
|
||||
action.setStartTime(sidebar.getStartTimeField().getValue());
|
||||
action.setEndTime(sidebar.getEndTimeField().getValue());
|
||||
action.setReason(sidebar.getReasonField().getValue());
|
||||
action.setRequestedBy(sidebar.getRequestedByField().getValue());
|
||||
action.setRemarks(sidebar.getRemarksField().getValue());
|
||||
action.setStatus(sidebar.getWorkorderStatusField().getValue());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
updateView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendReport() {
|
||||
SendTechScheduleEmailAction action = new SendTechScheduleEmailAction();
|
||||
action.setUserId(sidebar.getReportTechField().getValue().getId());
|
||||
action.setDate(sidebar.getReportDateField().getValue());
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<EmptyResult>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(EmptyResult result) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateView() {
|
||||
if (techId != 0) {
|
||||
loadScheduleForTech(currentDate, techId);
|
||||
} else {
|
||||
loadScheduleForDay(currentDate);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTechList() {
|
||||
GetUsersAction action = new GetUsersAction();
|
||||
action.setUserTypeId(1);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<UserDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ListResult<UserDTO> result) {
|
||||
colorIndex = 0;
|
||||
techColorMap = Maps.newHashMap();
|
||||
|
||||
for (UserDTO user : result.getResult()) {
|
||||
techColorMap.put(user.getId(), colorIndex);
|
||||
colorIndex = (colorIndex + 1) % 12;
|
||||
}
|
||||
|
||||
sidebar.setTechList(result.getResult());
|
||||
loadScheduleForDay(DateUtil.getNextWorkDay(new Date()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadScheduleForDay(final Date day) {
|
||||
biomedService.getSchedule(format.format(day), format.format(day), 0,
|
||||
new DefaultCallback<SqlResultSet>() {
|
||||
@Override
|
||||
public void onSuccess(SqlResultSet result) {
|
||||
List<Workorder> workorders = Lists.newArrayList();
|
||||
for (PropertyBag bag : result.results) {
|
||||
Workorder workorder = new Workorder(bag);
|
||||
workorder.color = techColorMap.get(workorder.techId);
|
||||
workorders.add(workorder);
|
||||
}
|
||||
view.setView(day, 1);
|
||||
view.addWorkorders(workorders);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadScheduleForTech(final Date date, final int techId) {
|
||||
final Date startDate = DateUtil.getWorkFirstDay(date);
|
||||
final Date endDate = DateUtil.addDays(date, 5);
|
||||
|
||||
biomedService.getSchedule(format.format(startDate), format.format(endDate), techId,
|
||||
new DefaultCallback<SqlResultSet>() {
|
||||
@Override
|
||||
public void onSuccess(SqlResultSet result) {
|
||||
List<Workorder> workorders = Lists.newArrayList();
|
||||
for (PropertyBag bag : result.results) {
|
||||
Workorder workorder = new Workorder(bag);
|
||||
workorder.color = techColorMap.get(workorder.techId);
|
||||
workorders.add(workorder);
|
||||
}
|
||||
view.setView(startDate, 5);
|
||||
view.addWorkorders(workorders);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadClients() {
|
||||
GetClientsAction action = new GetClientsAction();
|
||||
action.setView(View.NAMES_ONLY);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<ClientDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ListResult<ClientDTO> result) {
|
||||
ArrayList<ClientDTO> results = result.getResult();
|
||||
Collections.sort(results, new ClientDTO.IdentifierComparator());
|
||||
|
||||
sidebar.getClientField().setAcceptableValues(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
133
src/com/biomed/client/activity/ViewWorkordersActivity.java
Normal file
133
src/com/biomed/client/activity/ViewWorkordersActivity.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.biomed.client.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.AbstractBiomedActivity;
|
||||
import com.biomed.client.BiomedActivityManager.SiteContainer;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.dispatch.DefaultCallback;
|
||||
import com.biomed.client.place.EditWorkorderPlace;
|
||||
import com.biomed.client.services.BiomedService;
|
||||
import com.biomed.client.ui.workorders.WorkordersPanel;
|
||||
import com.biomed.client.ui.workorders.WorkordersSidebarPanel;
|
||||
import com.biomed.shared.api.GetClientsAction;
|
||||
import com.biomed.shared.api.GetClientsAction.View;
|
||||
import com.biomed.shared.api.GetUsersAction;
|
||||
import com.biomed.shared.api.GetWorkordersAction;
|
||||
import com.biomed.shared.api.ListResult;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class ViewWorkordersActivity extends AbstractBiomedActivity {
|
||||
|
||||
@Inject
|
||||
WorkordersPanel view;
|
||||
@Inject
|
||||
WorkordersSidebarPanel sidebar;
|
||||
@Inject
|
||||
BiomedService biomedService;
|
||||
@Inject
|
||||
PlaceController placeController;
|
||||
|
||||
private ListDataProvider<WorkorderDTO> dataProvider;
|
||||
|
||||
@Override
|
||||
public void start(SiteContainer container, EventBus eventBus) {
|
||||
|
||||
view.activity = this;
|
||||
|
||||
dataProvider = new ListDataProvider<WorkorderDTO>();
|
||||
dataProvider.addDataDisplay(view.getTable());
|
||||
|
||||
container.setWidget(BiomedSite.CONTENT, view);
|
||||
container.setWidget(BiomedSite.SIDEBAR, sidebar);
|
||||
|
||||
sidebar.getSearchButton().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
requestData();
|
||||
}
|
||||
});
|
||||
|
||||
sidebar.getWorkorderStatusField().setAcceptableValues(WorkorderStatusDTO.VALUES);
|
||||
|
||||
loadUsers();
|
||||
loadClients();
|
||||
}
|
||||
|
||||
public void onWorkorderClicked(int id) {
|
||||
placeController.goTo(EditWorkorderPlace.getPlace(id));
|
||||
}
|
||||
|
||||
private void loadUsers() {
|
||||
GetUsersAction action = new GetUsersAction();
|
||||
action.setUserTypeId(1);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<UserDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ListResult<UserDTO> result) {
|
||||
ArrayList<UserDTO> results = result.getResult();
|
||||
Collections.sort(results, new UserDTO.DisplayNameComparator());
|
||||
|
||||
sidebar.getTechField().setAcceptableValues(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadClients() {
|
||||
GetClientsAction action = new GetClientsAction();
|
||||
action.setView(View.NAMES_ONLY);
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<ClientDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ListResult<ClientDTO> result) {
|
||||
ArrayList<ClientDTO> results = result.getResult();
|
||||
Collections.sort(results, new ClientDTO.IdentifierComparator());
|
||||
|
||||
sidebar.getClientField().setAcceptableValues(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void requestData() {
|
||||
view.showLoading();
|
||||
|
||||
GetWorkordersAction action = new GetWorkordersAction();
|
||||
action.setStartDate(sidebar.getStartDateField().getValue());
|
||||
action.setEndDate(sidebar.getEndDateField().getValue());
|
||||
|
||||
UserDTO tech = sidebar.getTechField().getValue();
|
||||
if (tech != null) {
|
||||
action.setTechId(tech.getId());
|
||||
}
|
||||
|
||||
WorkorderStatusDTO status = sidebar.getWorkorderStatusField().getValue();
|
||||
if (status != null) {
|
||||
action.setWorkorderStatusId(status.getId());
|
||||
}
|
||||
|
||||
ClientDTO client = sidebar.getClientField().getValue();
|
||||
if (client != null) {
|
||||
action.setClientId(client.getId());
|
||||
}
|
||||
|
||||
biomedService.execute(action, new DefaultCallback<ListResult<WorkorderDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ListResult<WorkorderDTO> result) {
|
||||
dataProvider.setList(result.getResult());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
17
src/com/biomed/client/components/DatePicker.java
Normal file
17
src/com/biomed/client/components/DatePicker.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.biomed.client.components;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.github.gwtbootstrap.datepicker.client.ui.base.DateBoxBase;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
|
||||
public class DatePicker extends DateBoxBase {
|
||||
|
||||
private final SimplePanel panel;
|
||||
|
||||
public DatePicker() {
|
||||
this.panel = new SimplePanel();
|
||||
setElement(panel.getElement());
|
||||
setValue(new Date());
|
||||
}
|
||||
}
|
16
src/com/biomed/client/components/HeaderPanel.java
Normal file
16
src/com/biomed/client/components/HeaderPanel.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.biomed.client.components;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class HeaderPanel extends Widget {
|
||||
interface Binder extends UiBinder<DivElement, HeaderPanel> {}
|
||||
|
||||
private static Binder binder = GWT.create(Binder.class);
|
||||
|
||||
public HeaderPanel() {
|
||||
setElement(binder.createAndBindUi(this));
|
||||
}
|
||||
}
|
14
src/com/biomed/client/components/HeaderPanel.ui.xml
Normal file
14
src/com/biomed/client/components/HeaderPanel.ui.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
|
||||
<div id="top">
|
||||
<div class="wrapper">
|
||||
<div class="logo"></div>
|
||||
<a href="#" title="" class="logoText">Atlantic Biomedical</a>
|
||||
|
||||
<div class="topNav">
|
||||
<ul class="userNav">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ui:UiBinder>
|
93
src/com/biomed/client/components/NavigationPanel.java
Normal file
93
src/com/biomed/client/components/NavigationPanel.java
Normal file
@ -0,0 +1,93 @@
|
||||
package com.biomed.client.components;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.client.place.ClientsPlace;
|
||||
import com.biomed.client.place.MessagesPlace;
|
||||
import com.biomed.client.place.NewMessagePlace;
|
||||
import com.biomed.client.place.SchedulePlace;
|
||||
import com.biomed.client.place.ViewClientsPlace;
|
||||
import com.biomed.client.place.ViewSchedulePlace;
|
||||
import com.biomed.client.place.ViewWorkordersPlace;
|
||||
import com.biomed.client.place.WorkordersPlace;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.place.shared.Place;
|
||||
import com.google.gwt.place.shared.PlaceChangeEvent;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
@Singleton
|
||||
public class NavigationPanel extends Composite implements PlaceChangeEvent.Handler {
|
||||
interface Binder extends UiBinder<HTMLPanel, NavigationPanel> {}
|
||||
|
||||
private final PlaceController placeController;
|
||||
|
||||
@UiField Anchor scheduleLink;
|
||||
@UiField Anchor clientsLink;
|
||||
@UiField Anchor messagesLink;
|
||||
@UiField Anchor workordersLink;
|
||||
|
||||
Anchor activeLink;
|
||||
|
||||
@Inject
|
||||
public NavigationPanel(PlaceController placeController, EventBus eventBus, Binder binder) {
|
||||
this.placeController = placeController;
|
||||
|
||||
eventBus.addHandler(PlaceChangeEvent.TYPE, this);
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
@UiHandler("scheduleLink")
|
||||
void onScheduleLinkClicked(ClickEvent event) {
|
||||
placeController.goTo(ViewSchedulePlace.INSTANCE);
|
||||
}
|
||||
|
||||
@UiHandler("clientsLink")
|
||||
void onClientsLinkClicked(ClickEvent event) {
|
||||
placeController.goTo(ViewClientsPlace.INSTANCE);
|
||||
}
|
||||
|
||||
@UiHandler("messagesLink")
|
||||
void onMessagesLinkClicked(ClickEvent event) {
|
||||
placeController.goTo(NewMessagePlace.INSTANCE);
|
||||
}
|
||||
|
||||
@UiHandler("workordersLink")
|
||||
void onWorkordersLinkClicked(ClickEvent event) {
|
||||
placeController.goTo(ViewWorkordersPlace.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaceChange(PlaceChangeEvent event) {
|
||||
Place place = event.getNewPlace();
|
||||
|
||||
if (place instanceof ClientsPlace) {
|
||||
setLinkActive(clientsLink);
|
||||
} else if (place instanceof MessagesPlace) {
|
||||
setLinkActive(messagesLink);
|
||||
} else if (place instanceof SchedulePlace) {
|
||||
setLinkActive(scheduleLink);
|
||||
} else if (place instanceof WorkordersPlace) {
|
||||
setLinkActive(workordersLink);
|
||||
} else {
|
||||
setLinkActive(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void setLinkActive(Anchor link) {
|
||||
if (activeLink != null) {
|
||||
activeLink.removeStyleName("active");
|
||||
}
|
||||
|
||||
activeLink = link;
|
||||
activeLink.addStyleName("active");
|
||||
}
|
||||
}
|
37
src/com/biomed/client/components/NavigationPanel.ui.xml
Normal file
37
src/com/biomed/client/components/NavigationPanel.ui.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
|
||||
<g:HTMLPanel>
|
||||
<ul ui:field="navigation" class="mainNav">
|
||||
<li>
|
||||
<g:Anchor ui:field="scheduleLink" title="">
|
||||
<img src="resources/images/icons/mainnav/tables.png" alt="" />
|
||||
<span>Schedule</span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li>
|
||||
<g:Anchor ui:field="workordersLink" title="">
|
||||
<img src="resources/images/icons/mainnav/dashboard.png" alt="" />
|
||||
<span>Workorders</span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li>
|
||||
<g:Anchor ui:field="clientsLink" title="">
|
||||
<img src="resources/images/icons/mainnav/clients.png" alt="" />
|
||||
<span>Clients</span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li>
|
||||
<g:Anchor ui:field="messagesLink" title="">
|
||||
<img src="resources/images/icons/mainnav/messages.png" alt="" />
|
||||
<span>Messages</span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://atlanticbiomedical.com/ticket/" target="_blank">
|
||||
<img src="resources/images/icons/mainnav/forms.png" alt="" />
|
||||
<span>Tickets</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
251
src/com/biomed/client/components/Pager.java
Normal file
251
src/com/biomed/client/components/Pager.java
Normal file
@ -0,0 +1,251 @@
|
||||
package com.biomed.client.components;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.user.cellview.client.AbstractPager;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.view.client.HasRows;
|
||||
import com.google.gwt.view.client.Range;
|
||||
|
||||
public class Pager extends AbstractPager {
|
||||
|
||||
private final Label label;
|
||||
private final Image loading;
|
||||
|
||||
private final Anchor firstPage;
|
||||
private final Anchor prevPage;
|
||||
private final Anchor nextPage;
|
||||
private final Anchor lastPage;
|
||||
|
||||
public Pager() {
|
||||
|
||||
label = new Label();
|
||||
label.setStyleName("dataTables_info");
|
||||
|
||||
loading = new Image();
|
||||
loading.setStyleName("loading");
|
||||
loading.setUrl("resources/images/elements/loaders/9.gif");
|
||||
loading.setVisible(false);
|
||||
|
||||
firstPage = new Anchor("First");
|
||||
firstPage.setStyleName("first paginate_button");
|
||||
firstPage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
firstPage();
|
||||
}
|
||||
});
|
||||
|
||||
prevPage = new Anchor("Previous");
|
||||
prevPage.setStyleName("previous paginate_button");
|
||||
prevPage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
previousPage();
|
||||
}
|
||||
});
|
||||
|
||||
nextPage = new Anchor("Next");
|
||||
nextPage.setStyleName("next paginate_button");
|
||||
nextPage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
nextPage();
|
||||
}
|
||||
});
|
||||
|
||||
lastPage = new Anchor("Last");
|
||||
lastPage.setStyleName("last paginate_button");
|
||||
lastPage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
lastPage();
|
||||
}
|
||||
});
|
||||
|
||||
FlowPanel buttonsPanel = new FlowPanel();
|
||||
buttonsPanel.setStyleName("dataTables_paginate paging_full_numbers");
|
||||
buttonsPanel.add(firstPage);
|
||||
buttonsPanel.add(prevPage);
|
||||
buttonsPanel.add(nextPage);
|
||||
buttonsPanel.add(lastPage);
|
||||
|
||||
FlowPanel layout = new FlowPanel();
|
||||
layout.setStyleName("tableFooter");
|
||||
|
||||
layout.add(loading);
|
||||
layout.add(label);
|
||||
layout.add(buttonsPanel);
|
||||
|
||||
initWidget(layout);
|
||||
|
||||
setDisplay(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplay(HasRows display) {
|
||||
boolean disableButtons = (display == null);
|
||||
setNextPageButtonsDisabled(disableButtons);
|
||||
setPrevPageButtonsDisabled(disableButtons);
|
||||
|
||||
super.setDisplay(display);
|
||||
}
|
||||
|
||||
public void startLoading() {
|
||||
getDisplay().setRowCount(0, true);
|
||||
loading.setVisible(true);
|
||||
label.setText("Loading...");
|
||||
}
|
||||
|
||||
protected String createText() {
|
||||
// Default text is 1 based.
|
||||
NumberFormat formatter = NumberFormat.getFormat("#,###");
|
||||
HasRows display = getDisplay();
|
||||
Range range = display.getVisibleRange();
|
||||
int pageStart = range.getStart() + 1;
|
||||
int pageSize = range.getLength();
|
||||
int dataSize = display.getRowCount();
|
||||
int endIndex = Math.min(dataSize, pageStart + pageSize - 1);
|
||||
endIndex = Math.max(pageStart, endIndex);
|
||||
boolean exact = display.isRowCountExact();
|
||||
return "Showing " + formatter.format(pageStart) + " to " + formatter.format(endIndex)
|
||||
+ (exact ? " of " : " of over ") + formatter.format(dataSize) + " entries";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRangeOrRowCountChanged() {
|
||||
HasRows display = getDisplay();
|
||||
label.setText(createText());
|
||||
loading.setVisible(false);
|
||||
|
||||
// Update the prev and first buttons.
|
||||
setPrevPageButtonsDisabled(!hasPreviousPage());
|
||||
|
||||
// Update the next and last buttons.
|
||||
if (isRangeLimited() || !display.isRowCountExact()) {
|
||||
setNextPageButtonsDisabled(!hasNextPage());
|
||||
// setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the next page buttons.
|
||||
*
|
||||
* @param disabled true to disable, false to enable
|
||||
*/
|
||||
private void setNextPageButtonsDisabled(boolean disabled) {
|
||||
if (disabled) {
|
||||
lastPage.addStyleName("paginate_button_disabled");
|
||||
nextPage.addStyleName("paginate_button_disabled");
|
||||
} else {
|
||||
lastPage.removeStyleName("paginate_button_disabled");
|
||||
nextPage.removeStyleName("paginate_button_disabled");
|
||||
}
|
||||
|
||||
lastPage.setEnabled(!disabled);
|
||||
nextPage.setEnabled(!disabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the previous page buttons.
|
||||
*
|
||||
* @param disabled true to disable, false to enable
|
||||
*/
|
||||
private void setPrevPageButtonsDisabled(boolean disabled) {
|
||||
if (disabled) {
|
||||
firstPage.addStyleName("paginate_button_disabled");
|
||||
prevPage.addStyleName("paginate_button_disabled");
|
||||
} else {
|
||||
firstPage.removeStyleName("paginate_button_disabled");
|
||||
prevPage.removeStyleName("paginate_button_disabled");
|
||||
}
|
||||
|
||||
firstPage.setEnabled(!disabled);
|
||||
prevPage.setEnabled(!disabled);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void firstPage() {
|
||||
super.firstPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPage() {
|
||||
return super.getPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPageCount() {
|
||||
return super.getPageCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNextPage() {
|
||||
return super.hasNextPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNextPages(int pages) {
|
||||
return super.hasNextPages(pages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPage(int index) {
|
||||
return super.hasPage(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPreviousPage() {
|
||||
return super.hasPreviousPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPreviousPages(int pages) {
|
||||
return super.hasPreviousPages(pages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lastPage() {
|
||||
super.lastPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lastPageStart() {
|
||||
super.lastPageStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nextPage() {
|
||||
super.nextPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void previousPage() {
|
||||
super.previousPage();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPage(int index) {
|
||||
super.setPage(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPageSize(int pageSize) {
|
||||
super.setPageSize(pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPageStart(int index) {
|
||||
super.setPageStart(index);
|
||||
}
|
||||
}
|
14
src/com/biomed/client/dispatch/ClientDispatchGinModule.java
Normal file
14
src/com/biomed/client/dispatch/ClientDispatchGinModule.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.biomed.client.dispatch;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.shared.dispatch.DispatchAsync;
|
||||
import com.google.gwt.inject.client.AbstractGinModule;
|
||||
|
||||
public class ClientDispatchGinModule extends AbstractGinModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(DispatchAsync.class).to(DefaultDispatchAsync.class).in(Singleton.class);
|
||||
}
|
||||
}
|
10
src/com/biomed/client/dispatch/DefaultCallback.java
Normal file
10
src/com/biomed/client/dispatch/DefaultCallback.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.biomed.client.dispatch;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public abstract class DefaultCallback<T> implements AsyncCallback<T> {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
throw new RuntimeException(caught);
|
||||
}
|
||||
}
|
31
src/com/biomed/client/dispatch/DefaultDispatchAsync.java
Normal file
31
src/com/biomed/client/dispatch/DefaultDispatchAsync.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.biomed.client.dispatch;
|
||||
|
||||
import com.biomed.shared.dispatch.DispatchAction;
|
||||
import com.biomed.shared.dispatch.DispatchAsync;
|
||||
import com.biomed.shared.dispatch.DispatchService;
|
||||
import com.biomed.shared.dispatch.DispatchServiceAsync;
|
||||
import com.biomed.shared.dispatch.DispatchResult;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public class DefaultDispatchAsync implements DispatchAsync {
|
||||
|
||||
private static final DispatchServiceAsync realService = GWT.create(DispatchService.class);
|
||||
|
||||
public DefaultDispatchAsync() {
|
||||
}
|
||||
|
||||
public <A extends DispatchAction<R>, R extends DispatchResult> void execute(final A action,
|
||||
final AsyncCallback<R> callback) {
|
||||
realService.execute(action, new AsyncCallback<DispatchResult>() {
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onSuccess(DispatchResult result) {
|
||||
callback.onSuccess((R) result);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
5
src/com/biomed/client/place/BiomedPlace.java
Normal file
5
src/com/biomed/client/place/BiomedPlace.java
Normal file
@ -0,0 +1,5 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.Place;
|
||||
|
||||
public abstract class BiomedPlace extends Place { }
|
3
src/com/biomed/client/place/ClientsPlace.java
Normal file
3
src/com/biomed/client/place/ClientsPlace.java
Normal file
@ -0,0 +1,3 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
public abstract class ClientsPlace extends BiomedPlace { }
|
46
src/com/biomed/client/place/EditClientDevicesPlace.java
Normal file
46
src/com/biomed/client/place/EditClientDevicesPlace.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class EditClientDevicesPlace extends ClientsPlace implements HasClientId {
|
||||
|
||||
public static EditClientDevicesPlace getPlace(int id) {
|
||||
return new EditClientDevicesPlace(id);
|
||||
}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EditClientDevicesPlace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof EditClientDevicesPlace)) return false;
|
||||
|
||||
EditClientDevicesPlace other = (EditClientDevicesPlace) obj;
|
||||
|
||||
return other.id == this.id;
|
||||
}
|
||||
|
||||
@Prefix("client/device")
|
||||
public static class Tokenizer implements PlaceTokenizer<EditClientDevicesPlace> {
|
||||
|
||||
@Override
|
||||
public EditClientDevicesPlace getPlace(String token) {
|
||||
return EditClientDevicesPlace.getPlace(Integer.parseInt(token));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(EditClientDevicesPlace place) {
|
||||
return Integer.toString(place.id);
|
||||
}
|
||||
}
|
||||
}
|
46
src/com/biomed/client/place/EditClientFrequencyPlace.java
Normal file
46
src/com/biomed/client/place/EditClientFrequencyPlace.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class EditClientFrequencyPlace extends ClientsPlace implements HasClientId {
|
||||
|
||||
public static EditClientFrequencyPlace getPlace(int id) {
|
||||
return new EditClientFrequencyPlace(id);
|
||||
}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EditClientFrequencyPlace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof EditClientFrequencyPlace)) return false;
|
||||
|
||||
EditClientFrequencyPlace other = (EditClientFrequencyPlace) obj;
|
||||
|
||||
return other.id == this.id;
|
||||
}
|
||||
|
||||
@Prefix("client/frequency")
|
||||
public static class Tokenizer implements PlaceTokenizer<EditClientFrequencyPlace> {
|
||||
|
||||
@Override
|
||||
public EditClientFrequencyPlace getPlace(String token) {
|
||||
return EditClientFrequencyPlace.getPlace(Integer.parseInt(token));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(EditClientFrequencyPlace place) {
|
||||
return Integer.toString(place.id);
|
||||
}
|
||||
}
|
||||
}
|
46
src/com/biomed/client/place/EditClientOverviewPlace.java
Normal file
46
src/com/biomed/client/place/EditClientOverviewPlace.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class EditClientOverviewPlace extends ClientsPlace implements HasClientId {
|
||||
|
||||
public static EditClientOverviewPlace getPlace(int id) {
|
||||
return new EditClientOverviewPlace(id);
|
||||
}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EditClientOverviewPlace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof EditClientOverviewPlace)) return false;
|
||||
|
||||
EditClientOverviewPlace other = (EditClientOverviewPlace) obj;
|
||||
|
||||
return other.id == this.id;
|
||||
}
|
||||
|
||||
@Prefix("client/overview")
|
||||
public static class Tokenizer implements PlaceTokenizer<EditClientOverviewPlace> {
|
||||
|
||||
@Override
|
||||
public EditClientOverviewPlace getPlace(String token) {
|
||||
return EditClientOverviewPlace.getPlace(Integer.parseInt(token));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(EditClientOverviewPlace place) {
|
||||
return Integer.toString(place.id);
|
||||
}
|
||||
}
|
||||
}
|
46
src/com/biomed/client/place/EditClientWorkordersPlace.java
Normal file
46
src/com/biomed/client/place/EditClientWorkordersPlace.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class EditClientWorkordersPlace extends ClientsPlace implements HasClientId {
|
||||
|
||||
public static EditClientWorkordersPlace getPlace(int id) {
|
||||
return new EditClientWorkordersPlace(id);
|
||||
}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EditClientWorkordersPlace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof EditClientWorkordersPlace)) return false;
|
||||
|
||||
EditClientWorkordersPlace other = (EditClientWorkordersPlace) obj;
|
||||
|
||||
return other.id == this.id;
|
||||
}
|
||||
|
||||
@Prefix("client/workorders")
|
||||
public static class Tokenizer implements PlaceTokenizer<EditClientWorkordersPlace> {
|
||||
|
||||
@Override
|
||||
public EditClientWorkordersPlace getPlace(String token) {
|
||||
return EditClientWorkordersPlace.getPlace(Integer.parseInt(token));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(EditClientWorkordersPlace place) {
|
||||
return Integer.toString(place.id);
|
||||
}
|
||||
}
|
||||
}
|
45
src/com/biomed/client/place/EditWorkorderPlace.java
Normal file
45
src/com/biomed/client/place/EditWorkorderPlace.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public class EditWorkorderPlace extends WorkordersPlace {
|
||||
|
||||
public static EditWorkorderPlace getPlace(int id) {
|
||||
return new EditWorkorderPlace(id);
|
||||
}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EditWorkorderPlace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof EditWorkorderPlace)) return false;
|
||||
|
||||
EditWorkorderPlace other = (EditWorkorderPlace) obj;
|
||||
|
||||
return other.id == this.id;
|
||||
}
|
||||
|
||||
@Prefix("workorder/edit")
|
||||
public static class Tokenizer implements PlaceTokenizer<EditWorkorderPlace> {
|
||||
|
||||
@Override
|
||||
public EditWorkorderPlace getPlace(String token) {
|
||||
return EditWorkorderPlace.getPlace(Integer.parseInt(token));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(EditWorkorderPlace place) {
|
||||
return Integer.toString(place.id);
|
||||
}
|
||||
}
|
||||
}
|
5
src/com/biomed/client/place/HasClientId.java
Normal file
5
src/com/biomed/client/place/HasClientId.java
Normal file
@ -0,0 +1,5 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
public interface HasClientId {
|
||||
public int getId();
|
||||
}
|
3
src/com/biomed/client/place/MessagesPlace.java
Normal file
3
src/com/biomed/client/place/MessagesPlace.java
Normal file
@ -0,0 +1,3 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
public abstract class MessagesPlace extends BiomedPlace { }
|
23
src/com/biomed/client/place/NewClientPlace.java
Normal file
23
src/com/biomed/client/place/NewClientPlace.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class NewClientPlace extends ClientsPlace {
|
||||
public static final NewClientPlace INSTANCE = new NewClientPlace();
|
||||
private NewClientPlace() { }
|
||||
|
||||
@Prefix("client/new")
|
||||
public static class Tokenizer implements PlaceTokenizer<NewClientPlace> {
|
||||
|
||||
@Override
|
||||
public NewClientPlace getPlace(String token) {
|
||||
return NewClientPlace.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(NewClientPlace place) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
23
src/com/biomed/client/place/NewMessagePlace.java
Normal file
23
src/com/biomed/client/place/NewMessagePlace.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class NewMessagePlace extends MessagesPlace {
|
||||
public static final NewMessagePlace INSTANCE = new NewMessagePlace();
|
||||
private NewMessagePlace() { }
|
||||
|
||||
@Prefix("message/new")
|
||||
public static class Tokenizer implements PlaceTokenizer<NewMessagePlace> {
|
||||
|
||||
@Override
|
||||
public NewMessagePlace getPlace(String token) {
|
||||
return NewMessagePlace.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(NewMessagePlace place) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
3
src/com/biomed/client/place/SchedulePlace.java
Normal file
3
src/com/biomed/client/place/SchedulePlace.java
Normal file
@ -0,0 +1,3 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
public abstract class SchedulePlace extends BiomedPlace { }
|
23
src/com/biomed/client/place/ViewClientsPlace.java
Normal file
23
src/com/biomed/client/place/ViewClientsPlace.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class ViewClientsPlace extends ClientsPlace {
|
||||
public static final ViewClientsPlace INSTANCE = new ViewClientsPlace();
|
||||
private ViewClientsPlace() { }
|
||||
|
||||
@Prefix("clients")
|
||||
public static class Tokenizer implements PlaceTokenizer<ViewClientsPlace> {
|
||||
|
||||
@Override
|
||||
public ViewClientsPlace getPlace(String token) {
|
||||
return ViewClientsPlace.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(ViewClientsPlace place) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
23
src/com/biomed/client/place/ViewSchedulePlace.java
Normal file
23
src/com/biomed/client/place/ViewSchedulePlace.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class ViewSchedulePlace extends SchedulePlace {
|
||||
public static final ViewSchedulePlace INSTANCE = new ViewSchedulePlace();
|
||||
private ViewSchedulePlace() { }
|
||||
|
||||
@Prefix("schedule")
|
||||
public static class Tokenizer implements PlaceTokenizer<ViewSchedulePlace> {
|
||||
|
||||
@Override
|
||||
public ViewSchedulePlace getPlace(String token) {
|
||||
return ViewSchedulePlace.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(ViewSchedulePlace place) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
23
src/com/biomed/client/place/ViewWorkordersPlace.java
Normal file
23
src/com/biomed/client/place/ViewWorkordersPlace.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.place.shared.Prefix;
|
||||
|
||||
public final class ViewWorkordersPlace extends WorkordersPlace {
|
||||
public static final ViewWorkordersPlace INSTANCE = new ViewWorkordersPlace();
|
||||
private ViewWorkordersPlace() { }
|
||||
|
||||
@Prefix("workorders")
|
||||
public static class Tokenizer implements PlaceTokenizer<ViewWorkordersPlace> {
|
||||
|
||||
@Override
|
||||
public ViewWorkordersPlace getPlace(String token) {
|
||||
return ViewWorkordersPlace.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken(ViewWorkordersPlace place) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
3
src/com/biomed/client/place/WorkordersPlace.java
Normal file
3
src/com/biomed/client/place/WorkordersPlace.java
Normal file
@ -0,0 +1,3 @@
|
||||
package com.biomed.client.place;
|
||||
|
||||
public abstract class WorkordersPlace extends BiomedPlace { }
|
158
src/com/biomed/client/resources/BiomedAppointmentStyle.java
Normal file
158
src/com/biomed/client/resources/BiomedAppointmentStyle.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.biomed.client.resources;
|
||||
|
||||
import com.bradrydzewski.gwt.calendar.client.ThemeAppointmentStyle;
|
||||
|
||||
class BiomedAppointmentStyle implements ThemeAppointmentStyle {
|
||||
|
||||
public BiomedAppointmentStyle(String border, String background) {
|
||||
super();
|
||||
|
||||
// set the border
|
||||
this.border = "#979797";
|
||||
this.selectedBorder = border;
|
||||
|
||||
// set the body text
|
||||
this.text = "#777";
|
||||
this.selectedText = text;
|
||||
|
||||
// set the header text
|
||||
this.headerText = "#1D1D1D";
|
||||
this.selectedHeaderText = headerText;
|
||||
|
||||
// set the background colors
|
||||
this.background = background;
|
||||
this.selectedBackground = background;
|
||||
|
||||
// set the header colors to the same color as the border
|
||||
this.backgroundHeader = background;
|
||||
this.selectedBackgroundHeader = background;
|
||||
|
||||
}
|
||||
|
||||
protected String selectedBorder;
|
||||
protected String selectedBackground;
|
||||
protected String selectedBackgroundImage;
|
||||
protected String selectedBackgroundHeader;
|
||||
protected String selectedBackgroundFooter;
|
||||
protected String selectedText;
|
||||
protected String selectedHeaderText;
|
||||
protected String border;
|
||||
protected String background;
|
||||
protected String backgroundImage;
|
||||
protected String backgroundHeader;
|
||||
protected String backgroundFooter;
|
||||
protected String text;
|
||||
protected String headerText;
|
||||
|
||||
public String getSelectedBorder() {
|
||||
return selectedBorder;
|
||||
}
|
||||
|
||||
public String getSelectedBackground() {
|
||||
return selectedBackground;
|
||||
}
|
||||
|
||||
public String getSelectedBackgroundHeader() {
|
||||
return selectedBackgroundHeader;
|
||||
}
|
||||
|
||||
public String getSelectedBackgroundFooter() {
|
||||
return selectedBackgroundFooter;
|
||||
}
|
||||
|
||||
public String getSelectedText() {
|
||||
return selectedText;
|
||||
}
|
||||
|
||||
public String getSelectedHeaderText() {
|
||||
return selectedHeaderText;
|
||||
}
|
||||
|
||||
public String getBorder() {
|
||||
return border;
|
||||
}
|
||||
|
||||
public String getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
public String getBackgroundHeader() {
|
||||
return backgroundHeader;
|
||||
}
|
||||
|
||||
public String getBackgroundFooter() {
|
||||
return backgroundFooter;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getHeaderText() {
|
||||
return headerText;
|
||||
}
|
||||
|
||||
public void setSelectedBorder(String selectedBorder) {
|
||||
this.selectedBorder = selectedBorder;
|
||||
}
|
||||
|
||||
public void setSelectedBackground(String selectedBackground) {
|
||||
this.selectedBackground = selectedBackground;
|
||||
}
|
||||
|
||||
public void setSelectedBackgroundHeader(String selectedBackgroundHeader) {
|
||||
this.selectedBackgroundHeader = selectedBackgroundHeader;
|
||||
}
|
||||
|
||||
public void setSelectedBackgroundFooter(String selectedBackgroundFooter) {
|
||||
this.selectedBackgroundFooter = selectedBackgroundFooter;
|
||||
}
|
||||
|
||||
public void setSelectedText(String selectedText) {
|
||||
this.selectedText = selectedText;
|
||||
}
|
||||
|
||||
public void setSelectedHeaderText(String selectedHeaderText) {
|
||||
this.selectedHeaderText = selectedHeaderText;
|
||||
}
|
||||
|
||||
public void setBorder(String border) {
|
||||
this.border = border;
|
||||
}
|
||||
|
||||
public void setBackground(String background) {
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
public void setBackgroundHeader(String backgroundHeader) {
|
||||
this.backgroundHeader = backgroundHeader;
|
||||
}
|
||||
|
||||
public void setBackgroundFooter(String backgroundFooter) {
|
||||
this.backgroundFooter = backgroundFooter;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void setHeaderText(String headerText) {
|
||||
this.headerText = headerText;
|
||||
}
|
||||
|
||||
public String getSelectedBackgroundImage() {
|
||||
return selectedBackgroundImage;
|
||||
}
|
||||
|
||||
public String getBackgroundImage() {
|
||||
return backgroundImage;
|
||||
}
|
||||
|
||||
public void setSelectedBackgroundImage(String selectedBackgroundImage) {
|
||||
this.selectedBackgroundImage = selectedBackgroundImage;
|
||||
}
|
||||
|
||||
public void setBackgroundImage(String backgroundImage) {
|
||||
this.backgroundImage = backgroundImage;
|
||||
}
|
||||
}
|
42
src/com/biomed/client/resources/BiomedAppointmentTheme.java
Normal file
42
src/com/biomed/client/resources/BiomedAppointmentTheme.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.biomed.client.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BiomedAppointmentTheme {
|
||||
// border, background
|
||||
|
||||
public static final BiomedAppointmentStyle DARK_GRAY = new BiomedAppointmentStyle("#979797", "#C2C2C2");
|
||||
public static final BiomedAppointmentStyle BOLD_BLUE = new BiomedAppointmentStyle("#979797", "#5484ED");
|
||||
public static final BiomedAppointmentStyle BLUE = new BiomedAppointmentStyle("#979797", "#A4BDFC");
|
||||
public static final BiomedAppointmentStyle TURQUOISE = new BiomedAppointmentStyle("#979797", "#46D6DB");
|
||||
public static final BiomedAppointmentStyle GREEN = new BiomedAppointmentStyle("#979797", "#7AE7BF");
|
||||
public static final BiomedAppointmentStyle BOLD_GREEN = new BiomedAppointmentStyle("#979797", "#51B749");
|
||||
public static final BiomedAppointmentStyle YELLOW = new BiomedAppointmentStyle("#979797", "#FBD75B");
|
||||
public static final BiomedAppointmentStyle ORANGE = new BiomedAppointmentStyle("#979797", "#FFB878");
|
||||
public static final BiomedAppointmentStyle RED = new BiomedAppointmentStyle("#979797", "#FF887C");
|
||||
public static final BiomedAppointmentStyle BOLD_RED = new BiomedAppointmentStyle("#979797", "#DC2127");
|
||||
public static final BiomedAppointmentStyle PURPLE = new BiomedAppointmentStyle("#979797", "#DBADFF");
|
||||
public static final BiomedAppointmentStyle GRAY = new BiomedAppointmentStyle("#979797", "#E1E1E1");
|
||||
|
||||
public static final List<BiomedAppointmentStyle> STYLES = new ArrayList<BiomedAppointmentStyle>();
|
||||
|
||||
static {
|
||||
STYLES.add(DARK_GRAY);
|
||||
STYLES.add(BOLD_BLUE);
|
||||
STYLES.add(BLUE);
|
||||
STYLES.add(TURQUOISE);
|
||||
STYLES.add(GREEN);
|
||||
STYLES.add(BOLD_GREEN);
|
||||
STYLES.add(YELLOW);
|
||||
STYLES.add(ORANGE);
|
||||
STYLES.add(RED);
|
||||
STYLES.add(BOLD_RED);
|
||||
STYLES.add(PURPLE);
|
||||
STYLES.add(GRAY);
|
||||
|
||||
}
|
||||
|
||||
private BiomedAppointmentTheme() {
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.biomed.client.resources;
|
||||
|
||||
import com.biomed.client.ui.schedule.BiomedAppointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.Appointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.ThemeAppointmentStyle;
|
||||
import com.bradrydzewski.gwt.calendar.client.dayview.DayViewStyleManager;
|
||||
|
||||
public class BiomedDayViewStyleManager extends DayViewStyleManager {
|
||||
@Override
|
||||
protected ThemeAppointmentStyle getDefaultViewAppointmentStyleForTheme() {
|
||||
return BiomedAppointmentTheme.GRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ThemeAppointmentStyle getViewAppointmentStyleForTheme(Appointment appointment) {
|
||||
return ((BiomedAppointment) appointment).getTheme();
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.biomed.client.resources;
|
||||
|
||||
import com.biomed.client.ui.schedule.BiomedAppointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.Appointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.ThemeAppointmentStyle;
|
||||
import com.bradrydzewski.gwt.calendar.client.monthview.MonthViewStyleManager;
|
||||
|
||||
public class BiomedMonthViewStyleManager extends MonthViewStyleManager {
|
||||
|
||||
@Override
|
||||
protected ThemeAppointmentStyle getDefaultViewAppointmentStyleForTheme() {
|
||||
return BiomedAppointmentTheme.GRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ThemeAppointmentStyle getViewAppointmentStyleForTheme(Appointment appointment) {
|
||||
return ((BiomedAppointment) appointment).getTheme();
|
||||
}
|
||||
}
|
96
src/com/biomed/client/resources/CellTableResource.css
Normal file
96
src/com/biomed/client/resources/CellTableResource.css
Normal file
@ -0,0 +1,96 @@
|
||||
.cellTableWidget {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cellTableFirstColumn {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.cellTableLastColumn {
|
||||
|
||||
}
|
||||
|
||||
.cellTableFooter {
|
||||
}
|
||||
|
||||
.cellTableHeader {
|
||||
text-align: center; font-size: 11px; padding: 3px 5px 2px 5px; color: #909090; background: #eee;
|
||||
}
|
||||
|
||||
.cellTableCell {
|
||||
border-left: 1px solid #DFDFDF; box-shadow: 0 1px 0 #fafafa inset; -webkit-box-shadow: 0 1px 0 #fafafa inset; -moz-box-shadow: 0 1px 0 #fafafa inset;
|
||||
padding: 7px 11px; vertical-align: middle;
|
||||
}
|
||||
|
||||
.cellTableFirstColumnFooter {
|
||||
}
|
||||
|
||||
.cellTableFirstColumnHeader {
|
||||
}
|
||||
|
||||
.cellTableLastColumnFooter {
|
||||
|
||||
}
|
||||
|
||||
.cellTableLastColumnHeader {
|
||||
|
||||
}
|
||||
|
||||
.cellTableSortableHeader {
|
||||
}
|
||||
|
||||
.cellTableSortableHeader:hover {
|
||||
}
|
||||
|
||||
.cellTableSortedHeaderAscending {
|
||||
|
||||
}
|
||||
|
||||
.cellTableSortedHeaderDescending {
|
||||
|
||||
}
|
||||
|
||||
.cellTableEvenRow {
|
||||
background: #f2f2f2;
|
||||
border-top: 1px solid #DFDFDF;
|
||||
}
|
||||
|
||||
.cellTableEvenRowCell {
|
||||
|
||||
}
|
||||
|
||||
.cellTableOddRow {
|
||||
border-top: 1px solid #DFDFDF;
|
||||
}
|
||||
|
||||
.cellTableOddRowCell {
|
||||
|
||||
}
|
||||
|
||||
.cellTableHoveredRow {
|
||||
background: #ddd;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cellTableHoveredRowCell {
|
||||
|
||||
}
|
||||
|
||||
.cellTableKeyboardSelectedRow {
|
||||
}
|
||||
|
||||
.cellTableKeyboardSelectedRowCell {
|
||||
|
||||
}
|
||||
|
||||
.cellTableSelectedRow {
|
||||
}
|
||||
|
||||
.cellTableSelectedRowCell {
|
||||
}
|
||||
|
||||
.cellTableKeyboardSelectedCell {
|
||||
}
|
||||
|
||||
.cellTableLoading {
|
||||
}
|
17
src/com/biomed/client/resources/CellTableResource.java
Normal file
17
src/com/biomed/client/resources/CellTableResource.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.biomed.client.resources;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.CellTable.Resources;
|
||||
|
||||
public interface CellTableResource extends Resources {
|
||||
|
||||
public CellTable.Resources INSTANCE =
|
||||
GWT.create(CellTableResource.class);
|
||||
|
||||
/**
|
||||
* The styles used in this widget.
|
||||
*/
|
||||
@Source("CellTableResource.css")
|
||||
CellTable.Style cellTableStyle();
|
||||
}
|
72
src/com/biomed/client/services/BiomedService.java
Normal file
72
src/com/biomed/client/services/BiomedService.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.biomed.client.services;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.client.ui.MainPanel;
|
||||
import com.biomed.shared.api.GetScheduleAction;
|
||||
import com.biomed.shared.api.GetTechListAction;
|
||||
import com.biomed.shared.api.SqlResultSet;
|
||||
import com.biomed.shared.dispatch.DispatchAction;
|
||||
import com.biomed.shared.dispatch.DispatchAsync;
|
||||
import com.biomed.shared.dispatch.DispatchResult;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
@Singleton
|
||||
public class BiomedService {
|
||||
|
||||
private static final String LOADING = "Loading...";
|
||||
private static final String SAVING = "Saving...";
|
||||
|
||||
private final MainPanel mainPanel;
|
||||
private final DispatchAsync dispatcher;
|
||||
|
||||
@Inject
|
||||
public BiomedService(MainPanel mainPanel, DispatchAsync dispatcher) {
|
||||
this.mainPanel = mainPanel;
|
||||
this.dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
public <A extends DispatchAction<R>, R extends DispatchResult> void execute(A action,
|
||||
AsyncCallback<R> callback) {
|
||||
dispatcher.execute(action, createCallback(LOADING, callback));
|
||||
}
|
||||
|
||||
public void getSchedule(String startDate, String endDate, int techId,
|
||||
AsyncCallback<SqlResultSet> callback) {
|
||||
GetScheduleAction action = new GetScheduleAction();
|
||||
action.startDate = startDate;
|
||||
action.endDate = endDate;
|
||||
action.techId = techId;
|
||||
|
||||
dispatcher.execute(action, createCallback(LOADING, callback));
|
||||
}
|
||||
|
||||
public void getTechList(AsyncCallback<SqlResultSet> callback) {
|
||||
GetTechListAction action = new GetTechListAction();
|
||||
dispatcher.execute(action, createCallback(LOADING, callback));
|
||||
}
|
||||
|
||||
private <T extends DispatchResult> AsyncCallback<T> createCallback(final String message,
|
||||
final AsyncCallback<T> callback) {
|
||||
|
||||
if (message != null) {
|
||||
mainPanel.showMessage(message);
|
||||
}
|
||||
|
||||
return new AsyncCallback<T>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(T result) {
|
||||
callback.onSuccess(result);
|
||||
mainPanel.hideMessage();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
10
src/com/biomed/client/services/ServicesGinModule.java
Normal file
10
src/com/biomed/client/services/ServicesGinModule.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.biomed.client.services;
|
||||
|
||||
import com.google.gwt.inject.client.AbstractGinModule;
|
||||
|
||||
public class ServicesGinModule extends AbstractGinModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
}
|
12
src/com/biomed/client/ui/DashboardPanel.java
Normal file
12
src/com/biomed/client/ui/DashboardPanel.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.biomed.client.ui;
|
||||
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
|
||||
public class DashboardPanel extends Composite implements DashboardView {
|
||||
|
||||
public DashboardPanel() {
|
||||
initWidget(new Label("DashboardPanel"));
|
||||
}
|
||||
|
||||
}
|
9
src/com/biomed/client/ui/DashboardView.java
Normal file
9
src/com/biomed/client/ui/DashboardView.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.biomed.client.ui;
|
||||
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
@ImplementedBy(DashboardPanel.class)
|
||||
public interface DashboardView extends IsWidget {
|
||||
|
||||
}
|
112
src/com/biomed/client/ui/MainPanel.java
Normal file
112
src/com/biomed/client/ui/MainPanel.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.biomed.client.ui;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.biomed.client.BiomedActivityManager;
|
||||
import com.biomed.client.BiomedActivityMapper;
|
||||
import com.biomed.client.BiomedSite;
|
||||
import com.biomed.client.components.NavigationPanel;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.SpanElement;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.UIObject;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
@Singleton
|
||||
public class MainPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, MainPanel> {
|
||||
}
|
||||
|
||||
private Logger logger = Logger.getLogger("");
|
||||
|
||||
@UiField(provided = true)
|
||||
NavigationPanel navigationPanel;
|
||||
|
||||
@UiField
|
||||
SimplePanel sidebar;
|
||||
@UiField
|
||||
SimplePanel content;
|
||||
@UiField
|
||||
DivElement sidebarContainer;
|
||||
|
||||
@UiField
|
||||
DivElement loadingPanel;
|
||||
@UiField
|
||||
SpanElement message;
|
||||
|
||||
@UiField
|
||||
DivElement errorPanel;
|
||||
|
||||
@Inject
|
||||
public MainPanel(NavigationPanel navigationPanel, BiomedActivityMapper mapper, EventBus eventBus,
|
||||
Binder binder) {
|
||||
|
||||
this.navigationPanel = navigationPanel;
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
UIObject.setVisible(loadingPanel, false);
|
||||
UIObject.setVisible(errorPanel, false);
|
||||
|
||||
BiomedActivityManager activityManager = new BiomedActivityManager(mapper, eventBus);
|
||||
activityManager.setSiteDisplay(BiomedSite.CONTENT, content);
|
||||
activityManager.setSiteDisplay(BiomedSite.SIDEBAR, new SidebarPanel());
|
||||
|
||||
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
|
||||
|
||||
@Override
|
||||
public void onUncaughtException(Throwable e) {
|
||||
hideMessage();
|
||||
UIObject.setVisible(errorPanel, true);
|
||||
logger.log(Level.SEVERE, "Unhandled Exception: " + e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class SidebarPanel implements AcceptsOneWidget {
|
||||
@Override
|
||||
public void setWidget(IsWidget w) {
|
||||
boolean hasSidebar = w != null;
|
||||
|
||||
sidebar.setWidget(w);
|
||||
UIObject.setVisible(sidebarContainer, hasSidebar);
|
||||
Document.get().getDocumentElement().setClassName(hasSidebar ? "wide" : "thin");
|
||||
}
|
||||
}
|
||||
|
||||
public void beginSave() {
|
||||
}
|
||||
|
||||
public void endSave() {
|
||||
}
|
||||
|
||||
public void beginLoading() {
|
||||
showMessage("Loading...");
|
||||
}
|
||||
|
||||
public void endLoading() {
|
||||
hideMessage();
|
||||
}
|
||||
|
||||
public void showMessage(String message) {
|
||||
this.message.setInnerText(message);
|
||||
UIObject.setVisible(loadingPanel, true);
|
||||
}
|
||||
|
||||
public void hideMessage() {
|
||||
UIObject.setVisible(loadingPanel, false);
|
||||
}
|
||||
}
|
34
src/com/biomed/client/ui/MainPanel.ui.xml
Normal file
34
src/com/biomed/client/ui/MainPanel.ui.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'
|
||||
xmlns:bio="urn:import:com.biomed.client.components">
|
||||
|
||||
<g:HTMLPanel>
|
||||
<div ui:field="loadingPanel" class="loadingPanel">
|
||||
<img src="resources/images/elements/loaders/9.gif" />
|
||||
<span ui:field="message"></span>
|
||||
</div>
|
||||
|
||||
<div ui:field="errorPanel" class="errorPanel">
|
||||
An unexpected error has occurred, Please refresh your browser and try again.
|
||||
</div>
|
||||
|
||||
|
||||
<bio:HeaderPanel />
|
||||
|
||||
<div id="sidebar">
|
||||
<bio:NavigationPanel ui:field="navigationPanel" />
|
||||
|
||||
<div ui:field="sidebarContainer" class="secNav">
|
||||
<g:SimplePanel ui:field="sidebar" styleName="secWrapper" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div class="wrapper">
|
||||
<g:SimplePanel ui:field="content" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,114 @@
|
||||
package com.biomed.client.ui.clienteditor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.components.Pager;
|
||||
import com.biomed.client.resources.CellTableResource;
|
||||
import com.biomed.shared.api.dto.DeviceDTO;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.view.client.HasData;
|
||||
|
||||
public class ClientDevicesEditorPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientDevicesEditorPanel> {
|
||||
}
|
||||
|
||||
private static final DateTimeFormat format = DateTimeFormat.getShortDateFormat();
|
||||
|
||||
@UiField(provided = true) CellTable<DeviceDTO> table;
|
||||
@UiField(provided = true) Pager pager;
|
||||
|
||||
@Inject
|
||||
public ClientDevicesEditorPanel(Binder binder) {
|
||||
buildTable();
|
||||
buildPager();
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public HasData<DeviceDTO> getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
private void buildTable() {
|
||||
table = new CellTable<DeviceDTO>(20, CellTableResource.INSTANCE);
|
||||
table.setWidth("100%", true);
|
||||
|
||||
TextColumn<DeviceDTO> identifierColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getIdentifier();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> nameColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getName();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> manufacturerColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getManufacturer();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> modelColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getModel();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> serialColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getSerial();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> statusColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
return device.getStatus();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<DeviceDTO> lastPmColumn = new TextColumn<DeviceDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceDTO device) {
|
||||
if (device.getLastPm() != null) {
|
||||
return format.format(device.getLastPm());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
table.addColumn(identifierColumn, "Device ID");
|
||||
table.addColumn(nameColumn, "Device");
|
||||
table.addColumn(manufacturerColumn, "Manufacturer");
|
||||
table.addColumn(modelColumn, "Model #");
|
||||
table.addColumn(serialColumn, "Serial #");
|
||||
table.addColumn(statusColumn, "Status");
|
||||
table.addColumn(lastPmColumn, "Last Pm");
|
||||
}
|
||||
|
||||
private void buildPager() {
|
||||
pager = new Pager();
|
||||
pager.setDisplay(table);
|
||||
pager.setPageSize(20);
|
||||
}
|
||||
|
||||
public void showLoading() {
|
||||
pager.startLoading();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:bio="urn:import:com.biomed.client.components"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel styleName="widget">
|
||||
<div id="dyn2" class="shownpars">
|
||||
<cv:CellTable ui:field="table" />
|
||||
<bio:Pager ui:field="pager" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,55 @@
|
||||
package com.biomed.client.ui.clienteditor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
|
||||
public class ClientEditorSidebarPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientEditorSidebarPanel> { }
|
||||
|
||||
@UiField NavLink overviewTab;
|
||||
@UiField NavLink frequencyTab;
|
||||
@UiField NavLink devicesTab;
|
||||
@UiField NavLink workordersTab;
|
||||
|
||||
@Inject
|
||||
public ClientEditorSidebarPanel(Binder binder) {
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void setActive(Tabs tab) {
|
||||
overviewTab.setActive(tab == Tabs.OVERVIEW);
|
||||
frequencyTab.setActive(tab == Tabs.FREQUENCY);
|
||||
devicesTab.setActive(tab == Tabs.DEVICES);
|
||||
workordersTab.setActive(tab == Tabs.WORKORDERS);
|
||||
}
|
||||
|
||||
public HasClickHandlers getOverviewTab() {
|
||||
return overviewTab;
|
||||
}
|
||||
|
||||
public HasClickHandlers getFrequencyTab() {
|
||||
return frequencyTab;
|
||||
}
|
||||
|
||||
public HasClickHandlers getDevicesTab() {
|
||||
return devicesTab;
|
||||
}
|
||||
|
||||
public HasClickHandlers getWorkordersTab() {
|
||||
return workordersTab;
|
||||
}
|
||||
|
||||
public enum Tabs {
|
||||
OVERVIEW,
|
||||
FREQUENCY,
|
||||
DEVICES,
|
||||
WORKORDERS
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<g:HTMLPanel>
|
||||
<ul class="sub-nav">
|
||||
<b:NavLink ui:field="overviewTab" icon="USER" iconSize="LARGE">Overview</b:NavLink>
|
||||
<b:NavLink ui:field="frequencyTab" icon="CALENDAR" iconSize="LARGE">Frequency</b:NavLink>
|
||||
<b:NavLink ui:field="devicesTab" icon="HDD" iconSize="LARGE">Devices</b:NavLink>
|
||||
<b:NavLink ui:field="workordersTab" icon="TASKS" iconSize="LARGE">Workorders</b:NavLink>
|
||||
</ul>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,128 @@
|
||||
package com.biomed.client.ui.clienteditor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.shared.api.dto.FrequencyDTO;
|
||||
import com.biomed.shared.api.dto.FrequencyType;
|
||||
import com.biomed.shared.api.dto.Month;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.google.gwt.dom.builder.shared.HtmlBuilderFactory;
|
||||
import com.google.gwt.dom.builder.shared.TableBuilder;
|
||||
import com.google.gwt.dom.builder.shared.TableRowBuilder;
|
||||
import com.google.gwt.dom.builder.shared.TableSectionBuilder;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.NodeList;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.EventListener;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
|
||||
public class ClientFrequencyEditorPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientFrequencyEditorPanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel rootPanel;
|
||||
|
||||
Button saveButton;
|
||||
|
||||
FrequencyDTO frequencies;
|
||||
|
||||
@Inject
|
||||
public ClientFrequencyEditorPanel(Binder binder) {
|
||||
saveButton = new Button("Save");
|
||||
saveButton.setType(ButtonType.PRIMARY);
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void setFrequencies(FrequencyDTO frequencies) {
|
||||
this.frequencies = frequencies;
|
||||
|
||||
buildTable();
|
||||
}
|
||||
|
||||
public FrequencyDTO getFrequencies() {
|
||||
return frequencies;
|
||||
}
|
||||
|
||||
public HasClickHandlers getSaveButton() {
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
private void buildTable() {
|
||||
|
||||
HtmlBuilderFactory builder = HtmlBuilderFactory.get();
|
||||
|
||||
TableBuilder table = builder.createTableBuilder();
|
||||
table.className("table table-bordered frequency");
|
||||
TableSectionBuilder thead = table.startTHead();
|
||||
TableRowBuilder theadRow = thead.startTR();
|
||||
theadRow.startTH().end();
|
||||
theadRow.startTH().text("JAN").end();
|
||||
theadRow.startTH().text("FEB").end();
|
||||
theadRow.startTH().text("MAR").end();
|
||||
theadRow.startTH().text("APR").end();
|
||||
theadRow.startTH().text("MAY").end();
|
||||
theadRow.startTH().text("JUN").end();
|
||||
theadRow.startTH().text("JUL").end();
|
||||
theadRow.startTH().text("AUG").end();
|
||||
theadRow.startTH().text("SEP").end();
|
||||
theadRow.startTH().text("OCT").end();
|
||||
theadRow.startTH().text("NOV").end();
|
||||
theadRow.startTH().text("DEC").end();
|
||||
|
||||
theadRow.end();
|
||||
thead.end();
|
||||
|
||||
TableSectionBuilder tbody = table.startTBody();
|
||||
for (FrequencyType type : FrequencyType.values()) {
|
||||
TableRowBuilder tr = tbody.startTR();
|
||||
|
||||
tr.startTD().className("name").text(type.getLabel()).end();
|
||||
|
||||
for (Month month : Month.values()) {
|
||||
tr.startTD()
|
||||
.className("item " + (frequencies.getFrequency(type, month) ? "enabled" : "disabled"))
|
||||
.attribute("data-month", month.toString()).attribute("data-frequency", type.toString())
|
||||
.html(SafeHtmlUtils.fromSafeConstant("<i class=\"icon\" />")).end();
|
||||
}
|
||||
tr.end();
|
||||
}
|
||||
|
||||
TableRowBuilder tr = tbody.startTR();
|
||||
tr.startTD().colSpan(13).className("controls").id("controls").end();
|
||||
tr.end();
|
||||
|
||||
tbody.end();
|
||||
table.end();
|
||||
rootPanel.getElement().appendChild(table.finish());
|
||||
rootPanel.add(saveButton, "controls");
|
||||
|
||||
NodeList<Element> elements = rootPanel.getElement().getElementsByTagName("td");
|
||||
for (int i = 0; i < elements.getLength(); i++) {
|
||||
final com.google.gwt.user.client.Element cell = elements.getItem(i).cast();
|
||||
if (cell.getClassName().contains("item")) {
|
||||
DOM.setEventListener(cell, new EventListener() {
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
Element target = event.getCurrentTarget();
|
||||
FrequencyType type = FrequencyType.valueOf(target.getAttribute("data-frequency"));
|
||||
Month month = Month.valueOf(target.getAttribute("data-month"));
|
||||
boolean enabled = "enabled".equals(target.getClassName());
|
||||
frequencies.setFrequency(type, month, !enabled);
|
||||
target.setClassName(enabled ? "disabled" : "enabled");
|
||||
}
|
||||
});
|
||||
DOM.sinkEvents(cell, Event.ONCLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel ui:field="rootPanel">
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,160 @@
|
||||
package com.biomed.client.ui.clienteditor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.shared.api.dto.State;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.ValueListBox;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.text.shared.Renderer;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
|
||||
public class ClientOverviewEditorPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientOverviewEditorPanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
TextBox identifierField;
|
||||
|
||||
@UiField
|
||||
TextBox nameField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryAddressField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryAddress2Field;
|
||||
|
||||
@UiField
|
||||
TextBox primaryCityField;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<State> primaryStateField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryZipField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryContactField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryPhoneField;
|
||||
|
||||
@UiField
|
||||
TextBox primaryEmailField;
|
||||
|
||||
@UiField
|
||||
TextBox secondaryContactField;
|
||||
|
||||
@UiField
|
||||
TextBox secondaryPhoneField;
|
||||
|
||||
@UiField
|
||||
TextBox secondaryEmailField;
|
||||
|
||||
@UiField
|
||||
TextArea notesField;
|
||||
|
||||
@UiField
|
||||
Button saveButton;
|
||||
|
||||
@Inject
|
||||
public ClientOverviewEditorPanel(Binder binder) {
|
||||
List<State> values = Lists.newArrayList(State.values());
|
||||
|
||||
primaryStateField = new ValueListBox<State>(new StateRenderer());
|
||||
primaryStateField.setAcceptableValues(values);
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public HasValue<String> getIdentifierField() {
|
||||
return identifierField;
|
||||
}
|
||||
|
||||
public HasValue<String> getNameField() {
|
||||
return nameField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryAddressField() {
|
||||
return primaryAddressField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryAddress2Field() {
|
||||
return primaryAddress2Field;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryCityField() {
|
||||
return primaryCityField;
|
||||
}
|
||||
|
||||
public HasValue<State> getPrimaryStateField() {
|
||||
return primaryStateField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryZipField() {
|
||||
return primaryZipField;
|
||||
}
|
||||
|
||||
public HasValue<String> getNotesField() {
|
||||
return notesField;
|
||||
}
|
||||
|
||||
public HasClickHandlers getSaveButton() {
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryPhoneField() {
|
||||
return primaryPhoneField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryEmailField() {
|
||||
return primaryEmailField;
|
||||
}
|
||||
|
||||
public HasValue<String> getSecondaryPhoneField() {
|
||||
return secondaryPhoneField;
|
||||
}
|
||||
|
||||
public HasValue<String> getSecondaryEmailField() {
|
||||
return secondaryEmailField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPrimaryContactField() {
|
||||
return primaryContactField;
|
||||
}
|
||||
|
||||
public HasValue<String> getSecondaryContactField() {
|
||||
return secondaryContactField;
|
||||
}
|
||||
|
||||
private class StateRenderer implements Renderer<State> {
|
||||
|
||||
@Override
|
||||
public String render(State object) {
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(State object, Appendable appendable) throws IOException {
|
||||
if (object != null) {
|
||||
appendable.append(object.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<g:HTMLPanel styleName="widget fluid">
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Fieldset>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="identifierField">Client Identifier:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="identifierField" alternateSize="LARGE"
|
||||
b:id="identifierField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="nameField">Client Name:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="nameField" alternateSize="LARGE"
|
||||
b:id="nameField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Fieldset>
|
||||
<b:Legend>Primary Address</b:Legend>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="primaryAddressField">Address:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryAddressField" alternateSize="LARGE"
|
||||
b:id="primaryAddressField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="primaryAddress2Field">Address 2:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryAddress2Field"
|
||||
alternateSize="LARGE" b:id="primaryAddress2Field" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="primaryCityField">City:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryCityField" alternateSize="LARGE"
|
||||
b:id="primaryCityField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="primaryStateField">State:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ValueListBox ui:field="primaryStateField"
|
||||
alternateSize="LARGE" b:id="primaryStateField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="primaryZipField">Zip:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryZipField" alternateSize="LARGE"
|
||||
b:id="primaryZipField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Fieldset>
|
||||
<b:Legend>Primary Contact Information</b:Legend>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="contactField">Contact:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryContactField" alternateSize="LARGE"
|
||||
b:id="contactField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="phoneField">Phone:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryPhoneField" alternateSize="LARGE"
|
||||
b:id="phoneField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="emailField">E-Mail:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="primaryEmailField" alternateSize="LARGE"
|
||||
b:id="emailField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Fieldset>
|
||||
<b:Legend>Secondary Contact Information</b:Legend>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="contactField">Contact:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="secondaryContactField" alternateSize="LARGE"
|
||||
b:id="contactField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="phoneField">Phone:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="secondaryPhoneField" alternateSize="LARGE"
|
||||
b:id="phoneField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="emailField">E-Mail:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="secondaryEmailField" alternateSize="LARGE"
|
||||
b:id="emailField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Fieldset>
|
||||
<b:Legend>Notes</b:Legend>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="notesField">Notes:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea ui:field="notesField" alternateSize="LARGE"
|
||||
b:id="notesField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Fieldset>
|
||||
<b:FormActions>
|
||||
<b:Button ui:field="saveButton" type="PRIMARY">Save</b:Button>
|
||||
</b:FormActions>
|
||||
</b:Fieldset>
|
||||
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,122 @@
|
||||
package com.biomed.client.ui.clienteditor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.activity.EditClientWorkordersActivity;
|
||||
import com.biomed.client.components.Pager;
|
||||
import com.biomed.client.resources.CellTableResource;
|
||||
import com.biomed.shared.api.dto.WorkorderDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.view.client.CellPreviewEvent;
|
||||
import com.google.gwt.view.client.CellPreviewEvent.Handler;
|
||||
import com.google.gwt.view.client.HasData;
|
||||
|
||||
public class ClientWorkordersEditorPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientWorkordersEditorPanel> {
|
||||
}
|
||||
|
||||
private static final DateTimeFormat format = DateTimeFormat.getShortDateFormat();
|
||||
|
||||
@UiField(provided = true) CellTable<WorkorderDTO> table;
|
||||
@UiField(provided = true) Pager pager;
|
||||
|
||||
public EditClientWorkordersActivity activity;
|
||||
|
||||
@Inject
|
||||
public ClientWorkordersEditorPanel(Binder binder) {
|
||||
buildTable();
|
||||
buildPager();
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
}
|
||||
|
||||
public HasData<WorkorderDTO> getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
private void buildTable() {
|
||||
table = new CellTable<WorkorderDTO>(20, CellTableResource.INSTANCE);
|
||||
table.setWidth("100%", true);
|
||||
|
||||
TextColumn<WorkorderDTO> technicianColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getTechFirstName() + " " + workorder.getTechLastName();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> jobDateColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
if (workorder.getJobDate() != null) {
|
||||
return format.format(workorder.getJobDate());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> remarksColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getRemarks();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> reasonColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getReason();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> jobStatusColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
WorkorderStatusDTO status = WorkorderStatusDTO.getById(workorder.getJobStatusId());
|
||||
if (status != null) {
|
||||
return status.getLabel();
|
||||
} else {
|
||||
return "(Unknown)";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
table.addColumn(technicianColumn, "Technician");
|
||||
table.addColumn(jobDateColumn, "Job Date");
|
||||
table.addColumn(remarksColumn, "Remarks");
|
||||
table.addColumn(reasonColumn, "Reason");
|
||||
table.addColumn(jobStatusColumn, "Job Status");
|
||||
|
||||
table.addCellPreviewHandler(new Handler<WorkorderDTO>() {
|
||||
|
||||
@Override
|
||||
public void onCellPreview(CellPreviewEvent<WorkorderDTO> event) {
|
||||
boolean isClick = "click".equals(event.getNativeEvent().getType());
|
||||
|
||||
if (isClick) {
|
||||
activity.onWorkorderClicked(event.getValue().getWorkorderId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildPager() {
|
||||
pager = new Pager();
|
||||
pager.setDisplay(table);
|
||||
pager.setPageSize(20);
|
||||
}
|
||||
|
||||
public void showLoading() {
|
||||
pager.startLoading();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:bio="urn:import:com.biomed.client.components"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel styleName="widget">
|
||||
<div id="dyn2" class="shownpars">
|
||||
<cv:CellTable ui:field="table" />
|
||||
<bio:Pager ui:field="pager" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
109
src/com/biomed/client/ui/clientlist/ClientListPanel.java
Normal file
109
src/com/biomed/client/ui/clientlist/ClientListPanel.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.biomed.client.ui.clientlist;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.activity.ViewClientsActivity;
|
||||
import com.biomed.client.components.Pager;
|
||||
import com.biomed.client.resources.CellTableResource;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.view.client.CellPreviewEvent;
|
||||
import com.google.gwt.view.client.CellPreviewEvent.Handler;
|
||||
import com.google.gwt.view.client.HasData;
|
||||
|
||||
public class ClientListPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientListPanel> {
|
||||
}
|
||||
|
||||
@UiField(provided = true) CellTable<ClientDTO> table;
|
||||
@UiField(provided = true) Pager pager;
|
||||
|
||||
public ViewClientsActivity activity;
|
||||
|
||||
@Inject
|
||||
public ClientListPanel(Binder binder) {
|
||||
buildTable();
|
||||
buildPager();
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public HasData<ClientDTO> getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
private void buildTable() {
|
||||
table = new CellTable<ClientDTO>(20, CellTableResource.INSTANCE);
|
||||
table.setWidth("100%", true);
|
||||
|
||||
TextColumn<ClientDTO> idColumn = new TextColumn<ClientDTO>() {
|
||||
@Override
|
||||
public String getValue(ClientDTO client) {
|
||||
return client.getIdentifier();
|
||||
}
|
||||
};
|
||||
idColumn.setSortable(true);
|
||||
table.addColumn(idColumn, "ID");
|
||||
table.setColumnWidth(idColumn, 30.0, Unit.PCT);
|
||||
|
||||
TextColumn<ClientDTO> nameColumn = new TextColumn<ClientDTO>() {
|
||||
@Override
|
||||
public String getValue(ClientDTO client) {
|
||||
return client.getName();
|
||||
}
|
||||
};
|
||||
nameColumn.setSortable(true);
|
||||
table.addColumn(nameColumn, "Client Name");
|
||||
table.setColumnWidth(nameColumn, 30.0, Unit.PCT);
|
||||
|
||||
|
||||
TextColumn<ClientDTO> contactColumn = new TextColumn<ClientDTO>() {
|
||||
@Override
|
||||
public String getValue(ClientDTO client) {
|
||||
return client.getPrimaryContactName();
|
||||
}
|
||||
};
|
||||
contactColumn.setSortable(true);
|
||||
table.addColumn(contactColumn, "Contact");
|
||||
table.setColumnWidth(contactColumn, 30.0, Unit.PCT);
|
||||
|
||||
TextColumn<ClientDTO> phoneColumn = new TextColumn<ClientDTO>() {
|
||||
@Override
|
||||
public String getValue(ClientDTO client) {
|
||||
return client.getPrimaryPhone();
|
||||
}
|
||||
};
|
||||
phoneColumn.setSortable(true);
|
||||
table.addColumn(phoneColumn, "Phone");
|
||||
table.setColumnWidth(phoneColumn, 15.0, Unit.PCT);
|
||||
|
||||
table.addCellPreviewHandler(new Handler<ClientDTO>() {
|
||||
|
||||
@Override
|
||||
public void onCellPreview(CellPreviewEvent<ClientDTO> event) {
|
||||
boolean isClick = "click".equals(event.getNativeEvent().getType());
|
||||
|
||||
if (isClick) {
|
||||
activity.onClientClicked(event.getValue().getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildPager() {
|
||||
pager = new Pager();
|
||||
pager.setDisplay(table);
|
||||
pager.setPageSize(20);
|
||||
}
|
||||
|
||||
public void showLoading() {
|
||||
pager.startLoading();
|
||||
}
|
||||
}
|
11
src/com/biomed/client/ui/clientlist/ClientListPanel.ui.xml
Normal file
11
src/com/biomed/client/ui/clientlist/ClientListPanel.ui.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:bio="urn:import:com.biomed.client.components"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel styleName="widget">
|
||||
<div id="dyn2" class="shownpars">
|
||||
<cv:CellTable ui:field="table" />
|
||||
<bio:Pager ui:field="pager" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,51 @@
|
||||
package com.biomed.client.ui.clientlist;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.activity.ViewClientsActivity;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
|
||||
public class ClientListSidebarPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ClientListSidebarPanel> {}
|
||||
|
||||
public ViewClientsActivity activity;
|
||||
|
||||
@UiField Anchor addClient;
|
||||
@UiField Anchor search;
|
||||
@UiField TextBox searchBox;
|
||||
|
||||
@Inject
|
||||
public ClientListSidebarPanel(Binder binder) {
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
searchBox.addKeyPressHandler(new KeyPressHandler() {
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
activity.filterTable(searchBox.getText());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@UiHandler("addClient")
|
||||
void onAddClientClicked(ClickEvent event) {
|
||||
activity.onNewClientClicked();
|
||||
}
|
||||
|
||||
@UiHandler("search")
|
||||
void onSearchClicked(ClickEvent event) {
|
||||
activity.filterTable(searchBox.getText());
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
|
||||
|
||||
<g:HTMLPanel>
|
||||
<div class="divider">
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sideWidget">
|
||||
<g:Anchor ui:field="addClient" styleName="sideB bBlue">Add Client</g:Anchor>
|
||||
</div>
|
||||
<div class="divider">
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sideWidget">
|
||||
<div class="formRow">
|
||||
<b:ControlLabel>Search:</b:ControlLabel>
|
||||
<b:TextBox ui:field="searchBox" placeholder="type to search..."></b:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sideWidget">
|
||||
<g:Anchor ui:field="search" styleName="sideB bBlue">Search</g:Anchor>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
39
src/com/biomed/client/ui/messages/MessageFor.java
Normal file
39
src/com/biomed/client/ui/messages/MessageFor.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.biomed.client.ui.messages;
|
||||
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public enum MessageFor {
|
||||
ChrisEndres(10, "Chris Endres"),
|
||||
RyanFoley(32, "Ryan Foley"),
|
||||
AllisonHartlove(51, "Allison Hartlove"),
|
||||
CarlEndres(11, "Carl Endres"),
|
||||
WillTurner(54, "Will Turner"),
|
||||
KelliKirk(59, "Kelli Kirk");
|
||||
|
||||
private final int id;
|
||||
private final String label;
|
||||
|
||||
MessageFor(int id, String label) {
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public static class Renderer extends AbstractRenderer<MessageFor> {
|
||||
@Override
|
||||
public String render(MessageFor object) {
|
||||
if (object == null) {
|
||||
return "";
|
||||
} else {
|
||||
return object.getLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
src/com/biomed/client/ui/messages/Messages.java
Normal file
12
src/com/biomed/client/ui/messages/Messages.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.biomed.client.ui.messages;
|
||||
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
public interface Messages {
|
||||
|
||||
@ImplementedBy(MessagesPanel.class)
|
||||
public interface View extends IsWidget {
|
||||
|
||||
}
|
||||
}
|
118
src/com/biomed/client/ui/messages/MessagesPanel.java
Normal file
118
src/com/biomed/client/ui/messages/MessagesPanel.java
Normal file
@ -0,0 +1,118 @@
|
||||
package com.biomed.client.ui.messages;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.ValueListBox;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HasConstrainedValue;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
|
||||
public class MessagesPanel extends Composite implements Messages.View {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, MessagesPanel> {
|
||||
}
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<MessageFor> messageForField;
|
||||
@UiField
|
||||
TextBox nameField;
|
||||
@UiField
|
||||
TextBox companyField;
|
||||
@UiField
|
||||
TextBox phoneField;
|
||||
@UiField
|
||||
TextBox phoneExtensionField;
|
||||
@UiField
|
||||
TextBox timeToReturnCallField;
|
||||
@UiField
|
||||
CheckBox telephonedField;
|
||||
@UiField
|
||||
CheckBox cameToSeeYouField;
|
||||
@UiField
|
||||
CheckBox wantsToSeeYouField;
|
||||
@UiField
|
||||
CheckBox returnedYourCallField;
|
||||
@UiField
|
||||
CheckBox pleaseCallField;
|
||||
@UiField
|
||||
CheckBox willCallAgainField;
|
||||
@UiField
|
||||
CheckBox rushField;
|
||||
@UiField
|
||||
CheckBox specialAttentionField;
|
||||
@UiField
|
||||
Button sendButton;
|
||||
|
||||
@Inject
|
||||
public MessagesPanel(Binder binder) {
|
||||
messageForField = new ValueListBox<MessageFor>(new MessageFor.Renderer());
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public HasConstrainedValue<MessageFor> getMessageForField() {
|
||||
return messageForField;
|
||||
}
|
||||
|
||||
public HasValue<String> getNameField() {
|
||||
return nameField;
|
||||
}
|
||||
|
||||
public HasValue<String> getCompanyField() {
|
||||
return companyField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPhoneField() {
|
||||
return phoneField;
|
||||
}
|
||||
|
||||
public HasValue<String> getPhoneExtensionField() {
|
||||
return phoneExtensionField;
|
||||
}
|
||||
|
||||
public HasValue<String> getTimeToReturnCallField() {
|
||||
return timeToReturnCallField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getTelephonedField() {
|
||||
return telephonedField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getCameToSeeYouField() {
|
||||
return cameToSeeYouField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getWantsToSeeYouField() {
|
||||
return wantsToSeeYouField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getReturnedYourCallField() {
|
||||
return returnedYourCallField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getPleaseCallField() {
|
||||
return pleaseCallField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getWillCallAgainField() {
|
||||
return willCallAgainField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getRushField() {
|
||||
return rushField;
|
||||
}
|
||||
|
||||
public HasValue<Boolean> getSpecialAttentionField() {
|
||||
return specialAttentionField;
|
||||
}
|
||||
|
||||
public HasClickHandlers getSendButton() {
|
||||
return sendButton;
|
||||
}
|
||||
}
|
71
src/com/biomed/client/ui/messages/MessagesPanel.ui.xml
Normal file
71
src/com/biomed/client/ui/messages/MessagesPanel.ui.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<ui:UiBinder
|
||||
xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:dp="urn:import:com.google.gwt.user.datepicker.client"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<g:HTMLPanel styleName="widget fluid">
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Fieldset>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="messageFor">Message For:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ValueListBox b:id="messageFor" ui:field="messageForField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="name">Name:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" ui:field="nameField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="name">Company:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" ui:field="companyField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="phone">Phone:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" ui:field="phoneField" placeholder="(999) 999-9999" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="extension">Extension:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" ui:field="phoneExtensionField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="time">Time to return call:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" ui:field="timeToReturnCallField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="time"></b:ControlLabel>
|
||||
<b:Controls controlsRow="true">
|
||||
<b:CheckBox ui:field="telephonedField">Telephoned</b:CheckBox>
|
||||
<b:CheckBox ui:field="cameToSeeYouField">Came to see you</b:CheckBox>
|
||||
<b:CheckBox ui:field="wantsToSeeYouField">Wants to see you</b:CheckBox>
|
||||
<b:CheckBox ui:field="returnedYourCallField">Returned your call</b:CheckBox>
|
||||
<b:CheckBox ui:field="pleaseCallField">Please call</b:CheckBox>
|
||||
<b:CheckBox ui:field="willCallAgainField">Will call again</b:CheckBox>
|
||||
<b:CheckBox ui:field="rushField">Rush</b:CheckBox>
|
||||
<b:CheckBox ui:field="specialAttentionField">Special Attention</b:CheckBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="time">Notes:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea alternateSize="XXLARGE" ui:field="notesField" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:FormActions>
|
||||
<b:Button ui:field="sendButton" type="PRIMARY">Send</b:Button>
|
||||
</b:FormActions>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
22
src/com/biomed/client/ui/renderers/ClientDTORenderer.java
Normal file
22
src/com/biomed/client/ui/renderers/ClientDTORenderer.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.biomed.client.ui.renderers;
|
||||
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public class ClientDTORenderer extends AbstractRenderer<ClientDTO> {
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public ClientDTORenderer(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(ClientDTO object) {
|
||||
if (object != null) {
|
||||
return object.getIdentifier();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
22
src/com/biomed/client/ui/renderers/ScheduleTimeRenderer.java
Normal file
22
src/com/biomed/client/ui/renderers/ScheduleTimeRenderer.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.biomed.client.ui.renderers;
|
||||
|
||||
import com.biomed.shared.api.dto.ScheduleTime;
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public class ScheduleTimeRenderer extends AbstractRenderer<ScheduleTime> {
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public ScheduleTimeRenderer(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(ScheduleTime object) {
|
||||
if (object != null) {
|
||||
return object.getLabel();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
22
src/com/biomed/client/ui/renderers/UserDTORenderer.java
Normal file
22
src/com/biomed/client/ui/renderers/UserDTORenderer.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.biomed.client.ui.renderers;
|
||||
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public class UserDTORenderer extends AbstractRenderer<UserDTO> {
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public UserDTORenderer(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(UserDTO object) {
|
||||
if (object != null) {
|
||||
return object.getDisplayName();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.biomed.client.ui.renderers;
|
||||
|
||||
import com.biomed.shared.api.dto.WorkorderReasonDTO;
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public class WorkorderReasonDTORenderer extends AbstractRenderer<WorkorderReasonDTO> {
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public WorkorderReasonDTORenderer(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(WorkorderReasonDTO object) {
|
||||
if (object != null) {
|
||||
return object.getLabel();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.biomed.client.ui.renderers;
|
||||
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public class WorkorderStatusDTORenderer extends AbstractRenderer<WorkorderStatusDTO> {
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public WorkorderStatusDTORenderer(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(WorkorderStatusDTO object) {
|
||||
if (object != null) {
|
||||
return object.getLabel();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
16
src/com/biomed/client/ui/schedule/BiomedAppointment.java
Normal file
16
src/com/biomed/client/ui/schedule/BiomedAppointment.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import com.bradrydzewski.gwt.calendar.client.Appointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.ThemeAppointmentStyle;
|
||||
|
||||
public class BiomedAppointment extends Appointment {
|
||||
private ThemeAppointmentStyle theme;
|
||||
|
||||
public ThemeAppointmentStyle getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
public void setTheme(ThemeAppointmentStyle theme) {
|
||||
this.theme = theme;
|
||||
}
|
||||
}
|
31
src/com/biomed/client/ui/schedule/DateUtil.java
Normal file
31
src/com/biomed/client/ui/schedule/DateUtil.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class DateUtil {
|
||||
|
||||
public static Date addDays(Date date, int days) {
|
||||
return new Date(date.getTime() + (86400000 * days));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Date getWorkFirstDay(Date date) {
|
||||
Date current = date;
|
||||
while (current.getDay() != 1) {
|
||||
current = new Date(current.getTime() - 86400000);
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Date getNextWorkDay(Date date) {
|
||||
Date current = date;
|
||||
|
||||
while (current.getDay() == 0 || current.getDay() == 6) {
|
||||
current = new Date(current.getTime() + 86400000);
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
}
|
17
src/com/biomed/client/ui/schedule/Schedule.java
Normal file
17
src/com/biomed/client/ui/schedule/Schedule.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
public interface Schedule {
|
||||
|
||||
@ImplementedBy(SchedulePanel.class)
|
||||
public interface View extends IsWidget {
|
||||
|
||||
}
|
||||
|
||||
@ImplementedBy(ScheduleSidebarPanel.class)
|
||||
public interface Sidebar extends IsWidget {
|
||||
|
||||
}
|
||||
}
|
181
src/com/biomed/client/ui/schedule/SchedulePanel.java
Normal file
181
src/com/biomed/client/ui/schedule/SchedulePanel.java
Normal file
@ -0,0 +1,181 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.resources.BiomedAppointmentTheme;
|
||||
import com.bradrydzewski.gwt.calendar.client.Appointment;
|
||||
import com.bradrydzewski.gwt.calendar.client.Calendar;
|
||||
import com.bradrydzewski.gwt.calendar.client.CalendarSettings;
|
||||
import com.bradrydzewski.gwt.calendar.client.CalendarViews;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.maps.gwt.client.Geocoder;
|
||||
import com.google.maps.gwt.client.Geocoder.Callback;
|
||||
import com.google.maps.gwt.client.GeocoderRequest;
|
||||
import com.google.maps.gwt.client.GeocoderResult;
|
||||
import com.google.maps.gwt.client.GeocoderStatus;
|
||||
import com.google.maps.gwt.client.GoogleMap;
|
||||
import com.google.maps.gwt.client.LatLng;
|
||||
import com.google.maps.gwt.client.MapOptions;
|
||||
import com.google.maps.gwt.client.MapTypeId;
|
||||
import com.google.maps.gwt.client.Marker;
|
||||
import com.google.maps.gwt.client.MarkerOptions;
|
||||
|
||||
public class SchedulePanel extends Composite implements Schedule.View {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, SchedulePanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel rootPanel;
|
||||
@UiField
|
||||
FlowPanel calContainer;
|
||||
@UiField
|
||||
FlowPanel mapContainer;
|
||||
|
||||
private static final LatLng center = LatLng.create(39.257147, -76.685686);
|
||||
|
||||
private Calendar calendar;
|
||||
private GoogleMap map;
|
||||
private Geocoder geocoder;
|
||||
|
||||
private List<Marker> markers = Lists.newArrayList();
|
||||
private List<Appointment> appointments = Lists.newArrayList();
|
||||
|
||||
@Inject
|
||||
public SchedulePanel(Binder binder) {
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
buildCalendar();
|
||||
buildMap();
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
handleResize(event.getWidth(), event.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
|
||||
handleResize(Window.getClientWidth(), Window.getClientHeight());
|
||||
}
|
||||
|
||||
private void handleResize(int width, int height) {
|
||||
width = width - 312;
|
||||
height = height - 49;
|
||||
|
||||
mapContainer.setWidth(width + "px");
|
||||
mapContainer.setHeight((height * 0.40) + "px");
|
||||
calContainer.setWidth(width + "px");
|
||||
calContainer.setHeight((height * 0.60) + "px");
|
||||
|
||||
if (calendar != null) {
|
||||
calendar.doSizing();
|
||||
}
|
||||
|
||||
map.triggerResize();
|
||||
map.panTo(center);
|
||||
}
|
||||
|
||||
private void buildCalendar() {
|
||||
CalendarSettings settings = new CalendarSettings();
|
||||
settings.setEnableDragDrop(false);
|
||||
settings.setEnableDragDropCreation(false);
|
||||
|
||||
calendar = new Calendar();
|
||||
calendar.setSettings(settings);
|
||||
calendar.setView(CalendarViews.DAY);
|
||||
calendar.setWidth("100%");
|
||||
calendar.setHeight("100%");
|
||||
calContainer.add(calendar);
|
||||
}
|
||||
|
||||
public void addWorkorders(List<Workorder> workorders) {
|
||||
calendar.clearAppointments();
|
||||
appointments.clear();
|
||||
calendar.suspendLayout();
|
||||
|
||||
for (Marker m : markers) {
|
||||
m.setMap((GoogleMap) null);
|
||||
}
|
||||
markers.clear();
|
||||
|
||||
for (Workorder w : workorders) {
|
||||
String address = null;
|
||||
if (w.clientAddress != null) {
|
||||
address = w.clientAddress + "\n" + w.clientCity + ", " + w.clientState + ". " + w.clientZip;
|
||||
}
|
||||
|
||||
String description = "<b>" + w.clientName + "</b><br />(" + w.clientIdentifier + ")<br />";
|
||||
if (address != null) {
|
||||
description += "<br />" + address;
|
||||
}
|
||||
BiomedAppointment apt = new BiomedAppointment();
|
||||
apt.setTitle(w.techName);
|
||||
apt.setDescription(description);
|
||||
apt.setLocation(address);
|
||||
apt.setStart(w.jobStart);
|
||||
apt.setEnd(w.jobEnd);
|
||||
apt.setTheme(BiomedAppointmentTheme.STYLES.get(w.color));
|
||||
|
||||
calendar.addAppointment(apt);
|
||||
appointments.add(apt);
|
||||
|
||||
if (address != null) {
|
||||
GeocoderRequest request = GeocoderRequest.create();
|
||||
request.setAddress(address);
|
||||
geocoder.geocode(request, new Callback() {
|
||||
@Override
|
||||
public void handle(JsArray<GeocoderResult> a, GeocoderStatus b) {
|
||||
if (b == GeocoderStatus.OK) {
|
||||
LatLng location = a.get(0).getGeometry().getLocation();
|
||||
MarkerOptions options = MarkerOptions.create();
|
||||
options.setPosition(location);
|
||||
options.setMap(map);
|
||||
markers.add(Marker.create(options));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
calendar.resumeLayout();
|
||||
calendar.doLayout();
|
||||
}
|
||||
|
||||
public void setView(Date date, int days) {
|
||||
calendar.setDate(date, days);
|
||||
}
|
||||
|
||||
private void buildMap() {
|
||||
MapOptions myOptions = MapOptions.create();
|
||||
myOptions.setZoom(8.0);
|
||||
myOptions.setCenter(center);
|
||||
myOptions.setMapTypeId(MapTypeId.ROADMAP);
|
||||
mapContainer.setWidth("500px");
|
||||
mapContainer.setHeight("500px");
|
||||
map = GoogleMap.create(mapContainer.getElement(), myOptions);
|
||||
|
||||
MarkerOptions options = MarkerOptions.create();
|
||||
options.setPosition(center);
|
||||
options.setMap(map);
|
||||
Marker.create(options);
|
||||
|
||||
geocoder = Geocoder.create();
|
||||
}
|
||||
}
|
10
src/com/biomed/client/ui/schedule/SchedulePanel.ui.xml
Normal file
10
src/com/biomed/client/ui/schedule/SchedulePanel.ui.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<ui:UiBinder
|
||||
xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<g:HTMLPanel ui:field="rootPanel" styleName="scheduler">
|
||||
<g:FlowPanel ui:field="mapContainer" />
|
||||
<g:FlowPanel ui:field="calContainer" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
287
src/com/biomed/client/ui/schedule/ScheduleSidebarPanel.java
Normal file
287
src/com/biomed/client/ui/schedule/ScheduleSidebarPanel.java
Normal file
@ -0,0 +1,287 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.activity.ViewScheduleActivity;
|
||||
import com.biomed.client.ui.renderers.ClientDTORenderer;
|
||||
import com.biomed.client.ui.renderers.ScheduleTimeRenderer;
|
||||
import com.biomed.client.ui.renderers.UserDTORenderer;
|
||||
import com.biomed.client.ui.renderers.WorkorderReasonDTORenderer;
|
||||
import com.biomed.client.ui.renderers.WorkorderStatusDTORenderer;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.biomed.shared.api.dto.ScheduleTime;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderReasonDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.ValueListBox;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.LIElement;
|
||||
import com.google.gwt.dom.client.NodeList;
|
||||
import com.google.gwt.dom.client.UListElement;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.EventListener;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HasConstrainedValue;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
import com.google.gwt.user.datepicker.client.DateBox;
|
||||
import com.google.gwt.user.datepicker.client.DateBox.Format;
|
||||
import com.google.gwt.user.datepicker.client.DatePicker;
|
||||
|
||||
public class ScheduleSidebarPanel extends Composite implements Schedule.Sidebar {
|
||||
|
||||
public interface Templates extends SafeHtmlTemplates {
|
||||
|
||||
@Template("<li><a data=\"{1}\"><span class=\"contactName\">{0}</span><span class=\"style_away\"></span><span class=\"clear\"></span></a></li>")
|
||||
SafeHtml techItem(String name, int techId);
|
||||
}
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, ScheduleSidebarPanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
LIElement scheduleItem;
|
||||
@UiField
|
||||
LIElement techsItem;
|
||||
@UiField
|
||||
LIElement reportsItem;
|
||||
@UiField
|
||||
Anchor techsButton;
|
||||
@UiField
|
||||
Anchor scheduleButton;
|
||||
|
||||
@UiField
|
||||
HTMLPanel techs;
|
||||
@UiField
|
||||
HTMLPanel schedule;
|
||||
@UiField
|
||||
HTMLPanel reports;
|
||||
@UiField
|
||||
UListElement userListPanel;
|
||||
@UiField
|
||||
DatePicker datePicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ScheduleTime> startTimePicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ScheduleTime> endTimePicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<UserDTO> techPicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<UserDTO> reportTechPicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ClientDTO> clientPicker;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<WorkorderStatusDTO> workorderStatusField;
|
||||
|
||||
@UiField(provided = true)
|
||||
ValueListBox<WorkorderReasonDTO> reasonPicker;
|
||||
|
||||
@UiField
|
||||
Button saveButton;
|
||||
|
||||
@UiField
|
||||
Button sendReport;
|
||||
|
||||
@UiField DateBox jobDateField;
|
||||
@UiField DateBox reportDateField;
|
||||
@UiField TextBox requestedByField;
|
||||
@UiField TextBox remarksField;
|
||||
|
||||
|
||||
private final Templates templates;
|
||||
|
||||
public ViewScheduleActivity activity;
|
||||
|
||||
@Inject
|
||||
public ScheduleSidebarPanel(Binder binder, Templates templates) {
|
||||
this.templates = templates;
|
||||
|
||||
startTimePicker = new ValueListBox<ScheduleTime>(new ScheduleTimeRenderer(null));
|
||||
endTimePicker = new ValueListBox<ScheduleTime>(new ScheduleTimeRenderer(null));
|
||||
techPicker = new ValueListBox<UserDTO>(new UserDTORenderer("Please select ..."));
|
||||
reportTechPicker = new ValueListBox<UserDTO>(new UserDTORenderer("Please select ..."));
|
||||
clientPicker = new ValueListBox<ClientDTO>(new ClientDTORenderer("Please select ..."));
|
||||
workorderStatusField = new ValueListBox<WorkorderStatusDTO>(new WorkorderStatusDTORenderer(null));
|
||||
reasonPicker = new ValueListBox<WorkorderReasonDTO>(new WorkorderReasonDTORenderer(null));
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
schedule.setVisible(false);
|
||||
reports.setVisible(false);
|
||||
|
||||
Format format = new DateBox.DefaultFormat(DateTimeFormat.getShortDateFormat());
|
||||
jobDateField.setFormat(format);
|
||||
jobDateField.setValue(new Date());
|
||||
|
||||
reportDateField.setFormat(format);
|
||||
reportDateField.setValue(new Date());
|
||||
|
||||
datePicker.setValue(new Date(), false);
|
||||
}
|
||||
|
||||
public void setTechList(final List<UserDTO> techs) {
|
||||
|
||||
techPicker.setAcceptableValues(techs);
|
||||
reportTechPicker.setAcceptableValues(techs);
|
||||
|
||||
SafeHtmlBuilder builder = new SafeHtmlBuilder();
|
||||
builder.append(templates.techItem("- All Techs -", 0));
|
||||
|
||||
for (final UserDTO t : techs) {
|
||||
builder.append(templates.techItem(t.getDisplayName(), t.getId()));
|
||||
}
|
||||
userListPanel.setInnerSafeHtml(builder.toSafeHtml());
|
||||
|
||||
NodeList<Element> elements = userListPanel.getElementsByTagName("a");
|
||||
for (int i = 0; i < elements.getLength(); i++) {
|
||||
final com.google.gwt.user.client.Element anchor = elements.getItem(i).cast();
|
||||
|
||||
DOM.setEventListener(anchor, new EventListener() {
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
Element target = event.getCurrentTarget();
|
||||
|
||||
int techId = Integer.parseInt(target.getAttribute("data"));
|
||||
activity.setTechId(techId);
|
||||
|
||||
if (techId == 0) {
|
||||
techPicker.setValue(null);
|
||||
}
|
||||
for (UserDTO tech : techs) {
|
||||
if (tech.getId() == techId) {
|
||||
techPicker.setValue(tech);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
DOM.sinkEvents(anchor, Event.ONCLICK);
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("datePicker")
|
||||
void onDatePickerValueChanged(ValueChangeEvent<Date> event) {
|
||||
activity.setDate(event.getValue());
|
||||
jobDateField.setValue(event.getValue(), false);
|
||||
}
|
||||
|
||||
@UiHandler("jobDateField")
|
||||
void onJobDateFieldValueChanged(ValueChangeEvent<Date> event) {
|
||||
activity.setDate(event.getValue());
|
||||
datePicker.setValue(event.getValue(), false);
|
||||
}
|
||||
|
||||
@UiHandler("techsButton")
|
||||
void onTechsButtonClicked(ClickEvent event) {
|
||||
techsItem.setClassName("clicked");
|
||||
scheduleItem.setClassName("");
|
||||
reportsItem.setClassName("");
|
||||
techs.setVisible(true);
|
||||
schedule.setVisible(false);
|
||||
reports.setVisible(false);
|
||||
}
|
||||
|
||||
@UiHandler("scheduleButton")
|
||||
void onScheduleButtonClicked(ClickEvent event) {
|
||||
techsItem.setClassName("");
|
||||
scheduleItem.setClassName("clicked");
|
||||
reportsItem.setClassName("");
|
||||
techs.setVisible(false);
|
||||
schedule.setVisible(true);
|
||||
reports.setVisible(false);
|
||||
}
|
||||
|
||||
@UiHandler("reportButton")
|
||||
void onReportButtonClicked(ClickEvent event) {
|
||||
techsItem.setClassName("");
|
||||
scheduleItem.setClassName("");
|
||||
reportsItem.setClassName("clicked");
|
||||
techs.setVisible(false);
|
||||
schedule.setVisible(false);
|
||||
reports.setVisible(true);
|
||||
}
|
||||
|
||||
@UiHandler("techPicker")
|
||||
void onTechPickerValueChanged(ValueChangeEvent<UserDTO> event) {
|
||||
if (event.getValue() != null) {
|
||||
activity.setTechId(event.getValue().getId());
|
||||
} else {
|
||||
activity.setTechId(0);
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("sendReport")
|
||||
void onSendReportButtonClicked(ClickEvent event) {
|
||||
activity.sendReport();
|
||||
}
|
||||
|
||||
public HasValue<Date> getJobDateField() {
|
||||
return jobDateField;
|
||||
}
|
||||
|
||||
public HasValue<Date> getReportDateField() {
|
||||
return reportDateField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ScheduleTime> getStartTimeField() {
|
||||
return startTimePicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ScheduleTime> getEndTimeField() {
|
||||
return endTimePicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ClientDTO> getClientField() {
|
||||
return clientPicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<UserDTO> getTechField() {
|
||||
return techPicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<UserDTO> getReportTechField() {
|
||||
return reportTechPicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<WorkorderStatusDTO> getWorkorderStatusField() {
|
||||
return workorderStatusField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<WorkorderReasonDTO> getReasonField() {
|
||||
return reasonPicker;
|
||||
}
|
||||
|
||||
public HasValue<String> getRequestedByField() {
|
||||
return requestedByField;
|
||||
}
|
||||
|
||||
public HasValue<String> getRemarksField() {
|
||||
return remarksField;
|
||||
}
|
||||
|
||||
public HasClickHandlers getSaveButton() {
|
||||
return saveButton;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:dp="urn:import:com.google.gwt.user.datepicker.client"
|
||||
xmlns:bm="urn:import:com.biomed.client.components" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
|
||||
|
||||
<g:HTMLPanel>
|
||||
<!-- Tabs container -->
|
||||
<div id="tab-container" class="tab-container">
|
||||
<ul class="iconsLine ic3 etabs">
|
||||
<li ui:field="techsItem" class="clicked">
|
||||
<g:Anchor ui:field="techsButton">
|
||||
<span class="icos-user"></span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li ui:field="scheduleItem">
|
||||
<g:Anchor ui:field="scheduleButton">
|
||||
<span class="icos-dates"></span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
<li ui:field="reportsItem">
|
||||
<g:Anchor ui:field="reportButton">
|
||||
<span class="icos-graph"></span>
|
||||
</g:Anchor>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<g:HTMLPanel ui:field="techs">
|
||||
<dp:DatePicker ui:field="datePicker"></dp:DatePicker>
|
||||
<ul ui:field="userListPanel" class="userList"></ul>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="schedule" styleName="sideWidget">
|
||||
<div class="formRow">
|
||||
<label>Job Date:</label>
|
||||
<dp:DateBox ui:field="jobDateField"></dp:DateBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Client:</label>
|
||||
<b:ValueListBox ui:field="clientPicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Technician:</label>
|
||||
<b:ValueListBox ui:field="techPicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Start Time:</label>
|
||||
<b:ValueListBox ui:field="startTimePicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>End Time:</label>
|
||||
<b:ValueListBox ui:field="endTimePicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Reason:</label>
|
||||
<b:ValueListBox ui:field="reasonPicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Requested By:</label>
|
||||
<b:TextBox ui:field="requestedByField"></b:TextBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Remarks:</label>
|
||||
<b:TextBox ui:field="remarksField"></b:TextBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Status:</label>
|
||||
<b:ValueListBox ui:field="workorderStatusField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<b:Button ui:field="saveButton" block="true" size="SMALL"
|
||||
type="PRIMARY">Schedule</b:Button>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="reports" styleName="sideWidget">
|
||||
<div class="formRow">
|
||||
<label>Date:</label>
|
||||
<dp:DateBox ui:field="reportDateField"></dp:DateBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Technician:</label>
|
||||
<b:ValueListBox ui:field="reportTechPicker"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<b:Button ui:field="sendReport" block="true" size="SMALL"
|
||||
type="PRIMARY">Send Report</b:Button>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
52
src/com/biomed/client/ui/schedule/Workorder.java
Normal file
52
src/com/biomed/client/ui/schedule/Workorder.java
Normal file
@ -0,0 +1,52 @@
|
||||
package com.biomed.client.ui.schedule;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.biomed.shared.api.PropertyBag;
|
||||
import com.google.gwt.i18n.shared.DateTimeFormat;
|
||||
|
||||
|
||||
public class Workorder {
|
||||
public int id;
|
||||
public Date jobDate;
|
||||
public Date jobStart;
|
||||
public Date jobEnd;
|
||||
public int clientId;
|
||||
public String clientIdentifier;
|
||||
public String clientName;
|
||||
public String clientAddress;
|
||||
public String clientAddress2;
|
||||
public String clientCity;
|
||||
public String clientState;
|
||||
public String clientZip;
|
||||
public int techId;
|
||||
public String techName;
|
||||
public int color;
|
||||
|
||||
public Workorder() { }
|
||||
|
||||
public Workorder(PropertyBag bag) {
|
||||
DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
id = bag.getInteger("workorder_id");
|
||||
|
||||
jobDate = format.parse(bag.getString("job_date"));
|
||||
|
||||
int start = bag.getInteger("job_start");
|
||||
int end = bag.getInteger("job_end");
|
||||
|
||||
jobStart = new Date(jobDate.getTime() + (((start / 100 * 60) + (start % 100)) * 60000));
|
||||
jobEnd = new Date(jobDate.getTime() + (((end / 100 * 60) + (end % 100)) * 60000));
|
||||
|
||||
clientId = bag.getInteger("client_id");
|
||||
clientIdentifier = bag.getString("client_identification");
|
||||
clientName = bag.getString("client_name");
|
||||
clientAddress = bag.getString("client_address");
|
||||
clientAddress2 = bag.getString("client_address_2");
|
||||
clientCity = bag.getString("client_city");
|
||||
clientState = bag.getString("client_state");
|
||||
clientZip = bag.getString("client_zip");
|
||||
techId = bag.getInteger("tech_id");
|
||||
techName = bag.getString("tech_first_name") + " " + bag.getString("tech_last_name");
|
||||
}
|
||||
}
|
167
src/com/biomed/client/ui/workorders/EditWorkorderPanel.java
Normal file
167
src/com/biomed/client/ui/workorders/EditWorkorderPanel.java
Normal file
@ -0,0 +1,167 @@
|
||||
package com.biomed.client.ui.workorders;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.ui.renderers.ScheduleTimeRenderer;
|
||||
import com.biomed.client.ui.renderers.UserDTORenderer;
|
||||
import com.biomed.client.ui.renderers.WorkorderReasonDTORenderer;
|
||||
import com.biomed.client.ui.renderers.WorkorderStatusDTORenderer;
|
||||
import com.biomed.shared.api.dto.EditWorkorderViewDTO;
|
||||
import com.biomed.shared.api.dto.ScheduleTime;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderReasonDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.ValueListBox;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HasConstrainedValue;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.datepicker.client.DateBox;
|
||||
import com.google.gwt.user.datepicker.client.DateBox.Format;
|
||||
|
||||
public class EditWorkorderPanel extends Composite {
|
||||
interface Binder extends UiBinder<HTMLPanel, EditWorkorderPanel> {
|
||||
}
|
||||
|
||||
private static final DateTimeFormat format = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.DATE_MEDIUM);
|
||||
|
||||
@UiField
|
||||
Button saveButton;
|
||||
@UiField
|
||||
Button deleteButton;
|
||||
@UiField
|
||||
Label workorderId;
|
||||
@UiField
|
||||
Label workorderScheduledDate;
|
||||
@UiField
|
||||
Label clientName;
|
||||
@UiField
|
||||
Label clientAddress;
|
||||
@UiField
|
||||
Label clientAddress2;
|
||||
@UiField
|
||||
Label clientCity;
|
||||
@UiField
|
||||
Label clientState;
|
||||
@UiField
|
||||
Label clientZip;
|
||||
@UiField
|
||||
Label clientPhone;
|
||||
@UiField
|
||||
Label clientPrimaryContact;
|
||||
@UiField
|
||||
Label workorderStartTime;
|
||||
@UiField
|
||||
Label workorderEndTime;
|
||||
@UiField
|
||||
Label workorderTechName;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ScheduleTime> startTimePicker;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ScheduleTime> endTimePicker;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<UserDTO> techPicker;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<WorkorderReasonDTO> workorderReasonField;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<WorkorderStatusDTO> workorderStatusField;
|
||||
@UiField
|
||||
TextArea actionTakenField;
|
||||
@UiField
|
||||
TextArea remarksField;
|
||||
@UiField
|
||||
DateBox workorderJobDateField;
|
||||
|
||||
@Inject
|
||||
public EditWorkorderPanel(Binder binder) {
|
||||
startTimePicker = new ValueListBox<ScheduleTime>(new ScheduleTimeRenderer(null));
|
||||
endTimePicker = new ValueListBox<ScheduleTime>(new ScheduleTimeRenderer(null));
|
||||
techPicker = new ValueListBox<UserDTO>(new UserDTORenderer(null));
|
||||
|
||||
workorderReasonField = new ValueListBox<WorkorderReasonDTO>(
|
||||
new WorkorderReasonDTORenderer(null));
|
||||
workorderReasonField.setValue(WorkorderReasonDTO.ADD_NEW_EQUIPMENT);
|
||||
workorderReasonField.setAcceptableValues(WorkorderReasonDTO.VALUES);
|
||||
|
||||
workorderStatusField = new ValueListBox<WorkorderStatusDTO>(
|
||||
new WorkorderStatusDTORenderer(null));
|
||||
workorderStatusField.setValue(WorkorderStatusDTO.COMPLETE);
|
||||
workorderStatusField.setAcceptableValues(WorkorderStatusDTO.VALUES);
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
Format format = new DateBox.DefaultFormat(DateTimeFormat.getShortDateFormat());
|
||||
workorderJobDateField.setFormat(format);
|
||||
workorderJobDateField.setValue(new Date());
|
||||
}
|
||||
|
||||
public void setStaticValues(EditWorkorderViewDTO values) {
|
||||
workorderId.setText(Integer.toString(values.getWorkorderId()));
|
||||
if (values.getWorkorderScheduledDate() != null) {
|
||||
workorderScheduledDate.setText(format.format(values.getWorkorderScheduledDate()));
|
||||
}
|
||||
clientName.setText(values.getClientName());
|
||||
clientAddress.setText(values.getClientAddress());
|
||||
clientAddress2.setText(values.getClientAddress2());
|
||||
clientCity.setText(values.getClientCity());
|
||||
clientState.setText(values.getClientState());
|
||||
clientZip.setText(values.getClientZip());
|
||||
clientPhone.setText(values.getClientPhone());
|
||||
clientPrimaryContact.setText(values.getClientPrimaryContact());
|
||||
workorderReasonField.setValue(values.getWorkorderReason());
|
||||
workorderStatusField.setValue(values.getWorkorderStatus());
|
||||
actionTakenField.setValue(values.getActionTaken());
|
||||
remarksField.setValue(values.getRemarks());
|
||||
}
|
||||
|
||||
public HasClickHandlers getSaveButton() {
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
public HasClickHandlers getDeleteButton() {
|
||||
return deleteButton;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<WorkorderReasonDTO> getWorkorderReasonField() {
|
||||
return workorderReasonField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<WorkorderStatusDTO> getWorkorderStatusField() {
|
||||
return workorderStatusField;
|
||||
}
|
||||
|
||||
public HasValue<String> getActionTakenField() {
|
||||
return actionTakenField;
|
||||
}
|
||||
|
||||
public HasValue<String> getRemarksField() {
|
||||
return remarksField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ScheduleTime> getStartTimeField() {
|
||||
return startTimePicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ScheduleTime> getEndTimeField() {
|
||||
return endTimePicker;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<UserDTO> getTechField() {
|
||||
return techPicker;
|
||||
}
|
||||
|
||||
public HasValue<Date> getWorkorderJobDateField() {
|
||||
return workorderJobDateField;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
<ui:UiBinder
|
||||
xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'
|
||||
xmlns:bio="urn:import:com.biomed.client.components"
|
||||
xmlns:dp="urn:import:com.google.gwt.user.datepicker.client"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel styleName="widget">
|
||||
<div class="workorder">
|
||||
<div class="head">
|
||||
<div class="title">Workorder</div>
|
||||
<div class="info">
|
||||
<span class="workorderNumber">Workorder # <g:Label ui:field="workorderId" /></span>
|
||||
<i><g:Label ui:field="workorderScheduledDate" /></i>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<div class="company">
|
||||
<h5><g:Label ui:field="clientName" /></h5>
|
||||
<span><g:Label ui:field="clientAddress" /></span>
|
||||
<span><g:Label ui:field="clientAddress2" /></span>
|
||||
<span><g:Label ui:field="clientCity" />, <g:Label ui:field="clientState" />. <g:Label ui:field="clientZip" /></span>
|
||||
<span>
|
||||
Phone:
|
||||
<strong class="red"><g:Label ui:field="clientPhone" /></strong>
|
||||
</span>
|
||||
<span>
|
||||
Attn:
|
||||
<strong><g:Label ui:field="clientPrimaryContact" /></strong>
|
||||
</span>
|
||||
</div>
|
||||
<div class="schedule">
|
||||
<h5>Schedule</h5>
|
||||
<span>
|
||||
Job scheduled date:
|
||||
<dp:DateBox ui:field="workorderJobDateField"></dp:DateBox>
|
||||
</span>
|
||||
<span>
|
||||
From:
|
||||
<strong><g:Label ui:field="workorderStartTime" /></strong><b:ValueListBox ui:field="startTimePicker"></b:ValueListBox> to <strong><g:Label ui:field="workorderEndTime" /></strong><b:ValueListBox ui:field="endTimePicker"></b:ValueListBox>
|
||||
</span>
|
||||
<span>
|
||||
Tech:
|
||||
<strong><g:Label ui:field="workorderTechName" /></strong>
|
||||
<b:ValueListBox ui:field="techPicker"></b:ValueListBox>
|
||||
</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="job fluid">
|
||||
<div class="formRow">
|
||||
<div class="grid3">
|
||||
<label>Reason for call:</label>
|
||||
</div>
|
||||
<div class="grid9">
|
||||
<b:ValueListBox ui:field="workorderReasonField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<div class="grid3">
|
||||
<label>Job Status:</label>
|
||||
</div>
|
||||
<div class="grid9">
|
||||
<b:ValueListBox ui:field="workorderStatusField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<div class="grid3">
|
||||
<label>Action Taken:</label>
|
||||
</div>
|
||||
<div class="grid9">
|
||||
<b:TextArea ui:field="actionTakenField" visibleLines="4"></b:TextArea>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<div class="grid3">
|
||||
<label>Remarks:</label>
|
||||
</div>
|
||||
<div class="grid9">
|
||||
<b:TextArea ui:field="remarksField" visibleLines="4"></b:TextArea>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<b:Button ui:field="deleteButton" type="DANGER">Delete</b:Button>
|
||||
<b:Button ui:field="saveButton" type="PRIMARY">Update</b:Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
10
src/com/biomed/client/ui/workorders/Workorders.java
Normal file
10
src/com/biomed/client/ui/workorders/Workorders.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.biomed.client.ui.workorders;
|
||||
|
||||
|
||||
public interface Workorders {
|
||||
public interface Presenter {
|
||||
void onWorkorderClicked();
|
||||
void filterTable(String filter);
|
||||
}
|
||||
|
||||
}
|
130
src/com/biomed/client/ui/workorders/WorkordersPanel.java
Normal file
130
src/com/biomed/client/ui/workorders/WorkordersPanel.java
Normal file
@ -0,0 +1,130 @@
|
||||
package com.biomed.client.ui.workorders;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.activity.ViewWorkordersActivity;
|
||||
import com.biomed.client.components.Pager;
|
||||
import com.biomed.client.resources.CellTableResource;
|
||||
import com.biomed.shared.api.dto.WorkorderDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.view.client.CellPreviewEvent;
|
||||
import com.google.gwt.view.client.CellPreviewEvent.Handler;
|
||||
import com.google.gwt.view.client.HasData;
|
||||
|
||||
public class WorkordersPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, WorkordersPanel> {
|
||||
}
|
||||
|
||||
private static final DateTimeFormat format = DateTimeFormat.getShortDateFormat();
|
||||
|
||||
@UiField(provided = true) CellTable<WorkorderDTO> table;
|
||||
@UiField(provided = true) Pager pager;
|
||||
|
||||
public ViewWorkordersActivity activity;
|
||||
|
||||
@Inject
|
||||
public WorkordersPanel(Binder binder) {
|
||||
buildTable();
|
||||
buildPager();
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
}
|
||||
|
||||
public HasData<WorkorderDTO> getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
private void buildTable() {
|
||||
table = new CellTable<WorkorderDTO>(20, CellTableResource.INSTANCE);
|
||||
table.setWidth("100%", true);
|
||||
|
||||
TextColumn<WorkorderDTO> clientIdColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getClientIdentifier();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> clientNameColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getClientName();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> technicianColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getTechFirstName() + " " + workorder.getTechLastName();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> jobDateColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
if (workorder.getJobDate() != null) {
|
||||
return format.format(workorder.getJobDate());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> reasonColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
return workorder.getReason();
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<WorkorderDTO> jobStatusColumn = new TextColumn<WorkorderDTO>() {
|
||||
@Override
|
||||
public String getValue(WorkorderDTO workorder) {
|
||||
WorkorderStatusDTO status = WorkorderStatusDTO.getById(workorder.getJobStatusId());
|
||||
if (status != null) {
|
||||
return status.getLabel();
|
||||
} else {
|
||||
return "(Unknown)";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
table.addColumn(clientIdColumn, "Client ID");
|
||||
table.addColumn(clientNameColumn, "Client Name");
|
||||
table.addColumn(technicianColumn, "Technician");
|
||||
table.addColumn(jobDateColumn, "Job Date");
|
||||
table.addColumn(reasonColumn, "Reason");
|
||||
table.addColumn(jobStatusColumn, "Job Status");
|
||||
|
||||
table.addCellPreviewHandler(new Handler<WorkorderDTO>() {
|
||||
|
||||
@Override
|
||||
public void onCellPreview(CellPreviewEvent<WorkorderDTO> event) {
|
||||
boolean isClick = "click".equals(event.getNativeEvent().getType());
|
||||
|
||||
if (isClick) {
|
||||
activity.onWorkorderClicked(event.getValue().getWorkorderId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildPager() {
|
||||
pager = new Pager();
|
||||
pager.setDisplay(table);
|
||||
pager.setPageSize(20);
|
||||
}
|
||||
|
||||
public void showLoading() {
|
||||
pager.startLoading();
|
||||
}
|
||||
}
|
11
src/com/biomed/client/ui/workorders/WorkordersPanel.ui.xml
Normal file
11
src/com/biomed/client/ui/workorders/WorkordersPanel.ui.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:bio="urn:import:com.biomed.client.components"
|
||||
xmlns:cv="urn:import:com.google.gwt.user.cellview.client">
|
||||
|
||||
<g:HTMLPanel styleName="widget">
|
||||
<div id="dyn2" class="shownpars">
|
||||
<cv:CellTable ui:field="table" />
|
||||
<bio:Pager ui:field="pager" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,85 @@
|
||||
package com.biomed.client.ui.workorders;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.biomed.client.ui.renderers.ClientDTORenderer;
|
||||
import com.biomed.client.ui.renderers.UserDTORenderer;
|
||||
import com.biomed.client.ui.renderers.WorkorderStatusDTORenderer;
|
||||
import com.biomed.shared.api.dto.ClientDTO;
|
||||
import com.biomed.shared.api.dto.UserDTO;
|
||||
import com.biomed.shared.api.dto.WorkorderStatusDTO;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ValueListBox;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HasConstrainedValue;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
import com.google.gwt.user.datepicker.client.DateBox;
|
||||
import com.google.gwt.user.datepicker.client.DateBox.Format;
|
||||
|
||||
public class WorkordersSidebarPanel extends Composite {
|
||||
|
||||
interface Binder extends UiBinder<HTMLPanel, WorkordersSidebarPanel> {
|
||||
}
|
||||
|
||||
private static final String ALL = "- ALL -";
|
||||
|
||||
@UiField
|
||||
Button searchButton;
|
||||
@UiField
|
||||
DateBox startDateField;
|
||||
@UiField
|
||||
DateBox endDateField;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<ClientDTO> clientField;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<WorkorderStatusDTO> workorderStatusField;
|
||||
@UiField(provided = true)
|
||||
ValueListBox<UserDTO> techField;
|
||||
|
||||
@Inject
|
||||
public WorkordersSidebarPanel(Binder binder) {
|
||||
clientField = new ValueListBox<ClientDTO>(new ClientDTORenderer(ALL));
|
||||
workorderStatusField = new ValueListBox<WorkorderStatusDTO>(new WorkorderStatusDTORenderer(ALL));
|
||||
techField = new ValueListBox<UserDTO>(new UserDTORenderer(ALL));
|
||||
|
||||
initWidget(binder.createAndBindUi(this));
|
||||
|
||||
Format format = new DateBox.DefaultFormat(DateTimeFormat.getShortDateFormat());
|
||||
|
||||
startDateField.setFormat(format);
|
||||
startDateField.setValue(new Date());
|
||||
endDateField.setFormat(format);
|
||||
endDateField.setValue(new Date());
|
||||
}
|
||||
|
||||
public HasClickHandlers getSearchButton() {
|
||||
return searchButton;
|
||||
}
|
||||
|
||||
public HasValue<Date> getStartDateField() {
|
||||
return startDateField;
|
||||
}
|
||||
|
||||
public HasValue<Date> getEndDateField() {
|
||||
return endDateField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<ClientDTO> getClientField() {
|
||||
return clientField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<WorkorderStatusDTO> getWorkorderStatusField() {
|
||||
return workorderStatusField;
|
||||
}
|
||||
|
||||
public HasConstrainedValue<UserDTO> getTechField() {
|
||||
return techField;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:dp="urn:import:com.google.gwt.user.datepicker.client" xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
|
||||
|
||||
<g:HTMLPanel>
|
||||
<div class="sideWidget">
|
||||
<div class="formRow">
|
||||
<label>Start Date:</label>
|
||||
<dp:DateBox ui:field="startDateField"></dp:DateBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>End Date:</label>
|
||||
<dp:DateBox ui:field="endDateField"></dp:DateBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Client:</label>
|
||||
<b:ValueListBox ui:field="clientField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Workorder Status:</label>
|
||||
<b:ValueListBox ui:field="workorderStatusField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label>Technician:</label>
|
||||
<b:ValueListBox ui:field="techField"></b:ValueListBox>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<b:Button ui:field="searchButton" block="true" size="SMALL" type="INFO">Search</b:Button>
|
||||
</div>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
19
src/com/biomed/resources/BiomedConfigurator.java
Normal file
19
src/com/biomed/resources/BiomedConfigurator.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.biomed.resources;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.config.Configurator;
|
||||
import com.github.gwtbootstrap.client.ui.resources.Resources;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
public class BiomedConfigurator implements Configurator {
|
||||
|
||||
@Override
|
||||
public Resources getResources() {
|
||||
return GWT.create(BiomedResources.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasResponsiveDesign() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
18
src/com/biomed/resources/BiomedResources.java
Normal file
18
src/com/biomed/resources/BiomedResources.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.biomed.resources;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.resources.Resources;
|
||||
import com.google.gwt.resources.client.TextResource;
|
||||
|
||||
public interface BiomedResources extends Resources {
|
||||
@Source("js/bootstrap.min.js")
|
||||
TextResource bootstrapJs();
|
||||
|
||||
@Source("css/bootstrap.min.css")
|
||||
TextResource bootstrapCss();
|
||||
|
||||
@Source("css/bootstrap-responsive.css")
|
||||
TextResource bootstrapResponsiveCss();
|
||||
|
||||
@Source("css/gwt-bootstrap.css")
|
||||
TextResource gwtBootstrapCss();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user