this time just a link to share with you guys out there.
A REALLY, did I make this clear? REALLY REALLY cool fancy way to make type aheads the way I need them:
http://www.timtripcony.com/blog.nsf/d6plinks/TTRY-7XD5P9
this time just a link to share with you guys out there.
A REALLY, did I make this clear? REALLY REALLY cool fancy way to make type aheads the way I need them:
http://www.timtripcony.com/blog.nsf/d6plinks/TTRY-7XD5P9
Did you ever use the Extension library names picker? Do you like it? I don’t!
Why? It requires the user to use his mouse and make too many clicks to get to what he wants.
I have a better way to achieve it and it can be adopted to any type-ahead you would like: in only 3 steps!!!
And the coolest thing is: you can actually “fine tune” it.
Just to give a clue:
We have a database regarding travels which requires the user to enter his flights, we have a huge list of airports worldwide. So the user has 3 options for type-ahead: 2 characters will search for all airports in the country with that ISO code, 3 characters will search for a specific airport by that identifier and if the user enters more characters a full text search is being conducted! Ain’t that cool?
Steps: (check out the color coding where each piece goes to)
1. Define the field, make sure the var attribute is the one used as parameter to the method call of your bean, make sure the Class name is the name you defined as bean name (see step 3)
<?xml version=”1.0″ encoding=”UTF-8″?>
<xp:view xmlns:xp=”http://www.ibm.com/xsp/core”>
<xp:inputText id=”airport”>
<xp:typeAhead mode=”partial” minChars=”2″ var=”searchValue“
preventFiltering=”true”
valueList=”#{javascript:TypeAHeadBean.searchAirport(searchValue)}”
ignoreCase=”true”>
</xp:typeAhead>
</xp:inputText>
</xp:view>
2. Define the bean:
public class YourBean implements Serializable{
private static final long serialVersionUID = -4498155370434392583L; // this can be auto generated and is required for beans as they have to be serializable
public ArrayList<String> searchAirport(String searchValue){
try {
ArrayList<String> al = new ArrayList<String>();
Database db = (Database) DominoUtils.getCurrentDatabase();
// this is the part you may want to customize, ie with a creative view you might not need FTSearch (take a look at ($Users) in the names.nsf
View view = db.getView(“lupAirports”);
if( 2 == searchValue.length()){
view.FTSearch(“[AirportCountryCode]=”+searchValue, 0);
}else if(3 == searchValue.length()){
view.FTSearch(“[AirportCode]=”+searchValue, 0);
}else{
view.FTSearch(“*” + searchValue.toLowerCase() + “*”, 0);
}
Document doc = view.getFirstDocument();
while(null != doc ){
// the values you add here will be displayed in the type ahead
al.add(doc.getItemValueString(“AirportName”));
doc = view.getNextDocument(doc);
}
// maybe you wanna sort the result properly
Collections.sort(al);
return al;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
}
// maybe you wanna add some “recycling of Notes objects”…
3. Setup the bean:
Add the bean to the faces-config.xml
<managed-bean>
<managed-bean-name>TypeAHeadBean</managed-bean-name>
<managed-bean-class>com.acme.YourBean</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
</managed-bean>
If you open the Package Explorer view you will find the faces-config.xml here:
I hope one again you enjoyed my blog.. any comments are welcome, don’t hesitate starting a discussion about an interesting topic
this time just a reference I deem important:
Unhiding the hidden ‘hidden input’ control in XPages
kudos to Declan Sciolla-Lynch
so you read my article about how easy it is to debug xPages and now get stuck in the debug perspective all the time but you would like to checkout your code etc?
simple: use <ctrl><F8> to switch perspectives.
If you open first all those perspectives you don’t need and close them via WindowClose Perspective then it’s a simple matter of <ctrl><F8> to switch between Debug and xPages perspective
ah.. as a side note:
did you know that you can actually “debug” the building of the xPage component tree itself?
Open the Package Explorer view and inside your LN application open the Localxsp folder. There you will find the Java classes which have been created out of the XML in the xPages designer!
You can then set a breakpoint in the Java class for your xPage here:
protected AbstractCompiledPage createPage(int pageIndex) {
return new nameOfYourXPage();
}
I was trying to get the selected values from a check box group, but I failed miserably…
Almost when I gave up I got an error and then I found this site:
the XPages Extensibility API Documentation
via the class XspSelectManyCheckbox I then figured I had to search for the JSF API.
There I found this:
java.lang.Object[] getSelectedValues()
Return the currently selected values, or null if there are no currently selected values.
which basically means:
getComponent(“myCheckBoxGroupID”).getSelectedValues() will return an ARRAY!!! checkout the [] at the end the object.
so finally it was easy to parse the selected values:
var valueArray = getComponent(“myCheckBoxGroupID”).getSelectedValues();
// valueArray[0] contains the first value
// valueArray[1] contains the second value etc.
can you believe it how stupid I am? and how relieved to finally have found a way to read the selected values with SSJS?
It’s really simple:
Drag’n drop a tooltip control from the extension library controls onto your page and set the appropriate properties:
XML source code:
<xe:tooltip id=”tooltip1″ for=”id_of_object_for_which_this_tooltip_displays” label=”text to display in the web page while hovering the target object”></xe:tooltip>
The only thing left is to add proper styling. As soon as I have themes working the way I require I will post more on this here
For my studies I had to create a nice little graphic with curved arrows and they should contain text in them. I thought Illustrator might be the tool to use. But admittedly I am not a hard-core Illustrator user and hence I had to dig a bit to find out more how to do this…
I found several suggestions but then at last I figured the most easy way is like this:
Width tool to adjust the path width of the arrows |
for some of you this might be the almost perfect XMas gift from me.
I finally figured how to debug Java code in an xPage application, and it’s DEAD SIMPLE…
if only more people would blog about it…
so here is how:
1. Create a debug configuration. The debug button might not always be visible, you will see it definetely by switching to the Java perspective.
do you use SameTime? we use it a lot!
are you annoyed when someone sends you a message and the window pops to the front while you are typing something somewhere? I am!
here is the solution:
the setting “Bring chat window to front” is VERY hidden! You have to select the one-on-one chat notification to actually see that property!