Example usage for org.apache.wicket.ajax AjaxRequestTarget add

List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add

Introduction

In this page you can find the example usage for org.apache.wicket.ajax AjaxRequestTarget add.

Prototype

void add(Component... components);

Source Link

Document

Adds components to the list of components to be rendered.

Usage

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Common handler for errors during an Ajax submit
 *///from w  ww . j  av a2s  .  co  m
private void handleError(final AjaxRequestTarget target) {
    // Update feedback panel and components with errors
    target.addChildren(getPage(), FeedbackPanel.class);
    target.getPage().visitChildren(FormComponent.class, new IVisitor<Component, Void>() {
        @Override
        public void component(Component component, IVisit<Void> arg1) {
            if (component.hasErrorMessage()) {
                target.add(component);
            }
        }
    });
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Button 'Delete' (Ajax). Delete the current message.
 *///  w ww. java 2  s.  c  o  m
private void handleDelete(AjaxRequestTarget target) {

    getConfig().messages.remove(currentMessageId);

    // Show feedback messages
    info(new StringResourceModel("info.deleted", this, null, currentMessageId).getString());
    target.addChildren(getPage(), FeedbackPanel.class);

    if (getConfig().messages.isEmpty()) {
        // No message left. Create a new message with id=1.
        getConfig().addMessageConfig(new MessageConfig(1));
    }
    // Select the first configured message for initial display
    currentMessage = getConfig().getMessageList().get(0);
    currentMessageId = currentMessage.messageId;

    // Refresh the drop down choice
    target.add(currentMessageIdDropdown);

    doValidation();

    updateForm(target);
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Update the edit form/*from  w  w  w  .  j a va2s.c  o m*/
 */
private void updateForm(AjaxRequestTarget target) {
    // Refresh the drop down choice
    target.add(currentMessageIdDropdown);
    target.add(target.getPage()
            .get("config-contents:tabs:panel:upload-form:edit-form:table-container:usePersistance"));
    target.add(
            target.getPage().get("config-contents:tabs:panel:upload-form:edit-form:table-container:queueMode"));
    target.add(target.getPage()
            .get("config-contents:tabs:panel:upload-form:edit-form:table-container:messageType"));

    // Refresh the form
    editor.reloadModel();
    MarkupContainer listEditorContainer = (MarkupContainer) target.getPage()
            .get("config-contents:tabs:panel:upload-form:edit-form:table-container:list-editor");
    target.add(listEditorContainer);
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Update the tag length input in the list editor
 * @param target//w  ww.j av a2  s .c om
 */
private void updateTagLength(AjaxRequestTarget target) {

    @SuppressWarnings("rawtypes")
    List<DropDownChoice> choices = editor.getComponentsById("tagLengthType", DropDownChoice.class);
    for (DropDownChoice<?> choice : choices) {
        target.add(choice);
    }
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Update the offsets displayed in the list editor
 *//*from ww  w  .j  av a2s. c  o m*/
private void updateOffsets(AjaxRequestTarget target) {
    recalcOffsets();

    List<Label> labels = editor.getComponentsById("offset", Label.class);
    for (Label lab : labels) {
        target.add(lab);
    }
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.WritebackConfigUI.java

License:Apache License

private DropDownChoice<OptionalDataType> getMessageIdTypeDropdown() {
    DropDownChoice<OptionalDataType> dropDown = new DropDownChoice<OptionalDataType>("messageIdType",
            OptionalDataType.getOptions(), new EnumChoiceRenderer<OptionalDataType>(this));

    dropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override/*  www  .j  av  a  2 s  .co  m*/
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(getComponent().getParent().get("initialId")
                    .setEnabled(getConfig().getMessageIdType() != OptionalDataType.None));
        }
    });

    return dropDown;
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.WritebackConfigUI.java

License:Apache License

private CheckBox getEnabledCheckBox() {
    CheckBox checkbox = new CheckBox("enabled");

    checkbox.add(new OnChangeAjaxBehavior() {
        @Override/*  w ww.  j  av  a  2 s . co  m*/
        protected void onUpdate(AjaxRequestTarget target) {
            boolean value = ((CheckBox) getComponent()).getConvertedInput();

            if (value) {
                settingsTable.setEnabled(true);
            } else {
                settingsTable.setEnabled(false);
            }
            target.add(settingsTable);
        }
    });

    return checkbox;
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.WritebackConfigUI.java

License:Apache License

private CheckBox getUsePrefixCheckBox() {
    CheckBox checkbox = new CheckBox("usePrefix");

    checkbox.add(new OnChangeAjaxBehavior() {
        @Override//from   w  w w. j  a  v a2s.co  m
        protected void onUpdate(AjaxRequestTarget target) {
            boolean value = ((CheckBox) getComponent()).getConvertedInput();

            Component prefixTextField = getComponent().getParent().get("prefix");
            if (value && !prefixTextField.isEnabled()) {
                prefixTextField.setEnabled(true);
            } else {
                prefixTextField.setEnabled(false);
            }
            target.add(prefixTextField);
        }
    });

    return checkbox;
}

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.WritebackConfigUI.java

License:Apache License

private CheckBox getSendInitialValueCheckBox() {
    CheckBox checkbox = new CheckBox("sendInitialValue");

    // When the datatype is changed, the offsets are recalculated and
    // displayed/*from w w w. j a  va 2s  . c  om*/
    checkbox.add(new OnChangeAjaxBehavior() {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            boolean value = ((CheckBox) getComponent()).getConvertedInput();

            Component initialValueTextField = getComponent().getParent().get("initialValue");
            Component initialIdTextField = getComponent().getParent().get("initialId");

            if (value && !initialValueTextField.isEnabled()) {
                initialValueTextField.setEnabled(true);
                initialIdTextField.setEnabled(true);
            } else {
                initialValueTextField.setEnabled(false);
                initialIdTextField.setEnabled(false);
            }
            target.add(initialValueTextField);
            target.add(initialIdTextField);
        }
    });

    return checkbox;
}

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.MultiUpdatingTimerBehavior.java

License:Apache License

protected final void onTimer(final AjaxRequestTarget target) {
    target.add(getComponent());
    onPostProcessTarget(target);
}