org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink Java Examples

The following examples show how to use org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink. 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 File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private AjaxSubmitLink getSaveLink() {
 	return new AjaxSubmitLink("save") {

 		@Override
 		public void onSubmit(AjaxRequestTarget target, Form form) {
 			Analysis analysis = AnalysisPanel.this.getModel().getObject();	    			
 			analysisService.modifyAnalysis(analysis);
 			getSession().getFeedbackMessages().add(new FeedbackMessage(null, new StringResourceModel("Analysis.saved", null, new Object[] {analysis.getName()}).getString(), JGrowlAjaxBehavior.INFO_FADE));
 			setResponsePage(HomePage.class);
 		}
 		
 		@Override
public boolean isVisible() {				
 			if (dataProvider.isEmpty()) {
 				return false;
 			}
 			if (!SecurityUtil.hasPermission(securityService, PermissionUtil.getWrite(), getModelObject().getId())) {
 				return false;
 			}
 			return true;
}	
 		
 	};
 }
 
Example #2
Source File: LoginModalPanel.java    From the-app with Apache License 2.0 5 votes vote down vote up
private Component loginForm() {
    Form<Void> form = new Form<>("loginForm");
    LoginPanel loginPanel = loginPanel();
    form.add(loginPanel);

    AjaxSubmitLink submitLink = submitLink(loginPanel);
    form.add(submitLink);
    form.setDefaultButton(submitLink);
    form.add(closeLink("close"));
    return form;
}
 
Example #3
Source File: LoginModalPanel.java    From AppStash with Apache License 2.0 5 votes vote down vote up
private Component loginForm() {
    Form<Void> form = new Form<>("loginForm");
    LoginPanel loginPanel = loginPanel();
    form.add(loginPanel);

    AjaxSubmitLink submitLink = submitLink(loginPanel);
    form.add(submitLink);
    form.setDefaultButton(submitLink);
    form.add(closeLink("close"));
    return form;
}
 
Example #4
Source File: JEXLTransformersTogglePanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public JEXLTransformersTogglePanel(final WebMarkupContainer container, final PageReference pageRef) {
    super(Constants.OUTER, "jexlTransformersTogglePanel", pageRef);

    Form<?> form = new Form<>("form");
    addInnerObject(form);

    propagationJEXLTransformer = new AjaxTextFieldPanel(
            "propagationJEXLTransformer",
            "Propagation",
            Model.of(""));
    form.add(propagationJEXLTransformer.enableJexlHelp("value.toLowecase()", "'PREFIX' + value"));

    pullJEXLTransformer = new AjaxTextFieldPanel(
            "pullJEXLTransformer",
            "Pull",
            Model.of(""));
    form.add(pullJEXLTransformer.enableJexlHelp("value.toLowecase()", "'PREFIX' + value"));

    form.add(new AjaxSubmitLink("submit", form) {

        private static final long serialVersionUID = 4617041491286858973L;

        @Override
        public void onSubmit(final AjaxRequestTarget target) {
            toggle(target, false);
            target.add(container);
        }
    });
}
 
Example #5
Source File: AjaxFormCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected AbstractLink newLink(String id) {
	AjaxSubmitLink link =  new AjaxSubmitLink(id)
	{

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		protected void onSubmit(AjaxRequestTarget target) {
			AjaxFormCommand.this.onSubmit(target);
			trySendActionPerformed();
		}
		
	};
	if(defaultFormProcessing!=null) link.setDefaultFormProcessing(defaultFormProcessing);
	return link;
	/*return new AjaxFallbackLink<Object>(id)
	        {
				@Override
				public void onClick(AjaxRequestTarget target) {
					AjaxCommand.this.onClick(target);
				}
	        };*/
}
 
Example #6
Source File: AjaxFormCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public AjaxFormCommand<T> setDefaultFormProcessing(boolean defaultFormProcessing) {
	if(getLink()!=null) {
		((AjaxSubmitLink)getLink()).setDefaultFormProcessing(defaultFormProcessing);
	} 
	this.defaultFormProcessing = defaultFormProcessing;
	return this;
}
 
Example #7
Source File: GroupPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public GroupPanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);
	
	groups = new LinkedList<String>(model.getObject().getGroups());		
	
	groupObject = model.getObject().getColumns().get(0);		
	
	ContextImage urlImage = new ContextImage("infoImage","images/information.png");        
       urlImage.add(new SimpleTooltipBehavior(AnalysisUtil.getAnalysisInfo(model.getObject(), 5, storageService.getSettings())));
       add(urlImage);
	
	add(new Label("column", new StringResourceModel("GroupPanel.column", null, null)));
	columnChoice = new DropDownChoice<String>("columnChoice", 
				new PropertyModel<String>(this, "groupObject"), model.getObject().getSimpleColumns());
	columnChoice.setOutputMarkupPlaceholderTag(true);
	columnChoice.setRequired(true);
		add(columnChoice); 
			
		AjaxSubmitLink addLink = new AjaxSubmitLink("addLink") {						
			@Override
			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
				if (editIndex != -1) {
					int index = groups.indexOf(groupObject); 					
					if ( (index != -1) && (index != editIndex) ) {
						error(getString("GroupPanel.duplicateGroup"));	    
            		target.add(getFeedbackPanel());
        			return;
					} 					
					groups.set(editIndex, groupObject); 					 	
					resetEdit(target);
				} else {
 				if (groups.contains(groupObject)) {
 					error(getString("GroupPanel.duplicateGroup"));	    
            		target.add(getFeedbackPanel());
        			return;
 				}
 				groups.add(groupObject);	 				
 			}
				target.add(table);
				target.add(getFeedbackPanel());
			} 
			
	    };
	    
	    addTextModel = Model.of(""); 	    
	    label = new Label("addMessage", addTextModel);
	    label.setOutputMarkupPlaceholderTag(true);
	    addLink.add(label);
	    add(addLink);
		
		addTable();
	
}
 
Example #8
Source File: SortPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public SortPanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);				
	
	sortProperty = new ArrayList<String>(model.getObject().getSortProperty());		
	ascending = new ArrayList<Boolean>(model.getObject().getAscending());
	
	sortObject = new SortObject();
	sortObject.setColumn(model.getObject().getSimpleColumns().get(0));
	sortObject.setOrder(Boolean.TRUE);		
	
	ContextImage urlImage = new ContextImage("infoImage","images/information.png");        
       urlImage.add(new SimpleTooltipBehavior(AnalysisUtil.getAnalysisInfo(model.getObject(), 5, storageService.getSettings())));
       add(urlImage);
	
	add(new Label("column", new StringResourceModel("SortPanel.column", null, null)));
	columnChoice = new DropDownChoice<String>("columnChoice", 
				new PropertyModel<String>(this, "sortObject.column"), model.getObject().getSimpleColumns(),
				new ChoiceRenderer<String>() {
				@Override
				public Object getDisplayValue(String fullColumnName) {
					return DatabaseUtil.getColumnAlias(fullColumnName);
				}
	});
	columnChoice.setOutputMarkupPlaceholderTag(true);
	columnChoice.setRequired(true);
		add(columnChoice); 
	
	add(new Label("order", new StringResourceModel("SortPanel.order", null, null)));  
	orderChoice = new DropDownChoice<Boolean>("orderChoice", 
				new PropertyModel<Boolean>(this, "sortObject.order"), Arrays.asList(Boolean.TRUE, Boolean.FALSE));
	orderChoice.setOutputMarkupPlaceholderTag(true);
	orderChoice.setRequired(true);
		add(orderChoice); 
		
		AjaxSubmitLink addLink = new AjaxSubmitLink("addLink") {						
			@Override
			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
				if (editIndex != -1) {
					int index = sortProperty.indexOf(sortObject.getColumn()); 					
					if ( (index != -1) && (index != editIndex) ) {
						error(getString("SortPanel.duplicateColumn"));	    
            		target.add(getFeedbackPanel());
        			return;
					}
					if (editIndex == 0)  {
						if (sortProperty.get(editIndex).equals(sortObject.getColumn())) {
							changeFirstSortOrder = true;
						} else {
							firstSortRemoved = true;
						}
					}
					sortProperty.set(editIndex, sortObject.getColumn());
					ascending.set(editIndex, sortObject.getOrder()); 	
					resetEdit(target);
				} else {
 				if (sortProperty.contains(sortObject.getColumn())) {
 					error(getString("SortPanel.duplicateColumn"));	    
            		target.add(getFeedbackPanel());
        			return;
 				}
 				sortProperty.add(sortObject.getColumn());
 				ascending.add(sortObject.getOrder());
 			}
				target.add(table);
				target.add(getFeedbackPanel());
			} 
			
	    };
	    
	    addTextModel = Model.of(""); 	    
	    label = new Label("addMessage", addTextModel);
	    label.setOutputMarkupPlaceholderTag(true);
	    addLink.add(label);
	    add(addLink);
		
		addTable();
	
}
 
Example #9
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private AjaxSubmitLink getFreezeLink() {
 	return new AjaxSubmitLink("freeze") {

 		@Override
 		public void onSubmit(AjaxRequestTarget target, Form form) {
 			Analysis analysis = AnalysisPanel.this.getModel().getObject();    			
 			
 			Analysis newAnalysis = ObjectCloner.silenceDeepCopy(analysis);
 			newAnalysis.setName(analysis.getName() + " " + UUID.randomUUID());
 			newAnalysis.setFreezed(true);
 			String addedId = analysisService.addAnalysis(newAnalysis);    	
 			
 			AnalysisPanel.this.getModel().setObject(newAnalysis);
 			
 			AnalysisBrowserPanel browserPanel = findParent(AnalysisBrowserPanel.class);
	SectionContext sectionContext = NextServerSession.get().getSectionContext(AnalysisSection.ID);
	sectionContext.getData().put(SectionContextConstants.SELECTED_ANALYSIS_ID, addedId);
	browserPanel.getAnalysisPanel().changeDataProvider(new SelectedAnalysisModel(), target);							
	target.add(browserPanel);				
 			    		
 			getSession().getFeedbackMessages().add(new FeedbackMessage(null, getString("freeze.start"), JGrowlAjaxBehavior.INFO_FADE));    			
 	        setResponsePage(HomePage.class);    	            	        
 	        
 	        analysisService.freeze(newAnalysis);
 		}
 		
 		@Override
public boolean isVisible() {				
	if (dataProvider.isEmpty() || AnalysisPanel.this.getModel().getObject().isFreezed()) {
		return false;
	}
	if (!SecurityUtil.hasPermission(securityService, PermissionUtil.getWrite(), getModelObject().getId())) {
 				return false;
 			}
 			return true;
}	 
 		
 		@Override
 		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
 		    super.updateAjaxAttributes(attributes);
 		    attributes.getAjaxCallListeners().add(new AjaxCallListener() {
 		        @Override
 		        public CharSequence getBeforeHandler(Component cmpnt) {
 		            return "$(\"#" + cmpnt.getMarkupId() + "\").hide()";    		        	
 		        }
 		    });   
 		}
 		
 	};
 }
 
Example #10
Source File: FormPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public AjaxSubmitLink getOkButton() {
	return okButton;
}
 
Example #11
Source File: FormPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public AjaxSubmitLink getApplyButton() {
	return applyButton;
}