Java Code Examples for java.text.DateFormat#getInstance()
The following examples show how to use
java.text.DateFormat#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XAxisDynamicRenderer.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected DateFormat createFormatInstance ( final long timeRange ) { if ( hasFormat () ) { try { return new SimpleDateFormat ( this.format ); } catch ( final IllegalArgumentException e ) { return DateFormat.getInstance (); } } else { return Helper.makeFormat ( timeRange ); } }
Example 2
Source File: DateFormatTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * @tests java.text.DateFormat#clone() */ public void test_clone() { DateFormat format = DateFormat.getInstance(); DateFormat clone = (DateFormat) format.clone(); assertTrue("Clone not equal", format.equals(clone)); clone.getNumberFormat().setMinimumFractionDigits(123); assertTrue("Clone shares NumberFormat", !format.equals(clone)); }
Example 3
Source File: IntervalCategoryToolTipGeneratorTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryToolTipGenerator g1 = new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryToolTipGenerator g2 = (IntervalCategoryToolTipGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 4
Source File: IntervalCategoryToolTipGeneratorTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryToolTipGenerator g1 = new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryToolTipGenerator g2 = (IntervalCategoryToolTipGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 5
Source File: IntervalCategoryItemLabelGeneratorTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryItemLabelGenerator g2 = (IntervalCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 6
Source File: IntervalCategoryToolTipGeneratorTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryToolTipGenerator g1 = new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryToolTipGenerator g2 = (IntervalCategoryToolTipGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 7
Source File: StandardCategoryItemLabelGeneratorTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { StandardCategoryItemLabelGenerator g1 = new StandardCategoryItemLabelGenerator("{2}", DateFormat.getInstance()); StandardCategoryItemLabelGenerator g2 = (StandardCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 8
Source File: StandardCategoryToolTipGeneratorTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { StandardCategoryToolTipGenerator g1 = new StandardCategoryToolTipGenerator("{2}", DateFormat.getInstance()); StandardCategoryToolTipGenerator g2 = (StandardCategoryToolTipGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 9
Source File: IntervalCategoryItemLabelGeneratorTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryItemLabelGenerator g2 = (IntervalCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 10
Source File: IntervalCategoryItemLabelGeneratorTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryItemLabelGenerator g2 = (IntervalCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 11
Source File: IntervalCategoryItemLabelGeneratorTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator("{3} - {4}", DateFormat.getInstance()); IntervalCategoryItemLabelGenerator g2 = (IntervalCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 12
Source File: StandardCategoryItemLabelGeneratorTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { StandardCategoryItemLabelGenerator g1 = new StandardCategoryItemLabelGenerator("{2}", DateFormat.getInstance()); StandardCategoryItemLabelGenerator g2 = (StandardCategoryItemLabelGenerator) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 13
Source File: StandardXYItemLabelGeneratorTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { StandardXYItemLabelGenerator g1 = new StandardXYItemLabelGenerator(); StandardXYItemLabelGenerator g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getXFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); g1.getYFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getYFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); // another test... g1 = new StandardXYItemLabelGenerator("{0} {1} {2}", DateFormat.getInstance(), DateFormat.getInstance()); g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); g1.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); }
Example 14
Source File: StandardXYItemLabelGeneratorTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { StandardXYItemLabelGenerator g1 = new StandardXYItemLabelGenerator(); StandardXYItemLabelGenerator g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getXFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); g1.getYFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getYFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); // another test... g1 = new StandardXYItemLabelGenerator("{0} {1} {2}", DateFormat.getInstance(), DateFormat.getInstance()); g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); g1.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); }
Example 15
Source File: StandardXYItemLabelGeneratorTest.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { StandardXYItemLabelGenerator g1 = new StandardXYItemLabelGenerator(); StandardXYItemLabelGenerator g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getXFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); g1.getYFormat().setMinimumIntegerDigits(2); assertFalse(g1.equals(g2)); g2.getYFormat().setMinimumIntegerDigits(2); assertTrue(g1.equals(g2)); // another test... g1 = new StandardXYItemLabelGenerator("{0} {1} {2}", DateFormat.getInstance(), DateFormat.getInstance()); g2 = (StandardXYItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getXDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); g1.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertFalse(g1.equals(g2)); g2.getYDateFormat().setNumberFormat(new DecimalFormat("0.000")); assertTrue(g1.equals(g2)); }
Example 16
Source File: HighLowItemLabelGenerator.java From SIMVA-SoS with Apache License 2.0 | 2 votes |
/** * Creates an item label generator using the default date and number * formats. */ public HighLowItemLabelGenerator() { this(DateFormat.getInstance(), NumberFormat.getInstance()); }
Example 17
Source File: HighLowItemLabelGenerator.java From buffer_bci with GNU General Public License v3.0 | 2 votes |
/** * Creates an item label generator using the default date and number * formats. */ public HighLowItemLabelGenerator() { this(DateFormat.getInstance(), NumberFormat.getInstance()); }
Example 18
Source File: StandardXYToolTipGenerator.java From SIMVA-SoS with Apache License 2.0 | 2 votes |
/** * Returns a tool tip generator that formats the x-values as dates and the * y-values as numbers. * * @return A tool tip generator (never <code>null</code>). */ public static StandardXYToolTipGenerator getTimeSeriesInstance() { return new StandardXYToolTipGenerator(DEFAULT_TOOL_TIP_FORMAT, DateFormat.getInstance(), NumberFormat.getInstance()); }
Example 19
Source File: HighLowItemLabelGenerator.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Creates an item label generator using the default date and number * formats. */ public HighLowItemLabelGenerator() { this(DateFormat.getInstance(), NumberFormat.getInstance()); }
Example 20
Source File: StandardXYToolTipGenerator.java From opensim-gui with Apache License 2.0 | 2 votes |
/** * Returns a tool tip generator that formats the x-values as dates and the * y-values as numbers. * * @return A tool tip generator (never <code>null</code>). */ public static StandardXYToolTipGenerator getTimeSeriesInstance() { return new StandardXYToolTipGenerator(DEFAULT_TOOL_TIP_FORMAT, DateFormat.getInstance(), NumberFormat.getInstance()); }