Example usage for org.apache.wicket Component setOutputMarkupId

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

Introduction

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

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

From source file:org.geoserver.web.wicket.EditAreaBehavior.java

License:Open Source License

public void bind(Component component) {
    if (this.component != null)
        throw new IllegalStateException("TinyMceBehavior can not bind to more than one component");
    super.bind(component);
    component.setOutputMarkupId(true);
    this.component = component;
}

From source file:org.headsupdev.agile.web.components.AttachmentUploadPanel.java

License:Open Source License

public AttachmentUploadPanel(String id, HeadsUpPage page, final AttachmentPanel panel) {
    super(id);/*from  w  w w.  ja v a  2s.c o  m*/
    this.page = page;
    this.panel = panel;
    add(createFileUploadField());
    addAttachmentLink = new AjaxLink("addAttachmentLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            Component replacement = new AttachmentUploadPanel("addAttachmentLink",
                    AttachmentUploadPanel.this.page, panel);
            replacement.setOutputMarkupId(true);
            addAttachmentLink.replaceWith(replacement);
            target.addComponent(addAttachmentLink);
            target.addComponent(replacement);
        }
    };
    addAttachmentLink.setOutputMarkupId(true);
    add(addAttachmentLink);
}

From source file:org.headsupdev.agile.web.components.milestones.MilestoneListPanel.java

License:Open Source License

private void addAnimatorToForm(Component[] rowAddComponents) {
    User currentUser = ((HeadsUpSession) getSession()).getUser();
    quickAdd = new WebMarkupContainer("quickAdd");
    quickAdd.add(new HeadsUpTooltip("Quick-add a milestone"));
    quickAdd.setVisible(Permissions.canEditDoc(currentUser, page.getProject()));

    icon = new WebMarkupContainer("icon");
    icon.setMarkupId("icon" + groupReference).setOutputMarkupId(true);
    Label iconToggleScript = new Label("iconToggleScript",
            "function moveIconBackground" + groupReference + "( value ) {" + "Wicket.$('icon" + groupReference
                    + "').style.backgroundPosition = '0px ' + ( 0 + ( value * 16 ) ) + 'px';}");

    iconToggleScript.setEscapeModelStrings(false);
    quickAdd.add(iconToggleScript);//from  ww w . j a  v a  2  s  . co m

    Animator animator = new Animator("" + groupReference + "Animator");

    animator.addCssStyleSubject(new MarkupIdModel(rowAdd.setOutputMarkupId(true)), "rowhidden", "rowshown");

    for (Component rowAddComponent : rowAddComponents) {
        rowAdd.add(rowAddComponent);
        if (rowAddComponent.isVisible()) {
            animator.addCssStyleSubject(new MarkupIdModel(rowAddComponent.setOutputMarkupId(true)), "hidden",
                    "shown");
        }
    }

    animator.addSubject(new IAnimatorSubject() {
        public String getJavaScript() {
            return "moveIconBackground" + groupReference;
        }

    });

    animator.attachTo(quickAdd, "onclick", Animator.Action.toggle());
    quickAdd.add(icon);
}

From source file:org.hippoecm.addon.workflow.ContextWorkflowManagerPlugin.java

License:Apache License

public ContextWorkflowManagerPlugin(IPluginContext context, IPluginConfig config) {
    super(new ServiceContext(context), config);
    this.pluginContext = context;

    Component menu;/*  ww w.  j  a v  a2 s.  c  o  m*/
    replace(menu = new Label("menu"));
    Component v;
    replace(v = new Label("view"));
    v.setVisible(false);
    menu.setVisible(false);
    v.setOutputMarkupId(true);
    menu.setOutputMarkupId(true);
    setOutputMarkupId(true);
}

From source file:org.hippoecm.frontend.dialog.AbstractDialog.java

License:Apache License

public Component setFocus(Component c) {
    if (focusComponent != null) {
        return c;
    }/*from   w  w  w  .ja v a 2s .  c o m*/

    if (!c.getOutputMarkupId()) {
        c.setOutputMarkupId(true);
    }
    return focusComponent = c;
}

From source file:org.hippoecm.frontend.plugins.cms.browse.SectionViewer.java

License:Apache License

public SectionViewer(final String id, final BrowserSections sections, IRenderService parentRenderService) {
    super(id, new Model<String>(null));

    setOutputMarkupId(true);/*w ww. j a v  a2s . co  m*/

    add(new AttributeAppender("class", Model.of("section-viewer"), " "));

    this.parentService = parentRenderService;
    this.sections = sections;

    IDataProvider<String> sectionProvider = new IDataProvider<String>() {

        private transient List<String> names;

        private void load() {
            if (names == null) {
                names = new ArrayList<>(sections.getSections());
            }
        }

        @Override
        public Iterator<String> iterator(long first, long count) {
            load();
            return names.subList((int) first, (int) (first + count)).iterator();
        }

        @Override
        public IModel<String> model(String object) {
            return new Model<>(object);
        }

        @Override
        public long size() {
            return sections.getSections().size();
        }

        @Override
        public void detach() {
            names = null;
        }
    };

    add(new AbstractView<String>("list", sectionProvider) {

        @Override
        protected void populateItem(final Item<String> item) {
            final IBrowserSection section = sections.getSection(item.getModelObject());

            section.bind(parentService, "section-view");

            final Component component = section.getComponent();
            component.setOutputMarkupId(true);
            component.setOutputMarkupPlaceholderTag(true);
            item.add(component);

            item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    return sections.isActive(section) ? "selected" : "unselected";
                }
            }, " "));
        }

        @Override
        protected void destroyItem(Item<String> item) {
            IBrowserSection section = sections.getSection(item.getModelObject());
            section.unbind();
        }
    });

    String selectedBrowserSection = (String) getDefaultModelObject();
    if (selectedBrowserSection != null) {
        select(selectedBrowserSection);
    }

    final Form form = new Form("selection-form");
    add(form);

    final SectionNamesModel sectionNamesModel = new SectionNamesModel();
    this.sections.addListener(sectionNamesModel);

    final IModel<String> selectModel = new SelectedSectionModel();
    select = new DropDownChoice<>("select", selectModel, sectionNamesModel, new IChoiceRenderer<String>() {
        @Override
        public Object getDisplayValue(final String sectionId) {
            final IBrowserSection section = sections.getSection(sectionId);
            return section.getTitle().getObject();
        }

        @Override
        public String getIdValue(final String sectionId, final int index) {
            return sectionId;
        }
    });
    select.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            onSelect(selectModel.getObject());
        }
    });
    form.add(select);

    this.sections.addListener(new IChangeListener() {
        public void onChange() {
            select(sections.getActiveSectionName());
        }
    });
}

From source file:org.hippoecm.frontend.plugins.gallery.editor.crop.CropBehavior.java

License:Apache License

@Override
public void bind(final Component component) {
    super.bind(component);
    component.setOutputMarkupId(true);
}

From source file:org.hippoecm.frontend.plugins.gallery.editor.ImageCropEditorDialog.java

License:Apache License

public ImageCropEditorDialog(IModel<Node> jcrImageNodeModel, GalleryProcessor galleryProcessor) {
    super(jcrImageNodeModel);

    setSize(DIALOG_SIZE);// ww  w .  ja v a 2  s. c o m
    setTitleKey(DIALOG_TITLE);

    this.galleryProcessor = galleryProcessor;
    Node thumbnailImageNode = jcrImageNodeModel.getObject();

    HiddenField<String> regionField = new HiddenField<>("region", new PropertyModel<>(this, "region"));
    regionField.setOutputMarkupId(true);
    add(regionField);

    Component originalImage, imgPreview;
    try {
        Node originalImageNode = thumbnailImageNode.getParent()
                .getNode(HippoGalleryNodeType.IMAGE_SET_ORIGINAL);
        originalImageDimension = new Dimension(
                (int) originalImageNode.getProperty(HippoGalleryNodeType.IMAGE_WIDTH).getLong(),
                (int) originalImageNode.getProperty(HippoGalleryNodeType.IMAGE_HEIGHT).getLong());

        JcrNodeModel originalNodeModel = new JcrNodeModel(originalImageNode);
        originalImage = new JcrImage("image", new JcrResourceStream(originalNodeModel));
        imgPreview = new JcrImage("imagepreview", new JcrResourceStream(originalNodeModel));

    } catch (RepositoryException e) {
        log.error("Cannot retrieve original image", e);
        error(e);
        originalImage = new EmptyPanel("image");
        imgPreview = new EmptyPanel("imagepreview");
    }

    WebMarkupContainer imagePreviewContainer = new WebMarkupContainer("previewcontainer");
    imagePreviewContainer.setOutputMarkupId(true);
    try {
        configuredDimension = galleryProcessor.getDesiredResourceDimension(thumbnailImageNode);
        thumbnailDimension = handleZeroValueInDimension(originalImageDimension, configuredDimension);

        final double previewCropFactor = determinePreviewScalingFactor(thumbnailDimension.getWidth(),
                thumbnailDimension.getHeight());
        final double previewWidth = Math.floor(previewCropFactor * thumbnailDimension.getWidth());
        final double previewHeight = Math.floor(previewCropFactor * thumbnailDimension.getHeight());

        imagePreviewContainer
                .add(new AttributeAppender("style", Model.of("width:" + previewWidth + "px"), ";"));
        imagePreviewContainer
                .add(new AttributeAppender("style", Model.of("height:" + previewHeight + "px"), ";"));

    } catch (RepositoryException | GalleryException e) {
        log.error("Cannot retrieve thumbnail dimensions", e);
        error(e);
    }

    boolean isUpscalingEnabled = true;
    try {
        isUpscalingEnabled = galleryProcessor.isUpscalingEnabled(thumbnailImageNode);
    } catch (GalleryException | RepositoryException e) {
        log.error("Cannot retrieve Upscaling configuration option", e);
        error(e);
    }

    Label thumbnailSize = new Label("thumbnail-size", new StringResourceModel("thumbnail-size", this, null));
    thumbnailSize.setOutputMarkupId(true);
    add(thumbnailSize);
    //
    cropSettings = new ImageCropSettings(regionField.getMarkupId(), imagePreviewContainer.getMarkupId(),
            originalImageDimension, configuredDimension, thumbnailDimension, isUpscalingEnabled, false,
            thumbnailSize.getMarkupId(true));

    if (configuredDimension.width > originalImageDimension.width
            || configuredDimension.height > originalImageDimension.height) {
        final double cropFactor = determineScalingFactor(configuredDimension.getWidth(),
                configuredDimension.getHeight(), originalImageDimension.getWidth(),
                originalImageDimension.getHeight());
        cropSettings.setInitialWidth((int) Math.floor(cropFactor * configuredDimension.getWidth()));
        cropSettings.setInitialHeight((int) Math.floor(cropFactor * configuredDimension.getHeight()));
    }

    final ImageCropBehavior imageCropBehavior = new ImageCropBehavior(cropSettings);
    final IModel<Boolean> fitViewModel = new PropertyModel<>(this.cropSettings, "fitView");
    final AjaxCheckBox fitViewCheckbox = new AjaxCheckBox("fit-view", fitViewModel) {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            executeFitInView(target, imageCropBehavior);
        }
    };
    fitViewCheckbox.setOutputMarkupId(true);
    add(fitViewCheckbox);

    originalImage.add(imageCropBehavior);
    originalImage.setOutputMarkupId(true);

    add(originalImage);
    imgPreview.add(new AttributeAppender("style", Model.of("position:absolute"), ";"));
    imagePreviewContainer.add(imgPreview);
    imagePreviewContainer.setVisible(cropSettings.isPreviewVisible());
    add(imagePreviewContainer);

    add(new Label("preview-description",
            cropSettings.isPreviewVisible() ? new StringResourceModel("preview-description-enabled", this, null)
                    : new StringResourceModel("preview-description-disabled", this, null)));

    compressionQuality = 1.0f;
    try {
        compressionQuality = galleryProcessor.getScalingParametersMap().get(thumbnailImageNode.getName())
                .getCompressionQuality();
    } catch (RepositoryException e) {
        log.info("Cannot retrieve compression quality.", e);
    }
}

From source file:org.hippoecm.frontend.plugins.yui.datetime.YuiDatePicker.java

License:Apache License

@Override
public void bind(Component component) {
    super.bind(component);
    this.component = component;
    checkComponentProvidesDateFormat(component);
    component.setOutputMarkupId(true);
}

From source file:org.jaulp.wicket.behaviors.FocusRequestBehavior.java

License:Apache License

/**
 * {@inheritDoc}/*w  ww .ja v a  2s . c o  m*/
 */
@Override
public void renderHead(Component component, IHeaderResponse response) {
    component.setOutputMarkupId(true);
    response.render(OnLoadHeaderItem.forScript(createJavaScript(component)));
    super.renderHead(component, response);
}