GWTBootstrap3 equivalent of android's "match-parent" - gwtbootstrap3

Is there any way to fix the size of a Panel to take up the full space inside its Column instead of wrapping around the content?
My parent column has 2 panels side by side- one for stacked Navpils menu (with variable number of items) and one to show the data based on menu choice. I need the data panel to match the height of the menu panel.
Here's the relevant section of code:
<b:Column size="MD_3">
<b:Panel>
<b:PanelHeader>
<b:Heading size="H3" text="Services" />
</b:PanelHeader>
<b:PanelBody>
<b:NavPills stacked="true">
<b:AnchorListItem text="ClockService" ui:field="clockService" />
<b:AnchorListItem text="CloudService" ui:field="cloudService" />
<b:AnchorListItem text="CommandService" ui:field="commandService" />
<b:AnchorListItem text="WebConsole" ui:field="webConsole" />
<b:AnchorListItem text="DataService" ui:field="dataService" />
<b:AnchorListItem text="MqttDataTransport" ui:field="mqttDataTransport" />
<b:AnchorListItem text="SslManagerService" ui:field="sslManagerService" />
<b:AnchorListItem text="WatchdogService" ui:field="watchdogService" />
</b:NavPills>
</b:PanelBody>
</b:Panel>
</b:Column>
<b:Column size="MD_9">
<b:Panel ui:field="contentPanel">
<b:PanelHeader ui:field="contentPanelHeader">
</b:PanelHeader>
<b:PanelBody ui:field="contentPanelBody">
</b:PanelBody>
</b:Panel>
</b:Column>
Any help or suggestions are appreciated, I'm also open to using other widgets as long as they provide a similar view.

If you want the contents of a *Panel to use up all the available space, just wrap its contents in a Column with the appropriate size (like MD_12). Depending on your layout, it might be sufficient to reverse the hierarchy - the Panel should be the parent and the Column its child. If you have a lot of situations like this (or this is a widget that's used a lot), you can avoid "unnecessary" wrapping by just applying the CSS style .col-md-12 to your widget (the Panel's contents) directly.

Related

SAPUI5: ObjectAttribute Wrap Text

I am attempting to display a wrapped long text in an ObjectAttribute in an SAP UI5 application:
<List id="__listObjectAttributes" noDataText="Drop list items here" headerText="Shipping Information" items="{Shipments}">
<items>
<ObjectListItem id="__listItemShipments" title="{ShipmentTxt}">
<attributes>
<ObjectAttribute id="__attributeShipmentId" title="Shipment #" text="{Id}"/>
<ObjectAttribute id="__attributeShipmentCode" title="Shipment Code" text="{ShipCd}"/>
<ObjectAttribute id="__attributeShipmentLongText" title="Long Text" text="{LongText}" binding="{ShipmentLongText}"/>
</attributes>
</ObjectListItem>
</items>
</List>
The problem is, when the list is displayed the text is truncated instead of wrapped. I've been looking for ways to wrap the text in an ObjectAttribute, but to no avail.
I have found articles that say both "you can do it" and "you can't do it".
Possible: https://archive.sap.com/discussions/thread/3589475
Not possible: https://experience.sap.com/fiori-design-web/object-list-item/
If it is not possible to add this information to an ObjectAttribute, does anyone know a way to display the same information in a list that will accept wrapped text?
Solution
#Ran Hassid's answer was correct! Using a CustomListItem in combination with a SimpleForm was the best solution. Here is the code I ended up going with:
<List id="__listObjectAttributes" noDataText="Drop list items here" headerText="Shipping Information" items="{Shipments}">
<items>
<CustomListItem id="__listItemShipments">
<content>
<form:SimpleForm id="__formShipmentList" editable="true" layout="GridLayout" labelMinWidth="100">
<form:content>
<!--Id-->
<Label id="__labelShipmentId" text="Id"/>
<Text id="__textShipmentId" text="{Id}"/>
<!--Shipment Code-->
<Label id="__labelShipmentCode" text="Shipment Code"/>
<Text id="__textShipmentCode" text="{ShipCd}"/>
<!--Long text-->
<Label id="__labelShipmentLongText" text="LongText"/>
<Text id="__textShipmentLongText" text="{Longtext}" binding="{ShipmentLongText}"/>
</form:content>
</form:SimpleForm>
</content>
</CustomListItem>
</items>
</List>
Then I added the sap.ui.layout.form to the mvc:View to simplify the code:
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" xmlns:form="sap.ui.layout.form" controllerName="shipments.controller.ShipmentDetail">
I think that even if it is possible (I assume via css changes and so on) it is not recommended because it is not part of the ObjectAttribute interface. In order to achieve the same effect you can do one of the following:
Use CustomListItem instead of ObjectListItem and inside the content of it wrap a SimpleForm. The simple form layout should be grid layout because you want to position text next to the title in the same row. In the Text control you can put as longest string as you want and also control on the wrapping of it. So your code should look something like that (I didn't use binding but I assume you will know what to do in your code)
<List noDataText="Drop list items here" id="__list0">
<items>
<CustomListItem type="Navigation" id="__item1">
<content>
<sap.ui.layout.form:SimpleForm xmlns:sap.ui.layout.form="sap.ui.layout.form" xmlns:sap.ui.core="sap.ui.core" editable="true" layout="GridLayout" id="__form0" labelMinWidth="100">
<sap.ui.layout.form:content>
<sap.ui.core:Title text="Title" id="__title0" />
<Label text="Long Text" id="__label1" />
<Text text="Very long text with\nmultiple lines" />
<Label text="Other text" id="__label2" />
<Text text="Some text goes here" />
</sap.ui.layout.form:content>
</sap.ui.layout.form:SimpleForm>
</content>
</CustomListItem>
</items>
</List>
The second option is to use CustomListItem but with VBOX + HBOX. so you have a VBOX which wrap HBOX's and inside each HBOX you put title next to the text.
I recommend to go with the first approach because it's much more clear and responsive.
Good luck.
I would recommend using basic CSS to solve this issue.
XML-View:
...
<ObjectAttribute text="{aVeryLongText}" class="objectAttributeWrapper" />
...
CSS:
.objectAttributeWrapper * {
white-space: pre-line !important;
word-wrap: break-word !important;
}
This will even work if there are changes on the sap.m.ObjectAttribute Interface, since this CSS-Selector grabs all children of the element which we assigned the CSS class to.
Speaking from my experience this was a quick and stable solution. I had to extend a legacy app, where replacing the whole control would result in me needing to rewrite a whole controller.
Works like a charm and didnt break since 1.71.50

ace:selectMenu and unwanted blank value

I have an ace:selectMenu nested with a <f:selectItems value="#{formLayout.formSelectList}" /> and formSelectList which has two elements (SelectItem objects), but I'm still with a blank element at top in my select input.
How can I make this work?
My full code:
<ace:selectMenu valueChangeListener="#{formLayout.onFormChange}" disabled="#{formLayout.editMode}" >
<f:selectItems value="#{formLayout.formSelectList}" />
<f:converter converterId="javax.faces.Integer"/>
<ace:ajax execute="#this" render="#all" />
</ace:selectMenu>
I'm using icefaces 4.1.1

Hiding parts of OpenXml documents programmatically

Is it possible to programmatically hide parts of an OpenXML document, without actually removing it?
The reason I would want to do this: This is a template file, dynamic parts are filled using databindig. And some parts should be hidden, if there is no backing data. But don't want to actually remove parts from the document, so the document could be "refreshed" later with new data.
Something like display: none in html/css.
The is no exact equivalent to hiding content in Word using the open xml sdk. However there are two approaches that might work for you:
Hidden paragraph trick
Create a style, let's call it HiddenParagraph. Define it in your styles.xml as follows:
<w:style w:type="paragraph" w:customStyle="1" w:styleId="HiddenParagraph">
<w:name w:val="HiddenParagraph" />
<w:next w:val="Normal" />
<w:pPr>
<w:spacing w:line="14" w:lineRule="auto" />
</w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorEastAsia" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:style>
The w:line=14 makes the paragraph effectively invisible.
Now render the content your don't want to see using this paragraph style.
<w:p>
<w:pPr>
<w:pStyle w:val="HiddenParagraph" />
</w:pPr>
<w:r>
<w:text>you should not be able to see me
</w:r>
</w:p>
To show the content again just change the paragraph style to normal or some other more sane style.
Custom XML Part
Store data you don't want to display in the document in a custom xml data store, although this might not work in your specific scenario
Reference
http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2010/10/27/59361.aspx

Building a Tree Widget in GWT

I am trying to build a Tree Structure in GWT which gets to be scrollable when the number of items are large, the Tree structure will permanently reside on the WestRegion of my Application DockLayout Panel.
The Main code:
<!-- The west side has a panel with complex dynamic tree list to be implemented -->
<g:west size='14'>
<app:Mainlist ui:field='mainlist'/>
</g:west>
The Mainlist:
<g:VerticalPanel>
<g:ScrollPanel>
<g:HTMLPanel width='100%' >
<div class='{style.contentColumn}'>
<g:Tree ui:field='citytree'>
<g:TreeItem text='Delhi/NCR'/>
</g:Tree>
</div>
</g:HTMLPanel>
</g:ScrollPanel>
</g:VerticalPanel>
</ui:UiBinder>
However I dont see anything in the west region. Can anyone point out what am I doing wrong?
Moreover:
In the corresponding "Mainlist.java" file I cannot say #UiField Tree citytree(Gives Exception) . This seems to be because of the nesting involved. How do I access my Tree instance?
The GWT showcase has Tree built without using UiBinder. Moreover I could not find any sample code to build a Tree structure with UiBinder. Any resources?
After searching and exploring more. I did it. I think theere is no example code online so this post might be helpfull for learners like me.
<ui:with field='res' type='myth.social.zomato.client.Mainlist.Images' />
<ui:style src="resources/GlobalStyles.css">
</ui:style>
<g:Tree ui:field='tree' resources='{res}'>
<g:TreeItem text='Cities' >
<g:TreeItem text='Ahemadabad'/>
<g:TreeItem text='Banglore'/>
<g:TreeItem text='Chennai' />
<g:TreeItem text='Delhi/NCR' />
<g:TreeItem text='Hyderabad' />
<g:TreeItem text='Jaipur' />
<g:TreeItem text='Kolkata'/>
<g:TreeItem text='Mumbai'/>
<g:TreeItem text='Pune' />
</g:TreeItem>
<g:TreeItem text='SalesPerson'>
<g:TreeItem text='Sales1' />
<g:TreeItem text='Sales2' />
</g:TreeItem>
</g:Tree>

How to re-render a RichFaces component after a4j link is invoked

Hoping someone can help me with a slight hurdle I've come up against in regards to re-rendering of RichFaces components after an a4j link/button has performed it's action. A simplified version of my problem is as follows:
I have 2 output components displaying a text value which are rendered based on some value in my manager class:
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
I also have 2 a4j links that call some action and then re-render the above outputText components:
<a4j:commandLink ajaxSingle="true" value="Set On" action="#{manager.setOn(true)}" reRender="on,off" />
<a4j:commandLink ajaxSingle="true" value="Set Off" action="#{manager.setOn(false)}" reRender="on,off" />
What I would expect to happen is, when I click the 'Set On' button, the 'ON' outputText component would unhide, and the 'OFF outputText component would show. However, this does not happen.
Does anyone have the answer as to why this is so, and how I go about re-rendering these components after the a4j component action has completed?
Wrap the outputText components in an s:div and re-render that as follows:
<s:div id="myDiv">
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
</s:div>
<a4j:commandLink ajaxSingle="true" value="Set On"
action="#{manager.setOn(true)}" reRender="myDiv" />
<a4j:commandLink ajaxSingle="true" value="Set Off"
action="#{manager.setOn(false)}" reRender="myDiv" />
I agree with Gene but the best way I could find is to surround the content with
<a4j:outputpanel id="whatever_id" />
for example,
<a4j:outputpanel id="myDiv">
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
</a4j:outputpanel>
You rerender the parent. It doesn't have to be a Seam tag.
I suppose that your h:outputText elements on and off are not rendered at load time of the page.
RichFaces will not rerender these components later even if the value of rendered changed to true.