Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #517 from sjardine/master
Browse files Browse the repository at this point in the history
Fixes # 516.  Added HasTarget.
  • Loading branch information
sjardine committed Feb 14, 2018
2 parents a124cdb + dc5d11c commit b2987ef
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
Expand Up @@ -10,7 +10,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -43,4 +43,5 @@ public void setText(final String text) {
public String getText() {
return anchor.getText();
}

}
Expand Up @@ -10,7 +10,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -37,14 +37,15 @@
import com.google.gwt.user.client.ui.Focusable;

/**
* Base class for list items that contain an {@link org.gwtbootstrap3.client.ui.Anchor} link.
* Base class for list items that contain an
* {@link org.gwtbootstrap3.client.ui.Anchor} link.
*
* @author Sven Jacobs
* @author Drew Spencer
* @author Steven Jardine
*/
public abstract class AbstractAnchorListItem extends AbstractListItem
implements HasHref, HasTargetHistoryToken, HasClickHandlers, Focusable, HasDataToggle, HasIcon, HasIconPosition, HasBadge {
public abstract class AbstractAnchorListItem extends AbstractListItem implements HasHref, HasTargetHistoryToken,
HasClickHandlers, Focusable, HasDataToggle, HasIcon, HasIconPosition, HasBadge, HasTarget {

protected final Anchor anchor;

Expand All @@ -54,6 +55,7 @@ public abstract class AbstractAnchorListItem extends AbstractListItem
protected AbstractAnchorListItem() {
anchor = new Anchor();
anchor.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
delegateEvent(AbstractAnchorListItem.this, event);
Expand Down Expand Up @@ -128,6 +130,14 @@ public int getTabIndex() {
return anchor.getTabIndex();
}

/**
* {@inheritDoc}
*/
@Override
public String getTarget() {
return anchor.getTarget();
}

/** {@inheritDoc} */
@Override
public String getTargetHistoryToken() {
Expand Down Expand Up @@ -219,6 +229,12 @@ public void setIconBordered(final boolean iconBordered) {
anchor.setIconBordered(iconBordered);
}

/** {@inheritDoc} */
@Override
public void setIconColor(String iconColor) {
anchor.setIconColor(iconColor);
}

/** {@inheritDoc} */
@Override
public void setIconFixedWidth(final boolean iconFixedWidth) {
Expand Down Expand Up @@ -268,21 +284,24 @@ public void setIconSpin(final boolean iconSpin) {
}

/** {@inheritDoc} */

@Override
public void setTabIndex(final int index) {
anchor.setTabIndex(index);
}

/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
anchor.setTargetHistoryToken(targetHistoryToken);
public void setTarget(final String target) {
anchor.setTarget(target);
}

/** {@inheritDoc} */
@Override
public void setIconColor(String iconColor) {
anchor.setIconColor(iconColor);
public void setTargetHistoryToken(final String targetHistoryToken) {
anchor.setTargetHistoryToken(targetHistoryToken);
}

}
Expand Up @@ -100,8 +100,8 @@ public void fireEvent(GwtEvent<?> event) {
* @return true, if successful
*/
public <T extends Widget & HasValidators<?>> boolean remove(final T field) {
fields.remove(field);
HandlerRegistration reg = registrations.remove(field);
fields.remove((HasValidators<?>) field);
HandlerRegistration reg = registrations.remove((HasValidators<?>) field);
if (reg != null) {
reg.removeHandler();
return true;
Expand Down

0 comments on commit b2987ef

Please sign in to comment.