Package org.brixcms.plugin.site.page

Examples of org.brixcms.plugin.site.page.AbstractContainer$Properties


        Property[] properties = new Property[3];
        properties[0] = new Property(SystemStatistics.ORGANIZATION_COUNT.name(), Long.toString(organizationService.countAll()), SystemStatistics.ORGANIZATION_COUNT.getDescription());
        properties[1] = new Property(SystemStatistics.USER_COUNT.name(), Long.toString(userService.countAll()), SystemStatistics.USER_COUNT.getDescription());
        properties[2] = new Property(SystemStatistics.APPLICATION_COUNT.name(), Long.toString(applicationService.countAll()), SystemStatistics.APPLICATION_COUNT.getDescription());

        Properties props = new Properties();
        props.setProperties(properties);

        return props;
    }
View Full Code Here


                    CreatePageOrTemplatePanel.this));
            error(error);
        } else {
            JcrNode page = parent.addNode(name, "nt:file");

            AbstractContainer node;

            node = initializePage(type, page);

            node.setTitle(name);

            node.setData("");
            name = null;

            parent.save();

            SitePlugin.get().selectNode(this, node, true);
View Full Code Here

            SitePlugin.get().selectNode(this, node, true);
        }
    }

    protected AbstractContainer initializePage(String type, JcrNode page) {
        AbstractContainer node;
        if (type.equals(PageSiteNodePlugin.TYPE)) {
            node = PageNode.initialize(page);
        } else {
            node = TemplateNode.initialize(page);
        }
View Full Code Here

        grid.setContentHeight(17, SizeUnit.EM);

        add(delete = new AjaxLink<Void>("deleteSelected") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
                for (IModel<?> m : grid.getSelectedItems()) {
                    Entry e = (Entry) m.getObject();
                    node.setVariableValue(e.getKey(), null);
                }
                node.save();
                grid.markAllItemsDirty();
                grid.update();
                grid.resetSelectedItems();
                target.addComponent(this);
            }
View Full Code Here

        public IModel<Entry> model(Entry object) {
            return new Model<Entry>(object);
        }

        public void query(IQuery query, IQueryResult<Entry> result) {
            AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
            List<Entry> res = new ArrayList<Entry>();
            for (String s : node.getSavedVariableKeys()) {
                res.add(new Entry(s));
            }
            Collections.sort(res, new Comparator<Entry>() {
                public int compare(Entry o1, Entry o2) {
                    return o1.getKey().compareTo(o2.getKey());
View Full Code Here

        public String getKey() {
            return key;
        }

        public String getValue() {
            AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
            return node.getVariableValue(key, false);
        }
View Full Code Here

            AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
            return node.getVariableValue(key, false);
        }

        public void setValue(String value) {
            AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
            node.setVariableValue(key, value);
            node.save();
        }
View Full Code Here

            IModel<List<? extends String>> choicesModel = new LoadableDetachableModel<List<? extends String>>() {
                @Override
                protected List<? extends String> load() {
                    List<String> result = new ArrayList<String>();
                    AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
                    result.addAll(node.getVariableKeys());
                    return result;
                }
            };

            final TextField<String> tf;
            add(tf = new TextField<String>("key", new PropertyModel<String>(this, "key")));
            tf.setRequired(true);
            tf.setOutputMarkupId(true);

            final DropDownChoice<String> keySuggestions;
            add(keySuggestions = new DropDownChoice<String>("keySuggestions", new Model<String>(), choicesModel) {
                @Override
                public boolean isVisible() {
                    return VariablesPanel.this.getModelObject() instanceof GlobalContainerNode == false;
                }
            });
            keySuggestions.setNullValid(true);

            keySuggestions.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    tf.setModelObject(keySuggestions.getModelObject());
                    keySuggestions.setModelObject(null);
                    target.addComponent(tf);
                    target.addComponent(keySuggestions);
                    target.focusComponent(tf);
                }
            });

            add(new TextField<String>("value", new PropertyModel<String>(this, "value")).setRequired(true));

            add(new AjaxButton("submit") {
                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();
                    node.setVariableValue(key, value);
                    node.save();
                    onItemAdded();
                    key = null;
                    value = null;
                    target.addComponent(form);
                    target.addChildren(findParent(VariablesPanel.class), FeedbackPanel.class);
                }

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.addChildren(findParent(VariablesPanel.class), FeedbackPanel.class);
                }
            });

            tf.add(new IValidator<String>() {
                public void validate(IValidatable validatable) {
                    String key = (String) validatable.getValue();

                    AbstractContainer node = (AbstractContainer) VariablesPanel.this.getModelObject();

                    if (key.contains("/") || key.contains(":")) {
                        report(validatable, "keyValidator.invalidKey", key);
                    } else if (node.getVariableValue(key, false) != null) {
                        report(validatable, "keyValidator.duplicateKey", key);
                    }
                }

                private void report(IValidatable validatable, String messageKey, String key) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Component getComponent(String id, IModel<BrixNode> pageNodeModel) {
        AbstractContainer container = getTileContainer();
        BrixNode tileNode = container.getTileNode(tileName);

        if (tileNode != null) {
            Tile tile = Tile.Helper.getTileOfType(TileContainerFacet.getTileClassName(tileNode),
                    tileNode.getBrix());
            return tile.newViewer(id, new BrixNodeModel(tileNode));
View Full Code Here

    /**
     * @return tile container that contains the tile
     */
    protected AbstractContainer getTileContainer() {
        AbstractContainer container = (AbstractContainer) tileContainerNodeModel.getObject();
        tileContainerNodeModel.detach();
        return container;
    }
View Full Code Here

TOP

Related Classes of org.brixcms.plugin.site.page.AbstractContainer$Properties

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.