I'm using Flexganttfx, and I'd like swipe to an specific activity in my gantt chart when I click in a term (this term is out gantt chart, but contains the reference for the activity object that I want to swipe to).
How to do this?
I found the answer into the flexganttfx's forum:
"there is no utility method for doing this, yet. You will need to call scrollTo() on the tree table view and then request a specific time on the timeline (Timeline.showTime())."
http://dlsc.com/forums/topic/setselectedactivity-scroll-to-row-and-activity/
In my case:
int rowIndex = gantt.getTreeTable().getRow(treeItem);
gantt.getTreeTable().scrollTo(rowIndex);
gantt.getTimeline().showTime(date);
This solves my problem, I hope to help someone :)
Related
So I'm trying to build my own custom view for a month's worth of data (based on the "agenda-views.html' example) and I've been able to create a custom View class which adds itself as a button on the list of .. buttons.
When I click on that button (MyView), its setRange is called so I know the range of Events to display.
The View's renderEvents is called but is passed all of the Events that the Calendar knows about, so I have a two parter question:
(a) Is there a way I can use existing code to do the equivalent of: "given this range, give me all of the Events fullCalendar knows about"?
- or -
(b) Do I use an XHR here to pull back the data for the given range (now that I know what it is is) and Render it
I'd rather do (a) as it's more efficient (less requests etc) but I'm finding myself swamped in code and, after reading through quite a lot it haven't really found a method that says 'Get all events for this range'.
Alternatively, am I missing something? How does renderEvents know what the current range is and then render them? Or, should I be using renderSelection, which doesn't seem to get called.
Thanks!
Set up your events as a json feed, when the URL is called it will pass the start and end dates for the current view. In your function/method/action you then retrieve your events for the given dates and return them.
We created a small painting application in JavaFX. A new requirement arose, where we have to warn the user, that he made changes, which are not yet persisted and asking him, if the user might like to save first before closing.
Sample Snapshot:
Unfortunately there are a lot of different Nodes, and Nodes can be changed in many ways, like for example a Polygon point can move. The Node itself can be dragged. They can be rotated and many more. So before firing a zillion events for every possible change of a Node object to the canvas I`d like to ask, if anyone might have an idea on how to simplify this approach. I am curious, if there are any listeners, that I can listen to any changes of the canvas object within the scene graph of JavaFX.
Especially since I just want to know if anything has changed and not really need to know the specific change.
Moreover, I also do not want to get every single event, like a simple select, which causes a border to be shown around the selected node (like shown on the image), which does not necessary mean, that the user has to save his application before leaving.
Anyone have an idea? Or do I really need to fire Events for every single change within a Node?
I think you are approaching this problem in the wrong way. The nodes displayed on screen should just be a visual representation of an underlying model. All you really need to know is that the underlying model has changed.
If, for example, you were writing a text editor, the text displayed on the screen would be backed by some sort of model. Let's assume the model is a String. You wouldn't need to check if any of the text nodes displayed on screen had changed you would just need to compare the original string data with the current string data to determine if you need to prompt the user to save.
Benjamin's answer is probably the best one here: you should use an underlying model, and that model can easily check if relevant state has changed. At some point in the development of your application, you will come to the point where you realize this is the correct way to do things. It seems like you have reached that point.
However, if you want to delay the inevitable redesign of your application a little further (and make it a bit more painful when you do get to that point ;) ), here's another approach you might consider.
Obviously, you have some kind of Pane that is holding the objects that are being painted. The user must be creating those objects and you're adding them to the pane at some point. Just create a method that handles that addition, and registers an invalidation listener with the properties of interest when you do. The structure will look something like this:
private final ReadOnlyBooleanWrapper unsavedChanges =
new ReadOnlyBooleanWrapper(this, "unsavedChanged", false);
private final ChangeListener<Object> unsavedChangeListener =
(obs, oldValue, newValue) -> unsavedChanges.set(true);
private Pane drawingPane ;
// ...
Button saveButton = new Button("Save");
saveButton.disableProperty().bind(unsavedChanges.not());
// ...
#SafeVarArgs
private final <T extends Node> void addNodeToDrawingPane(
T node, Function<T, ObservableValue<?>>... properties) {
Stream.of(properties).forEach(
property -> property.apply(node).addListener(unsavedChangeListener));
drawingPane.getChildren().add(node);
}
Now you can do things like
Rectangle rect = new Rectangle();
addNodeToDrawingPane(rect,
Rectangle::xProperty, Rectangle::yProperty,
Rectangle::widthProperty, Rectangle::heightProperty);
and
Text text = new Text();
addNodeToDrawingPane(text,
Text::xProperty, Text::yProperty, Text::textProperty);
I.e. you just specify the properties to observe when you add the new node. You can create a remove method which removes the listener too. The amount of extra code on top of what you already have is pretty minimal, as (probably, I haven't seen your code) is the refactoring.
Again, you should really have a separate view model, etc. I wanted to post this to show that #kleopatra's first comment on the question ("Listen for invalidation of relevant state") doesn't necessarily involve a lot of work if you approach it in the right way. At first, I thought this approach was incompatible with #Tomas Mikula's mention of undo/redo functionality, but you may even be able to use this approach as a basis for that too.
I want to display quite a bit of demographic data for a certain pin when someone touches on it, so providing a pop-up isn't going to cut it. I figured once the pin is touched I will just stick a tableviewController onto the NavigationController and the table view will have access to the object and display the single objects information, with one item per row and 1 section.
Anyway I'm having a hard time figuring out MKMapViewDelegates methods as it appears none of them do what I need and/or allow me to return a tableview or push that view onto the navigation controller.
I played around with:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation;
But that requires a MKAnnotationView be returned and I really just need this method to work by showing the user a table view of all the data. I was hoping for something simple like a userDidTouchPin method....
Anyone have any ideas how to accomplish what I am trying to do?
If you want to do something when the user selects the pin (and not a button on its callout), then implement the mapView:didSelectAnnotationView: delegate method and present or push your detail view controller there.
The selected annotation object is available as the annotation property of the view parameter:
- (void)mapView:(MKMapView *)mapView
didSelectAnnotationView:(MKAnnotationView *)view
{
YourDetailViewController *dvc = [[YourDetailViewController alloc] init...
dvc.annotation = view.annotation;
//present or push here
[dvc release];
}
You might need to check which type of annotation was selected (eg. if MKUserLocation was selected do nothing, etc) and you might need to cast the view.annotation to your own annotation class to easily access any custom properties you may have.
I'm trying to find the best way to create a personalized contact List for an instant messaging app.
Maybe with a Tree View but I'm not sure.
I Need a way to view Groups in which there are Contacts.
A Contact contains different info and action buttons like "Send a message, View infos, ... "
An example # http://ycorpblog.com/wp-content/uploads/2007/10/yahoo-messenger-90-action-toolbar.jpg
here I am in my little research. I inherited one of my classes QAbstractItemDelegate.
I reimplements paint () and sizeHint ()
in the paint () for drawing my items (and here for example a button)
Code:
QStyleOptionButton buttonStyle;
buttonStyle.rect = option.rect;
buttonStyle.features = QStyleOptionButton::AutoDefaultButton;
buttonStyle.text = "Salut!";
QApplication::style()->drawControl(QStyle::CE_PushButton,&buttonStyle,painter);
But then it does involve reimplementing QAbstractItemDelegate: helpEvent () to retrieve the actions of clicking the buttons (compare the position of the mouse compared to my drawing and determine what the user clicks)?
Moreover, with the solution proposed above,
QAbstractItemDelegate::helpEvent () is a slot
Despite a careful reading of the documentation, I can not determine when this function is called, does it connect to something?
I also cast a glance at editorEvent (), I recovered well Mouse Click but no way of knowing exactly where the user clicked, so no way of knowing if it's a button or other element.
I asked about the method I use too. Is this good? Can you enlighten me?
Pending your answers / ideas. Thank you.
I'm using a DateChooser, and want to show different information in a tooltip as the user rolls over each day. Is there an event that fires as I'm rolling around the calendar that will tell me what day I'm currently over?
It's a little complicated. You're going to need to use the mx_internal namespace. The grid portion of the DateChooser component is a CalenderLayout component in DateChooser.as.
mx_internal var dataGrid:CalenderLayout;
CalenderLayout.as has the mouseMoveHandler. In the handler we have:
var selCell:IUITextField = dayBlocksArray[colIndex][rowIndex];
that gives you the necessary info about which day the mouse is over. You will need to extend DateChooser to use an extended CalendarLayout that exposes the selectedCell.
perhaps:
private function mouseMoveHandler(event:MouseEvent):void
{
...
dispatchEvent(new DayHoverEvent(selCell.text));
}
I guess what I'm trying to say is it's kinda tricky, and it uses mx_internal, which means the variables are subject to change in later versions of Flex.
What about change?
You may want to check out my blog post on this: http://flexmonkey.blogspot.com/2010/06/displaying-color-coded-events-in-flex.html
I've based this on some previous work by Kevin Brammer (http://www.cyberslingers.com/weblog/post/Adding-Calendar-Event-Entries-to-the-Flex-DateChooser-Component.aspx) - it allows you to add a tooltip to individual days and colour code them
Hope it helps,
simon