Example usage for org.apache.wicket Component getString

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

Introduction

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

Prototype

public final String getString(final String key) 

Source Link

Usage

From source file:com.gitblit.wicket.WicketUtils.java

License:Apache License

public static ContextImage getRegistrationImage(String wicketId, FederationModel registration, Component c) {
    if (registration.isResultData()) {
        return WicketUtils.newImage(wicketId, "information_16x16.png", c.getString("gb.federationResults"));
    } else {//from www.j a  v  a  2  s.c om
        return WicketUtils.newImage(wicketId, "arrow_left.png", c.getString("gb.federationRegistration"));
    }
}

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

License:Open Source License

/**
 * //w  w w  .j a v a  2s .c  o  m
 * @param component
 * @param script
 * @return
 */
private static Map<String, String> buildMap(final Component component, final String script) {
    Map<String, String> result = new HashMap<String, String>();
    result.put("NO_CONTEXTMENU_INDICATOR", NO_CONTEXTMENU_INDICATOR);
    result.put("ORIGINAL_CALLBACK", script);
    result.put("MOVE_SAVE", component.getString(MOVE_SAVE));
    result.put("MOVE_SAVE_TARGET", CalendarDropMode.MOVE_SAVE.getAjaxTarget());
    result.put("MOVE_EDIT", component.getString(MOVE_EDIT));
    result.put("MOVE_EDIT_TARGET", CalendarDropMode.MOVE_EDIT.getAjaxTarget());
    result.put("COPY_SAVE", component.getString(COPY_SAVE));
    result.put("COPY_SAVE_TARGET", CalendarDropMode.COPY_SAVE.getAjaxTarget());
    result.put("COPY_EDIT", component.getString(COPY_EDIT));
    result.put("COPY_EDIT_TARGET", CalendarDropMode.COPY_EDIT.getAjaxTarget());
    result.put("CANCEL", component.getString(CANCEL));
    result.put("NONE_TARGET", CalendarDropMode.MOVE_EDIT.getAjaxTarget());
    return result;
}

From source file:nl.knaw.dans.common.wicket.WicketUtil.java

License:Apache License

public static String commonMessage(Component reporter, final String messageKey, final int type,
        final String... param) {
    String propertyMessage;/*from  w w w.  j  a  va  2 s  . co m*/
    if (reporter != null)
        propertyMessage = reporter.getString(messageKey);
    else
        propertyMessage = (String) new ResourceModel(messageKey).getObject();

    if (param != null && param.length > 0) {
        for (int i = 0; i < param.length; i++) {
            if (param[i] != null)
                propertyMessage = propertyMessage.replace("$" + (i + 1), param[i]);
        }
    }

    final String message = getDisplayedMessage(propertyMessage, type);

    Session.get().getFeedbackMessages().add(reporter, message, type);
    Session.get().dirty();

    return propertyMessage;
}

From source file:org.apache.syncope.client.console.commons.Constants.java

License:Apache License

public static Component getJEXLPopover(final Component caller, final TooltipConfig.Placement placement) {
    return new Label("jexlInfo", Model.of()).add(new PopoverBehavior(Model.<String>of(),
            Model.of(caller.getString("jexl_info") + "<ul>" + "<li>" + caller.getString("jexl_ex1") + "</li>"
                    + "<li>" + caller.getString("jexl_ex2") + "</li>" + "</ul>"
                    + "<a href='https://commons.apache.org/proper/commons-jexl/reference/index.html' "
                    + "target='_blank'>" + caller.getString("jexl_syntax_url") + "</a>"),
            new PopoverConfig().withHtml(true).withPlacement(placement)) {

        private static final long serialVersionUID = -7867802555691605021L;

        @Override//ww  w .j ava2s .  c o  m
        protected String createRelAttribute() {
            return "jexlInfo";
        }
    });
}

From source file:org.projectforge.web.mobile.MenuMobilePage.java

License:Open Source License

/**
 * Returns a link to this the menu mobile page. It should be shown directly instead of restoring last page after stay-logged-in .
 *///w  ww . j  av a2s. com
public static JQueryButtonPanel getHomeLink(final Component parent, final String id) {
    final PageParameters params = new PageParameters();
    params.add(PARAM_HOME_KEY, true);
    return new JQueryButtonPanel(id, JQueryButtonType.HOME, MenuMobilePage.class, params,
            parent.getString("mobile.home")).setNoText();
}

From source file:org.projectforge.web.task.TaskListPage.java

License:Open Source License

/**
 * //  w w w . ja v a 2s  .  c  o  m
 * @param parentComponent Needed for call parentComponent.getString(String) for i18n.
 * @param componentId
 * @param taskTree
 * @param selectMode
 * @param node
 * @return
 */
public static ConsumptionBarPanel getConsumptionBarPanel(final Component parentComponent,
        final String componentId, final TaskTree taskTree, final boolean selectMode, final TaskNode node) {
    Integer maxHours = null;
    Integer taskId = null;
    boolean finished = false;
    if (node != null) {
        maxHours = node.getTask().getMaxHours();
        taskId = node.getTaskId();
        finished = node.isFinished();
    }
    final BigDecimal maxDays;
    if (maxHours != null && maxHours.intValue() == 0) {
        maxDays = null;
    } else {
        maxDays = NumberHelper.setDefaultScale(taskTree.getPersonDays(node));
    }
    BigDecimal usage = (node != null) ? new BigDecimal(node.getDuration(taskTree, true))
            .divide(DateHelper.SECONDS_PER_WORKING_DAY, 2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO;
    usage = NumberHelper.setDefaultScale(usage);
    final ConsumptionBarPanel panel = new ConsumptionBarPanel(componentId, usage, maxDays, taskId, finished,
            parentComponent.getString("projectmanagement.personDays.short"), selectMode == false);
    return panel;
}

From source file:org.projectforge.web.user.UserPrefEditForm.java

License:Open Source License

public static LabelValueChoiceRenderer<UserPrefArea> createAreaChoiceRenderer(final Component parent) {
    // DropDownChoice area
    final LabelValueChoiceRenderer<UserPrefArea> areaChoiceRenderer = new LabelValueChoiceRenderer<UserPrefArea>();
    for (final UserPrefArea area : UserPrefAreaRegistry.instance()
            .getOrderedEntries(PFUserContext.getLocale())) {
        areaChoiceRenderer.addValue(area, parent.getString("userPref.area." + area.getKey()));
    }/*from  ww w . ja v a 2s.c om*/
    return areaChoiceRenderer;
}

From source file:org.projectforge.web.wicket.AbstractListForm.java

License:Open Source License

/**
 * For displaying the modified search string for lucene, e. g. "modified searchstring: micromata*"
 * @param component Needed for {@link Component#getString(String)}.
 * @param searchString/* w w w.j a  v a  2  s . c o  m*/
 * @return
 */
public static String getModifiedSearchExpressionLabel(final Component component, final String searchString) {
    return component.getString("search.lucene.expression") + " "
            + StringEscapeUtils.escapeHtml(BaseDao.modifySearchString(searchString));
}

From source file:org.projectforge.web.wicket.components.LabelValueChoiceRenderer.java

License:Open Source License

/**
 * Creates already entries from the given enum. Works only if T is from type I18nEnum.
 * @param parent Only needed for internationalization.
 * @param i18nEnum if not enum and not from type T a class cast exception will be thrown.
 * @see Component#getString(String)/*from   w  w  w. ja va2 s  .  c  o  m*/
 */
@SuppressWarnings("unchecked")
public LabelValueChoiceRenderer(final Component parent, final I18nEnum[] values) {
    this();
    for (final I18nEnum value : values) {
        addValue((T) value, parent.getString(value.getI18nKey()));
    }
}

From source file:org.projectforge.web.wicket.flowlayout.FieldsetPanel.java

License:Open Source License

private static String getString(final Component parent, final String label, final boolean translate) {
    if (translate == false || label == null) {
        return label;
    }//from  w  w  w. j av  a 2  s  .c om
    return parent.getString(label);
}