JDev 11: richTextEditor + auto completion (next)
+ This post is next to this one: JDev 11: richTextEditor + auto-completionFinal solution will be shown in both positions.
Hello
previous post was too big.
I have a richTextEditor. When an abbreviation is entered and then ctrl + space is pressed, a bean is called and he's looking for the description of the abbreviation to refresh the text pane
There are my JSF page that contains a richTextEditor:
<f:view>
<af:document title="Ajout d'une note au dossier médical hospitalier">
<af:messages/>
<f:verbatim>
<![CDATA[
<script language="javascript" type="text/javascript">
var comp;
var target;
var prevKey;
var curKey=0;
function wysiwygKeyPress(event) {
prevKey = curKey;
curKey = event.keyCode;
if(prevKey==17 && curKey==32) // CTRL + espace
{
var richTextEditor = comp; //wysiwygmode
var wysiwygValue = target.contentDocument.body.firstChild.textContent;
AdfCustomEvent.queue(comp, "customEvent",{value1:wysiwygValue}, true);
}
}
function rteMouseOver(event) {
comp = event.getSource(); //helper function
var iframe = event._target;
target = iframe;
iframe.contentWindow.addEventListener('keydown',wysiwygKeyPress, true);
}
</script>
]]>
</f:verbatim>
<af:form id="form1">
<af:richTextEditor label="Label 1"
clientComponent="true"
binding="#{backing_main.observations}"
id="observations"
editMode="wysiwyg"
immediate="true"
autoSubmit="true">
<af:clientListener type="mouseOver" method="rteMouseOver"/>
<af:serverListener type="customEvent" method="#{backing_main.ctrlSpaceHandler}"/>
</af:richTextEditor>
</af:form>
</af:document>
</f:view>
When you press ctrl-space, this bean is called: public void ctrlSpaceHandler(ClientEvent clientEvent) {
// --- récupération du module d'application --- //
if(am==null)
setAm();
// --- récupération du viewObject contenant les abréviations --- //
ViewObjectImpl mesAbrev = am.getThesaurusVO1();
ViewCriteria vc = mesAbrev.createViewCriteria();
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
// --- Récupération du dernier mot saisi dans le composant --- //
RichTextEditor rte = (RichTextEditor) clientEvent.getComponent();
String texte = rte.getValue().toString();
System.out.println("[Main.java] ctrlSpaceHandler > valeur du rte : "+texte);
int indiceDernierMot = texte.lastIndexOf(" ");
indiceDernierMot++;
String abr = texte.substring(indiceDernierMot).toUpperCase();
abr = abr.replaceAll("<BR/>","");
System.out.println("[Main.java] ctrlSpaceHandler > abréviation recherchée : "+abr);
// --- Ajout d'un critère de recherche (msgcourt) --- //
vcRow.setAttribute("Msgcourt", "like '"+abr+"'");
vc.addElement(vcRow);
mesAbrev.applyViewCriteria(vc);
// --- Exécution de la recherche --- //
mesAbrev.executeQuery();
// --- Récupération du tuple trouvé --- //
Row row = null;
while(mesAbrev.hasNext())
{
row = mesAbrev.next();
System.out.println("[Main.java] ctrlSpaceHandler > ligne trouvée : "
+row.getAttribute("Spr") +" - "
+row.getAttribute("Msgcourt")+" - "
+row.getAttribute("Msglong"));
}
// --- Si on a trouvé l'abréviation et sa correspondance --- //
if(row!=null)
{
// --- Récupération du message long correspondant au msgcourt spécifié --- //
String detail = (String)row.getAttribute("Msglong");
System.out.println("[Main.java] ctrlSpaceHandler > message long = "+detail);
// --- Mise à jour du composant graphique --- //
texte = texte.replaceAll(abr.toLowerCase(), detail);
texte = texte.replaceAll(abr.toUpperCase(), detail);
rte.setValue(texte);
RequestContext.getCurrentInstance().addPartialTarget(rte);
}
}
It works, but 2 issues remain unresolved:-I have to click outside, then inside the component to send the value of the entire element to my grain
-keypressed are not caught in internet explore (only in firefox)
Thank you for your attention,
Valéry.
Answer to for this message points to related post: JDev 11: richTextEditor + auto-completion .
Thank you
Tags: Java
Similar Questions
-
JDev 11: richTextEditor + auto-completion
Hi all
My problem is that I have:
-some richTextEditors
-a viewObject containing a list of abbreviations and their description<af:richTextEditor value="#{bindings.Observation.inputValue}" label="#{bindings.Observation.hints.label}" required="#{bindings.Observation.hints.mandatory}" columns="150" shortDesc="#{bindings.Observation.hints.tooltip}" />
Is it possible to catch a key combination to call a bean?abr | desc ---------------------------------------- ADF | Application Developement Framework www | World Wide Web HTTP | Hyper text transfert protocol ...
I type
to replace * "ADF" * by * "application Devlopment.""ADF" and then "CTRL+space"
I guess I should do a bean to seek correspondence in the bean?
But how can I get the key combination (CTRL + space) to call the bean and replace the part of the richTextComponent (ADF) chain?
Thanks for your reading.This will remove NullPointerException, as second time wysiwygValue was null in Internet Explorer, on the development of the slider will keep you
JavaScript
function wysiwygKeyPress(event) { prevKey = curKey; curKey = event.keyCode; var wysiwygValue = ""; if(prevKey==17 && curKey==32) // CTRL + espace { var richTextEditor = comp; //wysiwygmode if (target.contentWindow.document.attachEvent){ //IE specific if(target.contentWindow.document.body.firstChild.innerHTML) { wysiwygValue = target.contentWindow.document.body.firstChild.innerHTML; } else{ wysiwygValue = target.contentWindow.document.body.innerHTML; } } else { //FF specific wysiwygValue = target.contentDocument.body.firstChild.textContent; } AdfCustomEvent.queue(comp, "customEvent",{value1:wysiwygValue}, true); } }
Backing bean
public void ctrlSpanceHandler(ClientEvent event){ RichTextEditor rte = (RichTextEditor) event.getComponent(); Object value = event.getParameters().get("value1"); String modifiedValue = value.toString().replaceAll("
",""); if(modifiedValue.contains("simplyadf")) { String oldValue = modifiedValue.replaceAll("simplyadf",""); rte.setSubmittedValue(oldValue + "Simply Application Developement Framework"); } RequestContext.getCurrentInstance().addPartialTarget(rte); System.out.println("my handler"); }concerning
-
When connecting on MacMini after I click on the user, the password field is auto-complete with a myriad of points and is not the right password.
There suddenly / maybe after the most recent update 2015-008, which I installed it on 8 January 2016.
I need to delete points, usually I can remove them by double clicking on it and pressing the delete key, but they will not simply remove by clicking in the field and using the delete key, as would be normal. Sometimes it takes a few tries to remove the points, and then I can connect.
Does my keyboard or a virus, my usb port, the update of security or something else...?
I use this computer without problem for a few years.
Thank you, Kathy
osX version 10.9.5 processor 2.3 GHz intel core 17
First try another KB
Next
-Try to reset memory NVRAM/PRAM and SMC
MacIntel: Reset of the controller (SMC) system management
Subject of memory NVRAM and PRAM
-Try to start safe mode
OS x: what is Safe Boot, Safe Mode?
-Start to recovery and repair the startup disk
OS X: on OS X Recovery - Apple Support
-If it is repairable reinstall the OSX
How to reinstall OS X on your Mac - Apple Support
-If you do not have a backup using disk utility to restore the internal drive to an external drive, so that you can try to recover the data.
Format the boot disk and then do a fresh install of Mac OS x
-
Seized auto-complete textfield
Can someone guide how to use auto-complete textfield for filtering values from the table database (SQLite).
The link http://docs.blackberry.com/en/developers/deliverables/18125/Autocomplete_text_field_1200231_11.jsp
shows with predefined tables.
I want it to filter the db table. How to on this subject.
Try to run this code
import java.util.Vector;
Net.rim.device.api.collection.util import. *;
Import net.rim.device.api.database.Cursor;
Import net.rim.device.api.database.Database;
Import net.rim.device.api.database.DatabaseFactory;
Import net.rim.device.api.database.Row;
Import net.rim.device.api.database.Statement;
Net.rim.device.api.ui import. *;
Net.rim.device.api.ui.container import. *;
Net.rim.device.api.ui.component import. *;SerializableAttribute public class AutoCompleteFieldDemo extends UiApplication
{Public Shared Sub main (String [] args)
{AutoCompleteFieldDemo app = new AutoCompleteFieldDemo();
app.enterEventDispatcher ();
}public AutoCompleteFieldDemo()
{
pushScreen (new AutoCompleteFieldDemoScreen());
}public static String [] getDataFromDB()
{
Vector of names = new Vector();Try
{Basis of data db = DatabaseFactory.openOrCreate ("database1.db");
Instruction statement1 = db.createStatement ("SELECT name FROM Directory_Items");
statement1. Prepare();
statement1. Execute();
Cursor c = statement1.getCursor ();
Line r;While (c.Next ())
{
r = c.getRow ();
names.addElement (r.getString (0));}
statement1. Close();
DB. Close();}
catch (System.Exception e)
{
System.out.println (e.getMessage ());
e.printStackTrace ();
}String [] returnValues = new String [names.size ()];
for (int i = 0; i)< names.size();="" i++)="">
returnValues [i] = (String) names.elementAt (i);
}Return returnValues;
}
public static final class AutoCompleteFieldDemoScreen extends screen
{AutoCompleteFieldDemoScreen()
{BasicFilteredList filterLst = new BasicFilteredList();
filterLst.addDataSet (1, getDataFromDB (), "Names", BasicFilteredList.COMPARISON_IGNORE_CASE);
AutoCompleteField autoFld = new AutoCompleteField (filterLst);
Add (autoFld);}
-
Auto-completion in the address bar does not work well
Usually, I always opened in the browser 2 tabs: gmail and hotmail. When I open a tab mew and I start typing in one'm ' to connect to facebook and open my page the mouse the automatic completion feature removes follow her ' I have typed and replaces it with the "switch to tab" Gmail, placing them directly in the address bar "https://mail.google.com/mail/?shva=1#inbox'."
So follow her ' I typed becomes magically an 'h', followed by the rest of the address.
I suggest to improve the auto-completion: if I type one me ' auto complete it with an address that begins with the'm 'or with the part of an address that begins with what am '.
A great idea (in my opinion) can show "https://" in an area between the one with the ' switch to tab:' text, display, in the rest of the address bar, am 'I typed followed by the right side of the address provided, in this case it would be'ail.google.com/mail/?shva=1#inbox'. In this way, when I type the 'o' of the mouse, you can change the "prediction" and fill it in this way: ' mohttp://apps.facebook.com/. usehunt', where the square brackets identifies the box and the vertical bar (|) identifies the beginning of auto-completion.See:
http://kb.mozillazine.org/browser.urlbar.default.behavior http://kb.mozillazine.org/Location_Bar_search
-
I have a bank I have to use Google's browser instead of safari to be able to download and view my monthly statement. Auto-complete in safari on id and psd won't AutoFill to this browser. What can we do to make this right?
I have safari 9.0.2 have a MacBook Pro. OS X El Capitan version 10.11.2 for operating system
If they are having problems with the Safari browser, you must contact the Bank to know if their site is compatible with Safari.
Good day.
-
How to set the auto complete in Windows Mail
How can I define the "full" automatic function in Windows Mail to use the Windows Messenger Contact list?
WinMail remembers only 29 addresses.How to delete registration completion email in Windows Mail
http://www.Winhelponline.com/articles/245/1/how-to-clear-the-email-auto-complete-entries-in-Windows-mail.htmlHow to remove an address from the list of AutoComplete in Windows Mail
http://email.about.com/od/windowsmailtips/Qt/et_del_autocomp.htm -
I have microsoft windows mail. I want my auto complete addresses. I put it in the to do under "tools-options-send-AutoComplete. He disobeys unless it's an address that I used in the last 24 hours. Help!
Windows Mail only remembers 29 addresses. This will show how to delete old addresses.
How to delete registration completion email in Windows Mail
http://www.Winhelponline.com/articles/245/1/how-to-clear-the-email-auto-complete-entries-in-Windows-mail.htmlBruce Hagen ~ MS - MVP [Mail]
Imperial Beach, CA -
Eclipse can not show auto completion ctrl + space
Guys,
My Eclipse 3.4.1 cannot display the auto completion or the required action when I'm clicking on ctrl + space.
Can someone help me with this? I'm a bit new to blackberry and these ctrl + space will be very useful for me
try to reboot or reinstall eclipse, as it works for me.
-
How can I turn off auto complete in windows 8
How can I enable auto complete turned off in windows 8 Please
Hi Robert,
- Launch of the desktop version of Microsoft Internet Explorer
- Click on the menu Tools - gear in the top right of the IE window
- Select Internet Options
- Go to the content tab
- Click the settings button in the AutoComplete section
- ...
NB: this change applies to the two versiosn of IE - Desktop and user Windows (aka metro) interface
Hope this helps at & answers your question. If so, feel free to mark your post as answered if this can help others... Thanks in advance.
See you soon
LZ.
-
Adobe in CC: when I go to file > file information > Preferences there is no active Auto-Completion options. CS6 got it, it was nice and I used it all the time. Now he's gone... Can he please add?
Hi Shannon,
You can apply this feature by completing the "feature request form': feature request/Bug Report Form
Thank you
OM
-
inputComboboxListOfValues and inputListOfValues auto complete function - Case Insensitive?
Hi team.
I was wondering if this is possible? I have one have seen messages on the search screen, and I know how it works. What I wonder about, is if there is a way for the auto complete functionality. When the user types a few characters, press tab or enter and then the control will attempt to find a valid value. If he finds one, he'll put it in the control. If this isn't the case, it will appear to the search screen.
I've seen a few posts about adding VC to advanced search so that you can specify the option box ignores. This isn't what I'm looking for.
Any suggestions?
Thank you
BradWThanks, Luke. I'll look at these two ideas. I tried the first, added the attribute to a virtual circuit that is part of the ViewAccessor used in the LOV. It doesn't seem to work. However, add a Advanced Find view Criteia toured! So I will chalk until antifreeze Oracle Documentation on this issue. I'm so happy that it works now...
Thanks for having me watch VCs a second time.
BradW
-
How intelligent auto complete starts with text?
Hi, palm has a smart feature useful text, so when you enter text in particular field, and this field was seized with another similar text, then the palm will try to auto complete the rest part with highlighted. Sadlly, seems it cannot let me select another candidate completion if the current is not what I need, so my question is, palm treo 650 does bike in the candidate of completion? I know that in any other charactors more to limit further the realization is a way, but if I want to enter a contact containing non-lettre name say commas, then type the after, palm has managed to complete it.
AutoComplete is a tool for spelling if there are commas so he doesn't know what you are trying to spell. With regard to cycling though the device does not allow that. But me and another tech found a software that might be able to help do.
-
Hello
I can't understand how get sql auto complete when it is linked to an Access database. I use SQL Developer 11g R2.
I selected all the options in the Code Editor > completion Insight.
Thank you
JohnHello
There's a specific forum for this kind of question which are not associated with PL/SQL: {forum: id = 260}
If please mark this question as answered and post your question there.
Kind regards.
Al -
Redirect to 3 different pages based on the value of the Auto complete field.
Hi friends,
I use a "Auto complete field" in a page for research (Apex version 4.0). But I need to get the values of the 3 tables and when you click on the redirection of the value to one of the 3 pages based on the value.
For example, I have 3 tables. 1 customer 2 Sites 3.Employees. When I enter "c" in the search field, I need to get values of 3 tables in this area "AutoComplete". That is to say, if I have a customer with the name "cusotmer1", "customer2" and the location with the names of "cisc1", "cisc2" and employees with the name "cid1", "cid2"; When I enter "c" in the FQDN of the auto all 6 values must be given in the "AutoComplete" box and clicking on "customer1" / "customer2" need to redirect to the 'customer' page When you click on 'cisc1' / 'cisc2' redirect to 'site' when clicking on "cid1" / "cid2" redirect to the page of the employees. Is there a way to do this. Help, please.
Kind regards
NAVNet asset value,
Here is a sample page that uses the code I proposed works fine for me with FF and IE (8.0).http://Apex.Oracle.com/pls/Apex/f?p=18:3
Note: I've added a warning message before being submitted
This page works by your side?
Maybe you are looking for
-
Unable connect to the iMessage and FaceTime
My mac doesn't let me connect. I tried: Update Restart Deactivation / activation iCloud Reset my Mac. But he always keep stand like this for: Someone knows what to do? I run on a MacBook Air 11 '' of 2015 on OS X El Capitan
-
Hello world I have an application that stores data in an Excel worksheet by using the report generation tool. My VI have worked well in the past using Excel XP, but since I have upgraded to Excel 2007, I get COM errors like this: "2147417842 error o
-
Blue Screen installation updates (KB2419640) & (KB2478935) for Windows Vista
I get the blue screen when I install the above, and this update was 12/01/2011 and continues to reappear after I restore the system to January 9. So I turned off auto updates but isn't this bad since I DON'T want to prevent remote control? What can
-
Hello there I have recently bought command and conquer 3 kanes wrath, once installed the game perfectly during playback mode campaign woks, it also works perfectly during playback mode skirmish during playback 2vs2, but as soon as you increase the am
-
cannot find Ethernet controller drivers for hp 15-do17tu
Mr President! I could not find ethernet controller drivers for my hp 15-d017tu Here is its hardware ID PCI\VEN_10EC & DEV_8136 & SUBSYS_218F103C & REV_07PCI\VEN_10EC & DEV_8136 & SUBSYS_218F103CPCI\VEN_10EC & DEV_8136 & CC_020000PCI\VEN_10EC & DEV_81