當前位置: 首頁>>代碼示例>>Java>>正文


Java Behavior類代碼示例

本文整理匯總了Java中org.apache.wicket.behavior.Behavior的典型用法代碼示例。如果您正苦於以下問題:Java Behavior類的具體用法?Java Behavior怎麽用?Java Behavior使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Behavior類屬於org.apache.wicket.behavior包,在下文中一共展示了Behavior類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initLayout

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
private void initLayout() {
    final TextField input = initTextField();

    input.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            //nothing to do, just update model data
        }
    });
    input.add(new Behavior() {

        @Override
        public void bind(Component component) {
            super.bind(component);

            component.add(AttributeModifier.replace("onkeydown",
                    Model.of("if(event.keyCode == 13) {event.preventDefault();}")));
        }
    });
    input.setOutputMarkupId(true);
    add(input);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:24,代碼來源:TextPopupPanel.java

示例2: decorate

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
private AbstractDynamicBookmarkableLink decorate(AbstractDynamicBookmarkableLink link) {
	if (linkBehaviorIfInvalid != null) {
		switch (linkBehaviorIfInvalid) {
		case HIDE:
			link.hideIfInvalid();
			break;
		case THROW_EXCEPTION:
			link.throwExceptionIfInvalid();
			break;
		}
	}
	for (Behavior linkBehavior : linkBehaviors) {
		link.add(linkBehavior);
	}
	return link;
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:17,代碼來源:CoreBootstrapBadgeColumn.java

示例3: getPanel

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
@Override
public WebMarkupContainer getPanel(final String containerId) {
    final Object modelValue = panelModel.getObject();
    final Panel panel = PanelFactory.get().getPanel(containerId, modelValue);
    final Boolean behaviorAdded = panel.getMetaData(KEY_DISABLED_BEHAVIOR_ADDED);
    if (behaviorAdded == null || !behaviorAdded) {
        panel.setMetaData(KEY_DISABLED_BEHAVIOR_ADDED, true);
        panel.add(new Behavior() {
            @Override
            public void onConfigure(final Component component) {
                super.onConfigure(component);
                component.setEnabled(ModelTab.this.isEnabled());
            }
        });
    } else {
        throw new IllegalStateException(
                "KEY_DISABLED_BEHAVIOR_ADDED not expected, since panels are normally not cached!");
    }
    return panel;
}
 
開發者ID:subes,項目名稱:invesdwin-nowicket,代碼行數:21,代碼來源:ModelTab.java

示例4: bind

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
@Override
public void bind(Component component) {
    if (getTargetId() == null) {
        // If we have a titled border behavior, than place the disabled-addon icon within the border title
        for (Behavior b : component.getBehaviors()) {
            if (b instanceof TitledBorderBehavior) {
                if (!isEnabled()) {
                    component.remove(b);
                }
                setTargetId(component.getMarkupId() + "-border-icon");
                ((TitledBorderBehavior) b).setCssClass("disabled-addon");
            }
        }
    }
    super.bind(component);
}
 
開發者ID:alancnet,項目名稱:artifactory,代碼行數:17,代碼來源:DisabledAddonBehavior.java

示例5: getScrollBehaviour

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
private Behavior getScrollBehaviour(){
	return new AttributeModifier("onscroll", Model.of(this.getMarkupId())){
		private static final long serialVersionUID = 3523727356782417598L;

		@Override
		public void renderHead(Component component, IHeaderResponse response) {
			super.renderHead(component, response);

			response.render(OnDomReadyHeaderItem.forScript("InfiniteScroll.getFromContainer('"+getMarkupId()+"').setUrls('"+upBehavior.getCallbackUrl()+"', '"+downBehavior.getCallbackUrl()+"')"));
		}
		
		@Override
		protected String newValue(String currentValue, String replacementValue) {
			return "InfiniteScroll.handleScroll('"+InfiniteScrollListView.this.getMarkupId()+"')"; 
		}
	};
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:18,代碼來源:InfiniteScrollListView.java

示例6: testDatepickerInvokeSpecialDates

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
@Test
public void testDatepickerInvokeSpecialDates() {
	final List<SpecialDate> list = Arrays.asList(new SpecialDate(christmas, "holiday", "Christmas"));

	BootstrapDatepicker picker = new BootstrapDatepicker("picker") {
		private static final long serialVersionUID = 1L;

		@Override
		public Collection<SpecialDate> getSpecialDates() {
			return list;
		}
	};

	List<? extends Behavior> behaviors = picker.getBehaviors();
	assertEquals(1, behaviors.size());
	assertTrue(behaviors.get(0) instanceof BootstrapDatePickerBehaviour);
	assertEquals(list, ((BootstrapDatePickerBehaviour)behaviors.get(0)).getSpecialDates());
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:19,代碼來源:BootstrapDatepickerTest.java

示例7: onInitialize

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();

	if(pageClass!=null){
		AbstractLink link = new BookmarkablePageLink<WebPage>("link", pageClass);
	
		add(link);
	}
	
	add(new Behavior() {
		@Override
		public void onComponentTag(Component component, ComponentTag tag) {
			super.onComponentTag(component, tag);
			if(isActive()) tag.append("class", "active", " ");
		}
	});
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-archetype,代碼行數:19,代碼來源:TemplatePage.java

示例8: SynchronizerHelper

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
public SynchronizerHelper(DMDWebGenPageContext context, String wicketId, String propertyName, boolean enableThoughUnmodifiable) {
	this.context = context;
	this.enableThoughUnmodifiable = enableThoughUnmodifiable;
	context.getPage().add(new Behavior() {
		private static final long serialVersionUID = 1L;
		@Override
		public void afterRender(Component component) {
			super.afterRender(component);
			// domainreference needs to be reset on ajax updates
			ref = null;
		}
	});
	this.wicketId = wicketId;
	this.propertyName = propertyName;
	saveAsPrototype();
}
 
開發者ID:Nocket,項目名稱:nocket,代碼行數:17,代碼來源:SynchronizerHelper.java

示例9: makeListView

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
private ListView<ProcessedGradeItem> makeListView(String componentName, List<ProcessedGradeItem> itemList) {
    return new ListView<ProcessedGradeItem>(componentName, itemList) {
        /**
         * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem)
         */
        @Override
        protected void populateItem(ListItem<ProcessedGradeItem> item) {
            item.add(new Label("itemTitle", new PropertyModel<String>(item.getDefaultModel(), "itemTitle")));

            PropertyModel<String> commentLabelProp = new PropertyModel<String>(item.getDefaultModel(), "commentLabel");
            final String commentLabel = commentLabelProp.getObject();

            item.add(new Behavior() {
                @Override
                public void afterRender(Component component) {
                    super.afterRender(component);
                    if(commentLabel != null){
                        component.getResponse().write(
                            "<tr class=\"comment\"><td class=\"item_title\"><span>" + commentLabel + "</span></td></tr>"
                        );
                    }
                }
            });
        }
    };
}
 
開發者ID:steveswinsburg,項目名稱:gradebookNG,代碼行數:27,代碼來源:GradeImportConfirmationStep.java

示例10: testInitialization

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
@Test
public void testInitialization() {
	TestGroup tg = new TestGroup("test", null);
	tg.init("prop", tg, true, String.class, null);
	startTest(tg);

	replayAll();

	verifyAll();

	getTester().assertComponent(tg.getPageRelativePath(), TestGroup.class);
	getTester().assertComponent(tg.field.getPageRelativePath(), TextField.class);
	getTester().assertComponent(tg.box.getPageRelativePath(), WebMarkupContainer.class);
	getTester().assertRequired(tg.field.getPageRelativePath());
	assertEquals("prop", tg.field.getLabel().getObject());

	List<? extends Behavior> behaviors = tg.field.getBehaviors();
	assertEquals(1, behaviors.size());
	assertTrue(behaviors.get(0) instanceof ValidatorAdapter);
	assertTrue(((ValidatorAdapter<?>)behaviors.get(0)).getValidator() instanceof HibernateValidatorProperty);
}
 
開發者ID:premium-minds,項目名稱:wicket-crudifier,代碼行數:22,代碼來源:AbstractControlGroupTest.java

示例11: markLastVisibleChild

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
public static void markLastVisibleChild(WebMarkupContainer container) {
	Component lastVisible = null;
	for (Component child: container) {
		for (Behavior behavior: child.getBehaviors()) {
			if (behavior instanceof LastVisibleAppender) {
				child.remove(behavior);
			}
		}
		child.configure();
		if (child.isVisible())
			lastVisible = child;
	}
	if (lastVisible != null)
		lastVisible.add(new LastVisibleAppender("class", "last-visible").setSeparator(" "));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:16,代碼來源:WicketUtils.java

示例12: stopRefreshing

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
public void stopRefreshing(Refreshable refreshable, AjaxRequestTarget target) {
	Component refreshingBehaviorParent = refreshable.getRefreshingBehaviorParent();
	for (Behavior behavior : refreshingBehaviorParent.getBehaviors()) {
		if (behavior instanceof RemovableAjaxTimerBehavior) {
			((RemovableAjaxTimerBehavior) behavior).remove(target);
		}
	}
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:9,代碼來源:AutoRefreshPanel.java

示例13: visibleIfFalse

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
public static Behavior visibleIfFalse(final NonEmptyModel<Boolean> model) {
	return new VisibleEnableBehaviour() {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {
			return !model.getObject();
		}
	};
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:11,代碼來源:WebComponentUtil.java

示例14: enabledIfFalse

import org.apache.wicket.behavior.Behavior; //導入依賴的package包/類
public static Behavior enabledIfFalse(final NonEmptyModel<Boolean> model) {
	return new VisibleEnableBehaviour() {
		private static final long serialVersionUID = 1L;
		
		@Override
		public boolean isEnabled() {
			return !model.getObject();
		}
	};
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:11,代碼來源:WebComponentUtil.java

示例15: createTitleToggler

import org.apache.wicket.behavior.Behavior; //導入依賴的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


注:本文中的org.apache.wicket.behavior.Behavior類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。