Example usage for com.google.gwt.http.client RequestBuilder send

List of usage examples for com.google.gwt.http.client RequestBuilder send

Introduction

In this page you can find the example usage for com.google.gwt.http.client RequestBuilder send.

Prototype

public Request send() throws RequestException 

Source Link

Document

Sends an HTTP request based on the current builder configuration.

Usage

From source file:org.opentaps.gwt.crmsfa.client.accounts.form.AccountsSublistView.java

License:Open Source License

/** {@inheritDoc} */
@Override/*from   w ww. java 2  s . c o  m*/
public void init() {

    String entityViewUrl = "/crmsfa/control/viewAccount?partyId={0}";
    StringFieldDef idDefinition = new StringFieldDef(PartyLookupConfiguration.INOUT_PARTY_ID);

    makeLinkColumn(UtilUi.MSG.crmContactId(), idDefinition, entityViewUrl, true);
    makeLinkColumn(UtilUi.MSG.crmAccountName(), idDefinition,
            new StringFieldDef(PartyLookupConfiguration.INOUT_FRIENDLY_PARTY_NAME), entityViewUrl, true);
    makeColumn(UtilUi.MSG.partyCity(), new StringFieldDef(PartyLookupConfiguration.INOUT_CITY));
    makeColumn(UtilUi.MSG.crmPrimaryEmail(), new StringFieldDef(PartyLookupConfiguration.INOUT_EMAIL));
    makeColumn(UtilUi.MSG.crmPrimaryPhone(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_FORMATED_PHONE_NUMBER));
    makeColumn(UtilUi.MSG.partyToName(), new StringFieldDef(PartyLookupConfiguration.INOUT_TO_NAME));
    makeColumn(UtilUi.MSG.partyAttentionName(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_ATTENTION_NAME));
    makeColumn(UtilUi.MSG.partyAddressLine1(), new StringFieldDef(PartyLookupConfiguration.INOUT_ADDRESS));
    makeColumn(UtilUi.MSG.partyAddressLine2(), new StringFieldDef(PartyLookupConfiguration.OUT_ADDRESS_2));
    makeColumn(UtilUi.MSG.partyState(), new StringFieldDef(PartyLookupConfiguration.INOUT_STATE));
    makeColumn(UtilUi.MSG.partyCountry(), new StringFieldDef(PartyLookupConfiguration.INOUT_COUNTRY));
    makeColumn(UtilUi.MSG.partyPostalCode(), new StringFieldDef(PartyLookupConfiguration.INOUT_POSTAL_CODE));
    makeColumn(UtilUi.MSG.crmPostalCodeExt(), new StringFieldDef(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT));

    // add last column if logged in user has required permission
    deleteColumnIndex = getCurrentColumnIndex();
    if (hasAccountsRemoveAbility()) {
        ColumnConfig config = makeColumn("", new Renderer() {
            public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex,
                    int colNum, Store store) {
                return Format.format("<img width=\"15\" height=\"15\" class=\"checkbox\" src=\"{0}\"/>",
                        UtilUi.ICON_DELETE);
            }
        });
        config.setWidth(26);
        config.setResizable(false);
        config.setFixed(true);
        config.setSortable(false);

        addGridCellListener(new GridCellListenerAdapter() {
            private final String actionUrl = "/crmsfa/control/removeContactFromAccountAJX";

            /** {@inheritDoc} */
            @Override
            public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e) {
                if (colindex == AccountsSublistView.this.deleteColumnIndex) {
                    String accountPartyId = getStore().getRecordAt(rowIndex).getAsString("partyId");
                    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
                    request.setHeader("Content-type", "application/x-www-form-urlencoded");
                    request.setRequestData(Format.format("partyId={0}&contactPartyId={0}&accountPartyId={1}",
                            AccountsSublistView.this.contactPartyId, accountPartyId));
                    request.setCallback(new RequestCallback() {
                        public void onError(Request request, Throwable exception) {
                            // display error message
                            markGridNotBusy();
                            UtilUi.errorMessage(exception.toString());
                        }

                        public void onResponseReceived(Request request, Response response) {
                            // if it is a correct response, reload the grid
                            markGridNotBusy();
                            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE,
                                    "ContactListView.init()");
                            if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                                getStore().reload();
                                loadFirstPage();
                            }
                        }
                    });

                    try {
                        markGridBusy();
                        UtilUi.logInfo("posting batch", MODULE, "ContactListView.init()");
                        request.send();
                    } catch (RequestException re) {
                        // display error message
                        UtilUi.errorMessage(e.toString(), MODULE, "ContactListView.init()");
                    }

                }
            }

        });
    }

    configure(PartyLookupConfiguration.URL_FIND_ACCOUNTS, PartyLookupConfiguration.INOUT_PARTY_ID, SortDir.ASC);

    // by default, hide non essential columns
    setColumnHidden(PartyLookupConfiguration.INOUT_PARTY_ID, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_STATE, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_COUNTRY, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_TO_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ATTENTION_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ADDRESS, true);
    setColumnHidden(PartyLookupConfiguration.OUT_ADDRESS_2, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_POSTAL_CODE, true);
    setColumnHidden(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT, true);
}

From source file:org.opentaps.gwt.crmsfa.client.contacts.form.ContactsSublistView.java

License:Open Source License

/** {@inheritDoc} */
@Override//from www. j  av  a2 s .  c  o m
public void init() {

    String entityViewUrl = "/crmsfa/control/viewContact?partyId={0}";
    StringFieldDef idDefinition = new StringFieldDef(PartyLookupConfiguration.INOUT_PARTY_ID);

    makeLinkColumn(UtilUi.MSG.crmContactId(), idDefinition, entityViewUrl, true);
    makeLinkColumn(UtilUi.MSG.crmContactName(), idDefinition,
            new StringFieldDef(PartyLookupConfiguration.INOUT_FRIENDLY_PARTY_NAME), entityViewUrl, true);
    makeColumn(UtilUi.MSG.partyCity(), new StringFieldDef(PartyLookupConfiguration.INOUT_CITY));
    makeColumn(UtilUi.MSG.crmPrimaryEmail(), new StringFieldDef(PartyLookupConfiguration.INOUT_EMAIL));
    makeColumn(UtilUi.MSG.crmPrimaryPhone(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_FORMATED_PHONE_NUMBER));
    makeColumn(UtilUi.MSG.partyToName(), new StringFieldDef(PartyLookupConfiguration.INOUT_TO_NAME));
    makeColumn(UtilUi.MSG.partyAttentionName(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_ATTENTION_NAME));
    makeColumn(UtilUi.MSG.partyAddressLine1(), new StringFieldDef(PartyLookupConfiguration.INOUT_ADDRESS));
    makeColumn(UtilUi.MSG.partyAddressLine2(), new StringFieldDef(PartyLookupConfiguration.OUT_ADDRESS_2));
    makeColumn(UtilUi.MSG.partyState(), new StringFieldDef(PartyLookupConfiguration.INOUT_STATE));
    makeColumn(UtilUi.MSG.partyCountry(), new StringFieldDef(PartyLookupConfiguration.INOUT_COUNTRY));
    makeColumn(UtilUi.MSG.partyPostalCode(), new StringFieldDef(PartyLookupConfiguration.INOUT_POSTAL_CODE));
    makeColumn(UtilUi.MSG.crmPostalCodeExt(), new StringFieldDef(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT));

    // add Remove button if user has required permission
    if (hasRemovePermission(isOpportunity)) {
        deleteColumnIndex = getCurrentColumnIndex();
        ColumnConfig config = makeColumn("", new Renderer() {
            public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex,
                    int colNum, Store store) {
                return Format.format("<img width=\"15\" height=\"15\" class=\"checkbox\" src=\"{0}\"/>",
                        UtilUi.ICON_DELETE);
            }
        });
        config.setWidth(26);
        config.setResizable(false);
        config.setFixed(true);
        config.setSortable(false);

        addGridCellListener(new GridCellListenerAdapter() {
            private final String actionUrl = isOpportunity ? "/crmsfa/control/removeContactFromOpportunityAJX"
                    : "/crmsfa/control/removeContactFromAccountAJX";

            /** {@inheritDoc} */
            @Override
            public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e) {
                if (colindex == ContactsSublistView.this.deleteColumnIndex) {
                    String contactPartyId = getStore().getRecordAt(rowIndex).getAsString("partyId");
                    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
                    request.setHeader("Content-type", "application/x-www-form-urlencoded");
                    if (isOpportunity) {
                        request.setRequestData(Format.format("salesOpportunityId={0}&contactPartyId={1}",
                                ContactsSublistView.this.entityId, contactPartyId));
                    } else {
                        request.setRequestData(
                                Format.format("partyId={0}&accountPartyId={0}&contactPartyId={1}",
                                        ContactsSublistView.this.entityId, contactPartyId));
                    }
                    request.setCallback(new RequestCallback() {
                        public void onError(Request request, Throwable exception) {
                            // display error message
                            markGridNotBusy();
                            UtilUi.errorMessage(exception.toString());
                        }

                        public void onResponseReceived(Request request, Response response) {
                            // if it is a correct response, reload the grid
                            markGridNotBusy();
                            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE,
                                    "ContactListView.init()");
                            if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                                // commit store changes
                                getStore().reload();
                                loadFirstPage();
                            }
                        }
                    });

                    try {
                        markGridBusy();
                        UtilUi.logInfo("posting batch", MODULE, "ContactListView.init()");
                        request.send();
                    } catch (RequestException re) {
                        // display error message
                        UtilUi.errorMessage(e.toString(), MODULE, "ContactListView.init()");
                    }

                }
            }

        });
    }

    configure(PartyLookupConfiguration.URL_FIND_CONTACTS, PartyLookupConfiguration.INOUT_PARTY_ID, SortDir.ASC);

    // by default, hide non essential columns
    setColumnHidden(PartyLookupConfiguration.INOUT_PARTY_ID, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_STATE, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_COUNTRY, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_TO_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ATTENTION_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ADDRESS, true);
    setColumnHidden(PartyLookupConfiguration.OUT_ADDRESS_2, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_POSTAL_CODE, true);
    setColumnHidden(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT, true);
}

From source file:org.opentaps.gwt.crmsfa.client.Entry.java

License:Open Source License

/**
 * This method setup a button into subsection title at right-hand position
 * and allow to assign a new account using lookup accounts window.
 * @param container <code>RootPanel</code> that is root container for button
 * @param contactAccounts parent accounts list view.
 *///from  w  w w . j a v  a  2  s .c  om
private void loadAssignAccountToContactWidget(RootPanel container, final AccountsSublistView contactAccounts) {

    // create lookup window
    final LookupAccountsWindow window = new LookupAccountsWindow(true, true);
    window.create();

    // register listener to be notified when user selects an account
    window.register(new FormNotificationInterface<String>() {

        /** {@inheritDoc} */
        public void notifySuccess(String obj) {
            if (obj == null) {
                return;
            }

            final String actionUrl = "/crmsfa/control/assignAccountToContactAJX";

            // keep user's selection
            String accountPartyId = obj;

            // nothing special, just send HTTP POST request
            // and run crmsfa.assignContactToAccount service
            RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
            request.setHeader("Content-type", "application/x-www-form-urlencoded");
            request.setRequestData(Format.format("partyId={0}&contactPartyId={0}&accountPartyId={1}",
                    getPartyId(), accountPartyId));
            request.setCallback(new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                    // display error message
                    UtilUi.errorMessage(exception.toString());
                }

                public void onResponseReceived(Request request, Response response) {
                    // we don't expect anything from server, just reload the list of contacts
                    UtilUi.logInfo("onResponseReceived, response = " + response, "",
                            "loadAssignContactToAccountWidget");
                    if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                        contactAccounts.getStore().reload();
                        contactAccounts.loadFirstPage();
                    }
                    contactAccounts.markGridNotBusy();
                }
            });

            try {
                contactAccounts.markGridBusy();
                UtilUi.logInfo("Run service crmsfa.assignContactToAccount", MODULE,
                        "loadAssignContactToAccountWidget");
                request.send();
            } catch (RequestException re) {
                // display error message
                UtilUi.errorMessage(re.toString(), MODULE, "loadAssignContactToAccountWidget");
            }
        }

    });

    // create hyperlink as submenu button
    Button embedLink = new Button(UtilUi.MSG.crmAssignAccount(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            window.show();
        }

    });
    embedLink.setStyleName("subMenuButton");

    // place [Assign Contact] button on page
    container.add(embedLink);
}

From source file:org.opentaps.gwt.crmsfa.client.Entry.java

License:Open Source License

/**
 * This method setup a button into subsection title at right-hand position
 * and allow to assign a new contact using lookup contacts window.
 * @param container <code>RootPanel</code> that is root container for button
 * @param opportunityContacts parent contacts list view.
 *///  w  w w. ja  v  a2s  .  c  o m
private void loadAssignContactToOpportunityWidget(RootPanel container,
        final ContactsSublistView opportunityContacts) {

    // create lookup window
    final LookupContactsWindow window = new LookupContactsWindow(true, true);
    window.create();

    // register listener to be notified when user selects a contact
    window.register(new FormNotificationInterface<String>() {

        /** {@inheritDoc} */
        public void notifySuccess(String obj) {
            if (obj == null) {
                return;
            }

            final String actionUrl = "/crmsfa/control/addContactToOpportunityAJX";

            // keep user's selection
            String contactPartyId = obj;

            // nothing special, just send HTTP POST request
            // and run crmsfa.assignContactToAccount service
            RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
            request.setHeader("Content-type", "application/x-www-form-urlencoded");
            request.setRequestData(Format.format("salesOpportunityId={0}&contactPartyId={1}",
                    getSalesOpportunityId(), contactPartyId));
            request.setCallback(new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                    // display error message
                    UtilUi.errorMessage(exception.toString());
                }

                public void onResponseReceived(Request request, Response response) {
                    // we don't expect anything from server, just reload the list of contacts
                    UtilUi.logInfo("onResponseReceived, response = " + response, "",
                            "loadAssignContactToAccountWidget");
                    if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                        opportunityContacts.getStore().reload();
                        opportunityContacts.loadFirstPage();
                    }
                    opportunityContacts.markGridNotBusy();
                }
            });

            try {
                opportunityContacts.markGridBusy();
                UtilUi.logInfo("Run service crmsfa.assignContactToAccount", MODULE,
                        "loadAssignContactToAccountWidget");
                request.send();
            } catch (RequestException re) {
                // display error message
                UtilUi.errorMessage(re.toString(), MODULE, "loadAssignContactToAccountWidget");
            }
        }

    });

    // create hyperlink as submenu button
    Button embedLink = new Button(UtilUi.MSG.crmAssignContact(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            window.show();
        }

    });
    embedLink.setStyleName("subMenuButton");

    // place [Assign Contact] button on page
    container.add(embedLink);
}

From source file:org.opentaps.gwt.crmsfa.client.Entry.java

License:Open Source License

/**
 * This method setup a button into subsection title at right-hand position
 * and allow to assign a new contact using lookup contacts window.
 * @param container <code>RootPanel</code> that is root container for button
 * @param accountContacts parent contacts list view.
 *//* w w w . ja  v  a2s. co  m*/
private void loadAssignContactToAccountWidget(RootPanel container, final ContactsSublistView accountContacts) {

    // create lookup window
    final LookupContactsWindow window = new LookupContactsWindow(true, true);
    window.create();

    // register listener to be notified when user selects a contact
    window.register(new FormNotificationInterface<String>() {

        /** {@inheritDoc} */
        public void notifySuccess(String obj) {
            if (obj == null) {
                return;
            }

            final String actionUrl = "/crmsfa/control/assignContactToAccountAJX";

            // keep user's selection
            String contactPartyId = obj;

            // nothing special, just send HTTP POST request
            // and run crmsfa.assignContactToAccount service
            RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
            request.setHeader("Content-type", "application/x-www-form-urlencoded");
            request.setRequestData(Format.format("partyId={0}&accountPartyId={0}&contactPartyId={1}",
                    getPartyId(), contactPartyId));
            request.setCallback(new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                    // display error message
                    UtilUi.errorMessage(exception.toString());
                }

                public void onResponseReceived(Request request, Response response) {
                    // we don't expect anything from server, just reload the list of contacts
                    UtilUi.logInfo("onResponseReceived, response = " + response, "",
                            "loadAssignContactToAccountWidget");
                    if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                        accountContacts.getStore().reload();
                        accountContacts.loadFirstPage();
                    }
                    accountContacts.markGridNotBusy();
                }
            });

            try {
                accountContacts.markGridBusy();
                UtilUi.logInfo("Run service crmsfa.assignContactToAccount", MODULE,
                        "loadAssignContactToAccountWidget");
                request.send();
            } catch (RequestException re) {
                // display error message
                UtilUi.errorMessage(re.toString(), MODULE, "loadAssignContactToAccountWidget");
            }
        }

    });

    // create hyperlink as submenu button
    Button embedLink = new Button(UtilUi.MSG.crmAssignContact(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            window.show();
        }

    });
    embedLink.setStyleName("subMenuButton");

    // place [Assign Contact] button on page
    container.add(embedLink);
}

From source file:org.opentaps.gwt.crmsfa.client.opportunities.form.OpportunityContactsSubview.java

License:Open Source License

/**
 * Constructor with autoLoad parameter, use this constructor if some filters need to be set prior to loading the grid data.
 * @param autoLoad sets the grid autoLoad parameter, set to <code>false</code> if some filters need to be set prior to loading the grid data
 *///from  ww w  . ja  va2 s  .co m
public OpportunityContactsSubview(String accountPartyId, boolean autoLoad) {
    super(UtilUi.MSG.crmContactId(), UtilUi.MSG.crmFindContacts());
    this.accountPartyId = accountPartyId;
    contactListView = new ContactListView() {

        /** {@inheritDoc} */
        @Override
        public void init() {

            String entityViewUrl = "/crmsfa/control/viewContact?partyId={0}";
            StringFieldDef idDefinition = new StringFieldDef(PartyLookupConfiguration.INOUT_PARTY_ID);

            makeLinkColumn(UtilUi.MSG.crmContactId(), idDefinition, entityViewUrl, true);
            makeLinkColumn(UtilUi.MSG.crmContactName(), idDefinition,
                    new StringFieldDef(PartyLookupConfiguration.INOUT_FRIENDLY_PARTY_NAME), entityViewUrl,
                    true);
            makeColumn(UtilUi.MSG.partyCity(), new StringFieldDef(PartyLookupConfiguration.INOUT_CITY));
            makeColumn(UtilUi.MSG.crmPrimaryEmail(), new StringFieldDef(PartyLookupConfiguration.INOUT_EMAIL));
            makeColumn(UtilUi.MSG.crmPrimaryPhone(),
                    new StringFieldDef(PartyLookupConfiguration.INOUT_FORMATED_PHONE_NUMBER));
            makeColumn(UtilUi.MSG.partyToName(), new StringFieldDef(PartyLookupConfiguration.INOUT_TO_NAME));
            makeColumn(UtilUi.MSG.partyAttentionName(),
                    new StringFieldDef(PartyLookupConfiguration.INOUT_ATTENTION_NAME));
            makeColumn(UtilUi.MSG.partyAddressLine1(),
                    new StringFieldDef(PartyLookupConfiguration.INOUT_ADDRESS));
            makeColumn(UtilUi.MSG.partyAddressLine2(),
                    new StringFieldDef(PartyLookupConfiguration.OUT_ADDRESS_2));
            makeColumn(UtilUi.MSG.partyState(), new StringFieldDef(PartyLookupConfiguration.INOUT_STATE));
            makeColumn(UtilUi.MSG.partyCountry(), new StringFieldDef(PartyLookupConfiguration.INOUT_COUNTRY));
            makeColumn(UtilUi.MSG.partyPostalCode(),
                    new StringFieldDef(PartyLookupConfiguration.INOUT_POSTAL_CODE));
            makeColumn(UtilUi.MSG.crmPostalCodeExt(),
                    new StringFieldDef(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT));
            deleteColumnIndex = getCurrentColumnIndex();
            ColumnConfig config = makeColumn("", new Renderer() {
                public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex,
                        int colNum, Store store) {
                    return Format.format("<img width=\"15\" height=\"15\" class=\"checkbox\" src=\"{0}\"/>",
                            UtilUi.ICON_DELETE);
                }
            });
            config.setWidth(26);
            config.setResizable(false);
            config.setFixed(true);
            config.setSortable(false);

            addGridCellListener(new GridCellListenerAdapter() {
                private final String actionUrl = "/crmsfa/control/removeContactFromAccount";

                /** {@inheritDoc} */
                @Override
                public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e) {
                    if (colindex == OpportunityContactsSubview.this.deleteColumnIndex) {
                        String contactPartyId = getStore().getRecordAt(rowIndex).getAsString("partyId");
                        RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
                        request.setHeader("Content-type", "application/x-www-form-urlencoded");
                        request.setRequestData(
                                Format.format("partyId={0}&accountPartyId={0}&contactPartyId={1}",
                                        OpportunityContactsSubview.this.accountPartyId, contactPartyId));
                        request.setCallback(new RequestCallback() {
                            public void onError(Request request, Throwable exception) {
                                // display error message
                                markGridNotBusy();
                                UtilUi.errorMessage(exception.toString());
                            }

                            public void onResponseReceived(Request request, Response response) {
                                // if it is a correct response, reload the grid
                                markGridNotBusy();
                                UtilUi.logInfo("onResponseReceived, response = " + response, MODULE,
                                        "ContactListView.init()");
                                if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                                    // commit store changes
                                    getStore().reload();
                                    loadFirstPage();
                                }
                            }
                        });

                        try {
                            markGridBusy();
                            UtilUi.logInfo("posting batch", MODULE, "ContactListView.init()");
                            request.send();
                        } catch (RequestException re) {
                            // display error message
                            UtilUi.errorMessage(e.toString(), MODULE, "ContactListView.init()");
                        }

                    }
                }

            });

            configure(PartyLookupConfiguration.URL_FIND_CONTACTS, PartyLookupConfiguration.INOUT_PARTY_ID,
                    SortDir.ASC);

            // by default, hide non essential columns
            setColumnHidden(PartyLookupConfiguration.INOUT_PARTY_ID, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_STATE, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_COUNTRY, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_TO_NAME, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_ATTENTION_NAME, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_ADDRESS, true);
            setColumnHidden(PartyLookupConfiguration.OUT_ADDRESS_2, true);
            setColumnHidden(PartyLookupConfiguration.INOUT_POSTAL_CODE, true);
            setColumnHidden(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT, true);
        }

    };
    contactListView.setHeader(false);
    contactListView.setAutoLoad(autoLoad);
    contactListView.init();
    addListView(contactListView);
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.CatalogRequestBuilder.java

License:Open Source License

public void sendRequestToCatalog(String endpoint, RequestCallback callback) {
    RequestBuilder request = new RequestBuilder(RequestBuilder.GET, this.catalogUrl + "/" + endpoint);
    request.setHeader(CatalogConstants.SESSION_ID_PARAM, LoginModel.getInstance().getSessionId());
    request.setCallback(callback);/*from   www .  j  a v a  2 s  .  com*/
    try {
        request.send();
    } catch (RequestException e) {
        this.importFromCatalogPanelFeeder.setNodeSourceWindowLabelWithError("Request sent to catalog failed",
                e);
    }
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.export.catalog.ExportToCatalogConfirmWindow.java

License:Open Source License

private void fillBucketList() {
    this.bucketList.setEnabled(false);
    this.bucketList.addItem(SELECT_A_BUCKET_OPTION);
    this.bucketList
            .addChangeHandler(event -> requestCatalogObjectsAndRevisions(this.bucketList.getSelectedValue()));
    RequestBuilder request = new RequestBuilder(RequestBuilder.GET,
            new CatalogUrlBuilder().getCatalogUrl() + "/buckets");
    request.setHeader("sessionId", LoginModel.getInstance().getSessionId());
    request.setCallback(fillBucketListWithRequestCallback());
    try {//  www . j a  v a  2 s . co m
        request.send();
    } catch (RequestException e) {
        String errorMessage = "Request sent to catalog failed";
        LogModel.getInstance().logCriticalMessage(errorMessage);
        this.windowLabel.setContents(errorMessage);
    }
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.ExportToCatalogConfirmWindow.java

License:Open Source License

private void fillBucketList() {
    this.bucketList.setEnabled(false);
    this.bucketList.addItem(SELECT_A_BUCKET_OPTION);
    this.bucketList.addChangeHandler(event -> requestNodeSourceInBucket(this.bucketList.getSelectedValue()));
    RequestBuilder request = new RequestBuilder(RequestBuilder.GET,
            new CatalogUrlBuilder().getCatalogUrl() + "/buckets");
    request.setHeader("sessionId", LoginModel.getInstance().getSessionId());
    request.setCallback(fillBucketListWithRequestCallback());
    try {/*w  w w .  jav  a  2s. c  o m*/
        request.send();
    } catch (RequestException e) {
        String errorMessage = "Request sent to catalog failed";
        GWT.log(errorMessage, e);
        this.windowLabel.setContents(errorMessage);
    }
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.ImportFromCatalogPanel.java

License:Open Source License

private void requestNodeSourceConfiguration() {
    String selectedNodeSourceInList = this.nodeSourceListBox.getSelectedValue();
    if (!selectedNodeSourceInList.equals(SELECT_NODE_SOURCE_GENERIC_ENTRY)) {
        String nodeSourceConfigurationRequestUrl = new CatalogUrlBuilder().getCatalogUrl() + "/buckets/"
                + this.importFromCatalogPanelFeeder.getBucketNameForNodeSource(selectedNodeSourceInList)
                + "/resources/" + selectedNodeSourceInList + "/raw";
        RequestBuilder nodeSourceConfigurationRequest = new RequestBuilder(RequestBuilder.GET,
                nodeSourceConfigurationRequestUrl);
        nodeSourceConfigurationRequest.setHeader(CatalogConstants.SESSION_ID_PARAM,
                LoginModel.getInstance().getSessionId());
        nodeSourceConfigurationRequest.setCallback(getNodeSourceConfigurationRequestCallback());
        try {/*  w w w  .  j a  va2s.c om*/
            nodeSourceConfigurationRequest.send();
        } catch (RequestException e) {
            setNodeSourceWindowLabelWithError("Request sent to catalog failed", e);
        }
    }
}