SHARE
TWEET

Untitled

a guest Aug 17th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Date;
  2.  
  3. import com.google.gwt.core.client.EntryPoint;
  4. import com.google.gwt.dom.client.Style.BorderStyle;
  5. import com.google.gwt.user.client.ui.HTML;
  6. import com.google.gwt.user.client.ui.RootPanel;
  7. import com.sencha.gxt.cell.core.client.form.DateCell;
  8. import com.sencha.gxt.core.client.dom.XElement;
  9. import com.sencha.gxt.core.client.util.Margins;
  10. import com.sencha.gxt.widget.core.client.Window;
  11. import com.sencha.gxt.widget.core.client.button.TextButton;
  12. import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
  13. import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
  14. import com.sencha.gxt.widget.core.client.container.MarginData;
  15. import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
  16. import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
  17. import com.sencha.gxt.widget.core.client.event.SelectEvent;
  18. import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
  19. import com.sencha.gxt.widget.core.client.form.DateField;
  20. import com.sencha.gxt.widget.core.client.form.FieldLabel;
  21. import com.sencha.gxt.widget.core.client.form.FieldSet;
  22. import com.sencha.gxt.widget.core.client.form.StringComboBox;
  23. import com.sencha.gxt.widget.core.client.form.TextField;
  24.  
  25. public class WindowWithDateFieldIssue implements EntryPoint {
  26.  
  27.   @Override
  28.   public void onModuleLoad() {
  29.    
  30.     String label1 = "field 1";
  31.     String label2 = "field 2";
  32.    
  33.     TextField textField1 = new TextField();
  34.     TextField textField2 = new TextField();
  35.    
  36.     StringComboBox combo = new StringComboBox();
  37.     combo.add("a");
  38.     combo.add("b");
  39.     combo.add("c");
  40.    
  41.     FieldLabel fl1 = new FieldLabel(textField1, label1);
  42.     //FieldLabel fl2 = new FieldLabel(textField2, label2);
  43.    
  44.     HBoxLayoutContainer hlc1 = new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
  45.     hlc1.add(fl1);
  46.     hlc1.add(combo);
  47.    
  48.     DateCell dateCell = new DateCell() {
  49.       @Override
  50.       protected void showDatepicker(Context context, XElement parent) {
  51.         super.showDatepicker(context, parent);
  52.        
  53.         // ~~~ workaround - debugging
  54.         menu.getDatePicker().getElement().getStyle().setProperty("border", "1px solid red");
  55.         // ~~~ workaround
  56.         menu.getDatePicker().getElement().getStyle().setProperty("zIndex", "1234");
  57.       }
  58.     };
  59.    
  60.    
  61.     Date date = new Date();
  62.     date.setMonth(3);
  63.    
  64.     DateField dateField = new DateField(dateCell);
  65.     dateField.setValue(date);
  66.  
  67.    
  68.    
  69.     HBoxLayoutContainer hlc2 = new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
  70.     hlc2.add(combo);
  71.     hlc2.add(new HTML("|"));
  72.     hlc2.add(dateField);
  73.    
  74.     FieldSet fs1 = new FieldSet();
  75.     fs1.setHeading("Group1");
  76.     fs1.add(hlc1);
  77.    
  78.     FieldSet fs2 = new FieldSet();
  79.     fs2.setHeading("Group2");
  80.     fs2.add(hlc2);
  81.    
  82.     VerticalLayoutContainer bodyVlc = new VerticalLayoutContainer();
  83.     bodyVlc.add(fs1, new VerticalLayoutData(1, -1));
  84.     bodyVlc.add(fs2, new VerticalLayoutData(1, -1, new Margins(10, 0, 0, 0)));
  85.    
  86.     final Window window = new Window();
  87.     window.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
  88.     window.setModal(true);
  89.     window.add(bodyVlc, new MarginData(20));
  90.     window.addButton(new TextButton("OK"));
  91.     //window.autoSize();
  92.    
  93.     TextButton button = new TextButton("Open");
  94.     button.addSelectHandler(new SelectHandler() {
  95.       @Override
  96.       public void onSelect(SelectEvent event) {
  97.         window.show();
  98.       }
  99.     });
  100.  
  101.     RootPanel.get().add(button);
  102.   }
  103.  
  104.  
  105. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top