Search in sources :

Example 6 with Manifest

use of org.apache.pivot.wtk.Manifest in project pivot by apache.

the class JSONViewer method paste.

public void paste() {
    Manifest clipboardContent = Clipboard.getContent();
    if (clipboardContent != null && clipboardContent.containsText()) {
        String json = null;
        JSONSerializer jsonSerializer = new JSONSerializer();
        try {
            json = clipboardContent.getText();
            setValue(jsonSerializer.readObject(new StringReader(json)));
        } catch (Exception exception) {
            Prompt.prompt(exception.getMessage(), window);
        }
        window.setTitle(WINDOW_TITLE);
    }
}
Also used : StringReader(java.io.StringReader) Manifest(org.apache.pivot.wtk.Manifest) IOException(java.io.IOException) JSONSerializer(org.apache.pivot.json.JSONSerializer)

Aggregations

IOException (java.io.IOException)6 Manifest (org.apache.pivot.wtk.Manifest)6 Component (org.apache.pivot.wtk.Component)4 DropAction (org.apache.pivot.wtk.DropAction)4 DropTarget (org.apache.pivot.wtk.DropTarget)4 DragSource (org.apache.pivot.wtk.DragSource)3 LocalManifest (org.apache.pivot.wtk.LocalManifest)3 Point (org.apache.pivot.wtk.Point)3 StringReader (java.io.StringReader)2 FileList (org.apache.pivot.io.FileList)2 Button (org.apache.pivot.wtk.Button)2 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)2 PushButton (org.apache.pivot.wtk.PushButton)2 Visual (org.apache.pivot.wtk.Visual)2 Image (org.apache.pivot.wtk.media.Image)2 Font (java.awt.Font)1 File (java.io.File)1 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)1 Sequence (org.apache.pivot.collections.Sequence)1 JSONSerializer (org.apache.pivot.json.JSONSerializer)1