How to get space between icon and label on button? - lotus-notes

I am working on one of my first xPages applications. I want to add a nice little icon (from the FamfamFam collection) to some of my buttons, e.g. "New","Save", "Cancel", etc.
I add the GIF images as image resource, and specify the image for the buttons I want the icons on.
It all works, but the label (text) on the button is right next to the icon. I would like them to be spaced out some, perhaps 4-6 pixels. I would prefer not to have to add spaces to the label, I am sure there is a better way, probably using CSS somehow.
Anyone know a good way to do this?
OneUI v2.1 is set as the theme for the application and I am using Domino Designer 8.5.3 and Domino Server 8.5.3.

You can use the following custom CSS to add some margin to the right of the icon:
.lotusBtn img {
margin-right: 10px;
}

To add a space I use an <xp:text themeId="Text.Blank"></xp:text>
Text.Blank is in my Theme resource with the following control block:
<control override="true">
<name>Text.Blank</name>
<property mode="override">
<name>escape</name>
<value>#{false}</value>
</property>
<property mode="override">
<name>value</name>
<value>&nbsp;</value>
</property>
</control>

Related

XPages favicon with oneui theme

I want to set a favicon in XPages. I am using Domino 8.5.3 with the latest 8.5.x version of the extlib. As application theme oneuiv2.1 is used.
I tried setting the pageIcon attribute in the XPage without success. Adding a link attribute to the header using
<xp:this.resources>
<xp:headTag tagName="link" rendered="true" loaded="true">
<xp:this.attributes>
<xp:parameter name="rel" value="icon"></xp:parameter>
<xp:parameter name="href" value="favIcon.png">
</xp:parameter>
<xp:parameter name="type" value="image/png">
</xp:parameter>
</xp:this.attributes>
</xp:headTag>
</xp:this.resources>
did not change the favicon. I found in various blogs, that I have to add a control to the application theme, for example:
<control>
<property>
<name>pageIcon</name>
<value>favicon.ico</value>
</property>
</control>
However I use the provided oneUi theme and do not want to create a custom theme. Is there a way to either set the favicon directly or modify the theme without creating a complete new one?
I think you are missing the control name in your theme rule.
Here is the syntax of the theme rule that works for me. (Taken from Tim Tripcony's HowYaBean demo application referenced on NotesIn9 and downloadable from here). I use it a ton. It takes the icon from the NotesDatabase (remember the one from the old Notes workspace that has not yet been pried out of my cold dead fingers). It also works with image or file resources.
<control override="false">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/$icon</value>
</property>
<property>
<name>pageTitle</name>
<value>#{database.title}</value>
</property>
</control>
This works for me - icon shows in tab bar and shortcut created from application URL.
Image resource (PNG image) with name img_ApplicationIcon16. The name is generic for every application, but each NSF contains different image.
Every XPage has property pageIcon="/img_ApplicationIcon16"
It renders as <link rel="SHORTCUT ICON" href="/path/database.nsf/img_ApplicationIcon16">
In my case, I did not want to use theme, too.
Import the favicon.ico file as file resource instead of image resource
Add the following code to the selected theme:
<control>
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
</control>
Set up the application to use the theme containing the reference for the favicon.
Create a new xpage for testing, or delete the browser cache.
This works for me properly. In the browser window you should see the folloving source:
<link rel="SHORTCUT ICON" href="/db.nsf/favicon.ico">
(db.nsf is your database.)
If still not work check the xpage: "All properties-styling-disableTheme" should not be enabled.

XPages: Add a button to a data view custom control

I'm using the Extension Library for creating XPages and I want to use a view, where i can use some inline buttons (buttons in every row of the view) and I also want to use the functionality of the data view where I can expand the content of the current row.
I want to use one of those inline buttons, to expand the content of this row, because before the functionality of this button can be executed, the user has to enter some data in an inputText-field.
So the questions are?
- How can I add inline buttons (using SSJS) to a data view?
- Do you know any other way to solve my problem?
Thanks!
In the Extlib database the expansion with a custom form was done using a link. I would stick to the links -> gives you the most options (client side, server side). Stick to those. If you really need that "buttony" look (which does IMHO not look very much like a web application), use CSS to style the link to look like a button. The OneUI has instructions for that (or steal them from Twitter bootstrap).
The OneUI is worth another look suggesting a different visual clue for expand/collapse.
You should be able to do this within the confines of a dataView by adding a facet for "detail" and using collapsible detail.
For the dataView, set collapsibleDetail="true", add in a panel to the detail facet, then put the elements you want to display when they click to expand in that panel.
<xe:dataView id="dataView1" collapsibleDetail="true" detailsOnClient="true">
<xp:this.facets>
<xp:panel xp:key="detail">
<xp:button id="Mybutton" value="My button"></xp:button>
<xp:label value="This is the label" id="label1" for="Mybutton"></xp:label>
</xp:panel>
</xp:this.facets>
<xe:this.summaryColumn>
<xe:viewSummaryColumn columnName="lastname"></xe:viewSummaryColumn>
</xe:this.summaryColumn>
<xe:this.extraColumns>
<xe:viewExtraColumn columnName="city"></xe:viewExtraColumn>
<xe:viewExtraColumn columnName="state"></xe:viewExtraColumn>
<xe:viewExtraColumn columnName="zip"></xe:viewExtraColumn>
</xe:this.extraColumns>
<xe:this.data>
<xp:dominoView var="view2" viewName="ByName-First"></xp:dominoView>
</xe:this.data>
</xe:dataView>
Now, I'm not positive on how to bind it to the contents of the documents displayed, but I'm sure there's a way. I know how to access the document in a repeat, but not in a dataView, so I would probably do it in a repeat (unless you figure it out and post it to us here!)
Hopefully, that moves you in the right direction.

How to set pattern for date/time converter in a theme?

I am trying to set a date/time converter using a theme but I can not get it to work.
I have tried the following and it doesn't work:
<control>
<name>InputField.EditBox</name>
<property mode="override">
<name>converter</name>
<complex type="xp_convertDateTime">
<property>
<name>pattern</name>
<value>DD-MM</value>
</property>
</complex>
</property>
</control>
If at all possible, how do I set a pattern for date/time converters in a theme?
I think the problem is timing. The theme settings are only applied during the render response phase.
The examples that work for complex properties are setting browser-related settings, like dojoAttributes. So the values are applied as the HTML is passed to the browser.
Converters work during the ProcessValidation phase (I've seen that with PhaseListeners). So the converter needs to be there much earlier in the lifecycle.
If I'm right, you won't be able to use a theme to apply a converter. You'd probably need to extend the Edit Box control and create your own component.

How to set <aui:button> icon in Liferay without using Javascript?

I'm trying to set icon to <aui:button> like on this tutorial.
But solution described there doesn't work well in my case, because I have a table and on each row I have a button with different resourceUrl. Like this:
<portlet:resourceURL id="saveReport" var="saveReportURL">
<portlet:param name="reportId" value="${report.reportId}" />
</portlet:resourceURL>
<aui:button onclick="location.href = '${saveReportURL}'">
Is it possible to set icon in <aui:button> without using JavaScript as described in tutorial?
Thanks
You can write this below code for setting icon in liferay alloy button
<aui:button type="cancel" cssClass="btn-info" icon="icon-upload-alt" iconAlign="right" value="upload" />
you need to use the icon attribute for this setting "Icon glyphs"
you need to use cssClass for adding extra design button class for the designing
you need to set iconAlign attribute for left or right side of the button text value
You should be able to add an icon to a button without using JavaScript by adding one of these Icon CSS classes to your button. For example, if you wanted to create a button with a calendar icon, your code should look something like this:
<aui:button class="icon-calendar" ... />

In Sharepoint I need to include a preview image for the screen of selecting layout for a new page

In Sharepoint 2007, I have created a layout. As you know when the user creates a page he chooses a layout from a listbox.
When you select a different element in the listbox, there is a preview image that changes on the left.
I thought this was controlled by the node PublishingPreviewImage in the xml of the layout. I have verified that the image exists in that place.
It is not working.
The code I use is:
<File Path="TituloTextoCtrl.aspx" Url="TituloTextoCtrl.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists ="TRUE">
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png" />
<Property Name="MasterPageDescription" Value="Plantilla Titulo+Texto+Control" />
<Property Name="ContentType" Value="Titulo+Texto+Control" />
<Property Name="PublishingAssociatedContentType" Value=";#Vialibre_ContentTypeGeneral;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39005215cca003b74e479baa123eb1dc5702;#" />
</File>
You also need XML to provision the image:
<Module Name="MyPreviewImages" Url="_catalogs/masterpage" IncludeFolders="??-??" Path="" RootWebOnly="TRUE">
<File Url="titulotextoctrl.png" Name="Preview Images/titulotextoctrl.png" Type="GhostableInLibrary">
</File>
</Module>
first of all upload yor layout page image in site collection document library or picture libary. Then Go to site actions--> site settings-->Galleries-->master pages and pagelayouts-->. In pagelayouts you can see your new layoutpage.
choose edit properties of your layoutpage there you can see the properties of that layout page. There is one column called preview image, give the url of image there that you already uploaed in the docu libary. click on Ok, now you have got preview image of your layout page.
Thx to Rich Bennema and Hojo for answering, there are right, but at the same time, my problem is that this layouts were deployed, and when I deploy again changing the PublishingPreviewImage, the layout is not updating. So my problem was a problem of controlling events so that everytime that I deploy the layouts are recreated in case there is changes.
This I know because it has worked for new layouts.
So for those who try this. Use the code I have provided with the one of Rich Bennema to upload the image.

Resources