Toolbox component

Hello all!

Last week I made a new component, the
Toolbox
. Please check it out! I guess it may come in handy in such projects where you need to have as much free space as possible for your working area.

There is still stuff to do, so please suggest what you think is missing.

At least these things will be made in some kind of future:

  • Drag and drop support
  • Click for folding in & out instead of the mouseOver only
  • Some Icon to show instead of the overlapping child component that now is shown
  • Maybe support adding this component to different elements

Very useful, but is it possible to add an image (icon) independent of the toolbox panel which will allow the user to click on it to expand the hidden toolbox panel.(see example here http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/view/velocity/VelocityToolboxView.html)

+1

Now I added “Click for folding in & out instead of the mouseOver only”. If I see I get many downloads (let’s say some 30 more), I’ll add the icon next. If the box is in “clickable mode”, the users should have an option of choosing between clicking the icon for folding, or then the whole component (+ icon) for folding.

Yes, this is my next mission, but as I said, I’ll wait and see if this component gets more popular :wink:

Aha, now that it can appear when we click on it, it becomes usable for me (I hate toolboxes appearing when I accidentally put my mouse over their area!).
You can count one more download, as I was precisely looking for such component (hoping I can customize it a lot).
Note: you can get more downloads by adding (requested) features instead of waiting for downloads to add them: people are more eager to get the software if it does what they expect! :slight_smile:
Of course, if you do that on your free time, I understand you try and manage this scarce resource… :dry: If needed, I will look and see if I can bring improvements myself (to be contributed back, of course!).

Hehe, that was a “selling” trick (we get food in exchange for components here ;)). I had no time to fix it at the moment, but now that one of my collegues promised to make some improvements to it (he needs it for a project), it really might get some boost. He will probably provide a patch that I’ll add when it’s completed.

Hi,

Johan just released a new version (0.2.0) of the add-on that contains improvements implemented by me:

  • Support for icons (setIcon(Resource) / getIcon()). The icon can be used to close and open the toolbox.
  • Overflow size can be set to 0. When the value is 0, the icon is only visible.
  • Added “close on click only” mode (setCloseOnClickOnly(boolean)/isCloseOnClickOnly()). When the mode is on, the toolbox can be closed only by clicking the overlow area or icon.

Because a demo application tells more than thousand words, take a look at the
updated demo application
:slight_smile:

-Henri

Awesome!
And one can replace the icon with a full vertical image, for example (in Firebug, I just replaced one with https://vaadin.com/vaadin-theme/images/vaadin/floating-tab-bg.png and it works…).
Thanks.

Is it possible to allow the orientation to be relative to the main window or layout that the toolbox is added to? Looks like the orientation only supports absolute positioning.

How can I remove the toolbox from a page ?

I add the toolbox to a vertical layout inside a panel. Then when the user click no a button, I replace the content of the panel with another laout but the toolbox statys on the page.
I tried to call

((ComponentContainer) toolbox.getParent()).removeComponent(toolbox);

But it stays on the screen.

I also tried detach() and setVisible(false) but whatever I try the toolbox stays on the screen…

Also is there a way to set a style to the toolbox ?

I tried setStylename and addStyleName but they seem to be overriden.

Thanks for this useful add-on.

I think that in revision 0.2 the
Toolbox#getComponentIterator
method is not implemented correctly because the
next
-method always returns the same
currentComponent
and the
hasNext
-method will always return
true
if
child
was initially not
null
.
With the implementation from the 0.2 version, the application will hang in an endless loop if you call the
requestRepaintAll
method (e.g when clicking on Analyze Layouts (AL) button in the vaadin debug window.

I’d suggest the following fix:


public Iterator<Component> getComponentIterator() {
   return new Iterator<Component>() {
   ...
   public Component next() {
      if (currentComponent == null) {
         throw new NoSuchElementException();
      }
      final Component current = currentComponent;
      currentComponent = null;
      return current;
   }
}

The version 0.3.0 of the add-on contains the following changes:

  • Added setToolboxVisible(boolean) - programmatic support for opening and closing the Toolbox
  • attach() / detach() bug fixed
  • Added possibility to define style names for Toolbox by using the set/add/removeStyleName methods

Thanks !

I could not find the setPopupVisible function in the jar, was there a packaging problem ?

Sorry, method’s name was wrong in the message, correct is setToolboxVisible.

I have started using this add-on and thanks to Johan Anas and Henri Kerola.

I have posted a thread under UI Components to highlight a problem with Toolbox. Accordion tabs added to Toolbox are showing the tab captions as links (with underlines). I haven’t set any style names.

We are evaluating this nice addon but getting an error with our navigation.

If we include the Toolbox, component exchange (removing/adding new components) did not work anymore. We will get the following error in the debug console:


JavaScriptException: (TypeError): c[1]
[s2b]
 is undefined stack: J$b([object Object]
,[object Array]
,[object Object]
)@http://localhost:8081/myapp/VAADIN/widgetsets/ag.mycompany.vaadin.gwt.MyCompoundVaadinWidgetSet/68A8C996D428E055BA133649C2219F03.cache.html:3189 C$b([object Array]
,[object Object]
)@http://localhost:8081/myapp/VAADIN/widgetsets/ag.mycompany.vaadin.gwt.MyCompoundVaadinWidgetSet/68A8C996D428E055BA133649C2219F03.cache.html:3240 hfb([object Array]
...(snip)

The component we exchanged did not show up. After reloading the page the new component is showed.

I think this is a bug in Toolbox.
Can anyone confirm this?

Indeed, sounds like a bug in Toolbox. Could you provide a simple test application that shows the issue.