It's all about the answers!

Ask a question

Timestamp GUI on a text area


Angelo Corna (26148381) | asked Jun 30 '10, 5:37 a.m.
For a customer workitem customization, we need to create a new tab with some Text Areas (the values inserted will be stored on a string customer attribute).
One of these text area is a timestamp field.
How can we associate the timestamp customer attribute GUI at this field?

Thanks in advance.

4 answers



permanent link
Salvatore D'Alò (2121) | answered Jul 02 '10, 9:29 a.m.
For a customer workitem customization, we need to create a new tab with some Text Areas (the values inserted will be stored on a string customer attribute).
One of these text area is a timestamp field.
How can we associate the timestamp customer attribute GUI at this field?

Thanks in advance.


..to add more details at this topic... We are actually trying to show up a calendar in a custom presentation (within the eclipse client) using the following code:

DateTime calendar = new DateTime (form.getShell(), SWT.CALENDAR);
calendar.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent e) {
System.out.println ("calendar date changed");
}
});

Note "form" is a WorkItemEditorToolkit form. Nevertheless no calendar is displayed. We are trying to use the native SWT calendar widget as have not find any toolkit calendar widget.

Please advice. We need to fill a text area within our own presentation using a calendar.

Thanks
Salvatore

permanent link
Milan Krivic (98010172140) | answered Jul 04 '10, 7:49 p.m.
For a customer workitem customization, we need to create a new tab with some Text Areas (the values inserted will be stored on a string customer attribute).
One of these text area is a timestamp field.
How can we associate the timestamp customer attribute GUI at this field?

Thanks in advance.


..to add more details at this topic... We are actually trying to show up a calendar in a custom presentation (within the eclipse client) using the following code:

DateTime calendar = new DateTime (form.getShell(), SWT.CALENDAR);
calendar.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent e) {
System.out.println ("calendar date changed");
}
});

Note "form" is a WorkItemEditorToolkit form. Nevertheless no calendar is displayed. We are trying to use the native SWT calendar widget as have not find any toolkit calendar widget.

Please advice. We need to fill a text area within our own presentation using a calendar.

Thanks
Salvatore

Hi Salvatore,

If I understood you good, you want to create custom field that will be associated with picking the date from showed calendar?

It's simple. In your process template, under cofiguration data and work items, choose Types and Attributes, add new custom attribute, give it name and Id, and under type choose Timestamp.
Then, in your Editor Presentation view, find your newly created tab, and within that tab, add your custom attribute which you created, and you 'll have the possibility to choose date from calendar.

Hope this helps,

Regards,

permanent link
Salvatore D'Alò (2121) | answered Jul 05 '10, 4:03 a.m.
For a customer workitem customization, we need to create a new tab with some Text Areas (the values inserted will be stored on a string customer attribute).
One of these text area is a timestamp field.
How can we associate the timestamp customer attribute GUI at this field?

Thanks in advance.


..to add more details at this topic... We are actually trying to show up a calendar in a custom presentation (within the eclipse client) using the following code:

DateTime calendar = new DateTime (form.getShell(), SWT.CALENDAR);
calendar.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent e) {
System.out.println ("calendar date changed");
}
});

Note "form" is a WorkItemEditorToolkit form. Nevertheless no calendar is displayed. We are trying to use the native SWT calendar widget as have not find any toolkit calendar widget.

Please advice. We need to fill a text area within our own presentation using a calendar.

Thanks
Salvatore

Hi Salvatore,

If I understood you good, you want to create custom field that will be associated with picking the date from showed calendar?

It's simple. In your process template, under cofiguration data and work items, choose Types and Attributes, add new custom attribute, give it name and Id, and under type choose Timestamp.
Then, in your Editor Presentation view, find your newly created tab, and within that tab, add your custom attribute which you created, and you 'll have the possibility to choose date from calendar.

Hope this helps,

Regards,

Hi Milan,
thanks for your reply but my need is a little bit more articulated. Actually I have my own presentation, which manages a string custom attribute and in such presentation I have a free text area (not linked to any custom attribute) for which I need to choose date from calendar. Such text area belongs to a presentation's form that includes moreover other text areas and a button that once pushed down makes the underlying custom attribue properly filled out. The value that is stored within the custom attribute is derived from the strings and the date put within the form fields.

I thought using the code in my previous append I could achive my goal but no calendar is shown on the screen. How can I add a calendar widget to my form within my presentation? Could you provide a snippet for it?

Thanks,
Salvatore

permanent link
Patrick Streule (4.9k21) | answered Jul 23 '10, 11:07 a.m.
JAZZ DEVELOPER
For a customer workitem customization, we need to create a new tab with some Text Areas (the values inserted will be stored on a string customer attribute).
One of these text area is a timestamp field.
How can we associate the timestamp customer attribute GUI at this field?

Thanks in advance.


..to add more details at this topic... We are actually trying to show up a calendar in a custom presentation (within the eclipse client) using the following code:

DateTime calendar = new DateTime (form.getShell(), SWT.CALENDAR);
calendar.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent e) {
System.out.println ("calendar date changed");
}
});

Note "form" is a WorkItemEditorToolkit form. Nevertheless no calendar is displayed. We are trying to use the native SWT calendar widget as have not find any toolkit calendar widget.

Please advice. We need to fill a text area within our own presentation using a calendar.

Thanks
Salvatore

We have a DateTime wrapper in Foundation that you could use:
com.ibm.team.jface.calendar.DatePicker

Sample usage (from com.ibm.team.workitem.ide.ui.internal.editor.presentations.TimestampAttributePart), with positioning logic:

DatePicker picker= new DatePicker(shell, DateFormat.MEDIUM);

Point loc= new Point(pt.x, pt.y);
if (shell != null) {
Rectangle sB= shell.getBounds();
Rectangle dB= shell.getMonitor().getBounds();
int maxX= Math.min(sB.x + sB.width, dB.x + dB.width) - 3;
int maxY= Math.min(sB.y + sB.height, dB.y + dB.height) - 3;

int sizeX= "gtk".equals(SWT.getPlatform()) ? 312 : 200; //$NON-NLS-1$
int sizeY= "gtk".equals(SWT.getPlatform()) ? 230 : "carbon".equals(SWT.getPlatform()) ? 150 : 200; //$NON-NLS-1$ //$NON-NLS-2$
if (pt.x > maxX - sizeX) {
loc.x= maxX - sizeX;
}
if (pt.y > maxY - sizeY) {
loc.y= maxY - sizeY;
if (loc.x + 32 > maxX - sizeX) {
loc.x= pt.x - sizeX;
} else {
loc.x= loc.x + 32;
}
}
}
picker.setLocation(loc.x, loc.y);
try {
picker.setDate(fDateFormat.parse(fAttributeContent.getText().getText()));
} catch (ParseException e1) {
/* Ignore */
}
picker.open();

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.