16,6 → 16,7 |
package org.tela_botanica.client; |
|
|
import com.google.gwt.http.client.URL; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONNumber; |
import com.google.gwt.json.client.JSONParser; |
26,7 → 27,6 |
import com.google.gwt.user.client.ui.Button; |
import com.google.gwt.user.client.ui.ClickListener; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.DockPanel; |
import com.google.gwt.user.client.ui.FlexTable; |
import com.google.gwt.user.client.ui.Grid; |
import com.google.gwt.user.client.ui.HTML; |
44,57 → 44,41 |
public class StationList extends Composite { |
|
|
|
// Barre de navigation |
// Debut Barre de navigation |
|
private class NavBar extends Composite implements ClickListener { |
|
public final DockPanel bar = new DockPanel(); |
|
public final Button gotoFirst = new Button("<<", this); |
|
public final Button gotoNext = new Button(">", this); |
|
public final Button gotoPrev = new Button("<", this); |
|
public final Button gotoEnd = new Button(">>", this); |
|
public final HTML status = new HTML(); |
|
|
public NavBar() { |
initWidget(bar); |
|
|
HorizontalPanel bar = new HorizontalPanel(); |
|
bar.setStyleName("navbar"); |
status.setStyleName("status"); |
status.setWordWrap(false); |
|
HorizontalPanel buttons = new HorizontalPanel(); |
|
buttons.add(status); |
buttons.setCellHorizontalAlignment(status, |
HasHorizontalAlignment.ALIGN_RIGHT); |
buttons.setCellVerticalAlignment(status, |
HasVerticalAlignment.ALIGN_MIDDLE); |
buttons.setCellWidth(status, "100%"); |
bar.add(status); |
bar.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT); |
bar.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE); |
bar.setCellWidth(status, "100%"); |
|
|
buttons.add(gotoFirst); |
buttons.add(gotoPrev); |
buttons.add(gotoNext); |
buttons.add(gotoEnd); |
bar.add(buttons, DockPanel.EAST); |
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT); |
bar.add(gotoFirst); |
bar.add(gotoPrev); |
bar.add(gotoNext); |
bar.add(gotoEnd); |
|
|
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT); |
|
bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE); |
initWidget(bar); |
|
|
|
|
|
} |
|
|
public void onClick(Widget sender) { |
if (sender == gotoNext) { |
123,6 → 107,8 |
|
} |
|
// Fin Barre de navigation |
|
private static final int VISIBLE_STATION_COUNT = 10; |
private static final String VALUE_UNKNOWN = "Inconnues"; |
|
260,7 → 246,7 |
|
setStatusDisabled(); |
|
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryStationList/" + user + "/" + location , |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryStationList/" + user + "/" + URL.encodeComponent(location) , |
new ResponseTextHandler() { |
|
public void onCompletion(String str) { |
312,7 → 298,7 |
|
setStatusDisabled(); |
|
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryStationList/" + user + "/" + location + "/" |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryStationList/" + user + "/" + URL.encodeComponent(location) + "/" |
+ startIndex + "/" + VISIBLE_STATION_COUNT, |
|
new ResponseTextHandler() { |
421,7 → 407,7 |
navBar.gotoNext.setEnabled(false); |
navBar.gotoEnd.setEnabled(false); |
|
setStatusText("Patientez ..."); |
navBar.status.setText("Patientez ..."); |
} |
|
/** |
444,40 → 430,34 |
// page |
navBar.gotoNext.setEnabled(true); |
navBar.gotoEnd.setEnabled(true); |
setStatusText((startIndex + 1) + " - " |
navBar.status.setText((startIndex + 1) + " - " |
+ (startIndex + VISIBLE_STATION_COUNT) + " sur " + count ); |
} else { // Derniere page |
setStatusText((startIndex + 1) + " - " + count + " sur " + count ); |
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count ); |
} |
} else { // Premiere page |
if (count > VISIBLE_STATION_COUNT) { // Des pages derrieres |
navBar.gotoNext.setEnabled(true); |
navBar.gotoEnd.setEnabled(true); |
setStatusText((startIndex + 1) + " - " |
navBar.status.setText((startIndex + 1) + " - " |
+ (startIndex + VISIBLE_STATION_COUNT) + " sur " + count); |
} else { |
setStatusText((startIndex + 1) + " - " + count + " sur " + count); |
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count); |
} |
} |
} |
|
else { // Pas d'inventaire, pas de navigation |
setStatusText("0 - 0 sur 0"); |
navBar.status.setText("0 - 0 sur 0"); |
} |
} |
|
|
|
private void setStatusText(String text) { |
navBar.status.setText(text); |
} |
|
|
public void setUser(String user) { |
this.user = user; |
} |
|
|
|
public void setStation(String station) { |
this.station = station; |