Example usage for org.apache.wicket.markup.html.basic Label setMarkupId

List of usage examples for org.apache.wicket.markup.html.basic Label setMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.basic Label setMarkupId.

Prototype

final void setMarkupId(Component comp) 

Source Link

Document

Copy markupId

Usage

From source file:jp.go.nict.langrid.management.web.view.page.user.YourTemporaryUsersPage.java

License:Open Source License

/**
 * /*w ww .  j av  a 2s .  c  om*/
 * 
 */
public YourTemporaryUsersPage(String message) {
    add(getForm());
    Label label;
    add(label = new Label("completeMessage", message));
    label.setMarkupId("infoPanel");
    label.setOutputMarkupId(true);
    add(label);
}

From source file:net.rrm.ehour.ui.timesheet.panel.MonthOverviewPanel.java

License:Open Source License

@SuppressWarnings("serial")
private Fragment createDayContents(String dayId, List<TimesheetEntry> timesheetEntries) {
    Fragment fragment;//from w ww  . j  ava2s.  c  o m
    fragment = new Fragment(dayId, "showProjects", this);

    //sort by Project Code
    if (timesheetEntries != null)
        Collections.sort(timesheetEntries, comparator);

    ListView<TimesheetEntry> projects = new ListView<TimesheetEntry>("projects", timesheetEntries) {
        @Override
        protected void populateItem(ListItem<TimesheetEntry> item) {
            TimesheetEntry entry = item.getModelObject();

            Project project = entry.getEntryId().getProjectAssignment().getProject();
            Label projectCodeLabel = new Label("projectCode", project.getProjectCode());
            projectCodeLabel.setMarkupId(String.format("prjV%d", project.getProjectId()));
            projectCodeLabel.setOutputMarkupId(true);

            item.add(projectCodeLabel);
            item.add(new Label("hours", new Model<>(entry.getHours())));
        }
    };

    fragment.add(projects);
    return fragment;
}

From source file:net.rrm.ehour.ui.timesheet.panel.ProjectOverviewPanel.java

License:Open Source License

@SuppressWarnings("serial")
private void addTableData(WebMarkupContainer container, Collection<UserProjectStatus> projectStatusSet) {
    List<UserProjectStatus> statusses = projectStatusSet == null ? new ArrayList<UserProjectStatus>()
            : new ArrayList<>(projectStatusSet);

    // table data should reflect the path to the listView
    ListView<UserProjectStatus> view = new ListView<UserProjectStatus>(ID_TABLE_DATA, statusses) {
        public void populateItem(final ListItem<UserProjectStatus> item) {
            UserProjectStatus projectStatus = item.getModelObject();

            WebMarkupContainer projectNameContainer = new WebMarkupContainer("projectNameContainer");
            item.add(projectNameContainer);
            setProjectLabelWidth(projectNameContainer);

            Project project = projectStatus.getProjectAssignment().getProject();
            Label projectLabel = new Label("projectName", project.getName());
            projectLabel.setMarkupId(String.format("prjN%d", project.getProjectId()));
            projectLabel.setOutputMarkupId(true);
            projectNameContainer.add(projectLabel);

            String name = project.getCustomer().getName();
            Label customerLabel = new Label("customerName", name);
            createTitle(customerLabel, name);
            setCustomerLabelWidth(customerLabel);
            item.add(customerLabel);//from w w w  . ja  v  a  2  s .c  o  m

            String projectCode = project.getProjectCode();
            Label projectCodeLabel = new Label("projectCode", projectCode);
            createTitle(customerLabel, projectCode);
            projectCodeLabel.setMarkupId(String.format("prjC%d", project.getProjectId()));
            projectCodeLabel.setOutputMarkupId(true);
            item.add(projectCodeLabel);

            Float hourlyRate = projectStatus.getProjectAssignment().getHourlyRate();
            Label rateLabel = hourlyRate != null ? new CurrencyLabel("rate", hourlyRate)
                    : new Label("rate", "--");
            rateLabel.setEscapeModelStrings(false);
            setRateWidthOrHide(rateLabel);
            item.add(rateLabel);

            Number hours = projectStatus.getHours();

            item.add(new Label("monthHours", new Model<>(hours != null ? hours.floatValue() : 0f)));

            boolean billable = project.isBillable();
            Label turnOverLabel = billable
                    ? new CurrencyLabel("turnover", projectStatus.getTurnOver().floatValue())
                    : new Label("turnover", "--");
            setTurnoverWidthOrHide(turnOverLabel);

            item.add(turnOverLabel);

            // SummaryRow
            Component projectSummaryRow = createProjectSummaryRow(ID_SUMMARY_ROW, projectStatus);
            item.add(projectSummaryRow);

            item.add(createFoldLink(projectSummaryRow));
        }
    };

    container.add(view);
}

From source file:nl.knaw.dans.common.wicket.components.upload.EasyUpload.java

License:Apache License

protected void onBeforeRender() {
    super.onBeforeRender();
    if (uploadIFrame == null) {
        // the iframe should be attached to a page to be able to get its pagemap,
        // that's why i'm adding it in onBeforRender
        addUploadIFrame();/*from   w  ww  .  j a  v  a  2  s . c  om*/

        // use a 'component id'
        Label progress = new Label("uploadProgress", "");
        progress.setOutputMarkupId(true);
        progress.setMarkupId("uploadProgress" + "_" + getMarkupId());
        add(progress);
    }
}

From source file:org.headsupdev.agile.framework.error.ErrorInternalPage.java

License:Open Source License

public void layout() {
    super.layout();

    if (isUserError()) {
        userError = true;/*  w w  w . j  av a 2 s  . c  o  m*/
        WebMarkupContainer container = new WebMarkupContainer("userError");
        container.add(new BookmarkablePageLink("home", getApplication().getHomePage()));
        add(container);
        add(new Label("message", "Sorry"));

        add(new WebMarkupContainer("systemError").setVisible(false));
        return;
    }

    add(new WebMarkupContainer("userError").setVisible(false));
    add(new Label("message", "Oops!"));

    WebMarkupContainer container = new WebMarkupContainer("systemError");
    add(container);

    container.add(new Label("cause", new Model<String>() {
        @SuppressWarnings({ "ThrowableResultOfMethodCallIgnored" })
        public String getObject() {
            if (getError() == null) {
                return "unknown";
            }

            return getError().getMessage();
        }
    }));

    Label stack = new Label("stack", new Model<String>() {
        public String getObject() {
            return getStack();
        }
    });
    stack.setMarkupId("stacktrace");
    container.add(stack);

    WebMarkupContainer button = new WebMarkupContainer("debug");
    button.setMarkupId("debug");
    container.add(button);

    Animator animator = new Animator();
    animator.addCssStyleSubject(new MarkupIdModel(stack), "stackhidden", "stackshown");
    animator.attachTo(button, "onclick", Animator.Action.toggle());
}

From source file:org.sakaiproject.profile2.tool.pages.MyPictures.java

License:Educational Community License

private void createAddPictureForm(final String userUuid) {

    addPictureUploadFolder = new Folder(System.getProperty("java.io.tmpdir"), "addPicturesUploadFolder");
    addPictureUploadFolder.mkdirs();/*from  w ww  .j  a  v  a  2 s . c  o  m*/

    //file feedback will be redirected here
    final FeedbackPanel fileFeedback = new FeedbackPanel("fileFeedback");
    fileFeedback.setOutputMarkupId(true);

    Form addPictureForm = new FileUploadForm("form", userUuid, fileFeedback);
    addPictureForm.add(fileFeedback);
    addPictureForm.setOutputMarkupId(true);
    add(addPictureForm);

    Label invalidFileTypeMessageLabel = new Label("invalidFileTypeMessage",
            new ResourceModel("pictures.filetypewarning"));
    invalidFileTypeMessageLabel.setMarkupId("invalidFileTypeMessage");
    invalidFileTypeMessageLabel.setOutputMarkupId(true);
    addPictureForm.add(invalidFileTypeMessageLabel);

    WebMarkupContainer addPictureContainer = new WebMarkupContainer("addPictureContainer");
    addPictureContainer.add(new Label("addPictureLabel", new ResourceModel("pictures.addpicture")));

    addPictureContainer.add(new MultiFileUploadField("choosePicture",
            new PropertyModel<Collection<FileUpload>>(addPictureForm, "uploads"),
            ProfileConstants.MAX_GALLERY_FILE_UPLOADS));

    IndicatingAjaxButton submitButton = new IndicatingAjaxButton("submitPicture",
            new ResourceModel("button.gallery.upload")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            target.add(fileFeedback);
        }

        protected void onError(AjaxRequestTarget target, Form form) {
            log.debug("MyPictures.onSubmit validation failed.");
            target.add(fileFeedback);
        }

    };
    addPictureContainer.add(submitButton);

    addPictureContainer.add(new IconWithClueTip("galleryImageUploadToolTip", ProfileConstants.INFO_IMAGE,
            new StringResourceModel("text.gallery.upload.tooltip", null, new Object[] {
                    sakaiProxy.getMaxProfilePictureSize() * ProfileConstants.MAX_GALLERY_FILE_UPLOADS })));

    addPictureForm.add(addPictureContainer);

    addPictureFiles.addAll(Arrays.asList(addPictureUploadFolder.listFiles()));
    addPictureListView = new FileListView("fileList", addPictureFiles);
    addPictureForm.add(addPictureListView);
}