Package org.brixcms.web.model

Examples of org.brixcms.web.model.ModelBuffer$Model


     * this.setModel(model); </code>
     *
     *
     */
    public Model createAndSetModel() {
        Model newValue = new Model();
        this.setModel(newValue);
        return newValue;
    }
View Full Code Here


  public boolean acceptFeature(Feature feature) {
    return this.styleFilter.match(feature);
  }

  public Model getKmlModel(Feature feature, Point point) {
    Model kmlModel = KmlFactory.createModel()
        .withId(feature.getName().toString())
        .withAltitudeMode(getAltitudeMode(feature, point));
    kmlModel.createAndSetLocation().withLongitude(point.getCoordinate().x)
        .withLatitude(point.getCoordinate().y)
        .withAltitude(getAltitude(feature, point));
    kmlModel.createAndSetOrientation()
        .withHeading(
            getGenericRotationValue(feature, model.getHeading()))
        .withTilt(getGenericRotationValue(feature, model.getTilt()))
        .withRoll(getGenericRotationValue(feature, model.getRoll()));
    kmlModel.createAndSetLink()
        .withHref(
            styleFilter.getExpressionValue(model.getHref(), feature))
        .withRefreshMode(RefreshMode.ON_CHANGE);
    return kmlModel;
  }
View Full Code Here

  public Kml getKml() {
    return kml;
  }

  private void addPoint(Feature feature, Point point, List<KmlModel> kmlModels) {
    Model kmlModel = getKmlModel(feature, point, kmlModels);
    if (kmlModel != null) {
      Placemark placemark = new Placemark().withName(feature.getName()
          .toString());
      placemark.createAndSetLookAt()
          .withLongitude(point.getCoordinate().x)
View Full Code Here

        form.add(new TextField<String>("fileName", new PropertyModel<String>(this, "fileName"))
                .setRequired(true).add(NodeNameValidator.getInstance()).setLabel(
                        new ResourceModel("fileName")));

        final ModelBuffer model = new ModelBuffer();

        form.add(new TextResourceEditor("editor", model));

        form.add(new SubmitLink("save") {
            @Override
            public void onSubmit() {
                if (getContainer().hasNode(fileName)) {
                    error(getString("fileExists", Model.ofMap(new MicroMap<String, String>(
                            "fileName", fileName))));
                    return;
                }

                // create initial node skeleton
                BrixNode node = (BrixNode) getContainer().addNode(fileName, "nt:file");
                BrixFileNode file = BrixFileNode.initialize(node, "text"); // temp-mime

                // save the node so brix assigns the correct jcr type to it
                getContainer().save();

                // populate node
                ResourceNode resource = (ResourceNode) getContainer().getSession().getItem(
                        node.getPath());
                model.setObject(new BrixNodeModel(resource));
                model.apply();

                getContainer().save();

                // done
                getSession().info(getString("saved"));
View Full Code Here

    public EditPropertiesPanel(String id, final IModel<BrixNode> nodeModel) {
        super(id, nodeModel);

        List<Protocol> protocols = Arrays.asList(Protocol.values());

        final ModelBuffer model = new ModelBuffer(nodeModel);
        Form<?> form = new Form<Void>("form");

        IChoiceRenderer<Protocol> renderer = new IChoiceRenderer<Protocol>() {
            public Object getDisplayValue(Protocol object) {
                return getString(object.toString());
            }

            public String getIdValue(Protocol object, int index) {
                return object.toString();
            }
        };
        IModel<Protocol> protocolModel = model.forProperty("requiredProtocol");
        form.add(new DropDownChoice<Protocol>("requiredProtocol", protocolModel, protocols,
                renderer).setNullValid(false));

        IModel<String> mimeTypeModel = model.forProperty("mimeType");
        form.add(new TextField<String>("mimeType", mimeTypeModel));

        form.add(new SubmitLink("save") {
            @Override
            public void onSubmit() {
                BrixNode node = nodeModel.getObject();
                model.apply();
                node.save();
                getSession().info(getString("propertiesSaved"));
                goBack();
            }
        });
View Full Code Here

        add(new FeedbackPanel("feedback"));

        Form<?> form = new Form<Void>("form");
        add(form);

        final ModelBuffer model = new ModelBuffer(node);

        form.add(new TextResourceEditor("editor", model));

        form.add(new SubmitLink("save") {
            @Override
            public void onSubmit() {
                model.apply();
                getNode().save();
                // done
                getSession().info(getString("saved"));
                done();
            }
View Full Code Here

        Brix brix = getModelObject().getBrix();
        Form<Void> form = new Form<Void>("form");
        add(form);

        final ModelBuffer adapter = new ModelBuffer(nodeModel);
        IModel<String> stringModel = adapter.forProperty("title");

        form.add(new TextField<String>("title", stringModel));

        String workspace = nodeModel.getObject().getSession().getWorkspace().getName();
        NodeFilter filter = new NodeTypeFilter(TemplateSiteNodePlugin.TYPE);

        IModel<BrixNode> model = adapter.forNodeProperty("template");

        form.add(new SiteNodePickerPanel("templatePicker", model, workspace, filter));

        IModel<Boolean> booleanModel = adapter.forProperty("requiresSSL");
        form.add(new ProtocolSelector("requiresSSL", booleanModel));

        IModel<String> mimeTypeModel = adapter.forProperty("mimeType");
        form.add(new TextField<String>("mimeType", mimeTypeModel));

        // set up markup editor

        contentEditorModel = adapter.forProperty("dataAsString");
        contentEditorParent = form;

        Collection<MarkupEditorFactory> editorFactories = brix.getConfig().getRegistry()
                .lookupCollection(MarkupEditorFactory.POINT);

        setupEditor(editorFactories.iterator().next().getClass().getName());

        // set up buttons to control editor switching

        RepeatingView editors = new RepeatingView("editors") {
            @Override
            public boolean isVisible() {
                return size() > 1;
            }
        };
        form.add(editors);

        for (MarkupEditorFactory factory : editorFactories) {
            final String cn = factory.getClass().getName();
            editors.add(new Button(editors.newChildId(), factory.newLabel()) {
                public void onSubmit() {
                    setupEditor(cn);
                }

                @Override
                public boolean isEnabled() {
                    return !cn.equals(currentEditorFactory);
                }
            });
        }


        form.add(new ContainerFeedbackPanel("feedback", this));

        form.add(new Button("save") {
            @Override
            public void onSubmit() {
                JcrNode node = nodeModel.getObject();
                node.checkout();
                adapter.apply();
                node.save();
                node.checkin();

                getSession().info(getString("status.saved"));
                goBack();
View Full Code Here

public class PropertiesTab extends BrixGenericPanel<BrixNode> {
    public PropertiesTab(String id, final IModel<BrixNode> folderNodeModel) {
        super(id, folderNodeModel);

        final ModelBuffer buffer = new ModelBuffer(folderNodeModel);

        Form<Void> form = new Form<Void>("form");

        form.add(new SubmitLink("submit") {
            @Override
            public void onSubmit() {
                buffer.apply();
                folderNodeModel.getObject().save();
                getSession().info(PropertiesTab.this.getString("propertiesSaved"));
            }
        });
        add(form);

        add(new ContainerFeedbackPanel("feedback", this));

        ReferenceEditorConfiguration conf = new ReferenceEditorConfiguration();

        conf.setDisplayFiles(true);
        conf.setWorkspaceName(folderNodeModel);

        IModel<Reference> model = buffer.forProperty("redirectReference");
        form.add(new ReferenceEditorPanel("redirectReference", model).setConfiguration(conf));
    }
View Full Code Here

    /**
     * Find the Model of a ressource (UML2 Model)
     */
    public static Model findModel(final UML2Resource resource)
    {
        Model model = (Model)EcoreUtil.getObjectByType(
                resource.getContents(),
                EcorePackage.eINSTANCE.getEObject());
        if (logger.isDebugEnabled())
        {
            logger.debug("Model found: " + model);
View Full Code Here

            null);
        final ModelAccessFacade modelFacade = repository.getModel();
        assertNotNull(modelFacade);
        assertNotNull(modelFacade.getModel());
        assertTrue(modelFacade.getModel() instanceof UML2Resource);
        Model model = (Model)EcoreUtil.getObjectByType(
            ((UML2Resource)repository.getModel().getModel()).getContents(),
            EcorePackage.eINSTANCE.getEObject());
        assertEquals(
            "Test Model",
            model.getName());
        Collection elements = UML2Util.findNamedElements(
                model.eResource(),
                "Test Model::testPackage::Top",
                true);
        org.eclipse.uml2.Class umlClass = (org.eclipse.uml2.Class)elements.iterator().next();
        assertEquals(
            "Top",
View Full Code Here

TOP

Related Classes of org.brixcms.web.model.ModelBuffer$Model

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.