I don’t find how to display the changes made at RichTextArea in another component as Label
code:
package foo;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.Slider;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window.Notification;
@SuppressWarnings(“serial”)
public class NotificationCustomExample extends VerticalLayout {
public Label richText;
public RichTextArea editor = new RichTextArea();
public Label n ;
public NotificationCustomExample() {
setSpacing(true);
final RichTextArea editor = new RichTextArea();
editor.setWidth("100%");
editor.setValue("<p>to <i>john.doe@example.com</i></p>");
editor.setCaption("Description");
editor.setDescription("Additional information; try to keep it short.");
addComponent(editor);
n = new Label("ccccccc");
addComponent(n);
Button show = new Button("Show",
new Button.ClickListener() {
// "Inline" click listener; this is where the
// notification is actually created and shown.
public void buttonClick(ClickEvent event) {
// create Notification instance and customize
n.setValue(editor.getValue());
n.setContentMode(Label.CONTENT_XHTML);
//replaceComponent(n, editor);
System.out.println( "richTextArea.getValue(): " + editor.getValue() );
}
});
addComponent(show);
setComponentAlignment(show, Alignment.MIDDLE_RIGHT);
}
}
and
/*
- Copyright 2009 IT Mill Ltd.
- Licensed under the Apache License, Version 2.0 (the “License”); you may not
- use this file except in compliance with the License. You may obtain a copy of
- the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations under
- the License.
*/
package foo;
import java.io.IOException;
import com.vaadin.Application;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
/**
-
The Application’s “main” class
*/
@SuppressWarnings(“serial”)
public class MyVaadinApplication extends Application
{
private Window window;
NotificationCustomExample notificationCustomExample;
@Override
public void init()
{
window = new Window(“My Vaadin Application”);
setMainWindow(window);
notificationCustomExample=new NotificationCustomExample();window.addComponent(notificationCustomExample);
}
}
thank you