bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,916
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,917
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,918
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (month < 0) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,919
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,920
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; } if (month > 11) if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } } if (month > 11) { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,921
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,922
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,923
|
private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = ((year * (365L * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear(year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
|
private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = ((year * (365L * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear(year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
| 3,925
|
private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = ((year * (365L * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear(year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
|
private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = ((year * (365L * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear(year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
| 3,926
|
private int getWeekDay(int year, int dayOfYear) { int day = (int) (getLinearTime(year, dayOfYear, 0) / (24 * 60 * 60 * 1000L)); // The epoch was a thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; return weekday; }
|
private int getWeekDay(int year, int dayOfYear) { boolean greg = isGregorian(year, dayOfYear); int day = (int) getLinearDay(year, dayOfYear, greg); // The epoch was a thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; return weekday; }
| 3,928
|
public boolean isLeapYear(int year) { if ((year & 3) != 0) // Only years divisible by 4 can be leap years return false; // compute the linear day of the 29. February of that year. // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. int julianDay = (((year - 1) * (365 * 4 + 1)) >> 2) + (31 + 29 - (((1970 - 1) * (365 * 4 + 1)) / 4 + 1 - 13)); // If that day is smaller than the gregorianChange the julian // rule applies: This is a leap year since it is divisible by 4. if (julianDay * (24 * 60 * 60 * 1000L) < gregorianCutover) return true; return ((year % 100) != 0 || (year % 400) == 0); }
|
public boolean isLeapYear(int year) { // Only years divisible by 4 can be leap years return false; // compute the linear day of the 29. February of that year. // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. int julianDay = (((year - 1) * (365 * 4 + 1)) >> 2) + (31 + 29 - (((1970 - 1) * (365 * 4 + 1)) / 4 + 1 - 13)); // If that day is smaller than the gregorianChange the julian // rule applies: This is a leap year since it is divisible by 4. if (julianDay * (24 * 60 * 60 * 1000L) < gregorianCutover) return true; return ((year % 100) != 0 || (year % 400) == 0); }
| 3,929
|
public boolean isLeapYear(int year) { if ((year & 3) != 0) // Only years divisible by 4 can be leap years return false; // compute the linear day of the 29. February of that year. // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. int julianDay = (((year - 1) * (365 * 4 + 1)) >> 2) + (31 + 29 - (((1970 - 1) * (365 * 4 + 1)) / 4 + 1 - 13)); // If that day is smaller than the gregorianChange the julian // rule applies: This is a leap year since it is divisible by 4. if (julianDay * (24 * 60 * 60 * 1000L) < gregorianCutover) return true; return ((year % 100) != 0 || (year % 400) == 0); }
|
public boolean isLeapYear(int year) { if ((year & 3) != 0) // Only years divisible by 4 can be leap years return false; // compute the linear day of the 29. February of that year. // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. int julianDay = (((year - 1) * (365 * 4 + 1)) >> 2) + (31 + 29 - (((1970 - 1) * (365 * 4 + 1)) / 4 + 1 - 13)); // If that day is smaller than the gregorianChange the julian // rule applies: This is a leap year since it is divisible by 4. if (julianDay * (24 * 60 * 60 * 1000L) < gregorianCutover) return true; return ((year % 100) != 0 || (year % 400) == 0); }
| 3,930
|
protected Calendar(TimeZone zone, Locale locale) { this.zone = zone; lenient = true; ResourceBundle rb = getBundle(locale); firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue(); minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek")).intValue(); }
|
protected Calendar() { this.zone = zone; lenient = true; ResourceBundle rb = getBundle(locale); firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue(); minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek")).intValue(); }
| 3,931
|
protected Calendar(TimeZone zone, Locale locale) { this.zone = zone; lenient = true; ResourceBundle rb = getBundle(locale); firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue(); minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek")).intValue(); }
|
protected Calendar(TimeZone zone, Locale locale) { this.zone = zone; lenient = true; ResourceBundle rb = getBundle(locale); firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue(); minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek")).intValue(); }
| 3,932
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,933
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,934
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,935
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,936
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,937
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,938
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,939
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
|
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. // However, compliance with Sun's VM would correspond to replacing // getAnchorSelectionIndex() with getLeadSelectionIndex().This is // both unnatural and contradictory to the way they handle other // similar UI interactions. BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // BasicListUI.this.list.setSelectionInterval // (BasicListUI.this.list.getLeadSelectionIndex(),index); // Note that for IBM this is contradictory to what they did in // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); } else if (event.isControlDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); BasicListUI.this.list.ensureIndexIsVisible (BasicListUI.this.list.getLeadSelectionIndex()); }
| 3,940
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. keyListener = new KeyHandler(); list.addComponentListener(componentListener); componentListener = new ComponentHandler(); list.addKeyListener(keyListener); }
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. list.addComponentListener(componentListener); componentListener = new ComponentHandler(); list.addKeyListener(keyListener); }
| 3,942
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. keyListener = new KeyHandler(); list.addComponentListener(componentListener); componentListener = new ComponentHandler(); list.addKeyListener(keyListener); }
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. keyListener = new KeyHandler(); list.addComponentListener(componentListener); componentListener = new ComponentHandler(); }
| 3,943
|
protected void selectNextIndex() { int index = list.getSelectedIndex(); index++; list.setSelectedIndex(index); list.ensureIndexIsVisible(index); }
|
protected void selectNextIndex() { int index = list.getSelectionModel().getLeadSelectionIndex(); if (index < list.getModel().getSize() - 1) { index++; list.setSelectedIndex(index); list.ensureIndexIsVisible(index); }
| 3,944
|
protected void selectPreviousIndex() { int index = list.getSelectedIndex(); index--; list.setSelectedIndex(index); list.ensureIndexIsVisible(index); }
|
protected void selectPreviousIndex() { int index = list.getSelectionModel().getLeadSelectionIndex(); if (index > 0) { index--; list.setSelectedIndex(index); list.ensureIndexIsVisible(index); }
| 3,946
|
protected void uninstallListeners() { list.removeFocusListener(focusListener); list.getModel().removeListDataListener(listDataListener); list.removeListSelectionListener(listSelectionListener); list.removeMouseListener(mouseInputListener); list.removeKeyListener(keyListener); list.removeMouseMotionListener(mouseInputListener); list.removePropertyChangeListener(propertyChangeListener); }
|
protected void uninstallListeners() { list.removeFocusListener(focusListener); list.getModel().removeListDataListener(listDataListener); list.removeListSelectionListener(listSelectionListener); list.removeMouseListener(mouseInputListener); list.removeMouseMotionListener(mouseInputListener); list.removePropertyChangeListener(propertyChangeListener); }
| 3,948
|
protected void readFormatTable(ByteArrayOutputStream baosp,int readType, CodePage codePage) { ScreenField sf; boolean isSigned = false; char c; if (masterMDT) { StringBuffer sb = new StringBuffer(); for (int x = 0; x < sizeFields; x++) { isSigned = false; sf = screenFields[x]; if (sf.mdt || (readType == CMD_READ_INPUT_FIELDS)) { sb.setLength(0); sb.append(sf.getText()); if (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT) { int len = sb.length() - 1; // we strip out all '\u0020' and less while (len >= 0 &&// (sb.charAt(len) <= ' ' || sb.charAt(len) >= '\uff20' )) { (sb.charAt(len) < ' ' || sb.charAt(len) >= '\uff20' )) { sb.deleteCharAt(len--); } }// System.out.println("field " + sf.toString());// System.out.println(">" + sb.toString() + "<");// System.out.println(" field is all nulls"); if (sf.isSignedNumeric() && sb.length() > 0 && sb.charAt(sb.length() - 1) == '-') { isSigned = true; sb.setLength(sb.length() - 1); } int len3 = sb.length(); if (len3 > 0 || (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { if ((readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { baosp.write(17); // start of field data baosp.write(sf.startRow()+1); baosp.write(sf.startCol()+1); }// int len = sb.length(); for (int k = 0; k < len3; k++) { c = sb.charAt(k); // here we have to check for special instances of the // characters in the string field. Attribute bytes // are encoded with an offset of \uff00 // This is a hack !!!!!!!!!!! // See ScreenField object for a description if (c < ' ' || c >= '\uff20') { // if it is an offset attribute byte we just pass // it straight on to the output stream if (c >= '\uff20' && c <= '\uff3f') { baosp.write(c - '\uff00'); } else baosp.write(codePage.getEBCDIC(' ')); } else { if (isSigned && k == len3 - 1) { baosp.write(0xd0 | (0x0f & c)); } else baosp.write(codePage.uni2ebcdic(c)); } } } } } } }
|
protected void readFormatTable(ByteArrayOutputStream baosp,int readType, CodePage codePage) { ScreenField sf; boolean isSigned = false; char c; if (masterMDT) { StringBuffer sb = new StringBuffer(); for (int x = 0; x < sizeFields; x++) { isSigned = false; sf = screenFields[x]; if (sf.mdt || (readType == CMD_READ_INPUT_FIELDS)) { sb.setLength(0); sb.append(sf.getText()); if (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT) { int len = sb.length() - 1; // we strip out all '\u0020' and less while (len >= 0 &&// (sb.charAt(len) <= ' ' || sb.charAt(len) >= '\uff20' )) { (sb.charAt(len) < ' ' || sb.charAt(len) >= '\uff20')) { if (sb.charAt(len) == 0x1C && sf.isDupEnabled()) break; sb.deleteCharAt(len--); } }// System.out.println("field " + sf.toString());// System.out.println(">" + sb.toString() + "<");// System.out.println(" field is all nulls"); if (sf.isSignedNumeric() && sb.length() > 0 && sb.charAt(sb.length() - 1) == '-') { isSigned = true; sb.setLength(sb.length() - 1); } int len3 = sb.length(); if (len3 > 0 || (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { if ((readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { baosp.write(17); // start of field data baosp.write(sf.startRow()+1); baosp.write(sf.startCol()+1); }// int len = sb.length(); for (int k = 0; k < len3; k++) { c = sb.charAt(k); // here we have to check for special instances of the // characters in the string field. Attribute bytes // are encoded with an offset of \uff00 // This is a hack !!!!!!!!!!! // See ScreenField object for a description if (c < ' ' || c >= '\uff20') { // if it is an offset attribute byte we just pass // it straight on to the output stream if (c >= '\uff20' && c <= '\uff3f') { baosp.write(c - '\uff00'); } else baosp.write(codePage.getEBCDIC(' ')); } else { if (isSigned && k == len3 - 1) { baosp.write(0xd0 | (0x0f & c)); } else baosp.write(codePage.uni2ebcdic(c)); } } } } } } }
| 3,949
|
protected void readFormatTable(ByteArrayOutputStream baosp,int readType, CodePage codePage) { ScreenField sf; boolean isSigned = false; char c; if (masterMDT) { StringBuffer sb = new StringBuffer(); for (int x = 0; x < sizeFields; x++) { isSigned = false; sf = screenFields[x]; if (sf.mdt || (readType == CMD_READ_INPUT_FIELDS)) { sb.setLength(0); sb.append(sf.getText()); if (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT) { int len = sb.length() - 1; // we strip out all '\u0020' and less while (len >= 0 &&// (sb.charAt(len) <= ' ' || sb.charAt(len) >= '\uff20' )) { (sb.charAt(len) < ' ' || sb.charAt(len) >= '\uff20' )) { sb.deleteCharAt(len--); } }// System.out.println("field " + sf.toString());// System.out.println(">" + sb.toString() + "<");// System.out.println(" field is all nulls"); if (sf.isSignedNumeric() && sb.length() > 0 && sb.charAt(sb.length() - 1) == '-') { isSigned = true; sb.setLength(sb.length() - 1); } int len3 = sb.length(); if (len3 > 0 || (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { if ((readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { baosp.write(17); // start of field data baosp.write(sf.startRow()+1); baosp.write(sf.startCol()+1); }// int len = sb.length(); for (int k = 0; k < len3; k++) { c = sb.charAt(k); // here we have to check for special instances of the // characters in the string field. Attribute bytes // are encoded with an offset of \uff00 // This is a hack !!!!!!!!!!! // See ScreenField object for a description if (c < ' ' || c >= '\uff20') { // if it is an offset attribute byte we just pass // it straight on to the output stream if (c >= '\uff20' && c <= '\uff3f') { baosp.write(c - '\uff00'); } else baosp.write(codePage.getEBCDIC(' ')); } else { if (isSigned && k == len3 - 1) { baosp.write(0xd0 | (0x0f & c)); } else baosp.write(codePage.uni2ebcdic(c)); } } } } } } }
|
protected void readFormatTable(ByteArrayOutputStream baosp,int readType, CodePage codePage) { ScreenField sf; boolean isSigned = false; char c; if (masterMDT) { StringBuffer sb = new StringBuffer(); for (int x = 0; x < sizeFields; x++) { isSigned = false; sf = screenFields[x]; if (sf.mdt || (readType == CMD_READ_INPUT_FIELDS)) { sb.setLength(0); sb.append(sf.getText()); if (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT) { int len = sb.length() - 1; // we strip out all '\u0020' and less while (len >= 0 &&// (sb.charAt(len) <= ' ' || sb.charAt(len) >= '\uff20' )) { (sb.charAt(len) < ' ' || sb.charAt(len) >= '\uff20' )) { sb.deleteCharAt(len--); } }// System.out.println("field " + sf.toString());// System.out.println(">" + sb.toString() + "<");// System.out.println(" field is all nulls"); if (sf.isSignedNumeric() && sb.length() > 0 && sb.charAt(sb.length() - 1) == '-') { isSigned = true; sb.setLength(sb.length() - 1); } int len3 = sb.length(); if (len3 > 0 || (readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { if ((readType == CMD_READ_MDT_FIELDS || readType == CMD_READ_MDT_IMMEDIATE_ALT)) { baosp.write(17); // start of field data baosp.write(sf.startRow()+1); baosp.write(sf.startCol()+1); }// int len = sb.length(); for (int k = 0; k < len3; k++) { c = sb.charAt(k); // here we have to check for special instances of the // characters in the string field. Attribute bytes // are encoded with an offset of \uff00 // This is a hack !!!!!!!!!!! // See ScreenField object for a description if (c < ' ' || c >= '\uff20') { // if it is an offset attribute byte we just pass // it straight on to the output stream if (c >= '\uff20' && c <= '\uff3f') { baosp.write(c - '\uff00'); } else if (c == 0x1C) baosp.write(c); else baosp.write(codePage.getEBCDIC(' ')); } else { if (isSigned && k == len3 - 1) { baosp.write(0xd0 | (0x0f & c)); } else baosp.write(codePage.uni2ebcdic(c)); } } } } } } }
| 3,950
|
UTF_8 () { super ("UTF-8", null); }
|
UTF_8 () { super ("UTF-8", new String[] { "ibm-1208", "ibm-1209", "ibm-5304", "ibm-5305", "windows-65001", "cp1208", "UTF8" }); }
| 3,951
|
public void connect(org.omg.CORBA.Object object, byte[] key) { int a_port = getFreePort(); Connected_objects.cObject ref = connected_objects.add(key, object, a_port, null); IOR ior = createIOR(ref); prepareObject(object, ior); if (running) startService(ior); }
|
public void connect(org.omg.CORBA.Object object) { int a_port = getFreePort(); Connected_objects.cObject ref = connected_objects.add(key, object, a_port, null); IOR ior = createIOR(ref); prepareObject(object, ior); if (running) startService(ior); }
| 3,953
|
public void connect(org.omg.CORBA.Object object, byte[] key) { int a_port = getFreePort(); Connected_objects.cObject ref = connected_objects.add(key, object, a_port, null); IOR ior = createIOR(ref); prepareObject(object, ior); if (running) startService(ior); }
|
public void connect(org.omg.CORBA.Object object, byte[] key) { int a_port = getFreePort(); Connected_objects.cObject ref = connected_objects.add(key, object, a_port, null); IOR ior = createIOR(ref); prepareObject(object, ior); if (running) startService(ior); }
| 3,954
|
protected IOR createIOR(Connected_objects.cObject ref) throws BAD_OPERATION { IOR ior = new IOR(); ior.key = ref.key; ior.Internet.port = ref.port; if (ref.object instanceof ObjectImpl) { ObjectImpl imp = (ObjectImpl) ref.object; if (imp._ids().length > 0) ior.Id = imp._ids() [ 0 ]; } if (ior.Id == null) ior.Id = ref.object.getClass().getName(); try { ior.Internet.host = InetAddress.getLocalHost().getHostAddress(); ior.Internet.port = ref.port; } catch (UnknownHostException ex) { throw new BAD_OPERATION("Cannot resolve the local host address"); } return ior; }
|
protected IOR createIOR(Connected_objects.cObject ref) throws BAD_OPERATION { IOR ior = new IOR(); ior.key = ref.key; ior.Internet.port = ref.port; if (ref.object instanceof ObjectImpl) { ObjectImpl imp = (ObjectImpl) ref.object; if (imp._ids().length > 0) ior.Id = imp._ids() [ 0 ]; } if (ior.Id == null) ior.Id = ref.object.getClass().getName(); try { ior.Internet.host = InetAddress.getLocalHost().getHostAddress(); ior.Internet.port = ref.port; } catch (UnknownHostException ex) { throw new BAD_OPERATION("Cannot resolve the local host address"); } return ior; }
| 3,955
|
protected IOR createIOR(Connected_objects.cObject ref) throws BAD_OPERATION { IOR ior = new IOR(); ior.key = ref.key; ior.Internet.port = ref.port; if (ref.object instanceof ObjectImpl) { ObjectImpl imp = (ObjectImpl) ref.object; if (imp._ids().length > 0) ior.Id = imp._ids() [ 0 ]; } if (ior.Id == null) ior.Id = ref.object.getClass().getName(); try { ior.Internet.host = InetAddress.getLocalHost().getHostAddress(); ior.Internet.port = ref.port; } catch (UnknownHostException ex) { throw new BAD_OPERATION("Cannot resolve the local host address"); } return ior; }
|
protected IOR createIOR(Connected_objects.cObject ref) throws BAD_OPERATION { IOR ior = new IOR(); ior.key = ref.key; ior.Internet.port = ref.port; if (ref.object instanceof ObjectImpl) { ObjectImpl imp = (ObjectImpl) ref.object; if (imp._ids().length > 0) ior.Id = imp._ids() [ 0 ]; } if (ior.Id == null) ior.Id = ref.object.getClass().getName(); try { ior.Internet.host = InetAddress.getLocalHost().getHostAddress(); ior.Internet.port = ref.port; } catch (UnknownHostException ex) { throw new BAD_OPERATION("Cannot resolve the local host address"); } return ior; }
| 3,956
|
public static void writeSystemException(OutputStream output, SystemException ex ) { String exIDL = toIDL(ex.getClass().getName()); output.write_string(exIDL); output.write_ulong(ex.minor); CompletionStatusHelper.write(output, ex.completed); }
|
public static void writeSystemException(OutputStream output, SystemException ex ) { String exIDL = getRepositoryId(ex.getClass()); output.write_string(exIDL); output.write_ulong(ex.minor); CompletionStatusHelper.write(output, ex.completed); }
| 3,959
|
public static java.lang.Object createObject(String idl, String suffix) { try { return Class.forName(toClassName(idl) + suffix).newInstance(); } catch (Exception ex) { return null; } }
|
public static java.lang.Object createObject(String idl, String suffix) { try { return Class.forName(toClassName(JAVA_PREFIX, idl) + suffix) .newInstance(); } catch (Exception ex) { return null; } }
| 3,960
|
public static SystemException createSystemException(String idl, int minor, CompletionStatus completed ) { try { String cl = toClassName(idl); Class exClass = Class.forName(cl); Constructor constructor = exClass.getConstructor(new Class[] { String.class, int.class, CompletionStatus.class } ); Object exception = constructor.newInstance(new Object[] { " Remote exception " + idl + ", minor " + minor + ", " + completed + ".", new Integer(minor), completed } ); return (SystemException) exception; } catch (Exception ex) { ex.printStackTrace(); return new UNKNOWN("Unsupported system exception", minor, completed); } }
|
public static SystemException createSystemException(String idl, int minor, CompletionStatus completed ) { try { String cl = toClassName(JAVA_PREFIX, idl); Class exClass = Class.forName(cl); Constructor constructor = exClass.getConstructor(new Class[] { String.class, int.class, CompletionStatus.class } ); Object exception = constructor.newInstance(new Object[] { " Remote exception " + idl + ", minor " + minor + ", " + completed + ".", new Integer(minor), completed } ); return (SystemException) exception; } catch (Exception ex) { ex.printStackTrace(); return new UNKNOWN("Unsupported system exception", minor, completed); } }
| 3,962
|
protected static String toClassName(String IDL) { String s = IDL; int a = s.indexOf(':') + 1; int b = s.lastIndexOf(':'); s = IDL.substring(a, b); if (s.startsWith(OMG_PREFIX)) s = JAVA_PREFIX + s.substring(OMG_PREFIX.length()); return s.replace('/', '.'); }
|
protected static String toClassName(String prefix, String IDL) { String s = IDL; int a = s.indexOf(':') + 1; int b = s.lastIndexOf(':'); s = IDL.substring(a, b); if (s.startsWith(OMG_PREFIX)) s = JAVA_PREFIX + s.substring(OMG_PREFIX.length()); return s.replace('/', '.'); }
| 3,963
|
protected static String toClassName(String IDL) { String s = IDL; int a = s.indexOf(':') + 1; int b = s.lastIndexOf(':'); s = IDL.substring(a, b); if (s.startsWith(OMG_PREFIX)) s = JAVA_PREFIX + s.substring(OMG_PREFIX.length()); return s.replace('/', '.'); }
|
protected static String toClassName(String IDL) { String s = IDL; int a = s.indexOf(':') + 1; int b = s.lastIndexOf(':'); s = IDL.substring(a, b); if (s.startsWith(OMG_PREFIX)) s = prefix + s.substring(OMG_PREFIX.length()); return s.replace('/', '.'); }
| 3,964
|
public void connect() throws IOException { if (connected) { return; } String protocol = url.getProtocol(); boolean secure = "https".equals(protocol); String host = url.getHost(); int port = url.getPort(); if (port < 0) { port = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } String file = url.getFile(); String username = url.getUserInfo(); String password = null; if (username != null) { int ci = username.indexOf(':'); if (ci != -1) { password = username.substring(ci + 1); username = username.substring(0, ci); } } final Credentials creds = (username == null) ? null : new Credentials (username, password); boolean retry; do { retry = false; if (connection == null) { connection = getConnection(host, port, secure); if (secure) { SSLSocketFactory factory = getSSLSocketFactory(); HostnameVerifier verifier = getHostnameVerifier(); if (factory != null) { connection.setSSLSocketFactory(factory); } connection.addHandshakeCompletedListener(this); // TODO verifier } } if (proxyHostname != null) { if (proxyPort < 0) { proxyPort = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } connection.setProxy(proxyHostname, proxyPort); } try { request = connection.newRequest(method, file); if (!keepAlive) { request.setHeader("Connection", "close"); } if (agent != null) { request.setHeader("User-Agent", agent); } request.getHeaders().putAll(requestHeaders); if (requestSink != null) { byte[] content = requestSink.toByteArray(); RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content); request.setRequestBodyWriter(writer); } if (creds != null) { request.setAuthenticator(new Authenticator() { public Credentials getCredentials(String realm, int attempts) { return (attempts < 2) ? creds : null; } }); } response = request.dispatch(); } catch (IOException ioe) { if (connection.useCount > 0) { // Connection re-use failed: Try a new connection. try { connection.close(); } catch (IOException _) { // Ignore. } connection = null; retry = true; continue; } else { // First time the connection was used: Hard failure. throw ioe; } } if (response.getCodeClass() == 3 && getInstanceFollowRedirects()) { // Follow redirect String location = response.getHeader("Location"); if (location != null) { String connectionUri = connection.getURI(); int start = connectionUri.length(); if (location.startsWith(connectionUri) && location.charAt(start) == '/') { file = location.substring(start); retry = true; } else if (location.startsWith("http:")) { connection.close(); connection = null; secure = false; start = 7; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTP_PORT; } file = location.substring(end); retry = true; } else if (location.startsWith("https:")) { connection.close(); connection = null; secure = true; start = 8; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTPS_PORT; } file = location.substring(end); retry = true; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = response.getBody(); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = true; }
|
public void connect() throws IOException { if (connected) { return; } String protocol = url.getProtocol(); boolean secure = "https".equals(protocol); String host = url.getHost(); int port = url.getPort(); if (port < 0) { port = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } String file = url.getFile(); String username = url.getUserInfo(); String password = null; if (username != null) { int ci = username.indexOf(':'); if (ci != -1) { password = username.substring(ci + 1); username = username.substring(0, ci); } } final Credentials creds = (username == null) ? null : new Credentials (username, password); boolean retry; do { retry = false; if (connection == null) { connection = getConnection(host, port, secure); if (secure) { SSLSocketFactory factory = getSSLSocketFactory(); HostnameVerifier verifier = getHostnameVerifier(); if (factory != null) { connection.setSSLSocketFactory(factory); } connection.addHandshakeCompletedListener(this); // TODO verifier } } if (proxyHostname != null) { if (proxyPort < 0) { proxyPort = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } connection.setProxy(proxyHostname, proxyPort); } try { request = connection.newRequest(method, file); if (!keepAlive) { request.setHeader("Connection", "close"); } if (agent != null) { request.setHeader("User-Agent", agent); } request.getHeaders().putAll(requestHeaders); if (requestSink != null) { byte[] content = requestSink.toByteArray(); RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content); request.setRequestBodyWriter(writer); } if (creds != null) { request.setAuthenticator(new Authenticator() { public Credentials getCredentials(String realm, int attempts) { return (attempts < 2) ? creds : null; } }); } response = request.dispatch(); } catch (IOException ioe) { if (connection.useCount > 0) { // Connection re-use failed: Try a new connection. try { connection.close(); } catch (IOException _) { // Ignore. } connection = null; retry = true; continue; } else { // First time the connection was used: Hard failure. throw ioe; } } if (response.getCodeClass() == 3 && getInstanceFollowRedirects()) { // Follow redirect String location = response.getHeader("Location"); if (location != null) { String connectionUri = connection.getURI(); int start = connectionUri.length(); if (location.startsWith(connectionUri) && location.charAt(start) == '/') { file = location.substring(start); retry = true; } else if (location.startsWith("http:")) { connection.close(); connection = null; secure = false; start = 7; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTP_PORT; } file = location.substring(end); retry = true; } else if (location.startsWith("https:")) { connection.close(); connection = null; secure = true; start = 8; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTPS_PORT; } file = location.substring(end); retry = true; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = response.getBody(); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = true; }
| 3,965
|
public AddressPcEntry(int pc, int offset) { this.pc = pc; this.offset = offset; }
|
public AddressPcEntry(VmMethod method, int pc, int offset) { this.method = method; this.pc = pc; this.offset = offset; }
| 3,967
|
public void add(int pc, int offset) { if (table != null) { throw new RuntimeException( "Address table is locked"); } final AddressPcEntry entry = new AddressPcEntry(pc, offset); if (list == null) { list = entry; } else { // Sort on offset (from low to high) if (offset < list.offset) { entry.next = list; list = entry; } else { AddressPcEntry p = list; while ((p.next != null) && (offset > p.next.offset)) { p = p.next; } entry.next = p.next; p.next = entry; } } }
|
public void add(VmMethod method, int pc, int offset) { if (table != null) { throw new RuntimeException( "Address table is locked"); } final AddressPcEntry entry = new AddressPcEntry(pc, offset); if (list == null) { list = entry; } else { // Sort on offset (from low to high) if (offset < list.offset) { entry.next = list; list = entry; } else { AddressPcEntry p = list; while ((p.next != null) && (offset > p.next.offset)) { p = p.next; } entry.next = p.next; p.next = entry; } } }
| 3,968
|
public void add(int pc, int offset) { if (table != null) { throw new RuntimeException( "Address table is locked"); } final AddressPcEntry entry = new AddressPcEntry(pc, offset); if (list == null) { list = entry; } else { // Sort on offset (from low to high) if (offset < list.offset) { entry.next = list; list = entry; } else { AddressPcEntry p = list; while ((p.next != null) && (offset > p.next.offset)) { p = p.next; } entry.next = p.next; p.next = entry; } } }
|
public void add(int pc, int offset) { if (table != null) { throw new RuntimeException( "Address table is locked"); } final AddressPcEntry entry = new AddressPcEntry(method, pc, offset); if (list == null) { list = entry; } else { // Sort on offset (from low to high) if (offset < list.offset) { entry.next = list; list = entry; } else { AddressPcEntry p = list; while ((p.next != null) && (offset > p.next.offset)) { p = p.next; } entry.next = p.next; p.next = entry; } } }
| 3,969
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 3]; this.methodTable = (VmMethod[]) methods.toArray(new VmMethod[ methods .size()]); p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
| 3,970
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
| 3,971
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
|
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 3; p = p.next; } this.table = table; this.list = null; }
| 3,972
|
public void writeTo(PrintStream out) { for (int i = 0; i < table.length; i += 2) { final int pc = table[ i + 0]; final int offset = table[ i + 1]; out.println("PC[" + pc + "]\t0x" + NumberUtils.hex(offset)); } }
|
public void writeTo(PrintStream out) { for (int i = 0; i < table.length; i += 2) { final int pc = table[ i + 0]; final int offset = table[ i + 1]; out.println("PC[" + pc + "]\t0x" + NumberUtils.hex(offset)); } }
| 3,973
|
public void writeTo(PrintStream out) { for (int i = 0; i < table.length; i += 2) { final int pc = table[ i + 0]; final int offset = table[ i + 1]; out.println("PC[" + pc + "]\t0x" + NumberUtils.hex(offset)); } }
|
public void writeTo(PrintStream out) { for (int i = 0; i < table.length; i += 2) { final int pc = table[ i + 0]; final int offset = table[ i + 1]; out.println(methodTable[ methodIdx].getName() + ", pc[" + pc + "]\t0x" + NumberUtils.hex(offset)); } }
| 3,974
|
public static int const0(int a0, int a1) { int l0 = 0; if (a0 < 0) { l0 = -1; } if (a0 > 0) { l0 = 1; } return l0; }
|
public static int const0(int a0, int a1) { int l0 = 0; if (a0 == 0) { l0 = -1; } if (a0 > 0) { l0 = 1; } return l0; }
| 3,975
|
private static VmByteCode loadByteCode(String className) throws MalformedURLException, ClassNotFoundException { VmSystemClassLoader vmc = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture()); VmType type = vmc.loadClass(className, true); VmMethod arithMethod = null; int nMethods = type.getNoDeclaredMethods(); for (int i=0; i<nMethods; i+=1) { VmMethod method = type.getDeclaredMethod(i); if ("const1".equals(method.getName())) { arithMethod = method; break; } } VmByteCode code = arithMethod.getBytecode(); return code; }
|
private static VmByteCode loadByteCode(String className) throws MalformedURLException, ClassNotFoundException { VmSystemClassLoader vmc = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture()); VmType type = vmc.loadClass(className, true); VmMethod arithMethod = null; int nMethods = type.getNoDeclaredMethods(); for (int i=0; i<nMethods; i+=1) { VmMethod method = type.getDeclaredMethod(i); if ("terniary".equals(method.getName())) { arithMethod = method; break; } } VmByteCode code = arithMethod.getBytecode(); return code; }
| 3,976
|
protected ClassLoader currentClassLoader() { return VMSecurityManager.currentClassLoader(); }
|
protected ClassLoader currentClassLoader() { Class cl = currentLoadedClass(); return cl != null ? cl.getClassLoader() : null; }
| 3,978
|
protected Class[] getClassContext() { return VMSecurityManager.getClassContext(); }
|
protected Class[] getClassContext() { Class[] stack1 = VMStackWalker.getClassContext(); Class[] stack2 = new Class[stack1.length - 1]; System.arraycopy(stack1, 1, stack2, 0, stack1.length - 1); return stack2; }
| 3,979
|
private void checkDataArrayBounds (int longIndex, int shortIndex, int type) throws SetDataException { if (shortIndex < 0 || longIndex < 0) { throw new SetDataException("Cant set data: passed locator/axes dont belong to this array?"); } // Does the location exist yet? If not, create the primative arrays // that lie along the short axis // int shortAxisSize = getShortAxis().getLength(); int shortAxisSize = parentArray.getShortAxisSize(); if (shortAxisSize < 1) { shortAxisSize = 1; } // is the long array too small? if (longDataArray.size() < (longIndex+1)) { int maxDeclLongArraySize = getMaxLongArraySize(); // should be held in private var int expandSize = longIndex > maxDeclLongArraySize ? longIndex : maxDeclLongArraySize; expandSize *= expandFactor; // add in additional amount to prevent us from doing this too much expandLongArray(expandSize); } // is the short array too small? has it been init'd even yet? // we perform checks here.. if (longDataArray.get(longIndex) == null) { // init/create the short array longDataArray.set( longIndex, new byte[shortAxisSize]); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, new double [shortAxisSize]); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, new int [shortAxisSize]); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, new byte [shortAxisSize]); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, new short [shortAxisSize]); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, new long [shortAxisSize]); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, new String [shortAxisSize]); } } else { int currentShortAxisSize = getLongDataArraySize(longIndex, type); // requested short axis location not exist? if (currentShortAxisSize <= shortIndex) { // should flag the user that need to add AxisValue first if (shortIndex > shortAxisSize) { throw new SetDataException("Error: axis lacks an AxisValue at location requested in setData()."); } else { // add in short axis location to local short array(s) int newsize = shortIndex+1; // need to add one for case of 1-D newsize *= expandFactor; // expand short axis by expandFactor // Log.debugln("Expanding short array at longIndex:"+longIndex+" to "+newsize); longDataArray.set(longIndex, expandArray((byte []) longDataArray.get(longIndex), newsize)); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((double[]) longDataArray.get(longIndex+1), newsize)); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((int[]) longDataArray.get(longIndex+1), newsize)); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((byte[]) longDataArray.get(longIndex+1), newsize)); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((short[]) longDataArray.get(longIndex+1), newsize)); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((long []) longDataArray.get(longIndex+1), newsize)); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((String []) longDataArray.get(longIndex+1), newsize)); } } } } }
|
private void checkDataArrayBounds (int longIndex, int shortIndex, int type) throws SetDataException { if (shortIndex < 0 || longIndex < 0) { throw new SetDataException("Cant set data: passed locator/axes dont belong to this array?"); } // Does the location exist yet? If not, create the primative arrays // that lie along the short axis // int shortAxisSize = getShortAxis().getLength(); int shortAxisSize = parentArray.getShortAxisSize(); if (shortAxisSize < 1) { shortAxisSize = 1; } // is the long array too small? if (longDataArray.size() < (longIndex+1)) { int maxDeclLongArraySize = getMaxLongArraySize(); // should be held in private var int expandSize = longIndex > maxDeclLongArraySize ? longIndex : maxDeclLongArraySize; expandSize *= expandFactor; // add in additional amount to prevent us from doing this too much expandLongArray(expandSize); } // is the short array too small? has it been init'd even yet? // we perform checks here.. if (longDataArray.get(longIndex) == null) { // init/create the short array longDataArray.set( longIndex, new byte[shortAxisSize]); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, new double [shortAxisSize]); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, new int [shortAxisSize]); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, new byte [shortAxisSize]); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, new short [shortAxisSize]); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, new long [shortAxisSize]); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, new String [shortAxisSize]); } } else { int currentShortAxisSize = getLongDataArraySize(longIndex, type); // requested short axis location not exist? if (currentShortAxisSize <= shortIndex) { // should flag the user that need to add AxisValue first if (shortIndex > shortAxisSize) { throw new SetDataException("Error: axis lacks an AxisValue at location requested in setData()."); } else { // add in short axis location to local short array(s) int newsize = shortIndex+1; // need to add one for case of 1-D newsize *= expandFactor; // expand short axis by expandFactor // Log.debugln("Expanding short array at longIndex:"+longIndex+" to "+newsize); longDataArray.set(longIndex, expandArray((byte []) longDataArray.get(longIndex), newsize)); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((double[]) longDataArray.get(longIndex+1), newsize)); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((int[]) longDataArray.get(longIndex+1), newsize)); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((byte[]) longDataArray.get(longIndex+1), newsize)); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((short[]) longDataArray.get(longIndex+1), newsize)); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((long []) longDataArray.get(longIndex+1), newsize)); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((String []) longDataArray.get(longIndex+1), newsize)); } } } } }
| 3,981
|
private void checkDataArrayBounds (int longIndex, int shortIndex, int type) throws SetDataException { if (shortIndex < 0 || longIndex < 0) { throw new SetDataException("Cant set data: passed locator/axes dont belong to this array?"); } // Does the location exist yet? If not, create the primative arrays // that lie along the short axis // int shortAxisSize = getShortAxis().getLength(); int shortAxisSize = parentArray.getShortAxisSize(); if (shortAxisSize < 1) { shortAxisSize = 1; } // is the long array too small? if (longDataArray.size() < (longIndex+1)) { int maxDeclLongArraySize = getMaxLongArraySize(); // should be held in private var int expandSize = longIndex > maxDeclLongArraySize ? longIndex : maxDeclLongArraySize; expandSize *= expandFactor; // add in additional amount to prevent us from doing this too much expandLongArray(expandSize); } // is the short array too small? has it been init'd even yet? // we perform checks here.. if (longDataArray.get(longIndex) == null) { // init/create the short array longDataArray.set( longIndex, new byte[shortAxisSize]); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, new double [shortAxisSize]); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, new int [shortAxisSize]); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, new byte [shortAxisSize]); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, new short [shortAxisSize]); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, new long [shortAxisSize]); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, new String [shortAxisSize]); } } else { int currentShortAxisSize = getLongDataArraySize(longIndex, type); // requested short axis location not exist? if (currentShortAxisSize <= shortIndex) { // should flag the user that need to add AxisValue first if (shortIndex > shortAxisSize) { throw new SetDataException("Error: axis lacks an AxisValue at location requested in setData()."); } else { // add in short axis location to local short array(s) int newsize = shortIndex+1; // need to add one for case of 1-D newsize *= expandFactor; // expand short axis by expandFactor // Log.debugln("Expanding short array at longIndex:"+longIndex+" to "+newsize); longDataArray.set(longIndex, expandArray((byte []) longDataArray.get(longIndex), newsize)); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((double[]) longDataArray.get(longIndex+1), newsize)); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((int[]) longDataArray.get(longIndex+1), newsize)); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((byte[]) longDataArray.get(longIndex+1), newsize)); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((short[]) longDataArray.get(longIndex+1), newsize)); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((long []) longDataArray.get(longIndex+1), newsize)); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((String []) longDataArray.get(longIndex+1), newsize)); } } } } }
|
private void checkDataArrayBounds (int longIndex, int shortIndex, int type) throws SetDataException { if (shortIndex < 0 || longIndex < 0) { throw new SetDataException("Cant set data: passed locator/axes dont belong to this array?"); } // Does the location exist yet? If not, create the primative arrays // that lie along the short axis // int shortAxisSize = getShortAxis().getLength(); int shortAxisSize = parentArray.getShortAxisSize(); if (shortAxisSize < 1) { shortAxisSize = 1; } // is the long array too small? if (longDataArray.size() < (longIndex+1)) { int maxDeclLongArraySize = getMaxLongArraySize(); // should be held in private var int expandSize = longIndex > maxDeclLongArraySize ? longIndex : maxDeclLongArraySize; expandSize *= expandFactor; // add in additional amount to prevent us from doing this too much expandLongArray(expandSize); } // is the short array too small? has it been init'd even yet? // we perform checks here.. if (longDataArray.get(longIndex) == null) { // init/create the short array longDataArray.set( longIndex, new byte[shortAxisSize]); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, new double [shortAxisSize]); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, new int [shortAxisSize]); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, new byte [shortAxisSize]); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, new short [shortAxisSize]); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, new long [shortAxisSize]); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, new String [shortAxisSize]); } } else { int currentShortAxisSize = getLongDataArraySize(longIndex, type); // requested short axis location not exist? if (currentShortAxisSize <= shortIndex) { // should flag the user that need to add AxisValue first if (shortIndex > shortAxisSize) { throw new SetDataException("Error: axis lacks an AxisValue at location requested in setData()."); } else { // add in short axis location to local short array(s) int newsize = shortIndex+1; // need to add one for case of 1-D newsize *= expandFactor; // expand short axis by expandFactor // Log.debugln("Expanding short array at longIndex:"+longIndex+" to "+newsize); longDataArray.set(longIndex, expandArray((byte []) longDataArray.get(longIndex), newsize)); if (type == DOUBLE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((double[]) longDataArray.get(longIndex+1), newsize)); } else if (type == INT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((int[]) longDataArray.get(longIndex+1), newsize)); } else if (type == BYTE_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((byte[]) longDataArray.get(longIndex+1), newsize)); } else if (type == SHORT_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((short[]) longDataArray.get(longIndex+1), newsize)); } else if (type == LONG_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((long []) longDataArray.get(longIndex+1), newsize)); } else if (type == STRING_DATA_TYPE) { longDataArray.set(longIndex+1, expandArray((String []) longDataArray.get(longIndex+1), newsize)); } } } } }
| 3,982
|
public Object getData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.get(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
|
public Object getData (Locator locator) throws NoDataException, IllegalArgumentException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.get(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
| 3,983
|
public Object getData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.get(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
|
public Object getData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.get(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
| 3,984
|
public double getDoubleData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getDouble(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
|
public double getDoubleData (Locator locator) throws NoDataException, IllegalArgumentException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getDouble(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
| 3,985
|
public double getDoubleData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getDouble(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
|
public double getDoubleData (Locator locator) throws NoDataException { int longIndex = parentArray.getLongArrayIndex(locator); int shortIndex = parentArray.getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getDouble(longDataArray.get(longIndex+1), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } }
| 3,986
|
private int getLongDataArraySize (int longIndex, int type) { int size = 0; if (type == DOUBLE_DATA_TYPE) { size = ((double[]) longDataArray.get(longIndex+1)).length; } else if (type == INT_DATA_TYPE) { size = ((int []) longDataArray.get(longIndex+1)).length; } else if (type == BYTE_DATA_TYPE) { size = ((byte []) longDataArray.get(longIndex+1)).length; } else if (type == SHORT_DATA_TYPE) { size = ((short []) longDataArray.get(longIndex+1)).length; } else if (type == LONG_DATA_TYPE) { size = ((long []) longDataArray.get(longIndex+1)).length; } else if (type == STRING_DATA_TYPE) { size = ((String []) longDataArray.get(longIndex+1)).length; } return size; }
|
private int getLongDataArraySize (int longIndex, int type) { int size = 0; if (type == DOUBLE_DATA_TYPE) { size = ((double[]) longDataArray.get(longIndex+1)).length; } else if (type == INT_DATA_TYPE) { size = ((int []) longDataArray.get(longIndex+1)).length; } else if (type == BYTE_DATA_TYPE) { size = ((byte []) longDataArray.get(longIndex+1)).length; } else if (type == SHORT_DATA_TYPE) { size = ((short []) longDataArray.get(longIndex+1)).length; } else if (type == LONG_DATA_TYPE) { size = ((long []) longDataArray.get(longIndex+1)).length; } else if (type == STRING_DATA_TYPE) { size = ((String []) longDataArray.get(longIndex+1)).length; } return size; }
| 3,987
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
| 3,988
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
| 3,989
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(2, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
| 3,990
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
|
private void initXTFRInfo() { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel JLabel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel JLabel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); initXTFRFields(); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); as400FieldP = new JPanel(); AlignLayout as400fLayout = new AlignLayout(); as400FieldP.setLayout(as400fLayout); // now show the world what we can do show(); }
| 3,991
|
public void itemStateChanged(ItemEvent e) { Object source = e.getItemSelectable(); if (source == useQuery) { if (useQuery.isSelected()) { queryWizard.setEnabled(true); as400p.remove(as400FieldP); as400p.add(as400QueryP, BorderLayout.SOUTH); } else { queryWizard.setEnabled(false); as400p.remove(as400QueryP); as400p.add(as400FieldP, BorderLayout.SOUTH); } this.validate(); this.repaint(); } }
|
public void itemStateChanged(ItemEvent e) { Object source = e.getItemSelectable(); if (source == useQuery) { if (useQuery.isSelected()) { queryWizard.setEnabled(true); as400p.remove(as400FieldP); as400p.add(as400QueryP, BorderLayout.SOUTH); } else { queryWizard.setEnabled(false); as400p.remove(as400QueryP); as400p.add(as400FieldP, BorderLayout.SOUTH); } this.validate(); this.repaint(); } }
| 3,992
|
public void itemStateChanged(ItemEvent e) { Object source = e.getItemSelectable(); if (source == useQuery) { if (useQuery.isSelected()) { queryWizard.setEnabled(true); as400p.remove(as400FieldP); as400p.add(as400QueryP, BorderLayout.SOUTH); } else { queryWizard.setEnabled(false); as400p.remove(as400QueryP); as400p.add(as400FieldP, BorderLayout.SOUTH); } this.validate(); this.repaint(); } }
|
public void itemStateChanged(ItemEvent e) { Object source = e.getItemSelectable(); if (source == useQuery) { if (useQuery.isSelected()) { queryWizard.setEnabled(true); as400p.remove(as400FieldP); as400p.add(as400QueryP, BorderLayout.SOUTH); } else { queryWizard.setEnabled(false); as400p.remove(as400QueryP); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); } this.validate(); this.repaint(); } }
| 3,993
|
public void show() { if (! isVisible()) { moveToFront(); super.show(); JDesktopPane pane = getDesktopPane(); if (pane != null) pane.setSelectedFrame(this); else { try { setSelected(true); } catch (PropertyVetoException e) { // Do nothing. if they don't want to be selected. } } if (isFirstTimeVisible) { isFirstTimeVisible = false; fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED); } } }
|
public void show() { if (! isVisible()) { super.show(); JDesktopPane pane = getDesktopPane(); if (pane != null) pane.setSelectedFrame(this); else { try { setSelected(true); } catch (PropertyVetoException e) { // Do nothing. if they don't want to be selected. } } if (isFirstTimeVisible) { isFirstTimeVisible = false; fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED); } } }
| 3,994
|
public Object clone() throws CloneNotSupportedException { FieldAxis cloneObj = (FieldAxis) super.clone(); synchronized (this.fieldGroupOwnedHash) { synchronized(cloneObj.fieldGroupOwnedHash) { cloneObj.fieldGroupOwnedHash = Collections.synchronizedSet(new HashSet(this.fieldGroupOwnedHash.size())); Iterator iter = this.fieldGroupOwnedHash.iterator(); while (iter.hasNext()) { cloneObj.fieldGroupOwnedHash.add(iter.next()); } } } return cloneObj; }
|
public Object clone() throws CloneNotSupportedException { FieldAxis cloneObj = (FieldAxis) super.clone(); synchronized (this.fieldGroupOwnedHash) { synchronized(cloneObj.fieldGroupOwnedHash) { cloneObj.fieldGroupOwnedHash = Collections.synchronizedSet(new HashSet(this.fieldGroupOwnedHash.size())); Iterator iter = this.fieldGroupOwnedHash.iterator(); while (iter.hasNext()) { cloneObj.fieldGroupOwnedHash.add(((Group)iter.next()).clone()); } } } return cloneObj; }
| 3,995
|
protected PropertyChangeListener createPropertyChangeListener(JSlider slider) { // TODO: try to figure out why it might be necessary to override this // method as is done in Sun's implementation return super.createPropertyChangeListener(slider); }
|
protected PropertyChangeListener createPropertyChangeListener(JSlider slider) { // TODO: try to figure out why it might be necessary to override this // method as is done in Sun's implementation return new MetalPropertyListener(); }
| 3,997
|
public static ComponentUI createUI(JComponent component) { if (instances == null) instances = new HashMap(); Object o = instances.get(component); MetalSliderUI instance; if (o == null) { instance = new MetalSliderUI(); instances.put(component, instance); } else instance = (MetalSliderUI) o; return instance; }
|
public static ComponentUI createUI(JComponent component) { if (instances == null) instances = new HashMap(); Object o = instances.get(component); MetalSliderUI instance; if (o == null) { instance = new MetalSliderUI(); instances.put(component, instance); } else instance = (MetalSliderUI) o; return instance; }
| 3,998
|
protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... g.setColor(new Color(153, 153, 204)); g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength); }
|
protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... if (slider.isEnabled()) g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getControlDisabled()); g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength); }
| 3,999
|
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... g.setColor(new Color(153, 153, 204)); g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength, y); }
|
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... if (slider.isEnabled()) g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getControlDisabled()); g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength, y); }
| 4,000
|
protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... g.setColor(new Color(153, 153, 204)); g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength / 2); }
|
protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... if (slider.isEnabled()) g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getControlDisabled()); g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength / 2); }
| 4,001
|
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... g.setColor(new Color(153, 153, 204)); g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength / 2, y); }
|
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { // Note the incoming 'g' has a translation in place to get us to the // start of the tick rect already... // TODO: get color from UIManager... if (slider.isEnabled()) g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getControlDisabled()); g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength / 2, y); }
| 4,002
|
public void paintTrack(Graphics g) { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1, getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray, Color.white); } else { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width - getTrackWidth()) / 2, trackRect.y, getTrackWidth(), trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray, Color.white); } }
|
public void paintTrack(Graphics g) { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1, getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray, Color.white); } else { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width - getTrackWidth()) / 2, trackRect.y, getTrackWidth(), trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray, Color.white); } }
| 4,004
|
public void paintTrack(Graphics g) { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1, getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray, Color.white); } else { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width - getTrackWidth()) / 2, trackRect.y, getTrackWidth(), trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray, Color.white); } }
|
public void paintTrack(Graphics g) { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1, getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray, Color.white); } else { if (filledSlider) { // TODO: fill the track } BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width - getTrackWidth()) / 2, trackRect.y, getTrackWidth(), trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray, Color.white); } }
| 4,006
|
private final void emitObjects(NativeStream os, VmArchitecture arch, Object skipMe) throws BuildException { log.info("Emitting objects "); PrintWriter debugOut = null; try { if (debug) { debugOut = new PrintWriter(new FileWriter(debugFile)); } final ObjectEmitter emitter = new ObjectEmitter(clsMgr, os, debugOut, legalInstanceClasses); final long start = System.currentTimeMillis(); int cnt = 0; int lastUnresolved = -1; int loops = 0; while (true) { loops++; compileClasses(os, arch); final Collection objectRefs = new ArrayList(os.getObjectRefs()); int unresolved = 0; // Number of unresolved references found in the following loop int emitted = 0; // Number of emitted objects in the following loop for (Iterator i = objectRefs.iterator(); i.hasNext();) { X86Stream.ObjectRef ref = (X86Stream.ObjectRef) i.next(); if (!ref.isResolved()) { final Object obj = ref.getObject(); if (!(obj instanceof Label)) { unresolved++; if (obj instanceof VmType) { ((VmType) obj).link(); } if (obj != skipMe) { emitter.emitObject(obj); emitted++; X86Stream.ObjectRef newRef = os.getObjectRef(obj); if (ref != newRef) { throw new RuntimeException("Object has changed during emitObject! type=" + obj.getClass().getName()); } if (!ref.isResolved()) { throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? "null" : obj.getClass().getName())); } } } } } if (unresolved == lastUnresolved) { if ((unresolved == 0) || (skipMe != null)) { break; } } lastUnresolved = unresolved; cnt += emitted; } final long end = System.currentTimeMillis(); log.info("Emitted " + cnt + " objects, took " + (end - start) + "ms in " + loops + " loops"); if (debugOut != null) { debugOut.close(); debugOut = null; } } catch (ClassNotFoundException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } }
|
private final void emitObjects(NativeStream os, VmArchitecture arch, Object skipMe) throws BuildException { log("Emitting objects", Project.MSG_DEBUG); PrintWriter debugOut = null; try { if (debug) { debugOut = new PrintWriter(new FileWriter(debugFile)); } final ObjectEmitter emitter = new ObjectEmitter(clsMgr, os, debugOut, legalInstanceClasses); final long start = System.currentTimeMillis(); int cnt = 0; int lastUnresolved = -1; int loops = 0; while (true) { loops++; compileClasses(os, arch); final Collection objectRefs = new ArrayList(os.getObjectRefs()); int unresolved = 0; // Number of unresolved references found in the following loop int emitted = 0; // Number of emitted objects in the following loop for (Iterator i = objectRefs.iterator(); i.hasNext();) { X86Stream.ObjectRef ref = (X86Stream.ObjectRef) i.next(); if (!ref.isResolved()) { final Object obj = ref.getObject(); if (!(obj instanceof Label)) { unresolved++; if (obj instanceof VmType) { ((VmType) obj).link(); } if (obj != skipMe) { emitter.emitObject(obj); emitted++; X86Stream.ObjectRef newRef = os.getObjectRef(obj); if (ref != newRef) { throw new RuntimeException("Object has changed during emitObject! type=" + obj.getClass().getName()); } if (!ref.isResolved()) { throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? "null" : obj.getClass().getName())); } } } } } if (unresolved == lastUnresolved) { if ((unresolved == 0) || (skipMe != null)) { break; } } lastUnresolved = unresolved; cnt += emitted; } final long end = System.currentTimeMillis(); log.info("Emitted " + cnt + " objects, took " + (end - start) + "ms in " + loops + " loops"); if (debugOut != null) { debugOut.close(); debugOut = null; } } catch (ClassNotFoundException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } }
| 4,007
|
private final void emitObjects(NativeStream os, VmArchitecture arch, Object skipMe) throws BuildException { log.info("Emitting objects "); PrintWriter debugOut = null; try { if (debug) { debugOut = new PrintWriter(new FileWriter(debugFile)); } final ObjectEmitter emitter = new ObjectEmitter(clsMgr, os, debugOut, legalInstanceClasses); final long start = System.currentTimeMillis(); int cnt = 0; int lastUnresolved = -1; int loops = 0; while (true) { loops++; compileClasses(os, arch); final Collection objectRefs = new ArrayList(os.getObjectRefs()); int unresolved = 0; // Number of unresolved references found in the following loop int emitted = 0; // Number of emitted objects in the following loop for (Iterator i = objectRefs.iterator(); i.hasNext();) { X86Stream.ObjectRef ref = (X86Stream.ObjectRef) i.next(); if (!ref.isResolved()) { final Object obj = ref.getObject(); if (!(obj instanceof Label)) { unresolved++; if (obj instanceof VmType) { ((VmType) obj).link(); } if (obj != skipMe) { emitter.emitObject(obj); emitted++; X86Stream.ObjectRef newRef = os.getObjectRef(obj); if (ref != newRef) { throw new RuntimeException("Object has changed during emitObject! type=" + obj.getClass().getName()); } if (!ref.isResolved()) { throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? "null" : obj.getClass().getName())); } } } } } if (unresolved == lastUnresolved) { if ((unresolved == 0) || (skipMe != null)) { break; } } lastUnresolved = unresolved; cnt += emitted; } final long end = System.currentTimeMillis(); log.info("Emitted " + cnt + " objects, took " + (end - start) + "ms in " + loops + " loops"); if (debugOut != null) { debugOut.close(); debugOut = null; } } catch (ClassNotFoundException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } }
|
private final void emitObjects(NativeStream os, VmArchitecture arch, Object skipMe) throws BuildException { log.info("Emitting objects "); PrintWriter debugOut = null; try { if (debug) { debugOut = new PrintWriter(new FileWriter(debugFile)); } final ObjectEmitter emitter = new ObjectEmitter(clsMgr, os, debugOut, legalInstanceClasses); final long start = System.currentTimeMillis(); int cnt = 0; int lastUnresolved = -1; int loops = 0; while (true) { loops++; compileClasses(os, arch); final Collection objectRefs = new ArrayList(os.getObjectRefs()); int unresolved = 0; // Number of unresolved references found in the following loop int emitted = 0; // Number of emitted objects in the following loop for (Iterator i = objectRefs.iterator(); i.hasNext();) { X86Stream.ObjectRef ref = (X86Stream.ObjectRef) i.next(); if (!ref.isResolved()) { final Object obj = ref.getObject(); if (!(obj instanceof Label)) { unresolved++; if (obj instanceof VmType) { ((VmType) obj).link(); } if (obj != skipMe) { emitter.emitObject(obj); emitted++; X86Stream.ObjectRef newRef = os.getObjectRef(obj); if (ref != newRef) { throw new RuntimeException("Object has changed during emitObject! type=" + obj.getClass().getName()); } if (!ref.isResolved()) { throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? "null" : obj.getClass().getName())); } } } } } if (unresolved == lastUnresolved) { if ((unresolved == 0) || (skipMe != null)) { break; } } lastUnresolved = unresolved; cnt += emitted; } final long end = System.currentTimeMillis(); log("Emitted " + cnt + " objects, took " + (end - start) + "ms in " + loops + " loops"); if (debugOut != null) { debugOut.close(); debugOut = null; } } catch (ClassNotFoundException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } }
| 4,008
|
public final void execute() throws BuildException { final long lmJar = jarFile.lastModified(); final long lmKernel = kernelFile.lastModified(); final long lmDest = destFile.lastModified(); final long lmPIL = getPluginListFile().lastModified(); final PluginList piList; final long lmPI; try { piList = getPluginList(); lmPI = piList.lastModified(); } catch (PluginException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } if ((lmJar < lmDest) && (lmKernel < lmDest) && (lmPIL < lmDest) && (lmPI < lmDest)) { // No need to do anything, skip return; } try { System.getProperties().setProperty(BUILDTIME_PROPERTY, "1"); // Load the plugin descriptors final PluginRegistry piRegistry; piRegistry = new PluginRegistryModel(piList.getDescriptorUrlList()); testPluginPrerequisites(piRegistry); /* Now create the processor */ final VmProcessor proc = createProcessor(); final VmArchitecture arch = proc.getArchitecture(); log("Building for " + proc.getCPUID()); clsMgr = new VmClassLoader(classesURL, proc.getArchitecture()); final NativeStream os = createNativeStream(); final Object clInitCaller = new Label("$$clInitCaller"); VmType systemClasses[] = VmType.initializeForBootImage(clsMgr); for (int i = 0; i < systemClasses.length; i++) { clsMgr.addLoadedClass(systemClasses[i].getName(), systemClasses[i]); } // First copy the native kernel file copyKernel(os); os.setObjectRef(bootHeapStart); // Setup a call to our first java method initImageHeader(os, clInitCaller, piRegistry); // Create the initial stack createInitialStack(os, initialStack, initialStackPtr); /* Now load the classes */ loadClass(VmMethodCode.class); loadClass(Unsafe.class); loadClass(VmClassLoader.class); loadClass(VmType[].class); /* Now emit the processor */ os.getObjectRef(proc); /* Let the compilers load its native symbol offsets */ final NativeCodeCompiler[] cmps = arch.getCompilers(); for (int i = 0; i < cmps.length; i++) { final NativeCodeCompiler cmp = cmps[i]; cmp.initialize(clsMgr); os.getObjectRef(cmp); } for (Iterator i = BootClasses.values().iterator(); i.hasNext();) { BootClassInfo bci = (BootClassInfo) i.next(); if (!bci.isPackage()) { clsMgr.loadClass(bci.getName(), true); } } // Load the jarfile as byte-array copyJarFile(os); // Now emit all object images to the actual image emitObjects(os, arch, clsMgr); /* Set the bootclasses */ VmType bootClasses[] = clsMgr.prepareAfterBootstrap(); os.getObjectRef(bootClasses); emitObjects(os, arch, clsMgr); // Disallow the loading of new classes clsMgr.setFailOnNewLoad(true); // Turn auto-compilation on clsMgr.setCompileRequired(); // Emit the remaining objects emitObjects(os, arch, null); /* Write static initializer code */ emitStaticInitializerCalls(os, bootClasses, clInitCaller); // This is the end of the image X86Stream.ObjectInfo dummyObjectAtEnd = os.startObject(loadClass(VmMethodCode.class)); pageAlign(os); dummyObjectAtEnd.markEnd(); os.setObjectRef(imageEnd); os.setObjectRef(bootHeapEnd); /* Link all native symbols */ linkNativeSymbols(os); // Patch multiboot header patchHeader(os); // Store the image storeImage(os); // Generate the listfile printLabels(os, bootClasses); for (int i = 0; i < cmps.length; i++) { cmps[i].dumpStatistics(); } log.info("Done."); } catch (Throwable ex) { ex.printStackTrace(); throw new BuildException(ex); } }
|
public final void execute() throws BuildException { final long lmJar = jarFile.lastModified(); final long lmKernel = kernelFile.lastModified(); final long lmDest = destFile.lastModified(); final long lmPIL = getPluginListFile().lastModified(); final PluginList piList; final long lmPI; try { piList = getPluginList(); lmPI = piList.lastModified(); } catch (PluginException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } if ((lmJar < lmDest) && (lmKernel < lmDest) && (lmPIL < lmDest) && (lmPI < lmDest)) { // No need to do anything, skip return; } try { System.getProperties().setProperty(BUILDTIME_PROPERTY, "1"); // Load the plugin descriptors final PluginRegistry piRegistry; piRegistry = new PluginRegistryModel(piList.getDescriptorUrlList()); testPluginPrerequisites(piRegistry); /* Now create the processor */ final VmProcessor proc = createProcessor(); final VmArchitecture arch = proc.getArchitecture(); log("Building for " + proc.getCPUID()); clsMgr = new VmClassLoader(classesURL, proc.getArchitecture()); final NativeStream os = createNativeStream(); final Object clInitCaller = new Label("$$clInitCaller"); VmType systemClasses[] = VmType.initializeForBootImage(clsMgr); for (int i = 0; i < systemClasses.length; i++) { clsMgr.addLoadedClass(systemClasses[i].getName(), systemClasses[i]); } // First copy the native kernel file copyKernel(os); os.setObjectRef(bootHeapStart); // Setup a call to our first java method initImageHeader(os, clInitCaller, piRegistry); // Create the initial stack createInitialStack(os, initialStack, initialStackPtr); /* Now load the classes */ loadClass(VmMethodCode.class); loadClass(Unsafe.class); loadClass(VmClassLoader.class); loadClass(VmType[].class); /* Now emit the processor */ os.getObjectRef(proc); /* Let the compilers load its native symbol offsets */ final NativeCodeCompiler[] cmps = arch.getCompilers(); for (int i = 0; i < cmps.length; i++) { final NativeCodeCompiler cmp = cmps[i]; cmp.initialize(clsMgr); os.getObjectRef(cmp); } for (Iterator i = BootClasses.values().iterator(); i.hasNext();) { BootClassInfo bci = (BootClassInfo) i.next(); if (!bci.isPackage()) { clsMgr.loadClass(bci.getName(), true); } } // Load the jarfile as byte-array copyJarFile(os); // Now emit all object images to the actual image emitObjects(os, arch, clsMgr); /* Set the bootclasses */ VmType bootClasses[] = clsMgr.prepareAfterBootstrap(); os.getObjectRef(bootClasses); emitObjects(os, arch, clsMgr); // Disallow the loading of new classes clsMgr.setFailOnNewLoad(true); // Turn auto-compilation on clsMgr.setCompileRequired(); // Emit the remaining objects emitObjects(os, arch, null); /* Write static initializer code */ emitStaticInitializerCalls(os, bootClasses, clInitCaller); // This is the end of the image X86Stream.ObjectInfo dummyObjectAtEnd = os.startObject(loadClass(VmMethodCode.class)); pageAlign(os); dummyObjectAtEnd.markEnd(); os.setObjectRef(imageEnd); os.setObjectRef(bootHeapEnd); /* Link all native symbols */ linkNativeSymbols(os); // Patch multiboot header patchHeader(os); // Store the image storeImage(os); // Generate the listfile printLabels(os, bootClasses); for (int i = 0; i < cmps.length; i++) { cmps[i].dumpStatistics(); } log("Done."); } catch (Throwable ex) { ex.printStackTrace(); throw new BuildException(ex); } }
| 4,009
|
protected void storeImage(NativeStream os) throws BuildException { try { log.info("Creating image"); FileOutputStream fos = new FileOutputStream(destFile); fos.write(os.getBytes(), 0, os.getLength()); fos.close(); } catch (IOException ex) { throw new BuildException(ex); } }
|
protected void storeImage(NativeStream os) throws BuildException { try { log("Creating image"); FileOutputStream fos = new FileOutputStream(destFile); fos.write(os.getBytes(), 0, os.getLength()); fos.close(); } catch (IOException ex) { throw new BuildException(ex); } }
| 4,011
|
private IntItem(int kind, Register reg, int value, int local) { super(kind, reg, local); this.value = value; }
|
private IntItem(int kind, Register reg, int value, int local) { super(kind, reg, local); this.value = value; }
| 4,012
|
protected WordItem cloneConstant() { return createConst(getValue()); }
|
protected WordItem cloneConstant() { return factory.createIConst(getValue()); }
| 4,013
|
public static LifespanPolicyValue from_int(int code) { try { return enume [ code ]; } catch (ArrayIndexOutOfBoundsException ex) { throw new BAD_OPERATION("Invalid enumeration code " + code); } }
|
public static LifespanPolicyValue from_int(int code) { try { return enume [ code ]; } catch (ArrayIndexOutOfBoundsException ex) { BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); bad.minor = Minor.PolicyType; throw bad; } }
| 4,014
|
public String getFormat() { return KeyPairCodecFactory.getEncodingShortName(defaultFormat); }
|
public String getFormat() { return FormatUtil.getEncodingShortName(defaultFormat); }
| 4,015
|
public final SelectionKey register(Selector selin, int ops, Object att) throws ClosedChannelException { if (! isOpen()) throw new ClosedChannelException(); if ((ops & ~validOps()) != 0) throw new IllegalArgumentException(); SelectionKey key = null; AbstractSelector selector = (AbstractSelector) selin; synchronized (blockingLock()) { key = locate(selector); if (key != null) { if (att != null) key.attach(att); } else { key = selector.register(this, ops, att); if (key != null) addSelectionKey(key); } } return key; }
|
public final SelectionKey register(Selector selin, int ops, Object att) throws ClosedChannelException { if (! isOpen()) throw new ClosedChannelException(); if ((ops & ~validOps()) != 0) throw new IllegalArgumentException(); SelectionKey key = null; AbstractSelector selector = (AbstractSelector) selin; synchronized (blockingLock()) { key = locate(selector); if (key != null && key.isValid()) { if (att != null) key.attach(att); } else { key = selector.register(this, ops, att); if (key != null && key.isValid()) addSelectionKey(key); } } return key; }
| 4,016
|
public static void main(String[] args) throws InterruptedException { boolean useDoubleBuffer = (args.length > 0) && args[0].equals("buffer"); final Frame wnd = new Frame("AWTTest"); try { //wnd.setSize(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getSize()); wnd.setSize(600, 400); wnd.setLayout(new BorderLayout()); //wnd.setLocation(75, 50); wnd.setBackground(Color.GREEN); final List l = new List(); l.add("Item 1"); l.add("Item 2"); l.add("Item 3"); //wnd.add(l, BorderLayout.NORTH); final Button b = new Button("Hello world"); b.addActionListener(new ActionListener() { int i =0; public void actionPerformed(ActionEvent e) { System.out.println("Action performed " + e); switch(i){ case 0:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.WEST); break; } case 1:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.SOUTH); break; } case 2:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.EAST); break; } default: b.setLabel(String.valueOf(i)); wnd.setVisible(false); } i++; wnd.validate(); } }); wnd.add(b, BorderLayout.CENTER); b.setBackground(Color.YELLOW); final Button b2 = new Button("Left"); final Scrollbar sb = new Scrollbar(Scrollbar.HORIZONTAL); final JCheckBox cb1 = new JCheckBox("Right"); wnd.add(b2, BorderLayout.WEST); b2.setBackground(Color.RED); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Action on b2"); if (sb.getValue() + sb.getBlockIncrement() <= sb.getMaximum()) { sb.setValue(sb.getValue() + sb.getBlockIncrement()); } else { Frame f2 = new Frame("New frame"); f2.setSize(200, 100); f2.show(); } } }); wnd.add(cb1, BorderLayout.EAST); cb1.setBackground(Color.WHITE); wnd.add(sb, BorderLayout.SOUTH); wnd.show(); while (wnd.isVisible()) { Thread.sleep(500); } // Font f = wnd.getFont();// System.out.println(f.getName());// wnd.getFontMetrics(f);// for (int i = 0; i < 30; i++) {// wnd.setLocation(wnd.getX() + 5, wnd.getY() + 4);// if ((i % 10) == 0) {// cb1.setState(!cb1.getState());// Thread.sleep(2500);// } else {// if ((i % 5) == 0) {// // Intended mixing of width & height, just for the fun of the test// wnd.setSize(wnd.getHeight(), wnd.getWidth());// }// Thread.sleep(100);// }// } Thread.sleep(5000); wnd.hide(); }catch(Throwable t){ t.printStackTrace(); } finally { wnd.dispose(); } }
|
public static void main(String[] args) throws InterruptedException { boolean useDoubleBuffer = (args.length > 0) && args[0].equals("buffer"); final Frame wnd = new Frame("AWTTest"); try { //wnd.setSize(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getSize()); wnd.setSize(600, 400); wnd.setLayout(new BorderLayout()); //wnd.setLocation(75, 50); wnd.setBackground(Color.GREEN); final List l = new List(); l.add("Item 1"); l.add("Item 2"); l.add("Item 3"); //wnd.add(l, BorderLayout.NORTH); final Button b = new Button("Hello world"); b.addActionListener(new ActionListener() { int i =0; public void actionPerformed(ActionEvent e) { System.out.println("Action performed " + e); switch(i){ case 0:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.WEST); break; } case 1:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.SOUTH); break; } case 2:{ wnd.add(new Button(String.valueOf(i)), BorderLayout.EAST); break; } default: b.setLabel(String.valueOf(i)); wnd.setVisible(false); } i++; wnd.validate(); } }); wnd.add(b, BorderLayout.CENTER); b.setBackground(Color.YELLOW); final Button b2 = new Button("Left"); final Scrollbar sb = new Scrollbar(Scrollbar.HORIZONTAL); final JCheckBox cb1 = new JCheckBox("Right"); wnd.add(b2, BorderLayout.WEST); b2.setBackground(Color.RED); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Action on b2"); if (sb.getValue() + sb.getBlockIncrement() <= sb.getMaximum()) { sb.setValue(sb.getValue() + sb.getBlockIncrement()); } else { Frame f2 = new Frame("New frame"); f2.setSize(200, 100); f2.show(); } } }); wnd.add(cb1, BorderLayout.EAST); cb1.setBackground(Color.WHITE); System.out.println(wnd.getFont().getName()); System.out.println(wnd.getFont().getClass().getName()); System.out.println(wnd.getFontMetrics(wnd.getFont()).getClass().getName()); wnd.show(); while (wnd.isVisible()) { Thread.sleep(500); } // Font f = wnd.getFont();// System.out.println(f.getName());// wnd.getFontMetrics(f);// for (int i = 0; i < 30; i++) {// wnd.setLocation(wnd.getX() + 5, wnd.getY() + 4);// if ((i % 10) == 0) {// cb1.setState(!cb1.getState());// Thread.sleep(2500);// } else {// if ((i % 5) == 0) {// // Intended mixing of width & height, just for the fun of the test// wnd.setSize(wnd.getHeight(), wnd.getWidth());// }// Thread.sleep(100);// }// } Thread.sleep(5000); wnd.hide(); }catch(Throwable t){ t.printStackTrace(); } finally { wnd.dispose(); } }
| 4,017
|
public HTTPURLConnection(URL url) throws IOException { super(url); requestHeaders = new Headers(); AccessController.doPrivileged(this.new GetHTTPPropertiesAction()); }
|
public HTTPURLConnection(URL url) throws IOException { super(url); requestHeaders = new Headers(); proxyHostname = SystemProperties.getProperty("http.proxyHost"); if (proxyHostname != null && proxyHostname.length() > 0) { String port = SystemProperties.getProperty("http.proxyPort"); if (port != null && port.length() > 0) { proxyPort = Integer.parseInt(port); } else { proxyHostname = null; proxyPort = -1; } } agent = SystemProperties.getProperty("http.agent"); String ka = SystemProperties.getProperty("http.keepAlive"); keepAlive = !(ka != null && "false".equals(ka)); }
| 4,018
|
public void addRequestProperty(String key, String value) { super.addRequestProperty(key, value); String old = requestHeaders.getValue(key); if (old == null) { requestHeaders.put(key, value); } else { requestHeaders.put(key, old + "," + value); } }
|
public void addRequestProperty(String key, String value) { super.addRequestProperty(key, value); String old = requestHeaders.getValue(key); if (old == null) { requestHeaders.put(key, value); } else { requestHeaders.put(key, old + "," + value); } }
| 4,019
|
public String getHeaderField(int index) { if (!connected) { try { connect(); } catch (IOException e) { return null; } } if (index == 0) { return getStatusLine(response); } Iterator i = response.getHeaders().entrySet().iterator(); Map.Entry entry; int count = 1; do { if (!i.hasNext()) { return null; } entry = (Map.Entry) i.next(); count++; } while (count <= index); return (String) entry.getValue(); }
|
public String getHeaderField(int index) { if (!connected) { try { connect(); } catch (IOException e) { return null; } } if (index == 0) { return getStatusLine(response); } Iterator i = response.getHeaders().entrySet().iterator(); Map.Entry entry; int count = 1; do { if (!i.hasNext()) { return null; } entry = (Map.Entry) i.next(); count++; } while (count <= index); return (String) entry.getValue(); }
| 4,020
|
public String getHeaderFieldKey(int index) { if (!connected) { try { connect(); } catch (IOException e) { return null; } } if (index == 0) { return null; } Iterator i = response.getHeaders().entrySet().iterator(); Map.Entry entry; int count = 1; do { if (!i.hasNext()) { return null; } entry = (Map.Entry) i.next(); count++; } while (count <= index); return (String) entry.getKey(); }
|
public String getHeaderFieldKey(int index) { if (!connected) { try { connect(); } catch (IOException e) { return null; } } if (index == 0) { return null; } Iterator i = response.getHeaders().entrySet().iterator(); Map.Entry entry; int count = 1; do { if (!i.hasNext()) { return null; } entry = (Map.Entry) i.next(); count++; } while (count <= index); return (String) entry.getKey(); }
| 4,021
|
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Headers headers = response.getHeaders(); LinkedHashMap ret = new LinkedHashMap(); ret.put(null, Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return Collections.unmodifiableMap(ret); }
|
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Headers headers = response.getHeaders(); LinkedHashMap ret = new LinkedHashMap(); ret.put(null, Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return Collections.unmodifiableMap(ret); }
| 4,022
|
public Map getRequestProperties() { if (connected) throw new IllegalStateException("Already connected"); return requestHeaders; }
|
public Map getRequestProperties() { if (connected) throw new IllegalStateException("Already connected"); Map m = requestHeaders.getAsMap(); return Collections.unmodifiableMap(m); }
| 4,023
|
public String getRequestProperty(String key) { if (key == null) return null; return requestHeaders.getValue(key); }
|
public String getRequestProperty(String key) { if (key == null) return null; return requestHeaders.getValue(key); }
| 4,024
|
public void insertIcon(Icon icon) { SimpleAttributeSet atts = new SimpleAttributeSet(); atts.addAttribute(StyleConstants.IconAttribute, icon); atts.addAttribute(StyleConstants.NameAttribute, StyleConstants.IconElementName); try { getDocument().insertString(getCaret().getDot(), " ", atts); } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location"); err.initCause(ex); throw err; } }
|
public void insertIcon(Icon icon) { SimpleAttributeSet atts = new SimpleAttributeSet(); atts.addAttribute(StyleConstants.IconAttribute, icon); atts.addAttribute(StyleConstants.NameAttribute, StyleConstants.IconElementName); try { getDocument().insertString(getCaret().getDot(), " ", atts); } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location"); err.initCause(ex); throw err; } }
| 4,025
|
public static void load(String filename) { Runtime.getRuntime().load(filename); }
|
public static void load(String filename) { Runtime.getRuntime().load(filename, VMStackWalker.getCallingClassLoader()); }
| 4,026
|
public static void loadLibrary(String libname) { Runtime.getRuntime().loadLibrary(libname); }
|
public static void loadLibrary(String libname) { Runtime.getRuntime().loadLibrary(libname, VMStackWalker.getCallingClassLoader()); }
| 4,027
|
public Position createPosition(final int offset) throws BadLocationException { return new Position() { int off = offset; public int getOffset() { return off; } }; }
|
public Position createPosition(final int offset) throws BadLocationException { return new Position() { int off = offset; public int getOffset() { return off; } }; }
| 4,028
|
public Position createPosition(final int offset) throws BadLocationException { return new Position() { int off = offset; public int getOffset() { return off; } }; }
|
public Position createPosition(final int offset) throws BadLocationException { return new Position() { int off = offset; public int getOffset() { return off; } }; }
| 4,029
|
public boolean addValueList (ValueListInterface valueListObj) { List values = valueListObj.getValues(); // do we have any new values? if (values.size() > 0) { addValueListObj(valueListObj); // append in new values to Parameter obj Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = ((Value) iter.next()); internalAddValue(thisValue); } return true; } else { // safety, needed? hasValueListCompactDescription = false; Log.warnln("Warning: no Values appended, ValueList empty. Parameter unchanged."); return false; } }
|
public boolean addValueList (ValueList valueListObj) { List values = valueListObj.getValues(); // do we have any new values? if (values.size() > 0) { addValueListObj(valueListObj); // append in new values to Parameter obj Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = ((Value) iter.next()); internalAddValue(thisValue); } return true; } else { // safety, needed? hasValueListCompactDescription = false; Log.warnln("Warning: no Values appended, ValueList empty. Parameter unchanged."); return false; } }
| 4,032
|
public Object clone() throws CloneNotSupportedException { BaseObjectWithValueList cloneObj = (BaseObjectWithValueList) super.clone(); cloneObj.valueListObjects = Collections.synchronizedList(new ArrayList()); int stop = this.valueListObjects.size(); for (int i = 0; i < stop; i++) { cloneObj.valueListObjects.add( ((ValueListInterface) this.valueListObjects.get(i)).clone()); } return cloneObj; }
|
public Object clone() throws CloneNotSupportedException { BaseObjectWithValueList cloneObj = (BaseObjectWithValueList) super.clone(); cloneObj.valueListObjects = Collections.synchronizedList(new ArrayList()); int stop = this.valueListObjects.size(); for (int i = 0; i < stop; i++) { cloneObj.valueListObjects.add( ((ValueList) this.valueListObjects.get(i)).clone()); } return cloneObj; }
| 4,033
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.