Example usage for org.apache.wicket.util.collections MicroMap MicroMap

List of usage examples for org.apache.wicket.util.collections MicroMap MicroMap

Introduction

In this page you can find the example usage for org.apache.wicket.util.collections MicroMap MicroMap.

Prototype

public MicroMap(final K key, final V value) 

Source Link

Document

Constructs map with a single key and value pair.

Usage

From source file:com.doculibre.constellio.wicket.panels.admin.connector.ConnectorListPanel.java

License:Open Source License

@Override
protected IModel getTitleModel() {
    return new LoadableDetachableModel() {
        @Override/*from   w w w .jav  a 2  s  .  c o  m*/
        protected Object load() {
            AdminCollectionPanel collectionAdminPanel = (AdminCollectionPanel) findParent(
                    AdminCollectionPanel.class);
            RecordCollection collection = collectionAdminPanel.getCollection();
            Locale displayLocale = collection.getDisplayLocale(getLocale());
            String title = MapVariableInterpolator.interpolate(
                    getLocalizer().getString("panelTitle", ConnectorListPanel.this),
                    new MicroMap("collectionName", collection.getTitle(displayLocale)));
            return title;
        }
    };
}

From source file:net.ftlines.wicket.fullcalendar.callback.BlockingDecorator.java

License:Apache License

public CharSequence decorateScript(Component component, CharSequence script) {
    switch (callback.getCalendar().getAjaxConcurrency()) {
    case QUEUE:/*from  w  w w. j  ava2s  .  c  o  m*/
        return script;
    case DROP_PER_CALLBACK:
    case DROP:
        return new MapVariableInterpolator(template, new MicroMap<String, String>("var", var())).toString()
                + script;

    default:
        throw new IllegalStateException();
    }
}

From source file:net.ftlines.wicket.fullcalendar.callback.GetEventsCallback.java

License:Apache License

public String getUrl(EventSource source) {
    return getUrl(new MicroMap<String, Object>(SOURCE_ID, source.getUuid()));
}

From source file:net.ftlines.wicket.fullcalendar.FullCalendar.java

License:Apache License

@SuppressWarnings("serial")
private void setupCallbacks() {

    if (getEvents != null)
        return;// www.  ja v a2 s  .co  m

    getEvents = new GetEventsCallback();
    add(getEvents);
    for (final EventSource source : config.getEventSources()) {
        source.setEventsModel(new AbstractReadOnlyModel<String>() {
            @Override
            public String getObject() {
                return EVENTS.asString(new MicroMap<String, String>("url", getEvents.getUrl(source)));
            }
        });
    }

    if (Strings.isEmpty(config.getEventClick()) == true) {
        add(eventClicked = new EventClickedCallback() {
            @Override
            protected void onClicked(final ClickedEvent event, final CalendarResponse response) {
                onEventClicked(event, response);
            }
        });
        config.setEventClickModel(eventClicked.getHandlerScript());
    }

    if (Strings.isEmpty(config.getSelect()) == true) {
        add(dateRangeSelected = new DateRangeSelectedCallback(config.isIgnoreTimezone()) {
            @Override
            protected void onSelect(final SelectedRange range, final CalendarResponse response) {
                FullCalendar.this.onDateRangeSelected(range, response);
            }
        });
        config.setSelectModel(dateRangeSelected.getHandlerScript());
    }

    if (Strings.isEmpty(config.getEventDrop()) == true) {
        add(eventDropped = new EventDroppedCallback(config) {

            @Override
            protected boolean onEventDropped(final DroppedEvent event, final CalendarResponse response) {
                return FullCalendar.this.onEventDropped(event, response);
            }
        });
        config.setEventDropModel(eventDropped.getHandlerScript());
    }

    if (Strings.isEmpty(config.getEventResize()) == true) {
        add(eventResized = new EventResizedCallback() {

            @Override
            protected boolean onEventResized(final ResizedEvent event, final CalendarResponse response) {
                return FullCalendar.this.onEventResized(event, response);
            }

        });

        config.setEventResizeModel(eventResized.getHandlerScript());
    }

    if (Strings.isEmpty(config.getViewDisplay()) == true) {
        add(viewDisplay = new ViewDisplayCallback() {
            @Override
            protected void onViewDisplayed(final View view, final CalendarResponse response) {
                FullCalendar.this.onViewDisplayed(view, response);
            }
        });
        config.setViewDisplayModel(viewDisplay.getHandlerScript());
    }

    getPage().dirty();
}

From source file:org.apache.openmeetings.core.util.StrongPasswordValidator.java

License:Apache License

@Override
public void validate(IValidatable<String> pass) {
    if (badLength(pass.getValue())) {
        error(pass, "bad.password.short", new MicroMap<String, Object>("0", getMinPasswdLength()));
    }/* ww  w  .j  a va2  s .  co m*/
    if (noLowerCase(pass.getValue())) {
        error(pass, "bad.password.lower");
    }
    if (noUpperCase(pass.getValue())) {
        error(pass, "bad.password.upper");
    }
    if (noDigit(pass.getValue())) {
        error(pass, "bad.password.digit");
    }
    if (noSymbol(pass.getValue())) {
        error(pass, "bad.password.special");
    }
    if (hasStopWords(pass.getValue())) {
        error(pass, "bad.password.stop");
    }
}

From source file:org.apache.openmeetings.web.user.calendar.CalendarFunctionsBehavior.java

License:Apache License

private IModel<Map<String, Object>> newResourceModel() {
    return Model.ofMap(new MicroMap<String, Object>("markupId", this.markupId));
}

From source file:org.bindgen.wicket.phonebook.web.page.DeleteContactPage.java

License:Apache License

private void addConfimButton() {
    /*/* w w  w .  java 2  s  .co  m*/
     * notice in mark-up this link is attached to <input type='button'/>
     * tag, the link is smart enough to know to generate an onclick instead
     * of href
     */
    Link<String> confirmLink = new Link<String>("confirm") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            final Contact deleted = getContact();
            contactDao.delete(deleted.getId());
            String msg = MapVariableInterpolator.interpolate(getLocalizer().getString("status.deleted", this),
                    new MicroMap<String, String>("name", deleted.getFullName()));
            getSession().info(msg);
            setResponsePage(DeleteContactPage.this.backPage);
        }
    };
    confirmLink.add(new AttributeModifier("value", true, new ResourceModel("confirm")));
    add(confirmLink);
}

From source file:org.bindgen.wicket.phonebook.web.page.DeleteContactPage.java

License:Apache License

private void addCancelButton() {
    Link<String> cancelLink = new Link<String>("cancel") {
        private static final long serialVersionUID = 1L;

        @Override//from w  w w  . java  2 s. c o  m
        public void onClick() {
            String msg = MapVariableInterpolator.interpolate(getLocalizer().getString("status.cancelled", this),
                    new MicroMap<String, String>("name", getContact().getFullName()));
            getSession().info(msg);
            setResponsePage(DeleteContactPage.this.backPage);
        }
    };
    cancelLink.add(new AttributeModifier("value", true, new ResourceModel("cancel")));
    add(cancelLink);
}

From source file:org.bindgen.wicket.phonebook.web.page.EditContactPage.java

License:Apache License

private void onSave() {
    contactDao.save(contact);//from  www. j  ava2s . c  o m
    String msg = MapVariableInterpolator.interpolate(getLocalizer().getString("status.save", this),
            new MicroMap<String, String>("name", contact.getFullName()));
    getSession().info(msg);
    setResponsePage(EditContactPage.this.backPage);
}

From source file:org.brixcms.plugin.site.resource.managers.text.CreateTextResourcePanel.java

License:Apache License

public CreateTextResourcePanel(String id, IModel<BrixNode> container, final SimpleCallback back) {
    super(id, container);

    add(new FeedbackPanel("feedback"));

    Form<?> form = new Form<Void>("form");
    add(form);/*w  w  w.  java 2 s.  c  o m*/

    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"));
            SitePlugin.get().selectNode(this, resource, true);
        }
    });

    form.add(new Link<Void>("cancel") {
        @Override
        public void onClick() {
            getSession().info(getString("cancelled"));
            back.execute();
        }
    });
}