}
public void showModalView(String code,boolean cleanMode,int zIndex,float opacity,String background)
{
ItsNatComponentManager compMgr = itsNatDoc.getItsNatComponentManager();
final ItsNatModalLayer modalLayer = compMgr.createItsNatModalLayer(null,cleanMode,opacity,background,null);
TestUtil.checkError(modalLayer.getZIndex() == zIndex); // Lo m�s probable es que se haya pulsado dos veces el link de crear los layers
EventListener unexpEvtListener = new EventListenerSerial()
{
public void handleEvent(Event evt)
{
StringBuilder code = new StringBuilder();
code.append("if (confirm('Received an unexpected event by a hidden element. Reload?')) ");
code.append(" window.location.reload(true);");
itsNatDoc.addCodeToSend(code.toString());
}
};
modalLayer.addUnexpectedEventListener(unexpEvtListener);
final HTMLDocument doc = itsNatDoc.getHTMLDocument();
DocumentFragment frag = itsNatDoc.toDOM(code);
final Element elem = (Element)frag.getFirstChild();
doc.getBody().appendChild(elem);
NodeList links = elem.getElementsByTagName("a");
final HTMLAnchorElement linkExit = (HTMLAnchorElement)links.item(0);
final HTMLAnchorElement linkCheckServ = (HTMLAnchorElement)links.item(1);
// Link simplemente para actualizar el cliente con cambios en el servidor
final EventListener listenerNothing = new EventListenerSerial()
{
public void handleEvent(Event evt)
{
}
};
((EventTarget)linkCheckServ).addEventListener("click",listenerNothing,false);
final HTMLSelectElement select = (HTMLSelectElement)elem.getElementsByTagName("select").item(0);
final ItsNatHTMLSelectComboBox selectComp = (ItsNatHTMLSelectComboBox)compMgr.createItsNatComponent(select);
DefaultComboBoxModel model = (DefaultComboBoxModel)selectComp.getComboBoxModel();
model.addElement("One " + zIndex);
model.addElement("Two " + zIndex);
model.addElement("Three " + zIndex);
model.addElement("Four " + zIndex);
model.addElement("Five " + zIndex);
NodeList inputList = elem.getElementsByTagName("input");
final HTMLInputElement inputText = (HTMLInputElement)inputList.item(0);
final ItsNatHTMLInputText inputTextComp = (ItsNatHTMLInputText)compMgr.createItsNatComponent(inputText);
inputTextComp.setText("Hello");
final HTMLTextAreaElement textArea = (HTMLTextAreaElement)elem.getElementsByTagName("textarea").item(0);
final ItsNatHTMLTextArea textAreaComp = (ItsNatHTMLTextArea)compMgr.createItsNatComponent(textArea);
textAreaComp.setText("Hello");
final HTMLInputElement inputCheck = (HTMLInputElement)inputList.item(1);
final ItsNatHTMLInputCheckBox inputCheckComp = (ItsNatHTMLInputCheckBox)compMgr.createItsNatComponent(inputCheck);
inputCheckComp.setSelected(false);
final HTMLInputElement inputRadio1 = (HTMLInputElement)inputList.item(2);
final ItsNatHTMLInputRadio inputRadioComp1 = (ItsNatHTMLInputRadio)compMgr.createItsNatComponent(inputRadio1);
inputRadioComp1.setSelected(false);
final HTMLInputElement inputRadio2 = (HTMLInputElement)inputList.item(3);
final ItsNatHTMLInputRadio inputRadioComp2 = (ItsNatHTMLInputRadio)compMgr.createItsNatComponent(inputRadio2);
inputRadioComp2.setSelected(false);
EventListener listenerExit = new EventListenerSerial()
{
public void handleEvent(Event evt)
{
selectComp.dispose();
inputTextComp.dispose();
textAreaComp.dispose();
inputCheckComp.dispose();
inputRadioComp1.dispose();
inputRadioComp2.dispose();
((EventTarget)linkCheckServ).removeEventListener("click",listenerNothing,false);
//((EventTarget)elem).removeEventListener("click",this,false);
((EventTarget)linkExit).removeEventListener("click",this,false);
doc.getBody().removeChild(elem);
modalLayer.dispose();
}
};
// ((EventTarget)elem).addEventListener("click",listenerExit,false);
((EventTarget)linkExit).addEventListener("click",listenerExit,false);