Java Code Examples for org.apache.wicket.ajax.markup.html.AjaxLink

The following examples show how to use org.apache.wicket.ajax.markup.html.AjaxLink. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: onedev   Source File: CodeCommentPanel.java    License: MIT License 6 votes vote down vote up
private WebMarkupContainer newAddReplyContainer() {
	WebMarkupContainer addReplyContainer = new Fragment("addReply", "addReplyFrag", this) {

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(SecurityUtils.getUser() != null);
		}
		
	};
	addReplyContainer.setOutputMarkupId(true);
	addReplyContainer.add(new AjaxLink<Void>("reply") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			onAddReply(target);
		}
		
	});
	return addReplyContainer;
}
 
Example 2
Source Project: onedev   Source File: AjaxActionTab.java    License: MIT License 6 votes vote down vote up
@Override
public Component render(String componentId) {
	return new ActionTabLink(componentId, this) {

		@Override
		protected WebMarkupContainer newLink(String id, ActionTab tab) {
			return new AjaxLink<Void>("link") {

				@Override
				protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
					super.updateAjaxAttributes(attributes);
					AjaxActionTab.this.updateAjaxAttributes(attributes);
				}

				@Override
				public void onClick(AjaxRequestTarget target) {
					selectTab(this);
				}
				
			};
		}
		
	};
}
 
Example 3
Source Project: onedev   Source File: SideInfoPanel.java    License: MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(newContent("content"));
	add(new AjaxLink<Void>("close") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			String script = String.format("$('#%s').hide('slide', {direction: 'right', duration: 200});", SideInfoPanel.this.getMarkupId());
			target.appendJavaScript(script);
			send(getPage(), Broadcast.BREADTH, new SideInfoClosed(target));
		}
		
	});
	
	add(AttributeAppender.append("class", "side-info closed"));
}
 
Example 4
Source Project: onedev   Source File: GeneralErrorPage.java    License: MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	WebMarkupContainer container = new WebMarkupContainer("error");
	container.setOutputMarkupId(true);
	add(container);
	
	container.add(new Label("title", StringUtils.abbreviate(title, MAX_TITLE_LEN)));
	
	container.add(new ViewStateAwarePageLink<Void>("home", ProjectListPage.class));
	
	container.add(new AjaxLink<Void>("showDetail") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			Fragment fragment = new Fragment("detail", "detailFrag", GeneralErrorPage.this);
			fragment.add(new MultilineLabel("body", detailMessage));				
			container.replace(fragment);
			target.add(container);
			setVisible(false);
		}

	});
	container.add(new WebMarkupContainer("detail"));
}
 
Example 5
Source Project: openmeetings   Source File: InvitationDetails.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(new Label("id"));
	add(valid);
	add(invitee);
	add(from);
	add(to);
	// add a cancel button that can be used to submit the form via ajax
	delBtn = new AjaxLink<>("ajax-cancel-button") {
		private static final long serialVersionUID = 1L;

		public void onClick(AjaxRequestTarget target) {
			inviteDao.delete(InvitationDetails.this.getModelObject(), getUserId());
			InvitationDetails.this.setModelObject(new Invitation());
			target.add(list, InvitationDetails.this);
		}
	};
	delBtn.add(newOkCancelDangerConfirm(this, getString("833")));
	add(delBtn.setOutputMarkupId(true).setEnabled(false));
}
 
Example 6
Source Project: etcd-viewer   Source File: DeleteClusterModalPanel.java    License: Apache License 2.0 6 votes vote down vote up
public DeleteClusterModalPanel(String id, IModel<String> model) {
    super(id, model);

    add(name = new Label("name", getModel()));
    name.setOutputMarkupId(true);

    add(new AjaxLink<String>("delete", getModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            clusterManager.removeCluster(getModelObject());

            onClusterDeleted(target);

            modalHide(target);
        }
    });
}
 
Example 7
public TestPanel(String id) {
	super(id);

	message = null;

	link = new AjaxLink<String>("link") {
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			Session.get().getFeedbackMessages().add(new FeedbackMessage(label, msg, 0));
			target.add(TestPanel.this);
		}
	};

	label = new Label("label");
}
 
Example 8
Source Project: syncope   Source File: MultilevelPanel.java    License: Apache License 2.0 6 votes vote down vote up
public MultilevelPanel(final String id) {
    super(id);

    firstLevelContainer = new WebMarkupContainer("firstLevelContainer");
    firstLevelContainer.setOutputMarkupPlaceholderTag(true);
    firstLevelContainer.setVisible(true);
    add(firstLevelContainer);

    secondLevelContainer = new WebMarkupContainer("secondLevelContainer");
    secondLevelContainer.setOutputMarkupPlaceholderTag(true);
    secondLevelContainer.setVisible(false);
    add(secondLevelContainer);

    secondLevelContainer.add(new AjaxLink<String>("back") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            onClickBackInternal(target);
            prev(target);
        }
    });
}
 
Example 9
Source Project: Orienteer   Source File: TabbedPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected WebMarkupContainer newLink(String linkId, final int index) {
	return new AjaxLink<Void>(linkId) {
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			setSelectedTab(index);
			target.add(TabbedPanel.this);
			onLinkClick(target);
		}

		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			String cssClass = tag.getAttribute("class");
			if (getSelectedTab() == index) {
				cssClass += " active";
			} else cssClass = "nav-link";
			tag.put("class", cssClass.trim());
		}
	};

}
 
Example 10
@SuppressWarnings("serial")
public ScriptEditPage(final PageParameters parameters)
{
  super(parameters, "scripting");
  init();
  if (StringUtils.isNotEmpty(form.getData().getScriptBackupAsString()) == true) {
    // Show backup script button:
    final AjaxLink<Void> showBackupScriptButton = new AjaxLink<Void>(ContentMenuEntryPanel.LINK_ID) {
      @Override
      public void onClick(final AjaxRequestTarget target)
      {
        form.showBackupScriptDialog.open(target);
      }
    };
    final ContentMenuEntryPanel menu = new ContentMenuEntryPanel(getNewContentMenuChildId(), showBackupScriptButton,
        getString("scripting.scriptBackup.show"));
    addContentMenuEntry(menu);
  }
}
 
Example 11
/**
 * @param id
 * @param type
 * @param tooltip
 */
@SuppressWarnings("serial")
public AjaxIconLinkPanel(final String id, final IconType type, final IModel<String> tooltip)
{
  super(id, type, tooltip);
  setLink(new AjaxLink<Void>(IconLinkPanel.LINK_ID) {
    /**
     * @see org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
     */
    @Override
    public void onClick(final AjaxRequestTarget target)
    {
      AjaxIconLinkPanel.this.onClick(target);
    }
  });
}
 
Example 12
Source Project: nextreports-server   Source File: WidgetPopupMenuModel.java    License: Apache License 2.0 6 votes vote down vote up
private AjaxLink createEmbedCodeLink(final IModel<Widget> model) {
	AjaxLink<Void> link = new AjaxLink<Void>(MenuPanel.LINK_ID) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			final Widget widget = model.getObject();
			ModalWindow dialog = findParent(BasePage.class).getDialog();

			dialog.setTitle(new StringResourceModel("WidgetPopupMenu.embeddedCode", null).getString());
			dialog.setInitialWidth(550);
			dialog.setUseInitialHeight(false);

			dialog.setContent(new WidgetEmbedCodePanel(dialog.getContentId(), widget.getId()));
			dialog.show(target);
		}
	};
	return link;
}
 
Example 13
Source Project: nextreports-server   Source File: AnalysisRuntimePanel.java    License: Apache License 2.0 6 votes vote down vote up
public AnalysisRuntimePanel(String id, ReportRuntimeModel model) {
	super(id);

	Label label = new Label("analysisLabel", getString("Analysis.run.name"));
	add(label);
	
	TextField<String> analysisText = new TextField<String>("analysisText", new PropertyModel(model, "analysisName"));    	
   	add(analysisText);
   	
   	AjaxLink analysisLink = new AjaxLink("analysisLink") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO Auto-generated method stub
			
		}
   		
   	}; 
   	add(analysisLink);
}
 
Example 14
Source Project: nextreports-server   Source File: AnalysisPanel.java    License: Apache License 2.0 6 votes vote down vote up
private AjaxLink<Analysis> getPaginateLink() {
 	return new ToolbarLink<Analysis>("paginate", "PaginatePanel.title", 200) {

@Override
protected FormContentPanel<Analysis> createPanel() {
	return new PaginatePanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	                		                	         		                	
              	ModalWindow.closeCurrent(target);	   
              	changeDataProvider(AnalysisPanel.this.getModel(), target);	                	
              }
          };
}			
 	};
 }
 
Example 15
Source Project: inception   Source File: AccessSpecificSettingsPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void setUpLocalSpecificSettings(WebMarkupContainer wmc)
{
    wmc.add(uploadForm("uploadForm", "uploadField"));

    // add link for clearing the knowledge base contents, enabled only, if there is
    // something to clear
    AjaxLink<Void> clearLink = clearLink("clear");
    wmc.add(clearLink);

    wmc.add(fileExtensionsExportList("exportButtons"));

    List<KnowledgeBaseProfile> localKBs = knowledgeBaseProfiles.values().stream()
        .filter(kb -> RepositoryType.LOCAL.equals(kb.getType()))
        .collect(Collectors.toList());

    listViewContainer = new WebMarkupContainer("listViewContainer");
    ListView<KnowledgeBaseProfile> suggestions = localSuggestionsList("localKBs", localKBs);
    listViewContainer.add(suggestions);
    listViewContainer.setOutputMarkupPlaceholderTag(true);

    LambdaAjaxLink addKbButton = new LambdaAjaxLink("addKbButton",
        this::actionDownloadKbAndSetIRIs);
    addKbButton.add(new Label("addKbLabel", new ResourceModel("kb.wizard.steps.local.addKb")));
    listViewContainer.add(addKbButton);

    infoContainerLocal = createKbInfoContainer("infoContainer");
    infoContainerLocal.setOutputMarkupId(true);
    wmc.add(infoContainerLocal);

    wmc.add(listViewContainer);
}
 
Example 16
Source Project: onedev   Source File: ProjectDependencyListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Project Dependency";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "project-dependency def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, dependencies.get(index));
				}
					
			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 17
Source Project: onedev   Source File: ParamSpecListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, SideFloating.Placement.RIGHT) {

				@Override
				protected String getTitle() {
					ParamSpec param = paramSpecs.get(index);
					return "Parameter Spec (type: " + EditableUtils.getDisplayName(param.getClass()) + ")";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "param-spec input-spec def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					Set<String> excludedProperties = Sets.newHashSet("canBeChangedBy", "nameOfEmptyValue");
					return BeanContext.view(id, paramSpecs.get(index), excludedProperties, true);
				}

			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 18
Source Project: onedev   Source File: JobServiceListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Service";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "job-service def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, services.get(index));
				}
					
			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 19
Source Project: onedev   Source File: JobReportListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, SideFloating.Placement.RIGHT) {

				@Override
				protected String getTitle() {
					JobReport report = reports.get(index);
					return "Report (type: " + EditableUtils.getDisplayName(report.getClass()) + ")";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "job-report def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, reports.get(index));
				}

			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 20
Source Project: onedev   Source File: JobDependencyListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Job Dependency";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "job-dependency def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, dependencies.get(index));
				}
					
			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 21
Source Project: onedev   Source File: JobPrivilegeListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Job Privilege";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "job-privilege def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, privileges.get(index));
				}
					
			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 22
Source Project: onedev   Source File: JobTriggerListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, SideFloating.Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Trigger (type: " + EditableUtils.getDisplayName(triggers.get(index).getClass()) + ")";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "job-trigger def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, triggers.get(index));
				}

			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 23
Source Project: onedev   Source File: ActionListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, SideFloating.Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Popst Build Action (type: " + EditableUtils.getDisplayName(actions.get(index).getClass()) + ")";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "post-build-action def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, actions.get(index));
				}

			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 24
Source Project: onedev   Source File: LocatorListViewPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	AjaxLink<Void> link = new AjaxLink<Void>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			new SideFloating(target, Placement.RIGHT) {

				@Override
				protected String getTitle() {
					return "Service Locator";
				}

				@Override
				protected void onInitialize() {
					super.onInitialize();
					add(AttributeAppender.append("class", "locator def-detail"));
				}

				@Override
				protected Component newBody(String id) {
					return BeanContext.view(id, locators.get(index), Sets.newHashSet("job"), true);
				}
					
			};
		}
		
	};
	link.add(newLabel("label"));
	add(link);
}
 
Example 25
Source Project: onedev   Source File: CloseablePanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(new Label("title", title));
	add(renderSubHeader("subHeader"));
	add(new AjaxLink<Void>("close") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			onClose(target);
		}
		
	});
	add(newFloatingContent("content"));
}
 
Example 26
Source Project: the-app   Source File: LoginModalPanel.java    License: Apache License 2.0 5 votes vote down vote up
private AjaxLink<Void> closeLink(String id) {
    return new AjaxLink<Void>(id) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            target.appendJavaScript(generateToggleScript());
        }
    };
}
 
Example 27
Source Project: openmeetings   Source File: EmailForm.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(status);
	add(new Label("subject"));
	add(new Label("recipients"));
	add(new Label("body").setEscapeModelStrings(false));
	add(new DateLabel("inserted"));
	add(new DateLabel("updated"));
	add(new Label("errorCount"));
	add(new Label("lastError"));
	add(reset = new BootstrapAjaxButton("reset", new ResourceModel("admin.email.reset.status"), Buttons.Type.Outline_Primary) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onSubmit(AjaxRequestTarget target) {
			emailDao.resetSendingStatus(EmailForm.this.getModelObject().getId());
			target.add(list);
		}
	});
	reset.setEnabled(false);
	// add a cancel button that can be used to submit the form via ajax
	delBtn = new AjaxLink<>("btn-delete") {
		private static final long serialVersionUID = 1L;

		public void onClick(AjaxRequestTarget target) {
			emailDao.delete(EmailForm.this.getModelObject().getId());
			EmailForm.this.setModelObject(new MailMessage());
			target.add(list, EmailForm.this);
		}
	};
	delBtn.add(newOkCancelDangerConfirm(this, getString("833")));
	add(delBtn.setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true).setVisible(false));
}
 
Example 28
Source Project: wicket-spring-boot   Source File: AbstractActionItemLink.java    License: Apache License 2.0 5 votes vote down vote up
public AbstractActionItemLink(IModel<T> label, IconType iconType){
	AjaxLink<T> link = new AjaxLink<T>("link") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			AbstractActionItemLink.this.onClick(target);
			
		}
	};
	add(link);
	WebMarkupContainer webMarkupContainer = new WebMarkupContainer("icon-type");
	webMarkupContainer.add(new AttributeAppender("class", "glyphicon glyphicon-" + iconType.getCssName()));
	link.add(webMarkupContainer);
}
 
Example 29
Source Project: sakai   Source File: BaseTreePage.java    License: Educational Community License v2.0 5 votes vote down vote up
protected AjaxLink getExpandCollapseLink(){
	//Expand Collapse Link:
	final Label expandCollapse = new Label("expandCollapse", new StringResourceModel("exapndNodes", null));
	expandCollapse.setOutputMarkupId(true);
	AjaxLink expandLink  = new AjaxLink("expandAll")
	{
		boolean expand = true;
		@Override
		public void onClick(AjaxRequestTarget target)
		{
			if(expand){
				getTree().getTreeState().expandAll();
				expandCollapse.setDefaultModel(new StringResourceModel("collapseNodes", null));
				collapseEmptyFolders();
			}else{
				getTree().getTreeState().collapseAll();
				expandCollapse.setDefaultModel(new StringResourceModel("exapndNodes", null));
			}
			target.add(expandCollapse);
			getTree().updateTree(target);
			expand = !expand;

		}
		@Override
		public boolean isVisible() {
			return getTree().getDefaultModelObject() != null;
		}
	};
	expandLink.add(expandCollapse);
	return expandLink;
}
 
Example 30
public LinkPanel(String id, final IModel labelModel) {
	super(id);
	AjaxLink link = new AjaxLink("link") {
		@Override
		public void onClick(AjaxRequestTarget target) {
			clicked(target);
		}
	};
	link.add(new Label("linkLabel", labelModel));
	add(link);
}