Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

Ignore whitespace Rev 14 → Rev 26

/trunk/src/org/tela_botanica/client/DateList.java
1,21 → 1,21
/**
David Delon david.delon@clapas.net 2007
*/
 
/*
* Copyright 2006 Google Inc.
* DateList.java : filtrage des releves par date d'observation
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
* 1: Le programme initialise les filtres communes, lieu-dit et dates)
*/
 
 
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 → 26,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 → 43,41
public class DateList 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 → 106,7
 
}
 
// Fin Barre de navigation
 
 
private static final int VISIBLE_DATE_COUNT = 10;
150,9 → 134,9
private NavBar navBar=null;
 
private int count = 65000;
private int count = 0;
// Tous selectionné
// Tous selectionne
private int selectedRow = -1;
private Mediator mediator = null;
187,7 → 171,7
// header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme de l'entree "Toutes localités"
// Mise en forme de l'entree "Toutes localites"
 
selector.setCellSpacing(0);
selector.setCellPadding(0);
224,7 → 208,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%");
255,9 → 239,6
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
//updateCount();
// update()
initWidget(outer);
 
 
274,7 → 255,7
setStatusDisabled();
 
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+ station,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location ,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
315,9 → 296,9
/**
*
* Mise a jour de l'affichage, à partir des données d'inventaire deja
* Mise a jour de l'affichage, a partir des donnees d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
* donnees seront affichees
*
*/
 
327,7 → 308,7
setStatusDisabled();
 
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" + station + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) + "/"
+ startIndex + "/" + VISIBLE_DATE_COUNT,
 
new ResponseTextHandler() {
405,7 → 386,7
/*
* Positionnement index de parcours (this.startIndex) pour affichage de la
* dernière page
* derni�re page
*
* @param
* @return void
423,7 → 404,7
/**
* Affichage message d'attente et désactivation navigation
* Affichage message d'attente et d�sactivation navigation
*
* @param
* @return void
436,7 → 417,7
navBar.gotoNext.setEnabled(false);
navBar.gotoEnd.setEnabled(false);
 
setStatusText("Patientez ...");
navBar.status.setText("Patientez ...");
}
 
/**
459,35 → 440,31
// page
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
setStatusText((startIndex + 1) + " - "
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_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_DATE_COUNT) { // Des pages derrieres
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
setStatusText((startIndex + 1) + " - "
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_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;
}
500,3 → 477,8
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
*
*/