1,20 → 1,21 |
/** |
David Delon david.delon@clapas.net 2007 |
|
*/ |
|
/* |
* DateList.java : filtrage des releves par date d'observation |
* Copyright 2006 Google Inc. |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
* use this file except in compliance with the License. You may obtain a copy of |
* the License at |
* |
* 1: Le programme initialise les filtres communes, lieu-dit et dates) |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
* License for the specific language governing permissions and limitations under |
* the License. |
*/ |
|
|
package 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; |
26,6 → 27,7 |
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; |
43,42 → 45,58 |
public class DateList extends Composite { |
|
|
// Debut Barre de navigation |
|
// 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); |
bar.setStyleName("navbar"); |
status.setStyleName("status"); |
status.setWordWrap(false); |
|
HorizontalPanel buttons = new HorizontalPanel(); |
|
HorizontalPanel bar = new HorizontalPanel(); |
buttons.add(status); |
buttons.setCellHorizontalAlignment(status, |
HasHorizontalAlignment.ALIGN_RIGHT); |
buttons.setCellVerticalAlignment(status, |
HasVerticalAlignment.ALIGN_MIDDLE); |
buttons.setCellWidth(status, "100%"); |
|
bar.setStyleName("navbar"); |
status.setStyleName("status"); |
|
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(status); |
bar.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT); |
bar.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE); |
bar.setCellWidth(status, "100%"); |
|
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) { |
// Move forward a page. |
106,7 → 124,6 |
|
} |
|
// Fin Barre de navigation |
|
|
private static final int VISIBLE_DATE_COUNT = 10; |
134,9 → 151,9 |
private NavBar navBar=null; |
|
|
private int count = 0; |
private int count = 65000; |
|
// Tous selectionne |
// Tous selectionné |
private int selectedRow = -1; |
|
private Mediator mediator = null; |
171,7 → 188,7 |
// header.getCellFormatter().setWidth(0, 0, "100%"); |
|
|
// Mise en forme de l'entree "Toutes localites" |
// Mise en forme de l'entree "Toutes localités" |
|
selector.setCellSpacing(0); |
selector.setCellPadding(0); |
208,7 → 225,7 |
|
|
outer.add(header); |
inner.add(selector); // Toutes localit�s |
inner.add(selector); // Toutes localités |
inner.add(table); |
inner.setStyleName("date-List"); |
inner.setWidth("100%"); |
239,6 → 256,9 |
selector.getRowFormatter().addStyleName(0, "date-SelectedRow"); |
|
|
//updateCount(); |
// update() |
|
initWidget(outer); |
|
|
254,7 → 274,6 |
|
setStatusDisabled(); |
|
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+ station, |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) , |
new ResponseTextHandler() { |
|
296,9 → 315,9 |
|
/** |
* |
* Mise a jour de l'affichage, a partir des donnees d'inventaire deja |
* Mise a jour de l'affichage, à partir des données d'inventaire deja |
* saisies. La valeur de this.startIndex permet de determiner quelles |
* donnees seront affichees |
* données seront affichées |
* |
*/ |
|
307,7 → 326,6 |
|
setStatusDisabled(); |
|
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" + station + "/" |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) + "/" |
+ startIndex + "/" + VISIBLE_DATE_COUNT, |
|
386,7 → 404,7 |
|
/* |
* Positionnement index de parcours (this.startIndex) pour affichage de la |
* derni�re page |
* dernière page |
* |
* @param |
* @return void |
404,7 → 422,7 |
|
|
/** |
* Affichage message d'attente et d�sactivation navigation |
* Affichage message d'attente et désactivation navigation |
* |
* @param |
* @return void |
417,7 → 435,7 |
navBar.gotoNext.setEnabled(false); |
navBar.gotoEnd.setEnabled(false); |
|
navBar.status.setText("Patientez ..."); |
setStatusText("Patientez ..."); |
} |
|
/** |
440,31 → 458,35 |
// page |
navBar.gotoNext.setEnabled(true); |
navBar.gotoEnd.setEnabled(true); |
navBar.status.setText((startIndex + 1) + " - " |
setStatusText((startIndex + 1) + " - " |
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count ); |
} else { // Derniere page |
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count ); |
setStatusText((startIndex + 1) + " - " + count + " sur " + count ); |
} |
} else { // Premiere page |
if (count > VISIBLE_DATE_COUNT) { // Des pages derrieres |
navBar.gotoNext.setEnabled(true); |
navBar.gotoEnd.setEnabled(true); |
navBar.status.setText((startIndex + 1) + " - " |
setStatusText((startIndex + 1) + " - " |
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count); |
} else { |
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count); |
setStatusText((startIndex + 1) + " - " + count + " sur " + count); |
} |
} |
} |
|
else { // Pas d'inventaire, pas de navigation |
navBar.status.setText("0 - 0 sur 0"); |
setStatusText("0 - 0 sur 0"); |
} |
} |
|
|
|
private void setStatusText(String text) { |
navBar.status.setText(text); |
} |
|
|
public void setUser(String user) { |
this.user = user; |
} |
477,8 → 499,3 |
|
|
} |
|
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* |
*/ |