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


Java AttributeAppender類代碼示例

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


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

示例1: newSuggestionItem

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
private Component newSuggestionItem(String itemId, InputCompletion suggestion) {
	WebMarkupContainer item = new WebMarkupContainer(itemId);
	WebMarkupContainer link = new WebMarkupContainer("link");
	Range matchRange = suggestion.getMatchRange();
	String label = suggestion.getLabel();
	if (matchRange != null) {
		String prefix = StringEscapeUtils.escapeHtml4(label.substring(0, matchRange.getFrom()));
		String suffix = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getTo()));
		String matched = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getFrom(), matchRange.getTo()));
		link.add(new Label("label", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
	} else {
		link.add(new Label("label", label));
	}
	item.add(link);
	if (suggestion.getDescription() != null)
		item.add(new Label("description", suggestion.getDescription()));
	else
		item.add(new Label("description").setVisible(false));
	item.add(AttributeAppender.append("data-content", suggestion.complete(inputStatus).getContent()));
	item.add(AttributeAppender.append("data-caret", suggestion.getCaret()));
	item.setOutputMarkupId(true);
	return item;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:24,代碼來源:AssistPanel.java

示例2: onInitialize

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

	add(new INullAcceptingValidator<T>() {

		@Override
		public void validate(IValidatable<T> validatable) {
			Validator validator = AppLoader.getInstance(Validator.class);
			Set<?> violations = validator.validateValue(
					propertyDescriptor.getBeanClass(), 
					propertyDescriptor.getPropertyName(), 
					validatable.getValue());
			
			for (Object each: violations) {
				ConstraintViolation<?> violation = (ConstraintViolation<?>) each;
				addError(violation.getMessage());
			}
		}
		
	});
	
	add(new AttributeAppender("class", " property editor editable"));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:25,代碼來源:PropertyEditor.java

示例3: onInitialize

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();
	
	input = new TextField<Number>("input", Model.of(getModelObject()));
	input.setType(getPropertyDescriptor().getPropertyClass());
	add(input);

	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:21,代碼來源:NumericPropertyEditor.java

示例4: onInitialize

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			BlobIdent blobIdent = (BlobIdent) getDefaultModelObject();
			if (blobIdent.isTree())
				return " fa fa-folder-o";
			else if (blobIdent.isGitLink()) 
				return " fa fa-ext fa-folder-submodule-o";
			else if (blobIdent.isSymbolLink()) 
				return " fa fa-ext fa-folder-symbol-link-o";
			else  
				return " fa fa-file-text-o";
		}
		
	}));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:22,代碼來源:BlobIcon.java

示例5: onInitialize

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(input = new CheckBox("input", Model.of(getModelObject())));

	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
	
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:20,代碼來源:BooleanPropertyEditor.java

示例6: onInitialize

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new ListView<PropertyContext<Serializable>>("properties", propertyContexts) {

		@Override
		protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
			PropertyContext<Serializable> propertyContext = item.getModelObject();
			Method propertyGetter = propertyContext.getPropertyGetter();
			Label nameLabel = new Label("name", EditableUtils.getName(propertyGetter));
			item.add(nameLabel);
			OmitName omitName = propertyGetter.getAnnotation(OmitName.class);

			if (omitName != null && omitName.value() != OmitName.Place.EDITOR) {
				nameLabel.setVisible(false);
				item.add(AttributeAppender.append("class", "name-omitted"));
			}

			Serializable bean = (Serializable) ReflectionBeanViewer.this.getDefaultModelObject();
			Serializable propertyValue = (Serializable) propertyContext.getPropertyValue(bean);
			item.add(propertyContext.renderForView("value", Model.of(propertyValue)));
		}

	});
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:27,代碼來源:ReflectionBeanViewer.java

示例7: onInitialize

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

	add(new IValidator<T>() {

		@Override
		public void validate(IValidatable<T> validatable) {
			Validator validator = AppLoader.getInstance(Validator.class);
			for (ConstraintViolation<T> violation: validator.validate(validatable.getValue())) {
				ValuePath valuePath = new ValuePath(violation.getPropertyPath());
				if (!valuePath.getElements().isEmpty()) {
					PathSegment.Property property = (Property) valuePath.getElements().iterator().next();
					if (!propertyNames.contains(property.getName()))
						continue;
				}
				ErrorContext errorContext = getErrorContext(valuePath);
				errorContext.addError(violation.getMessage());
			}
		}
		
	});
	
	add(AttributeAppender.append("class", " bean editor editable"));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:26,代碼來源:BeanEditor.java

示例8: onInitialize

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
@Override
protected void onInitialize() {
	super.onInitialize();
	
	input = new PasswordTextField("input", Model.of(getModelObject()));
	input.setRequired(false);
	input.setResetPassword(false);
	add(input);

	String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
	if (autocomplete != null)
		input.add(AttributeAppender.append("autocomplete", autocomplete));
	
	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:26,代碼來源:PasswordPropertyEditor.java

示例9: newSinceChangesRow

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
private Component newSinceChangesRow(String id, Date sinceDate) {
	WebMarkupContainer row = new WebMarkupContainer(id);
	row.setOutputMarkupId(true);
	row.add(AttributeAppender.append("class", " non-discussion"));
	
	WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
	avatarColumn.add(new WebMarkupContainer("avatar"));
	row.add(avatarColumn);
	
	WebMarkupContainer contentColumn = new Fragment("content", "sinceChangesRowContentFrag", this);
	contentColumn.add(new SinceChangesLink("sinceChanges", requestModel, sinceDate));
	row.add(contentColumn);
	
	row.add(AttributeAppender.append("class", "since-changes"));
	
	return row;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:18,代碼來源:RequestOverviewPage.java

示例10: onInitialize

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

	add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (anyMessage(FeedbackMessage.ERROR) || anyMessage(FeedbackMessage.FATAL))
				return " error";
			else if (anyMessage(FeedbackMessage.WARNING))
				return " warning";
			else if (anyMessage(FeedbackMessage.SUCCESS))
				return " success";
			else
				return " info";
		}
		
	}));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:21,代碼來源:SessionFeedbackPanel.java

示例11: loadNavbar

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
/**
 * generates the navbar and mark the active page
 *
 * @param activePage page to be marked active (null for no active page)
 */
private void loadNavbar(final PageType activePage) {
    // add an entry for each page type
    add(new ListView<PageType>("navbar_left_elements", Arrays.asList(PageType.values())) {
        @Override
        protected void populateItem(final ListItem<PageType> item) {
            final PageType type = item.getModelObject();
            // create a link for the page type
            BookmarkablePageLink<String> link = new BookmarkablePageLink<>("navbar_left_element_link", type.getPageClass());
            link.add(new Label("navbar_left_element_text", type.getLinkText()));
            // if the type is same as active page, mark it as active
            if (type.equals(activePage)) link.add(new AttributeAppender("class", "active", " "));
            item.add(link);
        }
    });

    // create the summoner search region drop down menu
    // get all valid entries
    List<String> endpoints = Arrays.asList(RiotEndpoint.PLAYABLE_ENDPOINTS)
            .stream().map(RiotEndpoint::name).collect(Collectors.toList());
    // add the options to the drop down menu
    DropDownChoice<String> dropDownChoice = new DropDownChoice<>("navbar_form_regions_select",
            new PropertyModel<>(this, "selectedRegion"), endpoints, new StringChoiceRenderer());
    dropDownChoice.add(new AttributeModifier("name", "region"));
    add(dropDownChoice);
}
 
開發者ID:LogicalOverflow,項目名稱:MasterStats,代碼行數:31,代碼來源:BasePage.java

示例12: initLayout

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
private void initLayout(IModel<String> label, String labelSize, String textSize, boolean required) {
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);

    WebMarkupContainer dateWrapper = new WebMarkupContainer(ID_DATE_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        dateWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(dateWrapper);

    DateInput date = new DateInput(ID_DATE, new XmlGregorianCalendarModel(getModel()));
    date.setRequired(required);
    date.setLabel(label);
    dateWrapper.add(date);

    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(date));
    dateWrapper.add(feedback);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:22,代碼來源:DateFormGroup.java

示例13: initLayout

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
private void initLayout(){
    AjaxButton button = new AjaxButton(ID_BUTTON, createButtonStringResource(getCaption())) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            clickPerformed(target, SingleButtonPanel.this.getModel());
        }

        @Override
        public boolean isEnabled(){
            return SingleButtonPanel.this.isEnabled(SingleButtonPanel.this.getModel());
        }

        @Override
        public boolean isVisible() {
            return SingleButtonPanel.this.isVisible(SingleButtonPanel.this.getModel());
        }
    };
    button.add(new AttributeAppender("class", getButtonCssClass()));

    add(button);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:23,代碼來源:SingleButtonPanel.java

示例14: BootstrapLabel

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
public BootstrapLabel(String id, IModel<String> model, final IModel<State> state) {
    super(id, model);

    add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            StringBuilder sb = new StringBuilder();
            sb.append("label label-");

            State s = state.getObject();
            if (s == null) {
                s = State.DEFAULT;
            }
            sb.append(s.name().toLowerCase());

            return sb.toString();
        }
    }));
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:21,代碼來源:BootstrapLabel.java

示例15: AsyncDashboardPanel

import org.apache.wicket.behavior.AttributeAppender; //導入依賴的package包/類
public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
                           Duration durationSecs, String boxCssClasses, boolean noPadding) {
    super(id, callableParameterModel, durationSecs);
    
    initLayout(noPadding);

    WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
            createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));

    Label label = (Label) dashboardTitle.get(ID_TITLE);
    label.setDefaultModel(title);

    if (boxCssClasses == null) {
    	boxCssClasses = GuiStyleConstants.CLASS_BOX_DEFAULT;
    }
    Component dashboardParent = get(ID_DASHBOARD_PARENT);
    dashboardParent.add(new AttributeAppender("class", " " + boxCssClasses));

    WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
    iconI.add(AttributeModifier.replace("class", icon));
    dashboardTitle.add(iconI);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:23,代碼來源:AsyncDashboardPanel.java


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