Example usage for org.apache.wicket.extensions.breadcrumb IBreadCrumbModel allBreadCrumbParticipants

List of usage examples for org.apache.wicket.extensions.breadcrumb IBreadCrumbModel allBreadCrumbParticipants

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.breadcrumb IBreadCrumbModel allBreadCrumbParticipants.

Prototype

List<IBreadCrumbParticipant> allBreadCrumbParticipants();

Source Link

Document

Lists the bread crumb participants in this model.

Usage

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * @return The corresponding panel activating the back command based on given BreadCrumbModel . If there is no back returns null.
 * @param breadCrumbModel The given Breadcrumb Model
 * */// w  w  w.j  ava  2  s.com
public static Object backBreadCrumbPanel(IBreadCrumbModel breadCrumbModel) {

    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    //There must be at least 2 participants in order to return the back page participant
    //Current page = participantsSize-1
    //Back page = participantsSize-2
    if (participantsSize >= 2) {
        return breadCrumbModel.allBreadCrumbParticipants().get(participantsSize - 2);
    } //if

    return null;
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * @param breadCrumbModel The given BreadCrumb Model
 * *///from   ww w.ja v  a  2  s  .  c  o m
public static void removePreviousBreadCrumbPanel(IBreadCrumbModel breadCrumbModel) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    //There must be at least 3 participants in order to remove the back page participant
    if (participantsSize >= 3) {
        breadCrumbModel.setActive(
                (IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(participantsSize - 3));
    } //if
    else {
        breadCrumbModel.allBreadCrumbParticipants().clear();
    }
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * Returns the first panel of path to active panel
 * @param breadCrumbModel The given BreadCrumb Model
 * *//*from  w  ww.  j  av a2 s  .c o m*/
public static BreadCrumbPanel moveToRootPanel(IBreadCrumbModel breadCrumbModel) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    if (participantsSize > 0) {
        breadCrumbModel.setActive((IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(0));
    }

    return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * Returns a BreadCrumbPanel of a given breadCrumbModel according to the panelIndex
 * @param breadCrumbModel  The BreadCrumbModel
 * @param panelIndex Panel index/*from www .  j  a  va  2 s  .co  m*/
 * @return 
 * */
public static BreadCrumbPanel moveToPanel(IBreadCrumbModel breadCrumbModel, int panelIndex) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    if (panelIndex < participantsSize && panelIndex > 0) {
        breadCrumbModel.setActive(
                (IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(panelIndex));
        return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
    }

    return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * @param breadCrumbModel// w  ww  .  ja  va 2  s  .co  m
 * @param panelClassName
 * @return 
 * 
 * */
public static BreadCrumbPanel moveToPanel(IBreadCrumbModel breadCrumbModel, String panelClassName) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    for (int i = 0; i < participantsSize; i++) {
        IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant) breadCrumbModel
                .allBreadCrumbParticipants().get(i);
        if (breadCrumbParticipant.getClass().getName().equals(panelClassName)) {
            breadCrumbModel
                    .setActive((IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(i));
            return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
        } //if

    } //for

    return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * @param breadCrumbModel/*from  ww  w  . j ava  2s. c  o  m*/
 * @param 
 * @return 
 * 
 * */
public static BreadCrumbPanel moveToPanel(IBreadCrumbModel breadCrumbModel, Class panelClass) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    for (int i = 0; i < participantsSize; i++) {
        IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant) breadCrumbModel
                .allBreadCrumbParticipants().get(i);
        if (breadCrumbParticipant.getClass().equals(panelClass)) {
            breadCrumbModel
                    .setActive((IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(i));
            return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
        } //if

    } //for

    return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

public static BreadCrumbPanel moveToPanelForRelod(IBreadCrumbModel breadCrumbModel, Class panelClass) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    for (int i = 0; i < participantsSize; i++) {
        IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant) breadCrumbModel
                .allBreadCrumbParticipants().get(i);
        if (breadCrumbParticipant.getClass().equals(panelClass)) {
            if (i >= 1) {
                breadCrumbModel.setActive(
                        (IBreadCrumbParticipant) breadCrumbModel.allBreadCrumbParticipants().get(i - 1));
            }/*www . j  a  v a 2s.  c o m*/
            return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
        } //if

    } //for

    return (BreadCrumbPanel) breadCrumbModel.getActive().getComponent();
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

/**
 * @param breadCrumbModel//w ww  . j a v  a 2 s.c o m
 * @param 
 * @return BreadCrumbPanel of the panelClass class, null if not found
 * 
 * */
public static BreadCrumbPanel getPanel(IBreadCrumbModel breadCrumbModel, Class panelClass) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    for (int i = 0; i < participantsSize; i++) {
        IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant) breadCrumbModel
                .allBreadCrumbParticipants().get(i);
        if (breadCrumbParticipant.getClass().equals(panelClass)) {
            return (BreadCrumbPanel) breadCrumbParticipant;
        } //if

    } //for

    return null;
}

From source file:gr.abiss.calipso.util.BreadCrumbUtils.java

License:Open Source License

public static BreadCrumbPanel getPanel(IBreadCrumbModel breadCrumbModel, List<Class> panelsClasses) {
    int participantsSize = breadCrumbModel.allBreadCrumbParticipants().size();

    for (int i = 0; i < participantsSize; i++) {
        IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant) breadCrumbModel
                .allBreadCrumbParticipants().get(i);

        if (panelsClasses.contains(breadCrumbParticipant.getClass())) {
            return (BreadCrumbPanel) breadCrumbParticipant;
        } //if//  w  w w.j av a2 s .c  om

    } //for

    return null;
}

From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributeLookupValuesFormPanel.java

License:Open Source License

/**
 * Renders User Interface components//from www  .j  av  a 2 s.c o m
 * */
private void addComponents() {

    if (this.assetTypeCustomAttribute.getAllowedLookupValues() == null) {
        lookupValues = new ArrayList<CustomAttributeLookupValue>();
    } //if
    else {
        lookupValues = new ArrayList<CustomAttributeLookupValue>(
                this.assetTypeCustomAttribute.getAllowedLookupValues());
    } //else

    add(new ValuesForm("valuesForm", lookupValues));
    WebMarkupContainer editArea = new WebMarkupContainer("editArea");

    if (this.lookupValue == null) {
        editArea.add(new EditForm("editForm", new CustomAttributeLookupValue()));
        editArea.setVisible(false);
    } //if
    else {
        isNewEntry = (lookupValue.getAttribute() == null);
        editArea.add(new Label("editLabel",
                localize("asset.customAttributes." + String.valueOf(isNewEntry ? "add" : "edit") + "Value")));
        editArea.add(new EditForm("editForm", this.lookupValue));
    } //else

    add(editArea);

    Link add = new Link("add") {
        public void onClick() {

            activate(new IBreadCrumbPanelFactory() {
                public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) {

                    //Remove last breadcrumb participant
                    if (breadCrumbModel.allBreadCrumbParticipants().size() > 0) {
                        breadCrumbModel.allBreadCrumbParticipants()
                                .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1);
                    } //if

                    return new AssetCustomAttributeFormPagePanel(
                            breadCrumbModel.getActive().getComponent().getId(), breadCrumbModel,
                            AssetCustomAttributeLookupValuesFormPanel.this.assetTypeCustomAttribute,
                            new CustomAttributeLookupValue()).setReferenceAssetType(referenceAssetType);
                }
            });

        }//onClick
    };
    add(add);

}