Example usage for java.text DateFormatSymbols DateFormatSymbols

List of usage examples for java.text DateFormatSymbols DateFormatSymbols

Introduction

In this page you can find the example usage for java.text DateFormatSymbols DateFormatSymbols.

Prototype

public DateFormatSymbols() 

Source Link

Document

Construct a DateFormatSymbols object by loading format data from resources for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:de.fahrgemeinschaft.util.ReoccuringWeekDaysView.java

public ReoccuringWeekDaysView(Context context, AttributeSet attrs) {
    super(context, attrs);
    clickable = attrs.getAttributeBooleanValue(android, CLICKABLE, true);
    String[] weekDays = new DateFormatSymbols().getShortWeekdays();
    for (int i = 2; i <= weekDays.length; i++) {
        TextView day = makeRecurringDayButton(getContext());
        day.setText(weekDays[i < weekDays.length ? i : 1].substring(0, 2));
        addView(day);/*w  ww  . j a  v  a2 s  .c  om*/
    }
    setFocusable(true);
}

From source file:com.tmendes.birthdaydroid.StatisticsFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_statistics, container, false);

    ctx = container.getContext();/*from w  ww .j  a  v  a 2s.  c  o m*/
    BirthDayDataList data = BirthDayDataList.getBirthDayDataList(this.ctx);
    DateFormatSymbols dfs = new DateFormatSymbols();

    int contactsCounter = data.getList().size();

    Map<Integer, Integer> ageStat = data.getAgeStats();
    Map<String, Integer> signStat = data.getSignStats();
    Map<Integer, Integer> monthStat = data.getMonthStats();
    Map<Integer, Integer> weekStat = data.getWeekStats();

    Button buttonAges = (Button) v.findViewById(R.id.buttonAges);
    Button buttonSign = (Button) v.findViewById(R.id.buttonSign);
    Button buttonMonth = (Button) v.findViewById(R.id.buttonMonth);
    Button buttonWeek = (Button) v.findViewById(R.id.buttonWeek);

    Iterator it;

    it = ageStat.entrySet().iterator();

    String dialogData = ctx.getResources().getString(R.string.statistics_contacts_counter, contactsCounter);

    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        int age = (int) pair.getKey();
        int number = (int) pair.getValue();
        dialogData += ctx.getResources().getString(R.string.statistics_int_int, number, age);
    }

    final String finalDialogDataAges = dialogData;
    buttonAges.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
            alertDialog.setTitle(ctx.getResources().getString(R.string.statistics_age_title));
            alertDialog.setMessage(finalDialogDataAges);
            alertDialog.show();
        }

    });

    it = signStat.entrySet().iterator();
    dialogData = ctx.getResources().getString(R.string.statistics_contacts_counter, contactsCounter);
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        String sign = (String) pair.getKey();
        int number = (int) pair.getValue();
        dialogData += ctx.getResources().getString(R.string.statistics_int_string, number, sign);
    }

    final String finalDialogDataSign = dialogData;
    buttonSign.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
            alertDialog.setTitle(ctx.getResources().getString(R.string.statistics_sign_title));
            alertDialog.setMessage(finalDialogDataSign);
            alertDialog.show();
        }

    });

    it = monthStat.entrySet().iterator();
    dialogData = ctx.getResources().getString(R.string.statistics_contacts_counter, contactsCounter);
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        int month = (int) pair.getKey();
        int number = (int) pair.getValue();
        dialogData += ctx.getResources().getString(R.string.statistics_int_string, number,
                dfs.getMonths()[month]);
    }

    final String finalDialogDataMonth = dialogData;
    buttonMonth.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
            alertDialog.setTitle(ctx.getResources().getString(R.string.statistics_month_title));
            alertDialog.setMessage(finalDialogDataMonth);
            alertDialog.show();
        }

    });

    it = weekStat.entrySet().iterator();
    dialogData = ctx.getResources().getString(R.string.statistics_contacts_counter, contactsCounter);
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        int week = (int) pair.getKey();
        int number = (int) pair.getValue();
        dialogData += ctx.getResources().getString(R.string.statistics_int_string, number,
                dfs.getWeekdays()[week]);
    }

    final String finalDialogDataWeek = dialogData;
    buttonWeek.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
            alertDialog.setTitle(ctx.getResources().getString(R.string.statistics_week_title));
            alertDialog.setMessage(finalDialogDataWeek);
            alertDialog.show();
        }

    });

    return v;

}

From source file:Main.java

public Main() {
    setSize(500, 340);//from w  w w  .j ava  2s.co m

    Date currentDate = new Date();
    calendar.setTime(currentDate);

    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(4, 1));

    JPanel p = new JPanel();
    p.setBorder(new TitledBorder(new EtchedBorder(), "Selected Date"));
    dateLabel = new JLabel(dateFormat.format(currentDate) + "     ");
    dateLabel.setFont(new Font("Arial", Font.BOLD, 24));
    p.add(dateLabel);
    p1.add(p);

    yearSlider.setPaintLabels(true);
    yearSlider.setMajorTickSpacing(5);
    yearSlider.setMinorTickSpacing(1);
    yearSlider.setPaintTicks(true);
    DateListener lst = new DateListener();
    yearSlider.addChangeListener(lst);

    p = new JPanel();
    p.setBorder(new TitledBorder(new EtchedBorder(), "Year"));
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p.add(yearSlider);
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p1.add(p);

    String[] months = (new DateFormatSymbols()).getShortMonths();
    hashTable = new Hashtable(12);
    for (int i = 0; i < 12; i++)
        hashTable.put(new Integer(i + 1), new JLabel(months[i], JLabel.CENTER));
    monthSlider.setLabelTable(hashTable);
    monthSlider.setPaintLabels(true);
    monthSlider.setMajorTickSpacing(1);
    monthSlider.setPaintTicks(true);
    monthSlider.addChangeListener(lst);

    p = new JPanel();
    p.setBorder(new TitledBorder(new EtchedBorder(), "Month"));
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p.add(monthSlider);
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p1.add(p);

    int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    daySlider = new JSlider(JSlider.HORIZONTAL, 1, maxDays, calendar.get(Calendar.DAY_OF_MONTH));
    daySlider.setPaintLabels(true);
    daySlider.setMajorTickSpacing(5);
    daySlider.setMinorTickSpacing(1);
    daySlider.setPaintTicks(true);
    daySlider.addChangeListener(lst);

    p = new JPanel();
    p.setBorder(new TitledBorder(new EtchedBorder(), "Day"));
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p.add(daySlider);
    p.add(Box.createRigidArea(RIGID_DIMENSION));
    p1.add(p);

    getContentPane().add(p1, BorderLayout.CENTER);

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    enableEvents(ComponentEvent.COMPONENT_RESIZED);
    setVisible(true);
}

From source file:be.ibridge.kettle.trans.step.xmlinput.XMLInputData.java

/**
 * //from   w ww  .  j  a va 2  s. c  o  m
 */
public XMLInputData() {
    super();

    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
}

From source file:org.pentaho.di.trans.steps.xmlinput.XMLInputData.java

public XMLInputData() {
    super();/*from w  w  w . jav  a  2 s  .c o m*/

    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
}

From source file:com.panet.imeta.trans.steps.propertyinput.PropertyInputData.java

/**
 * /*from   w  ww.  j  a  v a  2  s.  c om*/
 */
public PropertyInputData() {
    super();
    previousRow = null;
    thisline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    is = null;
    rw = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    readrow = null;
    pro = new Properties();
    it = null;
}

From source file:com.panet.imeta.trans.steps.getfilenames.GetFileNamesData.java

/**
 * // w  w w  . ja v  a 2 s.c  om
 */
public GetFileNamesData() {
    super();

    lineBuffer = new ArrayList<String>();
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previous_row = null;
    filenr = 0;
    filessize = 0;

    nrLinesOnPage = 0;

    fr = null;
    zi = null;
    file = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    indexOfWildcardField = -1;
    readrow = null;
    nrStepFields = 0;
}

From source file:com.panet.imeta.trans.steps.ldifinput.LDIFInputData.java

/**
 * /*  www .  j  a va  2s.c o m*/
 */
public LDIFInputData() {
    super();
    nrInputFields = -1;
    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
    InputLDIF = null;
    recordLDIF = null;
    multiValueSeparator = ",";
    totalpreviousfields = 0;
    readrow = null;
    indexOfFilenameField = -1;
}

From source file:com.codetroopers.betterpickers.radialtimepicker.AmPmCirclesView.java

public void initialize(Context context, int amOrPm) {
    if (mIsInitialized) {
        Log.e(TAG, "AmPmCirclesView may only be initialized once.");
        return;/*from w w  w .j  av  a 2  s  .  c o m*/
    }

    Resources res = context.getResources();
    mUnselectedColor = res.getColor(R.color.bpWhite);
    mSelectedColor = res.getColor(R.color.bpBlue);
    mAmPmTextColor = res.getColor(R.color.ampm_text_color);
    String typefaceFamily = res.getString(R.string.sans_serif);
    Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL);
    mPaint.setTypeface(tf);
    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Align.CENTER);

    mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.circle_radius_multiplier));
    mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    setAmOrPm(amOrPm);
    mAmOrPmPressed = -1;

    mIsInitialized = true;
}

From source file:org.pentaho.di.trans.steps.getfilenames.GetFileNamesData.java

public GetFileNamesData() {
    super();/*  ww  w . j  av a  2s.  c om*/

    lineBuffer = new ArrayList<String>();
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previous_row = null;
    filenr = 0;
    filessize = 0;

    nrLinesOnPage = 0;

    fr = null;
    zi = null;
    file = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    indexOfWildcardField = -1;
    readrow = null;
    nrStepFields = 0;
    indexOfExcludeWildcardField = -1;
}