I have the following code for a popupmenu from Extension library
<xe:popupMenu id="pop">
<xe:this.treeNodes>
<xe:basicContainerNode image="/vwicn148.gif" label="Container">
<xe:this.children>
<xe:basicLeafNode label="Child" image="/vwicn148.gif"></xe:basicLeafNode>
</xe:this.children>
</xe:basicContainerNode>
</xe:this.treeNodes></xe:popupMenu>
<xp:link escape="true" text="Open popup" id="link1">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[XSP.openMenu(thisEvent,#{javascript:getComponent('pop').getMenuCtor()})]]></xp:this.script>
</xp:eventHandler>
</xp:link>
The result looks like this
As you can see the image for the basic containerNode is not displayed but the image for the basicLeafNode is displayed.
I want to add an arrow to the container node so that users know it has sub items, how can I do that?
Using firebug I can see that the image icon for the basicContainerNode has the class "dijitNoIcon" added to it, which sets "display:none" for the icon image. Whereas the leaf node does not have that dijiNoIcon class added. (I might need to look into that further as a possible defect)
But, as a workaround you could use some custom CSS to override what dijitNoIcon is doing.
<xe:basicContainerNode image="/vwicn148.gif" label="Container" styleClass="showIcon">
And add a custom css file to your application with the following:
.showIcon .dijitNoIcon{
display: block;
}
Related
I'm trying to show the employee's picture (fields: hr_employee.image) on a website template. But the template just show the default picture for employees instead of the loaded image.
I tried this:
<span t-field="employee.image" t-options="{'widget': 'image', 'style': 'height:200px;width:200px;'}"/>
And also, tried this:
<div t-field="employee.image" t-options="{'widget': 'image', 'style': 'height:200px;width:200px;'}"/>
And this:
<img t-field="employee.image" t-options="{'widget': 'image', 'style': 'height:200px;width:200px;'}"/>
Template just show this:
I'm afraid accessing images isn't as simple as that since you need sudo access to get them. If you're accessing the built-in employee module then the base model already provides this sudo access for you. Instead use the following:
<img t-att-src="image_data_uri(employee.image_1920)" style="max-height:85pt;max-width:90%"/>
The 1920 refers to the image's size. You can also use employee.image_1024, employee.image_512, employee.image_256 or employee.image_128
If you're trying to access images from your own custom module then you'll need to update the .py file to access the image and provide its public url.
You can use website.image_url to define the image src attribute.
<img t-att-src="website.image_url(employee, 'image_medium')" class="img shadow rounded" alt="Employee"/>
The above code is taken from website_hr
module (aboutus template)
I am having a WebBrowser control and loaded a local image into an IMG tag and set the DocumentText of the WebBrowser as below
<!DOCTYPE HTML>
<meta http-equiv='X-UA-Compatible' content='IE=10' />
<html lang='en'>
<body style='margin: 0; overflow: hidden;'>
<img Width = 1269 Height = 1600 src='C:\Users\ADMIN\Desktop\p41.png'></img>
</body>
</html>
It is loading perfectly fine. For some reason, I want to invoke the context menu of the image and click one of the context menu items programmatically (say for example "Copy" - though I don't want this - I can choose any item in the menu). I don't know how to achieve this. When I tried to iterate the context menu of the browser control, I am getting System.NullReferenceException: 'Object reference not set to an instance of an object.' as I have not placed any ContextMenu control in the form, since I wanted to access the WebBrowser's inbuilt context menu. Is this achievable ?
Or is there a way to get the code (which IE does) for each of its menu item, so I can directly call that - atleast for "Save picture as..." and "Copy"
Please Note: I do not want to use the "SRC" attribute to be part of any solution as I do not want that as you see I am the one forming the HTML tag with that. Hence I know that.
Please find the screenshot below
I have a dojoFilteringSelect field which I want to put a dojo tootltip for. If the user hovers over the field (or I could put an icon next to the field) I want the contents of a computed field to show up.
Looked around and saw various examples but what I cannot find is how to connect the tool tip to the hover action? I am running this in the Lotus client.
My code is below.
<xe:djFilteringSelect id="djFilteringSelect3"
rendered="true" value="#{document1.loc}" tabIndex="1">
<xe:this.defaultValue><![CDATA[""]]></xe:this.defaultValue>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:getComponent("lookupLocs").getValue();}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onClick" submit="false">
<xe:this.script><![CDATA[XSP.openTooltipDialog("#{id:tooltipDialog1}", "#{id:label1}")]]></xe:this.script>
</xp:eventHandler></xe:djFilteringSelect>
<xe:valuePicker dialogTitle="Locs with Loc Manager"
for="djFilteringSelect1">
<xe:this.dataProvider>
<xe:simpleValuePicker>
<xe:this.valueList><![CDATA[#{javascript:getComponent("lookupLocs2").getValue();}]]></xe:this.valueList>
</xe:simpleValuePicker>
</xe:this.dataProvider>
</xe:valuePicker>
<xe:tooltipDialog id="tooltipDialog1"></xe:tooltipDialog></xp:td>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[XSP.addOnLoad(function(){
XSP.getElementById("#{id:djFilteringSelect1}").focus();
});]]></xp:this.value>
</xp:scriptBlock>
<xp:td style="width:229.0px">
<xp:message id="message1" for="loc"></xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label id="label3" value="Work Category" style="font-weight:bold"></xp:label>
</xp:td>
<xp:td>
<xe:djFilteringSelect id="djFilteringSelect2"
rendered="true" value="#{document1.workCategory}" tabIndex="2">
<xe:this.defaultValue><![CDATA[""]]></xe:this.defaultValue>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var db = new Array(#DbName()[0], 'TSCTT.nsf');
#DbColumn(db, "workCategoryView", 1)
}]]></xp:this.value>
</xp:selectItems>
</xe:djFilteringSelect>
You are very close to the solution you are looking for.
It is not really useful to set the hover tooltip function on dojoFilteringSelect field itself as it is then impossible to select a value there. Instead, like you suggested already, let the tooltip work on an icon or the field's label.
This is an example for a tooltip dialog appearing on hovering over label:
<xp:label value="Label" id="label1">
<xp:eventHandler event="onmouseover" submit="false">
<xp:this.script><![CDATA[
XSP.openTooltipDialog("#{id:tooltipDialog1}", "#{id:label1}")
]]></xp:this.script>
</xp:eventHandler>
<xp:eventHandler event="onmouseout" submit="false">
<xp:this.script><![CDATA[
XSP.closeTooltipDialog("#{id:tooltipDialog1}")
]]></xp:this.script>
</xp:eventHandler>
</xp:label>
<xe:djFilteringSelect id="djFilteringSelect1" rendered="true"
value="#{document1.loc}">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:
["abc","def","xyz"]
}]]></xp:this.value>
</xp:selectItems>
</xe:djFilteringSelect>
<xe:tooltipDialog id="tooltipDialog1" title="This is the dialog title">
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:
"This is the computed value"
}]]></xp:this.value>
</xp:text>
</xe:tooltipDialog>
Label's event "onmouseover" (not "onMouseOver"!) opens the tooltip dialog box. This event works only if you don't use the parameter for="djFilteringSelect1" ( I don't know why).
I added an event "onmouseout" which closes the tooltip dialog when mouse no longer hovering over label.
Instead of event "onmouseout", you can add same CSJS code to a close button inside tooltip dialog box. This is useful if you have things on tooltip dialog box you want to click on like links or editable fields.
If you use the tooltip and not the tooltipdialog than just use the for property and it will happen automatically, no code needed. Very simple.
In your code above you are using the onclick event, that will not work onMouseOver (which would be the event you need?)
Howard
there are clear, clear all buttons on richfaces fileUpload component.
<rich:fileUpload id="quoteFile" tabindex="10" listHeight="80" maxFilesQuantity="1" onuploadcanceled=""
clearControlLabel=""
clearAllControlLabel=""
acceptedTypes="xml"
fileUploadListener="#{loadSaveQuotes.uploadListener}">
<a4j:support event="onuploadcanceled" action="#{loadSaveQuotes.clearUploadData}" reRender="footer" />
</rich:fileUpload>
all I want to are:
1, remove the both buttons so that end user cannot click it. as I set clearControlLabel to "", and clearAllControlLabel to "", but only clearControlLabel is hidden. still have clear All Control appear as [x] button and I still click it
2, if I cannot remove these button, so how do I take control of them. like add an event listener to that on clear event. I added an a4j:support event but it do not trigger when I click clear button.
many thanks for your contribute.
Add an a4j:support for 'onclear' JavaScript event. The code is self-explanatory:
<rich:fileUpload id="upload">
<a4j:support event="onclear" reRender="upload"/>
</rich:fileUpload>
You can hide these buttons through CSS, e.g. you can give your fileupload an additional class like
<rich:fileUpload styleClass="my-upload"> etc. </rich:fileUpload>
and then use CSS Specificity to overrule the appearance of this fileupload component:
.my-upload .rf-fu-btns-rgh, .my-upload .rf-fu-itm-rgh {
display: none;
}
You can choose any combination of selectors that has higher specificity then the original one from RichFaces. I find having an extra class the cleanest solution, as it would allow me to have "normal" and "modified" RichFaces components next to each other, only differing in their style class.
You can look up the RichFaces style classes of the elements you want to alter in the RichFaces component documentation or with your favourite website inspection tool.
I was having the same requirement. Hide Clear All button and Clear Link but only when the file is submitted for upload. I solved this requirement with dynamic css through JavaScript. Below is the example.
rich:fileUpload control
<rich:fileUpload id="excelUploader"
fileUploadListener="#{uploadUIController.excelFileUploadListener}"
acceptedTypes=".xls"
maxFilesQuantity="1"
noDuplicate="true"
ontyperejected="Wrong file type selected !"
serverErrorLabel="Invalid file type selected !"
listHeight="100px"
doneLabel="Excel Upload Completed !"
onfilesubmit="showHideClearLink()"
styleClass="fileUploadClass"/>
Javascript code at the top of the file...
<script type="text/javascript">
function showHideClearLink()
{
var styleSheet = document.createElement('style')
styleSheet.innerHTML = ".fileUploadClass .rf-fu-btns-rgh, .fileUploadClass .rf-fu-itm-rgh {display: none;}";
document.body.appendChild(styleSheet);
}
I want to display an image located in the app-storage directory of my AIR application. This image has to be displayed in an html text area where the html text is coming in from a local embedded sqlite database.
When I put in the following code:
imageTest.htmlText = '<img src="app-storage:/demo.jpg" border="0" />';
nothing is displayed.
But when instead of the app-storage path, I put in the absolute url of an image on the web, like below:
imageTest.htmlText = '<img src="http://www.example.com/demo.jpg" border="0" />';
the image is displayed correctly.
Also, I checked that the app-storage method is able to locate the image, but it just does not display in an htmlText container. For example, the following code displays the image:
imageTest.location = 'app-storage:/demo.jpg';
Any suggestions what I should do to get the image to display? I am using Adobe Flex Builder 3 as the IDE.
Thanks
Vinayak
Since your loading the html as a string it isn't in the application sandbox by default. Have you tried setting:
placeLoadStringContentInApplicationSandbox = true;
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/html/HTMLLoader.html#placeLoadStringContentInApplicationSandbox
Have you tried this?
imageTest.htmlText = '<img src="'+ File.applicationStorageDirectory.nativePath +'/demo.jpg" border="0" />';
This is very strange! The following code works for displaying images when I use the open source Flex Builder SDK on the Eclipse IDE, but does not work when I use the Adobe FlexBuilder IDE:
imageTest.htmlText = '<img src="app-storage:/folder/demo.jpg" />';
Maybe it is a bug.
Have posted as a bug:
https://bugs.adobe.com/jira/browse/FB-25986