Shortly: i want to position a dialog in the middle of the screen and not in the middle of the page.
I have a problem positioning a dialog with primefaces. My Dialog is usualy in the middle of the screen and if the height of my page is not bigger than my screen its ok. But if there is a scroll bar and the height is for example 3 times my screen (e.g. 3072 in a 1280*1024 resolution), the Dialog is displayed at position 1536, which is out of my screen. As the background is frozen, the only way i can do something is by refreshing or leaving the page.
Any idea?
Use attribute position:
position="center"
Other possible values are:
top
bottom
left
right
right,top
right,bottom
left,top
left,bottom
You can use html .
-Create div element.Firstly hide it
When you want to show it,change z-index and display of div element.
-You can use size that you want
My idea :)
Related
I've been working on a Button extending class that when left-clicked on displays a stay-open popup menu (ContextMenu object) on a configurable side/corner of the button. The constructor takes an enumerated value like NORTH_LEFT that indicates the side of the button where it gets shown and which edges on both the button and popup are aligned. In other words the 2 should always show in an L shape combo, not a T shape.
So when I want to do something like EAST_BOTTOM where the bottom edges of both button and popup should align, I figured something like this would work:
PopupMenu.show(this, Side.RIGHT, 0, this.getHeight() - PopupMenu.getHeight());
But what I get is a Popup that appears much higher up then it should. That's because the PopupMenu.getHeight() call is returning a larger value then expected. I suspect because it is including the large shadow border in its dimensions. I've noticed that this semi-visible border also extends over my button a bit and prevents mouse clicks from registering on the edge of the button near the menu. So I have multiple reasons to want a border of 0 width.
I assume there is a way to do it via CSS. I've tried setting -fx-background-insets and -fx-padding to 0 but neither seems to make a difference. Any other suggestions?
The solution is to add -fx-effect: null; to your CSS for the ContextMenu. This removes the dropshadow effect that is the modena.css default for ContextMenus. Once I did that I was able to correctly place my menu wherever I needed it to go.
Credit for this working answer goes to José Pereda - we worked it out in the comments above.
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.
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!
On a BorderLayout panel (with hidden overflow), when Page Down, ↓ or End are pressed the page is scrolled down, hiding its top. How to prevent it?
This same problem occurs on the Ext GWT example website also. To reproduce it, left click on the tab panel header on an empty area and press Page Down.
Here's a screenshot illustrating the problem.
i find the way to solve this problem ,
i give margin to my viewport
x-viewport {margin-bottom: -16px;}
and Done!
I have a need to make my dialog partially transparent. Pull out a tab from google chrome to create a new window, while dragging the shape it makes is the shape that I want to make, minus see-through.
The point is that my dialog is a fairly simple and standard dialog, but I need one chunk of it cut out and transparent. Double points if that area is not part of the dialog so clicking there will lose focus from the dialog.
you can set the opacity.
http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#Setting-the-Opacity-Level-of-a-Window
I see what you mean by chrome page tab. In this case you may have to have an underlying panel which is transparent, this panel would then contain the tab in the top corner, and the rest of the page underneath. ie 2 separate components
hope that is what you very looking for