Example usage for org.apache.wicket Component add

List of usage examples for org.apache.wicket Component add

Introduction

In this page you can find the example usage for org.apache.wicket Component add.

Prototype

public Component add(final Behavior... behaviors) 

Source Link

Document

Adds a behavior modifier to the component.

Usage

From source file:at.molindo.wicketutils.dev.MarkupSourceAttributeAppender.java

License:Apache License

@Override
public void onInstantiation(final Component component) {
    if (component instanceof MarkupContainer) {
        component.add(new AttributeModifier(attribute, new MarkupSourceModel((MarkupContainer) component)));
    }/*from  w  ww.j a  va  2  s. c o m*/
}

From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java

License:Apache License

private void addPropertyToForm(final EntityModel entityModel, final OneToOneAssociation association,
        final WebMarkupContainer container, final List<LinkAndLabel> entityActions) {
    final OneToOneAssociation otoa = association;
    final PropertyMemento pm = new PropertyMemento(otoa);

    final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
    final Component component = getComponentFactoryRegistry().addOrReplaceComponent(container, ID_PROPERTY,
            ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);

    final List<ObjectAction> associatedActions = EntityActionUtil.getObjectActionsForAssociation(entityModel,
            otoa, getDeploymentType());//from w w  w  .  j a  va2 s.  co  m

    entityActions
            .addAll(EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(entityModel, associatedActions));

    if (!renderedFirstField) {
        component.add(new CssClassAppender("first-field"));
        renderedFirstField = true;
    }
}

From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java

License:Apache License

private static void addClassForSpan(final Component component, final int numGridCols) {
    component.add(new CssClassAppender("col-xs-" + numGridCols));
}

From source file:au.org.theark.core.web.form.ArkFormVisitor.java

License:Open Source License

public void component(final Component component, final IVisit<Void> visit) {

    if (!visited.contains(component)) {
        visited.add(component);//from w  w  w .  jav  a  2 s.  c  o  m
        if (component instanceof FormComponent) {
            // Force id's in HTML to allow for target.focusCompont to focus on fieds in error
            component.setOutputMarkupId(true);
            // Add a "*" after the required fields
            component.add(new ArkRequiredFieldHintBehavior());
        }
    }
}

From source file:ca.travelagency.navigation.BaseNavigationMenu.java

License:Apache License

protected Component bookmarkablePageLink(String id, Class<? extends Page> page,
        Class<? extends Page> currentPage) {
    Component component = new BookmarkablePageLink<String>(id, page);
    if (page.getSimpleName().equals(currentPage.getSimpleName())) {
        component.add(new AttributeAppender("class", "selected"));
    }/*ww w  . j a v a 2  s  .co  m*/
    return component;
}

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.components.GraphPanel.java

License:Apache License

public void addDataSource(final Component c) {
    if (lineCount > 4) {
        return;//w  ww . j  av  a2s . c  o  m
    }
    c.add(new AttributeModifier("data-graph-id", Model.of(graphId)));
    c.add(new AttributeModifier("data-graph-index", Model.of(lineCount)));
    lineCount++;
}

From source file:com.cubeia.backoffice.web.MenuPanel.java

License:Open Source License

private Component createPageLink(String id, Class<? extends Page> pageClass,
        Class<? extends BasePage> currentPageClass) {

    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, pageClass);
    Component li = new WebMarkupContainer(id + "Item").add(link);
    if (pageClass.equals(currentPageClass)) {
        link.add(new AttributeModifier("class", Model.of("currentMenuItem")));
        li.add(new AttributeModifier("class", Model.of("current")));
    }/*from w  w  w.j  a  va2s .  c o m*/

    return li;
}

From source file:com.danhaywood.isis.wicket.ui.components.collectioncontents.gmap3.CollectionOfEntitiesAsLocatables.java

License:Apache License

private static void applyCssVisibility(final Component component, final boolean visible) {
    final AttributeModifier modifier = visible ? new AttributeModifier("class",
            String.valueOf(component.getMarkupAttributes().get("class")).replaceFirst(INVISIBLE_CLASS, ""))
            : new AttributeAppender("class", " " + INVISIBLE_CLASS);
    component.add(modifier);
}

From source file:com.doculibre.constellio.wicket.components.holders.ModalImgLinkHolder.java

License:Open Source License

@Override
public Component newLabel(String id, IModel labelModel) {
    Component img = newImg(id);
    IModel altModel = getAltModel();//  www . jav  a 2s .  co  m
    if (altModel != null) {
        img.add(new AttributeModifier("alt", true, altModel));
    }
    return img;
}

From source file:com.doculibre.constellio.wicket.pages.BaseConstellioPage.java

License:Open Source License

@SuppressWarnings("serial")
private void initComponents() {
    Component keepAliveComponent = new WebMarkupContainer("keepAlive");
    add(keepAliveComponent);/*from w ww .  ja v  a2  s . com*/

    if (ConstellioSession.get().getUser() != null) {
        keepAliveComponent.add(new AbstractAjaxTimerBehavior(Duration.seconds(30)) {
            @Override
            protected void onTimer(AjaxRequestTarget target) {
                // Do nothing, will prevent page from expiring
            }
        });
    }
    initStyling();
}