Example usage for java.util Locale GERMANY

List of usage examples for java.util Locale GERMANY

Introduction

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

Prototype

Locale GERMANY

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

Click Source Link

Document

Useful constant for country.

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from ww w .  j a v a 2  s  . c o  m*/
@Test
public void testGetLastMillisecondWithCalendar() {
    Year y = new Year(2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(1009843199999L, y.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        y.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*w ww . ja  v a  2s . c o  m*/
public void testGetFirstMillisecondWithCalendar() {
    Month m = new Month(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*w ww. ja  v  a2s  . c om*/
public void testGetFirstMillisecondWithCalendar() {
    Day d = new Day(1, 12, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(1007164800000L, d.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */// w w w .  ja  va2s  .  c om
@Test
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(986083199999L, m.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///w w  w.ja v a2s .co m
public void testGetLastMillisecondWithCalendar() {
    Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550250L, m.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///w  ww. j  a v a2 s  . c  o m
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987890399999L, h.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///ww w.j  a  v  a  2  s  . co m
@Test
public void testGetLastMillisecondWithCalendar() {
    Quarter q = new Quarter(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(1001894399999L, q.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*  w ww. j  a  va2s .  c  om*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Week w = new Week(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, w.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        w.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */// w w w.  java 2  s .  c  om
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(986083199999L, m.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.polymap.wbv.ui.FlurstueckTableViewer.java

public FlurstueckTableViewer(PanelSite panelSite, Composite parent) {
    super(parent, /* SWT.VIRTUAL | SWT.V_SCROLL | SWT.FULL_SELECTION |*/ SWT.BORDER);
    this.panelSite = panelSite;
    IAppContext context = BatikApplication.instance().getContext();
    context.propagate(this);

    suppressSelection();//ww w .j  av  a 2s .c  om

    context.addListener(panelChangeListener, ev -> ev.getType().isOnOf(EventType.LIFECYCLE));

    // listen to column/field changes
    EventManager.instance().subscribe(this,
            ev -> ev instanceof PropertyChangeEvent && displayed.values().contains(ev.getSource()));

    try {
        // suppress deferred loading to fix "empty table" issue
        // setContent( fs.getFeatures( this.baseFilter ) );
        setContentProvider(new CompositesFeatureContentProvider());

        // Action: delete
        addColumn(new FormFeatureTableColumn(descriptorFor("", String.class)).setWeight(1, 25)
                .setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public Image getImage(Object elm) {
                        return WbvPlugin.images().svgImage("delete.svg", SvgImageRegistryHelper.NORMAL12);
                    }

                    @Override
                    public String getText(Object elm) {
                        return null;
                    }

                    @Override
                    public String getToolTipText(Object elm) {
                        return "Flurstck lschen";
                    }
                }).setEditing(new ActionCellEditor(elm -> {
                    assert wb.isPresent();
                    Flurstueck fst = FeatureTableElement.entity(elm);
                    fst.geloescht.set(true);
                    refresh();

                    flurstueckDeleted = true;
                    fieldChange(null);

                    // waldbesitzer lschen, wenn (wirklich) kein flurstck mehr da
                    if (wb.get().flurstuecke(null).isEmpty()) {
                        uow.get().removeEntity(wb.get());
                        panelSite.toolkit().createSnackbar(Appearance.FadeIn,
                                "Waldbesitzer wird beim Speichern <b>gelscht</b>!");
                    }
                })));

        // Action: transfer
        addColumn(new FormFeatureTableColumn(descriptorFor("", String.class)).setWeight(1, 30)
                .setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public Image getImage(Object elm) {
                        return WbvPlugin.images().svgImage("transfer.svg", SvgImageRegistryHelper.NORMAL12);
                    }

                    @Override
                    public String getText(Object elm) {
                        return null;
                    }

                    @Override
                    public String getToolTipText(Object elm) {
                        return "Eigentumsbergang: an einem anderen Waldbesitzer bertragen";
                    }
                }).setEditing(new ActionCellEditor(elm -> {
                    Flurstueck fst = FeatureTableElement.entity(elm);
                    selected.set(fst);

                    BatikApplication.instance().getContext().openPanel(panelSite.path(),
                            EigentumsuebergangPanel.ID);
                })));

        // Gemarkung
        String propName = Flurstueck.TYPE.gemarkung.info().getName();
        addColumn(new FormFeatureTableColumn(descriptorFor(propName, Gemarkung.class)).setWeight(6, 80)
                .setLabelsAndValidation(new DefaultTableValidator<Object, Gemarkung>() {
                    @Override
                    public Object transform2Field(Gemarkung gmk, ValidatorSite site) throws Exception {
                        if (site.isEditing()) {
                            return gmk;
                        } else {
                            //Flurstueck flst = FeatureTableElement.entity( site.element() );
                            String result = gmk != null ? gmk.label() : "-keine Gemarkung-"; //"WVK: " + flst.wvkGemarkung.get() + "/" + flst.wvkGemeinde.get();
                            return StringUtils.abbreviate(result, 30);
                        }
                    }

                    @Override
                    public Gemarkung transform2Model(Object fieldValue, ValidatorSite site) throws Exception {
                        return fieldValue != null ? uow.get().entity((Gemarkung) fieldValue) : null;
                    }
                }).setEditing(new PicklistFormField(Gemarkung.all.get()))
                .setSortable(new Comparator<IFeatureTableElement>() {
                    public int compare(IFeatureTableElement e1, IFeatureTableElement e2) {
                        return label(e1).compareTo(label(e2));
                    }

                    protected String label(IFeatureTableElement elm) {
                        Gemarkung gmk = (Gemarkung) elm.getValue(propName);
                        return gmk != null ? gmk.label() : "";
                    }
                })).sort(SWT.DOWN);

        // Flurstcksnummer
        addColumn(new FormFeatureTableColumn(descriptorFor(Flurstueck.TYPE.zaehlerNenner)).setWeight(3, 50)
                .setHeader("Nr.")
                .setLabelsAndValidation(AND(new NotEmptyValidator().forTable(), new AenderungValidator(),
                        new NummerValidator(), new FlurstueckExistsValidator()))
                .setEditing(new StringFormField()));

        // Flche
        NumberValidator flaecheValidator = new NumberValidator(Double.class, Locale.GERMANY, 10, 4, 1, 4);
        addColumn(new FormFeatureTableColumn(descriptorFor(Flurstueck.TYPE.flaeche)).setWeight(3, 50)
                .setHeader("Flche\n(in ha)")
                .setLabelsAndValidation(AND(flaecheValidator.forTable(), new AenderungValidator()))
                .setEditing(new StringFormField()).setSortable(true));

        // davon Wald
        addColumn(new FormFeatureTableColumn(descriptorFor(Flurstueck.TYPE.flaecheWald)).setWeight(3, 50)
                .setHeader("Wald\n(in ha)")
                .setLabelsAndValidation(
                        AND(new WaldflaecheValidator(flaecheValidator), new AenderungValidator()))
                .setEditing(new StringFormField()).setSortable(true));

        // nderungsdatum
        addColumn(new FormFeatureTableColumn(descriptorFor(Flurstueck.TYPE.aenderung)).setWeight(4, 80)
                .setHeader("nderung").setLabelsAndValidation(new DateValidator().forTable()));

        // Bemerkung
        FormFeatureTableColumn bcolumn = new FormFeatureTableColumn(descriptorFor(Flurstueck.TYPE.bemerkung));
        bcolumn.setWeight(11, 120);
        bcolumn.setLabelsAndValidation(new AenderungValidator());
        bcolumn.setEditing(new CellEditor() {
            private String value;
            private Text txt;

            @Override
            protected Control createControl(Composite _parent) {
                return null;
            }

            @Override
            protected void doSetFocus() {
            }

            @Override
            protected Object doGetValue() {
                return value;
            }

            @Override
            protected void doSetValue(Object newValue) {
                this.value = (String) newValue;
            }

            @Override
            public void activate() {
                Shell appShell = BatikApplication.shellToParentOn();
                new SimpleDialog().centerOn.put(appShell).title.put("Bemerkung").setContents(dialogParent -> {
                    dialogParent.setLayout(FormLayoutFactory.defaults().create());
                    txt = on(new Text(dialogParent, SWT.MULTI | SWT.WRAP | SWT.BORDER)).fill().width(350)
                            .height(150).control();
                    txt.setText(value != null ? value : "");
                    txt.setFocus();
                }).addOkAction("BERNEHMEN", () -> {
                    value = txt.getText();
                    fireApplyEditorValue();
                    EventManager.instance().publish(new PropertyChangeEvent(bcolumn, "bemerkung", value, null));
                    return null;
                }).addCancelAction("ABBRECHEN").open();
            }
        });
        addColumn(bcolumn);

        setInput(wb.get().flurstuecke(revier.get()));

        //            /* Register for property change events */
        //            EventManager.instance().subscribe( this, new EventFilter<PropertyChangeEvent>() {
        //                public boolean apply( PropertyChangeEvent input ) {
        //                    return input.getSource() instanceof Flurstueck;
        //                }
        //            });
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}