I'm using a set of views for the data access layer of our primary web application, and need to document these views. Logically the views mirror the underlying tables, meaning they have similar relationships to the tables. (It's a bit more complex, since the views are pulling data from 3 databases...)
So I opened up Visio and reverse engineered the views in question into the diagram, but the problem now is that Visio won't let me add relationships to views.
Is there any way around that limitation so that I can model these views as if they were actually tables?
Or is there an easy way to "convert" each view to a table? (I could do it manually, but that's a lot of boring typing for all the properties...)
Have you succeeded in this? I need to document data layer based on related views, but in addition to the problem related to relations there is another one: when model is refreshed the tables in the drawings update nicely but all chenged views disappear from the drawing. The model is updated, i.e. if I drag the views back on canvas the content is updated. But still I don't want to rebuild the whole picture every time a small update is done on the DB...
Related
I'm running into a problem of how to display sequences of core data entities on a single graph, if there are time gaps between sequences.
I got a fixed-length bar graph (backed by UITableView) with each bar represented by a core data entity, all entities are timestamped and follow each other, so sorting such data results in a graph like below. The good thing about such graph is that NSFetchedResultsController can be used to dynamically update the table view in response to new events being added. The result is that it appears to the user that new bars are added on the left as time goes by.
My problem is that I want to expand this graph and make it 24 hour long and scrollable side to side. In this case, there will be episodes where no data will be present in the app. The end result is that if I rely on NSFetchedResultsController when there are gaps in data, and I want to display blank cells for missing data.
I'm interested in how you would approach the problem.
I see two potential solutions:
1) Drop the approach of using NSFetchedResultsController, and instead manually calculate the number of bars in a UITableView. Each bar is defined by a start date and an end date. Then I can use NSFetchRequest with predicate to query each bar's data. If there's an event with a timestamp that falls within the bar's date range, then a bar is shown, otherwise a blank is shown.
The problem with approach #1 is that it is slow, and while it does allow scrolling through the entire data set, it is slow and laggy, as each fetch request is executed for each new bar. Additionally, I need to manually refresh the table in response to new data being added, which is difficult to implement properly.
2) Maybe I can pre-populate the data set with blank events, and then "fill them in" as data becomes available. This would allow me to keep the table view with fetched results controller, resulting in smoother scrolling, but at the price of significantly increasing the persistent storage used by the app (as blank entities will be created between app use).
I'm wandering if there's an additional approach that I'm not thinking of. How would you create a side scrollable bar graph that would allow for "gaps" in the app's persistent data storage?
Thank you for your input!
Your question really doesn't have (or shouldn't have) anything to do with Core Data or NSFetchedResultsController. How your graph view draws the data it's given is entirely up to the graph view. There's no reason that you couldn't write a graph view that uses NSFetchedResultsController and deals appropriately with gaps in the data, but UITableView was never intended to deal with missing/empty cells.
The problem is not that you're using either Core Data or NSFetchedResultsController. The problem is that you're abusing UITableView.
Drawing a bar graph is pretty easy -- it's just a series of rectangles drawn at appropriate locations. You can give your view a fetched results controller and have it look at the fetchedObjects property to get the current list of objects. It can then render as many of those objects as it likes, and it can use the start and end date of each object to locate the drawing on the graph. Put your graph in a UIScrollView so that you don't have to worry about scrolling. If the graph can get large, add tiling so that you're only drawing the parts that the user is looking at, just like UITableView does.
It looks like you're currently drawing some content above your table view, too. If you create your own graph view, you might consider drawing that additional content (the red line, the red and green bubbles, the high REM probability thing) at the same time. Doing that will make it easy to ensure that all that content is located correctly on the graph (which is probably a bit of a pain with your current scheme).
Do someone has an Idea, how to implement a Layout in RCP,
where the Views would look like Tabs and appear nested?
The Tabs should have all the advantages of Views - can be dragged to the desktop to become a detached view, be tiled near each other, rearranged etc.
On the picture the views: View4 and View5 are nested into View1.
In my experience, something like this will not be easy - there's likely going to be a lot of custom coding in your future. I'll try to cover this more from a high level architecture standpoint, since there'll be a lot of details you'll need to figure out specific to your requirements and strengths.
There's two ways you can go about this I think:
1. write a view extension where the contents of that view are other views.
This would be less work up front, but might be harder to get view rearrangement to work. Based on your mockup, this means View1 is an instance of this view, and is responsible for rendering the tab controls for View4/View5, and telling those views to render their content. You can probably look at MultiPageEditorPart for some inspiration, though you'll probably want to render the tabs a bit nicer.
In this case, your subviews will likely plug in specifically to their parent view. Drag and drop support within the view wouldn't be too bad, though pulling them out of the view would involve a bit of work. This article provides a basic intro to drag-and-drop; google can provide the rest.
2. write a custom presentation to render your views in this way.
This one might be a bit more work up front to learn about how the presentation layer works, but once that is done, it will probably be easier to get all the features you're looking for. See this article for an introduction to presentation layers.
In this case, all your views will be treated by the plugin system as top level views - your presentation layer decides where to render the areas for the view contents. I've used presentation layer for something similar to this, but in my case, the views were all statically positioned. That said, since everything is a regular view, you should be able to re-use the existing drag-and-drop functionality to rearrange views with a lot less effort than the other option.
I have the following problem. I want to relaunch a tool that displays the relationship between multiple objects. In this case there are numerous works of art, each is more or less related to all the others. In its inital state the display shows all objects (represented by a thumbnail and/or title) in different clouds depending on the main category each object belongs to (think sculpture, painting, poem etc.). When a user clicks on an object, all objects are rearranged: the clicked object is displayed in the center, all other objects arre arrange arround it. The closeer they are to center, the closer they are related (depending on additional parameters).
The current version of the tool can be seen here: http://atlas.taswir.org/
The relauch is necessary due to several issues: currently it's flash based, it is a very clunky solution pieced together by several long gone devs, to add new items the XML file of doom has to be hand-edited etc.
Which (finally :) brings me to a question: I'm sure that this is not a unique problem. Are there any tools, frameworks, classes... anything that can be used as a starting point to get a better result? I'm not sure what to look for. HTML5/PHP would be ideal, but I'll take nearly anything.
Check out d3 Force Layout. It can give you the layout and interactivity you are looking for.
I am new to iOS platform and i heard about MVC archtecture.
To draw a circle i just create a separate UIView class and override the drawRect: and able to do this.
But now i want to rebuild the same project using MVC architecture.The main aim is to separate my Model part from View & Controller part.So that i can extend my project.
So how can i do this?
Any sample application for reference?
I'm not sure what you want to separate. Drawing a circle would generally fit into the "View" part of the MVC architecture, which is what you have already done. Code that would, for instance, change the colour of the circle would live in the "Controller" part, which on iOS is a UIViewController. If you had something storing information on what the circle looked like (i.e. size, colour, etc.), that could be considered part of the model, and can be stored in its own class, pulled in by the view controller and passed to the view when it is neede.
Here is a link that may help.
http://www.bit-101.com/blog/?p=1969
As for the model side of things, Core Data is a technology that can help.
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP40001075
The separation would be the drawing code in drawRect and the size and location in a model with a controller getting the circle attributes from the model and requesting the drawing and passing the attributes to the view. The model might be another class or an API supplied class such as an NSDictionary.
By creating a separate model if there were multiple circles the controller could make multiple draw requests, one per model circle. Or there could be multiple views that the circle(s) would be drawn in or different representations such as a text list of the circles attributed in one view and graphic circles in another.
Many patterns seem trivial and not particularly useful in the trivial case yet in a real-world program work very well.
All you ios architects out there, please help me choose architecture/technology for the following iphone/ipad app.
The app itself is a financial app, but we want more of a game look-and-feel of the app, so we probably don't want to use the builtin looks of the cocoa widgets. The elements on the screen will probably be some kind of blob-shaped images.
The app will essentially have five "blob"-shaped areas, spread out evenly across the screen. One of the blobs will be centered and larger than the other ones. Within each blob there will be clickable areas which will pop up "details" and menu-action blobs. These blobs are also graphics objects and must not take over the whole screen. The blobs should animate nicely when popping up. The graphics elements will have a couple of lines of text, which are generated, so the overlaying text itself cannot be part of the static background-image.
The main user interaction will be swiping within the center blob, displaying summaries of the items that are conceptually contained within the blobs underlying data store. Now and then, the user will drag and drop the item to one of the other blobs. While dragging, the item should be traced by a line and when dropping on the other blob, the item should be animated to look like it's being "sucked into" the blob.
Now, what kind of technique would you suggest for this app? Is Cocoa suitable in this scenario? Should I use a game framework like Cocos2D? All kinds of suggestions including example code snippets are most welcome.
I realize that this question might not be as straightforward and to the point as questions generally are on SO, but I hope your answers will come to use by more people than me. Thanks!
EDIT (MY SOLUTION):
I eventually ended up doing everything in UIKit, which was a lot easier than I expected.
Briefly described I used UIButtons with Custom style and an image background, which gave me full control over the visual appearance of the "items". I also found it very useful to manipulate the underlying CALayer of many of my other UIViews. It is often easier than drawing things from scratch using Core Graphics programming.
Another thing that was useful were the UIGestureRecognizer:s. I found them useful for both handling "real" gestures like swiping, longpress etc, but also for handling normal "tap" for UIView classes that aren't subclasses of UIControl. Two examples are UIImage, UILabel and UIView itself. That way I could handle taps for these simple classes. I could for example use a normal UIView, modify it's CALayer to change the look of it completely and still handle taps. Using this technique, I didn't have to subclass any views at all in my app.
The animations were pretty easy too, even though I had to use a non-public method to use "suck" animation, so my app will never pass App Store moderation. It was just a prototype anyway so I don't care.
When this app will be for real, I will probably implement it in HTML5/JavaScript wrapped by Phonegap. The reason for this is mainly reuse of existing mobile web services and also for code reuse across platforms. It will probably also be easier to hook into the existing security solution when using a webapp.
Cocos2d is great if you need to move elements around really fast as it is a layer on top of OpenGLES. I think from what you have said the UIKit will be fine, you get nice animation support, you can do some nice things with UIScrollViews to handle moving elements around etc.
If you need more detailed graphics support and lots of moving elements, particle effects etc then by all means go for Cocos2D but be aware that in Cocos2d the application works more on a scheduled update method, i.e. you get notified every 1/60th of a second to move stuff draw stuff etc, whereas with normal UIKit approach it is more event drive, i.e. I click a button and show a view etc.