Package org.brixcms.web.reference

Examples of org.brixcms.web.reference.Reference


        super(id);
        init(configuration);
    }

    private void init(ReferenceEditorConfiguration configuration) {
        Reference old = getModelObject();

        reference = old != null ? new Reference(old) : new Reference();

        add(new ReferenceEditor("editor", new PropertyModel<Reference>(this, "reference"), configuration));

        add(new AjaxLink<Void>("ok") {
            @Override
View Full Code Here


    }

    @Override
    public boolean checkRequired() {
        if (isRequired()) {
            Reference ref = (Reference) getModelObject();
            if (ref == null || ref.isEmpty()) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

    private void init() {
        add(newModalWindow(MODAL_WINDOW_ID));
        final Label label = new Label("label", newLabelModel()) {
            @Override
            public boolean isVisible() {
                Reference ref = ReferenceEditorPanel.this.getModelObject();
                return ref != null && !ref.isEmpty();
            }
        };
        setOutputMarkupId(true);
        add(label);

        add(new AjaxLink<Void>("edit") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                getModalWindow().setModel(ReferenceEditorPanel.this.getModel());
                getModalWindow().setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
                    public void onClose(AjaxRequestTarget target) {
                        target.addComponent(ReferenceEditorPanel.this);
                        ReferenceEditorPanel.this.onUpdate(target);
                    }
                });
                getModalWindow().show(target);
            }
        });

        add(new AjaxLink<Void>("clear") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                Reference ref = ReferenceEditorPanel.this.getModelObject();
                ref.makeEmpty();
                // indicate that reference was changed (might be needed if the
                // model is buffered)
                ReferenceEditorPanel.this.setModelObject(ref);
                target.addComponent(ReferenceEditorPanel.this);
                ReferenceEditorPanel.this.onUpdate(target);
            }

            @Override
            public boolean isEnabled() {
                Reference ref = ReferenceEditorPanel.this.getModelObject();
                return ref != null && !ref.isEmpty();
            }
        });
    }
View Full Code Here

        }
    }

    protected boolean isSelected(ChildEntry entry) {
        final String url = "/" + getRequest().getContextPath();
        Reference ref = entry.getReference();
        if (ref == null) {
            return false;
        } else {
            return isSelected(ref, url);
        }
View Full Code Here

        super(id, model);

        IModel<String> labelModel = new AbstractModel<String>() {
            @Override
            public String getObject() {
                Reference reference = ReferenceColumnPanel.this.getModelObject();
                if (reference != null && !reference.isEmpty()) {
                    return reference.generateUrl();
                } else {
                    return "";
                }
            }
        };
View Full Code Here

//        if (new Path(path).equals(uriPath) == false) {
//            return null;
//        }

        FolderNode folder = (FolderNode) node;
        Reference redirect = folder.getRedirectReference();

        if (redirect != null && !redirect.isEmpty()) {
            IRequestHandler target = redirect.getRequestTarget();
            final CharSequence url = RequestCycle.get().urlFor(target);
            return new RedirectRequestHandler(url.toString());
        } else {
            return new RenderPageRequestHandler(new PageProvider(new ForbiddenPage(/*path*/)));
        }
View Full Code Here

    }

    public void setRedirectReference(Reference reference) {
        ensureType();
        if (reference == null) {
            reference = new Reference();
        }
        reference.save(this, REDIRECT_REFERENCE);
    }
View Full Code Here

TOP

Related Classes of org.brixcms.web.reference.Reference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.