Package org.fusesource.restygwt.client

Examples of org.fusesource.restygwt.client.Resource


        }
    }

    @Override
    public void deleteFile(String url) throws FormBuilderException {
        Resource resource = new Resource(URLBuilder.deleteFileURL(this.contextPath, this.packageName, url));
        try {
            resource.delete().send(new RequestCallback() {
                @Override
                public void onError(Request request, Throwable exception) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.ErrorDeletingFile(""), exception));
                }
                @Override
View Full Code Here


    }
   
    @Override
    public void getFiles(List<String> types, final FilesLoadedHandler handler) {
        String url = URLBuilder.getFilesURL(this.contextPath, this.packageName, types);
        Resource resource = new Resource(url);
        resource.get().send(new SimpleTextCallback(i18n.CouldntFindFiles("")) {
            @Override
            public void onSuccess(Method method, String response) {
                if (method.getResponse().getStatusCode() == Response.SC_OK) {
                    List<String> list = helper.readFiles(response);
                    handler.onFilesLoaded(list);
View Full Code Here

    }


    @Override
    public void deleteFormItem(String formItemName, FormItemRepresentation formItem) {
        Resource resource = new Resource(URLBuilder.deleteFormItemURL(this.contextPath, this.packageName, formItemName));
        try {
            resource.delete().send(new RequestCallback() {
                @Override
                public void onError(Request request, Throwable exception) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.ErrorDeletingFormItem(""), exception));
                }
                @Override
View Full Code Here

    }

    @Override
    public void generateForm(FormRepresentation form, final String language,
            Map<String, Object> inputs) {
        Resource resource = new Resource(URLBuilder.generateFormURL(this.contextPath, language));
        try {
            String xml = helper.asXml(form, inputs);
            resource.post().header(Resource.HEADER_ACCEPT, Resource.CONTENT_TYPE_TEXT).
                xml(XMLParser.parse(xml)).send(new SimpleTextCallback(i18n.CouldntPreviewForm()) {
                @Override
                public void onSuccess(Method method, String urlResponse) {
                    bus.fireEvent(new PreviewFormResponseEvent(urlResponse, language));
                }
View Full Code Here

        }
    }

    @Override
    public void saveMenuItem(String groupName, final FBMenuItem item) {
        Resource resource = new Resource(URLBuilder.getMenuItemsURL(this.contextPath));
        String xml = helper.asXml(groupName, item);
        try {
            resource.post().xml(XMLParser.parse(xml)).expect(201,409).send(new RequestCallback() {
                @Override
                public void onError(Request request, Throwable exception) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.CouldntGenerateMenuItem(), exception));
                }
                @Override
View Full Code Here

        }
    }

    @Override
    public void deleteMenuItem(String groupName, FBMenuItem item) {
        Resource resource = new Resource(URLBuilder.getMenuItemsURL(this.contextPath));
        String xml = helper.asXml(groupName, item);
        try {
            resource.delete().xml(XMLParser.parse(xml)).send(new RequestCallback() {
                @Override
                public void onError(Request request, Throwable exception) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.ErrorDeletingMenuItem(), exception));
                }
                @Override
View Full Code Here

    }

    @Override
    public void getExistingIoAssociations(final String filter) {
        String url = URLBuilder.getIoAssociationsURL(this.contextPath, this.packageName);
        Resource resource = new Resource(url);
        if (filter != null && !"".equals(filter)) {
            resource = resource.addQueryParam("q", filter);
        }
        resource.get().send(new SimpleTextCallback(i18n.CouldntReadTasks()) {
            @Override
            public void onSuccess(Method method, String response) {
                List<TaskRef> retval = helper.readTasks(response);
                bus.fireEventFromSource(new ExistingTasksResponseEvent(retval, filter), RestyFormBuilderModel.this);
            }
View Full Code Here

    }

    @Override
    public void selectIoAssociation(String pkgName, String processName, String taskName) {
        String url = URLBuilder.getIoAssociationURL(this.contextPath, pkgName, processName, taskName);
        Resource resource = new Resource(url);
        resource.get().send(new SimpleTextCallback(i18n.CouldntReadSingleIO()) {
            @Override
            public void onSuccess(Method method, String response) {
                List<TaskRef> tasks = helper.readTasks(response);
                if (tasks.size() == 1) {
                    TaskRef singleTask = tasks.iterator().next();
View Full Code Here

        });
    }

    @Override
    public void getExistingValidations() {
        Resource resource = new Resource(URLBuilder.getValidationsURL(this.contextPath));
        resource.get().send(new SimpleTextCallback(i18n.CouldntReadValidations()) {
            @Override
            public void onSuccess(Method method, String response) {
                try {
                    List<FBValidationItem> retval = helper.readValidations(response);
                    bus.fireEvent(new ExistingValidationsResponseEvent(retval));
View Full Code Here

    }

    @Override
    public void getForm(final String formName) {
        String url = URLBuilder.getFormURL(this.contextPath, this.packageName, formName);
        Resource resource = new Resource(url);
        resource.get().send(new SimpleTextCallback(i18n.CouldntFindForm(formName)) {
            @Override
            public void onSuccess(Method method, String response) {
                if (method.getResponse().getStatusCode() == Response.SC_OK) {
                    List<FormRepresentation> list = helper.readForms(response);
                    bus.fireEvent(new LoadServerFormResponseEvent(list.isEmpty() ? null : list.iterator().next()));
View Full Code Here

TOP

Related Classes of org.fusesource.restygwt.client.Resource

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.