List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink add
public MarkupContainer add(final Component... children)
From source file:org.jaulp.wicket.dialogs.examples.HomePage.java
License:Apache License
/** * Constructor that is invoked when page is invoked without a session. * * @param parameters//w w w . jav a 2 s . c om * Page parameters */ public HomePage(final PageParameters parameters) { final WebMarkupContainer wmc = new WebMarkupContainer("comments"); wmc.setOutputMarkupId(true); final List<MessageBean> noteList = new ArrayList<MessageBean>(); final MessageBean messageBean = new MessageBean(); messageBean.setMessageContent("hello"); final ModalWindow modalWindow = new BaseModalWindow<MessageBean>("baseModalWindow", "Title", 350, 160, new CompoundPropertyModel<MessageBean>(messageBean)) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void onCancel(final AjaxRequestTarget target) { target.add(wmc); close(target); } @Override public void onSelect(final AjaxRequestTarget target, final MessageBean object) { MessageBean clone = (MessageBean) WicketObjects.cloneObject(object); noteList.add(clone); // Clear the content from textarea in the dialog. object.setMessageContent(""); target.add(wmc); close(target); } }; modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY); modalWindow.setResizable(false); add(modalWindow); final AjaxLink<String> linkToModalWindow = new AjaxLink<String>("linkToModalWindow") { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { modalWindow.show(target); } }; // Add the WebMarkupContainer... add(wmc); final Label linkToModalWindowLabel = new Label("linkToModalWindowLabel", "show modal dialog"); linkToModalWindow.add(linkToModalWindowLabel); // The AjaxLink to open the modal window add(linkToModalWindow); // here we must set the message content from the bean in a repeater... final ListView<MessageBean> repliesAndNotesListView = new ListView<MessageBean>("repliesAndNotesListView", noteList) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<MessageBean> item) { final MessageBean repliesandnotes = item.getModelObject(); item.add(new RepliesandnotesPanel("repliesandnotesPanel", repliesandnotes)); } }; repliesAndNotesListView.setVisible(true); wmc.add(repliesAndNotesListView); @SuppressWarnings("rawtypes") Link showUploadPage = new Link("showUploadPage") { /** * */ private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(new UploadPage(getPageParameters())); } }; add(showUploadPage); add(new ModalDialogWithStylePanel("modalDialogWithStylePanel")); }
From source file:org.laughingpanda.kansanpankki.accounts.AccountsView.java
License:Apache License
@Override protected void populateItem(Item<Account> item) { final IModel<Account> model = new Model<Account>(item.getModelObject()); AjaxLink<Account> accountLink = new AjaxLink<Account>("accountLink", model) { @Override//from w w w. ja va2 s .c o m public void onClick(AjaxRequestTarget target) { setResponsePage(new AccountPage(getModel(), getPage())); } }; accountLink.add(new Label("accountId", item.getDefaultModelObjectAsString())); item.add(new Label("balance", model.getObject().getBalance().toString())); item.add(accountLink); final PossibleTargetAccounts targetAccounts = new PossibleTargetAccounts(model); item.add(targetAccounts); final TextField<Integer> amountToTransfer = new TextField<Integer>("amountToTransfer", new Model<Integer>()) { @Override public boolean isEnabled() { return !(model.getObject()).isEmpty(); } // Wicket uses disabled="disabled" attribute for disabled text fields // However, WebDriver checks disabled state by checking if there is // fields having disabled attribute set to "true" @Override protected void onDisabled(ComponentTag tag) { tag.put("disabled", "true"); } }; amountToTransfer.setType(Integer.class); amountToTransfer.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { if (amountToTransfer.getModelObject() == null) { targetAccounts.setVisible(false); } else { targetAccounts.setVisible(true); targetAccounts.setAmountToTransfer(Money.euros(amountToTransfer.getModelObject())); } target.addComponent(targetAccounts); } }); item.add(amountToTransfer); }
From source file:org.obiba.onyx.jade.core.wicket.wizard.InstrumentWizardForm.java
License:Open Source License
public InstrumentWizardForm(String id, IModel<InstrumentType> instrumentTypeModel) { super(id, instrumentTypeModel); // Add Interrupt button. add(createInterrupt());//from w w w . j av a 2s.co m InstrumentType type = (InstrumentType) instrumentTypeModel.getObject(); log.debug("instrumentType={}", type.getName()); observedContraIndicationStep = new ObservedContraIndicationStep(getStepId()); askedContraIndicationStep = new AskedContraIndicationStep(getStepId()); instrumentSelectionStep = new InstrumentSelectionStep(getStepId(), instrumentTypeModel); noInstrumentAvailableStep = new NoInstrumentAvailableStep(getStepId()); inputParametersStep = new InputParametersStep(getStepId()); instrumentLaunchStep = new InstrumentLaunchStep(getStepId()); conclusionStep = new ConclusionStep(getStepId()); warningStep = new WarningsStep(getStepId()); outputParametersStep = new OutputParametersStep(getStepId(), conclusionStep, warningStep); warningStep.setNextStep(conclusionStep); warningStep.setPreviousStep(outputParametersStep); createModalAdministrationPanel(); // admin button AjaxLink link = new AjaxLink("adminLink") { private static final long serialVersionUID = 0L; @Override public void onClick(AjaxRequestTarget target) { adminWindow.setInterruptState(getInterruptLink().isEnabled()); if (getCancelLink() != null) adminWindow.setCancelState(getCancelLink().isEnabled()); adminWindow.show(target); } }; link.add(new AttributeModifier("value", true, new StringResourceModel("Administration", this, null))); link.add(new AttributeAppender("class", new Model("ui-corner-all"), " ")); add(link); }
From source file:org.obiba.onyx.jade.core.wicket.wizard.InstrumentWizardForm.java
License:Open Source License
private AjaxLink createInterrupt() { AjaxLink link = new AjaxLink("interrupt") { private static final long serialVersionUID = 0L; @Override/*from w w w . ja v a 2 s . co m*/ public void onClick(AjaxRequestTarget target) { onInterrupt(target); } @Override public boolean isVisible() { IStageExecution exec = activeInterviewService.getStageExecution((Stage) stageModel.getObject()); return exec.getActionDefinition(ActionType.INTERRUPT) != null; } }; link.add(new AttributeModifier("value", true, new StringResourceModel("Interrupt", InstrumentWizardForm.this, null))); return link; }
From source file:org.obiba.onyx.jade.core.wicket.workstation.ActionsPanel.java
License:Open Source License
public ActionsPanel(String id, IModel<InstrumentMeasurementType> model) { super(id, model); setOutputMarkupId(true);//w w w . j a v a 2 s . c om InstrumentMeasurementType instrumentMeasurementType = (InstrumentMeasurementType) model.getObject(); experimentalConditionDialogHelperPanel = new ExperimentalConditionDialogHelperPanel( "experimentalConditionDialogHelperPanel", new Model<Instrument>(instrumentMeasurementType.getInstrument()), new Model<Instrument>(instrumentMeasurementType.getInstrument())); add(experimentalConditionDialogHelperPanel); editInstrumentWindow = createEditInstrumentWindow("editInstrumentWindow"); add(editInstrumentWindow); deleteInstrumentConfirmationWindow = createDeleteInstrumentConfirmationDialogWindow( "deleteConfirmationDialog"); add(deleteInstrumentConfirmationWindow); RepeatingView repeating = new RepeatingView("link"); add(repeating); SeparatorMarkupComponentBorder border = new SeparatorMarkupComponentBorder(); for (LinkInfo linkInfo : getListOfLinkInfo(instrumentMeasurementType.getInstrument())) { AjaxLink<LinkInfo> link = new AjaxLink<LinkInfo>(repeating.newChildId(), new Model<LinkInfo>(linkInfo)) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { getModelObject().onClick(target); } }; link.add(new Label("action", new StringResourceModel(linkInfo.name, null)).setRenderBodyOnly(true)); link.setComponentBorder(border); link.setVisible(linkInfo.isVisible()); repeating.add(link); } }
From source file:org.obiba.onyx.jade.core.wicket.workstation.ViewCalibrationLogPanel.java
License:Open Source License
public ViewCalibrationLogPanel(String id, IModel<InstrumentMeasurementType> model) { super(id, model); ResourceModel logTitleModel = new ResourceModel("CalibrationHistory"); final Dialog logDialog = DialogBuilder .buildDialog("calibrationLogDialog", logTitleModel, getExperimentalConditionHistoryPanel()) .setOptions(Option.CLOSE_OPTION).getDialog(); logDialog.setHeightUnit("em"); logDialog.setWidthUnit("em"); logDialog.setInitialHeight(20);//from w w w . j ava 2 s. c o m logDialog.setInitialWidth(50); add(logDialog); AjaxLink<InstrumentMeasurementType> viewCalibrationLink = new AjaxLink<InstrumentMeasurementType>( "viewCalibrationLog", model) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { logDialog.show(target); } }; ContextImage commentIcon = new ContextImage("viewCalibrationLogImage", new Model<String>("icons/loupe_button.png")); viewCalibrationLink.add(commentIcon); add(viewCalibrationLink); }
From source file:org.obiba.onyx.marble.core.wicket.wizard.ConsentWizardForm.java
License:Open Source License
public ConsentWizardForm(String id, IModel interviewConsentModel) { super(id, interviewConsentModel); consentConfirmationStep = new ManualConsentStep(getStepId()); electronicConsentStep = new ElectronicConsentStep(getStepId(), consentConfirmationStep); consentModeSelectionStep = new ConsentModeSelectionStep(getStepId(), electronicConsentStep, consentConfirmationStep);/* www .j av a 2 s . c o m*/ WizardStepPanel startStep = setupWizardFlow(); startStep.onStepInNext(this, null); startStep.handleWizardState(this, null); add(startStep); createModalAdministrationPanel(); // admin button AjaxLink link = new AjaxLink("adminLink") { private static final long serialVersionUID = 0L; @Override public void onClick(AjaxRequestTarget target) { adminWindow.setInitialWidth(350); adminWindow.setInterruptState(false); if (getCancelLink() != null) adminWindow.setCancelState(getCancelLink().isEnabled()); adminWindow.show(target); } }; link.add(new AttributeModifier("value", true, new StringResourceModel("Administration", this, null))); link.add(new AttributeAppender("class", new Model("ui-corner-all"), " ")); add(link); }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.QuestionCategoryImageLink.java
License:Open Source License
protected void addLinkComponent(IModel<String> labelModel, IModel<String> descriptionModel) { AjaxLink<String> link = new AjaxLink<String>("link", labelModel) { private static final long serialVersionUID = 1L; @Override//from www . j ava 2s .c o m public void onClick(AjaxRequestTarget target) { QuestionCategoryImageLink.this.handleSelectionEvent(target); } }; link.add(new QuestionCategorySelectionBehavior()); link.add(new NoDragBehavior()); link.add(getCategoryImage("imageSelected", getCategoryImageId(getQuestionCategory(), true))); link.add(getCategoryImage("imageDeselected", getCategoryImageId(getQuestionCategory(), false))); add(link); }
From source file:org.obiba.onyx.quartz.core.wicket.wizard.QuestionnaireWizardForm.java
License:Open Source License
public QuestionnaireWizardForm(String id, IModel<Questionnaire> questionnaireModel) { super(id, questionnaireModel); // Add Interrupt button. add(createInterrupt());/* w w w . j a v a 2s.c o m*/ // Language selection step. languageSelectionStep = new LanguageSelectionStep(getStepId()); // Conclusion step. conclusionStep = new ConclusionStep(getStepId()); progressBar = new ProgressBarPanel("progressBar"); progressBar.setVisible(false); add(progressBar); createModalAdministrationPanel(); Questionnaire questionnaire = questionnaireModel.getObject(); add(new Label("questionnaireInfo", questionnaire.getName() + " " + questionnaire.getVersion())); // admin button AjaxLink link = new AjaxLink("adminLink") { private static final long serialVersionUID = 0L; @Override public void onClick(AjaxRequestTarget target) { adminWindow.setInterruptState(getInterruptLink().isEnabled()); if (getCancelLink() != null) adminWindow.setCancelState(getCancelLink().isEnabled()); adminWindow.show(target); } }; link.add(new AttributeModifier("value", true, new StringResourceModel("Administration", this, null))); link.add(new AttributeAppender("class", new Model("ui-corner-all"), " ")); add(link); // hidden, page-level Begin and End buttons createBeginAndEndButtons(); }
From source file:org.obiba.onyx.quartz.core.wicket.wizard.QuestionnaireWizardForm.java
License:Open Source License
private void createBeginAndEndButtons() { AjaxLink beginLink = new AjaxLink("beginLink") { private static final long serialVersionUID = 1L; @Override/*from ww w . ja v a 2 s .co m*/ public void onClick(AjaxRequestTarget target) { onBegin(target); } }; beginLink.setMarkupId("beginButton"); beginLink.add(new AttributeAppender("class", new Model("begin"), " ")); add(beginLink); AjaxButton endLink = new AjaxButton("endLink", this) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form form) { onEnd(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { showFeedbackWindow(target); } }; endLink.setMarkupId("endButton"); endLink.add(new AttributeAppender("class", new Model("end"), " ")); add(endLink); }