Edit:
Bug report Bug Report on github
Situation:
I am writing an app with the ObjectPageLayout.
In the header content I have a sap.m.Select and a sap.m.MultiComboBox with a reset button each.
I want to have them in the header, since they filter all Diagramms and Tabels of the diffrent tabs.
I set my css class as it is discribed in the Workthrough.
When the style is set to compact mode due to the device type everything is fine.
Problem:
When the css class is cozy the select still has the compact style.
The MultiComboBox and buttons and everything else take the cozy style.
--> it looks really bad
Does anyone have an idea, why the select doesn't have the cozy style aswell?
I even tryed hard setting the css style in the XML, but it doesn't work.
If I change the css class of the MultiComboBox or the buttons it works,
but I dont want to always have everything on compact just because the select cannot go on cozy...
To replicate the problem you can just create a new project (UI5 Version 1.71) in the webide and replace the view with mine:
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns="sap.uxap"
xmlns:layout="sap.ui.layout"
xmlns:m="sap.m"
xmlns:f="sap.f"
controllerName="TEST.TestingSelects.controller.Home"
height="100%"
>
<ObjectPageLayout
id="ObjectPageLayout"
enableLazyLoading="true"
useIconTabBar="true"
showTitleInHeaderContent="false"
>
<headerTitle>
<ObjectPageHeader
id="headerForTest"
objectTitle="{i18n>home.title}"
>
</ObjectPageHeader>
</headerTitle>
<headerContent>
<m:VBox>
<m:HBox>
<m:Select
id="idStoreSelect"
selectedKey="{homeModel>/storeSelectKey}"
change="onStoreSelectChange"
items=""
>
<core:Item
key=""
text=""
/>
</m:Select>
<m:Button
icon="sap-icon://redo"
press="onResetStoreButtonPress"
tooltip="{i18n>home.store.redo.tooltip}"
type="Transparent"
/>
</m:HBox>
<m:HBox>
<m:MultiComboBox
id="idCatMCB"
selectedKeys=""
selectionChange="onCatMBCChange"
items=""
>
<core:Item
key=""
text=""
/>
</m:MultiComboBox>
<m:Button
icon="sap-icon://redo"
press="onResetCatButtonPress"
tooltip="{i18n>home.cat.redo.tooltip}"
type="Transparent"
/>
</m:HBox>
</m:VBox>
</headerContent>
<sections>
<ObjectPageSection title="2014 Goals Plan">
<subSections>
<ObjectPageSubSection title=" ">
<blocks>
<m:Button
icon="sap-icon://redo"
press="onResetCatButtonPress"
tooltip="{i18n>home.cat.redo.tooltip}"
type="Transparent"
/>
</blocks>
</ObjectPageSubSection>
</subSections>
</ObjectPageSection>
<ObjectPageSection title="Personal">
<subSections>
<ObjectPageSubSection title="Connect">
<blocks>
<m:Button
icon="sap-icon://redo"
press="onResetCatButtonPress"
tooltip="{i18n>home.cat.redo.tooltip}"
type="Transparent"
/>
</blocks>
</ObjectPageSubSection>
<ObjectPageSubSection id="paymentSubSection" title="Payment information">
<blocks>
<m:Button
icon="sap-icon://redo"
press="onResetCatButtonPress"
tooltip="{i18n>home.cat.redo.tooltip}"
type="Transparent"
/>
</blocks>
</ObjectPageSubSection>
</subSections>
</ObjectPageSection>
</sections>
</ObjectPageLayout>
</mvc:View>
Code of select when hard setting css style:
<m:Select
id="idStoreSelect"
class="sapUiSizeCozy"
selectedKey="{homeModel>/storeSelectKey}"
change="onStoreSelectChange"
items=""
>
<core:Item
key=""
text=""
/>
</m:Select>
SAP fixed the UI5 bug with the version 1.95 (commit 4c7fffe).
Here you can see, that the sap.m.Select no longer has its own height set in the ObjectPageHeaderContent but applies the height according to the density class:
UI5 ≥ 1.95
UI5 ≤ 1.94
Screenshots from: https://plnkr.co/edit/gTxIx9BvTChZovBZ?preview
To fix the width of the Select you can add the aggregation layoutData
<m:layoutData>
<m:FlexItemData growFactor="1" />
</m:layoutData>
To fix the height of the Button you need to set the content density (as described in the official Walkthrough (Step 37)).
Basically you provide a method in your Component.js which returns the correct density (and don't forget to import "sap/ui/Device" at the top!)
getContentDensityClass : function () {
if (!this._sContentDensityClass) {
if (!Device.support.touch) {
this._sContentDensityClass = "sapUiSizeCompact";
} else {
this._sContentDensityClass = "sapUiSizeCozy";
}
}
return this._sContentDensityClass;
}
Then in the controller of your root view (defined in manifest.json > sap.ui5 > rootView) you can call this method
onInit: function() {
this.getView().addStyleClass(
this.getOwnerComponent().getContentDensityClass()
);
}
I put together a small sample:
https://plnkr.co/edit/h1JZiyYrWLmuck46
Related
My IonTabBar is being covered always by iOS notches on the phone. How do I increase the size of the IonTabBar so it is above any notches?
I'm working on this stackblitz:
https://stackblitz.com/edit/ionic-react-demo?file=index.js
I've added onto variables.css the following:
ion-tab-bar {
--height: 1000px;
--min-height: 1000px;
}
and nothing happens.
Here is a screenshot of my issue:
https://imgur.com/a/UqkXOEB
commenter said that footer could handle iPhone notches but I've tried to add IonFooter but no matter where I add it, then the app doesn't load. I kind of have a complicated router setup (abbreviated):
App.js
<IonApp>
<IonReactRouter>
<Route path="/" component={isLoggedIn ? Maintabs : UnloggedinRoutes} />
</IonReactRouter>
</IonApp>
Maintabs.js
<IonTabs>
<IonRouterOutlet>
<Redirect exact path="/" to="/profile" />
</IonRouterOutlet>
<IonTabBar className="stylebar" slot='bottom'>
<IonTabButton color='black' tab='Profile' href='/profile'>
<IonIcon icon={ellipse} />
<IonLabel>Profile</IonLabel>
</IonTabButton>
<IonTabButton tab='Leaflet' href='/leafletMap'>
<IonIcon icon={triangle} />
<IonLabel>Map</IonLabel>
</IonTabButton>
</IonTabBar>
</IonTabs>
I've tried adding IonFooter all over and didn't get anywhere.
I'm using Java EE with JDK 1.8, Maven and Primefaces. Regarding the tabMenu of Primefaces I have the following question:
How can I align the last menuitem to the right?
Please see my code below:
<p:tabMenu activeIndex="#{param.i}">
<p:menuitem value="Login" outcome="/Person/PersonLogin.xhtml"
icon="fa fa-sign-in"
rendered="#{!personModel.personLoggedIn()}">
<f:param name="i" value="#{(!personModel.personLoggedIn())?0:99}"/>
</p:menuitem>
<p:menuitem value="Register" outcome="/Person/PersonRegistration.xhtml"
icon="fa fa-user-plus"
rendered="#{!personModel.personLoggedIn()}">
<f:param name="i" value="#{(!personModel.personLoggedIn())?3:95}"/>
</p:menuitem>
<p:menuitem value="#{personModel.usedAccount.balanceFormatted}"
outcome="/Overviews/TransactionOverview.xhtml"
style="float:right; margin-right: 30px; #{personModel.usedAccount.balance >=0 ? 'color:green;' : 'color:red;'}"
rendered="#{personModel.personLoggedIn()}">
<f:param name="i" value="#{(personModel.personLoggedIn())?123:94}"/>
</p:menuitem>
</p:tabMenu>
This code snippet style="float:right; margin-right: 30px; #{personModel.usedAccount.balance >=0 ? 'color:green;' : 'color:red;'}" in the last menuitem still doesn't align it on the right side:
Currently the output is the following:
while it should look like this:
I have just checked the css that primefaces used. And I see that your css code is used for <a> element instead of outer <li> element. When I manually add your css to outer <li> element, it is working as you want. You need to find a way to add your css to outer <li>
Or, you may use
<p:panelGrid columns="2" layout="grid" columnClasses="ui-grid-col-10,ui-grid-col-2>
first element your <p:tabMenu> element without last <p:menuitem>
and second one can be a <p:commandLink> element
<p:panelGrid columns="2" layout="grid" columnClasses="ui-grid-col-10 tabMenucssclass,ui-grid-col-2 commandlinkcssclass>
<p:tabMenu></p:tabMenu>
<p:commandLink></p:commandLink>
</p:panelGrid>
Check out primefaces panelGrid element
UPDATE - This is not for score, just for answer you should accept #Kukeltje answer
.flo .ui-tabmenuitem:last-child{float: right;}
<p:tabMenu class="flo"></p:tabMenu>
For me the following works (tested in the PF showcase on 6.0.x)
.ui-tabmenuitem:last-child {
float: right !important;
}
Although it is better to not use !important and see if adding a styleClass to the menuItem or the tabMenu and use that in your selector works to (no time to try, sorry).
Update:
As #mismanc and OP found out, styleClass or related is not supported on the tabMenu but a class is. So if you do not want this on every tabmenu
<p:tabMenu class="flo">
...
</p:tabMenu>
and use the class in the selector
.flo .ui-tabmenuitem:last-child {
float: right;
}
I am using PF v. 5.3.5 and JSF v. 2.2.8.
<p:tree value="#{userFiltersBean.objectsTreeModel}" var="node" hideRootNode="true" styleClass="filtersTree">
<p:treeNode icon="">
My CSS class is below:
.ui-treenode-icon{
background: url("#{node.leafIcon}") no-repeat top !important;
}
I see the same icon in each treeNode that it is not desired. This icon is for the final treeNode in the tree.
However, I want to iterate trough them that each treeNode has his own icon.
NOTE The size of tree is different on each environment and it is created dynamically.
How can I do this, please?
Please, see current PF version here.
The desired Icefaces version is here.
Thanks in advance.
In the Api-Documentation (http://www.primefaces.org/showcase/ui/data/tree/basic.xhtml -> Documentation Tab) it says you could do it like this:
<p: tree value="#{bean.root}" var="doc">
<p:treeNode type="mp3" icon="ui-icon ui-icon-video">
<h:outputText value="#{doc.name}" />
</p:treeNode>
<p:treeNode type="document" icon="ui-icon ui-icon-image-document">
<h:outputText value="#{doc.name}" />
</p:treeNode>
</p:Tree>
So in the backing Bean you have to give the Node a name, which will be the p:treeNode type. So as far as I understand
TreeNode mp3 = new TreeNode("mp3", "some music");
would do the linking for
<p:treeNode type="mp3" ... />
Let me know if it helped.
Cheers
kyhu :)
SOLVED without css
I solved by inserting a h:graphicImage inside treeNode without facet. it now as I needed and how it was done in the previous version.
<p:tree value="#{userFiltersBean.objectsTreeModel}" var="node" hideRootNode="true" styleClass="filtersTree"
selectionMode="checkbox">
<p:treeNode>
<h:graphicImage value="#{node.leafIcon}" />
<h:outputText value="#{node.text}" />
</p:treeNode>
</p:tree>
Having different values for each element with one CSS class is not possible. You would have to create a class for each icon, like so:
my-treenode-icon-1 {
background: url("/resources/img/treenode/icon-1.jpg") no-repeat top !important;
}
my-treenode-icon-2 {
background: url("/resources/img/treenode/icon-2.jpg") no-repeat top !important;
}
and then in iteration use icon name instead of path (if you have a path in database you can slice last part of it and take only the image name which will be class name).
<p:tree value="#{userFiltersBean.objectsTreeModel}" var="node" hideRootNode="true" styleClass="filtersTree">
<p:treeNode icon="my-treenode-#{node.iconName}">
I know that inputNumberSlider in richfaces allow you to increase values with a slider also by an indicator. Is it possible to change the indicator with an other shape, for example square or circle?.
I saw that there are many properties to change aspect, like, for example, several style properties to change colors,width, to handling input, steps and other, but I didn't find anything about this.
Here are some examples:
<rich:inputNumberSlider value="50" showInput="false" enableManualInput="false" showBoundaryValues="false" showTooltip="false"/>
Without boundary values and without manual input
<rich:inputNumberSlider maxValue="100" step="2" value="0" width="6" showArrows="true" showTooltip="false" />
A disabled inputNumberSlider example:
<rich:inputNumberSlider width="100" maxValue="200" step="1" showArrows="true" showTooltip="false" disabled="true" value="0" />
The icon is not directly customizable but you can use handleClass:
.myHandleClass {
background-image: url('my/image.gif');
}
<rich:inputNumberSlider handleClass="myHandleClass" … />
I have a little trouble with tag h:selectOneMenu, I just want to add some background image to option, such as avatar of user.
Follow styling options in h:selectOneMenu - by balusC
I had tried to render options with its own style css.
<h:selectOneMenu id="dropListUser"
value="#{myController.myUserObject.userid}">
<f:attribute name="avatar" value="#{true}"></f:attribute>
<f:attribute name="key" value="somthing"></f:attribute>
<f:attribute name="height" value="32"></f:attribute>
<f:attribute name="width" value="32"></f:attribute>
<f:selectItems value="#{myController.listOfUsers}" var="item" itemLabel="#{item.username}" itemValue="#{item.userid}"/>
</h:selectOneMenu>
It work great with height, width and key, but with avatar(or any attribute contains value with #{} expression) server bean could not get it.
Try to printout all key name:
Iterator itr = component.getAttributes().keySet().iterator();
while(itr.hasNext()){
System.out.println(itr.next().toString());
}
there is no key with name avatar :
--------------------------------
height
javax.faces.component.VIEW_LOCATION_KEY
com.sun.faces.facelets.MARK_ID
key
width
width: 32 height: 32 style null?: true
--------------------------------
ps: by the way,Is there any one know how to create custom taglib that extends h:selectOneMenu :-?
ps2: In the fact, If I could get myController.listOfUsers
in <f:selectItems value="#{myController.listOfUsers}" var="item" itemLabel="#{item.username}" itemValue="#{item.userid}"/> in my custom render bean, it could be better
Woof, I don't know why or how, but when try print out all of key names from component.getAttributes() also component.getAttributes().containsKey("avatar") return that avatar is not exist, BUT I really can get avatar value, my trouble was solved ^^" just remove code that check the key exist or not