I've got a DateTime (SWT.TIME) and want to know if the hours or minutes or seconds are selected.
I would like to get this information because I want that the User can scroll the mouse wheel in order to change the selected values accordingly.
Unfortunately I couldn't find any way to get the selected element of the DateTime Control. Does anybody have an idea?
DateTime provides many methods for getting the selected date. Like getHours, getMinutes, getDay, and so on. It's unclear to me what's your exact question, but appropiate setters are there as well.
Related
I would like the DateField to be defaulted to my user's timezone. I've tried DateField.setZoneId() but this really didn't seem to do anything. I then tried to do DateField.setDefaultValue(LocalDateAdjustedForTimeZone) which mostly worked in that the blue box was correctly highlighted but the black outline remained under the server's timezone.
As far as I can see in the Vaadin client component VAbstractCalendarPanel#buildCalendarBody(), there's no way to influence which day is marked with the today CSS style v-datefield-calendarpanel-day-today. The client component Java code about determining "today" looks like:
final Date tmp = new Date();
final Date today = new Date(tmp.getYear(), tmp.getMonth(), tmp.getDate());
So I guess when it's translated to JavaScript it will take the current date on the browser's system.
However, as a workaround you can at least adapt the CSS styles to hide the today marker. I wonder why Vaadin did not think about your use case (which is mine, too). Can you open an issue at Vaadin please?
For example if I only want it to show ranges from 9am to 9pm? displayedCalendar property doesn't seem to change anything, only changed the displayed date.
Is this possible?
Right now there is only a week and day skin, showing both 24 hours. So the answer is: not at the moment.
I am struggling with a gwt/gxt problem. I've been using Sencha ValueProvider for grids and similar for quite some time without any trouble. Now I want to create a Cell wich gets an additional ValueProvider to display the Tooltip. For example I have a column with CustomerNames and the Tooltip is supposed to display the customerNumber.
Unfortunately I can't figure out how the ValueProvider works internally. I know, that I somehow have to use the Path-Attribute but I still can't get the correct value to be displayed.
I would be very thankful for suggestions!
I have a JFreechart, showing stocks data, the type of dataset i use to plot it is an OHLCDataset.
I can get the actual X value from the point where the user click on the plot (i mean, i get the real date corresponding to that point, not just the coordinate on the window).
Next step i need to make is get the data from the OHLCDataset corresponding to that date, to be able to get the Open.High,Close and Low values in that date, but i just can find ways to get the OHLCDataset date corresponding to an item (an integer wich indicates the ordinal), not even one way to obtain that item having the date.
¿Any ideas of how to get the item having the date?
Thanks.
The approach suggested is tedious and error-prone. Instead, add a ChartMouseListener, as shown here. You can invoke getDataset() on any XYItemEntity you encounter.
I want to implement a date chooser using a JSlider. The user should be able to use the slider to freely choose between two previously known dates. I've seen examples like this one:
But I want to do the same, using only one slider. The minimal distance between two points (tick) should be one day. Any hints how to implement that?
If you want to have a slider with min = 1.1.2012 and max = 10.1.2012 just create a slider with min = 0 and max = number of days in between, then add the selected number to 1.1.2012.
I assume 10.1.2012 means January 10th, thus your slider would have min = 0 and max = 9. Then set the labels accordingly.
I can't to image how to do that with one JSlider, because there you'd have bunch of days, there are some workarounds for Double/RangeSlider, but I think better and easiest would be implements JSpinner with SpinnerDateModel, or best options is look for Custom Java Calendar or DatePicker
EDIT (#Robin)
First to answer your question: you can just use a JSlider, use the number of days between your start and end date to determine the range, and use custom labels (by using for example the setLabelTable method)
Now for user-friendliness, avoid this since
Nobody is familiar with this concept. Every site/application nowadays uses a textfield, most of the time in combination with a calendar widget. That is what users expect, not a slider
It will be hard to get all dates as labels on the slider due to the limited width. This means that a user have to interpolate / count to select his correct date
If you stick to the slider approach, at least consider to add a textfield as well. Even a non-editable text field which shows the currently selected date would be a huge improvement over a slider (see point 2)