Examples of Datebox


Examples of com.cedarsolutions.client.gwt.custom.datepicker.DateBox

    /** Test getCriteria() for DateBox. */
    public void testGetCriteriaDateBox() {
        Date date = GwtDateUtils.createDate(2011, 11, 15, 19, 32, 19, 224);

        DateBox input = new DateBox();
        input.setValue(date);

        assertEquals(date, ViewDataUtils.getCriteria(input));
    }
View Full Code Here

Examples of com.cedarsolutions.client.gwt.custom.datepicker.DateBox

    /** The timestamp used for creating end dates. */
    public static final String END_TIMESTAMP = "23:59:59,999";

    /** Create a DateBox using the standard GwtDateUtils date format. */
    public static DateBox createDateBoxForDate() {
        DateBox dateBox = new DateBox();
        dateBox.setFormat(new DateBox.DefaultFormat(GwtDateUtils.getDateFormat()));
        return dateBox;
    }
View Full Code Here

Examples of com.cedarsolutions.client.gwt.custom.datepicker.DateBox

        return dateBox;
    }

    /** Create a DateBox using the standard GwtDateUtils time format. */
    public static DateBox createDateBoxForTime() {
        DateBox dateBox = new DateBox();
        dateBox.setFormat(new DateBox.DefaultFormat(GwtDateUtils.getTimeFormat()));
        return dateBox;
    }
View Full Code Here

Examples of com.cedarsolutions.client.gwt.custom.datepicker.DateBox

        return dateBox;
    }

    /** Create a DateBox using the standard GwtDateUtils timestamp format. */
    public static DateBox createDateBoxForTimestamp() {
        DateBox dateBox = new DateBox();
        dateBox.setFormat(new DateBox.DefaultFormat(GwtDateUtils.getTimestampFormat()));
        return dateBox;
    }
View Full Code Here

Examples of com.github.gwtbootstrap.datepicker.client.ui.DateBox

    final CheckBox    chkToday   = new CheckBox("Utilizza Data e Ora del Server");
   
    final TextBox     txtTemp    = new TextBox();
   
    final TextBox     txtLight   = new TextBox();
    final DateBox     tpkDate    = new DateBox();
    final TextBox    dtkHour    = new TextBox();
    final TextBox    dtkMin    = new TextBox();
    final TextBox    dtkSec    = new TextBox();
   
    // valori di default
    dtkHour.setText("0");
    dtkMin.setText("0");
    dtkSec.setText("0");

    // handler per impedire che l'utente inserisca Minuti e Secondi con formato errato
    KeyDownHandler   time   = new KeyDownHandler() {
      @Override
      public void onKeyDown(KeyDownEvent event) {
        // inputbox interessata
        TextBox input = (TextBox)(event.getSource());
        char carattere = (char)event.getNativeKeyCode();
         
        // il carattere inserito � un numero?
        if (Character.isDigit(carattere)){
        // effettuo il controllo sul contenuto solo se necessario
        if (!input.getText().isEmpty()){
            
          int limit;
          // l'ora pu� assumere valori 0-23, minuti/secondi 0-59
          if (input==dtkHour){
          limit = 23; }else{ limit = 59; }
         
          // ci stiamo allargando troppo, elimina il carattere!
          if (Integer.parseInt(input.getText()+carattere) > limit) {
          input.cancelKey(); }
          // se il testo inizia per '0' e contiene altri 2 caratteri allora eliminalo!
          if (input.getText().startsWith("0")){
          if (input.getText().length()==2){
          input.setText(Integer.toString(Integer.parseInt(input.getText())));}}
        }
           
        }else{
        // Il carattere inserito non � un numero? Eliminalo!
           
        // il controllo per il Backspace non pu� avvenire assieme a
        // quello del formato del carattere
        if(carattere != (char) KeyCodes.KEY_BACKSPACE &&
          carattere != (char) KeyCodes.KEY_TAB){input.cancelKey();}
        }

      }
    };
   
   
    KeyDownHandler   fDown   = new KeyDownHandler() {
      @Override
      public void onKeyDown(KeyDownEvent event) {
        // inputbox interessata
        TextBox input = (TextBox)(event.getSource());
        char carattere = (char)event.getNativeKeyCode();

        // controllo che il carattere inserito sia un numero/segno [-]/Backspace/Tab
        if (Character.isDigit(carattere)){
          // niente da fare qui
        }else if (carattere == (char) 109 || // carattere [ - ] in Opera e Firefox
              carattere == (char) 189){ // carattere [ - ] in MSIE, Safari e Chrome
          if (input == txtLight){
            input.cancelKey();
          }else{toCheck[curFocus] = true;}
        }else if (
              carattere == (char) 190){ // carattere [ . ]
          //toCheck = true;
        }else if (carattere == (char) KeyCodes.KEY_BACKSPACE){
          toCheck[curFocus] = true;
        }else if (carattere == (char) KeyCodes.KEY_TAB){
          // niente da fare qui, se ne occupa onBlur
        }else{
          input.cancelKey();
        }
      }
    };
   
    KeyUpHandler fUp = new KeyUpHandler(){
     
      @Override
      public void onKeyUp(KeyUpEvent event) {
       
        if(toCheck[curFocus]){
          rightDataPat((TextBox)(event.getSource()))
        }
      }
    };
   
    BlurHandler fBlur = new BlurHandler(){
     
      @Override
      public void onBlur(BlurEvent event) {
        rightDataPat((TextBox)(event.getSource()));
      }

    };
   
    FocusHandler fFocus = new FocusHandler(){

      @Override
      public void onFocus(FocusEvent event) {
        curFocus = (((TextBox)(event.getSource()) == txtLight) ? 0 : 1);
       
      }
     
    };
       
    // associo alle textbox gli handler necessari
    dtkHour.addKeyDownHandler(time);
    dtkMin.addKeyDownHandler(time);
    dtkSec.addKeyDownHandler(time);
   
    txtTemp.addKeyDownHandler(fDown);
    txtLight.addKeyDownHandler(fDown);
    txtTemp.addKeyUpHandler(fUp);
    txtLight.addKeyUpHandler(fUp);
    txtTemp.addBlurHandler(fBlur);
    txtLight.addBlurHandler(fBlur);
    txtTemp.addFocusHandler(fFocus);
    txtLight.addFocusHandler(fFocus);
   
    // messaggio durante l'invio dei dati al Server
    pendingPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    pendingPanel.add(pendingMessage);
   
    // elimino l'elemento HTML "Loading"
    DOM.removeChild(DOM.getElementById("jContainer"), DOM.getElementById("loading"));
   
    // definisco gli elementi da inserire nella pagina Web
    HorizontalPanel timehp = new HorizontalPanel();

    timehp.add(dtkHour);
    timehp.add(dtkMin);
    timehp.add(dtkSec);
   
    // Aggiungo gli elementi HTML alla pagina
    RootPanel.get("tempFieldContainer").add(txtTemp);
    RootPanel.get("lightFieldContainer").add(txtLight);
    RootPanel.get("dateFieldContainer").add(tpkDate);
   
    RootPanel.get("timeFieldContainer").add(timehp);
    RootPanel.get("chkFieldContainer").add(chkToday);
   
    tpkDate.setValue(new Date());
   
    RootPanel.get("sendButtonContainer").add(sendButton);

    // l'opzione di default prevede che la data e l'ora siano presi dal Server
    chkToday.setChecked(true);
    tpkDate.setEnabled(false);
    dtkHour.setEnabled(false);
    dtkMin.setEnabled(false);
    dtkSec.setEnabled(false);
   
    // Handler che si occupa di disabilitare i campi relativi all'orario
    // nel caso in cui si decida di utilizzare la data attuale
    chkToday.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        tpkDate.setEnabled(!chkToday.isChecked());
        dtkHour.setEnabled(!chkToday.isChecked());
        dtkMin.setEnabled(!chkToday.isChecked());
        dtkSec.setEnabled(!chkToday.isChecked());
      }
    });
View Full Code Here

Examples of com.github.gwtbootstrap.datepicker.client.ui.DateBox

      String        temperatura  =  ((TextBox) RootPanel.get("tempFieldContainer").getWidget(0)).getText();
      String        luce    =  ((TextBox) RootPanel.get("lightFieldContainer").getWidget(0)).getText();
      HorizontalPanel   time    =   (HorizontalPanel) RootPanel.get("timeFieldContainer").getWidget(0);
     
      // campo data (Giorno, Mese, Anno)
      DateBox    data  =   (DateBox)(RootPanel.get("dateFieldContainer").getWidget(0));
     
      // dati relativi a Ora, Minuti e Secondi
      TextBox   hh    =  (TextBox)(time.getWidget(0));
      TextBox    mm    =   (TextBox)(time.getWidget(1));
      TextBox    ss    =  (TextBox)(time.getWidget(2));
      CheckBox   check   =   (CheckBox) RootPanel.get("chkFieldContainer").getWidget(0);
      String    sTime;
     
      // contenitori di Luce e Temperatura
      float fl = 0;
      float ft = 0;
     
      try {
        fl=Float.parseFloat(luce);
        ft=Float.parseFloat(temperatura);
        if (fl<0)throw new Exception();
       
        // recupero l'ora impostata o quella corrente?
        if(!check.isChecked()){
        if(Integer.parseInt(hh.getValue())==0 &&
        Integer.parseInt(mm.getValue())==0 &&
        Integer.parseInt(ss.getValue())==0){throw new Exception();}

        // cambio formato data (es. con formato Standard: Wed Jun 26 17:41:38 CEST 2013)
        DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy");
       
        // la stringa sTime sar� nulla nel caso in cui si decida di recuperare il momento dell'inserimento
        // dal Server, altrimenti avr� un formato simile al DateTime
        sTime = "&"+format.format(data.getValue())+"&"+hh.getText()+":"+mm.getText()+":"+ss.getText();
        }else{
        // il server si occupa di effettuare un controllo sul formato di sTime: nel caso in cui il suo
        // formato non sia 'HH:mm:ss' l'orario di inserimento viene preso da quello attuale del Server
          sTime = "";
        }
View Full Code Here

Examples of com.google.gwt.gen2.datepicker.client.DateBox

  private Widget dateRange() {
    VerticalPanel v = new VerticalPanel();
    HorizontalPanel p = new HorizontalPanel();
    v.add(p);
    start = new DateBox();
    start.setAnimationEnabled(true);
    final DateBox end = new DateBox();
    end.setAnimationEnabled(true);

    start.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent e) {
        if (e.isRightKeyCode()
            && start.getCursorPos() == start.getText().length()) {
          start.hideDatePicker();
          end.setFocus(true);
        }
      }
    });

    end.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent e) {
        if ((e.isLeftKeyCode()) && end.getCursorPos() == 0) {
          start.setFocus(true);
          end.hideDatePicker();
        }
      }
    });

    end.getDatePicker().addSelectionHandler(new SelectionHandler<Date>() {
      public void onSelection(SelectionEvent<Date> event) {
        start.removeStyleName("user-modified");
      }
    });

    start.showDate(new Date());

    p.add(start);
    Label l = new Label(" - ");
    l.setStyleName("filler");
    p.add(l);
    p.add(end);
    HorizontalPanel h2 = new HorizontalPanel();
    v.add(h2);
    h2.add(new Button("Short format", new ClickListener() {

      public void onClick(Widget sender) {
        start.setDateFormat(DateTimeFormat.getShortDateFormat());
        end.setDateFormat(DateTimeFormat.getShortDateFormat());
      }
    }));
    h2.add(new Button("Long format", new ClickListener() {

      public void onClick(Widget sender) {
        start.setDateFormat(DateTimeFormat.getLongDateFormat());
        end.setDateFormat(DateTimeFormat.getLongDateFormat());
      }
    }));

    h2.add(new Button("clear", new ClickListener() {
      public void onClick(Widget sender) {
        start.clear();
        end.clear();
      }
    }));
    return v;
  }
View Full Code Here

Examples of com.google.gwt.user.datepicker.client.DateBox

    private HandlerManager handlerManager;
    private DateBox datebox;

    public UTCDateBoxImplHtml4() {
        handlerManager = new HandlerManager(this);
        datebox = new DateBox();
        datebox.addValueChangeHandler(new ValueChangeHandler<Date>() {

            @Override
            public void onValueChange(ValueChangeEvent<Date> event) {
                // pass this event onto our handlers after converting
View Full Code Here

Examples of com.google.gwt.user.datepicker.client.DateBox

    return ((DateBox) w).getValue();
  }

  @Override
  protected Widget editField() {
    final DateBox box = new DateBox();
    box.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG)));
    return box;
  }
View Full Code Here

Examples of com.google.gwt.user.datepicker.client.DateBox

   
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    tabPanel.add(horizontalPanel, "New tab", false);
    horizontalPanel.setSize("5cm", "3cm");
   
    DateBox dateBox_1 = new DateBox();
    horizontalPanel.add(dateBox_1);
   
    Button btnNewButton = new Button("New button");
    horizontalPanel.add(btnNewButton);
   
    Label lblNewLabel = new Label("New label");
    horizontalPanel.add(lblNewLabel);
   
    Button btnNewButton_1 = new Button("New button");
    horizontalPanel.add(btnNewButton_1);
   
    VerticalPanel verticalPanel = new VerticalPanel();
    tabPanel.add(verticalPanel, "New tab", false);
    verticalPanel.setSize("5cm", "3cm");
   
    Button btnNewButton_2 = new Button("New button");
    verticalPanel.add(btnNewButton_2);
   
    DateBox dateBox = new DateBox();
    verticalPanel.add(dateBox);
   
    ListBox comboBox = new ListBox();
    verticalPanel.add(comboBox);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.