protected Tabpanel renderTabpanel(final Resource resource) { Tabpanel sourcepanel = new Tabpanel(); Hlayout hlayout = new Hlayout(); hlayout.setStyle("margin-top:20px"); final Label label = new Label("Image url:"); hlayout.appendChild(label); final Textbox txtURL = new Textbox(); txtURL.setValue(resource.getContent()); txtURL.setWidth("500px"); txtURL.setConstraint("no empty"); hlayout.appendChild(txtURL); txtURL.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event event) throws Exception { if (txtURL.isValid()) { if (event instanceof InputEvent) { String value = ((InputEvent) event).getValue(); resource.setContent(value); FiddleSourceEventQueue.lookup().fireResourceChanged(resource, Type.Modified); } } } }); sourcepanel.appendChild(hlayout); { sourcepanel.appendChild(new Separator()); } { Label lbl = new Label( "Enter a image url ,and you have to make sure you have the right to use the image."); sourcepanel.appendChild(lbl); } return sourcepanel; }
public Popup generarPopupResultados( Textbox textboxResultado, boolean readonly, Pexamenes_paraclinicos pexamenes_paraclinicos) { // final Image image = (Image)form.getFellow("img_"+id_alumno); final Textbox tbxRes = textboxResultado; // popup.setId("popupResultados_" + key); Vlayout vlayout = new Vlayout(); if (pexamenes_paraclinicos.getNormal_anormal().equals("S")) { String valor_na = (String) tbxRes.getAttribute("VALOR_NORMAL_ANORMAL"); String valor_descripcion_na = (String) tbxRes.getAttribute("VALOR_DESCRIPCION_NA"); final Radiogroup radiogroup_anormal = new Radiogroup(); Radio radio_normal = new Radio("Normal"); radio_normal.setValue("N"); radiogroup_anormal.appendChild(radio_normal); radiogroup_anormal.appendChild(new Space()); Radio radio_anormal = new Radio("Anormal"); radio_anormal.setValue("A"); radiogroup_anormal.appendChild(radio_anormal); vlayout.appendChild(radiogroup_anormal); final Textbox textbox_anormal = new Textbox(); textbox_anormal.setWidth("400px"); textbox_anormal.setRows(4); textbox_anormal.setVisible(false); if (valor_na != null) { if (valor_na.equals("S")) { radio_normal.setChecked(true); radio_anormal.setChecked(false); textbox_anormal.setVisible(true); } else { radio_anormal.setChecked(true); radio_normal.setChecked(false); textbox_anormal.setVisible(false); } } else { radio_normal.setChecked(true); radio_anormal.setChecked(false); textbox_anormal.setVisible(false); } if (valor_descripcion_na != null) { textbox_anormal.setValue(valor_descripcion_na); } radiogroup_anormal.addEventListener( Events.ON_CHECK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { Radio radio_seleccionado = radiogroup_anormal.getSelectedItem(); if (radio_seleccionado != null) { if (radio_seleccionado.getValue().toString().equals("A")) { textbox_anormal.setVisible(true); } else { textbox_anormal.setVisible(false); } tbxRes.setAttribute( "VALOR_NORMAL_ANORMAL", radio_seleccionado.getValue().toString()); } } }); textbox_anormal.addEventListener( Events.ON_CHANGING, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { InputEvent inputEvent = (InputEvent) arg0; tbxRes.setAttribute("VALOR_DESCRIPCION_NA", inputEvent.getValue()); } }); vlayout.appendChild(textbox_anormal); } final Textbox textbox = new Textbox(); textbox.setWidth("400px"); textbox.setRows(8); vlayout.appendChild(new Label("Resultado paraclinico")); vlayout.appendChild(textbox); textbox.setValue(tbxRes.getValue()); textbox.addEventListener( "onChanging", new EventListener() { @Override public void onEvent(Event event) throws Exception { InputEvent inputevent = (InputEvent) event; tbxRes.setValue(inputevent.getValue()); } }); final Popup popup = new Popup(); popup.addEventListener( Events.ON_OPEN, new EventListener<Event>() { @Override public void onEvent(Event event) throws Exception { textbox.setValue(tbxRes.getValue()); textbox.setFocus(true); } }); popup.appendChild(vlayout); contenedor.appendChild(popup); return popup; }