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


Java TextField.setMarkupId方法代碼示例

本文整理匯總了Java中org.apache.wicket.markup.html.form.TextField.setMarkupId方法的典型用法代碼示例。如果您正苦於以下問題:Java TextField.setMarkupId方法的具體用法?Java TextField.setMarkupId怎麽用?Java TextField.setMarkupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.wicket.markup.html.form.TextField的用法示例。


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

示例1: LoginPanel

import org.apache.wicket.markup.html.form.TextField; //導入方法依賴的package包/類
public LoginPanel(String string, Form form) {
    super(string);

    Label defaultCredentialsLabel = new Label("defaultCredentials", " (default: admin/password)");
    try {
        UserInfo userInfo = userGroupService.findUser("admin");
        defaultCredentialsLabel.setVisible(neverLoggedIn(userInfo) && defaultAdminPassword(userInfo));
    } catch (Exception ignored) {
        defaultCredentialsLabel.setVisible(false);
    }
    add(defaultCredentialsLabel);

    // add username
    TextField username = new TextField("username");
    username.setRequired(true);
    username.setMarkupId("username");
    username.setOutputMarkupId(true);
    username.add(new AttributeModifier("autocomplete", new AbstractReadOnlyModel<String>() {
        @Override
        public String getObject() {
            return ConstantValues.useUserNameAutoCompleteOnLogin.getString();
        }
    }));

    add(username);

    // add password
    PasswordTextField password = new PasswordTextField("password");
    password.setRequired(false);
    password.setMarkupId("password");
    password.setOutputMarkupId(true);
    add(password);

    // add login link
    TitledPageLink ssoLoginLink = new TitledPageLink("ssoLogin", "SSO Login", null) {
        @Override
        protected CharSequence getURL() {
            return addons.addonByType(SamlAddon.class).getSamlLoginIdentityProviderUrl();
        }

        @Override
        public boolean isEnabled() {
            return addons.addonByType(SamlAddon.class).isSamlEnabled();
        }

        @Override
        public boolean isVisible() {
            return addons.addonByType(SamlAddon.class).isSamlEnabled();
        }
    };
    add(ssoLoginLink);
    // add login link
    IFormSubmittingComponent loginLink =
            addons.addonByType(WebApplicationAddon.class).getLoginLink("loginLink", form);
    addDefaultButton(loginLink);


    // add remember me checkbox
    StyledCheckbox checkbox = new StyledCheckbox("rememberMe") {
        @Override
        protected String getCheckboxInputName(String defaultName) {
            // set the parameter name to springs' remember me filter default name
            return AbstractRememberMeServices.DEFAULT_PARAMETER;
        }
    };
    checkbox.setSubmitButton((Component) loginLink);
    checkbox.setOutputMarkupPlaceholderTag(true);
    checkbox.setVisible(!ConstantValues.securityDisableRememberMe.getBoolean());
    add(checkbox);

    // add cancel link
    addButton(new TitledPageLink("cancel", "Cancel", ArtifactoryApplication.get().getHomePage()));

    // add forgot password link
    if (isMailServerConfigured()) {
        addButton(new ForgotPasswordLink("forgotPassword"));
    }
}
 
開發者ID:alancnet,項目名稱:artifactory,代碼行數:79,代碼來源:LoginPanel.java

示例2: EditablePanelDate

import org.apache.wicket.markup.html.form.TextField; //導入方法依賴的package包/類
public EditablePanelDate(String id, IModel inputModel, final NodeModel nodeModel, final TreeNode node, final boolean startDate)
{
	super(id);

	if (startDate && nodeModel.getNodeShoppingPeriodStartDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodStartDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}
	if (!startDate && nodeModel.getShoppingPeriodEndDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodEndDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}

	final TextField date = new TextField<String>("dateTextField", new PropertyModel<String>(this, "dateTextField")){
		@Override
		public boolean isVisible() {
			return nodeModel.isDirectAccess() && nodeModel.getNodeShoppingPeriodAdmin();
		}
		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			tag.append("size", "8", "");
			tag.append("readonly", "readonly", "");
			tag.append("class", "formInputField", " ");
			tag.append("class", "datePicker", " ");
		}
	};
	String dateInputId = ((startDate) ? "dateTextFieldStart_" : "dateTextFieldEnd_") + nodeModel.getNodeId();
	date.setMarkupId(dateInputId);

	final HiddenField hiddenInput = new HiddenField<String>("hiddenDateTextField", new PropertyModel<String>(this, "hiddenDateTextField"));
	String hiddenInputId = String.format((startDate) ? HIDDEN_START_ISO8601 : HIDDEN_END_ISO8601, nodeModel.getNodeId());
	hiddenInput.setMarkupId(hiddenInputId);
	hiddenInput.add(new AjaxFormComponentUpdatingBehavior("onchange")
	{
		@Override
		protected void onUpdate(AjaxRequestTarget target)
		{
			if (DateFormatterUtil.isValidISODate(hiddenDateTextField) && hiddenDateTextField != null){
				Date hiddenDate = DateFormatterUtil.parseISODate(hiddenDateTextField);
				if(startDate){
					nodeModel.setShoppingPeriodStartDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}else{
					nodeModel.setShoppingPeriodEndDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}

				//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
				//since I don't want to expand or collapse, I just call whichever one the node is already
				//Refreshing the tree will update all the models and information (like role) will be generated onClick
				if(((BaseTreePage)target.getPage()).getTree().getTreeState().isNodeExpanded(node)){
					((BaseTreePage)target.getPage()).getTree().getTreeState().expandNode(node);
				}else{
					((BaseTreePage)target.getPage()).getTree().getTreeState().collapseNode(node);
				}
				((BaseTreePage)target.getPage()).getTree().updateTree(target);
				target.focusComponent(hiddenInput);
			}
		}

	});
	add(date);
	add(hiddenInput);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:64,代碼來源:EditablePanelDate.java


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