Vaadin Accordion in Panel should scroll to see contents - java

I got a Accordion embedded into a normal Panel. The Accordion size is half the current screen size.
Now if I add content (tab) to the Accordion, the Accordion itself contains a caption followed by the content and I can see the content clearly.
If I add more than, say about 30 tabs, I can only see the caption, cause it takes also space from the Accordion.
Now my question is, how can I set the tabs content size, that I always can see the content or is it possible to show the scrollbar of the underlying Panel, cause it is not showing up.
EDIT
Here is a screenshot of many tabs added to the accordion:
I can not scroll an if I click onto an item, it won't expand.

I solved it by using a TabSheet. It is not the best solution, but okay for me. Here is the reported bug link: https://dev.vaadin.com/ticket/18219

Related

Scroll bars for multiple JTextPanes

This question is very similar to previously asked, but unfortunately, previous articles do not help much to solve a problem described below.
I would like to create a layout with three text areas that holds source code, code lines and some help information. And only one text area has a scroll bar. It's required to sync text areas in terms of text lines (wrapped text should not affect code lines) and scroll functionality (scroll bar in test area with source code will scroll all three areas).
Please look at layout example:
I already seen a number of topics that shown how to use row header in scroll pane, like in Text Component Line Number. In this aproach, I have no idea how to add third text area. I am looking for advice, how to create such kind of interface easily. Thank you!
I have no idea how to add third text area
Use a BorderLayout and add the components to left, center and right
[...] and only one text area has a scroll bar. It's required to sync text areas in terms of text lines (wrapped text should not affect code lines) and scroll functionality
Please have a look at following answers:
How to scroll two JTextPane's?
synchronize scrolling of N number of jtables in java swing

Vaadin - Height of textarea inside a tabsheet that is inside a splitpanel

I have a textarea inside a tabsheet, that is inside a splitepanel. My problem is that the textarea not fills the hole space in tabsheet. I have set all component with a height of 100%...but it doesn't work :(
Here is a screenshot of the tab
Thanks for help!
I can't see your HTML/CSS from here, but usually Vaadin adds some divs around elements - in this case, the text area - Try to inspect that parent(s) element of the text area and there has to be one of them that needs a 100%

How to get tab pane tabs rotated and visible when oriented on the left side?

I am currently trying to get the tabs on the tab pane to be rotated 90 degrees and visible completely.
My attempt has ended in this
Image
I was able to rotate it by adding a rotate styling to the tab itself, but i cannot resize the anchorpane, or tab at all.
After googling for a long time, I could only find this http:// javafx-jira.kenai.com/browse/RT-19547. It says that the only way they could do it is to "put the text into the tab's 'Graphic' to achieve this". I'm not sure what that means or how to accomplish that.
My end goal is to create tabs that have the same shape and feel as these (image)
In this solution:
http://oreilly.com/pub/a/mac/2002/03/22/vertical_text.html
The text was painted vertically and tried as an icon on the tab. This way you don't have to modify JTabbedPane you just use a custom Icon in the tab.
Of course you would also have to specify the tab placement to be on the Left.

GWT: how do I scroll to the bottom of the page?

On my page I have a panel which is hidden by default. I can show it via myPanel.setVisible(true) when necessary. After this the height of the window is increased and the window scrollbar appears.
The problem is that the window is not scrolled to the bottom automatically, which is a desired behaviour. How can I fix it? I just want to scroll my page to the bottom.
I know Window.scrollTo (LEFT, TOP) can help me. But the problem is that I dont know how can I calculate the height of the page relative to the top - the second parameter I need to provide to this method. I really tried numerous ways:
Window.getClientHeight();
Document.get().getScrollHeight();
Document.get().getBody().getOffsetHeight();
Document.get().getBody().getAbsoluteBottom();
First two of them do not change their value after the hidden panel becomes visible. The second pair gives me 0 and 8 (???) values.
So how can I solve my issue?
ps
If the situation is a bit different and I have a div with a scrollbars, not the window scrollbars, is it possible to scroll it to the bottom programmatically?
You can use setVerticalScrollPostion API and set the position of the scroll
Is it simple Panel or some subclass of it.
In any case, try first with:
int top = myPanel.getAbsoluteTop();
and then scroll to some value aggregated with top.
From API:
public int getAbsoluteTop()
Gets the object's absolute top position in pixels, as measured from the browser window's client area.
For scrolling down the document, you should use the scrollTo method in Window object, i.e.:
Window.scrollTo(0, Window.getScrollTop() + Window.getClientHeight());
You actually do not need to know the size of the page to scroll to it's bottom. Just use
Window.scrollTo(0, Integer.MAX_VALUE);
At least this always worked for me.
If you want , you can create a widget handle with an id.
For example : widget.getElement().setId("scrollPanel");
Then you can scroll the view on the widget with Document.get().getElementById("scrollPanelFooter").scrollIntoView();
It's simpler!

How to disable horizontal scrolling in org.eclipse.epf.richtext.RichTextEditor

I have an Eclipse RCP application that has a widget that uses the rich text editor from org.eclipse.epf.richtext.RichTextEditor. So all the code is open to me to alter to how I see fit. I have found that the rte uses a browser to display the text.
My problem is that I want the rte to wrap the text and not put a horizontal scroll bar. So I was hoping to see if anyone has used this rte and figured out how to do this.
I think that in every SWT widget's constructor you can pass a style. So for example if you want vertical scroll but no horizontal you can do this:
new MyWidget(parent, SWT.V_SCROLL);
This way the widget won't scroll horizontally. the RichTextEditor itself does not have anything about text wrapping in its API so I guess that you can't alter that directly.
A little more about SWT styles: SWT style bits
Examine the HTML which is displayed in the SWT browser widget (call getText()). That should give you an idea how it's organized. Find the HTML element which wraps the editor, set it's width to 100% and make sure you do the same for the body and html elements to have the widget's width propagate to the editor element.
That should already fix the issue unless the text in the editor contains elements which are wider than the widget.

Categories