Codota Logo
ThreadLocalUserContext.getLocale
Code IndexAdd Codota to your IDE (free)

How to use
getLocale
method
in
org.projectforge.framework.persistence.user.api.ThreadLocalUserContext

Best Java code snippets using org.projectforge.framework.persistence.user.api.ThreadLocalUserContext.getLocale (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: micromata/projectforge

/**
 * @return the default locale of the system or the locale set by {@link #setLocale(Locale)}.
 * @see ExportContext#getLocale()
 */
public Locale getLocale()
{
 if (this.locale != null) {
  locale = ThreadLocalUserContext.getLocale();
 }
 return locale;
}
origin: micromata/projectforge

/**
 * Uses the scale of the BigDecimal. Uses the ThreadLocalUserContext locale.
 * @param value
 */
public static String format(final int value)
{
 final NumberFormat format = NumberFormat.getNumberInstance(ThreadLocalUserContext.getLocale());
 return format.format(value);
}
origin: micromata/projectforge

/**
 * Uses the locale of the context user.
 * @param value
 * @return 1,234.00 €
 * @see #format(BigDecimal, Locale)
 */
public static String format(final BigDecimal value)
{
 return format(value, ThreadLocalUserContext.getLocale());
}
origin: micromata/projectforge

public static Calendar getCalendar(TimeZone timeZone, Locale locale)
{
 if (locale == null) {
  locale = ThreadLocalUserContext.getLocale();
 }
 if (timeZone == null) {
  timeZone = ThreadLocalUserContext.getTimeZone();
 }
 return Calendar.getInstance(timeZone, locale);
}
origin: micromata/projectforge

/**
 * @return Short name of day represented by the giving day. The context user's locale and time zone is considered.
 */
public static final String formatShortNameOfDay(final Date date)
{
 final DateFormat df = new SimpleDateFormat("EE", ThreadLocalUserContext.getLocale());
 df.setTimeZone(ThreadLocalUserContext.getTimeZone());
 return df.format(date);
}
origin: micromata/projectforge

 public static String getLocalizedString(final String key)
 {
  return I18nHelper.getLocalizedMessage(getLocale(), key);
 }
}
origin: micromata/projectforge

/**
 * Uses {@link ThreadLocalUserContext#getLocale()} as locale.
 * @param s1
 * @param s2
 * @param asc
 * @return The result of {@link Collator#compare(String, String)}.
 * @see #compare(String, String, Locale)
 */
public int compare(final String s1, final String s2, final boolean asc)
{
 return compare(s1, s2, asc, ThreadLocalUserContext.getLocale());
}
origin: micromata/projectforge

/**
 * @see ThreadLocalUserContext#getLocale()
 */
public static String formatFraction2(final Number value)
{
 final Locale locale = ThreadLocalUserContext.getLocale();
 final NumberFormat format = getNumberFraction2Format(locale);
 return format.format(value);
}
origin: micromata/projectforge

/**
 * Uses the scale of the BigDecimal. Uses the ThreadLocalUserContext locale.
 * @param value
 */
public static String format(final BigDecimal value, final int scale)
{
 return format(value, scale, ThreadLocalUserContext.getLocale());
}
origin: micromata/projectforge

/**
 * Uses patternKey SHORT_DATE_FORMAT
 *
 * @param dateTime
 * @see #getFormattedDateTime(Object, String, Locale, TimeZone)
 */
public String getFormattedDate(final Object date)
{
 return getFormattedDate(date, ThreadLocalUserContext.getLocale(), ThreadLocalUserContext.getTimeZone());
}
origin: micromata/projectforge

/**
 * Gets the formatted time stamp with the context user's time zone and the internationalized pattern.
 *
 * @param dateTime
 * @param patternKey i18n key of the pattern
 */
public String getFormattedDateTime(final Date dateTime, final String pattern)
{
 return getFormattedDateTime(dateTime, pattern, ThreadLocalUserContext.getLocale(),
   ThreadLocalUserContext.getTimeZone());
}
origin: micromata/projectforge

/**
 * Gets the formatted date (without time of day) with the context user's time zone and the internationalized pattern.
 *
 * @param date
 * @param patternKey i18n key of the pattern
 */
public String getFormattedDate(final Object date, final String pattern)
{
 return getFormattedDate(date, pattern, ThreadLocalUserContext.getLocale(), ThreadLocalUserContext.getTimeZone());
}
origin: micromata/projectforge

/**
 * Sets or updates the locale of the user's session. Takes the locale of the user account or if not given the locale
 * of the given request.
 *
 * @param request
 */
public void setLocale(final Request request)
{
 setLocale(ThreadLocalUserContext.getLocale(request.getLocale()));
}
origin: micromata/projectforge

private ICalParser()
{
 this.parseVEvent = new ArrayList<>();
 // set user, timezone, locale
 this.user = ThreadLocalUserContext.getUser();
 this.timeZone = ThreadLocalUserContext.getTimeZone();
 this.locale = ThreadLocalUserContext.getLocale();
 this.reset();
}
origin: micromata/projectforge

private ICalGenerator()
{
 this.exportsVEvent = new ArrayList<>();
 // set user, timezone, locale
 this.user = ThreadLocalUserContext.getUser();
 this.timeZone = ThreadLocalUserContext.getTimeZone();
 this.locale = ThreadLocalUserContext.getLocale();
 this.reset();
}
origin: micromata/projectforge

@BeforeClass
public void setUp()
{
 Calendar c = Calendar.getInstance();
 c.setTimeZone(DateHelper.EUROPE_BERLIN);
 PowerMockito.mockStatic(ThreadLocalUserContext.class);
 PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(c.getTimeZone());
 PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(Locale.ENGLISH);
}
origin: micromata/projectforge

@BeforeMethod
public void setUp()
{
 Mockito.reset(teamEventDao);
 MockitoAnnotations.initMocks(this);
 mockStatic(ThreadLocalUserContext.class);
 mockStatic(ConfigXml.class);
 Locale locale = Locale.getDefault();
 TimeZone timeZone = TimeZone.getDefault();
 PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(locale);
 PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(timeZone);
}
origin: micromata/projectforge

public static LabelValueChoiceRenderer<UserPrefArea> createAreaChoiceRenderer(final Component parent)
{
 // DropDownChoice area
 final LabelValueChoiceRenderer<UserPrefArea> areaChoiceRenderer = new LabelValueChoiceRenderer<UserPrefArea>();
 for (final UserPrefArea area : UserPrefAreaRegistry.instance()
   .getOrderedEntries(ThreadLocalUserContext.getLocale())) {
  areaChoiceRenderer.addValue(area, parent.getString("userPref.area." + area.getKey()));
 }
 return areaChoiceRenderer;
}
origin: micromata/projectforge

@BeforeMethod
public void setUp()
{
 MockitoAnnotations.initMocks(this);
 mockStatic(ThreadLocalUserContext.class);
 mockStatic(ConfigXml.class);
 ConfigXml configXml = new ConfigXml("./target/Projectforge");
 PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(locale);
 PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(timeZone);
 PowerMockito.when(ConfigXml.getInstance()).thenReturn(configXml);
 systemService.setEnableVersionCheck(true);
}
origin: micromata/projectforge

public VersionCheck getVersionCheckInformations()
{
 Locale locale = ThreadLocalUserContext.getUser() != null && ThreadLocalUserContext.getUser().getLocale() != null ?
   ThreadLocalUserContext.getUser().getLocale() :
   ThreadLocalUserContext.getLocale();
 TimeZone timeZone = ThreadLocalUserContext.getUser() != null && ThreadLocalUserContext.getUser().getTimeZone() != null ?
   TimeZone.getTimeZone(ThreadLocalUserContext.getUser().getTimeZone()) :
   ThreadLocalUserContext.getTimeZone();
 VersionCheck versionCheck = new VersionCheck(AppVersion.VERSION.toString(), locale, timeZone);
 versionCheck = restCallService.callRestInterfaceForUrl(versionCheckUrl, HttpMethod.POST, VersionCheck.class, versionCheck);
 return versionCheck;
}
org.projectforge.framework.persistence.user.apiThreadLocalUserContextgetLocale

Popular methods of ThreadLocalUserContext

  • getUser
  • getLocalizedString
  • getTimeZone
  • getUserId
  • getDateTimeZone
  • setUser
    If given user is null, #clear() is called.
  • clear
  • getLocalizedMessage
  • getUserContext
  • setUserContext
  • getCalendarFirstDayOfWeek
    The first day of the week, configured at the given user, if not configured ConfigXml#getFirstDayOfWe
  • getJodaFirstDayOfWeek
  • getCalendarFirstDayOfWeek,
  • getJodaFirstDayOfWeek

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getSystemService (Context)
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JFrame (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now