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:be.ibridge.kettle.trans.step.textfileinput.TextFileInputData.java

/**
 * // w  ww .j ava2s .  c  o m
 */
public TextFileInputData() {
    super();

    thisline = null;
    nextline = null;

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

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

    nrLinesOnPage = 0;

    fr = null;
    zi = null;

    filterProcessor = null;
}

From source file:org.pentaho.di.trans.steps.propertyinput.PropertyInputData.java

public PropertyInputData() {
    super();//from  w  ww .j a v  a2s .c om
    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 = null;
    it = null;
    iniSection = null;
    wini = null;
    itSection = null;
    realEncoding = null;
    realSection = null;
    propfiles = true;
    iniIt = null;
}

From source file:org.pentaho.di.trans.steps.ldifinput.LDIFInputData.java

public LDIFInputData() {
    super();//from  w ww .j av a2s . c  o m
    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.panet.imeta.trans.steps.getxmldata.GetXMLDataData.java

/**
 * //w ww.jav  a 2  s .co m
 */
public GetXMLDataData() {
    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;
    is = null;
    indexOfXmlField = -1;

    nrInputFields = -1;
    PathValue = null;
    tokenStart = "@_";
    tokenEnd = "-";
    nodenr = 0;
    nodesize = 0;
    an = null;
    readrow = null;
    totalpreviousfields = 0;
    prunePath = "";
    stopPruning = false;
    errorInRowButContinue = false;
}

From source file:me.philnate.textmanager.utils.PDFCreator.java

@SuppressWarnings("deprecation")
private void preparePDF() {
    try {/*w w w. jav a 2  s.com*/
        File path = new File(SystemUtils.getUserDir(), "template");
        File template = new File(path, Setting.find("template").getValue());

        Velocity.setProperty("file.resource.loader.path", path.getAbsolutePath());
        Velocity.init();
        VelocityContext ctx = new VelocityContext();

        // User data/Settings
        for (Setting setting : ds.find(Setting.class).asList()) {
            ctx.put(setting.getKey(), setting.getValue());
        }

        NumberFormat format = NumberFormat.getNumberInstance(new Locale(Setting.find("locale").getValue()));
        // #60 always show 2 digits for fraction no matter if right most(s)
        // are zero
        format.setMinimumFractionDigits(2);
        format.setMaximumFractionDigits(2);
        ctx.put("number", format);
        // TODO update schema to have separate first and lastname
        // Customer data
        ctx.put("customer", customer);

        // General data
        ctx.put("month", new DateFormatSymbols().getMonths()[month]);
        ctx.put("math", new MathTool());
        // Billing data
        ctx.put("allItems", BillingItem.find(customer.getId(), year, month));
        ctx.put("billNo", bill.getBillNo());

        StringWriter writer = new StringWriter();
        Velocity.mergeTemplate(template.getName(), ctx, writer);
        File filledTemplate = new File(path, bill.getBillNo() + ".tex");
        FileUtils.writeStringToFile(filledTemplate, writer.toString(), "ISO-8859-1");

        ProcessBuilder pdfLatex = new ProcessBuilder(Setting.find("pdfLatex").getValue(),
                "-interaction nonstopmode", "-output-format pdf", filledTemplate.toString());

        // Saving template file (just in case it may be needed later
        GridFSFile texFile = tex.createFile(filledTemplate);
        texFile.put("month", month);
        texFile.put("year", year);
        texFile.put("customerId", customer.getId());
        texFile.save();

        pdfLatex.directory(path);
        String pdfPath = filledTemplate.toString().replaceAll("tex$", "pdf");
        if (0 == printOutputStream(pdfLatex)) {
            // display Bill in DocumentViewer
            new ProcessBuilder(Setting.find("pdfViewer").getValue(), pdfPath).start().waitFor();
            GridFSFile pdfFile = pdf.createFile(new File(pdfPath));
            pdfFile.put("month", month);
            pdfFile.put("year", year);
            pdfFile.put("customerId", customer.getId());
            pdf.remove(QueryBuilder.start("month").is(month).and("year").is(year).and("customerId")
                    .is(customer.getId()).get());
            pdfFile.save();
            File[] files = path.listFiles((FileFilter) new WildcardFileFilter(bill.getBillNo() + ".*"));
            for (File file : files) {
                FileUtils.forceDelete(file);
            }
        } else {
            new JOptionPane(
                    "Bei der Erstellung der Rechnung ist ein Fehler aufgetreten. Es wurde keine Rechnung erstellt.\n Bitte Schauen sie in die Logdatei fr nhere Fehlerinformationen.",
                    JOptionPane.ERROR_MESSAGE).setVisible(true);
        }
    } catch (IOException e) {
        Throwables.propagate(e);
    } catch (InterruptedException e) {
        Throwables.propagate(e);
    }
}

From source file:org.pentaho.di.trans.steps.getxmldata.GetXMLDataData.java

/**
 *
 *//*from w  ww .j  a  va2 s.  com*/
public GetXMLDataData() {
    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;
    is = null;
    indexOfXmlField = -1;

    nrInputFields = -1;
    PathValue = null;
    tokenStart = "@_";
    tokenEnd = "-";
    nodenr = 0;
    nodesize = 0;
    an = null;
    readrow = null;
    totalpreviousfields = 0;
    prunePath = "";
    stopPruning = false;
    errorInRowButContinue = false;
    nrReadRow = 0;
}

From source file:com.chauffeurprive.kronos.time.AmPmCirclesView.java

public void initialize(Context context, TimePickerController controller, int amOrPm) {
    if (mIsInitialized) {
        Log.e(TAG, "AmPmCirclesView may only be initialized once.");
        return;/*from  w w  w . ja v a 2s .  com*/
    }

    Resources res = context.getResources();

    mUnselectedColor = ContextCompat.getColor(context, controller.getCircleBackgroundColor());
    mAmPmTextColor = ContextCompat.getColor(context, controller.getTextColor());
    mAmPmDisabledTextColor = ContextCompat.getColor(context, controller.getDisabledTextColor());
    mSelectedAlpha = SELECTED_ALPHA;

    mSelectedColor = ContextCompat.getColor(context, controller.getAccentColor());
    mTouchedColor = ContextCompat.getColor(context, controller.getDisabledTextColor());
    mAmPmSelectedTextColor = ContextCompat.getColor(context, controller.getSelectedTextColor());

    String typefaceFamily = res.getString(R.string.mdtp_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.mdtp_circle_radius_multiplier));
    mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    mAmDisabled = controller.isAmDisabled();
    mPmDisabled = controller.isPmDisabled();

    setAmOrPm(amOrPm);
    mAmOrPmPressed = -1;

    mIsInitialized = true;
}

From source file:com.android.datetimepicker.time.AmPmCirclesView.java

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

    Resources res = context.getResources();

    if (controller.isThemeDark()) {
        mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_circle_background_dark_theme);
        mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_white);
        mAmPmDisabledTextColor = ContextCompat.getColor(context,
                R.color.mdtp_date_picker_text_disabled_dark_theme);
        mSelectedAlpha = SELECTED_ALPHA_THEME_DARK;
    } else {
        mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_white);
        mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_ampm_text_color);
        mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled);
        mSelectedAlpha = SELECTED_ALPHA;
    }

    mSelectedColor = controller.getAccentColor();
    mTouchedColor = Utils.darkenColor(mSelectedColor);
    mAmPmSelectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white);

    String typefaceFamily = res.getString(R.string.mdtp_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.mdtp_circle_radius_multiplier));
    mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    mAmDisabled = controller.isAmDisabled();
    mPmDisabled = controller.isPmDisabled();

    setAmOrPm(amOrPm);
    mAmOrPmPressed = -1;

    mIsInitialized = true;
}

From source file:uk.org.ngo.squeezer.itemlist.AlarmView.java

private View getAdapterView(View convertView, final ViewGroup parent) {
    AlarmViewHolder currentViewHolder = (convertView != null && convertView.getTag() instanceof AlarmViewHolder)
            ? (AlarmViewHolder) convertView.getTag()
            : null;//from ww  w .ja  v a 2  s.  co  m

    if (currentViewHolder == null) {
        convertView = getLayoutInflater().inflate(R.layout.list_item_alarm, parent, false);
        final View alarmView = convertView;
        final AlarmViewHolder viewHolder = new AlarmViewHolder();
        viewHolder.is24HourFormat = DateFormat.is24HourFormat(getActivity());
        viewHolder.timeFormat = viewHolder.is24HourFormat ? "%02d:%02d" : "%d:%02d";
        String[] amPmStrings = new DateFormatSymbols().getAmPmStrings();
        viewHolder.am = amPmStrings[0];
        viewHolder.pm = amPmStrings[1];
        viewHolder.time = (TextView) convertView.findViewById(R.id.time);
        viewHolder.amPm = (TextView) convertView.findViewById(R.id.am_pm);
        viewHolder.amPm.setVisibility(viewHolder.is24HourFormat ? View.GONE : View.VISIBLE);
        viewHolder.enabled = new CompoundButtonWrapper((CompoundButton) convertView.findViewById(R.id.enabled));
        viewHolder.enabled.setOncheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if (getActivity().getService() != null) {
                    viewHolder.alarm.setEnabled(b);
                    getActivity().getService().alarmEnable(viewHolder.alarm.getId(), b);
                }
            }
        });
        viewHolder.repeat = new CompoundButtonWrapper((CompoundButton) convertView.findViewById(R.id.repeat));
        viewHolder.repeat.setOncheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if (getActivity().getService() != null) {
                    viewHolder.alarm.setRepeat(b);
                    getActivity().getService().alarmRepeat(viewHolder.alarm.getId(), b);
                    viewHolder.dowHolder.setVisibility(b ? View.VISIBLE : View.GONE);
                }
            }
        });
        viewHolder.repeat.getButton().setText(ServerString.ALARM_ALARM_REPEAT.getLocalizedString());
        viewHolder.delete = (ImageView) convertView.findViewById(R.id.delete);
        viewHolder.playlist = (Spinner) convertView.findViewById(R.id.playlist);
        viewHolder.dowHolder = (LinearLayout) convertView.findViewById(R.id.dow);
        for (int day = 0; day < 7; day++) {
            ViewGroup dowButton = (ViewGroup) viewHolder.dowHolder.getChildAt(day);
            final int finalDay = day;
            dowButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (getActivity().getService() != null) {
                        final Alarm alarm = viewHolder.alarm;
                        boolean wasChecked = alarm.isDayActive(finalDay);
                        if (wasChecked) {
                            alarm.clearDay(finalDay);
                            getActivity().getService().alarmRemoveDay(alarm.getId(), finalDay);
                        } else {
                            alarm.setDay(finalDay);
                            getActivity().getService().alarmAddDay(alarm.getId(), finalDay);
                        }
                        setDowText(viewHolder, finalDay);
                    }
                }
            });
            viewHolder.dowTexts[day] = (TextView) dowButton.getChildAt(0);
        }
        viewHolder.delete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View view) {
                final AnimationSet animationSet = new AnimationSet(true);
                animationSet.addAnimation(new ScaleAnimation(1F, 1F, 1F, 0.5F));
                animationSet.addAnimation(new AlphaAnimation(1F, 0F));
                animationSet.setDuration(ANIMATION_DURATION);
                animationSet.setAnimationListener(new AnimationEndListener() {
                    @Override
                    public void onAnimationEnd(Animation animation) {
                        mActivity.getItemAdapter().removeItem(viewHolder.position);
                        UndoBarController.show(getActivity(), ServerString.ALARM_DELETING.getLocalizedString(),
                                new UndoListener(viewHolder.position, viewHolder.alarm));
                    }
                });

                alarmView.startAnimation(animationSet);
            }
        });
        viewHolder.playlist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                final AlarmPlaylist selectedAlarmPlaylist = mAlarmPlaylists.get(position);
                final Alarm alarm = viewHolder.alarm;
                if (getActivity().getService() != null && selectedAlarmPlaylist.getId() != null
                        && !selectedAlarmPlaylist.getId().equals(alarm.getUrl())) {
                    alarm.setUrl(selectedAlarmPlaylist.getId());
                    getActivity().getService().alarmSetPlaylist(alarm.getId(), selectedAlarmPlaylist);
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        });

        convertView.setTag(viewHolder);
    }

    return convertView;
}