Easiest way to rearrange methods in Eclipse - eclipse

I am trying to keep functions related to each other close together. What would be the easiest way to rearrange methods within a class in Eclipse?
ALT+UP / ALT+DOWN works for code within methods, but moving the whole function around is a bit hard since it does not respect function boundaries.
Copy/Paste works, but I was hoping for something more elegant.

In the outline view you can rearrange methods with the mouse.

In the outline view you can drag and drop methods - you may need to unselect the alphabetic sort option.
Personally, I would not spend too much effort on re-ordering methods. I'd hope that your classes are small enough that it doesn't matter too much, and the outline view helps navigation too.

Related

Scroll a panel using drag and drop gwt

I am trying to scroll a panel by mouse. I looked over drag and drop and I can`t figure out if it is possible using drag events to scroll a panel or is it better using mouse move event, mouse over and mouse out etc.
Any ideas would be appreciated.
Although modern GWT supports DnD, its implementation is not so good, so it is better that you select one 3party library for that. You have gwt-dnd or gwtquery-dnd-plugin. IMO the second one is easier to use and much more powerful.
But I dont think DnD can help you to move the scroll, since it is designed to move all the draggable element and drop over another one.
Maybe what you need is something similar to the scrollwidget in mgwt, it is designed for mobile devices, but it has an implementation for desktop, so hopefully you could either use the library or copy the approach to your implementation.
Just in case you will use gwtquery, keep in mind that it's out of date. So, you will need to put the newest jquery and jquery-ui libraries into the corresponding jar and edit the gwt.xml files accordingly. It's not a big deal, but otherwise you would put your code under the risk of misfunction in newer browsers. By the way, it depends on the usage you would make of jquery-like functionality.

Is there a tree control for the iphone?

Is there a Tree control available for the iphone?
I need to represent a tree with sub nodes in a tree, how can I do it?
Thanks
No tree widget by default. It's basically not there because you shouldn't really need one and most cases it should probably be avoided.
A table navigation controller is the most common way to navigate down nodes in a hierarchy/tree usually.
It's hard to fit a tree like control we have on our desktops in the touch world where you have huge fingers (so huge nodes) and with the nodes offset to show depth, there isn't much space left over. Adding it to the iOS environment would create a weird UX flow so I would probably rethink my design flow if I think I need one.
If you need to fake it, you can use a table view and offset the left side of each subitem with some padding to show depth.
See this help
Rolling your own iPhone treeview control
part 1 : http://dotnet.kapenilattex.com/?p=566, part 2 and part 3 are in the pages : 585 and 633
part 4 : http://dotnet.kapenilattex.com/?p=648&cpage=1#comment-59842
I would use a UITableView and expand and collapse items further down the tree. You can set an indentation level for each UITableViewCell as it is displayed, depending on its position in the tree. You would need to keep track of which items in the tree are expanded/visible in order to always provide the tree with the correct data.
I just did just that for a project. Unfortunately I am not at liberty to share the full code. But it should not be terribly hard to write.
Let us know if you find an out-of-the-box solution.
From what I see, the best solution for my problem will be a BreadCrumbs control. I am looking for a ready solution of breadcrumbs, but if there isn't, it is not a big deal to write it.
OK, I did it.
I added a WebView and I am adding to it the crumb list. The design is similar to the Apple's official site.
When a user clikcs on the link, I call the popToViewController function and I am there.
This prevent the user from clicking Back and Back.
Hope this will help somebody.

Prototype library component for the select box options

An UI question...
There are two select boxes between which there are two buttons "<<" and ">>". When you hit the "<<" button the selected items from the select item on the right moves to the left and similarly from left to right ">>". I am not sure what this kind of set up is called in terms of or jargon or terminology ;)
I wanted to know if there is a prototype component like this existing already? or an optimized way of doing this with Prototype library?
Thanks, J
There is no fixed terminology of your required UI problem, so far to my knowledge. Still you may call it as "Moving selected Items from one Listbox to another".
For reference, you can see this example, which is built using plain JavaScript.
Also I am pretty sure that there is some way to build this type of functionality using Prototype & Scriptaculous libraries, along with the effects. You will require the "Sortables" object, most probably.
Hope it helps.

Arrange GUI elements in WPF in a similar way to the applications on the iPhone

I would like to arrange UIControls in WPF in a similar way to the applications on the iPhone. They should be positioned on a grid, but a user should be able to drag them somewhere else, after releasing the mouse button (or the finger in case of an iPhone) the selected UIControl should snap back to the next position in the grid. The other UIElements should be rearranged automatically.
Further the user should also be connect two elements with a line or something.
I'm not experienced with WPF. The first question is if there is a container which is suitable for something (System.Windows.Controls.Grid ?) or if I have to extend canvas or somethig else for this.
I would like to know which elements from the WPF framework can be used and which elements I have to write myself.
For people who do not own an iPhone: http://www.youtube.com/watch?v=3omhu2AUWC8
Update
I've looked at AnimatedTilePanel in the BangOTricks examples (see below), this one explains how to create your own Panel and how to let it arrange things there.. However I still need an idea how to implement drag and drop correctly in this example..
Unfortunately, you'll have to write a lot of things yourself, as WPF doesn't automatically do what you're looking for.
For positioning the controls, you can use either UniformGrid or Grid. Assuming it's much like the iPhone video you showed, you can just use the UniformGrid with 4 columns and however many rows you need.
For the dragging animation, layout-wise, you could start by manipulating the RenderTransform property on whatever is being dragged, but you'll have to set a handler to check once you've met whatever threshold necessary to move into the another "cell" -- and at that point, you'll have to changed the order of the items in the tree.
Take a look at AnimatedTilePanel from Kevin's Bag-o-Tricks at:
http://j832.com/bagotricks/
It doesn't do everything you want but it will show you how to write a panel that animates its children when changing size or order.
New input to this old post in 09. Earlier this year (2012) someone has wrote a FluidWrapPanel and open sourced it. I tried it and it works like a charm - just like that on the iPhone menu.
You can also apply to other UI Elements or UserControl.

Settings-style grouped table

So it's trivial to create a Settings style table on the iPhone. The problem is, they add a great deal of code as your Settings have a gamut of options/styled cells. One section might have a check list, another might have cells with accessory disclosures to drill down further, another might be labels with UITextFields.
My question here is, what's the cleanest way to go about creating this table. Do you typically create a subclass of UITableViewController and then subclass UITableViewCell for each different type of cells, and write supporting classes for those cells? Meaning if you have a Settings style table with 4 sections, all different types of cells, you will load 4 nibs into the table and import 4 class files? Programmatically set the frame, views, textfields and tag them for later access?
The answer(s) to this is probably subjective, but I'd like to know what you experts consider the most elegant approach to this common problem.
The easiest way to do this is to simply add your controls during the tableView:cellForRowAtIndexPath: method.
I also recommend this to help corral your code:
A technique for using UITableView and retaining your sanity
I would rather set most of the settings that I can in Interface Builder, instead of writing a whole bunch of code to make the visual/layout just right. As you can imagine, it will take quite a few rounds of "modify - build - test" in the iPhone Simulator to get this special table view laid out the way you want it.
I feel it's probably a bit easier to do all of these rough visual changes in IB, then load all of the custom UITableViewCell dynamically via their identifiers in code. You could then do one final round of tweaking on this code, if something that you want is not doable in IB.
Three20 library (extracted from Facebook iPhone app) has a set of ready-made cells that contain various controls.
(Not sure you want to use them, however. Three20 suffers from “not-invented-here” a little bit and tries to subclass and extend everything, so adding it adds quite a bit of a mess to your project. But at least you can use it as an example.)
P.S. Your question inspired me to open a “What are your favourite UITableView / UITableViewCell tricks?” thread on Stack Overflow, check it out for more tips.