Example usage for java.util Locale UK

List of usage examples for java.util Locale UK

Introduction

In this page you can find the example usage for java.util Locale UK.

Prototype

Locale UK

To view the source code for java.util Locale UK.

Click Source Link

Document

Useful constant for country.

Usage

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * Some checks for the getFirstMillisecond() method.
 *//*ww  w . j  av a2s.co  m*/
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Second s = new Second(15, 43, 15, 1, 4, 2006);
    assertEquals(1143902595000L, s.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:de.iteratec.iteraplan.xmi.XmiImport.java

/**
 * Creates the temporary user context to be able to import data.
 */// ww w.ja v  a 2  s. c om
private void createTempUserContext() {
    User user = new User();
    user.setLoginName("XmiImport");
    Set<Role> roles = Sets.newHashSet();

    Role role = new Role();
    role.setRoleName(Role.SUPERVISOR_ROLE_NAME);

    roles.add(role);

    UserContext userContext = new UserContext("XmiImport", roles, Locale.UK, user);
    UserContext.setCurrentUserContext(userContext);
}

From source file:org.jfree.data.time.HourTest.java

/**
 * Some checks for the getFirstMillisecond() method.
 *//* ww w .  j a  v a2 s  .c om*/
@Test
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Hour h = new Hour(15, 1, 4, 2006);
    assertEquals(1143900000000L, h.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.YearTest.java

/**
 * Some checks for the getFirstMillisecond() method.
 *//* ww  w .j  a v  a 2s  .co m*/
@Test
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Year y = new Year(1970);
    // TODO: Check this result...
    assertEquals(-3600000L, y.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.MinuteTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *///from   ww w  . ja  va  2 s.c  o m
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Minute m = new Minute(1, 1, 1, 1, 1970);
    assertEquals(119999L, m.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.SecondTest.java

/**
 * Some checks for the getLastMillisecond() method.
 *///from w w  w  . j  ava2  s  . c o m
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Second s = new Second(1, 1, 1, 1, 1, 1970);
    assertEquals(61999L, s.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:Utils.GenericUtils.java

public static String MicroTimestamp() {
    long startDate = System.currentTimeMillis();
    long startNanoseconds = System.nanoTime();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.UK);
    return dateFormat.format(startDate);
}

From source file:org.jfree.chart.demo.StackedXYAreaChartDemo.java

/**
 * Creates a chart.//w  w w  . ja  v a 2  s .  c om
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private JFreeChart createChart(final TableXYDataset dataset) {

    final StandardXYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("dd-MMM-yyyy", Locale.UK),
            NumberFormat.getInstance());
    final DateAxis xAxis = new DateAxis("Domain (X)");
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);

    final NumberAxis yAxis = new NumberAxis("Range (Y)");
    yAxis.setAutoRangeIncludesZero(true);
    final StackedXYAreaRenderer renderer = new StackedXYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES,
            toolTipGenerator, null);
    renderer.setOutline(true);
    renderer.setSeriesPaint(0, new Color(255, 255, 206));
    renderer.setSeriesPaint(1, new Color(206, 230, 255));
    renderer.setSeriesPaint(2, new Color(255, 230, 230));
    renderer.setShapePaint(Color.gray);
    renderer.setShapeStroke(new BasicStroke(0.5f));
    renderer.setShape(new Ellipse2D.Double(-3, -3, 6, 6));
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

    final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    return chart;
}

From source file:Utils.GenericUtils.java

public static String getCurrentTime() {
    long startDate = System.currentTimeMillis();
    long startNanoseconds = System.nanoTime();
    SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.UK);
    return dateFormat.format(startDate);
}

From source file:custom.application.search.java

public Object query(String query) throws ApplicationException {
    StringBuffer html = new StringBuffer();
    String[] keywords;//from www  .j a  v a 2  s.  c  om

    int page = 1, pageSize = 20;

    this.request = (HttpServletRequest) this.context.getAttribute("HTTP_REQUEST");
    if (this.request.getParameter("page") == null
            || this.request.getParameter("page").toString().trim().length() <= 0) {
        page = 1;
    } else {
        page = Integer.parseInt(this.request.getParameter("page").toString());
    }

    int startIndex = (page - 1) * pageSize;

    if (query.trim().length() > 0) {
        query = StringUtilities.htmlSpecialChars(query);

        keywords = query.split(" ");

        this.setVariable("keyword", query);
        this.setVariable("search.title", query + " - ");
    } else {
        this.setVariable("keyword", "");
        return this;
    }

    StringBuffer condition = new StringBuffer();
    int i = 0, j, k = 0;
    while (i < keywords.length) {
        if (condition.length() == 0) {
            condition.append(" bible.content like '%" + keywords[i] + "%' ");
        } else {
            condition.append(" AND bible.content like '%" + keywords[i] + "%' ");
            /*if(true)
               condition.append(" AND bible.content like '%"+keywords[i]+"%' ");
            else
               condition.append(" OR bible.content like '%"+keywords[i]+"%' ");*/
        }

        i++;
    }

    Locale locale = this.getLocale();
    if (condition.length() == 0)
        condition.append(" book.language='" + locale + "' ");
    else
        condition.append(" AND book.language='" + locale + "' ");

    book book = new book();
    bible bible = new bible();
    if (locale.toString().equalsIgnoreCase(Locale.US.toString())) {
        bible.setTableName("NIV");
    } else if (locale.toString().equalsIgnoreCase(Locale.UK.toString())) {
        bible.setTableName("ESV");
    } else {
        bible.setTableName(locale.toString());
    }

    String SQL = "SELECT bible.*,book.book_name FROM " + bible.getTableName() + " as bible left join "
            + book.getTableName() + " as book on bible.book_id=book.book_id where " + condition
            + " order by bible.book_id,bible.chapter_id limit " + startIndex + "," + pageSize;
    String look = "SELECT count(bible.id) AS size FROM " + bible.getTableName() + " as bible left join "
            + book.getTableName() + " as book on bible.book_id=book.book_id where " + condition;

    Table vtable = bible.find(SQL, new Object[] {});
    boolean noResult = vtable.size() > 0;

    if (!noResult) {
        try {
            Table list = book.findWith("WHERE language=? and book_name=?",
                    new Object[] { this.getLocale().toString(), query });
            if (list.size() > 0) {
                this.response = (HttpServletResponse) this.context.getAttribute("HTTP_RESPONSE");

                Reforward reforward = new Reforward(request, response);
                query = URLEncoder.encode(query, "utf-8");
                reforward.setDefault(this.context.getAttribute("HTTP_HOST") + query);
                reforward.forward();
                return reforward;
            }

        } catch (ApplicationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    Row found = bible.findOne(look, new Object[] {});

    long startTime = System.currentTimeMillis();
    Pager pager = new Pager();
    pager.setPageSize(pageSize);
    pager.setCurrentPage(page);
    pager.setListSize(found.getFieldInfo("size").intValue());

    Field field;
    int next = pager.getStartIndex();//????ID

    html.append("<ol class=\"searchresults\" start=\"" + next + "\">\r\n");

    String finded, word;
    Row row;
    Enumeration<Row> table = vtable.elements();
    int n = 0;
    while (table.hasMoreElements()) {
        row = table.nextElement();
        Iterator<Field> iterator = row.iterator();

        n++;
        while (iterator.hasNext()) {
            field = iterator.next();
            finded = field.get("content").value().toString();

            j = 0;
            while (j < keywords.length) {
                finded = StringUtilities.sign(finded, keywords[j++]);
            }

            html.append("<li" + (n % 2 == 0 ? " class=\"even\"" : " class=\"odd\"") + "><a href=\""
                    + this.context.getAttribute("HTTP_HOST") + "bible/"
                    + field.get("book_id").value().toString() + "/" + field.get("chapter_id").value().toString()
                    + "/" + field.get("part_id").value().toString() + "\" target=\"_blank\">"
                    + this.setText("search.bible.info", field.get("book_name").value().toString(),
                            field.get("chapter_id").value().toString(), field.get("part_id").value().toString())
                    + "</a><p>" + finded + "</p></li> \r\n");
            next++;
        }
    }

    Table ktable;
    Row krow;
    while (k < keywords.length && noResult) {
        word = keywords[k++];
        keyword keyword = new keyword();
        keyword.setKeyword(word);
        ktable = keyword.setRequestFields("id,visit").findWith("WHERE keyword=?", new Object[] { word });

        if (ktable.size() == 0) {
            keyword.setVisit(0);
            keyword.append();
        } else {
            krow = ktable.get(0);
            keyword.setId(krow.getFieldInfo("id").value());
            keyword.setVisit(krow.getFieldInfo("visit").intValue() + 1);
            keyword.update();
        }
    }
    html.append("</ol>\r\n");

    String actionURL = this.context.getAttribute("HTTP_HOST") + "bible/search/" + query + "&page";
    pager.setFirstPageText(this.getProperty("page.first.text"));
    pager.setLastPageText(this.getProperty("page.last.text"));
    pager.setCurrentPageText(this.getProperty("page.current.text"));
    pager.setNextPageText(this.getProperty("page.next.text"));
    pager.setEndPageText(this.getProperty("page.end.text"));
    pager.setControlBarText(this.getProperty("page.controlbar.text"));

    html.append("<div class=\"pagination\" style=\"cursor:default\">" + pager.getPageControlBar(actionURL)
            + "</div>\r\n");
    html.append("<!-- " + String.valueOf(System.currentTimeMillis() - startTime) + " -->");

    int start = page - 1 == 0 ? 1 : (page - 1) * pageSize + 1, end = page * pageSize;

    this.setVariable("start", String.valueOf(start));
    this.setVariable("end", String.valueOf(end));
    this.setVariable("size", String.valueOf(pager.getSize()));
    this.setVariable("value", html.toString());
    this.setVariable("action",
            this.config.get("default.base_url") + this.context.getAttribute("REQUEST_ACTION").toString());

    this.setText("search.info", start, end, query, pager.getSize());

    HttpSession session = request.getSession();
    if (session.getAttribute("usr") != null) {
        this.usr = (User) session.getAttribute("usr");

        this.setVariable("user.status", "");
        this.setVariable("user.profile",
                "<a href=\"javascript:void(0)\" onmousedown=\"profileMenu.show(event,'1')\">"
                        + this.usr.getEmail() + "</a>");
    } else {
        this.setVariable("user.status", "<a href=\"" + this.getLink("user/login") + "\">"
                + this.getProperty("page.login.caption") + "</a>");
        this.setVariable("user.profile", "");
    }

    return this;
}