minor fixes
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@133399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ce389ed195
commit
f2f25b9a0a
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DataType;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetadataFieldWrapper;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
@ -82,7 +83,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// fields.add(new MetadataFieldWrapper("Time intervals 2", true, DataType.Time_Interval, null, "Time intervals 2", null, null));
|
||||
|
||||
// time interval lists
|
||||
// fields.add(new MetadataFieldWrapper("Time intervals 2", false, DataType.Times_ListOf, "2010-10-12 15:23", "Time intervals 2", null, null));
|
||||
fields.add(new MetadataFieldWrapper("Time intervals 2", false, DataType.Times_ListOf, "2010-10-12 15:23", "Time intervals 2", null, null));
|
||||
|
||||
final ArrayList<MetaDataFieldSkeleton> widgetsList = new ArrayList<MetaDataFieldSkeleton>();
|
||||
for (MetadataFieldWrapper metadataFieldWrapper : fields) {
|
||||
|
|
|
@ -22,13 +22,12 @@ public class DataTimeBox extends Composite{
|
|||
|
||||
public static final String RANGE_SEPARATOR_START_END = "/";
|
||||
public static final String MISSING_RANGE_VALUE = "MISSING_RANGE_PART";
|
||||
private static final String MINOR_HYPHEN = "-";
|
||||
private static final String COLON = ":";
|
||||
private static final String INSERT_DATE_INSTANT_LABEL = "Insert a date";
|
||||
private static final String INSERT_TIME_INSTANT_LABEL = "Hour and minutes";
|
||||
private static final String INSERT_DATE_START_LABEL = "Insert a start date";
|
||||
private static final String INSERT_DATE_END_LABEL = "Insert an end date";
|
||||
private static final DateTimeFormat formatDate = DateTimeFormat.getFormat("yyyy/MM/dd");
|
||||
private static final DateTimeFormat formatDate = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
private static final DateTimeFormat formatTime = DateTimeFormat.getFormat("HH:mm");
|
||||
|
||||
private boolean isRange;
|
||||
|
@ -55,6 +54,12 @@ public class DataTimeBox extends Composite{
|
|||
singleDataEnd.setVisible(true);
|
||||
singleDataEnd.setWidth("50%");
|
||||
singleDataStart.setWidth("50%");
|
||||
|
||||
startRangeTime.setWidth("30%");
|
||||
endRangeTime.setWidth("30%");
|
||||
startRangeDate.setWidth("60%");
|
||||
endRangeDate.setWidth("60%");
|
||||
|
||||
startRangeDate.setPlaceholder(INSERT_DATE_START_LABEL);
|
||||
endRangeDate.setPlaceholder(INSERT_DATE_END_LABEL);
|
||||
endRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
|
||||
|
@ -71,7 +76,7 @@ public class DataTimeBox extends Composite{
|
|||
|
||||
public void setStartDate(String date, String time){
|
||||
GWT.log("Date is " + date + " and time is " + time);
|
||||
startRangeDate.setValue(new Date(date.replaceAll(MINOR_HYPHEN, RANGE_SEPARATOR_START_END)));
|
||||
startRangeDate.setValue(new Date(date));
|
||||
if(time != null && !time.isEmpty()){
|
||||
Date completeDate = new Date();
|
||||
completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
|
@ -82,7 +87,7 @@ public class DataTimeBox extends Composite{
|
|||
|
||||
public void setEndDate(String date, String time){
|
||||
GWT.log("Date is " + date + " and time is " + time);
|
||||
endRangeDate.setValue(new Date(date.replaceAll(MINOR_HYPHEN, RANGE_SEPARATOR_START_END)));
|
||||
endRangeDate.setValue(new Date(date));
|
||||
if(time != null && !time.isEmpty()){
|
||||
Date completeDate = new Date();
|
||||
completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
|
@ -101,12 +106,10 @@ public class DataTimeBox extends Composite{
|
|||
String secondRange = MISSING_RANGE_VALUE;
|
||||
|
||||
if(startRangeDate.getValue() != null){
|
||||
firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");
|
||||
firstRange = firstRange.replaceAll(RANGE_SEPARATOR_START_END, MINOR_HYPHEN);
|
||||
firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");;
|
||||
}
|
||||
if(isRange && endRangeDate.getValue() != null){
|
||||
secondRange = formatDate.format(endRangeDate.getValue()) + " " + (endRangeTime.getValue() != null ? formatTime.format(endRangeTime.getValue()) : "");
|
||||
secondRange = secondRange.replaceAll(RANGE_SEPARATOR_START_END, MINOR_HYPHEN);
|
||||
}
|
||||
|
||||
if(isRange){
|
||||
|
|
|
@ -7,23 +7,23 @@
|
|||
display: inline-block;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:FlowPanel>
|
||||
<g:FlowPanel ui:field="singleDataStart" styleName="{style.flow-panel-style}"
|
||||
<g:HTMLPanel width="100%">
|
||||
<g:FlowPanel width="100%">
|
||||
<g:FlowPanel width="100%" ui:field="singleDataStart" styleName="{style.flow-panel-style}"
|
||||
visible="true">
|
||||
<b3:DateBox format="yyyy/mm/dd" autoClose="true"
|
||||
language="en" ui:field="startRangeDate" width="40%" />
|
||||
<b3:DateBox format="yyyy-mm-dd" autoClose="true"
|
||||
language="en" ui:field="startRangeDate" width="70%" />
|
||||
<b2:DateTimeBox format="hh:ii" autoClose="true"
|
||||
maxView="HOUR" startView="HOUR" highlightToday="false" language="en"
|
||||
width="15%" ui:field="startRangeTime" />
|
||||
maxView="HOUR" startView="HOUR" language="en"
|
||||
width="20%" ui:field="startRangeTime" />
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel ui:field="singleDataEnd" visible="false"
|
||||
<g:FlowPanel width="100%" ui:field="singleDataEnd" visible="false"
|
||||
styleName="{style.flow-panel-style}">
|
||||
<b3:DateBox format="yyyy/mm/dd" autoClose="true" width="40%"
|
||||
<b3:DateBox format="yyyy-mm-dd" autoClose="true" width="70%"
|
||||
language="en" ui:field="endRangeDate" />
|
||||
<b2:DateTimeBox format="hh:ii" autoClose="true"
|
||||
maxView="HOUR" startView="HOUR" highlightToday="false" language="en"
|
||||
width="15%" ui:field="endRangeTime" />
|
||||
maxView="HOUR" startView="HOUR" language="en"
|
||||
width="20%" ui:field="endRangeTime" />
|
||||
</g:FlowPanel>
|
||||
</g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
|
|
Loading…
Reference in New Issue