Project

General

Profile

Revision b159d907

IDb159d907b305cc1eb82e4f57998a7c0d93c01a4d
Parent dd665bef
Child 2b6e8d64

Added by Katja Luther over 3 years ago

remove pattern string from DateElement when no data are available

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElement.java
58 58
    private Text textDate;
59 59
    private final Button openDateDialog;
60 60
    
61
    private static final String pattern = "yyyy-MM-dd HH:mm:ss";
61
    private static final String pattern = "yyyy-MM-dd HH:mm";
62 62
   
63 63

  
64 64
    /**
......
94 94
    	layout.numColumns = 2;
95 95
    	 	
96 96
    	composite.setLayout(layout);
97
    	composite.setSize(400, composite.getSize().y);
98
    	int width = composite.getSize().x;
99 97
    	
100
       // textDate = new Text(composite, SWT.BORDER|SWT.FILL);
101
    	textDate = toolkit.createText(composite, "yyyy-mm-dd HH:mm:ss", style);
98
    	
99
       // textDate = new Text(composite, SWT.BORDER|SWT.FILL);new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
100
    	textDate = toolkit.createText(composite, null, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
101
    	
102 102
        textDate.setEditable(editableText);
103 103
       
104
        GridData gridData = new GridData();
105
        gridData.minimumWidth = 200;
106
     
107
        
104
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
105
        gridData.minimumWidth = 100;
106
                       
108 107
        textDate.setLayoutData(gridData);
109 108
        openDateDialog = new Button (composite, SWT.PUSH);
110 109
        Image image = ImageResources.getImage(ImageResources.DATE);
......
192 191
			this.controller.setDateTime(data);
193 192
			this.textDate.setText(initialDateTime.toString(pattern));
194 193
			
194
			
195 195
		}
196 196

  
197 197
		
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElementController.java
42 42
    public DateElementController(DateElement dateTimeElement, CdmFormFactory formFactory, ICdmFormElement parentElement, DateTime initialDateTime) {
43 43
        super(formFactory, parentElement);
44 44
        this.textDate = dateTimeElement.getTextDate();
45
        this.textDate.setText(initialDateTime!=null?initialDateTime.toString("yyyy-MM-dd HH:mm:ss"):"yyyy-mm-dd HH:mm:ss");
45
       if (initialDateTime != null){
46
    	   this.textDate.setText(initialDateTime.toString("yyyy-MM-dd HH:mm"));
47
       }
48
       // this.textDate.setText(initialDateTime!=null?initialDateTime.toString("yyyy-MM-dd HH:mm"):null);
46 49
        addControl(textDate);
47 50
        dateTime = initialDateTime;
48 51
        textDate.addModifyListener(this);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)