List of usage examples for org.apache.wicket.markup ComponentTag getAttribute
public final String getAttribute(String name)
From source file:au.org.theark.core.web.component.navigator.ArkAjaxPagingNavigator.java
License:Open Source License
@Override protected Link<?> newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { AjaxPagingNavigationIncrementLink link = new AjaxPagingNavigationIncrementLink(id, pageable, increment) { private static final long serialVersionUID = 1L; @Override/*from ww w .ja v a 2s. c o m*/ protected void onInitialize() { super.onInitialize(); add(new AjaxPagingNavigationBehavior(this, pageable, "onclick") { /** * */ private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String onClickEvent = tag.getAttribute("onclick"); if (onClickEvent != null) { tag.put("onclick", dirtyFormJavaScript(onClickEvent)); } } }); } }; return link; }
From source file:au.org.theark.core.web.component.navigator.ArkAjaxPagingNavigator.java
License:Open Source License
@Override protected Link<?> newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { AjaxPagingNavigationLink link = new AjaxPagingNavigationLink(id, pageable, pageNumber) { private static final long serialVersionUID = 1L; @Override/*w w w. j ava 2s.c om*/ protected void onInitialize() { super.onInitialize(); add(new AjaxPagingNavigationBehavior(this, pageable, "onclick") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String onClickEvent = tag.getAttribute("onclick"); if (onClickEvent != null) { tag.put("onclick", dirtyFormJavaScript(onClickEvent)); } } }); } }; return link; }
From source file:au.org.theark.core.web.component.navigator.ArkAjaxPagingNavigator.java
License:Open Source License
@Override protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation("navigation", pageable, labelProvider) { private static final long serialVersionUID = 1456846335814294449L; protected PagingNavigationLink<?> newPagingNavigationLink(String id, IPageable pageable, int pageIndex) { AjaxPagingNavigationLink link = new AjaxPagingNavigationLink(id, pageable, pageIndex) { private static final long serialVersionUID = 1L; @Override/*from w w w . ja v a 2 s . co m*/ protected void onInitialize() { super.onInitialize(); add(new AjaxPagingNavigationBehavior(this, pageable, "onclick") { /** * */ private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String onClickEvent = tag.getAttribute("onclick"); if (onClickEvent != null) { tag.put("onclick", dirtyFormJavaScript(onClickEvent)); } } }); } }; return link; } }; }
From source file:au.org.theark.core.web.component.tabbedPanel.DynamicTabbedPanel.java
License:Open Source License
protected LoopItem newTabContainer(final int tabIndex) { return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override/* ww w.ja v a 2 s . c om*/ protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); String cssClass = (String) tag.getAttribute("class"); if (cssClass == null) { cssClass = " "; } cssClass += " tab" + getIndex(); if (getIndex() == getSelectedTab()) { cssClass += " selected"; } if (getIndex() == getTabs().size() - 1) { cssClass += " last"; } tag.put("class", cssClass.trim()); } @Override public boolean isVisible() { return getTabs().get(tabIndex).isVisible(); } }; }
From source file:ca.travelagency.components.decorators.FieldDecorator.java
License:Apache License
@Override public void onComponentTag(Component component, ComponentTag tag) { FormComponent<?> formComponent = (FormComponent<?>) component; if (formComponent.isValid()) { return;//from w w w .ja va 2s .c o m } String htmlClass = tag.getAttribute("class"); if (htmlClass == null) { tag.put("class", "error"); } else { tag.put("class", "error " + htmlClass); } }
From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.HeaderConfigUI.java
License:Apache License
/** * Create the DataType drop down. When the data type is changed, the offsets will be recalculated and updated. *//*from w ww .j a va 2s .co m*/ private DropDownChoice<HeaderDataType> getDataTypeDropdown() { DropDownChoice<HeaderDataType> dropDown = new DropDownChoice<HeaderDataType>("dataType", HeaderDataType.getOptions(), new EnumChoiceRenderer<HeaderDataType>(this)) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (hasErrorMessage()) { String style = "background-color:#ffff00;"; String oldStyle = tag.getAttribute("style"); tag.put("style", style + oldStyle); } } }; dropDown.setRequired(true); // When the data type is changed, the offsets are recalculated and displayed dropDown.add(new OnChangeAjaxBehavior() { @SuppressWarnings("unchecked") @Override protected void onUpdate(AjaxRequestTarget target) { // Recalculate and display the offsets updateOffsets(target); // Disable value field when DataType does not use a value. DropDownChoice<HeaderDataType> choice = (DropDownChoice<HeaderDataType>) getComponent(); MarkupContainer parent = choice.getParent(); HeaderDataType dataType = choice.getConvertedInput(); target.add( parent.get("rawValue").setEnabled(dataType.isHasValue()).setVisible(dataType.isHasValue())); target.add(parent.get("size").setEnabled(dataType.isArrayAllowed())); } }); dropDown.add(new UniqueListItemValidator<HeaderDataType>(dropDown) { @Override public String getValue(IValidatable<HeaderDataType> validatable) { return String.valueOf(validatable.getValue().name()); } }.setMessageKey("dataType.SpecialTypesValidator").setFilterList(HeaderDataType.getSpecialItemNames())); return dropDown; }
From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java
License:Apache License
/** * Create the DataType dropdown. When the datatype is changed, the offsets will be recalculated and updated. */// w ww. ja va 2 s . c o m private DropDownChoice<BinaryDataType> getDataTypeDropdown() { DropDownChoice<BinaryDataType> dropDown = new DropDownChoice<BinaryDataType>("dataType", BinaryDataType.getOptions(), new EnumChoiceRenderer<BinaryDataType>(this)) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (hasErrorMessage()) { String style = "background-color:#ffff00;"; String oldStyle = tag.getAttribute("style"); tag.put("style", style + oldStyle); } } }; dropDown.setRequired(true); // When the datatype is changed, the offsets are recalculated and displayed dropDown.add(new OnChangeAjaxBehavior() { @SuppressWarnings("unchecked") @Override protected void onUpdate(AjaxRequestTarget target) { // Recalculate and display the offsets updateOffsets(target); // Disable input fields when DataType is a special type. // Current state is determined by the enabled state of TextField("id") DropDownChoice<BinaryDataType> choice = (DropDownChoice<BinaryDataType>) getComponent(); MarkupContainer parent = choice.getParent(); Component idTextField = parent.get("id"); BinaryDataType dataType = choice.getConvertedInput(); if (dataType.isSpecial() && idTextField.isEnabled()) { // DataType changed to special type // Store current values ((TextField<Integer>) idTextField).getRawInput(); idTextField.replaceWith(getSpecialIdTextField().setEnabled(false)); target.add(parent.get("id")); target.add(parent.get("alias").setVisible(false)); } else if (!idTextField.isEnabled()) { idTextField.replaceWith(getIdTextField()); target.add(parent.get("id").setEnabled(true)); target.add(parent.get("alias").setVisible(true)); } target.add(parent.get("size").setEnabled(dataType.isArrayAllowed())); target.add(parent.get("tagLengthType").setEnabled(dataType.supportsVariableLength())); if (!dataType.supportsVariableLength()) { EditorListItem<TagConfig> listItem = getComponent().findParent(EditorListItem.class); if (listItem != null) { listItem.getModelObject().setTagLengthType(TagLengthType.FIXED_LENGTH); } } } }); dropDown.add(new UniqueListItemValidator<BinaryDataType>(dropDown) { @Override public String getValue(IValidatable<BinaryDataType> validatable) { return String.valueOf(validatable.getValue().name()); } }.setMessageKey("dataType.SpecialTypesValidator") .setFilterList(new String[] { BinaryDataType.MessageAge.name() })); return dropDown; }
From source file:com.chitek.wicket.FeedbackTextField.java
License:Apache License
@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (hasErrorMessage()) { String oldStyle = tag.getAttribute("style"); tag.put("style", style + oldStyle); }//from w ww. j a v a 2s .co m }
From source file:com.evolveum.midpoint.web.component.TabbedPanel.java
License:Apache License
/** * Generates a loop item used to represent a specific tab's <code>li</code> element. * * @param tabIndex/* www.j av a 2 s . co m*/ * @return new loop item */ protected LoopItem newTabContainer(final int tabIndex) { return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); setVisible(getVisiblityCache().isVisible(tabIndex)); } @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); String cssClass = tag.getAttribute("class"); if (cssClass == null) { cssClass = " "; } cssClass += " tab" + getIndex(); if (getIndex() == getSelectedTab()) { cssClass += ' ' + getSelectedTabCssClass(); } if (getVisiblityCache().getLastVisible() == getIndex()) { cssClass += ' ' + getLastTabCssClass(); } tag.put("class", cssClass.trim()); } }; }
From source file:com.francetelecom.clara.cloud.presentation.tools.FieldFeedbackDecorator.java
License:Apache License
@Override public void onComponentTag(Component component, ComponentTag tag) { FormComponent<?> fc = (FormComponent<?>) component; if (!fc.isValid()) { String c1 = tag.getAttribute("class"); if (c1 == null) { tag.put("class", "errorField"); } else {/*from w w w . j a va 2s . c o m*/ tag.put("class", " errorField " + c1); } } }