当前位置: 首页>>代码示例>>Java>>正文


Java AjaxFallbackLink.add方法代码示例

本文整理汇总了Java中org.apache.wicket.ajax.markup.html.AjaxFallbackLink.add方法的典型用法代码示例。如果您正苦于以下问题:Java AjaxFallbackLink.add方法的具体用法?Java AjaxFallbackLink.add怎么用?Java AjaxFallbackLink.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.ajax.markup.html.AjaxFallbackLink的用法示例。


在下文中一共展示了AjaxFallbackLink.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTitleToggler

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
private void createTitleToggler() {
    // title is also a link that toggles expansion state
    final AjaxFallbackLink titleLink = new IndicatingAjaxFallbackLink("titleToggle") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            final ExpansionState expansionState = expansionModel.getObject();
            if (expansionState == ExpansionState.COLLAPSED) {
                expansionModel.setObject(ExpansionState.EXPANDED);
            } else {
                expansionModel.setObject(ExpansionState.COLLAPSED);
            }
            if (target != null) {
                target.add(ExpandablePanel.this);
            }
        }
    };

    // Facet name becomes title
    titleLink.add(createTitleLabel("title"));
    titleLink.add(new AttributeModifier("aria-controls", ExpandablePanel.this.getMarkupId()));

    titleLink.add(new WebMarkupContainer("expand"));
    titleLink.add(new WebMarkupContainer("collapse"));
    titleLink.add(new Behavior() {
        @Override
        public void onConfigure(Component component) {
            final boolean expanded = expansionModel.getObject().equals(ExpansionState.EXPANDED);
            component.get("expand").setVisible(!expanded);
            component.get("collapse").setVisible(expanded);
        }

    });

    add(titleLink);
}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:37,代码来源:ExpandablePanel.java

示例2: addEditButton

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
private void addEditButton(final String id, final UserProfile userProfile) {
	AjaxFallbackLink editButton = new AjaxFallbackLink("editButton",
			new ResourceModel("button.edit")) {

		private static final long serialVersionUID = 1L;

		public void onClick(AjaxRequestTarget target) {
			Component newPanel = new MyBusinessEdit(id, userProfile);
			newPanel.setOutputMarkupId(true);
			MyBusinessDisplay.this.replaceWith(newPanel);
			if (target != null) {
				target.add(newPanel);
				// resize iframe
				target.appendJavaScript("setMainFrameHeight(window.name);");
			}

		}

	};
	editButton.add(new Label("editButtonLabel", new ResourceModel(
			"button.edit")));
	editButton.setOutputMarkupId(true);

	if (userProfile.isLocked() && !sakaiProxy.isSuperUser()) {
		editButton.setVisible(false);
	}

	add(editButton);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:MyBusinessDisplay.java

示例3: IconWithClueTip

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
public IconWithClueTip(String id, String iconUrl, IModel textModel) {
	super(id);
		
	//tooltip text
	Label text = new Label("text", textModel);
	text.setOutputMarkupId(true);
	add(text);
	
	//we need to id of the text span so that we can map it to the link.
	//the cluetip functions automatically hide it for us.
	StringBuilder textId = new StringBuilder();
	textId.append("#");
	textId.append(text.getMarkupId());
	
	//link
	AjaxFallbackLink link = new AjaxFallbackLink("link") {
		public void onClick(AjaxRequestTarget target) {
			//nothing
		}
	};
	link.add(new AttributeModifier("rel", true, new Model(textId)));
	link.add(new AttributeModifier("href", true, new Model(textId)));
	
	//image
	ContextImage image = new ContextImage("icon",new Model(iconUrl));
	link.add(image);
	
	add(link);

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:31,代码来源:IconWithClueTip.java

示例4: MyStudentDisplay

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
public MyStudentDisplay(final String id, final UserProfile userProfile) {
	
	super(id);
	
	//heading
	add(new Label("heading", new ResourceModel("heading.student")));
	
	String course = userProfile.getCourse();
	String subjects = userProfile.getSubjects();
	
	int visibleFieldCount = 0;
	
	//course
	WebMarkupContainer courseContainer = new WebMarkupContainer("courseContainer");
	courseContainer.add(new Label("courseLabel", new ResourceModel("profile.course")));
	courseContainer.add(new Label("course", course));
	add(courseContainer);
	if(StringUtils.isBlank(course)) {
		courseContainer.setVisible(false);
	} else {
		visibleFieldCount++;
	}
	
	//subjects
	WebMarkupContainer subjectsContainer = new WebMarkupContainer("subjectsContainer");
	subjectsContainer.add(new Label("subjectsLabel", new ResourceModel("profile.subjects")));
	subjectsContainer.add(new Label("subjects", subjects));
	add(subjectsContainer);
	if(StringUtils.isBlank(subjects)) {
		subjectsContainer.setVisible(false);
	} else {
		visibleFieldCount++;
	}

	//edit button
	AjaxFallbackLink editButton = new AjaxFallbackLink("editButton", new ResourceModel("button.edit")) {
		
		private static final long serialVersionUID = 1L;

		public void onClick(AjaxRequestTarget target) {
			Component newPanel = new MyStudentEdit(id, userProfile);
			newPanel.setOutputMarkupId(true);
			MyStudentDisplay.this.replaceWith(newPanel);
			if(target != null) {
				target.add(newPanel);
				//resize iframe
				target.appendJavaScript("setMainFrameHeight(window.name);");
			}
			
		}
					
	};
	editButton.add(new Label("editButtonLabel", new ResourceModel("button.edit")));
	editButton.setOutputMarkupId(true);
	
	if(userProfile.isLocked() && !sakaiProxy.isSuperUser()) {
		editButton.setVisible(false);
	}
	
	add(editButton);
	
	//no fields message
	Label noFieldsMessage = new Label("noFieldsMessage", new ResourceModel("text.no.fields"));
	add(noFieldsMessage);
	if(visibleFieldCount > 0) {
		noFieldsMessage.setVisible(false);
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:69,代码来源:MyStudentDisplay.java

示例5: OnlinePresenceIndicator

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
public OnlinePresenceIndicator(String id, String userUuid) {
	super(id);
	
	//get user's firstname
	String firstname = sakaiProxy.getUserFirstName(userUuid);
	if(StringUtils.isBlank(firstname)){
		firstname = new StringResourceModel("profile.name.first.none", null).getString();
	}
	
	//get user's online status
	int status = connectionsLogic.getOnlineStatus(userUuid);
	
	//get the mapping
	Map<String,String> m = mapStatus(status);
	
	//tooltip text
	Label text = new Label("text", new StringResourceModel(m.get("text"), null, new Object[]{ firstname } ));
	text.setOutputMarkupId(true);
	add(text);
	
	//we need to id of the text span so that we can map it to the link.
	//the cluetip functions automatically hide it for us.
	StringBuilder textId = new StringBuilder();
	textId.append("#");
	textId.append(text.getMarkupId());
	
	//link
	AjaxFallbackLink link = new AjaxFallbackLink("link") {
		public void onClick(AjaxRequestTarget target) {
			//nothing
		}
	};
	link.add(new AttributeModifier("rel", true, new Model(textId)));
	link.add(new AttributeModifier("href", true, new Model(textId)));
	
	//image
	ContextImage image = new ContextImage("icon",new Model(m.get("url")));
	link.add(image);
	
	add(link);

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:43,代码来源:OnlinePresenceIndicator.java

示例6: CloseButton

import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; //导入方法依赖的package包/类
public CloseButton(String id, final Component parent) {
	super(id);
		
	//container
	WebMarkupContainer closeButton = new WebMarkupContainer("closeButton");
	closeButton.setOutputMarkupId(true);
	
	//image
	ContextImage image = new ContextImage("img",new Model(ProfileConstants.CLOSE_IMAGE));
	image.add(new AttributeModifier("alt",""));
	
	AjaxFallbackLink link = new AjaxFallbackLink("link") {
		public void onClick(AjaxRequestTarget target) {
			if(target != null) {
				
				target.appendJavaScript("$('#" + parent.getMarkupId() + "').slideUp();");
				target.appendJavaScript("setMainFrameHeight(window.name);");

				//do we also need to remove the component as well?
				
			}
		}
					
	};
	
	
	link.add(image);
	
	closeButton.add(link);
	
	add(closeButton);
	
	

	

	
	//extend this to allow a behaviour to be set so that when its clicked, something happens
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:40,代码来源:CloseButton.java


注:本文中的org.apache.wicket.ajax.markup.html.AjaxFallbackLink.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。