Center VBox in Pane - javafx-8

I new to javaFx and using fxml to create templates.
I can't manage to center a Vbox in a Pane that is too big, although I'm certain it must be quite straightforward.
I also want a border around the VBox.
Can anyone help? Here is what I have:
<TitledPane text="Title" collapsible="false">
<content>
<GridPane hgap="10" vgap="10">
<children>
<VBox alignment="TOP_CENTER" spacing="10">
<!-- Content -->
</VBox>
</children>
<columnConstraints>
<ColumnConstraints halignment="CENTER"/>
</columnConstraints>
<rowConstraints>
<RowConstraints/>
</rowConstraints>
</GridPane>
</content>
</TitledPane>
I guess the GridPane is a bad idea, but this is the way I know to have the borders as I want them.
Thanks for your time!

I guess the GridPane is a bad idea, but this is the way I know to have the borders as I want them.
Yes it is. Using a GridPane for a single child is a overkill. Simply use a StackPane with a padding of 10:
<TitledPane text="Title" collapsible="false">
<content>
<StackPane>
<padding>
<Insets topRightBottomLeft="10"/>
</padding>
<children>
<VBox alignment="TOP_CENTER" spacing="10">
<children>
<!-- Content -->
</children>
</VBox>
</children>
</StackPane>
</content>
</TitledPane>

Related

Scrolling Issue when Page placed within Page in SAPUI5

I have a requirement where I need to place an sap.m.Page within another sap.m.Page, which I am aware is not recommended. The issue I'm facing is that I'm trying to enable scrolling for only the outer page; but the scrolling does not dynamically increase as I expand content inside the inner page. There is a lot of vertical content inside the inner page and is not entirely visible since the scrolling does not increase along with the expanded panels.
Even this does not resolve my issue. Kindly assist.
SAPUI5 version: 1.38.37
Layout of the outer page:
<mvc:View ...>
<Page showHeader="false">
<content>
<IconTabBar>
<items>
<IconTabFilter>
<content>
<mvc:XMLView viewName="namespace.view.InnerView1" displayBlock="true"/>
</content>
</IconTabFilter>
<IconTabSeparator icon=""/>
.
//multiple IconTabFilters here
.
</items>
</IconTabBar>
</content>
</Page>
</mvc:View>
Layout of the inner page (InnerView1):
<mvc:View ...>
<Page showHeader="false" enableScrolling="false">
<content>
.
//multiple expandable/collapsible Panels here
.
</content>
<footer floatingFooter="false">
<Toolbar>
<ToolbarSpacer/>
.
//multiple Buttons here
.
</Toolbar>
</footer>
</Page>
</mvc:View>
The Panels in the inner page are initially collapsed but they are expandable. But if all Panels are expanded in the running app, then the last couple of Panels are not accessible with the scrolling. i.e. the scrollbar does not adjust as per the panels' height.
Try using:
enableScrolling="false" //for disabling
enableScrolling="true" //for enabling

m.IconTabBar: How do I make tab's content scrollable?

I have a view structure like this:
<mvc:View>
<IconTabBar>
<items>
<IconTabFilter>
<SplitApp/>
</IconTabFilter>
<IconTabFilter>
<Panel>
</Panel>
<Panel>
</Panel>
</IconTabFilter>
</items>
</IconTabBar>
</mvc:View>
SplitApp looks fine and allows scrolling its content, but panels overflow and no scrolling is enabled. I thought I should wrap either IconTabBar or panels into some control like Page, VerticalLayout, or VBox, but nothing changes. Also I tried to set overflow:scroll for IconTabBar in CSS but in this case, the content of last panel moves out of IconTabBar.
What can I do?
Finally it works:
<mvc:View>
<IconTabBar stretchContentHeight="true">
<items>
<IconTabFilter>
<SplitApp/>
</IconTabFilter>
<IconTabFilter>
<ScrollContainer height="100%" vertical="true">
<Panel>
</Panel>
<Panel>
</Panel>
</ScrollContainer>
</IconTabFilter>
</items>
</IconTabBar>
</mvc:View>

SAP UI5 Application - Scrollbar issues

In SAP UI5 application, every table has its own scrollbar. There is one page level scrollbar as well. Problem is, to see all the rows of the table I have to use, both the scrollbars. For example, if I am scrolling the table, once it reaches the bottom (of the page not table), scroll disappears. Now to see remaining of the rows, I have to use Page scrollbar and move it down. Then again I can see table scroll and can move below. This means i have to use 2 scrollbars for viewing the rows. Any way to avoid this?
Second issue: If I don't use tag proper page level scroll does not appear. A very long scroll thumb appears (for example if I use semantic page tag as shown below, the scroll thumb is as good as body in length, with very little area to move as track)
ABC.xml
<mvc:View controllerName="com.ABC" xmlns:layout="sap.ui.layout" xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:semantic="sap.m.semantic">
//Here instead of semantic page if I use
// <Page class="sapUiNoMargin maxPage" showHeader="false"> it works fine
with proper page scroll of nice thumb length
<semantic:SemanticPage busy="{sharedApp>/oBusy/busy}" busyIndicatorDelay="{sharedApp/oBusy/delay}" id="page" showSubHeader="false">
<semantic:content>
<core:Fragment id="ordersGrowlNotifier" fragmentName="com.ASD" type="XML"/>
<IconTabBar id="order-tabs" select="onTabChangeEvent" expandable="false" class="tabs">
<items>
<IconTabFilter text="Order" key="cart_tab">
<content>
<VBox>
<items>
<core:Fragment fragmentName="com.Order" type="XML"/>
</items>
</VBox>
</content>
</IconTabFilter>
<IconTabFilter id="orderdetails-tab-track" key="track_tab" text="Track" visible="{orderMenu>/TrackVisible}" >
<content>
<VBox>
<items>
<core:Fragment fragmentName="com.XYZ" type="XML"/>
</items>
</VBox>
</content>
</IconTabFilter>
</items>
</IconTabBar>
</semantic:content>
</semantic:SemanticPage>
</mvc:View>

Line break in XMLView UI5

How can I set a line break between two controls?
I want to display one by one in vertical manner.
You can use a flex box control: either <VBox> or <HBox>.
<VBox xmlns="sap.m" wrap="Wrap" renderType="Bare">
<!-- ... -->
</VBox>
You don't really use linebreaks but layout controls.
If you want to have an element below another element, put both of them in a vertical layout.
https://sapui5.hana.ondemand.com/explored.html#/entity/sap.ui.layout.VerticalLayout/samples
<l:VerticalLayout>
<Input placeholder="UserID" />
<Input placeholder="Password" type="Password" />
</l:VerticalLayout>
Don't forget to include the namespace: xmlns:l="sap.ui.layout"
You can also nest different layouts: Outer layout is vertical, and each row of the vertical layout can be a horizontal layout where items are placed next to each other.
Edit: This also works in IE9. VBox unfortunately does not work in IE9.

UI5 Tiles to top of page

I'm new to UI5 and try to display some Tiles on a page.
However, they appear in the center of the screen, and I would like to have it at the top.
Below it is a graph that now doesnt even appear on the page without scrolling.
How do get it to the top of the page and remove the bottom margins ?
View:
<TileContainer
id="container"
tiles="{deviceData>/d/results}">
<StandardTile
number="BBB"
numberUnit="CCC"
title="ZZZ"
info="XXX"
infoState="CCC" />
</TileContainer>
<l:C3Chart id="chart1" class="c3Chart" height="300px" width="100%" columns="{cols}" type="{timeseries}" />
</Page> </mvc:View>
Set the height of your tile container to 50% ( or whatever suits your requirements).
code:
<TileContainer tiles='{/}' height='50%'>
<tiles>
<StandardTile title='{title}'>
</StandardTile>
</tiles>
</TileContainer>
You likely dont need a TileContainer here (tile container is full screen component to use when you have an unknown -but important- number of tiles).
You should use a simpler container like an HBox here
<HBox
id="container"
items="{deviceData>/d/results}">
<StandardTile
number="BBB"
numberUnit="CCC"
title="ZZZ"
info="XXX"
infoState="CCC" />
</HBox>