Package org.apache.sling.extensions.gwt.sample.service

Examples of org.apache.sling.extensions.gwt.sample.service.Note


        inputNoteText.setText("");
    }

    private void createNote(String title, String text) {

        final Note note = new Note();
        note.setTitle(title);
        note.setText(text);

        service.createNote(note, new AsyncCallback<String>() {

            public void onFailure(Throwable throwable) {
                Window.alert("Failed to created note: " + throwable.getMessage());
View Full Code Here


                Window.alert("Could not retrieve notes: " + throwable.getMessage());
            }

            public void onSuccess(ArrayList<Note> notesList) {
                for (int i = 0; i < notesList.size(); i++) {
                    final Note note = (Note) notesList.get(i);

                    final HorizontalPanel noteEntry = new HorizontalPanel();
                    noteEntry.setStyleName("noteEntry");

                    final HTML noteTitle = new HTML(note.getTitle());
                    noteTitle.setStyleName("noteTitle");

                    final HTML noteText = new HTML(note.getText());
                    noteText.setStyleName("noteText");

                    final Button delButton = new Button("Delete");
                    delButton.setStyleName("noteControls");
                    delButton.addClickHandler(new ClickHandler() {

                        public void onClick(ClickEvent event) {
                            deleteNote(note.getPath());
                        }
                    });
                    noteEntry.add(noteTitle);
                    noteEntry.add(noteText);
                    noteEntry.add(delButton);
View Full Code Here

                    Node node = nodes.nextNode();
                    // for every child node, that has the correct properties set, create a POJO and add it to the list
                    if (node.hasProperty(PN_NOTETITLE) && node.hasProperty(PN_NOTETEXT)) {

                        final Note note = new Note();
                        note.setTitle(node.getProperty(PN_NOTETITLE).getString());
                        note.setText(node.getProperty(PN_NOTETEXT).getString());
                        // set the node's path, so that the GWT client app can use it as the parameter for the
                        // deleteNote(String path) method.
                        note.setPath(node.getPath());

                        notes.add(note);
                        log.info("getNotes: found note {}, adding to list...", node.getPath());
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.sling.extensions.gwt.sample.service.Note

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.