hexsha stringlengths 40 40 | size int64 8 1.04M | content stringlengths 8 1.04M | avg_line_length float64 2.24 100 | max_line_length int64 4 1k | alphanum_fraction float64 0.25 0.97 |
|---|---|---|---|---|---|
084e4699f6eca97bf12bc2db370bc7218632a722 | 28,765 | package com.cloud9.biz.services;
import com.cloud9.biz.dao.mybatis.*;
import com.cloud9.biz.models.*;
import com.cloud9.biz.models.vo.StatisticsSectionVo;
import com.cloud9.biz.models.vo.VRecordConfig;
import com.cloud9.biz.models.vo.VScoreQuery;
import com.cloud9.biz.models.vo.VUserInfo;
import com.cloud9.biz.util.BizConstants;
import com.cloud9.biz.util.EduKit;
import com.roroclaw.base.bean.PageBean;
import com.roroclaw.base.handler.BizException;
import com.roroclaw.base.service.BaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* Created by zl on 2017/10/8.
*/
@Service("examScoresService")
@Transactional
public class ScoExamScoresService extends BaseService{
private static Logger logger = LoggerFactory.getLogger(ScoSubjectScoresService.class);
@Autowired
private CommonService commonService;
@Autowired
private TchCourseOpenMapper tchCourseOpenMapper;
@Autowired
private TchScoresConfigMapper tchScoresConfigMapper;
@Autowired
private ScoExamScoresMapper scoExamScoresMapper;
@Autowired
private TchCourseMapper tchCourseMapper;
@Autowired
private SysTeacherInfoMapper sysTeacherInfoMapper;
@Autowired
private ArcStudentInfoMapper arcStudentInfoMapper;
@Autowired
private ScoStuSubjctTotalAvgMapper scoStuSubjctTotalAvgMapper;
@Autowired
private ScoClassStuTotalMapper scoClassStuTotalMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private ScoClassScoreStaticMapper scoClassScoreStaticMapper;
@Autowired
private ExaExamInfoMapper exaExamInfoMapper;
@Autowired
private TchExamScoresConfigMapper tchExamScoresConfigMapper;
@Autowired
private ExaStuExamInfoMapper exaStuExamInfoMapper;
@Autowired
private ScoOtherExamScoresMapper otherExamScoresMapper;
private Lock lock = new ReentrantLock();
/**
* 分页查询登分成绩
* @param pageBean
* @return
*/
public PageBean getRecordScoresPageData(PageBean pageBean,String userId) {
//获取教师信息
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
List<ScoExamScores> resList = this.scoExamScoresMapper.selectRecordScoresPageData(pageBean,sysTeacherInfo.getId());
pageBean.setData(resList);
return pageBean;
}
public List<ScoExamScores> getScoresDatas(String openCourseId,String scoreType,String userId) {
//获取教师信息
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
List<ScoExamScores> resList = this.scoExamScoresMapper.selectScoresDatas(openCourseId,scoreType,sysTeacherInfo.getId());
return resList;
}
/**
* 登分
* @param id 成绩id
* @param score 分数
* @return
*/
public boolean recordScores(String id,String score) {
boolean bol = false;
ScoExamScores scoExamScores = new ScoExamScores();
scoExamScores.setId(id);
// scoExamScores.setStatus(resultStatus);
scoExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.UNSUB);
scoExamScores.setScore(new BigDecimal(score));
bol = this.scoExamScoresMapper.updateByPrimaryKeySelective(scoExamScores) > 0 ? true:false;
return bol;
}
/**
* 登分
* @return
*/
public boolean batchRecordScores(String[] valStrArr,String userId) {
boolean bol = false;
List<ScoExamScores> scoreList = new ArrayList<ScoExamScores>();
for (int i = 0; i < valStrArr.length; i++){
String valStr = valStrArr[i];
String[] valArr = valStr.split("\\|");
String id = valArr[0];
String score = valArr[1];
ScoExamScores scoExamScores = new ScoExamScores();
if(valArr.length == 3){
String remark = valArr[2];
scoExamScores.setRemark(remark);
}else{
scoExamScores.setRemark(null);
}
scoExamScores.setId(id);
// scoExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.UNSUB);
scoExamScores.setScore(new BigDecimal(score));
scoExamScores.setUpdater(userId);
scoExamScores.setUpdateTime(new Date());
scoreList.add(scoExamScores);
}
//判断用户是否是管理员角色
SysUser sysUser = this.sysUserMapper.selectByPrimaryKey(userId);
if (BizConstants.USER_TYPE.SUPER != sysUser.getType()) {//超级管理员
boolean checkbol = this.validateRecordTeacherByUserId(userId,scoreList);
if(!checkbol){
throw new BizException("非登分教师,不可以登分!");
}
}
bol = this.scoExamScoresMapper.batchRecordScores(scoreList) > 0 ? true:false;
return bol;
}
/**
* 提交登分成绩
* @param ids
* @return
*/
public boolean recordScores(String ids) {
boolean bol = false;
String[] idArr = ids.split(",");
List<ScoExamScores> scores = new ArrayList<ScoExamScores>();
for (int i=0;i < idArr.length;i++){
String id = idArr[i];
ScoExamScores scoExamScores = new ScoExamScores();
scoExamScores.setId(id);
scoExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.SUBED);
scores.add(scoExamScores);
}
bol = this.scoExamScoresMapper.batchSubRecordScores(scores) >0 ? true : false;
return bol;
}
/**
* BY ZL
*/
public boolean cleanScoExamScoresInfoByParam(ScoExamScores scoExamScoresInfo) {
boolean bol = true;
this.scoExamScoresMapper.deleteScoExamScoresInfoByParam(scoExamScoresInfo);
return bol;
}
/**
* 获取
* @param pageBean
* @return
*/
public PageBean getRecordConfigPageData(PageBean pageBean) {
List<VRecordConfig> resList = this.tchCourseOpenMapper.selectRecordConfigPageData(pageBean);
//遍历计算当时班级名称
for (int i=0 ; i < resList.size(); i++){
VRecordConfig vRecordConfig = resList.get(i);
String classId = vRecordConfig.getClassId();
// String className = "测试计算班级";//这里测试,后面调用统一方法
String className = commonService.getPresentGradeName(vRecordConfig.getPeriod(),vRecordConfig.getGraduateYear(),vRecordConfig.getSchoolYear(),vRecordConfig.getClassText());
vRecordConfig.setClassText(className);
}
pageBean.setData(resList);
return pageBean;
}
/**
* 登分教师设置
* @param openCourseId
* @param teacherId
* @return
*/
public boolean doTeacherSet(String openCourseId, String teacherId,String scoresType) {
this.tchScoresConfigMapper.deleteByOpenCourseId(openCourseId,scoresType);
TchScoresConfig tchScoresConfig = new TchScoresConfig();
tchScoresConfig.setId(BizConstants.generatorPid());
tchScoresConfig.setCourseOpenId(openCourseId);
tchScoresConfig.setTeacherId(teacherId);
tchScoresConfig.setStatus(BizConstants.RECORD_CONFIG_STATUS.SET_TEACHER);
tchScoresConfig.setScoresType(scoresType);
this.tchScoresConfigMapper.insertSelective(tchScoresConfig);
return true;
}
/**
* 开始登分
* @param openCourseId
* @param scoresType
* @param vUserInfo
* @return
*/
public boolean startRecord(String openCourseId,String scoresType,VUserInfo vUserInfo) throws Exception{
// int k = this.tchScoresConfigMapper.updateStatusByOpenCourseId(openCourseId,scoresType,BizConstants.RECORD_CONFIG_STATUS.SET_STATUS);
TchScoresConfig tchScoresConfig = this.tchScoresConfigMapper.selectConfigByOpenCourseId(openCourseId, scoresType);
if( (tchScoresConfig!=null && BizConstants.RECORD_CONFIG_STATUS.SET_STATUS.equals(tchScoresConfig.getStatus()))){
throw new BizException("已进入登分环节!");
}
//加锁
if(!lock.tryLock()){
throw new BizException("处理中,请稍等!");
}
// lock.lock();
try{
//获取开课信息
TchCourseOpen tchCourseOpen = this.tchCourseOpenMapper.selectByPrimaryKey(openCourseId);
// //如果无备课设置信息,自动设置授课教师为登分教师
// TchScoresConfig tchScoresConfig = this.tchScoresConfigMapper.selectConfigByOpenCourseId(openCourseId,scoresType);
if(tchScoresConfig == null || tchScoresConfig.getTeacherId() == null){
TchCourseWithBLOBs tchCourse = this.tchCourseMapper.selectByPrimaryKey(tchCourseOpen.getCourseId());
this.doTeacherSet(openCourseId,tchCourse.getTeacherId(),scoresType);
}
//查询开课相关学生信息,生成成绩信息
List<ArcStudentInfo> studInfos = this.arcStudentInfoMapper.selectStusByOpenCourseId(openCourseId);
List<ScoExamScores> scoList = new ArrayList<ScoExamScores>();
int stuSize = studInfos.size();
if(stuSize == 0){
throw new BizException("此开课信息无任何学员!");
}
for (int i= 0 ; i < studInfos.size() ; i++){
ArcStudentInfo arcStudentInfo = studInfos.get(i);
ScoExamScores scoExamScores = new ScoExamScores();
scoExamScores.setId(BizConstants.generatorPid());
scoExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.UNSUB);
scoExamScores.setStatus(BizConstants.EXAM_STU_STATUS.NORMALE);
scoExamScores.setCourseOpenId(openCourseId);
scoExamScores.setCreateTime(new Date());
scoExamScores.setCreator(vUserInfo.getId());
scoExamScores.setSchoolYear(tchCourseOpen.getSchoolYear());
scoExamScores.setTerm(tchCourseOpen.getTerm());
scoExamScores.setStuId(arcStudentInfo.getId());
scoExamScores.setType(scoresType);
scoExamScores.setClassId(arcStudentInfo.getClassId());
scoExamScores.setGradeId(tchCourseOpen.getGrade());
// String className = "测试班级";//计算班级名称
String className = commonService.getPresentGradeName(arcStudentInfo.getPeriod(),arcStudentInfo.getGraduateYear(),tchCourseOpen.getSchoolYear(),arcStudentInfo.getClassName());
scoExamScores.setClassName(className);
scoList.add(scoExamScores);
}
if(scoList.size() > 0){
this.scoExamScoresMapper.batchAddScoExamScores(scoList);
}
//设置状态为登分中
int k = this.tchScoresConfigMapper.updateStatusByOpenCourseId(openCourseId,scoresType,BizConstants.RECORD_CONFIG_STATUS.SET_STATUS);
}catch (Exception e){
throw e;
}finally {
lock.unlock();
}
return true;
}
public boolean startTeacher(String openCourseId,String scoresType) {
this.tchScoresConfigMapper.updateStatusByOpenCourseId(openCourseId,scoresType,BizConstants.RECORD_CONFIG_STATUS.RECORDING);
return true;
}
/**
* 设置成绩考试状态
* @param id
* @param status
* @return
*/
public boolean setScoresStatus(String id, String status) {
boolean bol = false;
ScoExamScores scoExamScores = new ScoExamScores();
scoExamScores.setId(id);
scoExamScores.setStatus(status);
if(!status.equals(BizConstants.EXAM_STU_STATUS.NORMALE)){
scoExamScores.setScore(new BigDecimal(0));
}
this.scoExamScoresMapper.updateByPrimaryKeySelective(scoExamScores);
return bol;
}
/**
* 分页获取缺/缓考数据
* @param pageBean
* @return
*/
public PageBean doGetExamScores4StatusPageData(PageBean pageBean) {
List<ScoExamScores> resList = this.scoExamScoresMapper.selectExamScores4StatusPageData(pageBean);
pageBean.setData(resList);
return pageBean;
}
/**
* 分页获分数数据
* @param pageBean
* @return
*/
public PageBean getExamScores4AdminModPageData(PageBean pageBean) {
List<ScoExamScores> resList = this.scoExamScoresMapper.selectExamScores4AdminModPageData(pageBean);
pageBean.setData(resList);
return pageBean;
}
public PageBean getRecordConfigPageData(PageBean pageBean, String userId) {
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
if(sysTeacherInfo != null){
pageBean.getQueryparam().put("teacherId",sysTeacherInfo.getId());
List<VRecordConfig> resList = this.tchCourseOpenMapper.selectRecordConfigPageData(pageBean);
//遍历计算当时班级名称
for (int i=0 ; i < resList.size(); i++){
VRecordConfig vRecordConfig = resList.get(i);
String classId = vRecordConfig.getClassId();
// String className = "测试计算班级";//这里测试,后面调用统一方法
String className = commonService.getPresentGradeName(vRecordConfig.getPeriod(),vRecordConfig.getGraduateYear(),vRecordConfig.getSchoolYear(),vRecordConfig.getClassText());
vRecordConfig.setClassText(className);
vRecordConfig.setClassText(className);
}
pageBean.setData(resList);
}
return pageBean;
}
public PageBean getOtherRecordConfigPageData(PageBean pageBean, String userId) {
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
if(sysTeacherInfo != null){
pageBean.getQueryparam().put("teacherId",sysTeacherInfo.getId());
List<VRecordConfig> resList = exaExamInfoMapper.selectOtherRecordConfigPageData(pageBean);
pageBean.setData(resList);
}
return pageBean;
}
public boolean updateStatusByOpenCourseId(String openCourseId,String scoresType,String status){
this.tchScoresConfigMapper.updateStatusByOpenCourseId(openCourseId,scoresType,status);
return true;
}
public boolean endScoreConfig(String openCourseId,String scoresType){
this.tchScoresConfigMapper.updateStatusByOpenCourseId(openCourseId,scoresType,BizConstants.RECORD_CONFIG_STATUS.END);
//修改此设置下所有成绩状态
this.scoExamScoresMapper.updateRecordStatusByOpenCourseId(openCourseId,scoresType,BizConstants.RECORDE_STATUS.PUBLISH);
return true;
}
public boolean validateRecordTeacherByUserId(String userId, List<ScoExamScores> scoreList) {
boolean bol = false;
List<String> teacherUserIdList= this.tchScoresConfigMapper.validateTeacherUserIdByScore(userId, scoreList);
if(teacherUserIdList.size() == 1 && teacherUserIdList.get(0).equals(userId)){
bol = true;
}
return bol;
}
public boolean validateRecordTeacherByUserId(String userId,String scoreId) {
boolean bol = false;
int num = this.tchScoresConfigMapper.selectRecordTeacherCountByUserId(userId, scoreId);
if(num == 1){
bol = true;
}
return bol;
}
////////////by zl
public List<ScoExamScoresForQuery> getScoreCousesForQueryListByParam(ScoExamScoresForQuery scoExamScoresForQuery) {
List<ScoExamScoresForQuery> resList = this.scoExamScoresMapper.selectScoreCousesForQueryListByParam(scoExamScoresForQuery);
return resList;
}
public List<ScoExamScoresForQuery> getScoreStuForQueryListByParam(ScoExamScoresForQuery scoExamScoresForQuery) {
List<ScoExamScoresForQuery> resList = this.scoExamScoresMapper.selectScoreStuForQueryListByParam(scoExamScoresForQuery);
return resList;
}
public List<ScoExamScoresForQuery> getScoreStuForScoreCollectingQueryByParam(ScoExamScoresForQuery scoExamScoresForQuery) {
List<ScoExamScoresForQuery> resList = this.scoExamScoresMapper.selectScoreStuForScoreCollectingQueryByParam(scoExamScoresForQuery);
return resList;
}
public List<ScoExamScoresForQuery> getCourseItemsForPower(ScoExamScoresForQuery scoExamScoresForQuery) {
List<ScoExamScoresForQuery> resList = this.scoExamScoresMapper.selectScoreCousesForQueryListByParam(scoExamScoresForQuery);
return resList;
}
/**
* 学生成绩查询
* @param pageBean
* @param
* @return
*/
public PageBean stuQueryScorePageData(PageBean pageBean, String stuId,String normaleStatus,String recordStatus,String subjectScoreStatus) {
List<VScoreQuery> resList = this.scoExamScoresMapper.stuQueryScorePageData(pageBean, stuId, recordStatus,subjectScoreStatus);
pageBean.setData(resList);
return pageBean;
}
/**
* 获取临时考试记录
* @param pageBean
* @return
*/
public PageBean getOtherRecordConfigPageData(PageBean pageBean) {
List<VRecordConfig> resList = exaExamInfoMapper.selectOtherRecordConfigPageData(pageBean);
pageBean.setData(resList);
return pageBean;
}
public boolean calStatisticsDatas(String schoolYear, String term, String scoreType, String grade) {
boolean bol = true;
this.scoClassStuTotalMapper.deleteClassStuTotal(schoolYear, term, scoreType,grade);
this.scoClassStuTotalMapper.calClassStuTotal(schoolYear, term, scoreType,grade);
this.scoStuSubjctTotalAvgMapper.deleteStuSubjctTotalAvg(schoolYear, term, scoreType, grade);
this.scoStuSubjctTotalAvgMapper.calStuSubjctTotalAvg(schoolYear, term, scoreType, grade);
return bol;
}
public boolean calExamClassStatisticsDatas(String schoolYear, String term, String scoreType, String grade) {
boolean bol = true;
StatisticsSectionVo statisticsSectionVo = getSectionByGrade(grade);
// String period = EduKit.getPeriodByGrade4Statistics(grade);
// StatisticsSectionVo statisticsSectionVo = new StatisticsSectionVo();
// if(BizConstants.PERIOD.PRIMARY_SCHOOL.equals(period)){
// statisticsSectionVo.setExcellent(80);
// statisticsSectionVo.setPass(60);
// statisticsSectionVo.setCol1(100);
// statisticsSectionVo.setCol2(90);
// statisticsSectionVo.setCol3(80);
// statisticsSectionVo.setCol4(70);
// statisticsSectionVo.setCol5(60);
// statisticsSectionVo.setCol6(60);
// }else if(BizConstants.PERIOD.MIDDLE_SCHOOL.equals(period)){
// statisticsSectionVo.setExcellent(96);
// statisticsSectionVo.setPass(72);
// statisticsSectionVo.setCol1(120);
// statisticsSectionVo.setCol2(108);
// statisticsSectionVo.setCol3(96);
// statisticsSectionVo.setCol4(84);
// statisticsSectionVo.setCol5(72);
// statisticsSectionVo.setCol6(72);
// }else if(BizConstants.PERIOD.HIGH_SCHOOL.equals(period)){
// statisticsSectionVo.setExcellent(120);
// statisticsSectionVo.setPass(90);
// statisticsSectionVo.setCol1(150);
// statisticsSectionVo.setCol2(135);
// statisticsSectionVo.setCol3(120);
// statisticsSectionVo.setCol4(105);
// statisticsSectionVo.setCol5(90);
// statisticsSectionVo.setCol6(90);
// }
this.scoClassScoreStaticMapper.deleteDatas(schoolYear, term, scoreType, grade);
this.scoClassScoreStaticMapper.calDatas(schoolYear, term, scoreType, grade,statisticsSectionVo);
return bol;
}
public StatisticsSectionVo getSectionByGrade(String grade){
String period = EduKit.getPeriodByGrade4Statistics(grade);
StatisticsSectionVo statisticsSectionVo = new StatisticsSectionVo();
if(BizConstants.PERIOD.PRIMARY_SCHOOL.equals(period)){
statisticsSectionVo.setExcellent(80);
statisticsSectionVo.setPass(60);
statisticsSectionVo.setCol1(100);
statisticsSectionVo.setCol2(90);
statisticsSectionVo.setCol3(80);
statisticsSectionVo.setCol4(70);
statisticsSectionVo.setCol5(60);
statisticsSectionVo.setCol6(60);
}else if(BizConstants.PERIOD.MIDDLE_SCHOOL.equals(period)){
statisticsSectionVo.setExcellent(96);
statisticsSectionVo.setPass(72);
statisticsSectionVo.setCol1(120);
statisticsSectionVo.setCol2(108);
statisticsSectionVo.setCol3(96);
statisticsSectionVo.setCol4(84);
statisticsSectionVo.setCol5(72);
statisticsSectionVo.setCol6(72);
}else if(BizConstants.PERIOD.HIGH_SCHOOL.equals(period)){
statisticsSectionVo.setExcellent(120);
statisticsSectionVo.setPass(90);
statisticsSectionVo.setCol1(150);
statisticsSectionVo.setCol2(135);
statisticsSectionVo.setCol3(120);
statisticsSectionVo.setCol4(105);
statisticsSectionVo.setCol5(90);
statisticsSectionVo.setCol6(90);
}
return statisticsSectionVo;
}
public boolean doOtherTeacherSet(String examId, String teacherId) {
this.tchExamScoresConfigMapper.deleteByExamId(examId);
TchExamScoresConfig tchExamScoresConfig = new TchExamScoresConfig();
tchExamScoresConfig.setId(BizConstants.generatorPid());
tchExamScoresConfig.setExamId(examId);
tchExamScoresConfig.setTeacherId(teacherId);
tchExamScoresConfig.setStatus(BizConstants.RECORD_CONFIG_STATUS.SET_TEACHER);
this.tchExamScoresConfigMapper.insertSelective(tchExamScoresConfig);
return true;
}
public boolean otherStartTeacher(String examId) {
TchExamScoresConfig tchExamScoresConfig = this.tchExamScoresConfigMapper.selectByExamId(examId);
String teacherId = tchExamScoresConfig.getTeacherId();
if(teacherId != null && !"".equals(teacherId) ){
this.tchExamScoresConfigMapper.updateOtherStatusByExamId(examId, BizConstants.RECORD_CONFIG_STATUS.RECORDING);
}else{
throw new BizException("请设置登分教师!");
}
return true;
}
public boolean otherStartRecord(String examId, VUserInfo vUserInfo) {
TchExamScoresConfig tchExamScoresConfig = this.tchExamScoresConfigMapper.selectByExamId(examId);
String teacherId = tchExamScoresConfig.getTeacherId();
if(teacherId != null && !"".equals(teacherId) ){
//查询开课相关学生信息,生成成绩信息
List<ExaStuExamInfo> exaStuExamInfos = this.exaStuExamInfoMapper.selectStusByExamId(examId);
List<ScoOtherExamScores> scoList = new ArrayList<ScoOtherExamScores>();
int stuSize = exaStuExamInfos.size();
if(stuSize == 0){
throw new BizException("此考试无任何学员!");
}
for (int i= 0 ; i < exaStuExamInfos.size() ; i++){
ExaStuExamInfo exaStuExamInfo = exaStuExamInfos.get(i);
ScoOtherExamScores scoOtherExamScores = new ScoOtherExamScores();
scoOtherExamScores.setId(BizConstants.generatorPid());
scoOtherExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.UNSUB);
scoOtherExamScores.setStatus(BizConstants.EXAM_STU_STATUS.NORMALE);
scoOtherExamScores.setExamId(examId);
scoOtherExamScores.setSubjuctId(exaStuExamInfo.getSubjectId());
scoOtherExamScores.setCreateTime(new Date());
scoOtherExamScores.setCreator(vUserInfo.getId());
scoOtherExamScores.setStuId(exaStuExamInfo.getStuId());
scoList.add(scoOtherExamScores);
}
if(scoList.size() > 0){
this.otherExamScoresMapper.batchAddScoExamScores(scoList);
}
//设置状态为登分中
int k = this.tchExamScoresConfigMapper.updateOtherStatusByExamId(examId,BizConstants.RECORD_CONFIG_STATUS.SET_STATUS);
return true;
}else{
throw new BizException("请设置登分教师!");
}
}
public PageBean doGetOtherExamScores4StatusPageData(PageBean pageBean) {
List<ScoOtherExamScores> resList = this.otherExamScoresMapper.selectExamScores4StatusPageData(pageBean);
pageBean.setData(resList);
return pageBean;
}
public boolean updateOtherStatusByExamId(String examId, String status) {
this.tchExamScoresConfigMapper.updateOtherStatusByExamId(examId, status);
return true;
}
public boolean setOtherScoresStatus(String id, String status) {
boolean bol = false;
ScoOtherExamScores scoOtherExamScores = new ScoOtherExamScores();
scoOtherExamScores.setId(id);
scoOtherExamScores.setStatus(status);
if(!status.equals(BizConstants.EXAM_STU_STATUS.NORMALE)){
scoOtherExamScores.setScore(new BigDecimal(0));
}
this.otherExamScoresMapper.updateByPrimaryKeySelective(scoOtherExamScores);
return bol;
}
public PageBean getOtherRecordScoresPageData(PageBean pageBean, String userId) {
//获取教师信息
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
List<ScoOtherExamScores> resList = this.otherExamScoresMapper.selectRecordScoresPageData(pageBean,sysTeacherInfo.getId());
pageBean.setData(resList);
return pageBean;
}
public boolean otherBatchRecordScores(String[] valStrArr, String userId) {
boolean bol = false;
List<ScoOtherExamScores> scoreList = new ArrayList<ScoOtherExamScores>();
for (int i = 0; i < valStrArr.length; i++){
String valStr = valStrArr[i];
String[] valArr = valStr.split("\\|");
String id = valArr[0];
String score = valArr[1];
ScoOtherExamScores scoOtherExamScores = new ScoOtherExamScores();
if(valArr.length == 3){
String remark = valArr[2];
scoOtherExamScores.setRemark(remark);
}else{
scoOtherExamScores.setRemark(null);
}
scoOtherExamScores.setId(id);
// scoExamScores.setRecordeStatus(BizConstants.RECORDE_STATUS.UNSUB);
scoOtherExamScores.setScore(new BigDecimal(score));
scoOtherExamScores.setUpdater(userId);
scoOtherExamScores.setUpdateTime(new Date());
scoreList.add(scoOtherExamScores);
}
//判断用户是否是管理员角色
SysUser sysUser = this.sysUserMapper.selectByPrimaryKey(userId);
if (BizConstants.USER_TYPE.SUPER != sysUser.getType()) {//超级管理员
boolean checkbol = this.validateOtherRecordTeacherByUserId(userId,scoreList);
if(!checkbol){
throw new BizException("非登分教师,不可以登分!");
}
}
bol = this.otherExamScoresMapper.batchRecordScores(scoreList) > 0 ? true:false;
return bol;
}
public boolean validateOtherRecordTeacherByUserId(String userId, List<ScoOtherExamScores> scoreList) {
boolean bol = false;
List<String> teacherUserIdList= this.tchExamScoresConfigMapper.validateTeacherUserIdByScore(userId, scoreList);
if(teacherUserIdList.size() == 1 && teacherUserIdList.get(0).equals(userId)){
bol = true;
}
return bol;
}
/**
* @param examId
* @param userId
* @return
*/
public List<ScoOtherExamScores> getOtherScoresDatas(String examId, String userId) {
//获取教师信息
SysTeacherInfo sysTeacherInfo = this.sysTeacherInfoMapper.selectTeacherInfoByUserId(userId);
List<ScoOtherExamScores> resList = this.otherExamScoresMapper.selectScoresDatas(examId,sysTeacherInfo.getId());
return resList;
}
public PageBean getOtherExamScores4AdminModPageData(PageBean pageBean) {
List<ScoOtherExamScores> resList = this.otherExamScoresMapper.selectExamScores4AdminModPageData(pageBean);
pageBean.setData(resList);
return pageBean;
}
public boolean endOtherScoreConfig(String examId) {
this.tchExamScoresConfigMapper.updateOtherStatusByExamId(examId, BizConstants.RECORD_CONFIG_STATUS.END);
//修改此设置下所有成绩状态
this.otherExamScoresMapper.updateRecordStatusByExamId(examId,BizConstants.RECORDE_STATUS.PUBLISH);
return true;
}
/**
* 分页查询成绩
* @param pageBean
* @return
*/
public PageBean getRecordScoresPageDataByParam(PageBean pageBean) {
List<ScoExamScores> resList = this.scoExamScoresMapper.selectRecordScoresPageDataByParam(pageBean);
pageBean.setData(resList);
return pageBean;
}
}
| 40.743626 | 187 | 0.683748 |
e2715ce212445533bd224c39625c7978c4f17d3f | 1,396 | /**
* Copyright 2011-2015 John Ericksen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.androidtransfuse.gen.variableDecorator;
import javax.inject.Inject;
import javax.inject.Provider;
/**
* @author John Ericksen
*/
public class ExpressionDecoratorFactory implements Provider<VariableExpressionBuilder> {
private final VariableExpressionBuilderFactory decoratorFactory;
@Inject
public ExpressionDecoratorFactory(VariableExpressionBuilderFactory decoratorFactory) {
this.decoratorFactory = decoratorFactory;
}
public VariableExpressionBuilder get() {
return decoratorFactory.buildCachedExpressionDecorator(
decoratorFactory.buildScopedExpressionDecorator(
decoratorFactory.buildVirtualProxyExpressionDecorator(
decoratorFactory.buildVariableBuilderExpressionDecorator())));
}
}
| 34.9 | 90 | 0.75788 |
25dd3a7d4d915f8d832985ff315e01f586f9aa18 | 1,451 | package com.intenthq.challenge;
import java.util.Collections;
import java.util.List;
public class JConnectedGraph {
// Find if two nodes in a directed graph are connected.
// Based on http://www.codewars.com/kata/53897d3187c26d42ac00040d
// For example:
// a -+-> b -> c -> e
// |
// +-> d
// run(a, a) == true
// run(a, b) == true
// run(a, c) == true
// run(b, d) == false
public static boolean run(JNode source, JNode target) {
// Connected to itself - true
if (source.equals(target)) {
return true;
}
// If nowhere to go, back from recursion or return false
if (source.edges.isEmpty()) {
return false;
}
for (JNode node : source.edges) {
// If target found already - true
if (node.value == target.value) {
return true;
}
// If target found deeper in recursion - true
if (run(node, target)) {
return true;
}
}
return false;
}
public static class JNode {
public final int value;
public final List<JNode> edges;
public JNode(final int value, final List<JNode> edges) {
this.value = value;
this.edges = edges;
}
public JNode(final int value) {
this.value = value;
this.edges = Collections.emptyList();
}
}
}
| 25.017241 | 69 | 0.527223 |
bd7731dc7dabd176bf564ddcf2857752e3721bbf | 706 | package com.qypt.just.just_retrofit_downfile.Model;
/**
* Created by Administrator on 2016/7/9.
*/
public class DownResultBean implements TopBean {
public DownResultBean(Object contetResult, int resultCode) {
this.contetResult = contetResult;
this.resultCode = resultCode;
}
public Object getContetResult() {
return contetResult;
}
public void setContetResult(Object contetResult) {
this.contetResult = contetResult;
}
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
private int resultCode;
private Object contetResult;
}
| 21.393939 | 64 | 0.67847 |
2295e01cdcb937b87ba1b5517466db30b72687b3 | 1,438 | package br.com.alura.java.io.teste;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
public class TesteCopiarArquivo {
public static void main(String[] args) throws IOException {
InputStream fis = System.in; //new FileInputStream("lorem.txt");
//System.in = Entrada pelo teclado.
Reader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
OutputStream fos = System.out; //new FileOutputStream("lorem3.txt");
//System.out = Saida no console.
Writer osw = new OutputStreamWriter(fos);
BufferedWriter bw = new BufferedWriter(osw);
//Dessa maneira o BufferedWriter fica guardando os valores que foram passado atravez do InputStream ate sair do laço
String linha = br.readLine();
while (linha != null && !linha.isEmpty()) {
bw.write(linha);
bw.newLine();
bw.flush(); // Esse metodo e para resolver o problema que o BuffereWriter fica guardando os valores, com ele toda vez que um nova linha seja inserida logo em seguida ela vai aparecer no console.
linha = br.readLine();
}
br.close();
bw.close();
}
}
| 32.681818 | 206 | 0.663421 |
814881187fe42d190ddcd173db4fed2772b339d7 | 6,785 | package rbadia.voidspace.main;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Timer;
import rbadia.voidspace.graphics.GraphicsManager;
import rbadia.voidspace.model.Asteroid;
import rbadia.voidspace.model.BigBullet;
import rbadia.voidspace.model.Boss;
import rbadia.voidspace.model.BossBullet;
import rbadia.voidspace.model.Bullet;
import rbadia.voidspace.model.Platform;
import rbadia.voidspace.sounds.SoundManager;
public class Level5State extends Level4State {
private static final long serialVersionUID = 5L;
protected Boss boss;
protected List<BossBullet> bossBullets;
// Constructors
public Level5State(int level, MainFrame frame, GameStatus status,
LevelLogic gameLogic, InputHandler inputHandler,
GraphicsManager graphicsMan, SoundManager soundMan) {
super(level, frame, status, gameLogic, inputHandler, graphicsMan, soundMan);
}
@Override
public void doStart() {
super.doStart();
setStartState(GETTING_READY);
setCurrentState(getStartState());
bossBullets = new ArrayList<BossBullet>();
startBossTimer();
newBoss(this);
}
@Override
public void updateScreen() {
super.updateScreen();
drawBoss();
drawBossBullets();
moveBoss();
checkMegaManBossCollision();
checkBigBulletBossCollision();
checkBulletBossCollision();
}
/*
* Disable megaMan-asteroid collisions check
*/
protected void checkMegaManAsteroidCollisions() {}
protected void checkAsteroidFloorCollisions() {}
protected void drawAsteroid() {}
protected void checkBulletAsteroidCollisions() {}
protected void checkBigBulletAsteroidCollisions() {}
@Override
public Asteroid newAsteroid(Level1State screen) {
return asteroid;
}
/*
* Draws Level 5's platforms
* @param int number of platforms to create
* @return Array of platforms
*/
public Platform[] newPlatforms(int n) {
platforms = new Platform[n];
for (int i = 0; i < n; i++) {
this.platforms[i] = new Platform(0, SCREEN_HEIGHT/2 + 140 - i * 40);
}
return platforms;
}
/**
* Create a new boss
* @param Level5State screen
* @return Boss new boss
*/
protected Boss newBoss(Level5State screen) {
// Minus 20 so it's not located on the exact corner
int xPos = (int) (SCREEN_WIDTH - Boss.WIDTH - 20);
int yPos = (int) (SCREEN_HEIGHT - Boss.HEIGHT - 20);
boss = new Boss(xPos, yPos);
return boss;
}
/*
* Draws the boss
*/
protected void drawBoss() {
Graphics2D g2d = getGraphics2D();
getGraphicsManager().drawBoss(boss, g2d, this);
}
/*
* Method to move the boss from top to bottom
*/
protected void moveBoss() {
if (boss.getMinY() == 0) boss.goingDown = true;
else if (boss.getMaxY() >= SCREEN_HEIGHT) boss.goingDown = false;
boss.translate(0, (boss.goingDown ? boss.getSpeed() : -boss.getSpeed()));
}
/*
* Draws the boss' bullets
*/
protected void drawBossBullets() {
Graphics2D g2d = getGraphics2D();
for (int i = 0; i < bossBullets.size(); i++) {
BossBullet bossBullet = bossBullets.get(i);
getGraphicsManager().drawBossBullet(bossBullet, g2d, this);
boolean remove = this.moveBossBullet(bossBullet);
if (remove) {
bossBullets.remove(i);
i--;
}
}
}
/*
* Checks for MegaMan and Boss' collision
* Removes 1 health to MegaMan if they intersect
*/
protected void checkMegaManBossCollision() {
GameStatus status = getGameStatus();
if (boss.intersects(megaMan)) {
status.setLivesLeft(status.getLivesLeft() - 1);
}
}
/*
* Check collisions between a big bullet and the boss
*/
protected void checkBulletBossCollision() {
GameStatus status = getGameStatus();
int bulletSize = bullets.size();
for (int i = 0; i < bulletSize; i++) {
Bullet bullet = bullets.get(i);
if (boss.intersects(bullet)) {
// Decrease boss' health
status.setBossLivesLeft(status.getBossLivesLeft() - 1);
// Remove bullet
bullets.remove(i);
break;
}
}
}
/*
* Check collisions between a regular bullet and the boss
*/
protected void checkBigBulletBossCollision() {
GameStatus status = getGameStatus();
int bigBulletsSize = bigBullets.size();
for (int i = 0; i < bigBulletsSize; i++) {
BigBullet bigBullet = bigBullets.get(i);
if (boss.intersects(bigBullet)) {
// Decrease boss' health
status.setBossLivesLeft(status.getBossLivesLeft() - 1);
bigBullets.remove(i);
break;
}
}
}
/*
* Starts a timer so the boss shoots (twice) and moves every second
*/
protected void startBossTimer() {
Timer shootTimer = new Timer(500, new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (getLevel() == 5) shootBossBullet();
}
}); shootTimer.setRepeats(true); shootTimer.start();
}
/**
* Fire the Boss' bullet
*/
protected void shootBossBullet() {
int xPos = boss.x + boss.width - BossBullet.WIDTH / 2;
int yPos = (boss.y + boss.width/2 - BossBullet.HEIGHT) + 10;
BossBullet bossBullet = new BossBullet(xPos, yPos + 10); // 10 so it's a bit lower
bossBullets.add(bossBullet);
this.getSoundManager().playBulletSound();
}
/**
* Move a bullet once fired.
* Damage MegaMan if he's hit by a bullet.
* @param bullet the bullet to move
* @return if the bullet should be removed from screen
*/
protected boolean moveBossBullet(BossBullet bullet) {
if (bullet.getX() >= SCREEN_WIDTH || bullet.getX() <= 0) {
return true;
}
if (bullet.intersects(megaMan)) {
GameStatus status = getGameStatus();
status.setLivesLeft(status.getLivesLeft() - 1);
return true;
}
if (bullet.getY() - bullet.getSpeed() >= 0) {
bullet.translate(-bullet.getSpeed(), 0);
return false;
} else { return true; }
}
}
| 30.563063 | 90 | 0.591452 |
39fcf0e6cd7b327fe6a769a56b03acd5f8d9a7c6 | 2,266 | package ru.job4j.parse;
import org.junit.Test;
import ru.job4j.db.ConnectionRollback;
import ru.job4j.db.PsqlStore;
import ru.job4j.model.Post;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
public class PsqlStoreTest {
public Connection init() {
try (InputStream in = PsqlStore.class.getClassLoader().getResourceAsStream("app.properties")) {
Properties config = new Properties();
config.load(in);
Class.forName(config.getProperty("driver-class-name"));
return DriverManager.getConnection(
config.getProperty("url"),
config.getProperty("username"),
config.getProperty("password")
);
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
@Test
public void savePost() throws Exception {
try (PsqlStore store = new PsqlStore(ConnectionRollback.create(this.init()))) {
Post post = new Post("Java dev", "We need a Java developer", "link", Timestamp.valueOf(LocalDateTime.now()));
store.save(post);
assertThat(store.findById(String.valueOf(post.getId())).getNameVacancy(), is("Java dev"));
}
}
@Test
public void getAllPosts() throws Exception {
try (PsqlStore store = new PsqlStore(ConnectionRollback.create(this.init()))) {
Post post = new Post("Java", "We need a Java developer", "link2", Timestamp.valueOf(LocalDateTime.now()));
store.save(post);
assertThat(store.findById(String.valueOf(post.getId())).getLinkDesc(), is("link2"));
}
}
@Test
public void findByIdPost() throws Exception {
try (PsqlStore store = new PsqlStore(ConnectionRollback.create(this.init()))) {
Post post = new Post("Java dev", "We need a Java developer", "link45", Timestamp.valueOf(LocalDateTime.now()));
store.save(post);
assertThat(store.findById(String.valueOf(post.getId())).getId(), is(post.getId()));
}
}
} | 35.968254 | 123 | 0.636364 |
b6a7b197668c811c88a9139aa43fb3593fcfa094 | 6,696 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.taverna.workflowmodel.processor.iteration;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Map;
import javax.swing.tree.TreeNode;
import org.apache.taverna.invocation.Completion;
import org.apache.taverna.workflowmodel.processor.activity.Job;
import org.junit.Before;
import org.junit.Test;
/**
* Test {@link AbstractIterationStrategyNode} implementations for
* {@link TreeNode} behaviour.
*
* @author Stian Soiland-Reyes
*
*/
public class TestIterationStrategyNodes {
TerminalNode root;
private NamedInputPortNode input1;
private NamedInputPortNode input2;
private CrossProduct crossProduct1;
private CrossProduct crossProduct2;
private DotProduct dotProduct1;
private DotProduct dotProduct2;
@Test
public void addSingleChildToTerminal() throws Exception {
assertNull(input1.getParent());
assertEquals(0, root.getChildCount());
root.insert(input1);
assertEquals(root, input1.getParent());
assertEquals(1, root.getChildCount());
assertEquals(input1, root.getChildAt(0));
assertEquals(Arrays.asList(input1), root.getChildren());
root.insert(input1);
assertEquals(1, root.getChildCount());
root.insert(input1, 0);
assertEquals(1, root.getChildCount());
}
@Test(expected = IllegalStateException.class)
public void cantAddSeveralChildrenToTerminal() throws Exception {
root.insert(input1);
root.insert(input2);
}
@Test
public void addCrossProduct() throws Exception {
assertNull(crossProduct1.getParent());
crossProduct1.setParent(root);
assertEquals(root, crossProduct1.getParent());
assertEquals(1, root.getChildCount());
assertEquals(crossProduct1, root.getChildAt(0));
assertEquals(Arrays.asList(crossProduct1), root.getChildren());
assertEquals(0, crossProduct1.getChildCount());
crossProduct1.insert(input1);
assertEquals(input1, crossProduct1.getChildAt(0));
crossProduct1.insert(input2, 0);
assertEquals(input2, crossProduct1.getChildAt(0));
assertEquals(input1, crossProduct1.getChildAt(1));
assertEquals(2, crossProduct1.getChildCount());
assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
// A re-insert should move it
crossProduct1.insert(input2, 2);
assertEquals(2, crossProduct1.getChildCount());
assertEquals(Arrays.asList(input1, input2), crossProduct1.getChildren());
crossProduct1.insert(input2, 0);
assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
crossProduct1.insert(input1, 1);
assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
}
@Test
public void addCrossProductMany() {
crossProduct1.insert(dotProduct1);
crossProduct1.insert(dotProduct2);
crossProduct1.insert(input1);
crossProduct1.insert(input2);
crossProduct1.insert(crossProduct2);
assertEquals(5, crossProduct1.getChildCount());
assertEquals(Arrays.asList(dotProduct1, dotProduct2, input1, input2,
crossProduct2), crossProduct1.getChildren());
Enumeration<IterationStrategyNode> enumeration = crossProduct1
.children();
assertTrue(enumeration.hasMoreElements());
assertEquals(dotProduct1, enumeration.nextElement());
assertEquals(dotProduct2, enumeration.nextElement());
assertEquals(input1, enumeration.nextElement());
assertEquals(input2, enumeration.nextElement());
assertEquals(crossProduct2, enumeration.nextElement());
assertFalse(enumeration.hasMoreElements());
}
@Test
public void moveNodeToDifferentParent() {
crossProduct1.setParent(root);
crossProduct1.insert(input1);
crossProduct1.insert(dotProduct1);
dotProduct1.insert(input2);
dotProduct1.insert(crossProduct2);
// Check tree
assertEquals(crossProduct2, root.getChildAt(0).getChildAt(1)
.getChildAt(1));
assertEquals(Arrays.asList(input2, crossProduct2), dotProduct1
.getChildren());
crossProduct1.insert(crossProduct2, 1);
assertEquals(Arrays.asList(input1, crossProduct2, dotProduct1),
crossProduct1.getChildren());
assertEquals(crossProduct1, crossProduct2.getParent());
// Should no longer be in dotProduct1
assertEquals(Arrays.asList(input2), dotProduct1.getChildren());
}
@Test(expected = IllegalStateException.class)
public void cantAddToNamedInput() throws Exception {
input1.insert(dotProduct1);
}
@Test
public void cantAddSelf() throws Exception {
dotProduct1.setParent(crossProduct1);
try {
dotProduct1.insert(dotProduct1);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// Make sure we didn't loose our old parent and
// ended up in a funny state
assertEquals(crossProduct1, dotProduct1.getParent());
assertEquals(dotProduct1, crossProduct1.getChildAt(0));
}
}
@Test
public void cantSetSelfParent() throws Exception {
crossProduct1.insert(dotProduct1);
try {
dotProduct1.setParent(dotProduct1);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// Make sure we didn't loose our old parent and
// ended up in a funny state
assertEquals(crossProduct1, dotProduct1.getParent());
assertEquals(dotProduct1, crossProduct1.getChildAt(0));
}
}
@Before
public void makeNodes() throws Exception {
root = new DummyTerminalNode();
input1 = new NamedInputPortNode("input1", 1);
input2 = new NamedInputPortNode("input2", 2);
crossProduct1 = new CrossProduct();
crossProduct2 = new CrossProduct();
dotProduct1 = new DotProduct();
dotProduct2 = new DotProduct();
}
@SuppressWarnings("serial")
protected final class DummyTerminalNode extends TerminalNode {
@Override
public int getIterationDepth(Map<String, Integer> inputDepths)
throws IterationTypeMismatchException {
return 0;
}
@Override
public void receiveCompletion(int inputIndex, Completion completion) {
}
@Override
public void receiveJob(int inputIndex, Job newJob) {
}
}
}
| 31.584906 | 75 | 0.764785 |
301f1f339ab91dd6a0f471e3712bd56f9ac10821 | 6,265 | /*
* /*
* Informational Notice:
* This software was developed under contract funded by the National Library of Medicine, which is part of the National Institutes of Health,
* an agency of the Department of Health and Human Services, United States Government.
*
* The license of this software is an open-source BSD license. It allows use in both commercial and non-commercial products.
*
* The license does not supersede any applicable United States law.
*
* The license does not indemnify you from any claims brought by third parties whose proprietary rights may be infringed by your usage of this software.
*
* Government usage rights for this software are established by Federal law, which includes, but may not be limited to, Federal Acquisition Regulation
* (FAR) 48 C.F.R. Part52.227-14, Rights in Data�General.
* The license for this software is intended to be expansive, rather than restrictive, in encouraging the use of this software in both commercial and
* non-commercial products.
*
* LICENSE:
*
* Government Usage Rights Notice: The U.S. Government retains unlimited, royalty-free usage rights to this software, but not ownership,
* as provided by Federal law.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above Government Usage Rights Notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above Government Usage Rights Notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the distribution.
*
* - The names,trademarks, and service marks of the National Library of Medicine, the National Cancer Institute, the National Institutes
* of Health, and the names of any of the software developers shall not be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE U.S. GOVERNMENT AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE U.S. GOVERNMENT
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package gov.nih.nlm.lpf.emails.gate.pipeline;
/**
* This is an implementation of the ANNIE processing pipeline for annotating Email documents.
* The annotations are retrieved and processed through a separate module to determine their
* relationships.
*
* Author:
* Date: August 29, 2012
*
*/
import java.net.URL;
import java.net.MalformedURLException;
import gate.Gate;
import gate.util.GateException;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import gov.nih.nlm.lpf.emails.util.Utils;
import org.apache.log4j.Logger;
public class PLAnnieAppWrapper
{
private Logger log = Logger.getLogger(PLAnnieAppWrapper.class);
boolean gateInited = false;
PLAnnieApp annie;
public PLAnnieAppWrapper(Properties ctxProperties) throws GateException
{
if (!gateInited)
{
try
{
// Load ANNIE plugin
File gateHome = new File(System.getProperty("GateHome"));
Gate.setGateHome(gateHome);
// Gate.setUserConfigFile(new File(gateHome, "user-gate.xml"));
String userConfig = Utils.getDereferencedProperty(ctxProperties, "UserConfig");
File file = new File(userConfig);
if (!file.exists())
{
log.error ("File " + file.getAbsolutePath() + " does not exist");
return;
}
Gate.setUserConfigFile(new File(userConfig));
Gate.init();
// Parent Directory where all ANNIE Processing r"esources" exist
URL annieURL = new File(System.getProperty("ANNIEHome")).toURI().toURL();
URL pluginHome = new File( System.getProperty("gate.plugins.home")).toURI().toURL();
URL user_pluginHome = new File( System.getProperty("gate.user_plugins.home")).toURI().toURL();
// Register the Anaphora resolver
File pronounResource = new File(user_pluginHome+"/pronoun_annotator");
//Gate.getCreoleRegister().registerDirectories( pronounResource.toURI().toURL());
// get path to file ANNIE_with_defaults.gapp
// NOTE: the application pipeline is defined in the .gapp file below
// Note: It must match the name used in GATEDeveloper for debugging the application
String gappStr = ctxProperties.getProperty("default-LPF-app");
File gappFile = new File(gappStr);
annie = new PLAnnieApp(annieURL, pluginHome, user_pluginHome, gappFile);
gateInited = true;
System.out.println("...GATE initialized");
}
catch (MalformedURLException me)
{
throw new GateException(me);
}
/* catch (IOException ioe)
{
throw new GateException(ioe);
}
*/
}
System.out.println("...Parser loaded");
}
/**************************************************************************/
// Return the Annie instance as created using the gapp file
public PLAnnieApp getAnnieInstance()
{
return annie;
}
/**************************************************************************/
}
| 46.066176 | 153 | 0.655866 |
42be9d3f4c63d4016a2fec605a0f01740695de65 | 657 | import java.util.Iterator;
/* 284. Peeking Iterator */
class PeekingIterator implements Iterator<Integer> {
private Iterator<Integer> iterator;
private Integer nextElement; // 保存指针后面下一个元素
public PeekingIterator(Iterator<Integer> iterator) {
this.iterator = iterator;
nextElement = iterator.next();
}
public Integer peek() {
return nextElement;
}
@Override
public Integer next() {
Integer ret = nextElement;
nextElement = iterator.hasNext() ? iterator.next() : null;
return ret;
}
@Override
public boolean hasNext() {
return nextElement != null;
}
} | 23.464286 | 66 | 0.636225 |
9fc0dc396dba1a99c19c9392b129536af70d23c2 | 3,892 | /*
* Copyright (C) 2013-2015 RoboVM AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bugvm.apple.avfoundation;
/*<imports>*/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.dispatch.*;
import com.bugvm.apple.coreanimation.*;
import com.bugvm.apple.coreimage.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coreaudio.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.corevideo.*;
import com.bugvm.apple.mediatoolbox.*;
import com.bugvm.apple.audiotoolbox.*;
import com.bugvm.apple.audiounit.*;
/*</imports>*/
/*<javadoc>*/
/**
* @since Available in iOS 6.0 and later.
*/
/*</javadoc>*/
/*<annotations>*/@Library("AVFoundation") @NativeClass/*</annotations>*/
/*<visibility>*/public/*</visibility>*/ class /*<name>*/AVAudioSessionPortDescription/*</name>*/
extends /*<extends>*/NSObject/*</extends>*/
/*<implements>*//*</implements>*/ {
/*<ptr>*/public static class AVAudioSessionPortDescriptionPtr extends Ptr<AVAudioSessionPortDescription, AVAudioSessionPortDescriptionPtr> {}/*</ptr>*/
/*<bind>*/static { ObjCRuntime.bind(AVAudioSessionPortDescription.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
public AVAudioSessionPortDescription() {}
protected AVAudioSessionPortDescription(SkipInit skipInit) { super(skipInit); }
/*</constructors>*/
/*<properties>*/
@Property(selector = "portType")
public native AVAudioSessionPort getPortType();
@Property(selector = "portName")
public native String getPortName();
@Property(selector = "UID")
public native String getUID();
@Property(selector = "channels")
public native NSArray<AVAudioSessionChannelDescription> getChannels();
/**
* @since Available in iOS 7.0 and later.
*/
@Property(selector = "dataSources")
public native NSArray<AVAudioSessionDataSourceDescription> getDataSources();
/**
* @since Available in iOS 7.0 and later.
*/
@Property(selector = "selectedDataSource")
public native AVAudioSessionDataSourceDescription getSelectedDataSource();
/**
* @since Available in iOS 7.0 and later.
*/
@Property(selector = "preferredDataSource")
public native AVAudioSessionDataSourceDescription getPreferredDataSource();
/*</properties>*/
/*<members>*//*</members>*/
/*<methods>*/
/**
* @since Available in iOS 7.0 and later.
*/
public boolean setPreferredDataSource(AVAudioSessionDataSourceDescription dataSource) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = setPreferredDataSource(dataSource, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**
* @since Available in iOS 7.0 and later.
*/
@Method(selector = "setPreferredDataSource:error:")
private native boolean setPreferredDataSource(AVAudioSessionDataSourceDescription dataSource, NSError.NSErrorPtr outError);
/*</methods>*/
}
| 37.423077 | 155 | 0.705293 |
759575298e252259be7187ef8ba7cf4bbf884195 | 493 | package com.dfire.platform.alchemy.repository;
import com.dfire.platform.alchemy.domain.Sink;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* Spring Data repository for the Sink entity.
*/
@SuppressWarnings("unused")
@Repository
public interface SinkRepository extends JpaRepository<Sink, Long>, JpaSpecificationExecutor<Sink> {
Optional<Sink> findOneByBusinessIdAndName(Long id, String name);
}
| 25.947368 | 99 | 0.79716 |
c2c30028111382dc5c6f4a1afcece859be0ea79d | 11,438 | // Code generated by Wire protocol buffer compiler, do not edit.
// Source file: ../wire-runtime/src/test/proto/all_types.proto
package com.squareup.wire.protos.alltypes;
import com.squareup.wire.Extension;
import java.lang.Boolean;
import java.lang.Double;
import java.lang.Float;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.util.List;
import okio.ByteString;
public final class Ext_all_types {
public static final Extension<AllTypes, Integer> ext_opt_int32 = Extension
.int32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_int32")
.setTag(1001)
.buildOptional();
public static final Extension<AllTypes, Integer> ext_opt_uint32 = Extension
.uint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_uint32")
.setTag(1002)
.buildOptional();
public static final Extension<AllTypes, Integer> ext_opt_sint32 = Extension
.sint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_sint32")
.setTag(1003)
.buildOptional();
public static final Extension<AllTypes, Integer> ext_opt_fixed32 = Extension
.fixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_fixed32")
.setTag(1004)
.buildOptional();
public static final Extension<AllTypes, Integer> ext_opt_sfixed32 = Extension
.sfixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_sfixed32")
.setTag(1005)
.buildOptional();
public static final Extension<AllTypes, Long> ext_opt_int64 = Extension
.int64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_int64")
.setTag(1006)
.buildOptional();
public static final Extension<AllTypes, Long> ext_opt_uint64 = Extension
.uint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_uint64")
.setTag(1007)
.buildOptional();
public static final Extension<AllTypes, Long> ext_opt_sint64 = Extension
.sint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_sint64")
.setTag(1008)
.buildOptional();
public static final Extension<AllTypes, Long> ext_opt_fixed64 = Extension
.fixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_fixed64")
.setTag(1009)
.buildOptional();
public static final Extension<AllTypes, Long> ext_opt_sfixed64 = Extension
.sfixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_sfixed64")
.setTag(1010)
.buildOptional();
public static final Extension<AllTypes, Boolean> ext_opt_bool = Extension
.boolExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_bool")
.setTag(1011)
.buildOptional();
public static final Extension<AllTypes, Float> ext_opt_float = Extension
.floatExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_float")
.setTag(1012)
.buildOptional();
public static final Extension<AllTypes, Double> ext_opt_double = Extension
.doubleExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_double")
.setTag(1013)
.buildOptional();
public static final Extension<AllTypes, String> ext_opt_string = Extension
.stringExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_string")
.setTag(1014)
.buildOptional();
public static final Extension<AllTypes, ByteString> ext_opt_bytes = Extension
.bytesExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_bytes")
.setTag(1015)
.buildOptional();
public static final Extension<AllTypes, AllTypes.NestedEnum> ext_opt_nested_enum = Extension
.enumExtending(AllTypes.NestedEnum.class, AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_nested_enum")
.setTag(1016)
.buildOptional();
public static final Extension<AllTypes, AllTypes.NestedMessage> ext_opt_nested_message = Extension
.messageExtending(AllTypes.NestedMessage.class, AllTypes.class)
.setName("squareup.protos.alltypes.ext_opt_nested_message")
.setTag(1017)
.buildOptional();
public static final Extension<AllTypes, List<Integer>> ext_rep_int32 = Extension
.int32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_int32")
.setTag(1101)
.buildRepeated();
public static final Extension<AllTypes, List<Integer>> ext_rep_uint32 = Extension
.uint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_uint32")
.setTag(1102)
.buildRepeated();
public static final Extension<AllTypes, List<Integer>> ext_rep_sint32 = Extension
.sint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_sint32")
.setTag(1103)
.buildRepeated();
public static final Extension<AllTypes, List<Integer>> ext_rep_fixed32 = Extension
.fixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_fixed32")
.setTag(1104)
.buildRepeated();
public static final Extension<AllTypes, List<Integer>> ext_rep_sfixed32 = Extension
.sfixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_sfixed32")
.setTag(1105)
.buildRepeated();
public static final Extension<AllTypes, List<Long>> ext_rep_int64 = Extension
.int64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_int64")
.setTag(1106)
.buildRepeated();
public static final Extension<AllTypes, List<Long>> ext_rep_uint64 = Extension
.uint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_uint64")
.setTag(1107)
.buildRepeated();
public static final Extension<AllTypes, List<Long>> ext_rep_sint64 = Extension
.sint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_sint64")
.setTag(1108)
.buildRepeated();
public static final Extension<AllTypes, List<Long>> ext_rep_fixed64 = Extension
.fixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_fixed64")
.setTag(1109)
.buildRepeated();
public static final Extension<AllTypes, List<Long>> ext_rep_sfixed64 = Extension
.sfixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_sfixed64")
.setTag(1110)
.buildRepeated();
public static final Extension<AllTypes, List<Boolean>> ext_rep_bool = Extension
.boolExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_bool")
.setTag(1111)
.buildRepeated();
public static final Extension<AllTypes, List<Float>> ext_rep_float = Extension
.floatExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_float")
.setTag(1112)
.buildRepeated();
public static final Extension<AllTypes, List<Double>> ext_rep_double = Extension
.doubleExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_double")
.setTag(1113)
.buildRepeated();
public static final Extension<AllTypes, List<String>> ext_rep_string = Extension
.stringExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_string")
.setTag(1114)
.buildRepeated();
public static final Extension<AllTypes, List<ByteString>> ext_rep_bytes = Extension
.bytesExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_bytes")
.setTag(1115)
.buildRepeated();
public static final Extension<AllTypes, List<AllTypes.NestedEnum>> ext_rep_nested_enum = Extension
.enumExtending(AllTypes.NestedEnum.class, AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_nested_enum")
.setTag(1116)
.buildRepeated();
public static final Extension<AllTypes, List<AllTypes.NestedMessage>> ext_rep_nested_message = Extension
.messageExtending(AllTypes.NestedMessage.class, AllTypes.class)
.setName("squareup.protos.alltypes.ext_rep_nested_message")
.setTag(1117)
.buildRepeated();
public static final Extension<AllTypes, List<Integer>> ext_pack_int32 = Extension
.int32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_int32")
.setTag(1201)
.buildPacked();
public static final Extension<AllTypes, List<Integer>> ext_pack_uint32 = Extension
.uint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_uint32")
.setTag(1202)
.buildPacked();
public static final Extension<AllTypes, List<Integer>> ext_pack_sint32 = Extension
.sint32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_sint32")
.setTag(1203)
.buildPacked();
public static final Extension<AllTypes, List<Integer>> ext_pack_fixed32 = Extension
.fixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_fixed32")
.setTag(1204)
.buildPacked();
public static final Extension<AllTypes, List<Integer>> ext_pack_sfixed32 = Extension
.sfixed32Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_sfixed32")
.setTag(1205)
.buildPacked();
public static final Extension<AllTypes, List<Long>> ext_pack_int64 = Extension
.int64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_int64")
.setTag(1206)
.buildPacked();
public static final Extension<AllTypes, List<Long>> ext_pack_uint64 = Extension
.uint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_uint64")
.setTag(1207)
.buildPacked();
public static final Extension<AllTypes, List<Long>> ext_pack_sint64 = Extension
.sint64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_sint64")
.setTag(1208)
.buildPacked();
public static final Extension<AllTypes, List<Long>> ext_pack_fixed64 = Extension
.fixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_fixed64")
.setTag(1209)
.buildPacked();
public static final Extension<AllTypes, List<Long>> ext_pack_sfixed64 = Extension
.sfixed64Extending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_sfixed64")
.setTag(1210)
.buildPacked();
public static final Extension<AllTypes, List<Boolean>> ext_pack_bool = Extension
.boolExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_bool")
.setTag(1211)
.buildPacked();
public static final Extension<AllTypes, List<Float>> ext_pack_float = Extension
.floatExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_float")
.setTag(1212)
.buildPacked();
public static final Extension<AllTypes, List<Double>> ext_pack_double = Extension
.doubleExtending(AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_double")
.setTag(1213)
.buildPacked();
public static final Extension<AllTypes, List<AllTypes.NestedEnum>> ext_pack_nested_enum = Extension
.enumExtending(AllTypes.NestedEnum.class, AllTypes.class)
.setName("squareup.protos.alltypes.ext_pack_nested_enum")
.setTag(1216)
.buildPacked();
private Ext_all_types() {
}
}
| 37.257329 | 106 | 0.723029 |
59890a0fb3d75fcfc4decaea4660332438f21bfe | 1,038 | package com.thinkgem.jeesite.modules.dx.portal.web;
import java.util.List;
import org.apache.commons.lang3.RandomUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.thinkgem.jeesite.modules.dx.room.entity.Room;
import com.thinkgem.jeesite.modules.dx.room.service.RoomService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/spring-context.xml"})
public class JunitTest {
@Autowired
private RoomService roomService;
@Test
public void test08(){
for(int i=0;i<10;i++){
Integer code=RandomUtils.nextInt(1000, 10000);
System.out.println(code);
}
}
@Test
public void test(){
Room room=new Room();
// room.setStatus("1");
List<Room> exrecords = roomService.findList(room);
System.out.println(exrecords.size()+"==========");
}
}
| 26.615385 | 72 | 0.72736 |
d126a71b11bc16a147041d5caadcec34ecbe2c87 | 8,257 | /*
* Copyright 2016-2019 Tim Boudreau, Frédéric Yvon Vinet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nemesis.antlr.v4.netbeans.v8.grammar.file.tool;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.junit.After;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.nemesis.antlr.v4.netbeans.v8.grammar.file.tool.extract.AntlrProxies.ProxySyntaxError;
import org.nemesis.jfs.javac.CompileResult;
import org.nemesis.antlr.v4.netbeans.v8.grammar.file.tool.extract.GenerateBuildAndRunGrammarResult;
import org.nemesis.antlr.v4.netbeans.v8.grammar.file.tool.extract.ParserRunResult;
import org.nemesis.antlr.v4.netbeans.v8.grammar.file.tool.extract.ParserRunnerBuilder;
/**
*
* @author Tim Boudreau
*/
public class RecompilationTest {
private TestDir nestedGrammarDir;
private ParserRunnerBuilder bldr;
public static final String TEXT_1 =
"{ skiddoo : 23, meaningful : true, meaning: '42' }";
public static final String TEXT_2 =
"{ skiddoo : 53, meaningful : false, meaning: 'hey' }";
@Test
public void testRecompilation() throws IOException, Throwable {
GenerateBuildAndRunGrammarResult res = bldr.parse(TEXT_1);
res.rethrow();
boolean usable = res.onSuccess((AntlrSourceGenerationResult genResult, CompileResult compileResult, ParserRunResult parserRunResult) -> {
assertTrue(parserRunResult.parseTree().isPresent());
ParserAssertions as = new ParserAssertions(parserRunResult.parseTree().get());
as.assertNextNonWhitespace("{", null, "map");
as.assertNextNonWhitespace("skiddoo", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("23", "Number", "map", "mapItem", "value", "numberValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaningful", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("true", "True", "value", "booleanValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaning", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("'42'", "String", "map", "mapItem", "value", "stringValue");
as.assertNextNonWhitespace("}", null, "map");
});
assertTrue(res.wasCompiled());
assertTrue(res.wasParsed());
assertTrue(res.parseResult().isPresent());
assertTrue(res.parseResult().get().parseTree().isPresent());
assertFalse(res.parseResult().get().parseTree().get().hasErrors());
List<ProxySyntaxError> errs = res.parseResult().get().parseTree().get().syntaxErrors();
assertTrue(errs.toString(), errs.isEmpty());
assertTrue(usable);
res = bldr.parse(TEXT_2);
usable = res.onSuccess((AntlrSourceGenerationResult genResult, CompileResult compileResult, ParserRunResult parserRunResult) -> {
assertTrue(parserRunResult.parseTree().isPresent());
ParserAssertions as = new ParserAssertions(parserRunResult.parseTree().get());
as.assertNextNonWhitespace("{", null, "map");
as.assertNextNonWhitespace("skiddoo", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("53", "Number", "map", "mapItem", "value", "numberValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaningful", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("false", "False", "value", "booleanValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaning", "Identifier", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("'hey'", "String", "map", "mapItem", "value", "stringValue");
as.assertNextNonWhitespace("}", null, "map");
});
assertFalse(res.wasCompiled());
assertTrue(usable);
nestedGrammarDir.modifyGrammar(line -> {
return line
.replaceAll("Identifier", "ArgleBargle");
});
res = bldr.parse(TEXT_2);
assertTrue(res.wasCompiled());
assertTrue(res.isUsable());
usable = res.onSuccess((AntlrSourceGenerationResult genResult, CompileResult compileResult, ParserRunResult parserRunResult) -> {
assertTrue(parserRunResult.parseTree().isPresent());
ParserAssertions as = new ParserAssertions(parserRunResult.parseTree().get());
as.assertNextNonWhitespace("{", null, "map");
as.assertNextNonWhitespace("skiddoo", "ArgleBargle", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("53", "Number", "map", "mapItem", "value", "numberValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaningful", "ArgleBargle", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("false", "False", "value", "booleanValue");
as.assertNextNonWhitespace(",", null, "map");
as.assertNextNonWhitespace("meaning", "ArgleBargle", "items", "map", "mapItem");
as.assertNextNonWhitespace(":", null, "mapItem");
as.assertNextNonWhitespace("'hey'", "String", "map", "mapItem", "value", "stringValue");
as.assertNextNonWhitespace("}", null, "map");
});
}
Path root;
@Before
public void setUp() throws IOException, URISyntaxException {
root = Paths.get(System.getProperty("java.io.tmpdir"), RecompilationTest.class.getSimpleName() + "-" + System.currentTimeMillis());
nestedGrammarDir = new TestDir(root, "NestedMapGrammar", "NestedMapGrammar.g4", "com.nested");
bldr = GrammarJavaSourceGeneratorBuilder.forAntlrSource(nestedGrammarDir.antlrSourceFile)
.withOutputRoot(nestedGrammarDir.javaClasspathRoot)
.withPackage(nestedGrammarDir.packageName)
.withAntlrLibrary(AntlrLibrary.getDefault())
.withRunOptions(AntlrRunOption.GENERATE_LEXER)
.withRunOptions(AntlrRunOption.GENERATE_VISITOR)
.toParseAndRunBuilder();
}
static boolean reallyCleanup;
@After
public void cleanup() throws IOException {
if (nestedGrammarDir != null) {
nestedGrammarDir.cleanUp();
}
// if (root != null && Files.exists(root)) {
// long size = Files.list(root).count();
// assertEquals("Some files left behind in " + root
// + ": " + files(root), 0, size);
// if (reallyCleanup) {
// Files.delete(root);
// }
// }
}
private String files(Path p) throws IOException {
StringBuilder sb = new StringBuilder();
Files.list(p).forEach(path -> {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(p.relativize(path));
});
return sb.toString();
}
}
| 49.443114 | 145 | 0.641516 |
599a9718dd0a88f53fd394ad8f42f8b04020b019 | 2,074 | /*
* File: Perturber.java
* Authors: Justin Basilico and Kevin R. Dixon
* Company: Sandia National Laboratories
* Project: Cognitive Foundry
*
* Copyright February 20, 2006, Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this work by
* or on behalf of the U.S. Government. Export of this program may require a
* license from the United States Government. See CopyrightHistory.txt for
* complete details.
*
*/
package gov.sandia.cognition.learning.algorithm.annealing;
import gov.sandia.cognition.annotation.CodeReview;
import gov.sandia.cognition.annotation.CodeReviews;
import gov.sandia.cognition.util.CloneableSerializable;
/**
* The Perturber interface defines the functionality of an object that can
* take an object and perturb it, returning the perturbed value.
*
* It is recommended that a {@link Perturber} implement
* {@link CloneableSerializable}, but it is not required.
*
* @param <PerturbedType> Class that is given to, and returned from, the
* {@code perturb()} method
* @author Justin Basilico
* @author Kevin R. Dixon
* @since 1.0
*/
@CodeReviews(
reviews={
@CodeReview(
reviewer="Kevin R. Dixon",
date="2008-07-22",
changesNeeded=false,
comments={
"Moved previous code review to annotation.",
"Fixed minor typo in javadoc.",
"Interface looks fine."
}
)
,
@CodeReview(
reviewer="Justin Basilico",
date="2006-10-02",
changesNeeded=false,
comments="Interface looks fine."
)
}
)
public interface Perturber<PerturbedType>
{
/**
* Perturbs the given object and returns the perturbed version.
*
* @param input The object to perturb. It should not be changed.
* @return The perturbed version of the object.
*/
public PerturbedType perturb(
final PerturbedType input);
}
| 31.424242 | 80 | 0.643202 |
96a9eda30e44221b7523e3f6899d4b377cd1a82b | 3,796 | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.sync.net;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.ThreadPool;
import ch.boye.httpclientandroidlib.HttpEntity;
import ch.boye.httpclientandroidlib.entity.StringEntity;
/**
* Resource class that implements expected headers and processing for Sync.
* Accepts a simplified delegate.
*
* Includes:
* * Basic Auth headers (via Resource)
* * Error responses:
* * 401
* * 503
* * Headers:
* * Retry-After
* * X-Weave-Backoff
* * X-Weave-Records?
* * ...
* * Timeouts
* * Network errors
* * application/newlines
* * JSON parsing
* * Content-Type and Content-Length validation.
*/
public class SyncStorageRecordRequest extends SyncStorageRequest {
public class SyncStorageRecordResourceDelegate extends SyncStorageResourceDelegate {
SyncStorageRecordResourceDelegate(SyncStorageRequest request) {
super(request);
}
}
public SyncStorageRecordRequest(URI uri) {
super(uri);
}
public SyncStorageRecordRequest(String url) throws URISyntaxException {
this(new URI(url));
}
@Override
protected SyncResourceDelegate makeResourceDelegate(SyncStorageRequest request) {
return new SyncStorageRecordResourceDelegate(request);
}
protected static StringEntity stringEntity(String s) throws UnsupportedEncodingException {
StringEntity e = new StringEntity(s, "UTF-8");
e.setContentType("application/json");
return e;
}
/**
* Helper for turning a JSON object into a payload.
* @throws UnsupportedEncodingException
*/
protected static StringEntity jsonEntity(JSONObject body) throws UnsupportedEncodingException {
return stringEntity(body.toJSONString());
}
/**
* Helper for turning a JSON array into a payload.
* @throws UnsupportedEncodingException
*/
protected static HttpEntity jsonEntity(JSONArray toPOST) throws UnsupportedEncodingException {
return stringEntity(toPOST.toJSONString());
}
@SuppressWarnings("unchecked")
public void post(JSONObject body) {
// Let's do this the trivial way for now.
// Note that POSTs should be an array, so we wrap here.
final JSONArray toPOST = new JSONArray();
toPOST.add(body);
try {
this.resource.post(jsonEntity(toPOST));
} catch (UnsupportedEncodingException e) {
this.delegate.handleRequestError(e);
}
}
public void post(JSONArray body) {
// Let's do this the trivial way for now.
try {
this.resource.post(jsonEntity(body));
} catch (UnsupportedEncodingException e) {
this.delegate.handleRequestError(e);
}
}
public void put(JSONObject body) {
// Let's do this the trivial way for now.
try {
this.resource.put(jsonEntity(body));
} catch (UnsupportedEncodingException e) {
this.delegate.handleRequestError(e);
}
}
public void post(CryptoRecord record) {
this.post(record.toJSONObject());
}
public void put(CryptoRecord record) {
this.put(record.toJSONObject());
}
public void deferGet() {
final SyncStorageRecordRequest self = this;
ThreadPool.run(new Runnable() {
@Override
public void run() {
self.get();
}});
}
public void deferPut(final JSONObject body) {
final SyncStorageRecordRequest self = this;
ThreadPool.run(new Runnable() {
@Override
public void run() {
self.put(body);
}});
}
}
| 27.309353 | 97 | 0.704426 |
7d7bdd502d7c2c78c8f19bbb52e72be8437e89a9 | 951 | package com.tigeeer.rabbitmq;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tigeeer.pojo.MailMessage;
import com.tigeeer.util.MailUtil;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by IntelliJ IDEA.
* User: tigeeer
* Date: 2017/4/19
* Time: 16:23
*/
@Component
public class MessageReceiver {
private MailUtil mailUtil;
private ExecutorService executor;
public MessageReceiver(MailUtil mailUtil) {
this.mailUtil = mailUtil;
executor = Executors.newFixedThreadPool(20);
}
public void sendMail(String message) {
executor.submit(() -> {
try {
mailUtil.send(new ObjectMapper().readValue(message, MailMessage.class));
} catch (IOException e) {
e.printStackTrace();
}
});
}
}
| 24.384615 | 88 | 0.672976 |
315670453fe0cc725113c1aa3108578a966b8adb | 184 | package com.quality.project.JUnit.AddRecipeValidatorTest;
import com.quality.project.recipe.IRecipe;
public interface IRecipeMockFactory {
public IRecipe getRecipes(String type);
}
| 23 | 57 | 0.831522 |
d07a535c58c9b24cfd852898c4027f6ee1d9eb92 | 1,795 | package cz.cvut.fel.ida.algebra.utils.metadata;
import cz.cvut.fel.ida.algebra.values.Value;
import cz.cvut.fel.ida.algebra.weights.Weight;
import cz.cvut.fel.ida.setup.Settings;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.logging.Logger;
/**
* Created by gusta on 5.3.18.
*/
public class WeightMetadata extends Metadata<Weight> {
private static final Logger LOG = Logger.getLogger(WeightMetadata.class.getName());
public WeightMetadata(Value initValue){
metadata = new LinkedHashMap<>();
addValidateMetadatum("initValue", initValue);
}
public WeightMetadata(Settings settings, Map<String, Object> stringObjectMap) {
super(settings, stringObjectMap);
}
@Override
public boolean addValidateMetadatum(String parameterText, Object value) {
Parameter parameter = new Parameter(parameterText);
ParameterValue parameterValue = new ParameterValue(value);
boolean valid = false;
if (parameter.type == Parameter.Type.VALUE && parameterValue.type == ParameterValue.Type.VALUE) {
valid = true;
}
if (valid)
metadata.put(parameter, parameterValue);
return valid;
}
@Override
public void applyTo(Weight object) {
metadata.forEach((param, value) -> apply(object, param, value));
}
private void apply(Weight weight, Parameter param, ParameterValue value) {
if (param.type == Parameter.Type.VALUE) {
weight.value = (Value) value.value;
}
}
public void addAll(WeightMetadata weightMetadata) {
if (this.metadata == null) {
this.metadata = weightMetadata.metadata;
} else {
this.metadata.putAll(weightMetadata.metadata);
}
}
} | 30.423729 | 105 | 0.665181 |
ea91d0fec8f646f9c40599bab10aef39dc49df01 | 10,488 | package org.bigml.binding.laminar;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
/**
* Activation functions and helpers
*
*/
public class MathOps {
// This can be any x where np.exp(x) + 1 == np.exp(x) Going up to 512
// isn't strictly necessary, but hey, why not?
private static final double HUGE_DOUBLE_EXP = 512;
private static final float HUGE_FLOAT_EXP = 64;
private static final float LARGE_FLOAT_EXP = 8;
private static float LEAKY_RELU_ALPHA = 0.1f;
private static final double SELU_ALPHA = 1.6732632423543772848170429916717;
private static final double SELU_SCALE = 1.0507009873554804934193349852946;
private static ArrayList<List<Double>> operation(
String operator, ArrayList<List<Double>> mat, JSONArray vec) {
ArrayList<List<Double>> out = new ArrayList<List<Double>>();
for (int i=0; i<mat.size(); i++) {
List<Double> row = (List<Double>) mat.get(i);
List<Double> newRow = new ArrayList<Double>();
for (int k=0; k<row.size(); k++) {
Double val = ((Number) vec.get(k)).doubleValue();
if ("+".equals(operator)) {
newRow.add(row.get(k) + val);
}
if ("-".equals(operator)) {
newRow.add(row.get(k) - val);
}
if ("*".equals(operator)) {
newRow.add(row.get(k) * val);
}
if ("/".equals(operator)) {
newRow.add(row.get(k) / val);
}
}
out.add(newRow);
}
return out;
}
private static ArrayList<List<Double>> plus(
ArrayList<List<Double>> mat, JSONArray vec) {
return operation("+", mat, vec);
}
private static ArrayList<List<Double>> minus(
ArrayList<List<Double>> mat, JSONArray vec) {
return operation("-", mat, vec);
}
private static ArrayList<List<Double>> times(
ArrayList<List<Double>> mat, JSONArray vec) {
return operation("*", mat, vec);
}
private static ArrayList<List<Double>> divide(
ArrayList<List<Double>> mat, JSONArray vec) {
return operation("/", mat, vec);
}
public static ArrayList<List<Double>> dot(
ArrayList<List<Double>> mat1, JSONArray mat2) {
ArrayList<List<Double>> outMat = new ArrayList<List<Double>>();
for (int i=0; i<mat1.size(); i++) {
List<Double> row1 = (List<Double>) mat1.get(i);
List<Double> newRow = new ArrayList<Double>();
for (int j=0; j<mat2.size(); j++) {
List<Double> row2 = (List<Double>) mat2.get(j);
double sum = 0.0;
for (int k=0; k<row1.size(); k++) {
Double val = ((Number) row2.get(k)).doubleValue();
sum += ((Number) row1.get(k)).doubleValue() * val;
}
newRow.add(sum);
}
outMat.add(newRow);
}
return outMat;
}
private static ArrayList<List<Double>> batchNorm(
ArrayList<List<Double>> mat, JSONArray mean,
JSONArray stdev, JSONArray shift, JSONArray scale) {
ArrayList<List<Double>> normVals = divide(minus(mat, mean), stdev);
return plus(times(normVals, scale), shift);
}
public static ArrayList<List<Double>> destandardize(
ArrayList<List<Double>> vec, Double mean, Double stdev) {
ArrayList<List<Double>> out = new ArrayList<List<Double>>();
for (int i=0; i<vec.size(); i++) {
List<Double> row = (List<Double>) vec.get(i);
List<Double> newRow = new ArrayList<Double>();
for (int k=0; k<row.size(); k++) {
newRow.add(row.get(k) * stdev + mean);
}
out.add(newRow);
}
return out;
}
private static ArrayList<List<Double>> toWidth(
ArrayList<List<Double>> mat, int width) {
int ntiles = 1;
if (width > mat.get(0).size()) {
ntiles = (int) Math.ceil( width / mat.get(0).size() );
}
ArrayList<List<Double>> output = new ArrayList<List<Double>>();
for (List<Double> row: mat) {
List<Double> newRow = new ArrayList<Double>();
for (int i=0; i<width; i+=ntiles) {
newRow.addAll(row);
}
output.add(newRow);
}
return output;
}
private static ArrayList<List<Double>> addResiduals(
ArrayList<List<Double>> residuals,
ArrayList<List<Double>> identities) {
ArrayList<List<Double>> output = new ArrayList<List<Double>>();
ArrayList<List<Double>> toAdd =
toWidth(identities, residuals.get(0).size());
for (int i=0; i<residuals.size(); i++) {
List<Double> residualRow = (List<Double>) residuals.get(i);
List<Double> toAddRow = (List<Double>) toAdd.get(i);
List<Double> newRow = new ArrayList<Double>();
for (int j=0; j<residualRow.size(); j++) {
newRow.add(residualRow.get(j) + toAddRow.get(j));
}
output.add(newRow);
}
return output;
}
public static ArrayList<List<Double>> propagate(
ArrayList<List<Double>> input, JSONArray layers) {
ArrayList<List<Double>> identities = input;
ArrayList<List<Double>> lastX = input;
ArrayList residualsList = new ArrayList();
for (Object layerObj: layers) {
JSONObject layer = (JSONObject) layerObj;
residualsList.add((Boolean) layer.get("residuals"));
}
boolean firstIdentities = false;
if (residualsList.contains(true)) {
firstIdentities =
!residualsList.subList(2, residualsList.size()).contains(true);
}
int i = 0;
for (Object layerObj: layers) {
JSONObject layer = (JSONObject) layerObj;
JSONArray weights = (JSONArray) layer.get("weights");
JSONArray mean = (JSONArray) layer.get("mean");
JSONArray stdev = (JSONArray) layer.get("stdev");
JSONArray scale = (JSONArray) layer.get("scale");
JSONArray offset = (JSONArray) layer.get("offset");
Boolean residuals = (Boolean) layer.get("residuals");
String afn = (String) layer.get("activation_function");
ArrayList<List<Double>> nextIn = dot(lastX, weights);
if (mean != null && stdev != null) {
nextIn = batchNorm(nextIn, mean, stdev, offset, scale);
} else {
nextIn = plus(nextIn, offset);
}
if (residuals != null && residuals) {
nextIn = addResiduals(nextIn, identities);
lastX = broadcast(afn, nextIn);
identities = lastX;
} else {
lastX = broadcast(afn, nextIn);
if (firstIdentities && i==0) {
identities = lastX;
}
}
i++;
}
return lastX;
}
private static ArrayList<List<Double>> broadcast(
String afn, ArrayList<List<Double>> xs) {
ArrayList<List<Double>> result = new ArrayList<List<Double>>();
if (xs.size() == 0) {
return result;
}
if ("identity".equals(afn) || "linear".equals(afn)) {
return xs;
}
if ("softmax".equals(afn)) {
return softmax(xs);
}
for (List<Double> row: xs) {
List<Double> newRow = new ArrayList<Double>();
for (Double d: row) {
if ("tanh".equals(afn)) {
newRow.add(Math.tanh(d));
}
if ("sigmoid".equals(afn)) {
newRow.add(sigmoid(d));
}
if ("softplus".equals(afn)) {
newRow.add(softplus(d));
}
if ("relu".equals(afn)) {
newRow.add(relu(d));
}
if ("relu6".equals(afn)) {
newRow.add(relu6(d));
}
if ("leaky_relu".equals(afn)) {
newRow.add(leakyReLU(d));
}
if ("swish".equals(afn)) {
newRow.add(swish(d));
}
if ("mish".equals(afn)) {
newRow.add(mish(d));
}
if ("selu".equals(afn)) {
newRow.add(selu(d));
}
}
result.add(newRow);
}
return result;
}
private static ArrayList<List<Double>> softmax(
ArrayList<List<Double>> xs) {
double max = 0.0;
for (List<Double> row: xs) {
double maxRow = Collections.max(row);
max = maxRow > max ? maxRow : max;
}
ArrayList<List<Double>> exps = new ArrayList<List<Double>>();
for (List<Double> row: xs) {
List<Double> newRow = new ArrayList<Double>();
for (Double d: row) {
newRow.add(Math.exp(d - max));
}
exps.add(newRow);
}
double sumex = 0.0;
for (List<Double> exp: exps) {
for (Double d: exp) {
sumex += d;
}
}
ArrayList<List<Double>> result = new ArrayList<List<Double>>();
for (List<Double> exp: exps) {
List<Double> newRow = new ArrayList<Double>();
for (Double d: exp) {
newRow.add(d / sumex);
}
result.add(newRow);
}
return result;
}
private static Double sigmoid(Double d) {
if (d > 0) {
if (d < HUGE_DOUBLE_EXP) {
double exVal = Math.exp(d);
return exVal / (exVal + 1);
} else {
return 1.0;
}
} else {
if (-d < HUGE_DOUBLE_EXP) {
return 1 / (1 + Math.exp(-d));
} else {
return 0.0;
}
}
}
private static Double softplus(Double d) {
return d < HUGE_FLOAT_EXP ? Math.log((Math.exp(d) + 1)) : d;
}
private static Double relu(Double d) {
return Math.max(0, d);
}
private static Double relu6(Double d) {
return Math.min(6, Math.max(0, d));
}
private static Double swish(Double d) {
if (d > 0) {
if (d < HUGE_FLOAT_EXP) {
float x = (float)Math.exp(d);
return (d * x) / (x + 1);
}
}
else {
return (d / (1 + Math.exp(-d)));
}
return 0.0;
}
private static Double leakyReLU(Double d) {
return d <= 0 ? d * LEAKY_RELU_ALPHA : d;
}
private static Double mish(Double d) {
float x = 1;
// tanh and softplus
if (d < LARGE_FLOAT_EXP) {
x = (float)(Math.tanh(Math.log(Math.exp(d) + 1)));
}
return d * x;
}
private static Double selu(Double d) {
/*
if (d <= 0) {
return SELU_ALPHA * (Math.exp(d) -1) - SELU_ALPHA;
} else {
return SELU_SCALE * d;
}*/
if (d <= 0) {
d = SELU_ALPHA * (Math.exp(d) - 1) - SELU_ALPHA;
}
return d * SELU_SCALE;
}
public static ArrayList<List<Double>> sumAndNormalize(
ArrayList<ArrayList<List<Double>>> inputs, boolean isRegression) {
ArrayList<List<Double>> first = (ArrayList<List<Double>>) inputs.get(0);
Double[] ysums = new Double[first.get(0).size()];
for (int j=0; j<first.get(0).size(); j++) {
ysums[j] = 0.0;
}
for (Object inputObj: inputs) {
ArrayList<List<Double>> input = (ArrayList<List<Double>>) inputObj;
for (int k=0; k<input.get(0).size(); k++) {
ysums[k] += input.get(0).get(k);
}
}
ArrayList<List<Double>> outDist = new ArrayList<List<Double>>();
List<Double> dist = new ArrayList<Double>();
double sum = 0.0;
for (int j=0; j<ysums.length; j++) {
sum += ysums[j];
}
for (int i=0; i<ysums.length; i++) {
if (isRegression) {
dist.add(ysums[i] / inputs.size());
} else {
dist.add(ysums[i] / sum);
}
}
outDist.add(dist);
return outDist;
}
} | 24.853081 | 79 | 0.605072 |
61a2577b4bb235b11b4398331d92f2b5f92f33df | 19,910 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
package org.elasticsearch.join.mapper;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperException;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.MapperServiceTestCase;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.SourceToParse;
import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xcontent.XContentType;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import static java.util.Collections.singleton;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
public class ParentJoinFieldMapperTests extends MapperServiceTestCase {
@Override
protected Collection<? extends Plugin> getPlugins() {
return singleton(new ParentJoinPlugin());
}
public void testSingleLevel() throws Exception {
MapperService mapperService = createMapperService(mapping(b -> {
b.startObject("join_field");
b.field("type", "join").startObject("relations").field("parent", "child").endObject();
b.endObject();
}));
DocumentMapper docMapper = mapperService.documentMapper();
Joiner joiner = Joiner.getJoiner(
mapperService.mappingLookup().getMatchingFieldNames("*").stream().map(mapperService.mappingLookup()::getFieldType)
);
assertNotNull(joiner);
assertEquals("join_field", joiner.getJoinField());
// Doc without join
ParsedDocument doc = docMapper.parse(source(b -> {}));
assertNull(doc.rootDoc().getBinaryValue("join_field"));
// Doc parent
doc = docMapper.parse(source(b -> b.field("join_field", "parent")));
assertEquals("1", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("parent", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
// Doc child
doc = docMapper.parse(source("2", b -> b.startObject("join_field").field("name", "child").field("parent", "1").endObject(), "1"));
assertEquals("1", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("child", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
// Unknown join name
MapperException exc = expectThrows(
MapperParsingException.class,
() -> docMapper.parse(source(b -> b.field("join_field", "unknown")))
);
assertThat(exc.getRootCause().getMessage(), containsString("unknown join name [unknown] for field [join_field]"));
}
public void testParentIdSpecifiedAsNumber() throws Exception {
DocumentMapper docMapper = createDocumentMapper(mapping(b -> {
b.startObject("join_field");
b.field("type", "join").startObject("relations").field("parent", "child").endObject();
b.endObject();
}));
ParsedDocument doc = docMapper.parse(
source("2", b -> b.startObject("join_field").field("name", "child").field("parent", 1).endObject(), "1")
);
assertEquals("1", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("child", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
doc = docMapper.parse(source("2", b -> b.startObject("join_field").field("name", "child").field("parent", 1.0).endObject(), "1"));
assertEquals("1.0", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("child", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
}
public void testMultipleLevels() throws Exception {
DocumentMapper docMapper = createDocumentMapper(mapping(b -> {
b.startObject("join_field");
b.field("type", "join");
b.startObject("relations").field("parent", "child").field("child", "grand_child").endObject();
b.endObject();
}));
// Doc without join
ParsedDocument doc = docMapper.parse(
new SourceToParse("0", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
);
assertNull(doc.rootDoc().getBinaryValue("join_field"));
// Doc parent
doc = docMapper.parse(source(b -> b.field("join_field", "parent")));
assertEquals("1", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("parent", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
// Doc child
doc = docMapper.parse(source("2", b -> b.startObject("join_field").field("name", "child").field("parent", "1").endObject(), "1"));
assertEquals("1", doc.rootDoc().getBinaryValue("join_field#parent").utf8ToString());
assertEquals("2", doc.rootDoc().getBinaryValue("join_field#child").utf8ToString());
assertEquals("child", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
// Doc child missing parent
MapperParsingException exc = expectThrows(
MapperParsingException.class,
() -> docMapper.parse(source("2", b -> b.field("join_field", "child"), "1"))
);
assertThat(exc.getRootCause().getMessage(), containsString("[parent] is missing for join field [join_field]"));
// Doc child missing routing
exc = expectThrows(
MapperParsingException.class,
() -> docMapper.parse(source(b -> b.startObject("join_field").field("name", "child").field("parent", "1").endObject()))
);
assertThat(exc.getRootCause().getMessage(), containsString("[routing] is missing for join field [join_field]"));
// Doc grand_child
doc = docMapper.parse(
source("3", b -> b.startObject("join_field").field("name", "grand_child").field("parent", "2").endObject(), "1")
);
assertEquals("2", doc.rootDoc().getBinaryValue("join_field#child").utf8ToString());
assertEquals("grand_child", doc.rootDoc().getBinaryValue("join_field").utf8ToString());
// Unknown join name
exc = expectThrows(
MapperParsingException.class,
() -> docMapper.parse(
new SourceToParse(
"1",
BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("join_field", "unknown").endObject()),
XContentType.JSON
)
)
);
assertThat(exc.getRootCause().getMessage(), containsString("unknown join name [unknown] for field [join_field]"));
}
public void testUpdateRelations() throws Exception {
MapperService mapperService = createMapperService(mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.field("parent", "child");
b.array("child", "grand_child1", "grand_child2");
}
b.endObject();
}
b.endObject();
}));
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.array("child", "grand_child1", "grand_child2");
}
b.endObject();
}
b.endObject();
})));
assertThat(exc.getMessage(), containsString("Cannot remove parent [parent]"));
exc = expectThrows(IllegalArgumentException.class, () -> merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.field("parent", "child");
b.array("child", "grand_child1");
}
b.endObject();
}
b.endObject();
})));
assertThat(exc.getMessage(), containsString("Cannot remove child [grand_child2]"));
exc = expectThrows(IllegalArgumentException.class, () -> merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.field("uber_parent", "parent");
b.field("parent", "child");
b.array("child", "grand_child1", "grand_child2");
}
b.endObject();
}
b.endObject();
})));
assertThat(exc.getMessage(), containsString("Cannot create child [parent] from an existing root"));
exc = expectThrows(IllegalArgumentException.class, () -> merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.field("parent", "child");
b.array("child", "grand_child1", "grand_child2");
b.field("grand_child2", "grand_grand_child");
}
b.endObject();
}
b.endObject();
})));
assertThat(exc.getMessage(), containsString("Cannot create parent [grand_child2] from an existing child"));
merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.array("parent", "child", "child2");
b.array("child", "grand_child1", "grand_child2");
}
b.endObject();
}
b.endObject();
}));
Joiner joiner = Joiner.getJoiner(
mapperService.mappingLookup().getMatchingFieldNames("*").stream().map(mapperService.mappingLookup()::getFieldType)
);
assertNotNull(joiner);
assertEquals("join_field", joiner.getJoinField());
assertTrue(joiner.childTypeExists("child2"));
assertFalse(joiner.parentTypeExists("child2"));
assertEquals(new TermQuery(new Term("join_field", "parent")), joiner.parentFilter("child"));
assertEquals(new TermQuery(new Term("join_field", "parent")), joiner.parentFilter("child2"));
assertTrue(joiner.childTypeExists("grand_child2"));
assertFalse(joiner.parentTypeExists("grand_child2"));
assertEquals(new TermQuery(new Term("join_field", "child")), joiner.parentFilter("grand_child1"));
assertEquals(new TermQuery(new Term("join_field", "child")), joiner.parentFilter("grand_child2"));
merge(mapperService, mapping(b -> {
b.startObject("join_field");
{
b.field("type", "join");
b.startObject("relations");
{
b.array("parent", "child", "child2");
b.array("child", "grand_child1", "grand_child2");
b.array("other", "child_other1", "child_other2");
}
b.endObject();
}
b.endObject();
}));
joiner = Joiner.getJoiner(
mapperService.mappingLookup().getMatchingFieldNames("*").stream().map(mapperService.mappingLookup()::getFieldType)
);
assertNotNull(joiner);
assertEquals("join_field", joiner.getJoinField());
assertTrue(joiner.childTypeExists("child2"));
assertFalse(joiner.parentTypeExists("child2"));
assertEquals(new TermQuery(new Term("join_field", "parent")), joiner.parentFilter("child"));
assertEquals(new TermQuery(new Term("join_field", "parent")), joiner.parentFilter("child2"));
assertTrue(joiner.childTypeExists("grand_child2"));
assertFalse(joiner.parentTypeExists("grand_child2"));
assertEquals(new TermQuery(new Term("join_field", "child")), joiner.parentFilter("grand_child1"));
assertEquals(new TermQuery(new Term("join_field", "child")), joiner.parentFilter("grand_child2"));
assertTrue(joiner.parentTypeExists("other"));
assertFalse(joiner.childTypeExists("other"));
assertTrue(joiner.childTypeExists("child_other1"));
assertFalse(joiner.parentTypeExists("child_other1"));
assertTrue(joiner.childTypeExists("child_other2"));
assertFalse(joiner.parentTypeExists("child_other2"));
assertEquals(new TermQuery(new Term("join_field", "other")), joiner.parentFilter("child_other2"));
}
public void testInvalidJoinFieldInsideObject() throws Exception {
MapperParsingException exc = expectThrows(MapperParsingException.class, () -> createMapperService(mapping(b -> {
b.startObject("object");
{
b.startObject("properties");
{
b.startObject("join_field");
b.field("type", "join").startObject("relations").field("parent", "child").endObject();
b.endObject();
}
b.endObject();
}
b.endObject();
})));
assertThat(
exc.getRootCause().getMessage(),
containsString("join field [object.join_field] cannot be added inside an object or in a multi-field")
);
}
public void testInvalidJoinFieldInsideMultiFields() throws Exception {
MapperParsingException exc = expectThrows(MapperParsingException.class, () -> createMapperService(mapping(b -> {
b.startObject("number");
{
b.field("type", "integer");
b.startObject("fields");
{
b.startObject("join_field");
{
b.field("type", "join").startObject("relations").field("parent", "child").endObject();
}
b.endObject();
}
b.endObject();
}
b.endObject();
})));
assertThat(
exc.getRootCause().getMessage(),
containsString("join field [number.join_field] cannot be added inside an object or in a multi-field")
);
}
public void testMultipleJoinFields() throws Exception {
{
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> createMapperService(mapping(b -> {
b.startObject("join_field");
b.field("type", "join");
b.startObject("relations").field("parent", "child").field("child", "grand_child").endObject();
b.endObject();
b.startObject("another_join_field");
b.field("type", "join");
b.startObject("relations").field("product", "item").endObject().endObject();
})));
assertThat(
exc.getMessage(),
equalTo("Only one [parent-join] field can be defined per index, got [join_field, another_join_field]")
);
}
{
MapperService mapperService = createMapperService(mapping(b -> {
b.startObject("join_field");
b.field("type", "join");
b.startObject("relations").field("parent", "child").field("child", "grand_child").endObject();
b.endObject();
}));
// Updating the mapping with another join field also fails
IllegalArgumentException exc = expectThrows(
IllegalArgumentException.class,
() -> merge(mapperService, mapping(b -> b.startObject("another_join_field").field("type", "join").endObject()))
);
assertThat(
exc.getMessage(),
equalTo("Only one [parent-join] field can be defined per index, got [join_field, another_join_field]")
);
}
}
public void testEagerGlobalOrdinals() throws Exception {
MapperService mapperService = createMapperService(
mapping(
b -> b.startObject("join_field")
.field("type", "join")
.startObject("relations")
.field("parent", "child")
.field("child", "grand_child")
.endObject()
.endObject()
)
);
assertFalse(mapperService.fieldType("join_field").eagerGlobalOrdinals());
assertNotNull(mapperService.fieldType("join_field#parent"));
assertTrue(mapperService.fieldType("join_field#parent").eagerGlobalOrdinals());
assertNotNull(mapperService.fieldType("join_field#child"));
assertTrue(mapperService.fieldType("join_field#child").eagerGlobalOrdinals());
merge(
mapperService,
mapping(
b -> b.startObject("join_field")
.field("type", "join")
.field("eager_global_ordinals", false)
.startObject("relations")
.field("parent", "child")
.field("child", "grand_child")
.endObject()
.endObject()
)
);
assertFalse(mapperService.fieldType("join_field").eagerGlobalOrdinals());
assertNotNull(mapperService.fieldType("join_field#parent"));
assertFalse(mapperService.fieldType("join_field#parent").eagerGlobalOrdinals());
assertNotNull(mapperService.fieldType("join_field#child"));
assertFalse(mapperService.fieldType("join_field#child").eagerGlobalOrdinals());
}
public void testSubFields() throws IOException {
MapperService mapperService = createMapperService(
mapping(
b -> b.startObject("join_field")
.field("type", "join")
.startObject("relations")
.field("parent", "child")
.field("child", "grand_child")
.endObject()
.endObject()
)
);
ParentJoinFieldMapper mapper = (ParentJoinFieldMapper) mapperService.mappingLookup().getMapper("join_field");
assertTrue(mapper.fieldType().isSearchable());
assertTrue(mapper.fieldType().isAggregatable());
Iterator<Mapper> it = mapper.iterator();
FieldMapper next = (FieldMapper) it.next();
assertThat(next.name(), equalTo("join_field#parent"));
assertTrue(next.fieldType().isSearchable());
assertTrue(next.fieldType().isAggregatable());
assertTrue(it.hasNext());
next = (FieldMapper) it.next();
assertThat(next.name(), equalTo("join_field#child"));
assertTrue(next.fieldType().isSearchable());
assertTrue(next.fieldType().isAggregatable());
assertFalse(it.hasNext());
}
}
| 44.943567 | 138 | 0.587092 |
9f3f67b8343a33114b8a7bb888689156aa6194c0 | 253 | package com.rocksolidapps.core.api.repository;
import com.rocksolidapps.core.api.model.ConfigurationApi;
import rx.Observable;
/**
* @author Skala
*/
public interface ConfigurationRepository {
Observable<ConfigurationApi> getConfiguration();
}
| 19.461538 | 57 | 0.786561 |
5c70d6a13ef96d9b3f8323c5fc6fc254935c679f | 3,058 | package top.ylonline.jpipe.freemarker.tag;
import freemarker.core.Environment;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapperBuilder;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
import lombok.extern.slf4j.Slf4j;
import top.ylonline.jpipe.common.Cts;
import top.ylonline.jpipe.freemarker.model.FmPagelet;
import top.ylonline.jpipe.freemarker.render.FmRender;
import java.io.IOException;
import java.util.Map;
/**
* pagelet Directive
*
* @author YL
* @since freemarker 2.3.11
*/
@Slf4j
public class PageletTag implements TemplateDirectiveModel {
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars,
TemplateDirectiveBody body) throws TemplateException, IOException {
if (params.isEmpty()) {
throw new TemplateModelException("This directive doesn't allow empty parameter");
}
if (loopVars.length != 0) {
throw new TemplateModelException("This directive doesn't allow loop variables");
}
if (body == null) {
return;
}
TemplateModel renderModel = env.getVariable(PipeTag.V_NAME_RENDER);
if (renderModel == null) {
throw new TemplateModelException("pagelet outside pipe");
}
TemplateScalarModel domIdModel = (TemplateScalarModel) params.get(Cts.PAGELET_DOM_ID);
if (domIdModel == null) {
throw new NullPointerException("No domid attribute!");
}
TemplateScalarModel beanModel = (TemplateScalarModel) params.get(Cts.PAGELET_BEAN);
if (beanModel == null) {
throw new NullPointerException("No bean attribute!");
}
TemplateScalarModel varModel = (TemplateScalarModel) params.get(Cts.PAGELET_VAR);
if (varModel == null) {
throw new NullPointerException("No var attribute!");
}
TemplateScalarModel uriModel = (TemplateScalarModel) params.get(Cts.PAGELET_URI);
TemplateScalarModel jsMethodModel = (TemplateScalarModel) params.get(Cts.PAGELET_JS_METHOD);
String domid = domIdModel.getAsString();
String bean = beanModel.getAsString();
String var = varModel.getAsString();
String uri = uriModel == null ? "" : uriModel.getAsString();
String jsmethod = jsMethodModel == null ? "" : jsMethodModel.getAsString();
FmPagelet pagelet = new FmPagelet(
domid,
bean,
var,
uri,
jsmethod,
env,
body
);
FmRender render = (FmRender) new DefaultObjectWrapperBuilder(Configuration.getVersion())
.build()
.unwrap(renderModel);
render.addPagelet(pagelet);
}
}
| 35.55814 | 100 | 0.666776 |
8b211b6fd5b338c2ae6d980cb0995934c3c911aa | 862 | package ru.job4j.tracker;
/**
* Class Класс для изменения заявки.
* @author Buryachenko
* @since 15.01.2019
* @version 1
*/
public class UpdateItem extends BaseAction {
public UpdateItem(int key, String info) {
super(key, info);
}
@Override
public void execute(Input input, ITracker tracker) {
System.out.println("--------- Изменение заявки ---------");
String id = input.ask("Введите индефикатор заявки :");
String name = input.ask("Введите имя заявки :");
String desc = input.ask("Введите описание заявки");
Item item = new Item(name, desc);
if (tracker.replace(id, item)) {
System.out.println("Заявка изменена.");
} else {
System.out.println("Заявка не найдена.");
}
System.out.println("-----------------------------------");
}
}
| 29.724138 | 67 | 0.567285 |
814663da29f06096dbc6d1b1fdc6e323180dacf5 | 769 | package com.example.albumapp;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
public abstract class MainActionModeCallback implements ActionMode.Callback {
private ActionMode action;
private MenuItem countItem;
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
actionMode.getMenuInflater().inflate(R.menu.menu_action_mode, menu);
this.action = actionMode;
this.countItem = menu.findItem(R.id.action_checked_count);
return true;
}
public void setCount(String checkedCount) {
if(countItem != null){
this.countItem.setTitle(checkedCount);
}
}
public ActionMode getAction() {
return action;
}
} | 27.464286 | 77 | 0.698309 |
4d24cbfc5d130aedd52769daf82d6f155630bc76 | 2,193 | /*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.uibinder.elementparsers;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.uibinder.rebind.FieldWriter;
import com.google.gwt.uibinder.rebind.UiBinderWriter;
import com.google.gwt.uibinder.rebind.XMLElement;
import com.google.gwt.user.client.ui.LazyPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Parses {@link com.google.gwt.user.client.ui.LazyPanel} widgets.
*/
public class LazyPanelParser implements ElementParser {
private static final String INITIALIZER_FORMAT = "new %s() {\n"
+ " protected %s createWidget() {\n"
+ " return %s;\n"
+ " }\n"
+ "}";
public void parse(XMLElement elem, String fieldName, JClassType type,
UiBinderWriter writer) throws UnableToCompleteException {
if (writer.getOwnerClass().getUiField(fieldName).isProvided()) {
return;
}
if (!writer.useLazyWidgetBuilders()) {
writer.die("LazyPanel only works with UiBinder.useLazyWidgetBuilders enabled.");
}
XMLElement child = elem.consumeSingleChildElement();
if (!writer.isWidgetElement(child)) {
writer.die(child, "Expecting only widgets in %s", elem);
}
FieldWriter childField = writer.parseElementToField(child);
String lazyPanelClassPath = LazyPanel.class.getName();
String widgetClassPath = Widget.class.getName();
String code = String.format(INITIALIZER_FORMAT, lazyPanelClassPath,
widgetClassPath, childField.getNextReference());
writer.setFieldInitializer(fieldName, code);
}
}
| 34.809524 | 86 | 0.730506 |
805c183cac2fc70608c19e06ec3a124f0422b400 | 649 | package net.cpollet.kozan.generator;
import java.util.function.Function;
public final class SequenceGenerator<T> implements Generator<T> {
private final Function<T, T> generator;
private T previous;
public SequenceGenerator(T seed, Function<T, T> generator) {
this.generator = generator;
this.previous = seed;
}
@Override
public boolean hasNext() {
return true;
}
@SuppressWarnings("squid:S2272") // infinite sequence always has a next() element
@Override
public T next() {
T retVal = previous;
previous = generator.apply(previous);
return retVal;
}
}
| 24.037037 | 85 | 0.653313 |
4a27f42f138df5eb22e9f04b8051c129cef32031 | 3,155 | /*
* JetS3t : Java S3 Toolkit
* Project hosted at http://bitbucket.org/jmurty/jets3t/
*
* Copyright 2006-2010 James Murty
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jets3t.service;
import org.jets3t.service.model.StorageObject;
/**
* Stores a "chunk" of StorageObjects returned from a list command - this particular chunk may or may
* not include all the objects available in a bucket.
*
* This class contains an array of objects and a the last key name returned by a prior
* call to the method {@link S3Service#listObjectsChunked(String, String, String, long, String)}.
*
* @author James Murty
*/
public class StorageObjectsChunk {
protected String prefix = null;
protected String delimiter = null;
protected StorageObject[] objects = null;
protected String[] commonPrefixes = null;
protected String priorLastKey = null;
public StorageObjectsChunk(String prefix, String delimiter, StorageObject[] objects,
String[] commonPrefixes, String priorLastKey)
{
this.prefix = prefix;
this.delimiter = delimiter;
this.objects = objects;
this.commonPrefixes = commonPrefixes;
this.priorLastKey = priorLastKey;
}
/**
* @return
* the objects in this chunk.
*/
public StorageObject[] getObjects() {
return objects;
}
/**
* @return
* the common prefixes in this chunk.
*/
public String[] getCommonPrefixes() {
return commonPrefixes;
}
/**
* @return
* the last key returned by the previous chunk if that chunk was incomplete, null otherwise.
*/
public String getPriorLastKey() {
return priorLastKey;
}
/**
* @return
* the prefix applied when this object chunk was generated. If no prefix was
* applied, this method will return null.
*/
public String getPrefix() {
return prefix;
}
/**
* @return
* the delimiter applied when this object chunk was generated. If no
* delimiter was applied, this method will return null.
*/
public String getDelimiter() {
return delimiter;
}
/**
* A convenience method to check whether a listing of objects is complete
* (true) or there are more objects available (false). Just a synonym for
* <code>{@link #getPriorLastKey()} == null</code>.
*
* @return
* true if the listing is complete and there are no more unlisted
* objects, false if follow-up requests will return more objects.
*/
public boolean isListingComplete() {
return (priorLastKey == null);
}
}
| 29.764151 | 101 | 0.666561 |
99e0c0892a5f227fb09a13ce5a47aa924886e0f7 | 3,498 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.websvc.jaxws.catalog.impl;
import org.netbeans.modules.websvc.jaxws.catalog.CatalogQNames;
import org.netbeans.modules.websvc.jaxws.catalog.NextCatalog;
import org.netbeans.modules.websvc.jaxws.catalog.CatalogComponent;
import org.netbeans.modules.websvc.jaxws.catalog.CatalogComponentFactory;
import org.netbeans.modules.websvc.jaxws.catalog.CatalogVisitor;
import org.netbeans.modules.websvc.jaxws.catalog.Catalog;
import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
import org.w3c.dom.Element;
public class CatalogComponentFactoryImpl implements CatalogComponentFactory {
private CatalogModelImpl model;
public CatalogComponentFactoryImpl(CatalogModelImpl model) {
this.model = model;
}
public CatalogComponent create(Element element, CatalogComponent context) {
if (context == null) {
if (areSameQName(CatalogQNames.CATALOG, element)) {
return new CatalogImpl(model, element);
} else {
return null;
}
} else {
return new CreateVisitor().create(element, context);
}
}
public NextCatalog createNextCatalog() {
return new NextCatalogImpl(model);
}
public org.netbeans.modules.websvc.jaxws.catalog.System createSystem() {
return new SystemImpl(model);
}
public Catalog createCatalog() {
return new CatalogImpl(model);
}
public static boolean areSameQName(CatalogQNames q, Element e) {
return q.getQName().equals(AbstractDocumentComponent.getQName(e));
}
public static class CreateVisitor extends CatalogVisitor.Default {
Element element;
CatalogComponent created;
CatalogComponent create(Element element, CatalogComponent context) {
this.element = element;
context.accept(this);
return created;
}
private boolean isElementQName(CatalogQNames q) {
return areSameQName(q, element);
}
public void visit(Catalog context) {
if (isElementQName(CatalogQNames.SYSTEM)) {
created = new SystemImpl((CatalogModelImpl)context.getModel(), element);
}
if (isElementQName(CatalogQNames.NEXTCATALOG)) {
created = new NextCatalogImpl((CatalogModelImpl)context.getModel(), element);
}
}
public void visit(org.netbeans.modules.websvc.jaxws.catalog.System context) {
}
public void visit(NextCatalog context) {
}
}
}
| 35.333333 | 93 | 0.670669 |
766fe26706cd358867984d9450a3d6b800847d65 | 3,889 | package cz.johnyapps.jecnakvkapse.Suplarch;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.widget.Toast;
import java.io.File;
import java.util.List;
import cz.johnyapps.jecnakvkapse.Dialogs.DialogLoading;
import cz.johnyapps.jecnakvkapse.HttpConnection.DownloadFile;
import cz.johnyapps.jecnakvkapse.HttpConnection.Request;
import cz.johnyapps.jecnakvkapse.HttpConnection.ResultErrorProcess;
import cz.johnyapps.jecnakvkapse.Suplarch.SuplarchLinky.SuplarchLink;
import cz.johnyapps.jecnakvkapse.Tools.GenericFileProvider;
import cz.johnyapps.jecnakvkapse.Tools.Logger;
/**
* Stáhne soubor se suplováním a pošle intent pro jeho otevření aplikací, která umí zpracovávat application/vnd.ms-excel.
* @see SuplarchLink
* @see DownloadFile
*/
public class StahniSuplarch {
private static final String TAG = "StahniSuplarch";
private Context context;
private SuplarchLink link;
/**
* Inicializace
* @param context Context
*/
public StahniSuplarch(Context context) {
this.context = context;
}
/**
* Stáhne suplarch
* @param link {@link SuplarchLink}
*/
public void stahni(SuplarchLink link) {
this.link = link;
DialogLoading dialog = new DialogLoading(context);
Request request = new Request(link.getLink(), "GET", new File(context.getCacheDir(), link.getDocName()));
DownloadFile download = new DownloadFile(dialog.get(link.getDocName()));
download.setOnCompleteListener(new DownloadFile.OnCompleteListener() {
@Override
public void onComplete(String result) {
ResultErrorProcess process = new ResultErrorProcess(context);
if (process.process(result)) {
onResult();
}
}
});
download.execute(request);
}
/**
* Spustí se při dokončení stahování
*/
private void onResult() {
if (link != null) {
openSuplarch(link);
}
}
/**
* Otevře suplování v aplikace schopné zpracovat application/vnd.ms-excel
* @param link {@link SuplarchLink}
* @see GenericFileProvider
*/
private void openSuplarch(SuplarchLink link) {
Logger.i(TAG, "openSuplarch");
Logger.v(TAG, "openSuplarch: Getting downloads directory");
File file = new File(context.getCacheDir(), link.getDocName());
Logger.v(TAG, "openSuplarch: Getting file provider");
Uri uri = GenericFileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
Logger.v(TAG, "openSuplarch: Creating intent");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "application/vnd.ms-excel");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Logger.v(TAG, "openSuplarch: Granting permissions");
List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName;
context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
Logger.v(TAG, "openSuplarch: Opening");
try {
context.startActivity(intent);
}
catch (ActivityNotFoundException e) {
Logger.v(TAG, "openSuplarch: Opening failed! No app found.");
Toast.makeText(context, "Nenalezena žádná app pro otevření suplarchu (.xls)", Toast.LENGTH_SHORT).show();
}
}
}
| 35.036036 | 133 | 0.683209 |
6f16843058a535a961fb9e89563488e6b017abba | 1,525 | /*******************************************************************************
* Copyright (c) 2021 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j.rio.helpers;
import org.eclipse.rdf4j.rio.RioSetting;
/**
* A class encapsulating writer settings that Turtle writers may support.
*
* @author Bart Hanssens
*/
public class TurtleWriterSettings {
/**
* Boolean setting for Turtle/TriG Writer to determine if the abbreviated syntax for numeric datatypes is to be used
* when {@link org.eclipse.rdf4j.rio.helpers.BasicWriterSettings.html#PRETTY_PRINT} is <code>true</code>.
*
* This setting has no effect when pretty print is false.
*
* <p>
* Defaults to true.
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.turtle.abbreviate_numbers}
*
* @since 3.7.0
* @see <a href="https://www.w3.org/TR/turtle/#abbrev">https://www.w3.org/TR/turtle/#abbrev</a>
*/
public static final RioSetting<Boolean> ABBREVIATE_NUMBERS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.turtle.abbreviate_numbers", "Abbreviate numbers", Boolean.TRUE);
/**
* Private default constructor.
*/
private TurtleWriterSettings() {
}
}
| 37.195122 | 117 | 0.657705 |
5732fb5c5d4cb57d48547222e52cc41f9ff2672f | 198 | public class E1 {
//@ requires true;
public static int m0(int a, int b){
if(a < 0 || b < 0 || a + b < 10 || a - b < 10 || a * b < 10){
return a - b;
}
return a + b;
}
}
| 15.230769 | 62 | 0.424242 |
82a4d23483dbd9ed906e1916fea747b33b85b093 | 1,601 | package nodes.arguments;
import tree.TreeContext;
import java.util.ArrayList;
import java.util.List;
public class BasicArgument extends ArgumentType {
private String content;
private TreeContext context;
public BasicArgument(String content, TreeContext context) {
this.content = content;
this.context = context;
}
/**
* Renames a function and uses to a new name
*
* @param oldFunctionName Existing function name
* @param newFunctionName Desired function name
*/
@Override
public void renameFunction(String oldFunctionName, String newFunctionName) {
this.content = rename(content, oldFunctionName, newFunctionName);
}
/**
* Renames the variable and all uses of this variable.
*
* @param oldVariableName Existing variable name
* @param newVariableName Desired variable name
*/
@Override
public void renameVariable(String oldVariableName, String newVariableName) {
this.content = rename(content, oldVariableName, newVariableName);
}
@Override
public ArgumentType inline(String functionName, String newText) {
// Cannot be inlined.
return this;
}
@Override
public boolean calls(String functionName) {
return false;
}
@Override
public boolean usesAsFunction(String functionName) {
return content.contains("function " + functionName);
}
@Override
public List<Argument> getArguments() {
return new ArrayList<>();
}
public String toString() {
return content;
}
}
| 24.630769 | 80 | 0.669582 |
830952acfe3b5b8fb1d418fabacd2fe405c48748 | 1,026 | package com.ibm.cruise.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import com.ibm.cruise.entity.Student;
@Repository
public class StudentDao {
@Autowired
private JdbcTemplate jdbcTemplate;
public List<Student> getStudentList() throws Exception {
String sql = "SELECT ID, NAME, SCORE_SUM, SCORE_AVG, AGE FROM TP_STUDENT";
return jdbcTemplate.query(sql, new RowMapper<Student>() {
@Override
public Student mapRow(ResultSet rs, int rowNum) throws SQLException {
Student student = new Student();
student.setId(rs.getInt("ID"));
student.setAge(rs.getInt("AGE"));
student.setName(rs.getString("NAME"));
student.setSumScore(rs.getString("SCORE_SUM"));
student.setAvgScore(rs.getString("SCORE_AVG"));
return student;
}
});
}
}
| 27.72973 | 76 | 0.753411 |
52288f3ad8b3a6c8076f186a45a81337ff192981 | 2,058 | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.partialimport;
import java.util.HashSet;
import java.util.Set;
/**
* Aggregates all the PartialImportResult objects.
* These results are used in the admin UI and for creating admin events.
*
* @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
*/
public class PartialImportResults {
private final Set<PartialImportResult> importResults = new HashSet<>();
public void addResult(PartialImportResult result) {
importResults.add(result);
}
public void addAllResults(PartialImportResults results) {
importResults.addAll(results.getResults());
}
public int getAdded() {
int added = 0;
for (PartialImportResult result : importResults) {
if (result.getAction() == Action.ADDED) added++;
}
return added;
}
public int getOverwritten() {
int overwritten = 0;
for (PartialImportResult result : importResults) {
if (result.getAction() == Action.OVERWRITTEN) overwritten++;
}
return overwritten;
}
public int getSkipped() {
int skipped = 0;
for (PartialImportResult result : importResults) {
if (result.getAction() == Action.SKIPPED) skipped++;
}
return skipped;
}
public Set<PartialImportResult> getResults() {
return importResults;
}
}
| 28.583333 | 75 | 0.673955 |
78b9dc1dee3a6d4c20e92c16b30386a9605dfd33 | 1,281 | // Copyright 2013 Square, Inc.
package org.assertj.android.api.widget;
import android.annotation.TargetApi;
import android.widget.TabWidget;
import static android.os.Build.VERSION_CODES.FROYO;
import static org.assertj.core.api.Assertions.assertThat;
/** Assertions for {@link TabWidget} instances. */
public class TabWidgetAssert extends AbstractLinearLayoutAssert<TabWidgetAssert, TabWidget> {
public TabWidgetAssert(TabWidget actual) {
super(actual, TabWidgetAssert.class);
}
public TabWidgetAssert hasTabCount(int count) {
isNotNull();
int actualCount = actual.getTabCount();
assertThat(actualCount) //
.overridingErrorMessage("Expected tab count <%s> but was <%s>.", count, actualCount) //
.isEqualTo(count);
return this;
}
@TargetApi(FROYO)
public TabWidgetAssert isStripEnabled() {
isNotNull();
assertThat(actual.isStripEnabled()) //
.overridingErrorMessage("Expected strip to be enabled but was disabled.") //
.isTrue();
return this;
}
@TargetApi(FROYO)
public TabWidgetAssert isStripDisabled() {
isNotNull();
assertThat(actual.isStripEnabled()) //
.overridingErrorMessage("Expected strip to be disabled but was enabled.") //
.isFalse();
return this;
}
}
| 29.790698 | 95 | 0.710383 |
77192db5da9c301e4caa50e3cd80527d4ec33486 | 35,126 | package music.hs.com.materialmusicv2.activities;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.media.audiofx.Visualizer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.SeekBar;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chibde.visualizer.LineVisualizer;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.database.core.utilities.Tree;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.temporal.TemporalAccessor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeMap;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import music.hs.com.materialmusicv2.LineBarVisualizer;
import music.hs.com.materialmusicv2.R;
import music.hs.com.materialmusicv2.HSMusicApplication;
import music.hs.com.materialmusicv2.ShowDatabaseObject;
import music.hs.com.materialmusicv2.adapters.ShowDatabaseAdapter;
import music.hs.com.materialmusicv2.bottomsheetdialogs.BottomSheetLyricsFragment;
import music.hs.com.materialmusicv2.customviews.nowplaying.NowPlayingLyrics;
import music.hs.com.materialmusicv2.customviews.others.CustomColorSwitchCompat;
import music.hs.com.materialmusicv2.customviews.others.SquareImageView;
import music.hs.com.materialmusicv2.lyrics.LRC;
import music.hs.com.materialmusicv2.lyrics.MagicFileChooser;
import music.hs.com.materialmusicv2.lyrics.flip;
import music.hs.com.materialmusicv2.objects.Song;
import music.hs.com.materialmusicv2.objects.events.AlbumArt;
import music.hs.com.materialmusicv2.objects.events.CurrentPlayingSong;
import music.hs.com.materialmusicv2.objects.events.MediaSessionData;
import music.hs.com.materialmusicv2.objects.events.PlaybackPosition;
import music.hs.com.materialmusicv2.objects.events.PlaybackState;
import music.hs.com.materialmusicv2.objects.events.RepeatState;
import music.hs.com.materialmusicv2.objects.events.ShuffleState;
import music.hs.com.materialmusicv2.objects.events.controllerevents.VisualizerData;
import music.hs.com.materialmusicv2.service.MusicService;
import music.hs.com.materialmusicv2.utils.languageutils.LocaleHelper;
import music.hs.com.materialmusicv2.utils.lyricsutils.LyricsUtils;
import music.hs.com.materialmusicv2.utils.queryutils.QueryUtils;
import music.hs.com.materialmusicv2.utils.themeutils.ThemeUtils;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
import static music.hs.com.materialmusicv2.utils.colorutils.ColorUtils.ContrastColor;
import static music.hs.com.materialmusicv2.utils.colorutils.ColorUtils.setBackgroundColorFilter;
import static music.hs.com.materialmusicv2.utils.colorutils.ColorUtils.setColorFilter;
import static music.hs.com.materialmusicv2.utils.colorutils.ColorUtils.setTextColor;
import static music.hs.com.materialmusicv2.utils.controller.Controller.changeRepeat;
import static music.hs.com.materialmusicv2.utils.controller.Controller.changeShuffle;
import static music.hs.com.materialmusicv2.utils.controller.Controller.getCurrentSong;
import static music.hs.com.materialmusicv2.utils.controller.Controller.getSongPosition;
import static music.hs.com.materialmusicv2.utils.controller.Controller.pauseOrResumePlayer;
import static music.hs.com.materialmusicv2.utils.controller.Controller.playNext;
import static music.hs.com.materialmusicv2.utils.controller.Controller.playPrevious;
import static music.hs.com.materialmusicv2.utils.controller.Controller.seekTo;
import static music.hs.com.materialmusicv2.utils.conversionutils.ConversionUtils.covertMilisToTimeString;
import static music.hs.com.materialmusicv2.utils.drawableutils.DialogUtils.showAddToPlaylistDialog;
import static music.hs.com.materialmusicv2.utils.drawableutils.DrawableUtils.getPlayPauseResourceBlack;
import static music.hs.com.materialmusicv2.utils.drawableutils.DrawableUtils.getRepeatResourceBlack;
import static music.hs.com.materialmusicv2.utils.lyricsutils.LyricsUtils.deleteLyricsFromCache;
import static music.hs.com.materialmusicv2.utils.lyricsutils.LyricsUtils.getLyricsFromCache;
import static music.hs.com.materialmusicv2.utils.misc.Etc.TOAST_ERROR;
import static music.hs.com.materialmusicv2.utils.misc.Etc.getRealString;
import static music.hs.com.materialmusicv2.utils.misc.Etc.postToast;
import static music.hs.com.materialmusicv2.utils.misc.Statics.treeUri;
import static music.hs.com.materialmusicv2.utils.themeutils.ThemeUtils.getThemeAccentColor;
import static music.hs.com.materialmusicv2.utils.themeutils.ThemeUtils.getThemeWindowBackgroundColor;
public class FullLyricsLayoutActivity extends MusicPlayerActivity implements NowPlayingLyrics.ClickEventListener{
@Nullable
@BindView(R.id.albumArt)
SquareImageView AlbumArt;
@BindView(R.id.gradient)
SquareImageView Gradient;
@BindView(R.id.wholeLayout)
RelativeLayout WholeLayout;
@BindView(R.id.container)
View container;
@Nullable
@BindView(R.id.lapsedTime2)
TextView lapsedTime2;
@Nullable
@BindView(R.id.totalDuration)
TextView totalDuration;
@BindView(R.id.playPrevious)
ImageButton playPrevious;
@BindView(R.id.playPause)
ExtendedFloatingActionButton playPause;
@BindView(R.id.playNext)
ImageButton playNext;
@BindView(R.id.shuffle)
ImageButton shuffle;
@BindView(R.id.repeat)
ImageButton repeat;
@Nullable
public static SeekBar songProgress2;
@BindView(R.id.songName)
MaterialButton SongName;
@BindView(R.id.back_image)
ImageButton BackImage;
@BindView(R.id.noLyricsText)
TextView NoLyricsText;
@BindView(R.id.setLyrics)
TextView SetLyrics;
@BindView(R.id.noLyricsLayout)
LinearLayout NoLyricslayout;
@BindView(R.id.lyricsLayout)
LinearLayout Lyricslayout;
@BindView(R.id.visualizer)
LineBarVisualizer Visualizer;
@BindView(R.id.switchLyrics)
CustomColorSwitchCompat SwitchLyrics;
@BindView(R.id.lyricsLayoutScroll)
LinearLayout LyricslayoutScroll;
@OnClick({ R.id.playPause, R.id.playPrevious, R.id.playNext, R.id.repeat, R.id.shuffle, R.id.back_image,R.id.setLyrics})
public void onClick(View view) {
switch (view.getId()) {
case R.id.playPause: {
pauseOrResumePlayer();
break;
}
case R.id.playPrevious: {
playPrevious();
break;
}
case R.id.playNext: {
playNext();
break;
}
case R.id.repeat: {
changeRepeat();
break;
}
case R.id.shuffle: {
changeShuffle();
break;
}
case R.id.back_image: {
onBackPressed();
break;
}
case R.id.setLyrics:
{
showLyrics();
break;
}
}
}
private boolean wasPlaying = false;
private boolean isUserTouchingSeekBar = false;
int contrast;
int foreGroundColor;
int backGroundColor;
Timer timer;
TextView[] lyricText;
TextView[] lyricTextScroll;
TreeMap<Integer,String> list;
int currentPosition = 0;
int lastPosition = 0;
private BottomSheetLyricsFragment bottomSheetLyricsFragment;
private NowPlayingLyrics nowPlayingLyrics;
File fileLRC;
LRC lrc;
private ExecutorService executorService = Executors.newSingleThreadExecutor();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_lyrics_layout);
setTheme(ThemeUtils.getTheme(this));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
songProgress2 = (SeekBar)findViewById(R.id.songProgress2);
ButterKnife.bind(this);
list = new TreeMap<>();
setUpSeekBar();
timer = new Timer(true);
timer.schedule(timerTask, 0, 300);
createTextViews();
createTextViewsScroll();
}
private void setUpSeekBar() {
if (songProgress2 != null) {
songProgress2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
seekTo(progress);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
isUserTouchingSeekBar = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
isUserTouchingSeekBar = false;
}
});
}
}
@Override
public void onPause() {
super.onPause();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
if (wasPlaying) {
}
}
@Override
protected void onResume() {
super.onResume();
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK) {
return;
}
if (data == null) return;
if (requestCode == 2) {
Uri uri = data.getData();
fileLRC = new File(MagicFileChooser.getAbsolutePathFromUri(this, uri));
try {
lrc = flip.Parse(fileLRC);
Song song = getCurrentSong();
String temp = lrc.getlyrics();
StringBuilder sb = new StringBuilder(temp);
sb.deleteCharAt(temp.indexOf("{"));
sb.deleteCharAt(temp.indexOf("}") - 1);
deleteLyricsFromCache(getApplicationContext(),song.getId());
LyricsUtils.deleteLyricsFromCache(getApplicationContext(),song.getId());
LyricsUtils.setLyricsInCache(getApplicationContext(), sb.toString(), song.getId());
setLyrics(sb.toString());
bottomSheetLyricsFragment.dismiss();
promptUserToUpoloadLyrics();
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == 0) {
super.onActivityResult(requestCode, resultCode, data);
}
if (requestCode == 42) {
treeUri = data.getData();
final SharedPreferences.Editor editor = getSharedPreferences("mypref", MODE_PRIVATE).edit();
editor.putString("treeUri", treeUri.toString());
editor.apply();
grantUriPermission(getPackageName(), treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
}
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(AlbumArt albumArt) {
Bitmap bitmap = albumArt.albumArt;
AlbumArt.setImageBitmap(bitmap);
setBackgroundColorFilter(albumArt.backgroundColor, Gradient);
WholeLayout.setBackgroundColor(albumArt.backgroundColor);
contrast = ContrastColor(albumArt.backgroundColor);
foreGroundColor = albumArt.foregroundColor;
backGroundColor = albumArt.backgroundColor;
setColors(albumArt.backgroundColor, foreGroundColor);
String lyricsText = LyricsUtils.getLyrics(HSMusicApplication.getInstance().getPlayingQueueManager().getSongs().get(getSongPosition()).getPath(), getApplicationContext(), getCurrentSong().getId());
setLyrics(lyricsText);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(PlaybackState playbackState) {
setPlayPause(playbackState.state);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(PlaybackPosition playbackPosition) {
setSongProgress(playbackPosition.position, playbackPosition.duration);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(RepeatState repeatState) {
setRepeat(repeatState.state);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(ShuffleState shuffleState) {
setShuffle(shuffleState.state);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(CurrentPlayingSong currentPlayingSong)
{
ArrayList<Song> songs = QueryUtils.getAllSongs(getContentResolver(), HSMusicApplication.getInstance().getPreferenceUtils().getSongSortOrder());
ArrayList<Song> t = QueryUtils.getLastPlayedSongs(this);
SongName.setText(currentPlayingSong.songName);
Visualizer.setPlayer(HSMusicApplication.getInstance().getMediaSessionUtils().getAudioID());
}
private void setSongProgress(int progress, int maxProgress) {
final String lapsedText = covertMilisToTimeString(progress);
final String durationText = covertMilisToTimeString(maxProgress);
if (lapsedTime2 != null) {
lapsedTime2.setText(lapsedText);
}
if (totalDuration != null) {
totalDuration.setText(durationText);
}
if (isUserTouchingSeekBar) {
return;
}
if (songProgress2 != null) {
if (songProgress2.getMax() != maxProgress) {
songProgress2.setMax(maxProgress);
}
songProgress2.setProgress(progress);
}
}
private void setShuffle(boolean state) {
if (shuffle != null) {
if (state) {
shuffle.setImageAlpha(255);
} else {
shuffle.setImageAlpha(80);
}
}
}
private void setRepeat(int state) {
if (repeat != null) {
repeat.setImageResource(getRepeatResourceBlack(state));
if (state != 0) {
repeat.setImageAlpha(255);
} else {
repeat.setImageAlpha(80);
}
}
}
private void setPlayPause(boolean isPlaying) {
if (playPause != null)
{
playPause.setIconResource(getPlayPauseResourceBlack(isPlaying));
}
wasPlaying = isPlaying;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setColors(int backgroundColor, int foregroundColor)
{
songProgress2.setProgressBackgroundTintList(ColorStateList.valueOf(contrast));
songProgress2.setProgressTintList(ColorStateList.valueOf(foregroundColor));
songProgress2.getThumb().setColorFilter(contrast, PorterDuff.Mode.SRC_IN);
setColorFilter(contrast, shuffle,playPrevious, playNext, repeat);
setColorFilter(foregroundColor,BackImage);
setBackgroundColorFilter(foregroundColor,BackImage);
Drawable checked = getResources().getDrawable(R.drawable.ic_toggle_checked);
Drawable unChecked = getResources().getDrawable(R.drawable.ic_toggle_unchecked);
PorterDuff.Mode mMode = PorterDuff.Mode.SRC_ATOP;
checked.setColorFilter(foregroundColor,mMode);
unChecked.setColorFilter(foregroundColor,mMode);
if(SwitchLyrics.isChecked())
SwitchLyrics.setTrackDrawable(checked);
else
SwitchLyrics.setTrackDrawable(unChecked);
SwitchLyrics.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked)
{
LyricslayoutScroll.setVisibility(View.VISIBLE);
Lyricslayout.setVisibility(View.GONE);
SwitchLyrics.setTrackDrawable(checked);
}
else
{
LyricslayoutScroll.setVisibility(View.GONE);
Lyricslayout.setVisibility(View.VISIBLE);
SwitchLyrics.setTrackDrawable(unChecked);
}
}
});
SwitchLyrics.setBgOffColor(foregroundColor);
SwitchLyrics.setBgOnColor(foregroundColor);
SwitchLyrics.setToggleOnColor(foregroundColor);
SwitchLyrics.setToggleOffColor(foregroundColor);
SongName.setTextColor(ContrastColor(foregroundColor));
SongName.setBackgroundColor(foregroundColor);
setTextColor(contrast, lapsedTime2, totalDuration);
NoLyricsText.setTextColor(contrast);
SetLyrics.setTextColor(foregroundColor);
if (nowPlayingLyrics != null) {
nowPlayingLyrics.setColors(backgroundColor, foregroundColor);
}
if (playPause != null) {
playPause.setIconTint(ColorStateList.valueOf(ContrastColor(foregroundColor)));
playPause.setBackgroundColor(foregroundColor);
playPause.setRippleColor(ColorStateList.valueOf(backgroundColor));
}
}
protected TreeMap<Integer,String> convertToTreeMap(String text){
TreeMap<Integer,String> data = new TreeMap<>();
String[] split = text.split(",");
for ( int i=0; i <split.length; i++ )
{
String t[] = split[i].split("=");
t[0] = t[0].replaceAll("\\s+","");
if( t.length > 1)
data.put(Integer.parseInt(t[0]),t[1]);
}
return data;
}
private void update(TreeMap<Integer,String> list,int millisecond,boolean isAnimation)
{
Animation aniSlide = AnimationUtils.loadAnimation(this, R.anim.linear_bottom_top);
int j=4;
int first =(contrast & 0x00FFFFFF) | 0x90000000;
int second =(contrast & 0x00FFFFFF) | 0x80000000;
int third =(contrast & 0x00FFFFFF) | 0x70000000;
int forth =(contrast & 0x00FFFFFF) | 0x60000000;
Typeface t = getResources().getFont(R.font.encode_sans_narrow);
for(int i=8;i>=0&&j>=-4;i--,j--)
{
lyricText[i].setText(getLine(millisecond,j));
if(i==8 || i==0)
lyricText[i].setTextColor(forth);
else if(i==7 || i==1)
lyricText[i].setTextColor(third);
else if(i==6 || i==2)
lyricText[i].setTextColor(second);
else if(i==5 || i==3)
lyricText[i].setTextColor(first);
lyricText[i].setTypeface(t);
}
lyricText[4].setTextSize(17);
t = getResources().getFont(R.font.encode_sans_narrow_medium);
lyricText[4].setTypeface(t);
lyricText[4].setTextColor(foreGroundColor);
}
private void createTextViews()
{
lyricText = new TextView[9];
for(int i=8;i>=0;i--)
{
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(R.layout.full_lyrics_format, null);
lyricText[i] = (TextView) v.findViewById(R.id.lyric);
lyricText[i].setTextColor(contrast);
Lyricslayout.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
}
}
private void createTextViewsScroll()
{
int n = list.size();
lyricTextScroll = new TextView[n];
Typeface tf = getResources().getFont(R.font.encode_sans_narrow);
for(int i=n-1;i>=0;i--)
{
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(R.layout.full_lyrics_format, null);
lyricTextScroll[i] = (TextView) v.findViewById(R.id.lyric);
int normal =(contrast & 0x00FFFFFF) | 0x70000000;
lyricTextScroll[i].setTextColor(normal);
Set<Integer> keys = list.keySet();
Integer i_key = getValueFromIndex(keys,i);
lyricTextScroll[i].setText(list.get(i_key));
lyricTextScroll[i].setTypeface(tf);
LyricslayoutScroll.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
}
}
private Integer getValueFromIndex(Set<Integer> set, int pos) {
Iterator<Integer> itr = set.iterator();
Integer value=null;
for(int i = 0; itr.hasNext(); i++)
{
value = itr.next();
if (i == pos)
{
break;
}
}
return value;
}
private int getIndexFromValue(Set<Integer> set, Integer pos) {
Iterator<Integer> itr = set.iterator();
int value=0;
for(int i = 0; itr.hasNext(); i++)
{
value = i;
Integer t = itr.next();
if (t.equals(pos))
{
break;
}
}
return value;
}
private TimerTask timerTask = new TimerTask(){
@Override
public void run() {
Message msg = new Message();
msg.what = songProgress2.getProgress();
handler.sendMessage(msg);
}
};
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
Integer t = getLineIndex(msg.what);
Set<Integer> keys = list.keySet();
Integer first = getValueFromIndex(keys,0);
currentPosition = getIndexFromValue(keys,t);
if ((list != null && !list.isEmpty()) && currentPosition != lastPosition && msg.what >= first)
{
update(list,msg.what,true);
if(lyricTextScroll.length > 0)
{
Typeface typeNormal = getResources().getFont(R.font.encode_sans_narrow);
Typeface typeSelected = getResources().getFont(R.font.encode_sans_narrow_medium);
lyricTextScroll[lastPosition].setTypeface(typeNormal);
lyricTextScroll[currentPosition].setTypeface(typeSelected);
int normal =(contrast & 0x00FFFFFF) | 0x80000000;
lyricTextScroll[lastPosition].setTextColor(normal);
lyricTextScroll[currentPosition].setTextColor(foreGroundColor);
}
lastPosition = currentPosition;
}
if((list != null && !list.isEmpty()) && msg.what < first)
{
int temp = getValueFromIndex(keys,0) + 1;
update(list,temp,false);
}
}
};
private Integer getLineIndex(int millisecond){
if (list.isEmpty()) return null;
Vector<Integer> time = new Vector<>(list.keySet());
int LinePtr = 0;
for (; LinePtr < time.size(); LinePtr++)
{
if (LinePtr + 1 >= time.size())
{
break;
}
if ((millisecond > time.get(LinePtr)) && (millisecond < time.get(LinePtr + 1))) break;
}
return time.get(LinePtr);
}
public String getLine(int millisecond, int offset){
if (list.isEmpty()) return null;
Vector<Integer> time = new Vector<>(list.keySet());
int LinePtr = 0;
for (; LinePtr < time.size(); LinePtr++){
if (LinePtr + 1 >= time.size()) break;
if ((millisecond > time.get(LinePtr)) && (millisecond < time.get(LinePtr + 1))) break;
}
if (LinePtr + offset < 0) return "";
if (LinePtr + offset >= time.size()) return "";
return list.get(time.get(LinePtr + offset));
}
private void showLyrics() {
if (bottomSheetLyricsFragment == null) {
bottomSheetLyricsFragment = new BottomSheetLyricsFragment();
bottomSheetLyricsFragment.setCallback(nowPlayingLyrics -> {
if (nowPlayingLyrics != null)
{
this.nowPlayingLyrics = nowPlayingLyrics;
nowPlayingLyrics.setInvisible();
this.nowPlayingLyrics.setClickEventListener(this);
//setLyrics();
AlbumArt albumArt = EventBus.getDefault().getStickyEvent(AlbumArt.class);
this.nowPlayingLyrics.setColors(albumArt.backgroundColor, albumArt.foregroundColor);
}
});
}
bottomSheetLyricsFragment.show(getSupportFragmentManager(), bottomSheetLyricsFragment.tag);
}
@Override
public void onSearchClicked() {
Song song = getCurrentSong();
String track = getRealString(song.getName());
String artist = getRealString(song.getArtist());
try {
String url = "https://www.google.com/search?q=" + track + URLEncoder.encode(" ", "UTF-8") + ".lrc";
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
try {
builder.setToolbarColor(ThemeUtils.getThemePrimaryColor(FullLyricsLayoutActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(FullLyricsLayoutActivity.this, Uri.parse(url));
} catch (Exception e) {
postToast(R.string.error_label, getApplicationContext(), TOAST_ERROR);
e.printStackTrace();
}
}
@Override
public void onDeleteClicked()
{
}
@Override
public void onSearchDatabaseClicked() {
bottomSheetLyricsFragment.dismiss();
Song song = getCurrentSong();
Intent intent = new Intent(FullLyricsLayoutActivity.this,ShowDatabaseActivity.class);
startActivity(intent);
}
@Override
public void onAddClicked() {
Song song = getCurrentSong();
openFileIntent("*/*", 2);
}
private void setLyrics(String lyricsText)
{
lastPosition = 0;
currentPosition = 0;
list = convertToTreeMap(lyricsText);
if(LyricslayoutScroll != null)
LyricslayoutScroll.removeAllViews();
if(list != null && !list.isEmpty())
{
createTextViewsScroll();
Set<Integer> keys = list.keySet();
int temp = getValueFromIndex(keys,0) + 1;
update(list,temp,false);
NoLyricslayout.setVisibility(View.GONE);
if(SwitchLyrics.isChecked())
{
Lyricslayout.setVisibility(View.GONE);
LyricslayoutScroll.setVisibility(View.VISIBLE);
}
else
{
Lyricslayout.setVisibility(View.VISIBLE);
LyricslayoutScroll.setVisibility(View.GONE);
}
Visualizer.setVisibility(View.GONE);
SwitchLyrics.setVisibility(View.VISIBLE);
}
else
{
NoLyricsText.setText("Loading Lyrics....");
Song cuurentSong = getCurrentSong();
loadLyricsFromDatabase(cuurentSong.getName());
//Visualizer Settings
Visualizer.setVisibility(View.VISIBLE);
Visualizer.setColor(foreGroundColor);
Visualizer.setDensity(70);
Visualizer.setMiddleLineColor(foreGroundColor);
NoLyricslayout.setVisibility(View.VISIBLE);
Lyricslayout.setVisibility(View.GONE);
LyricslayoutScroll.setVisibility(View.GONE);
SwitchLyrics.setVisibility(View.GONE);
}
}
private void openFileIntent(String MIME, int requestCode){
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(MIME);
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(intent, ""), requestCode);
}
private void loadLyricsFromDatabase(String Name)
{
final String songName = Name.toLowerCase();
DatabaseReference imagesQuery = FirebaseDatabase.getInstance().getReference().child("Song Details");
imagesQuery.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
int flag =0;
for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren())
{
HashMap<String, String> map = (HashMap<String, String>) dataSnapshot1.getValue();
String nameFromDatabase = map.get("Name");
nameFromDatabase = nameFromDatabase.toLowerCase();
if( nameFromDatabase.contains(songName) )
{
String lyrics = map.get("Lyrics");
list = convertToTreeMap(lyrics);
setLyrics(lyrics);
flag =1;
break;
}
}
if(flag == 0)
NoLyricsText.setText("No Lyrics Found");
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void promptUserToUpoloadLyrics()
{
int colorAccent = ThemeUtils.getThemeAccentColor(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
String titleText = "New Song Lyrics Added!!";
String messageText = "Do you want to Upload This Lyrics To Database?";
builder.setTitle(messageText);
Drawable d = getResources().getDrawable(R.drawable.ic_refresh_icon);
Drawable wrappedDrawable = DrawableCompat.wrap(d);
DrawableCompat.setTint(wrappedDrawable, colorAccent);
builder.setIcon(wrappedDrawable);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
uploadLyrics();
}
});
builder.setNegativeButton("No",null);
AlertDialog dialog = builder.create();
dialog.show();
Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
negativeButton.setTextColor(Color.WHITE);
negativeButton.setBackgroundColor(Color.TRANSPARENT);
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setTextColor(colorAccent);
positiveButton.setBackgroundColor(Color.TRANSPARENT);
}
private void uploadLyrics()
{
int colorAccent = ThemeUtils.getThemeAccentColor(this);
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setTitle("Uploading");
progressDialog.setMessage("Please Wait.....");
progressDialog.show();
FirebaseDatabase f = FirebaseDatabase.getInstance();
DatabaseReference d = f.getReference().child("Song Details");
ArrayList<Song> songs = QueryUtils.getAllSongs(getContentResolver(), HSMusicApplication.getInstance().getPreferenceUtils().getSongSortOrder());
HashMap<String,String> map = new HashMap<>();
for(Song s : songs)
{
String lyricsText = getLyricsFromCache(getApplicationContext(),s.getId());
map.put("Name",s.getName());
map.put("Artist",s.getArtist());
map.put("Duration",String.valueOf(s.getDuration()));
map.put("Lyrics",lyricsText);
if(!lyricsText.equals( "No lyrics"))
d.child(String.valueOf(s.getId())).setValue(map);
}
progressDialog.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Song Details Uploaded");
builder.setPositiveButton("ok",null);
AlertDialog dialog = builder.create();
dialog.show();
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setTextColor(colorAccent);
positiveButton.setBackgroundColor(Color.TRANSPARENT);
}
} | 36.28719 | 204 | 0.65228 |
d2d6a15ec47e43387c308a7c8525d22460d1a092 | 2,839 | package factorization.fzds.gui;
import factorization.fzds.Hammer;
import factorization.fzds.interfaces.IFzdsShenanigans;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import java.io.IOException;
public class ProxiedGuiContainer extends GuiContainer implements IFzdsShenanigans {
// Basically a copy of ProxiedGuiScreen.
// This is here for "NEI support" to prevent whiny NEI-dependent n00bs from whining and/or flipping their shit
final GuiContainer sub;
public ProxiedGuiContainer(Container container, GuiContainer sub) {
super(container);
this.sub = sub;
if (sub instanceof ProxiedGuiContainer) {
throw new IllegalArgumentException("Nesting has negative socio-economic impact! Not allowed!");
}
}
private boolean enter() {
if (!Hammer.proxy.isInShadowWorld()) {
Hammer.proxy.setShadowWorld();
return true;
}
return false;
}
private void exit(boolean do_it) {
if (do_it) {
Hammer.proxy.restoreRealWorld();
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float partial, int mouseX, int mouseY) {
// No-op; sub.drawScreen()'ll make this happen
}
public void initGui() {
boolean switched = enter();
try {
sub.initGui();
} finally {
exit(switched);
}
this.width = sub.width;
this.height = sub.height;
super.initGui();
}
@Override
public void setWorldAndResolution(Minecraft mc, int width, int height) {
super.setWorldAndResolution(mc, width, height);
boolean switched = enter();
try {
sub.setWorldAndResolution(mc, width, height);
} finally {
exit(switched);
}
}
public void drawScreen(int mouseX, int mouseY, float partial) {
boolean switched = enter();
try {
sub.drawScreen(mouseX, mouseY, partial);
} finally {
exit(switched);
}
}
@Override
public void handleInput() throws IOException {
boolean switched = enter();
try {
sub.handleInput();
} finally {
exit(switched);
}
}
public void onGuiClosed() {
boolean switched = enter();
try {
sub.onGuiClosed();
} finally {
exit(switched);
}
super.onGuiClosed();
}
public boolean doesGuiPauseGame() {
return sub.doesGuiPauseGame();
}
public void updateScreen() {
boolean switched = enter();
try {
sub.updateScreen();
} finally {
exit(switched);
}
}
}
| 25.348214 | 114 | 0.590701 |
aca52607dfe361ca5e91db02d565752387665c10 | 12,999 | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.chime.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* The Amazon Chime Voice Connector group configuration, including associated Amazon Chime Voice Connectors. You can
* include Amazon Chime Voice Connectors from different AWS Regions in your group. This creates a fault tolerant
* mechanism for fallback in case of availability events.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/chime-2018-05-01/VoiceConnectorGroup" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class VoiceConnectorGroup implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The Amazon Chime Voice Connector group ID.
* </p>
*/
private String voiceConnectorGroupId;
/**
* <p>
* The name of the Amazon Chime Voice Connector group.
* </p>
*/
private String name;
/**
* <p>
* The Amazon Chime Voice Connectors to which to route inbound calls.
* </p>
*/
private java.util.List<VoiceConnectorItem> voiceConnectorItems;
/**
* <p>
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
* </p>
*/
private java.util.Date createdTimestamp;
/**
* <p>
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
* </p>
*/
private java.util.Date updatedTimestamp;
/**
* <p>
* The Amazon Chime Voice Connector group ID.
* </p>
*
* @param voiceConnectorGroupId
* The Amazon Chime Voice Connector group ID.
*/
public void setVoiceConnectorGroupId(String voiceConnectorGroupId) {
this.voiceConnectorGroupId = voiceConnectorGroupId;
}
/**
* <p>
* The Amazon Chime Voice Connector group ID.
* </p>
*
* @return The Amazon Chime Voice Connector group ID.
*/
public String getVoiceConnectorGroupId() {
return this.voiceConnectorGroupId;
}
/**
* <p>
* The Amazon Chime Voice Connector group ID.
* </p>
*
* @param voiceConnectorGroupId
* The Amazon Chime Voice Connector group ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withVoiceConnectorGroupId(String voiceConnectorGroupId) {
setVoiceConnectorGroupId(voiceConnectorGroupId);
return this;
}
/**
* <p>
* The name of the Amazon Chime Voice Connector group.
* </p>
*
* @param name
* The name of the Amazon Chime Voice Connector group.
*/
public void setName(String name) {
this.name = name;
}
/**
* <p>
* The name of the Amazon Chime Voice Connector group.
* </p>
*
* @return The name of the Amazon Chime Voice Connector group.
*/
public String getName() {
return this.name;
}
/**
* <p>
* The name of the Amazon Chime Voice Connector group.
* </p>
*
* @param name
* The name of the Amazon Chime Voice Connector group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withName(String name) {
setName(name);
return this;
}
/**
* <p>
* The Amazon Chime Voice Connectors to which to route inbound calls.
* </p>
*
* @return The Amazon Chime Voice Connectors to which to route inbound calls.
*/
public java.util.List<VoiceConnectorItem> getVoiceConnectorItems() {
return voiceConnectorItems;
}
/**
* <p>
* The Amazon Chime Voice Connectors to which to route inbound calls.
* </p>
*
* @param voiceConnectorItems
* The Amazon Chime Voice Connectors to which to route inbound calls.
*/
public void setVoiceConnectorItems(java.util.Collection<VoiceConnectorItem> voiceConnectorItems) {
if (voiceConnectorItems == null) {
this.voiceConnectorItems = null;
return;
}
this.voiceConnectorItems = new java.util.ArrayList<VoiceConnectorItem>(voiceConnectorItems);
}
/**
* <p>
* The Amazon Chime Voice Connectors to which to route inbound calls.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setVoiceConnectorItems(java.util.Collection)} or {@link #withVoiceConnectorItems(java.util.Collection)}
* if you want to override the existing values.
* </p>
*
* @param voiceConnectorItems
* The Amazon Chime Voice Connectors to which to route inbound calls.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withVoiceConnectorItems(VoiceConnectorItem... voiceConnectorItems) {
if (this.voiceConnectorItems == null) {
setVoiceConnectorItems(new java.util.ArrayList<VoiceConnectorItem>(voiceConnectorItems.length));
}
for (VoiceConnectorItem ele : voiceConnectorItems) {
this.voiceConnectorItems.add(ele);
}
return this;
}
/**
* <p>
* The Amazon Chime Voice Connectors to which to route inbound calls.
* </p>
*
* @param voiceConnectorItems
* The Amazon Chime Voice Connectors to which to route inbound calls.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withVoiceConnectorItems(java.util.Collection<VoiceConnectorItem> voiceConnectorItems) {
setVoiceConnectorItems(voiceConnectorItems);
return this;
}
/**
* <p>
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
* </p>
*
* @param createdTimestamp
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
*/
public void setCreatedTimestamp(java.util.Date createdTimestamp) {
this.createdTimestamp = createdTimestamp;
}
/**
* <p>
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
* </p>
*
* @return The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
*/
public java.util.Date getCreatedTimestamp() {
return this.createdTimestamp;
}
/**
* <p>
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
* </p>
*
* @param createdTimestamp
* The Amazon Chime Voice Connector group creation timestamp, in ISO 8601 format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withCreatedTimestamp(java.util.Date createdTimestamp) {
setCreatedTimestamp(createdTimestamp);
return this;
}
/**
* <p>
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
* </p>
*
* @param updatedTimestamp
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
*/
public void setUpdatedTimestamp(java.util.Date updatedTimestamp) {
this.updatedTimestamp = updatedTimestamp;
}
/**
* <p>
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
* </p>
*
* @return The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
*/
public java.util.Date getUpdatedTimestamp() {
return this.updatedTimestamp;
}
/**
* <p>
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
* </p>
*
* @param updatedTimestamp
* The updated Amazon Chime Voice Connector group timestamp, in ISO 8601 format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VoiceConnectorGroup withUpdatedTimestamp(java.util.Date updatedTimestamp) {
setUpdatedTimestamp(updatedTimestamp);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getVoiceConnectorGroupId() != null)
sb.append("VoiceConnectorGroupId: ").append(getVoiceConnectorGroupId()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getVoiceConnectorItems() != null)
sb.append("VoiceConnectorItems: ").append(getVoiceConnectorItems()).append(",");
if (getCreatedTimestamp() != null)
sb.append("CreatedTimestamp: ").append(getCreatedTimestamp()).append(",");
if (getUpdatedTimestamp() != null)
sb.append("UpdatedTimestamp: ").append(getUpdatedTimestamp());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof VoiceConnectorGroup == false)
return false;
VoiceConnectorGroup other = (VoiceConnectorGroup) obj;
if (other.getVoiceConnectorGroupId() == null ^ this.getVoiceConnectorGroupId() == null)
return false;
if (other.getVoiceConnectorGroupId() != null && other.getVoiceConnectorGroupId().equals(this.getVoiceConnectorGroupId()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getVoiceConnectorItems() == null ^ this.getVoiceConnectorItems() == null)
return false;
if (other.getVoiceConnectorItems() != null && other.getVoiceConnectorItems().equals(this.getVoiceConnectorItems()) == false)
return false;
if (other.getCreatedTimestamp() == null ^ this.getCreatedTimestamp() == null)
return false;
if (other.getCreatedTimestamp() != null && other.getCreatedTimestamp().equals(this.getCreatedTimestamp()) == false)
return false;
if (other.getUpdatedTimestamp() == null ^ this.getUpdatedTimestamp() == null)
return false;
if (other.getUpdatedTimestamp() != null && other.getUpdatedTimestamp().equals(this.getUpdatedTimestamp()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getVoiceConnectorGroupId() == null) ? 0 : getVoiceConnectorGroupId().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getVoiceConnectorItems() == null) ? 0 : getVoiceConnectorItems().hashCode());
hashCode = prime * hashCode + ((getCreatedTimestamp() == null) ? 0 : getCreatedTimestamp().hashCode());
hashCode = prime * hashCode + ((getUpdatedTimestamp() == null) ? 0 : getUpdatedTimestamp().hashCode());
return hashCode;
}
@Override
public VoiceConnectorGroup clone() {
try {
return (VoiceConnectorGroup) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.chime.model.transform.VoiceConnectorGroupMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| 34.11811 | 138 | 0.640357 |
bc94db2f1098caebfa742c8dac66d5c6b02983d4 | 19,560 | /*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.psi.types;
import static com.jetbrains.python.psi.PyUtil.inSameFile;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.roots.FileIndexFacade;
import consulo.util.dataholder.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileSystemItem;
import com.intellij.psi.PsiInvalidElementAccessException;
import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.ResolveState;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.QualifiedName;
import com.intellij.util.Function;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.codeInsight.PyCustomMember;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.psi.AccessDirection;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.PyFromImportStatement;
import com.jetbrains.python.psi.PyImportElement;
import com.jetbrains.python.psi.PyImportStatement;
import com.jetbrains.python.psi.PyImportStatementBase;
import com.jetbrains.python.psi.PyStatement;
import com.jetbrains.python.psi.PyUtil;
import com.jetbrains.python.psi.impl.PyImportedModule;
import com.jetbrains.python.psi.impl.ResolveResultList;
import com.jetbrains.python.psi.resolve.CompletionVariantsProcessor;
import com.jetbrains.python.psi.resolve.ImportedResolveResult;
import com.jetbrains.python.psi.resolve.PointInImport;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.resolve.PyResolveUtil;
import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
import com.jetbrains.python.psi.resolve.RatedResolveResult;
import com.jetbrains.python.psi.resolve.ResolveImportUtil;
import com.jetbrains.python.sdk.PythonSdkType;
import consulo.ide.IconDescriptorUpdaters;
/**
* @author yole
*/
public class PyModuleType implements PyType // Modules don't descend from object
{
@Nonnull
private final PyFile myModule;
@Nullable
private final PyImportedModule myImportedModule;
public static final ImmutableSet<String> MODULE_MEMBERS = ImmutableSet.of("__name__", "__file__", "__path__", "__doc__", "__dict__", "__package__");
public PyModuleType(@Nonnull PyFile source)
{
this(source, null);
}
public PyModuleType(@Nonnull PyFile source, @Nullable PyImportedModule importedModule)
{
myModule = source;
myImportedModule = importedModule;
}
@Nonnull
public PyFile getModule()
{
return myModule;
}
@Nullable
@Override
public List<? extends RatedResolveResult> resolveMember(@Nonnull final String name, @Nullable PyExpression location, @Nonnull AccessDirection direction, @Nonnull PyResolveContext resolveContext)
{
final PsiElement overridingMember = resolveByOverridingMembersProviders(myModule, name);
if(overridingMember != null)
{
return ResolveResultList.to(overridingMember);
}
final List<RatedResolveResult> attributes = myModule.multiResolveName(name);
if(!attributes.isEmpty())
{
return attributes;
}
if(PyUtil.isPackage(myModule))
{
final List<PyImportElement> importElements = new ArrayList<>();
if(myImportedModule != null && (location == null || !inSameFile(location, myImportedModule)))
{
final PyImportElement importElement = myImportedModule.getImportElement();
if(importElement != null)
{
importElements.add(importElement);
}
}
else if(location != null)
{
final ScopeOwner owner = ScopeUtil.getScopeOwner(location);
if(owner != null)
{
importElements.addAll(getVisibleImports(owner));
}
if(!inSameFile(location, myModule))
{
importElements.addAll(myModule.getImportTargets());
}
final List<PyFromImportStatement> imports = myModule.getFromImports();
for(PyFromImportStatement anImport : imports)
{
Collections.addAll(importElements, anImport.getImportElements());
}
}
final List<? extends RatedResolveResult> implicitMembers = resolveImplicitPackageMember(name, importElements);
if(implicitMembers != null)
{
return implicitMembers;
}
}
final PsiElement member = resolveByMembersProviders(myModule, name);
if(member != null)
{
return ResolveResultList.to(member);
}
return null;
}
@Nullable
private static PsiElement resolveByMembersProviders(PyFile module, String name)
{
for(PyModuleMembersProvider provider : Extensions.getExtensions(PyModuleMembersProvider.EP_NAME))
{
if(!(provider instanceof PyOverridingModuleMembersProvider))
{
final PsiElement element = provider.resolveMember(module, name);
if(element != null)
{
return element;
}
}
}
return null;
}
@Nullable
private static PsiElement resolveByOverridingMembersProviders(@Nonnull PyFile module, @Nonnull String name)
{
for(PyModuleMembersProvider provider : Extensions.getExtensions(PyModuleMembersProvider.EP_NAME))
{
if(provider instanceof PyOverridingModuleMembersProvider)
{
final PsiElement element = provider.resolveMember(module, name);
if(element != null)
{
return element;
}
}
}
return null;
}
@Nullable
private List<? extends RatedResolveResult> resolveImplicitPackageMember(@Nonnull String name, @Nonnull List<PyImportElement> importElements)
{
final VirtualFile moduleFile = myModule.getVirtualFile();
if(moduleFile != null)
{
for(QualifiedName packageQName : QualifiedNameFinder.findImportableQNames(myModule, myModule.getVirtualFile()))
{
final QualifiedName resolvingQName = packageQName.append(name);
for(PyImportElement importElement : importElements)
{
for(QualifiedName qName : getImportedQNames(importElement))
{
if(qName.matchesPrefix(resolvingQName))
{
final PsiElement subModule = ResolveImportUtil.resolveChild(myModule, name, myModule, false, true);
if(subModule != null)
{
final ResolveResultList results = new ResolveResultList();
results.add(new ImportedResolveResult(subModule, RatedResolveResult.RATE_NORMAL, importElement));
return results;
}
}
}
}
}
}
return null;
}
@Nonnull
private static List<QualifiedName> getImportedQNames(@Nonnull PyImportElement element)
{
final List<QualifiedName> importedQNames = new ArrayList<>();
final PyStatement stmt = element.getContainingImportStatement();
if(stmt instanceof PyFromImportStatement)
{
final PyFromImportStatement fromImportStatement = (PyFromImportStatement) stmt;
final QualifiedName importedQName = fromImportStatement.getImportSourceQName();
final String visibleName = element.getVisibleName();
if(importedQName != null)
{
importedQNames.add(importedQName);
final QualifiedName implicitSubModuleQName = importedQName.append(visibleName);
if(implicitSubModuleQName != null)
{
importedQNames.add(implicitSubModuleQName);
}
}
else
{
final List<PsiElement> elements = ResolveImportUtil.resolveFromImportStatementSource(fromImportStatement, element.getImportedQName());
for(PsiElement psiElement : elements)
{
if(psiElement instanceof PsiFile)
{
final VirtualFile virtualFile = ((PsiFile) psiElement).getVirtualFile();
final QualifiedName qName = QualifiedNameFinder.findShortestImportableQName(element, virtualFile);
if(qName != null)
{
importedQNames.add(qName);
}
}
}
}
}
else if(stmt instanceof PyImportStatement)
{
final QualifiedName importedQName = element.getImportedQName();
if(importedQName != null)
{
importedQNames.add(importedQName);
}
}
if(!ResolveImportUtil.isAbsoluteImportEnabledFor(element))
{
PsiFile file = element.getContainingFile();
if(file != null)
{
file = file.getOriginalFile();
}
final QualifiedName absoluteQName = QualifiedNameFinder.findShortestImportableQName(file);
if(file != null && absoluteQName != null)
{
final QualifiedName prefixQName = PyUtil.isPackage(file) ? absoluteQName : absoluteQName.removeLastComponent();
if(prefixQName.getComponentCount() > 0)
{
final List<QualifiedName> results = new ArrayList<>();
results.addAll(importedQNames);
for(QualifiedName qName : importedQNames)
{
final List<String> components = new ArrayList<>();
components.addAll(prefixQName.getComponents());
components.addAll(qName.getComponents());
results.add(QualifiedName.fromComponents(components));
}
return results;
}
}
}
return importedQNames;
}
@Nonnull
public static List<PyImportElement> getVisibleImports(@Nonnull ScopeOwner owner)
{
final List<PyImportElement> visibleImports = new ArrayList<>();
PyResolveUtil.scopeCrawlUp(new PsiScopeProcessor()
{
@Override
public boolean execute(@Nonnull PsiElement element, @Nonnull ResolveState state)
{
if(element instanceof PyImportElement)
{
visibleImports.add((PyImportElement) element);
}
return true;
}
@Nullable
@Override
public <T> T getHint(@Nonnull Key<T> hintKey)
{
return null;
}
@Override
public void handleEvent(@Nonnull Event event, @Nullable Object associated)
{
}
}, owner, null, null);
return visibleImports;
}
/**
* @param directory the module directory
* @return a list of submodules of the specified module directory, either files or dirs, for easier naming; may contain file names
* not suitable for import.
*/
@Nonnull
private static List<PsiFileSystemItem> getSubmodulesList(final PsiDirectory directory, @Nullable PsiElement anchor)
{
List<PsiFileSystemItem> result = new ArrayList<>();
if(directory != null)
{ // just in case
// file modules
for(PsiFile f : directory.getFiles())
{
final String filename = f.getName();
// if we have a binary module, we'll most likely also have a stub for it in site-packages
if(!isExcluded(f) && (f instanceof PyFile && !filename.equals(PyNames.INIT_DOT_PY)) || isBinaryModule(filename))
{
result.add(f);
}
}
// dir modules
for(PsiDirectory dir : directory.getSubdirectories())
{
if(!isExcluded(dir) && PyUtil.isPackage(dir, anchor))
{
result.add(dir);
}
}
}
return result;
}
private static boolean isExcluded(@Nonnull PsiFileSystemItem file)
{
return FileIndexFacade.getInstance(file.getProject()).isExcludedFile(file.getVirtualFile());
}
private static boolean isBinaryModule(String filename)
{
final String ext = FileUtilRt.getExtension(filename);
if(SystemInfo.isWindows)
{
return "pyd".equalsIgnoreCase(ext);
}
else
{
return "so".equals(ext);
}
}
@Override
public Object[] getCompletionVariants(String completionPrefix, PsiElement location, ProcessingContext context)
{
List<LookupElement> result = getCompletionVariantsAsLookupElements(location, context, false, false);
return result.toArray();
}
public List<LookupElement> getCompletionVariantsAsLookupElements(PsiElement location, ProcessingContext context, boolean wantAllSubmodules, boolean suppressParentheses)
{
List<LookupElement> result = new ArrayList<>();
Set<String> namesAlready = context.get(CTX_NAMES);
PointInImport point = ResolveImportUtil.getPointInImport(location);
for(PyModuleMembersProvider provider : Extensions.getExtensions(PyModuleMembersProvider.EP_NAME))
{
for(PyCustomMember member : provider.getMembers(myModule, point))
{
final String name = member.getName();
if(namesAlready != null)
{
namesAlready.add(name);
}
if(PyUtil.isClassPrivateName(name))
{
continue;
}
final CompletionVariantsProcessor processor = createCompletionVariantsProcessor(location, suppressParentheses, point);
final PsiElement resolved = member.resolve(location);
if(resolved != null)
{
processor.execute(resolved, ResolveState.initial());
final List<LookupElement> lookupList = processor.getResultList();
if(!lookupList.isEmpty())
{
final LookupElement element = lookupList.get(0);
if(name.equals(element.getLookupString()))
{
result.add(element);
continue;
}
}
}
result.add(LookupElementBuilder.create(name).withIcon(member.getIcon()).withTypeText(member.getShortType()));
}
}
if(point == PointInImport.NONE || point == PointInImport.AS_NAME)
{ // when not imported from, add regular attributes
final CompletionVariantsProcessor processor = createCompletionVariantsProcessor(location, suppressParentheses, point);
myModule.processDeclarations(processor, ResolveState.initial(), null, location);
if(namesAlready != null)
{
for(LookupElement le : processor.getResultList())
{
String name = le.getLookupString();
if(!namesAlready.contains(name))
{
result.add(le);
namesAlready.add(name);
}
}
}
else
{
result.addAll(processor.getResultList());
}
}
if(PyUtil.isPackage(myModule))
{ // our module is a dir, not a single file
if(point == PointInImport.AS_MODULE || point == PointInImport.AS_NAME || wantAllSubmodules)
{ // when imported from somehow, add submodules
result.addAll(getSubModuleVariants(myModule.getContainingDirectory(), location, namesAlready));
}
else
{
result.addAll(collectImportedSubmodulesAsLookupElements(myModule, location, namesAlready));
}
}
return result;
}
@Nonnull
private static CompletionVariantsProcessor createCompletionVariantsProcessor(PsiElement location, boolean suppressParentheses, PointInImport point)
{
final CompletionVariantsProcessor processor = new CompletionVariantsProcessor(location, psiElement -> !(psiElement instanceof PyImportElement) || PsiTreeUtil.getParentOfType(psiElement,
PyImportStatementBase.class) instanceof PyFromImportStatement, null);
if(suppressParentheses)
{
processor.suppressParentheses();
}
processor.setPlainNamesOnly(point == PointInImport.AS_NAME); // no parens after imported function names
return processor;
}
@Nonnull
public static List<LookupElement> collectImportedSubmodulesAsLookupElements(@Nonnull PsiFileSystemItem pyPackage, @Nonnull PsiElement location, @Nullable final Set<String> existingNames)
{
final List<PsiElement> elements = collectImportedSubmodules(pyPackage, location);
return elements != null ? ContainerUtil.mapNotNull(elements, (Function<PsiElement, LookupElement>) element -> {
if(element instanceof PsiFileSystemItem)
{
return buildFileLookupElement((PsiFileSystemItem) element, existingNames);
}
else if(element instanceof PsiNamedElement)
{
return LookupElementBuilder.createWithIcon((PsiNamedElement) element);
}
return null;
}) : Collections.<LookupElement>emptyList();
}
@Nullable
public static List<PsiElement> collectImportedSubmodules(@Nonnull PsiFileSystemItem pyPackage, @Nonnull PsiElement location)
{
final PsiElement parentAnchor;
if(pyPackage instanceof PyFile && PyUtil.isPackage(((PyFile) pyPackage)))
{
parentAnchor = ((PyFile) pyPackage).getContainingDirectory();
}
else if(pyPackage instanceof PsiDirectory && PyUtil.isPackage(((PsiDirectory) pyPackage), location))
{
parentAnchor = pyPackage;
}
else
{
return null;
}
final ScopeOwner scopeOwner = ScopeUtil.getScopeOwner(location);
if(scopeOwner == null)
{
return Collections.emptyList();
}
final List<PsiElement> result = new ArrayList<>();
nextImportElement:
for(PyImportElement importElement : getVisibleImports(scopeOwner))
{
PsiElement resolvedChild = PyUtil.turnInitIntoDir(importElement.resolve());
if(resolvedChild == null || !PsiTreeUtil.isAncestor(parentAnchor, resolvedChild, true))
{
continue;
}
QualifiedName importedQName = importElement.getImportedQName();
// Looking for strict child of parentAncestor
while(resolvedChild != null && resolvedChild.getParent() != parentAnchor)
{
if(importedQName == null || importedQName.getComponentCount() <= 1)
{
continue nextImportElement;
}
importedQName = importedQName.removeTail(1);
resolvedChild = PyUtil.turnInitIntoDir(ResolveImportUtil.resolveImportElement(importElement, importedQName));
}
ContainerUtil.addIfNotNull(result, resolvedChild);
}
return result;
}
public static List<LookupElement> getSubModuleVariants(final PsiDirectory directory, PsiElement location, Set<String> namesAlready)
{
List<LookupElement> result = new ArrayList<>();
for(PsiFileSystemItem item : getSubmodulesList(directory, location))
{
if(item != location.getContainingFile().getOriginalFile())
{
LookupElement lookupElement = buildFileLookupElement(item, namesAlready);
if(lookupElement != null)
{
result.add(lookupElement);
}
}
}
return result;
}
@Nullable
public static LookupElementBuilder buildFileLookupElement(PsiFileSystemItem item, @Nullable Set<String> existingNames)
{
String s = FileUtil.getNameWithoutExtension(item.getName());
if(!PyNames.isIdentifier(s))
{
return null;
}
if(existingNames != null)
{
if(existingNames.contains(s))
{
return null;
}
else
{
existingNames.add(s);
}
}
return LookupElementBuilder.create(item, s).withTypeText(getPresentablePath((PsiDirectory) item.getParent())).withPresentableText(s).withIcon(IconDescriptorUpdaters.getIcon(item, 0));
}
private static String getPresentablePath(PsiDirectory directory)
{
if(directory == null)
{
return "";
}
final String path = directory.getVirtualFile().getPath();
if(path.contains(PythonSdkType.SKELETON_DIR_NAME))
{
return "<built-in>";
}
return FileUtil.toSystemDependentName(path);
}
@Override
public String getName()
{
return myModule.getName();
}
@Override
public boolean isBuiltin()
{
return true;
}
@Override
public void assertValid(String message)
{
if(!myModule.isValid())
{
throw new PsiInvalidElementAccessException(myModule, myModule.getClass().toString() + ": " + message);
}
}
@Nonnull
public static Set<String> getPossibleInstanceMembers()
{
return MODULE_MEMBERS;
}
}
| 31.548387 | 195 | 0.743149 |
a0c2e1976c2f26625c6288632f0c1404ad00855e | 4,436 | package es.uca.iw;
import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.HashSet;
import java.util.Objects;
import java.io.Serializable;
import java.util.Set;
@Entity
public class Vehiculo implements Serializable, Cloneable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@OneToMany(mappedBy = "vehiculo")
private Set<Reserva> reservaSet = new HashSet<>();
@NotNull(message = "Campos obligatorios")
@Min(value = 3, message = "El numero de puertas no puede ser menor que 3")
@Max(value = 5, message = "El numero de puertas no puede ser mayor que 5")
private Double puertas;
@NotNull(message = "Campos obligatorios")
@Min(value = 3, message = "El numero de plazas no puede ser menor que 3")
@Max(value = 7, message = "El numero de plazas no puede ser mayor que 7")
private Double plazas;
@NotNull(message = "Campos obligatorios")
@Enumerated(EnumType.STRING)
private VehiculoAC ac;
@NotNull(message = "Campos obligatorios")
@Min(value = 0, message = "El precio no puede ser negativo")
private Double precio;
@NotEmpty(message = "La matricula es obligatoria")
@Column(unique = true)
private String matricula = "";
@NotNull(message = "Campos obligatorios")
@Enumerated(EnumType.STRING)
private VehiculoMotor motor;
@ManyToOne
@NotNull(message = "Campos obligatorios")
private VehiculoMarca marca;
@ManyToOne
@NotNull(message = "Campos obligatorios")
private VehiculoModelo modelo;
@ManyToOne
@NotNull(message = "Campo obligatorio")
private VehiculoTipo tipo;
@NotNull(message = "Campo obligatorio")
@Enumerated(EnumType.STRING)
private VehiculoCiudad ciudad;
//Getters
public Long getId() {
return id;
}
public Set<Reserva> getReservas() {
return reservaSet;
}
public Double getPrecio() {
return precio;
}
public VehiculoMarca getMarca() {
return marca;
}
public VehiculoCiudad getCiudad() {
return ciudad;
}
public String getMatricula() {
return matricula;
}
public VehiculoModelo getModelo() {
return modelo;
}
public VehiculoTipo getTipo() {
return tipo;
}
public VehiculoAC getAc() {
return ac;
}
public Double getPuertas() {
return puertas;
}
public VehiculoMotor getMotor() {
return motor;
}
public Double getPlazas() {
return plazas;
}
//Setters
public void setId(Long Id) {
this.id = Id;
}
public void setReservas(Set<Reserva> Reservas) {
this.reservaSet = Reservas;
}
public void setCiudad(VehiculoCiudad ciudad) {
this.ciudad = ciudad;
}
public void setAc(VehiculoAC ac) {
this.ac = ac;
}
public void setMotor(VehiculoMotor motor) {
this.motor = motor;
}
public void setPlazas(Double plazas) {
this.plazas = plazas;
}
public void setPuertas(Double puertas) {
this.puertas = puertas;
}
public void setPrecio(Double Precio) {
this.precio = Precio;
}
public void setMarca(VehiculoMarca Marca) {
this.marca = Marca;
}
public void setMatricula(String Matricula) {
this.matricula = Matricula;
}
public void setModelo(VehiculoModelo Modelo) {
this.modelo = Modelo;
}
public void setTipo(VehiculoTipo tipo) {
this.tipo = tipo;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (this.id == null) {
return false;
}
if (obj instanceof Vehiculo && obj.getClass().equals(getClass())) {
return Objects.equals(this.id, ((Vehiculo) obj).id);
}
return false;
}
@Override
public int hashCode() {
int hash = 5;
hash = 43 * hash + (id == null ? 0 : id.hashCode());
return hash;
}
@Override
public Vehiculo clone() throws CloneNotSupportedException {
return (Vehiculo) super.clone();
}
@Override
public String toString() {
return marca.getMarca() + " " + tipo.getTipo();
}
} | 24.240437 | 78 | 0.624211 |
888c34dae9d4c0e630dab450b2fd53c1bbc3aa92 | 38,518 | /*
* ObfuscationModuleTest.java
* Copyright 2020 Rob Spoor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.robtimus.obfuscation.jackson.databind;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.file.Path;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException.Reference;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers.DateDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidDefinitionException;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.util.ClassUtil;
import com.github.robtimus.obfuscation.Obfuscated;
import com.github.robtimus.obfuscation.Obfuscator;
import com.github.robtimus.obfuscation.annotation.CharacterRepresentationProvider;
import com.github.robtimus.obfuscation.annotation.ObfuscateAll;
import com.github.robtimus.obfuscation.annotation.ObfuscateFixedLength;
import com.github.robtimus.obfuscation.annotation.ObfuscateFixedValue;
import com.github.robtimus.obfuscation.annotation.ObfuscateNone;
import com.github.robtimus.obfuscation.annotation.ObfuscatePortion;
import com.github.robtimus.obfuscation.annotation.RepresentedBy;
@SuppressWarnings("nls")
class ObfuscationModuleTest {
@Test
@DisplayName("serialize")
void testSerialize() throws IOException {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module)
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
TestClass original = new TestClass();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
assertThat(json, containsString("\"nullValue\":null"));
assertThat(json, containsString("\"fixedValue\":\"foo\""));
assertThat(json, containsString("\"dateValue\":\"2020-05-07T12:30:55.123+0000\""));
assertThat(json, containsString("\"intArray\":[1,2,3]"));
assertThat(json, containsString("\"nestedClass\":{\"intValue\":13}"));
assertThat(json, containsString("\"cws\":1"));
assertThat(json, containsString("\"annotated\":{}"));
assertThat(json, containsString("\"stringValue\":\"foo\""));
assertThat(json, containsString("\"intValue\":1"));
assertThat(json, containsString("\"obfuscatedList\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"upperCaseObfuscatedList\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"annotatedList\":[{}]"));
assertThat(json, containsString("\"stringList\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"intList\":[1,2]"));
assertThat(json, containsString("\"obfuscatedSet\":[\"foo\"]"));
assertThat(json, containsString("\"upperCaseObfuscatedSet\":[\"foo\"]"));
assertThat(json, containsString("\"annotatedSet\":[{}]"));
assertThat(json, containsString("\"stringSet\":[\"foo\"]"));
assertThat(json, containsString("\"intSet\":[1]"));
assertThat(json, containsString("\"obfuscatedCollection\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"upperCaseObfuscatedCollection\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"annotatedCollection\":[{}]"));
assertThat(json, containsString("\"stringCollection\":[\"foo\",\"bar\"]"));
assertThat(json, containsString("\"intCollection\":[1,2]"));
assertThat(json, containsString("\"obfuscatedMap\":{\"1\":2}"));
assertThat(json, containsString("\"negateValueObfuscatedMap\":{\"1\":2}"));
assertThat(json, containsString("\"annotatedMap\":{\"foo\":{}}"));
assertThat(json, containsString("\"stringMap\":{\"foo\":\"bar\"}"));
assertThat(json, containsString("\"intMap\":{\"1\":2}"));
assertThat(json, containsString("\"obfuscatedDateList\":[1588854655123]"));
}
@Nested
@DisplayName("deserialize")
class Deserialize {
@Test
@DisplayName("with default module")
void testWithDefaultModule() throws IOException {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
TestClass original = new TestClass();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
TestClass deserialized = mapper.readValue(json, TestClass.class);
assertEquals(original.fixedValue, deserialized.fixedValue);
assertEquals(original.dateValue, deserialized.dateValue);
assertNotNull(deserialized.intArray);
assertArrayEquals(original.intArray.value(), deserialized.intArray.value());
assertNotNull(deserialized.nestedClass);
assertEquals(original.nestedClass.value().intValue, deserialized.nestedClass.value().intValue);
assertNotNull(deserialized.classWithSerializer);
assertEquals(original.classWithSerializer.value().intValue, deserialized.classWithSerializer.value().intValue);
assertEquals(original.annotated, deserialized.annotated);
assertEquals(original.stringValue, deserialized.stringValue);
assertEquals(original.intValue, deserialized.intValue);
assertEquals(original.obfuscatedList, deserialized.obfuscatedList);
assertEquals(original.upperCaseObfuscatedList, deserialized.upperCaseObfuscatedList);
assertEquals(original.annotatedList, deserialized.annotatedList);
assertEquals(original.stringList, deserialized.stringList);
assertEquals(original.intList, deserialized.intList);
assertEquals(original.obfuscatedSet, deserialized.obfuscatedSet);
assertEquals(original.upperCaseObfuscatedSet, deserialized.upperCaseObfuscatedSet);
assertEquals(original.annotatedSet, deserialized.annotatedSet);
assertEquals(original.stringSet, deserialized.stringSet);
assertEquals(original.intSet, deserialized.intSet);
assertEquals(original.obfuscatedCollection, deserialized.obfuscatedCollection);
assertEquals(original.upperCaseObfuscatedCollection, deserialized.upperCaseObfuscatedCollection);
assertEquals(original.annotatedCollection, deserialized.annotatedCollection);
assertEquals(original.stringCollection, deserialized.stringCollection);
assertEquals(original.intCollection, deserialized.intCollection);
assertEquals(original.obfuscatedMap, deserialized.obfuscatedMap);
assertEquals(original.negateValueObfuscatedMap, deserialized.negateValueObfuscatedMap);
assertEquals(original.annotatedMap, deserialized.annotatedMap);
assertEquals(original.stringMap, deserialized.stringMap);
assertEquals(original.intMap, deserialized.intMap);
assertEquals(toLocalDates(original.obfuscatedDateList), toLocalDates(deserialized.obfuscatedDateList));
assertEquals("<string>", deserialized.fixedValue.toString());
assertEquals("***", deserialized.dateValue.toString());
assertEquals("[***]", deserialized.intArray.toString());
assertEquals("<<13>>", deserialized.nestedClass.toString());
assertEquals("********", deserialized.classWithSerializer.toString());
assertEquals("an**ed", deserialized.annotated.toString());
assertEquals("***", deserialized.stringValue.toString());
assertEquals("***", deserialized.intValue.toString());
assertEquals("[********, ********]", deserialized.obfuscatedList.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedList.toString());
assertEquals("[an**ed]", deserialized.annotatedList.toString());
assertEquals("[foo, bar]", deserialized.stringList.toString());
assertEquals("[1, 2]", deserialized.intList.toString());
assertEquals("[********]", deserialized.obfuscatedSet.toString());
assertEquals("[F***O]", deserialized.upperCaseObfuscatedSet.toString());
assertEquals("[an**ed]", deserialized.annotatedSet.toString());
assertEquals("[foo]", deserialized.stringSet.toString());
assertEquals("[1]", deserialized.intSet.toString());
assertEquals("[*****, *****]", deserialized.obfuscatedCollection.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedCollection.toString());
assertEquals("[an**ed]", deserialized.annotatedCollection.toString());
assertEquals("[foo, bar]", deserialized.stringCollection.toString());
assertEquals("[1, 2]", deserialized.intCollection.toString());
assertEquals("{1=******}", deserialized.obfuscatedMap.toString());
assertEquals("{1=-***2}", deserialized.negateValueObfuscatedMap.toString());
assertEquals("{foo=an**ed}", deserialized.annotatedMap.toString());
assertEquals("{foo=bar}", deserialized.stringMap.toString());
assertEquals("{1=2}", deserialized.intMap.toString());
assertEquals("[2020-05-**]", deserialized.obfuscatedDateList.toString());
}
@Nested
@DisplayName("with custom module")
class WithCustomModule {
@Test
@DisplayName("with custom default obfuscator")
void testWithCustomDefaultObfuscator() throws IOException {
Module module = ObfuscationModule.builder()
.withDefaultObfuscator(Obfuscator.fixedValue("<default>"))
.withDefaultObfuscator(Number.class, Obfuscator.portion().keepAtStart(2).keepAtEnd(2).withFixedTotalLength(6).build())
.withDefaultCharacterRepresentation(Number.class, s -> "<number>")
.withDefaultObfuscator(CharSequence.class, Obfuscator.portion().keepAtStart(2).keepAtEnd(2).withFixedTotalLength(6).build())
.withDefaultCharacterRepresentation(CharSequence.class, s -> "<charSequence>")
// not used, just to show that the maps are not overwritten
.withDefaultObfuscator(File.class, Obfuscator.none())
.withDefaultCharacterRepresentation(File.class, s -> "file")
.withDefaultObfuscator(Path.class, Obfuscator.none())
.withDefaultCharacterRepresentation(Path.class, s -> "path")
.build();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
TestClass original = new TestClass();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
TestClass deserialized = mapper.readValue(json, TestClass.class);
assertEquals(original.fixedValue, deserialized.fixedValue);
assertEquals(original.dateValue, deserialized.dateValue);
assertNotNull(deserialized.intArray);
assertArrayEquals(original.intArray.value(), deserialized.intArray.value());
assertNotNull(deserialized.nestedClass);
assertEquals(original.nestedClass.value().intValue, deserialized.nestedClass.value().intValue);
assertNotNull(deserialized.classWithSerializer);
assertEquals(original.classWithSerializer.value().intValue, deserialized.classWithSerializer.value().intValue);
assertEquals(original.annotated, deserialized.annotated);
assertEquals(original.stringValue, deserialized.stringValue);
assertEquals(original.intValue, deserialized.intValue);
assertEquals(original.obfuscatedList, deserialized.obfuscatedList);
assertEquals(original.upperCaseObfuscatedList, deserialized.upperCaseObfuscatedList);
assertEquals(original.annotatedList, deserialized.annotatedList);
assertEquals(original.stringList, deserialized.stringList);
assertEquals(original.intList, deserialized.intList);
assertEquals(original.obfuscatedSet, deserialized.obfuscatedSet);
assertEquals(original.upperCaseObfuscatedSet, deserialized.upperCaseObfuscatedSet);
assertEquals(original.annotatedSet, deserialized.annotatedSet);
assertEquals(original.stringSet, deserialized.stringSet);
assertEquals(original.intSet, deserialized.intSet);
assertEquals(original.obfuscatedCollection, deserialized.obfuscatedCollection);
assertEquals(original.upperCaseObfuscatedCollection, deserialized.upperCaseObfuscatedCollection);
assertEquals(original.annotatedCollection, deserialized.annotatedCollection);
assertEquals(original.stringCollection, deserialized.stringCollection);
assertEquals(original.intCollection, deserialized.intCollection);
assertEquals(original.obfuscatedMap, deserialized.obfuscatedMap);
assertEquals(original.negateValueObfuscatedMap, deserialized.negateValueObfuscatedMap);
assertEquals(original.annotatedMap, deserialized.annotatedMap);
assertEquals(original.stringMap, deserialized.stringMap);
assertEquals(original.intMap, deserialized.intMap);
assertEquals(toLocalDates(original.obfuscatedDateList), toLocalDates(deserialized.obfuscatedDateList));
assertEquals("<string>", deserialized.fixedValue.toString());
assertEquals("<default>", deserialized.dateValue.toString());
assertEquals("[***]", deserialized.intArray.toString());
assertEquals("<<13>>", deserialized.nestedClass.toString());
assertEquals("********", deserialized.classWithSerializer.toString());
assertEquals("an**ed", deserialized.annotated.toString());
assertEquals("<c**e>", deserialized.stringValue.toString());
assertEquals("<n**r>", deserialized.intValue.toString());
assertEquals("[********, ********]", deserialized.obfuscatedList.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedList.toString());
assertEquals("[an**ed]", deserialized.annotatedList.toString());
assertEquals("[<c**e>, <c**e>]", deserialized.stringList.toString());
assertEquals("[<n**r>, <n**r>]", deserialized.intList.toString());
assertEquals("[********]", deserialized.obfuscatedSet.toString());
assertEquals("[F***O]", deserialized.upperCaseObfuscatedSet.toString());
assertEquals("[an**ed]", deserialized.annotatedSet.toString());
assertEquals("[<c**e>]", deserialized.stringSet.toString());
assertEquals("[<n**r>]", deserialized.intSet.toString());
assertEquals("[*****, *****]", deserialized.obfuscatedCollection.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedCollection.toString());
assertEquals("[an**ed]", deserialized.annotatedCollection.toString());
assertEquals("[<c**e>, <c**e>]", deserialized.stringCollection.toString());
assertEquals("[<n**r>, <n**r>]", deserialized.intCollection.toString());
assertEquals("{1=******}", deserialized.obfuscatedMap.toString());
assertEquals("{1=-***2}", deserialized.negateValueObfuscatedMap.toString());
assertEquals("{foo=an**ed}", deserialized.annotatedMap.toString());
assertEquals("{foo=<c**e>}", deserialized.stringMap.toString());
assertEquals("{1=<n**r>}", deserialized.intMap.toString());
assertEquals("[2020-05-**]", deserialized.obfuscatedDateList.toString());
}
@Test
@DisplayName("without access modifier fix")
void testWithoutAccessModifierFix() {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module)
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS);
int originalInstantiationCount = CustomCharacterRepresentationProvider.getInstantiationCount();
TestClass original = new TestClass();
StringWriter writer = new StringWriter();
assertDoesNotThrow(() -> mapper.writeValue(writer, original));
String json = writer.toString();
IllegalStateException exception = assertThrows(IllegalStateException.class, () -> mapper.readValue(json, TestClass.class));
assertThat(exception.getCause(), instanceOf(IllegalArgumentException.class));
assertEquals(getExpectedErrorMessage(UpperCase.class), exception.getCause().getMessage());
assertEquals(originalInstantiationCount + 1, CustomCharacterRepresentationProvider.getInstantiationCount());
}
private String getExpectedErrorMessage(Class<?> cls) {
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> ClassUtil.createInstance(cls, false));
return exception.getMessage();
}
@Test
@DisplayName("requiring annotated obfuscator")
void testRequiringAnnotatedObfuscator() throws IOException {
Module module = ObfuscationModule.builder()
.withDefaultObfuscator(Obfuscator.fixedValue("<default>"))
.withDefaultObfuscator(Number.class, Obfuscator.portion().keepAtStart(2).keepAtEnd(2).withFixedTotalLength(6).build())
.withDefaultCharacterRepresentation(Number.class, s -> "<number>")
.withDefaultObfuscator(CharSequence.class, Obfuscator.portion().keepAtStart(2).keepAtEnd(2).withFixedTotalLength(6).build())
.withDefaultCharacterRepresentation(CharSequence.class, s -> "<charSequence>")
// not used, just to show that the maps are not overwritten
.withDefaultObfuscator(File.class, Obfuscator.none())
.withDefaultCharacterRepresentation(File.class, s -> "file")
.withDefaultObfuscator(Path.class, Obfuscator.none())
.withDefaultCharacterRepresentation(Path.class, s -> "path")
.requireObfuscatorAnnotation(true)
.build();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
TestClass original = new TestClass();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
TestClass deserialized = mapper.readValue(json, TestClass.class);
assertEquals(original.fixedValue, deserialized.fixedValue);
assertEquals(original.dateValue, deserialized.dateValue);
assertNotNull(deserialized.intArray);
assertArrayEquals(original.intArray.value(), deserialized.intArray.value());
assertNotNull(deserialized.nestedClass);
assertEquals(original.nestedClass.value().intValue, deserialized.nestedClass.value().intValue);
assertNotNull(deserialized.classWithSerializer);
assertEquals(original.classWithSerializer.value().intValue, deserialized.classWithSerializer.value().intValue);
assertEquals(original.annotated, deserialized.annotated);
assertEquals(original.stringValue, deserialized.stringValue);
assertEquals(original.intValue, deserialized.intValue);
assertEquals(original.obfuscatedList, deserialized.obfuscatedList);
assertEquals(original.upperCaseObfuscatedList, deserialized.upperCaseObfuscatedList);
assertEquals(original.annotatedList, deserialized.annotatedList);
assertEquals(original.stringList, deserialized.stringList);
assertEquals(original.intList, deserialized.intList);
assertEquals(original.obfuscatedSet, deserialized.obfuscatedSet);
assertEquals(original.upperCaseObfuscatedSet, deserialized.upperCaseObfuscatedSet);
assertEquals(original.annotatedSet, deserialized.annotatedSet);
assertEquals(original.stringSet, deserialized.stringSet);
assertEquals(original.intSet, deserialized.intSet);
assertEquals(original.obfuscatedCollection, deserialized.obfuscatedCollection);
assertEquals(original.upperCaseObfuscatedCollection, deserialized.upperCaseObfuscatedCollection);
assertEquals(original.annotatedCollection, deserialized.annotatedCollection);
assertEquals(original.stringCollection, deserialized.stringCollection);
assertEquals(original.intCollection, deserialized.intCollection);
assertEquals(original.obfuscatedMap, deserialized.obfuscatedMap);
assertEquals(original.negateValueObfuscatedMap, deserialized.negateValueObfuscatedMap);
assertEquals(original.annotatedMap, deserialized.annotatedMap);
assertEquals(original.stringMap, deserialized.stringMap);
assertEquals(original.intMap, deserialized.intMap);
assertEquals(toLocalDates(original.obfuscatedDateList), toLocalDates(deserialized.obfuscatedDateList));
assertEquals("<string>", deserialized.fixedValue.toString());
assertEquals("<default>", deserialized.dateValue.toString());
assertEquals("[***]", deserialized.intArray.toString());
assertEquals("<<13>>", deserialized.nestedClass.toString());
assertEquals("********", deserialized.classWithSerializer.toString());
assertEquals("an**ed", deserialized.annotated.toString());
assertEquals("<c**e>", deserialized.stringValue.toString());
assertEquals("<n**r>", deserialized.intValue.toString());
assertEquals("[********, ********]", deserialized.obfuscatedList.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedList.toString());
assertEquals("[" + deserialized.annotatedList.iterator().next() + "]", deserialized.annotatedList.toString());
assertEquals("[foo, bar]", deserialized.stringList.toString());
assertEquals("[1, 2]", deserialized.intList.toString());
assertEquals("[********]", deserialized.obfuscatedSet.toString());
assertEquals("[F***O]", deserialized.upperCaseObfuscatedSet.toString());
assertEquals("[" + deserialized.annotatedSet.iterator().next() + "]", deserialized.annotatedSet.toString());
assertEquals("[foo]", deserialized.stringSet.toString());
assertEquals("[1]", deserialized.intSet.toString());
assertEquals("[*****, *****]", deserialized.obfuscatedCollection.toString());
assertEquals("[F***O, B***R]", deserialized.upperCaseObfuscatedCollection.toString());
assertEquals("[" + deserialized.annotatedCollection.iterator().next() + "]", deserialized.annotatedCollection.toString());
assertEquals("[foo, bar]", deserialized.stringCollection.toString());
assertEquals("[1, 2]", deserialized.intCollection.toString());
assertEquals("{1=******}", deserialized.obfuscatedMap.toString());
assertEquals("{1=-***2}", deserialized.negateValueObfuscatedMap.toString());
assertEquals("{foo=" + deserialized.annotatedMap.get("foo") + "}", deserialized.annotatedMap.toString());
assertEquals("{foo=bar}", deserialized.stringMap.toString());
assertEquals("{1=2}", deserialized.intMap.toString());
assertEquals("[2020-05-**]", deserialized.obfuscatedDateList.toString());
}
}
@Test
@DisplayName("with non-deserializable type")
void testWithNonDeserializableType() throws IOException {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
WithNonDeserializableType original = new WithNonDeserializableType();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
InvalidDefinitionException exception = assertThrows(InvalidDefinitionException.class,
() -> mapper.readValue(json, WithNonDeserializableType.class));
// the exception should refer to the generic type, not Obfuscated
assertEquals(mapper.getTypeFactory().constructType(Runnable.class), exception.getType());
List<Reference> path = exception.getPath();
assertThat(path, hasSize(1));
Reference reference = path.get(0);
assertEquals(WithNonDeserializableType.class.getName() + "[\"value\"]", reference.getDescription());
assertEquals("value", reference.getFieldName());
}
private List<LocalDate> toLocalDates(List<Date> dates) {
return dates.stream()
.map(this::toLocalDate)
.collect(toList());
}
private LocalDate toLocalDate(Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
}
@Nested
@DisplayName("using constructor")
class UsingConstructorTest {
@Test
@DisplayName("serialize")
void testSerialize() throws IOException {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
Obfuscated<String> value = Obfuscator.fixedLength(8).obfuscateObject("foobar");
List<String> list = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
UsingConstructor original = new UsingConstructor(value, list);
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
assertThat(json, containsString("\"value\":\"foobar\""));
}
@Test
@DisplayName("deserialize")
void testDeserialize() throws IOException {
Module module = ObfuscationModule.defaultModule();
ObjectMapper mapper = new ObjectMapper()
.registerModule(module);
Obfuscated<String> value = Obfuscator.fixedLength(8).obfuscateObject("foobar");
List<String> list = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
UsingConstructor original = new UsingConstructor(value, list);
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
String json = writer.toString();
UsingConstructor deserialized = mapper.readValue(json, UsingConstructor.class);
assertEquals(original.value, deserialized.value);
assertEquals("********", deserialized.value.toString());
}
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public static final class TestClass {
@ObfuscateFixedValue("<null>")
public Obfuscated<String> nullValue = null;
@ObfuscateFixedValue("<string>")
public Obfuscated<String> fixedValue = Obfuscator.all().obfuscateObject("foo");
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
@JsonSerialize(using = DateSerializer.class)
@JsonDeserialize(using = DateDeserializer.class)
public Obfuscated<Date> dateValue = Obfuscator.all().obfuscateObject(calculateDate());
@ObfuscatePortion(keepAtStart = 1, keepAtEnd = 1, fixedTotalLength = 5)
public Obfuscated<int[]> intArray = Obfuscator.all().obfuscateObject(new int[] { 1, 2, 3 });
@ObfuscateNone
@RepresentedBy(CustomCharacterRepresentationProvider.class)
public Obfuscated<NestedClass> nestedClass = Obfuscator.all().obfuscateObject(new NestedClass());
@ObfuscateFixedLength(8)
@RepresentedBy(CustomCharacterRepresentationProvider.class)
@JsonProperty("cws")
public Obfuscated<ClassWithSerializer> classWithSerializer = Obfuscator.all().obfuscateObject(new ClassWithSerializer(1));
public Obfuscated<Annotated> annotated = Obfuscator.all().obfuscateObject(new Annotated());
public Obfuscated<String> stringValue = Obfuscator.all().obfuscateObject("foo");
public Obfuscated<Integer> intValue = Obfuscator.all().obfuscateObject(1);
@ObfuscateFixedLength(8)
public List<String> obfuscatedList = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
@ObfuscatePortion(keepAtStart = 1, keepAtEnd = 1, fixedTotalLength = 5)
@RepresentedBy(UpperCase.class)
public List<String> upperCaseObfuscatedList = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
public List<Annotated> annotatedList = Obfuscator.all().obfuscateList(Arrays.asList(new Annotated()));
public List<String> stringList = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
public List<Integer> intList = Obfuscator.all().obfuscateList(Arrays.asList(1, 2));
@ObfuscateFixedLength(8)
public Set<String> obfuscatedSet = Obfuscator.all().obfuscateSet(Collections.singleton("foo"));
@ObfuscatePortion(keepAtStart = 1, keepAtEnd = 1, fixedTotalLength = 5)
@RepresentedBy(UpperCase.class)
public Set<String> upperCaseObfuscatedSet = Obfuscator.all().obfuscateSet(Collections.singleton("foo"));
public Set<Annotated> annotatedSet = Obfuscator.all().obfuscateSet(Collections.singleton(new Annotated()));
public Set<String> stringSet = Obfuscator.all().obfuscateSet(Collections.singleton("foo"));
public Set<Integer> intSet = Obfuscator.all().obfuscateSet(Collections.singleton(1));
@ObfuscateFixedLength(5)
public Collection<String> obfuscatedCollection = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
@ObfuscatePortion(keepAtStart = 1, keepAtEnd = 1, fixedTotalLength = 5)
@RepresentedBy(UpperCase.class)
public Collection<String> upperCaseObfuscatedCollection = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
public Collection<Annotated> annotatedCollection = Obfuscator.all().obfuscateCollection(Arrays.asList(new Annotated()));
public Collection<Integer> intCollection = Obfuscator.all().obfuscateCollection(Arrays.asList(1, 2));
public Collection<String> stringCollection = Obfuscator.all().obfuscateList(Arrays.asList("foo", "bar"));
@ObfuscateFixedLength(6)
public Map<Integer, Integer> obfuscatedMap = Obfuscator.all().obfuscateMap(Collections.singletonMap(1, 2));
@ObfuscatePortion(keepAtStart = 1, keepAtEnd = 1, fixedTotalLength = 5)
@RepresentedBy(NegateValueToString.class)
public Map<Integer, Integer> negateValueObfuscatedMap = Obfuscator.all().obfuscateMap(Collections.singletonMap(1, 2));
public Map<String, Annotated> annotatedMap = Obfuscator.all().obfuscateMap(Collections.singletonMap("foo", new Annotated()));
public Map<String, String> stringMap = Obfuscator.all().obfuscateMap(Collections.singletonMap("foo", "bar"));
public Map<Integer, Integer> intMap = Obfuscator.all().obfuscateMap(Collections.singletonMap(1, 2));
@ObfuscatePortion(keepAtStart = 8)
@RepresentedBy(DateFormat.class)
public List<Date> obfuscatedDateList = Obfuscator.all().obfuscateList(Arrays.asList(calculateDate()));
private Date calculateDate() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2020);
calendar.set(Calendar.MONTH, Calendar.MAY);
calendar.set(Calendar.DAY_OF_MONTH, 7);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 30);
calendar.set(Calendar.SECOND, 55);
calendar.set(Calendar.MILLISECOND, 123);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
return calendar.getTime();
}
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public static final class NestedClass {
public int intValue = 13;
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@ObfuscatePortion(keepAtStart = 2, keepAtEnd = 2, fixedTotalLength = 6)
@RepresentedBy(AnnotatedRepresentation.class)
public static final class Annotated {
// no content necessary
@Override
public boolean equals(Object obj) {
return obj instanceof Annotated;
}
@Override
public int hashCode() {
return Annotated.class.hashCode();
}
}
public static final class AnnotatedRepresentation implements CharacterRepresentationProvider {
@Override
public CharSequence toCharSequence(Object value) {
return "annotated";
}
}
@JsonSerialize(using = CustomSerializer.class)
@JsonDeserialize(using = CustomDeserializer.class)
public static final class ClassWithSerializer {
private final int intValue;
private ClassWithSerializer(int intValue) {
this.intValue = intValue;
}
@Override
public String toString() {
return "{{" + intValue + "}}";
}
}
public static final class UsingConstructor {
private final Obfuscated<String> value;
private final List<String> list;
@JsonCreator
UsingConstructor(
@JsonProperty("value") @ObfuscateFixedLength(8) Obfuscated<String> value,
@JsonProperty("list") @ObfuscateAll List<String> list) {
this.value = value;
this.list = list;
}
public Obfuscated<String> getValue() {
return value;
}
public List<String> getList() {
return list;
}
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public static final class WithNonDeserializableType {
public final Obfuscated<Runnable> value = Obfuscator.all().obfuscateObject(() -> { /* do nothing */ });
}
public static final class CustomSerializer extends JsonSerializer<ClassWithSerializer> {
@Override
public void serialize(ClassWithSerializer value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeNumber(value.intValue);
}
}
public static final class CustomDeserializer extends JsonDeserializer<ClassWithSerializer> {
@Override
public ClassWithSerializer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
int intValue = p.getValueAsInt();
return new ClassWithSerializer(intValue);
}
}
}
| 53.946779 | 148 | 0.665793 |
3da8a2831a33719aa6f907c8b7524c3ff9790c81 | 1,756 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ru.specialist.IntConverter02;
/**
*
* @author pandrey
*/
public class App {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println(getBinaryByString(65004300));
System.out.println(getBinaryByStringBuilderInsert(65004300));
System.out.println(getBinaryByStringBuilderAppend(65004300));
}
public static String getBinaryByString (int num){
String str = new String();
for (int i = 0; i < 32; i++){
if ( num%2 != 0 ) str = "1" + str; else str = "0" + str;
if (i == 7 || i == 15 || i == 23) str = " " + str;
num = num>>1;
}
return str;
}
public static StringBuilder getBinaryByStringBuilderInsert (int num){
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 32; i++){
if ( num%2 != 0 ) sb.insert(0, "1"); else sb.insert (0, "0");
if (i == 7 || i == 15 || i == 23) sb.insert(0," ");
num = num>>1;
}
return sb;
}
public static StringBuilder getBinaryByStringBuilderAppend (int num){
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 32; i++){
if ( num%2 != 0 ) sb.append("1"); else sb.append ("0");
if (i == 7 || i == 15 || i == 23) sb.append(" ");
num = num>>1;
}
sb = sb.reverse();
return sb;
}
} | 29.266667 | 79 | 0.518223 |
2ff6d6f2f41c206a03341a99b863d2121821683a | 1,088 | package com.orangebank.boot.salesforce.filter;
import com.masmovil.it.ticket.service.TokenSalesForceService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.annotation.Filter;
import io.micronaut.http.filter.ClientFilterChain;
import io.micronaut.http.filter.HttpClientFilter;
import org.reactivestreams.Publisher;
@Filter("/${salesforce.api-version}/**")
public class SalesForceAuthFilter implements HttpClientFilter {
protected final TokenSalesForceService tokenSalesForceService;
public SalesForceAuthFilter(TokenSalesForceService tokenSalesForceService) {
this.tokenSalesForceService = tokenSalesForceService;
}
/**
* @param targetRequest The target request.
* @param chain The filter chain.
* @return The publisher of the response.
*/
@Override
public Publisher<? extends HttpResponse<?>> doFilter(
MutableHttpRequest<?> targetRequest, ClientFilterChain chain) {
targetRequest.bearerAuth(tokenSalesForceService.getToken());
return chain.proceed(targetRequest);
}
} | 34 | 78 | 0.788603 |
701c79147f59327a4e9284a41fc520ba5090d100 | 11,583 | package cn.wwl.radio.executor;
import cn.wwl.radio.console.ConsoleManager;
import cn.wwl.radio.executor.functions.*;
import cn.wwl.radio.file.ConfigLoader;
import cn.wwl.radio.file.ConfigObject;
import cn.wwl.radio.file.RadioFileManager;
import cn.wwl.radio.network.SocketTransfer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class FunctionExecutor {
private static final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
private static boolean isStartTickThread = false;
private static final Map<String, ConfigObject.ModuleObject> modules = new HashMap<>();
private static final Map<String, ConsoleFunction> functions = new HashMap<>();
private static final Map<String, ConsoleFunction> messageHookMap = new HashMap<>();
private static boolean isRegistered = false;
public static final String HOOK_HEAD = "HookExecute";
public static void executeFunction(String cmd) {
String prefix = ConfigLoader.getConfigObject().getPrefix();
if (cmd.startsWith("Unknown")) {
if (!cmd.contains(prefix)) {
return;
}
} else if (cmd.contains(ConfigLoader.getConfigObject().getPrefix()) || cmd.contains(HOOK_HEAD)) {
if (cmd.startsWith(HOOK_HEAD)) {
cmd = cmd.replace(ConfigLoader.getConfigObject().getPrefix() + "_", "");
} else {
String command = cmd.substring(prefix.length() + 1);
System.out.println("Internal Execution: " + command);
cmd = command;
}
} else {
return;
}
String func;
try {
func = removeUnknownCommandTag(cmd);
} catch (Exception e) {
func = cmd;
}
if (!modules.containsKey(func)) {
if (func.contains(prefix)) {
String wrong = "Wrong function Usage.";
String substring = func.equals(prefix) ? "" : func.substring(prefix.length() + 1);
List<String> guessList = new ArrayList<>();
for (Map.Entry<String, ConfigObject.ModuleObject> entry : modules.entrySet()) {
if (entry.getKey().contains(substring)) {
guessList.add(prefix + "_" + entry.getKey());
}
}
if (!guessList.isEmpty()) {
wrong += " do you mean " + guessList + "?";
}
SocketTransfer.getInstance().echoToConsole(wrong);
}
return;
}
ConfigObject.ModuleObject moduleConfig = modules.get(func);
ConsoleManager.getConsole().printToConsole("ModuleCall : [M: " + moduleConfig.getName() + " ,F: " + moduleConfig.getFunction() + " ,P: " + moduleConfig.getParameter() + "]");
functions.get(moduleConfig.getFunction()).onExecuteFunction(moduleConfig.getParameter());
}
public static void executeMessageHook(ConsoleFunction function, String message) {
ConsoleManager.getConsole().printToConsole("FunctionMessageHook : [F: " + function.getClass().getName() + " ,M: " + message + "]");
function.onHookSpecialMessage(message);
}
/**
* Remove the "Unknown command : ***" tags
* @param cmd message
* @return message without "Unknown ***"
*/
public static String removeUnknownCommandTag(String cmd) {
if (cmd.startsWith("Unknown")) {
/*两种输出方式:
1. 主菜单 : Unknown command "hello"
2. 游戏内 : Unknown command : hello
真就V社爆改
*/
try {
int firstIndex = cmd.indexOf("\"") + 1; //包含引号
int lastIndex = cmd.lastIndexOf("\"");
return cmd.substring(firstIndex, lastIndex);
} catch (Exception e) {
return cmd.split(":")[1].trim(); //如果抛出异常 说明不是新版 则使用老版分割
}
} else {
return cmd.substring(FunctionExecutor.HOOK_HEAD.length() + 1).trim();
}
}
public static void printHelp() {
SocketTransfer.getInstance().echoToConsole("Help list : ");
modules.forEach((str, obj) -> SocketTransfer.getInstance().echoToConsole("cmd : " + str + " , {F: " + obj.getFunction() + "}"));
}
public static void registerGameHook() {
registerMessageHook();
if (!isStartTickThread) {
startTickThread();
}
functions.forEach((name, func) -> func.onInit());
RadioFileManager.getInstance();
}
public static void callRebootHook() {
functions.forEach((s,f) -> f.onApplicationReboot());
}
private static void registerMessageHook() {
if (isRegistered) {
return;
}
isRegistered = true;
//Special message Hook
SocketTransfer.getInstance().addListenerTask("SpecialMessageHook", message -> {
for (Map.Entry<String, ConsoleFunction> entry : FunctionExecutor.getMessageHookMap().entrySet()) {
if (message.contains(entry.getKey())) {
FunctionExecutor.executeMessageHook(entry.getValue() ,message);
break;
}
}
});
//Function Hook
SocketTransfer.getInstance().addListenerTask("FunctionHook", FunctionExecutor::executeFunction);
//Player Chat Hook
SocketTransfer.getInstance().addListenerTask("PlayerChatHook", message -> {
try {
//(反恐精英)wwl @ 反恐精英起始点 : 123123
//(****)wwl @ ****起始点 : 123123
//(反恐精英)wwl : #music
if (message.contains("(反恐精英)") || message.contains("(****)") || message.contains("(恐怖分子)")) {
String playerName = message.substring(6, (
message.contains("@") ? message.indexOf("@") : message.indexOf(" : ")
)).trim();
String[] split = message.split(" : ");
String talkMessage = split[split.length - 1].trim();
ConsoleManager.getConsole().printToConsole("ChatHook : [P: " + playerName + " ,M: " + talkMessage + "]");
for (Map.Entry<String, ConsoleFunction> entry : functions.entrySet()) {
ConsoleFunction function = entry.getValue();
if (function.isHookPlayerChat()) {
function.onHookPlayerChat(playerName, talkMessage);
}
}
}
} catch (Exception e) {
ConsoleManager.getConsole().printError("Execute PlayerChat throw Exception!");
ConsoleManager.getConsole().printException(e);
}
});
SocketTransfer.getInstance().addListenerTask("CommandReplace", str -> {
if (!str.contains("Unknown")) {
return;
}
String unknownHead = removeUnknownCommandTag(str);
String newCommand = commandReplace(unknownHead);
if (!unknownHead.equalsIgnoreCase(newCommand)) { //处理自定义替换的字符串
SocketTransfer.getInstance().echoToConsole("Cmd [" + str + "] has been Replace to [" + newCommand + "] .");
// System.out.println("CMD: " + str + " -> " + newCommand);
SocketTransfer.getInstance().pushToConsole(newCommand);
}
});
}
public static void reloadModules() {
modules.clear();
initFunctions();
}
public static void initFunctions() {
loadFunctions();
checkConfigFunctions();
}
private static void startTickThread() {
isStartTickThread = true;
executor.scheduleAtFixedRate(() ->
functions.forEach((name, func) -> {
if (func.isRequireTicking()) {
try {
func.onTick();
} catch (Exception e) {
ConsoleManager.getConsole().printError("Try Tick function: " + name + " Throw Exception!");
ConsoleManager.getConsole().printException(e);
}
}
}), 0, 10, TimeUnit.MILLISECONDS);
}
private static String commandReplace(String oldCommand) {
for (Map.Entry<String, String> entry : ConfigLoader.getConfigObject().getAutoReplaceCommand().entrySet()) {
if (entry.getKey().equals(oldCommand)) {
return entry.getValue();
}
}
return oldCommand;
}
public static Map<String, ConsoleFunction> getMessageHookMap() {
return messageHookMap;
}
private static void loadFunctions() {
if (!functions.isEmpty()) {
return;
}
functions.put("CustomRadio", new CustomRadioFunction());
functions.put("CustomChat",new CustomChatFunction());
functions.put("AutoChat", new AutoChatFunction());
functions.put("help", new HelpFunction());
functions.put("ReloadConfig", new ReloadConfigFunction());
functions.put("FakeOpenCase",new FakeCaseOpenFunction());
functions.put("Debug",new DebugFunction());
functions.put("CustomMusic",new CustomMusicFunction());
functions.put("DamageReport",new DamageReportFunction());
functions.put("AdnmbClient", new AdnmbClientFunction());
//TODO 反射寻找其他模块来进行注册
functions.forEach((s,func) -> {
List<String> specialMessage = func.isHookSpecialMessage();
if (!specialMessage.isEmpty()) {
specialMessage.forEach(str -> messageHookMap.put(str,func));
}
});
}
public static Map<String, ConsoleFunction> getFunctions() {
return functions;
}
private static void checkConfigFunctions() {
List<ConfigObject.ModuleObject> moduleList = ConfigLoader.getConfigObject().getModuleList();
if (moduleList == null || moduleList.size() == 0) {
ConsoleManager.getConsole().printError("The Config not have any Functions! Tools will not work!");
return;
}
for (ConfigObject.ModuleObject moduleObject : moduleList) {
if (!moduleObject.isEnabled()) {
continue;
}
if (modules.containsKey(moduleObject.getCommand())) {
ConsoleManager.getConsole().printError("Module [" + moduleObject.getName() + "] Register Command [" + moduleObject.getCommand() + "] But Map already have it! Check config Command block!");
continue;
}
if (!functions.containsKey(moduleObject.getFunction())) {
ConsoleManager.getConsole().printError("Module [" + moduleObject.getName() + "] Used unknown Function [" + moduleObject.getFunction() + "] ! Check Function!");
continue;
}
if (functions.get(moduleObject.getFunction()).isRequireParameter() && (moduleObject.getParameter() == null || moduleObject.getParameter().size() == 0)) {
ConsoleManager.getConsole().printError("Function [" + moduleObject.getFunction() + "] is Require Parameter but not set! Please Set the Parameter!");
continue;
}
modules.put(moduleObject.getCommand(), moduleObject);
}
}
}
| 41.074468 | 204 | 0.57334 |
64a6ef92a5afdcaa9fee0fec06fe43e484498481 | 6,411 | /*
* Postmark API
* Postmark makes sending and receiving email incredibly easy.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package net.nextpulse.postmarkapp.models.server;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* ExtendedMessageOpenEventInformationGeo
*/
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-02-24T16:43:29.220+01:00")
public class ExtendedMessageOpenEventInformationGeo {
@JsonProperty("CountryISOCode")
private String countryISOCode = null;
@JsonProperty("Country")
private String country = null;
@JsonProperty("RegionISOCode")
private String regionISOCode = null;
@JsonProperty("Region")
private String region = null;
@JsonProperty("City")
private String city = null;
@JsonProperty("Zip")
private String zip = null;
@JsonProperty("Coords")
private String coords = null;
@JsonProperty("IP")
private String IP = null;
public ExtendedMessageOpenEventInformationGeo countryISOCode(String countryISOCode) {
this.countryISOCode = countryISOCode;
return this;
}
/**
* Get countryISOCode
* @return countryISOCode
**/
@ApiModelProperty(example = "null", value = "")
public String getCountryISOCode() {
return countryISOCode;
}
public void setCountryISOCode(String countryISOCode) {
this.countryISOCode = countryISOCode;
}
public ExtendedMessageOpenEventInformationGeo country(String country) {
this.country = country;
return this;
}
/**
* Get country
* @return country
**/
@ApiModelProperty(example = "null", value = "")
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public ExtendedMessageOpenEventInformationGeo regionISOCode(String regionISOCode) {
this.regionISOCode = regionISOCode;
return this;
}
/**
* Get regionISOCode
* @return regionISOCode
**/
@ApiModelProperty(example = "null", value = "")
public String getRegionISOCode() {
return regionISOCode;
}
public void setRegionISOCode(String regionISOCode) {
this.regionISOCode = regionISOCode;
}
public ExtendedMessageOpenEventInformationGeo region(String region) {
this.region = region;
return this;
}
/**
* Get region
* @return region
**/
@ApiModelProperty(example = "null", value = "")
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public ExtendedMessageOpenEventInformationGeo city(String city) {
this.city = city;
return this;
}
/**
* Get city
* @return city
**/
@ApiModelProperty(example = "null", value = "")
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public ExtendedMessageOpenEventInformationGeo zip(String zip) {
this.zip = zip;
return this;
}
/**
* Get zip
* @return zip
**/
@ApiModelProperty(example = "null", value = "")
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public ExtendedMessageOpenEventInformationGeo coords(String coords) {
this.coords = coords;
return this;
}
/**
* Get coords
* @return coords
**/
@ApiModelProperty(example = "null", value = "")
public String getCoords() {
return coords;
}
public void setCoords(String coords) {
this.coords = coords;
}
public ExtendedMessageOpenEventInformationGeo IP(String IP) {
this.IP = IP;
return this;
}
/**
* Get IP
* @return IP
**/
@ApiModelProperty(example = "null", value = "")
public String getIP() {
return IP;
}
public void setIP(String IP) {
this.IP = IP;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ExtendedMessageOpenEventInformationGeo extendedMessageOpenEventInformationGeo = (ExtendedMessageOpenEventInformationGeo) o;
return Objects.equals(this.countryISOCode, extendedMessageOpenEventInformationGeo.countryISOCode) &&
Objects.equals(this.country, extendedMessageOpenEventInformationGeo.country) &&
Objects.equals(this.regionISOCode, extendedMessageOpenEventInformationGeo.regionISOCode) &&
Objects.equals(this.region, extendedMessageOpenEventInformationGeo.region) &&
Objects.equals(this.city, extendedMessageOpenEventInformationGeo.city) &&
Objects.equals(this.zip, extendedMessageOpenEventInformationGeo.zip) &&
Objects.equals(this.coords, extendedMessageOpenEventInformationGeo.coords) &&
Objects.equals(this.IP, extendedMessageOpenEventInformationGeo.IP);
}
@Override
public int hashCode() {
return Objects.hash(countryISOCode, country, regionISOCode, region, city, zip, coords, IP);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExtendedMessageOpenEventInformationGeo {\n");
sb.append(" countryISOCode: ").append(toIndentedString(countryISOCode)).append("\n");
sb.append(" country: ").append(toIndentedString(country)).append("\n");
sb.append(" regionISOCode: ").append(toIndentedString(regionISOCode)).append("\n");
sb.append(" region: ").append(toIndentedString(region)).append("\n");
sb.append(" city: ").append(toIndentedString(city)).append("\n");
sb.append(" zip: ").append(toIndentedString(zip)).append("\n");
sb.append(" coords: ").append(toIndentedString(coords)).append("\n");
sb.append(" IP: ").append(toIndentedString(IP)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 25.541833 | 131 | 0.684449 |
71fb80d1edbb414034344c6a06e7acf6f09c2369 | 1,007 | package practice;
/**
* @author: 杜少雄 https://github.com/shaoxiongdu
* @date: 2021/08/18
* @description:
*
* 冒泡排序:
*
* 每次遍历都判断相邻两个数字,按照需要进行互换
* 直到遍历完所有的元素
*
*/
public class popSort {
public static void main(String[] args) {
int [] arrays ={5,2,8,9,1,7};
for (int i = 0; i < arrays.length; i++) {
for (int j = 0; j < arrays.length - 1 - i; j++) {
if(arrays[j] > arrays[j+1]){
int temp = arrays[j];
arrays[j] = arrays[j+1];
arrays[j+1] = temp;
}
System.out.print("第" + (i+1) + "轮第"+(j+1)+"次: ");
System.out.print(arrays[j] + "和" + arrays[j+1] + "判断后 ");
for (int array : arrays) {
System.out.print(array + "\t");
}
System.out.println();
}
}
for (int array : arrays) {
System.out.println(array);
}
}
}
| 20.14 | 73 | 0.41708 |
634d12b64ad6b801b7d65fbfcc549d2c0e3a7510 | 455 | package io.quarkus.jackson;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used on classes that are meant to be used as Jackson mixins.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface JacksonMixin {
/**
* The types for which the mixin should apply to.
*/
Class<?>[] value();
}
| 22.75 | 63 | 0.734066 |
902b39dba5119654547bdc6536f963e505e584d7 | 714 | package br.com.mbragariano.gobeautyapi.modules.specialty.usecases;
import br.com.mbragariano.gobeautyapi.common.annotations.UseCase;
import br.com.mbragariano.gobeautyapi.modules.specialty.entities.SpecialtyEntity;
import br.com.mbragariano.gobeautyapi.modules.specialty.facades.FindAllSpecialtiesFacade;
import br.com.mbragariano.gobeautyapi.modules.specialty.ports.SpecialtyStorage;
import lombok.RequiredArgsConstructor;
import java.util.List;
@UseCase
@RequiredArgsConstructor
public class FindAllSpecialtiesUseCase implements FindAllSpecialtiesFacade {
private final SpecialtyStorage specialtyStorage;
@Override
public List<SpecialtyEntity> execute() {
return this.specialtyStorage.findAll();
}
}
| 31.043478 | 89 | 0.85014 |
d17de425e885eec72796bb698639063e706aad12 | 3,482 | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.test;
import com.yahoo.search.Query;
import com.yahoo.prelude.semantics.RuleBase;
import com.yahoo.prelude.semantics.engine.Evaluation;
import com.yahoo.prelude.semantics.rule.ChoiceCondition;
import com.yahoo.prelude.semantics.rule.ConditionReference;
import com.yahoo.prelude.semantics.rule.NamedCondition;
import com.yahoo.prelude.semantics.rule.ProductionList;
import com.yahoo.prelude.semantics.rule.ProductionRule;
import com.yahoo.prelude.semantics.rule.ReplacingProductionRule;
import com.yahoo.prelude.semantics.rule.SequenceCondition;
import com.yahoo.prelude.semantics.rule.TermCondition;
/**
* @author bratseth
*/
public class ConditionTestCase extends junit.framework.TestCase {
public ConditionTestCase(String name) {
super(name);
}
public void testTermCondition() {
TermCondition term=new TermCondition("foo");
Query query=new Query("?query=foo");
assertTrue(term.matches(new Evaluation(query).freshRuleEvaluation()));
}
public void testSequenceCondition() {
TermCondition term1=new TermCondition("foo");
TermCondition term2=new TermCondition("bar");
SequenceCondition sequence=new SequenceCondition();
sequence.addCondition(term1);
sequence.addCondition(term2);
Query query=new Query("?query=foo+bar");
assertTrue(query + " matches " + sequence,sequence.matches(new Evaluation(query).freshRuleEvaluation()));
Query query2=new Query("?query=foo");
assertFalse(query2 + " does not match " + sequence,sequence.matches(new Evaluation(query2).freshRuleEvaluation()));
Query query3=new Query("?query=bar");
assertFalse(query3 + " does not match " + sequence,sequence.matches(new Evaluation(query3).freshRuleEvaluation()));
}
public void testChoiceCondition() {
TermCondition term1=new TermCondition("foo");
TermCondition term2=new TermCondition("bar");
ChoiceCondition choice=new ChoiceCondition();
choice.addCondition(term1);
choice.addCondition(term2);
Query query1=new Query("?query=foo+bar");
assertTrue(query1 + " matches " + choice,choice.matches(new Evaluation(query1).freshRuleEvaluation()));
Query query2=new Query("?query=foo");
assertTrue(query2 + " matches " + choice,choice.matches(new Evaluation(query2).freshRuleEvaluation()));
Query query3=new Query("?query=bar");
assertTrue(query3 + " matches " + choice,choice.matches(new Evaluation(query3).freshRuleEvaluation()));
}
public void testNamedConditionReference() {
TermCondition term=new TermCondition("foo");
NamedCondition named=new NamedCondition("cond",term);
ConditionReference reference=new ConditionReference("cond");
// To initialize the condition reference...
ProductionRule rule=new ReplacingProductionRule();
rule.setCondition(reference);
rule.setProduction(new ProductionList());
RuleBase ruleBase=new RuleBase();
ruleBase.setName("test");
ruleBase.addCondition(named);
ruleBase.addRule(rule);
ruleBase.initialize();
Query query=new Query("?query=foo");
assertTrue(query + " matches " + reference,reference.matches(new Evaluation(query).freshRuleEvaluation()));
}
}
| 44.075949 | 123 | 0.711373 |
c779f452f684eb8ac28699d3b039d628f1b9505d | 1,013 | package com.earasoft.beam.pubmed.bean.medlineCitation;
import java.io.Serializable;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
/**
* AuthorList
*
* DTD:
* <!ELEMENT AuthorList (Author+) >
* <!ATTLIST AuthorList
* CompleteYN (Y | N) "Y"
* Type ( authors | editors ) #IMPLIED >
*
* @author erivera
*
*/
public class AuthorList implements Serializable{
private static final long serialVersionUID = -3097458048816785578L;
private String completeYN;
private List<Author> authors;
public String getCompleteYN() {
return completeYN;
}
@XmlAttribute(name="CompleteYN")
public void setCompleteYN(String completeYN) {
this.completeYN = completeYN;
}
public List<Author> getAuthors() {
return authors;
}
@XmlElement(name = "Author")
public void setAuthors(List<Author> authors) {
this.authors = authors;
}
} | 22.511111 | 71 | 0.654492 |
89a72e3c1198ca2098d7dd2a4712a1e42127004f | 1,612 | package net.anweisen.cloud.base.command.annotation;
import net.anweisen.cloud.base.command.completer.CommandCompleter;
import net.anweisen.cloud.base.command.completer.EmptyCompleter;
import javax.annotation.Nonnull;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author anweisen | https://github.com/anweisen
* @since 1.0
*/
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandArgument {
/**
* @return the argument's name used in the {@link CommandPath}
*/
@Nonnull
String value();
/**
* The class of the argument completer.
* Can only be used with {@link #words() words} {@code = 1}
*
* @return the class of the argument completer
*/
@Nonnull
Class<? extends CommandCompleter> completer() default EmptyCompleter.class;
/**
* The amount of words used for this argument or {@code -1} for all words left
*
* @return the amount of words used or {@code -1} for all remaining
*/
int words() default 1;
/**
* Whether to use the raw suggestions supplied by the completer.
* If not, they will be sorted alphabetically and filtered out when they don't start with the current input.
*
* @return whether to use the raw suggestions supplied by the completer
*/
boolean raw() default false;
/**
* Whether this argument can be left out.
* This can only be used if this is the last argument.
*
* @return whether this argument can be left out
*/
boolean optional() default false; // TODO implement
}
| 27.322034 | 109 | 0.727667 |
433c32a738fd46760c850c6c2c57de820c40c6bc | 546 | package com.example.gateway.service.method;
import lombok.Getter;
import lombok.Setter;
/**
* Created by JiWen on 2019/7/19 at home.
*/
@Getter
@Setter
public class FacadeMethod {
private String methodCode;
private String methodName;
private String facadeName;
private String shortMethodName;
private String paramType;
private String returnType;
private String rpcType;
private Facade facade;
public Object invoke(String param) {
return facade.invoke(shortMethodName, paramType, param);
}
}
| 20.222222 | 64 | 0.721612 |
90a2115193deac568cf57d817278ff7ecfcfb8ab | 3,585 | package org.monarchinitiative.hpo_case_annotator.model.io;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import org.monarchinitiative.hpo_case_annotator.model.codecs.Codecs;
import org.monarchinitiative.hpo_case_annotator.model.proto.DiseaseCase;
import org.monarchinitiative.hpo_case_annotator.model.xml_model.DiseaseCaseModel;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Optional;
/**
* This class uses {@link XMLEncoder} & {@link XMLDecoder} to load/dump model data into XML file.<p>Note: no alert
* windows are created here, upper-level code should handle that.
*/
public final class XMLModelParser implements ModelParser {
public static final String MODEL_SUFFIX = ".xml";
/**
* Path to directory where XML files containing model data are stored.
*/
private final ObjectProperty<File> modelDir = new SimpleObjectProperty<>(this, "modelDir");
/**
* Create parser that will read and save model XML files to provided directory.
*/
public XMLModelParser(File modelDir) {
this.modelDir.set(modelDir);
}
/**
* Serialize {@link DiseaseCaseModel} data in XML format into given file.
*
* @param model {@link DiseaseCaseModel} containing data to be serializec.
* @param outputStream where data will be serialized in XML format
*/
public static void saveDiseaseCase(DiseaseCase model, OutputStream outputStream) {
try (XMLEncoder xmlEncoder = new XMLEncoder(outputStream)) {
DiseaseCaseModel dcm = Codecs.diseaseCaseToDiseaseCaseModelCodec().encode(model);
xmlEncoder.writeObject(dcm);
}
}
/**
* Try to deserialize content of the provided <code>inputStream</code> and reconstruct {@link DiseaseCaseModel}
* instance. Data must be in XML format.
*
* @param inputStream pointing to data stored in XML format is stored
* @return {@link DiseaseCaseModel} with read data
*/
public static Optional<DiseaseCase> loadDiseaseCase(InputStream inputStream) {
try (XMLDecoder xmlDecoder = new XMLDecoder(inputStream)) {
DiseaseCaseModel dcm = (DiseaseCaseModel) xmlDecoder.readObject();
return Optional.of(Codecs.diseaseCaseToDiseaseCaseModelCodec().decode(dcm));
}
}
public File getModelDir() {
return modelDir.get();
}
public void setModelDir(File modelDir) {
this.modelDir.set(modelDir);
}
public ObjectProperty<File> modelDirProperty() {
return modelDir;
}
/**
* {@inheritDoc}
*/
@Override
public void saveModel(OutputStream outputStream, DiseaseCase model) throws IOException {
saveDiseaseCase(model, outputStream);
}
/**
* {@inheritDoc}
*/
@Override
public Optional<DiseaseCase> readModel(InputStream inputStream) {
return loadDiseaseCase(inputStream);
}
/**
* {@inheritDoc}
*
* @return
*/
@Override
public Collection<File> getModelNames() {
if (modelDir.get() == null) {
return new HashSet<>();
}
File[] files = modelDir.get().listFiles(f -> f.getName().endsWith(MODEL_SUFFIX));
if (files == null) {
return new HashSet<>();
}
return Arrays.asList(files);
}
}
| 29.628099 | 115 | 0.67894 |
9c3acf3a0bbcc4af1b8bce8badbb31f9c2a0aa75 | 5,649 | /*
* Copyright (c) 2008-2016, GigaSpaces Technologies, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gigaspaces.internal.jvm;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* @author kimchy
*/
@com.gigaspaces.api.InternalApi
public class JVMStatistics implements Externalizable {
// for backwards compatibility
private static final long serialVersionUID = 1688670775236533438L;
private long timestamp = -1;
private long uptime;
private long memoryHeapCommitted;
private long memoryHeapUsed;
private long memoryNonHeapCommitted;
private long memoryNonHeapUsed;
private int threadCount;
private int peakThreadCount;
private long gcCollectionCount;
private long gcCollectionTime;
private double cpuPerc = -1;
private long cpuTotal = -1;
private long cpuTime = -1;
public JVMStatistics() {
}
public JVMStatistics(long timestamp, long uptime,
long memoryHeapCommitted, long memoryHeapUsed, long memoryNonHeapCommitted, long memoryNonHeapUsed,
int threadCount, int peakThreadCount, long gcCollectionCount, long gcCollectionTime) {
this(timestamp, uptime, memoryHeapCommitted, memoryHeapUsed, memoryNonHeapCommitted, memoryNonHeapUsed,
threadCount, peakThreadCount, gcCollectionCount, gcCollectionTime, -1, -1, -1);
}
public JVMStatistics(long timestamp, long uptime,
long memoryHeapCommitted, long memoryHeapUsed, long memoryNonHeapCommitted, long memoryNonHeapUsed,
int threadCount, int peakThreadCount, long gcCollectionCount, long gcCollectionTime,
double cpuPerc, long cpuTotal, long cpuTime) {
this.timestamp = timestamp;
this.uptime = uptime;
this.memoryHeapCommitted = memoryHeapCommitted;
this.memoryHeapUsed = memoryHeapUsed;
this.memoryNonHeapCommitted = memoryNonHeapCommitted;
this.memoryNonHeapUsed = memoryNonHeapUsed;
this.threadCount = threadCount;
this.peakThreadCount = peakThreadCount;
this.gcCollectionCount = gcCollectionCount;
this.gcCollectionTime = gcCollectionTime;
this.cpuPerc = cpuPerc;
this.cpuTotal = cpuTotal;
this.cpuTime = cpuTime;
}
public boolean isNA() {
return timestamp == -1;
}
public long getTimestamp() {
return timestamp;
}
public long getUptime() {
return uptime;
}
public long getMemoryHeapCommitted() {
return memoryHeapCommitted;
}
public long getMemoryHeapUsed() {
return memoryHeapUsed;
}
public long getMemoryNonHeapCommitted() {
return memoryNonHeapCommitted;
}
public long getMemoryNonHeapUsed() {
return memoryNonHeapUsed;
}
public int getThreadCount() {
return threadCount;
}
public int getPeakThreadCount() {
return peakThreadCount;
}
public long getGcCollectionCount() {
return gcCollectionCount;
}
public long getGcCollectionTime() {
return gcCollectionTime;
}
public double computeCpuPerc(JVMStatistics lastJVMStatistics) {
// This object has been created by read external by a new client
// The object itself has been serialized by and old (< 8.0.3) server
if (lastJVMStatistics.getCpuTime() <= 0 || getCpuTime() <= 0) {
return cpuPerc;
}
long timeDelta = getCpuTime() - lastJVMStatistics.getCpuTime();
long totalDelta = getCpuTotal() - lastJVMStatistics.getCpuTotal();
if( timeDelta <= 0 || totalDelta < 0 ) {
return -1;
}
return Math.min( ((double) totalDelta)/timeDelta, 1.0 );
}
private long getCpuTotal() {
return cpuTotal;
}
private long getCpuTime() {
return cpuTime;
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(timestamp);
out.writeLong(uptime);
out.writeLong(memoryHeapCommitted);
out.writeLong(memoryHeapUsed);
out.writeLong(memoryNonHeapCommitted);
out.writeLong(memoryNonHeapUsed);
out.writeInt(threadCount);
out.writeInt(peakThreadCount);
out.writeLong(gcCollectionCount);
out.writeLong(gcCollectionTime);
out.writeLong(cpuTotal);
out.writeLong(cpuTime);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
timestamp = in.readLong();
uptime = in.readLong();
memoryHeapCommitted = in.readLong();
memoryHeapUsed = in.readLong();
memoryNonHeapCommitted = in.readLong();
memoryNonHeapUsed = in.readLong();
threadCount = in.readInt();
peakThreadCount = in.readInt();
gcCollectionCount = in.readLong();
gcCollectionTime = in.readLong();
cpuTotal = in.readLong();
cpuTime = in.readLong();
}
}
| 30.047872 | 124 | 0.666667 |
77c8699f3b8f39592e65c6709f9650bf78ad13f6 | 3,274 | import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
public class Transformateur_PoemeTxt implements Transformable {
public static void main(String[] str)
{ }
public void transform(String source, String cible, String nom) throws FileNotFoundException
{
int i=1;
DocumentBuilder parseur = null;
try {
parseur = DocumentBuilderFactory.newInstance().newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
DOMImplementation domimp = parseur.getDOMImplementation();
DocumentType dtd = domimp.createDocumentType("poema",null,"neruda.dtd");
Document doc = domimp.createDocument(null,"poema",dtd);
doc.setXmlStandalone(true);
Element rac = doc.getDocumentElement();
try{
InputStream flux=new FileInputStream(source);
InputStreamReader lecture=new InputStreamReader(flux);
BufferedReader buff=new BufferedReader(lecture);
String ligne;
while ((ligne=buff.readLine())!=null){
if(i==1)//traitement du titre
{
Element verso_ele = (Element) doc.createElement("titulo");
rac.appendChild(verso_ele);
verso_ele.appendChild((doc.createTextNode(ligne)));
i++;
}
else
{
if( ligne.length() > 0)
{
Element estrofa_ele = doc.createElement("estrofa");
rac.appendChild(estrofa_ele);
while( ligne !=null && ligne.length() > 0) //verso
{
Element verso_ele = doc.createElement("verso");
rac.appendChild(verso_ele);
verso_ele.appendChild((doc.createTextNode(ligne)));
estrofa_ele.appendChild(verso_ele);
ligne=buff.readLine();
}
}
}
}
buff.close();
}
catch (Exception e){
System.out.println(e.toString());
}
DOMSource ds = new DOMSource(doc);
StreamResult res = new StreamResult(new File(cible));
Transformer tr = null;
try {
tr = TransformerFactory.newInstance().newTransformer();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
}
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
tr.setOutputProperty(OutputKeys.INDENT, "yes");
tr.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "neruda.dtd");
try {
tr.transform(ds, res);
} catch (TransformerException e) {
e.printStackTrace();
}
}
} | 35.978022 | 95 | 0.564447 |
eafa9284e3ab0be3ae1fdc5a0d915d52b42cb025 | 2,116 | package com.epam.reportportal.saucelabs;
import com.epam.reportportal.extension.PluginCommand;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import org.apache.commons.codec.binary.Hex;
import org.jasypt.util.text.BasicTextEncryptor;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Map;
import static com.epam.reportportal.saucelabs.SaucelabsExtension.JOB_ID;
import static com.epam.reportportal.saucelabs.SaucelabsProperties.ACCESS_TOKEN;
import static com.epam.reportportal.saucelabs.SaucelabsProperties.USERNAME;
import static com.epam.reportportal.saucelabs.ValidationUtils.validateParams;
/**
* @author <a href="mailto:pavel_bortnik@epam.com">Pavel Bortnik</a>
*/
public class GenerateAuthTokenCommand implements PluginCommand {
private final BasicTextEncryptor textEncryptor;
public GenerateAuthTokenCommand(BasicTextEncryptor textEncryptor) {
this.textEncryptor = textEncryptor;
}
@Override
public Object executeCommand(Integration integration, Map params) {
try {
validateParams(params);
String username = USERNAME.getParam(integration.getParams())
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Username is not specified."));
String accessToken = textEncryptor.decrypt(ACCESS_TOKEN.getParam(integration.getParams())
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Access token is not specified."
)));
SecretKeySpec keySpec = new SecretKeySpec((username + ":" + accessToken).getBytes(StandardCharsets.UTF_8), "HmacMD5");
Mac mac = Mac.getInstance("HmacMD5");
mac.init(keySpec);
return Collections.singletonMap(
"token",
Hex.encodeHexString(mac.doFinal(params.get(JOB_ID).toString().getBytes(StandardCharsets.UTF_8)))
);
} catch (Exception e) {
throw new ReportPortalException(e.getMessage());
}
}
}
| 37.785714 | 125 | 0.791115 |
a1bb16e3768f6dcfcddc7b3e05e9dfbdb74d013c | 83 | package com.github.nyukhalov.practice.algorithm.sort;
public class BubbleSort {
}
| 16.6 | 53 | 0.807229 |
306dbb2cb6ec6ee4cc91a4882a91c6f3eda92dc0 | 558 | package com.test.hadoop;
import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class UrlStreamHandler {
static {
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
}
public static void main(String[] args) throws IOException {
InputStream in = null;
in = new URL(args[0]).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
IOUtils.closeStream(in);
}
}
| 25.363636 | 72 | 0.704301 |
5d4ebb57f9575abba2ec588c7af628ffe18af46d | 131 | package com.qxcmp.exception;
/**
* 验证码不匹配异常
*
* @author aaric
*/
public class CaptchaIncorrectException extends Exception {
}
| 13.1 | 58 | 0.725191 |
0b8f27f20033b122a65d1daed0f4d436b7b39738 | 1,100 | // ============================================================================
//
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.daikon.messages.header.producer;
import org.talend.daikon.messages.MessageHeader;
import org.talend.daikon.messages.MessageTypes;
/**
* A factory for normalized {@link MessageHeader}
*/
@FunctionalInterface
public interface MessageHeaderFactory {
/**
* Creates a new message header for the provided message type and name
*
* @param type the message type
* @param messageName the message name
* @return the newly created message header
*/
MessageHeader createMessageHeader(MessageTypes type, String messageName);
}
| 32.352941 | 87 | 0.630909 |
4d2722fe5daf346ec017fcb76e6caede3149a93a | 191 | package expression.interfaces;
/**
* @author Georgiy Korneev (kgeorgiy@kgeorgiy.info)
*/
public strictfp interface DoubleExpression extends ToMiniString {
double evaluate(double x);
} | 21.222222 | 65 | 0.764398 |
8fa6038f02d4e4e2f12a40de3c79d03ee4fd41e3 | 2,352 | package io.github.mayubao.kuaichuan;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* Created by mayubao on 2016/12/14.
* Contact me 345269374@qq.com
*/
public class StringTest {
public static void testReplace(){
String string = "<h4>{app_name}</h4><h4>{app_name}</h4><h4>{app_name}</h4><h4>{app_name}</h4><h4>{app_name}</h4>";
String newString = string.replaceAll("\\{app_name\\}", "fuckyou");
System.out.println(newString);
}
public static void testUrlEncoder(){
String englishStr = "helloworld";
String chineseStr = "手机淘宝.apk";
String eEncodeStr = null;
String cEncodeStr = null;
String eDecodeStr = null;
String cDecodeStr = null;
try {
eEncodeStr = URLEncoder.encode(englishStr, "UTF-8");
cEncodeStr = URLEncoder.encode(chineseStr, "UTF-8");
System.out.println("eEncodeStr------>>>" + eEncodeStr);
System.out.println("cEncodeStr------>>>" + cEncodeStr);
eDecodeStr = URLDecoder.decode(eEncodeStr, "UTF-8");
cDecodeStr = URLDecoder.decode(cEncodeStr, "UTF-8");
System.out.println("eDecodeStr------>>>" + eDecodeStr);
System.out.println("cDecodeStr------>>>" + cDecodeStr);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public static void testURLEncode2(){
String str1 = "%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D.apk";
String str2 = "P60811-095912.jpg";
try {
String eDecodeStr = URLDecoder.decode(str1, "UTF-8");
String cDecodeStr = URLDecoder.decode(str2, "UTF-8");
System.out.println("eDecodeStr------>>>" + eDecodeStr);
System.out.println("cDecodeStr------>>>" + cDecodeStr);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public static void testSubString(){
String filePath = "myapk.apk.png";
String fileName = filePath.substring(0, filePath.length() - 4);
System.out.println("fileName------>>>" + fileName);
}
public static void main(String[] args){
// testReplace();
// testUrlEncoder();
// testURLEncode2();
testSubString();
}
}
| 31.783784 | 122 | 0.588861 |
4f8ca84bf5361588908d8a3aebeb6131d81705d3 | 2,790 | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.odata2services.odata.schema.property;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.integrationservices.model.IntegrationObjectItemModel;
import de.hybris.platform.odata2services.odata.schema.attribute.AliasAnnotationGenerator;
import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
import org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute;
import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@UnitTest
@RunWith(MockitoJUnitRunner.class)
public class IntegrationKeyPropertyGeneratorUnitTest
{
@Mock
private AliasAnnotationGenerator aliasGenerator;
@InjectMocks
private IntegrationKeyPropertyGenerator generator;
@Test
public void testGenerateSuccessful()
{
final AnnotationAttribute aliasAnnotation = new AnnotationAttribute().setName("s:Alias").setText("MyAlias");
final AnnotationAttribute nullableAnnotation = new AnnotationAttribute().setName("Nullable").setText("false");
when(aliasGenerator.generate(any(IntegrationObjectItemModel.class))).thenReturn(aliasAnnotation);
final SimpleProperty integrationKeyProperty = (SimpleProperty) generator.generate(mock(IntegrationObjectItemModel.class)).get();
assertThat(integrationKeyProperty)
.hasFieldOrPropertyWithValue("name", "integrationKey")
.hasFieldOrPropertyWithValue("type", EdmSimpleTypeKind.String);
assertThat(integrationKeyProperty.getAnnotationAttributes())
.usingElementComparatorOnFields("name", "text")
.containsExactlyInAnyOrder(nullableAnnotation, aliasAnnotation);
}
@Test
public void testGenerateReturnsNullWhenNoKeyFound()
{
when(aliasGenerator.generate(any(IntegrationObjectItemModel.class))).thenReturn(null);
assertThat(generator.generate(mock(IntegrationObjectItemModel.class))).isNotPresent();
}
@Test
public void testGenerateThrowsExceptionWhenNullIntegrationObjectItemModel()
{
assertThatThrownBy(() -> generator.generate(null)).isInstanceOf(IllegalArgumentException.class);
}
} | 38.219178 | 130 | 0.816846 |
171c34abba5cffc4d569587a88187e156ddd745f | 3,713 | package it.isislab.streamingkway.kwaysgp.finaltest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import org.graphstream.graph.Node;
import org.graphstream.graph.implementations.SingleGraph;
import org.graphstream.stream.file.FileSinkImages;
import org.graphstream.stream.file.FileSinkImages.LayoutPolicy;
import org.graphstream.stream.file.FileSinkImages.OutputType;
import org.graphstream.stream.file.FileSinkImages.Resolutions;
import org.graphstream.ui.spriteManager.SpriteManager;
import it.isislab.streamingkway.graphloaders.AbstractGraphLoader;
import it.isislab.streamingkway.graphloaders.graphtraversingordering.GraphTraversingOrdering;
import it.isislab.streamingkway.graphpartitionator.GraphPartitionator;
public class GraphDrawer extends AbstractGraphLoader {
ArrayList<Node> nodesTrav = new ArrayList<Node>();
Map<Node, Integer> mapNode = new HashMap<>();
public static void main(String[] args) throws IOException {
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
FileInputStream fis = new FileInputStream(new File("resources/cordasconetwork.graph"));
GraphDrawer gd = new GraphDrawer(fis, null,null);
gd.runPartition();
}
public GraphDrawer(FileInputStream fpIn, FileOutputStream fpOut,GraphTraversingOrdering gto) throws IOException {
super(fpIn, fpOut, 0, null, 0, false, gto);
}
public void runPartition() throws NumberFormatException, IOException {
nodesTrav.add(null);
nodeNumbers = -1;
edgeNumbers = -1;
Integer nodeCount = 1;
//read the first line
//go on until there are no comments
String line = "";
while ((line = scanner.readLine()) != null
&& line.length() != 0) {
//String firstLine = scanner.nextLine().trim();
line = line.trim();
if (line.startsWith("%")) { //it is a comment
continue;
} else {
printerOut.print(line);
StringTokenizer strTok = new StringTokenizer(line, " ");
//read the number of nodes
if (strTok.hasMoreTokens()) {
String token = strTok.nextToken();
nodeNumbers = Integer.parseInt(token);
}
//read the number of edges
if (strTok.hasMoreTokens()) {
String token = strTok.nextToken();
edgeNumbers = Integer.parseInt(token);
}
break;
}
}
//graph
this.gr = new SingleGraph("grafo");
gr.setStrict(false);
gr.addAttribute("ui.stylesheet", GraphPartitionator.STYLESHEET);
int j = 0;
//read the whole graph from file
SpriteManager sman = new SpriteManager(gr);
FileSinkImages pic = new FileSinkImages(OutputType.PNG, Resolutions.HD720);
ArrayList<Node> nodes = new ArrayList<>();
while((line = scanner.readLine()) != null) {
line = line.trim();
//String line = scanner.nextLine().trim();
if (line.startsWith("%")) { //it is a comment
continue;
}
if (!nodes.isEmpty()) {
System.out.println(nodes.size());
nodes.stream().forEach(p -> {
p.setAttribute("ui.color", 1.0/5);
});
}
String[] nNodes = line.split(" ");
Node v = gr.addNode(Integer.toString(nodeCount++));
v.addAttribute("ui.color", 1.0/2);
v.addAttribute("label", v.getId());
pic.setLayoutPolicy(LayoutPolicy.COMPUTED_FULLY_AT_NEW_IMAGE);
for (String s : nNodes) {
if (gr.getNode(s) == null) {
gr.addNode(s).addAttribute("label", s);
gr.getNode(s).addAttribute("ui.color", 1.0/100);
}
gr.addEdge(v.getId()+"-"+s, v.getId(), s);
}
String graphFile = " graph" + j++ + ".png";
//gr.display(true);
pic.writeAll(gr, graphFile);
nodes.add(v);
}
}
}
| 30.68595 | 114 | 0.703205 |
1c2ed7df337bf68df191967ecabb894db23c5862 | 801 | package net.bartzz.coins.listener;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import net.bartzz.coins.Main;
import net.bartzz.coins.data.CoinPlayer;
import net.bartzz.coins.manager.CoinPlayerManager;
public class JoinListener implements Listener {
int start = Main.getInstance().getConfig().getInt("start");
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
CoinPlayer coinPlayer = CoinPlayer.getCoinPlayer(player.getUniqueId());
if(coinPlayer == null) {
coinPlayer = new CoinPlayer(player.getUniqueId(), player.getName(), start);
coinPlayer.insert();
CoinPlayerManager.getCoinPlayers().add(coinPlayer);
}
}
}
| 24.272727 | 78 | 0.752809 |
34bf095d748c61f6072fa92d6fd63026435f30f6 | 5,919 | package com.xlab.vbrowser.quickdial.service;
import android.content.Context;
import android.util.Log;
import com.xlab.vbrowser.favicon.FaviconService;
import com.xlab.vbrowser.quickdial.db.QuickDialDb;
import com.xlab.vbrowser.quickdial.entity.QuickDialItem;
import com.xlab.vbrowser.session.Session;
import com.xlab.vbrowser.session.SessionManager;
import com.xlab.vbrowser.utils.BackgroundTask;
import com.xlab.vbrowser.utils.IBackgroundTask;
import com.xlab.vbrowser.utils.QuickDialWebsites;
import com.xlab.vbrowser.utils.Settings;
public class QuickDialService {
public static QuickDialItem[] load(final Context context) {
try {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return null;
}
QuickDialItem[] items = quickDialDb.quickDialDao().load();
if (items == null || items.length < 1) {
Settings settings = Settings.getInstance(context);
if (settings.isFirstTimeLoadingQuickDial()) {
items = buildDefault();
saveDefault(context, items);
settings.setFirstTimeLoadingQuickDial(false);
} else {
//Quick access data is cleared, we need re-save default icon.
FaviconService.writeDefaultFavicon(context);
}
}
return items;
}
catch (java.lang.IllegalStateException e) {
return null;
}
}
public static QuickDialItem[] load(final Context context, int maxRecords) {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return null;
}
return quickDialDb.quickDialDao().load(maxRecords);
}
public static String getSuggestionUrl(final String url, final Context context) {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return "";
}
String [] urls = quickDialDb.quickDialDao().getSuggestion(url + "%");
if (urls != null && urls.length > 0) {
return urls[0];
}
return "";
}
public static void checkUrl(final Context context) {
final Session session = SessionManager.getInstance().getCurrentSession();
if (context == null || session == null || session.getUrl() == null) {
return;
}
final String url = session.getUrl().getValue();
if (url == null) {
return;
}
new BackgroundTask(new IBackgroundTask() {
@Override
public void run() {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return;
}
boolean isAdded = quickDialDb.quickDialDao().load(url) > 0;
Log.d("checkUrl", isAdded + url);
session.setAddedToQuickAccess(isAdded);
}
@Override
public void onComplete() {
}
}).execute();
}
public static void remove(final Context context, final QuickDialItem[] quickDialItems) {
new BackgroundTask(new IBackgroundTask() {
@Override
public void run() {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return;
}
quickDialDb.quickDialDao().delete(quickDialItems);
}
@Override
public void onComplete() {
}
}).execute();
}
public static void clear(final Context context) {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb != null) {
quickDialDb.quickDialDao().clear();
}
FaviconService.writeDefaultFavicon(context);
//Recreate default quick dials
Settings settings = Settings.getInstance(context);
settings.setFirstTimeLoadingQuickDial(true);
}
public static void update(final Context context,final QuickDialItem... quickDialItems) {
new BackgroundTask(new IBackgroundTask() {
@Override
public void run() {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb != null) {
quickDialDb.quickDialDao().update(quickDialItems);
}
}
@Override
public void onComplete() {
}
}).execute();
}
public static long insert(final Context context, final QuickDialItem quickDialItem) {
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb == null) {
return 0;
}
return quickDialDb.quickDialDao().insert(quickDialItem);
}
private static QuickDialItem[] buildDefault() {
QuickDialItem[] quickDialItems = new QuickDialItem[QuickDialWebsites.Sites.length];
for (int i = 0; i< QuickDialWebsites.Sites.length; i++) {
QuickDialItem quickDialItem = QuickDialItem.create(QuickDialWebsites.Sites[i][1], QuickDialWebsites.Sites[i][0]);
quickDialItems[i] = quickDialItem;
}
return quickDialItems;
}
private static void saveDefault(final Context context, final QuickDialItem[] quickDialItems) {
FaviconService.writeDefaultFavicon(context);
QuickDialDb quickDialDb = QuickDialDb.getInstance(context);
if (quickDialDb != null) {
long[] results = quickDialDb.quickDialDao().insert(quickDialItems);
for (int pos = 0; pos < results.length; pos++) {
quickDialItems[pos].id = results[pos];
}
}
}
}
| 30.510309 | 125 | 0.588613 |
8acf02407729fb6a79e74208e8f33aaa032e2c05 | 1,090 | package com.commercetools.sunrise.framework.reverserouters.myaccount.mydetails;
import com.commercetools.sunrise.framework.reverserouters.AbstractLinksControllerComponent;
import com.commercetools.sunrise.framework.viewmodels.meta.PageMeta;
import javax.inject.Inject;
public class MyPersonalDetailsLinksControllerComponent extends AbstractLinksControllerComponent<MyPersonalDetailsReverseRouter> {
private final MyPersonalDetailsReverseRouter reverseRouter;
@Inject
protected MyPersonalDetailsLinksControllerComponent(final MyPersonalDetailsReverseRouter reverseRouter) {
this.reverseRouter = reverseRouter;
}
@Override
public final MyPersonalDetailsReverseRouter getReverseRouter() {
return reverseRouter;
}
@Override
protected void addLinksToPage(final PageMeta meta, final MyPersonalDetailsReverseRouter reverseRouter) {
meta.addHalLink(reverseRouter.myPersonalDetailsPageCall(), "myPersonalDetails", "myAccount");
meta.addHalLink(reverseRouter.myPersonalDetailsProcessCall(), "editMyPersonalDetails");
}
}
| 38.928571 | 129 | 0.812844 |
31511adc44574b6f35cbbf4e805f5e834adc57c5 | 2,381 | /*
* Copyright (c) 2017 Ampool, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License. See accompanying LICENSE file.
*/
package io.ampool.monarch.functions;
import java.util.List;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Declarable;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
public class MonarchCreateRegionFunction implements Declarable, Function {
@Override
public void init(java.util.Properties props) {
}
public MonarchCreateRegionFunction() {
super();
}
@Override
@SuppressWarnings("unchecked")
public void execute(FunctionContext context) {
List<Object> args = (List<Object>) context.getArguments();
String regionName = (String)args.get(0);
RegionShortcut regionShortCut = (RegionShortcut)args.get(1);
try {
Cache cache = CacheFactory.getAnyInstance();
Region<Object, Object> region = cache.getRegion(regionName);
if (region != null) {
context.getResultSender().lastResult(true);
}
if (region == null) {
cache.createRegionFactory(regionShortCut)
.create(regionName);
}
} catch ( RegionExistsException re) {
context.getResultSender().lastResult(true);
} catch (CacheClosedException e) {
context.getResultSender().lastResult(false);
}
context.getResultSender().lastResult(true);
}
@Override
public String getId() {
return this.getClass().getName();
}
}
| 33.069444 | 100 | 0.688366 |
49feb5f21c045f5d3a73264c99743c17767dd810 | 2,687 | package uk.dangrew.kode.datetime;
import java.time.LocalDateTime;
import java.util.OptionalInt;
import java.util.TreeSet;
import java.util.function.Function;
import java.util.stream.Stream;
public enum TimestampComponents {
Day(
t -> t.plusDays( 1 ),
t -> t.minusDays( 1 ),
0, 1, 2
),
Month(
t -> t.plusMonths( 1 ),
t -> t.minusMonths( 1 ),
3, 4, 5
),
Year(
t -> t.plusYears( 1 ),
t -> t.minusYears( 1 ),
6, 7, 8, 9, 10 ),
Separator(
null,
null
),
Hour(
t -> t.plusHours( 1 ),
t -> t.minusHours( 1 ),
11, 12, 13
),
Minute(
t -> t.plusMinutes( 1 ),
t -> t.minusMinutes( 1 ),
14, 15, 16
),
Second(
t -> t.plusSeconds( 1 ),
t -> t.minusSeconds( 1 ),
17, 18, 19
);
private final TreeSet< Integer > caretPositions;
private final Function< LocalDateTime, LocalDateTime > incrementFunction;
private final Function< LocalDateTime, LocalDateTime > decrementFunction;
private TimestampComponents(
Function< LocalDateTime, LocalDateTime > incrementFunction,
Function< LocalDateTime, LocalDateTime > decrementFunction,
Integer... caretPositions
) {
this.caretPositions = new TreeSet<>();
this.incrementFunction = incrementFunction;
this.decrementFunction = decrementFunction;
Stream.of( caretPositions ).forEach( this.caretPositions::add );
}//End Constructor
public boolean caretHighlightsComponent( int caret ) {
return caretPositions.contains( caret );
}//End Method
public LocalDateTime increment( LocalDateTime timestamp ) {
if ( incrementFunction == null ) {
return timestamp;
}
return incrementFunction.apply( timestamp );
}//End Method
public LocalDateTime decrement( LocalDateTime timestamp ) {
if ( decrementFunction == null ) {
return timestamp;
}
return decrementFunction.apply( timestamp );
}//End Method
public OptionalInt startingCaretPosition(){
if ( caretPositions.isEmpty() ) {
return OptionalInt.empty();
}
return OptionalInt.of( caretPositions.first() );
}//End Method
public static TimestampComponents findComponent( int caretPosition ) {
return Stream.of( TimestampComponents.values() )
.filter( c -> c.caretHighlightsComponent( caretPosition ) )
.findFirst()
.orElse( null );
}//End Method
}//End Enum
| 28.892473 | 76 | 0.582806 |
e212f498cd4d3c2f75de3828db9f0f73399e7621 | 6,457 | /*
* Zorbage: an algebraic data hierarchy for use in numeric processing.
*
* Copyright (c) 2016-2021 Barry DeZonia All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* Neither the name of the <copyright holder> nor the names of its contributors may
* be used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package nom.bdezonia.zorbage.type.universal;
import nom.bdezonia.zorbage.misc.BigList;
import nom.bdezonia.zorbage.misc.LongUtils;
import nom.bdezonia.zorbage.algebra.DimensionsResizable;
import nom.bdezonia.zorbage.misc.Hasher;
/**
*
* @author Barry DeZonia
*
*/
public class TensorOctonionRepresentation implements DimensionsResizable {
private BigList<OctonionRepresentation> values;
private long[] dims;
public TensorOctonionRepresentation() {
setDims(new long[] {});
}
@Override
public void setDims(long[] dims) {
long count = LongUtils.numElements(dims);
if (count == 0) count = 1;
if (values == null || count != values.size()) {
values = new BigList<OctonionRepresentation>(count, new OctonionRepresentation());
}
this.dims = dims.clone();
}
public long[] getDims() {
return dims;
}
public boolean isValue() {
return dims.length == 0;
}
public boolean isRModule() {
return dims.length == 1;
}
public boolean isMatrix() {
return dims.length == 2;
}
public boolean isTensor() {
return dims.length > 2;
}
// single value
public void setValue(OctonionRepresentation value) {
setDims(new long[] {});
values.set(0, value);
}
// vector/rmodule value
public void setRModule(long n, BigList<OctonionRepresentation> values) {
setDims(new long[] {n});
long thisValsSize = this.values.size();
if (thisValsSize != values.size())
throw new IllegalArgumentException("Incorrect number of values passed");
for (long i = 0; i < thisValsSize; i++) {
this.values.set(i, values.get(i));
}
}
// matrix value
public void setMatrix(long r, long c, BigList<OctonionRepresentation> values) {
setDims(new long[] {c,r});
long thisValsSize = this.values.size();
if (thisValsSize != values.size())
throw new IllegalArgumentException("Incorrect number of values passed");
for (long i = 0; i < thisValsSize; i++) {
this.values.set(i, values.get(i));
}
}
// tensor value
public void setTensor(long[] dims, BigList<OctonionRepresentation> values) {
setDims(dims);
long thisValsSize = this.values.size();
if (thisValsSize != values.size())
throw new IllegalArgumentException("Incorrect number of values passed");
for (long i = 0; i < thisValsSize; i++) {
this.values.set(i, values.get(i));
}
}
public OctonionRepresentation getValue() {
return nonNull(values.get(0));
}
public long getRModuleDim() {
long size = 1;
if (dims.length >= 1 && dims[0] > 0)
size = dims[0];
return size;
}
public BigList<OctonionRepresentation> getRModule() {
long size = getRModuleDim();
BigList<OctonionRepresentation> list = new BigList<OctonionRepresentation>(size, new OctonionRepresentation());
for (long i = 0; i < size; i++) {
list.set(i, nonNull(values.get(i)));
}
return list;
}
public long getMatrixColDim() {
long size = 1;
if (dims.length >= 1 && dims[0] > 0)
size = dims[0];
return size;
}
public long getMatrixRowDim() {
long size = 1;
if (dims.length >= 2 && dims[1] > 0)
size = dims[1];
return size;
}
public BigList<OctonionRepresentation> getMatrix() {
long r = getMatrixRowDim();
long c = getMatrixColDim();
long size = LongUtils.numElements(new long[] {c,r});
BigList<OctonionRepresentation> list = new BigList<OctonionRepresentation>(size, new OctonionRepresentation());
for (long i = 0; i < size; i++) {
list.set(i, nonNull(values.get(i)));
}
return list;
}
public long[] getTensorDims() {
return dims.clone();
}
public BigList<OctonionRepresentation> getTensor() {
long valuesSize = values.size();
BigList<OctonionRepresentation> list = new BigList<OctonionRepresentation>(valuesSize, new OctonionRepresentation());
for (long i = 0; i < valuesSize; i++) {
list.set(i, nonNull(values.get(i)));
}
return list;
}
private OctonionRepresentation nonNull(OctonionRepresentation o) {
if (o != null)
return o;
return new OctonionRepresentation();
}
@Override
public int hashCode() {
OctonionRepresentation tmp = null;
long len = values.size();
int v = 1;
v = Hasher.PRIME * v + Hasher.hashCode(len);
if (len > 0) {
tmp = values.get(0);
v = Hasher.PRIME * v + tmp.hashCode();
}
return v;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o instanceof TensorOctonionRepresentation) {
TensorOctonionRepresentation t = (TensorOctonionRepresentation) o;
if (this.dims.length != t.dims.length)
return false;
for (int i = 0; i < this.dims.length; i++) {
if (this.dims[i] != t.dims[i])
return false;
}
for (long i = 0; i < values.size(); i++) {
OctonionRepresentation a = this.values.get(i);
OctonionRepresentation b = t.values.get(i);
if (!a.equals(b))
return false;
}
return true;
}
return false;
}
}
| 28.697778 | 119 | 0.695679 |
b072f35d6fd17dd9fb2b04690b7b811c5ea72978 | 3,783 | package com.example.webviewapp;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
private WebView myWebView;
public void showExternalWebPage(){
// TODO: Add your code for showing external web page here
myWebView.loadUrl("https://google.com/");
}
public void showInternalWebPage(){
// TODO: Add your code for showing internal web page here
myWebView.loadUrl("file:///android_asset/about.html");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
myWebView = (WebView) findViewById(R.id.my_webview);
myWebView.setWebViewClient(new WebViewClient());
//setContentView(myWebView);
myWebView.loadUrl("https://his.se");
/*
* Rename your App. Tip: Values->Strings
* Enable Internet access for your App. Tip: Manifest
* Create a WebView element in the layout file content_main.xml
* Give the WebView element ID "my_webview"
-- Commit and push to your github fork
* Create a private member variable called "myWebView" of type WebView
* Locate the WebView element created in step 1 using the ID created in step 2
* Create a new WebViewClient to attach to our WebView. This allows us to
browse the web inside our app.
-- Commit and push to your github fork
* Enable Javascript execution in your WebViewClient
* Enter the url to load in our WebView
-- Commit and push to your github fork
* Move the code that loads a URL into your WebView into the two methods
"showExternalWebPage()" and "showInternalWebPage()".
* Call the "showExternalWebPage()" / "showInternalWebPage()" methods
when you select menu options "External Web Page" or "Internal Web Page"
respectively
-- Commit and push to your github fork
* Take two screenshots using the "Take a screenshot" tool in the AVD
showing your App. One (1) screenshot showing your internal web page and
one (1) screenshot showing your external web page.
*/
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_external_web) {
showExternalWebPage();
return true;
}
if (id == R.id.action_internal_web) {
showInternalWebPage();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
if(myWebView.canGoBack()){
myWebView.goBack();
}else {
super.onBackPressed();
}
}
}
| 35.35514 | 85 | 0.660322 |
30f3086268ccb35e8146fb1d108368c7413884b4 | 178,637 | /*
*AVISO LEGAL
© Copyright
*Este programa esta protegido por la ley de derechos de autor.
*La reproduccion o distribucion ilicita de este programa o de cualquiera de
*sus partes esta penado por la ley con severas sanciones civiles y penales,
*y seran objeto de todas las sanciones legales que correspondan.
*Su contenido no puede copiarse para fines comerciales o de otras,
*ni puede mostrarse, incluso en una version modificada, en otros sitios Web.
Solo esta permitido colocar hipervinculos al sitio web.
*/
package com.bydan.erp.activosfijos.presentation.swing.jinternalframes;
import com.bydan.erp.contabilidad.presentation.swing.jinternalframes.*;
import com.bydan.erp.activosfijos.presentation.web.jsf.sessionbean.*;//;
import com.bydan.erp.activosfijos.presentation.swing.jinternalframes.*;
import com.bydan.erp.activosfijos.presentation.swing.jinternalframes.auxiliar.*;
import com.bydan.erp.contabilidad.presentation.web.jsf.sessionbean.*;
import com.bydan.erp.contabilidad.business.entity.*;
//import com.bydan.erp.activosfijos.presentation.report.source.*;
import com.bydan.framework.erp.business.entity.Reporte;
import com.bydan.erp.seguridad.business.entity.Modulo;
import com.bydan.erp.seguridad.business.entity.Opcion;
import com.bydan.erp.seguridad.business.entity.Usuario;
import com.bydan.erp.seguridad.business.entity.ResumenUsuario;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario;
import com.bydan.erp.seguridad.util.SistemaParameterReturnGeneral;
import com.bydan.erp.activosfijos.business.entity.*;
import com.bydan.erp.activosfijos.util.CuentaContaDetaGrupoActiConstantesFunciones;
import com.bydan.erp.activosfijos.business.logic.*;
import com.bydan.framework.erp.business.entity.DatoGeneral;
import com.bydan.framework.erp.business.entity.OrderBy;
import com.bydan.framework.erp.business.entity.Mensajes;
import com.bydan.framework.erp.business.entity.Classe;
import com.bydan.framework.erp.business.logic.*;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverter;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate;
import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing;
import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase;
import com.bydan.framework.erp.presentation.desktop.swing.*;
import com.bydan.framework.erp.util.*;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.sql.*;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.data.JRBeanArrayDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.table.TableColumn;
import com.toedter.calendar.JDateChooser;
@SuppressWarnings("unused")
public class CuentaContaDetaGrupoActiJInternalFrame extends CuentaContaDetaGrupoActiBeanSwingJInternalFrameAdditional {
private static final long serialVersionUID = 1L;
//protected Usuario usuarioActual=null;
public JToolBar jTtoolBarCuentaContaDetaGrupoActi;
protected JMenuBar jmenuBarCuentaContaDetaGrupoActi;
protected JMenu jmenuCuentaContaDetaGrupoActi;
protected JMenu jmenuDatosCuentaContaDetaGrupoActi;
protected JMenu jmenuArchivoCuentaContaDetaGrupoActi;
protected JMenu jmenuAccionesCuentaContaDetaGrupoActi;
protected JPanel jContentPane = null;
protected JPanel jPanelBusquedasParametrosCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
protected GridBagLayout gridaBagLayoutCuentaContaDetaGrupoActi;
protected GridBagConstraints gridBagConstraintsCuentaContaDetaGrupoActi;
//protected JInternalFrameBase jInternalFrameParent;
public CuentaContaDetaGrupoActiDetalleFormJInternalFrame jInternalFrameDetalleFormCuentaContaDetaGrupoActi;
protected ReporteDinamicoJInternalFrame jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi;
protected ImportacionJInternalFrame jInternalFrameImportacionCuentaContaDetaGrupoActi;
//VENTANAS PARA ACTUALIZAR Y BUSCAR FK
protected CuentaContableBeanSwingJInternalFrame cuentacontableBeanSwingJInternalFrame;
public String sFinalQueryGeneral_cuentacontable="";
protected DetalleGrupoActivoFijoBeanSwingJInternalFrame detallegrupoactivofijoBeanSwingJInternalFrame;
public String sFinalQueryGeneral_detallegrupoactivofijo="";
public CuentaContaDetaGrupoActiSessionBean cuentacontadetagrupoactiSessionBean;
public CuentaContableSessionBean cuentacontableSessionBean;
public DetalleGrupoActivoFijoSessionBean detallegrupoactivofijoSessionBean;
//protected JDesktopPane jDesktopPane;
public List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactis;
public List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactisEliminados;
public List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactisAux;
protected OrderByJInternalFrame jInternalFrameOrderByCuentaContaDetaGrupoActi;
protected JButton jButtonAbrirOrderByCuentaContaDetaGrupoActi;
//protected JPanel jPanelOrderByCuentaContaDetaGrupoActi;
//public JScrollPane jScrollPanelOrderByCuentaContaDetaGrupoActi;
//protected JButton jButtonCerrarOrderByCuentaContaDetaGrupoActi;
public ArrayList<OrderBy> arrOrderBy= new ArrayList<OrderBy>();
public CuentaContaDetaGrupoActiLogic cuentacontadetagrupoactiLogic;
public JScrollPane jScrollPanelDatosCuentaContaDetaGrupoActi;
public JScrollPane jScrollPanelDatosEdicionCuentaContaDetaGrupoActi;
public JScrollPane jScrollPanelDatosGeneralCuentaContaDetaGrupoActi;
//public JScrollPane jScrollPanelDatosCuentaContaDetaGrupoActiOrderBy;
//public JScrollPane jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi;
//public JScrollPane jScrollPanelImportacionCuentaContaDetaGrupoActi;
protected JPanel jPanelAccionesCuentaContaDetaGrupoActi;
protected JPanel jPanelPaginacionCuentaContaDetaGrupoActi;
protected JPanel jPanelParametrosReportesCuentaContaDetaGrupoActi;
protected JPanel jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi;
;
protected JPanel jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi;
protected JPanel jPanelParametrosAuxiliar2CuentaContaDetaGrupoActi;
protected JPanel jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi;
protected JPanel jPanelParametrosAuxiliar4CuentaContaDetaGrupoActi;
//protected JPanel jPanelParametrosAuxiliar5CuentaContaDetaGrupoActi;
//protected JPanel jPanelReporteDinamicoCuentaContaDetaGrupoActi;
//protected JPanel jPanelImportacionCuentaContaDetaGrupoActi;
public JTable jTableDatosCuentaContaDetaGrupoActi;
//public JTable jTableDatosCuentaContaDetaGrupoActiOrderBy;
//ELEMENTOS TABLAS PARAMETOS
//ELEMENTOS TABLAS PARAMETOS_FIN
protected JButton jButtonNuevoCuentaContaDetaGrupoActi;
protected JButton jButtonDuplicarCuentaContaDetaGrupoActi;
protected JButton jButtonCopiarCuentaContaDetaGrupoActi;
protected JButton jButtonVerFormCuentaContaDetaGrupoActi;
protected JButton jButtonNuevoRelacionesCuentaContaDetaGrupoActi;
protected JButton jButtonModificarCuentaContaDetaGrupoActi;
protected JButton jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi;
protected JButton jButtonCerrarCuentaContaDetaGrupoActi;
protected JButton jButtonRecargarInformacionCuentaContaDetaGrupoActi;
protected JButton jButtonProcesarInformacionCuentaContaDetaGrupoActi;
protected JButton jButtonAnterioresCuentaContaDetaGrupoActi;
protected JButton jButtonSiguientesCuentaContaDetaGrupoActi;
protected JButton jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi;
//protected JButton jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi;
//protected JButton jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi;
//protected JButton jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi;
//protected JButton jButtonAbrirImportacionCuentaContaDetaGrupoActi;
//protected JButton jButtonGenerarImportacionCuentaContaDetaGrupoActi;
//protected JButton jButtonCerrarImportacionCuentaContaDetaGrupoActi;
//protected JFileChooser jFileChooserImportacionCuentaContaDetaGrupoActi;
//protected File fileImportacionCuentaContaDetaGrupoActi;
//TOOLBAR
protected JButton jButtonNuevoToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonDuplicarToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonNuevoRelacionesToolBarCuentaContaDetaGrupoActi;
public JButton jButtonGuardarCambiosToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonCopiarToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonVerFormToolBarCuentaContaDetaGrupoActi;
public JButton jButtonGuardarCambiosTablaToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonMostrarOcultarTablaToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonCerrarToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonRecargarInformacionToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonProcesarInformacionToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonAnterioresToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonSiguientesToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonNuevoGuardarCambiosToolBarCuentaContaDetaGrupoActi;
protected JButton jButtonAbrirOrderByToolBarCuentaContaDetaGrupoActi;
//TOOLBAR
//MENU
protected JMenuItem jMenuItemNuevoCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemDuplicarCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemGuardarCambiosCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemCopiarCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemVerFormCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemCerrarCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemDetalleCerrarCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemDetalleAbrirOrderByCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemDetalleMostarOcultarCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemRecargarInformacionCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemProcesarInformacionCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemAnterioresCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemSiguientesCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemAbrirOrderByCuentaContaDetaGrupoActi;
protected JMenuItem jMenuItemMostrarOcultarCuentaContaDetaGrupoActi;
//MENU
protected JLabel jLabelAccionesCuentaContaDetaGrupoActi;
protected JCheckBox jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi;
protected JCheckBox jCheckBoxSeleccionadosCuentaContaDetaGrupoActi;
protected JCheckBox jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi;
protected JCheckBox jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposReportesCuentaContaDetaGrupoActi;
//@SuppressWarnings("rawtypes")
//protected JComboBox jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi;
//@SuppressWarnings("rawtypes")
//protected JComboBox jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposPaginacionCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposRelacionesCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposAccionesCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi;
protected JTextField jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi;
//REPORTE DINAMICO
//@SuppressWarnings("rawtypes")
//public JLabel jLabelColumnasSelectReporteCuentaContaDetaGrupoActi;
//public JList<Reporte> jListColumnasSelectReporteCuentaContaDetaGrupoActi;
//public JScrollPane jScrollColumnasSelectReporteCuentaContaDetaGrupoActi;
//public JLabel jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi;
//public JList<Reporte> jListRelacionesSelectReporteCuentaContaDetaGrupoActi;
//public JScrollPane jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi;
//public JLabel jLabelConGraficoDinamicoCuentaContaDetaGrupoActi;
//protected JCheckBox jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi;
//public JLabel jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi;
//public JLabel jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi;
//public JLabel jLabelArchivoImportacionCuentaContaDetaGrupoActi;
//public JLabel jLabelPathArchivoImportacionCuentaContaDetaGrupoActi;
//protected JTextField jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi;
//public JLabel jLabelColumnaCategoriaGraficoCuentaContaDetaGrupoActi;
//@SuppressWarnings("rawtypes")
//protected JComboBox jComboBoxColumnaCategoriaGraficoCuentaContaDetaGrupoActi;
//public JLabel jLabelColumnaCategoriaValorCuentaContaDetaGrupoActi;
//@SuppressWarnings("rawtypes")
//protected JComboBox jComboBoxColumnaCategoriaValorCuentaContaDetaGrupoActi;
//public JLabel jLabelColumnasValoresGraficoCuentaContaDetaGrupoActi;
//public JList<Reporte> jListColumnasValoresGraficoCuentaContaDetaGrupoActi;
//public JScrollPane jScrollColumnasValoresGraficoCuentaContaDetaGrupoActi;
//public JLabel jLabelTiposGraficosReportesDinamicoCuentaContaDetaGrupoActi;
//@SuppressWarnings("rawtypes")
//protected JComboBox jComboBoxTiposGraficosReportesDinamicoCuentaContaDetaGrupoActi;
protected Boolean conMaximoRelaciones=true;
protected Boolean conFuncionalidadRelaciones=true;
public Boolean conCargarMinimo=false;
public Boolean cargarRelaciones=false;
public Boolean conMostrarAccionesCampo=false;
public Boolean permiteRecargarForm=false;//PARA NUEVO PREPARAR Y MANEJO DE EVENTOS, EVITAR QUE SE EJECUTE AL CARGAR VENTANA O LOAD
public Boolean conCargarFormDetalle=false;
//BYDAN_BUSQUEDAS
public JTabbedPane jTabbedPaneBusquedasCuentaContaDetaGrupoActi;
public JPanel jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi;
public JButton jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi;
public JPanel jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi;
public JButton jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi;
public JPanel jPanelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi;
public JLabel jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
public JComboBox jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi;
public JButton jButtonid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi= new JButtonMe();
public JButton jButtonid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActiUpdate= new JButtonMe();
public JButton jButtonid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActiBusqueda= new JButtonMe();
public JButton jButtonid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActiArbol= new JButtonMe();
public JButton jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi;
public JPanel jPanelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi;
public JLabel jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi;
@SuppressWarnings("rawtypes")
public JComboBox jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi;
public JButton jButtonid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi= new JButtonMe();
public JButton jButtonid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActiUpdate= new JButtonMe();
public JButton jButtonid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActiBusqueda= new JButtonMe();
//ELEMENTOS TABLAS PARAMETOS
//ELEMENTOS TABLAS PARAMETOS_FIN
public static int openFrameCount = 0;
public static final int xOffset = 10, yOffset = 35;
//LOS DATOS DE NUEVO Y EDICION ACTUAL APARECEN EN OTRA VENTANA(true) O NO(false)
public static Boolean CON_DATOS_FRAME=true;
public static Boolean ISBINDING_MANUAL=true;
public static Boolean ISLOAD_FKLOTE=true;
public static Boolean ISBINDING_MANUAL_TABLA=true;
public static Boolean CON_CARGAR_MEMORIA_INICIAL=true;
//Al final no se utilizan, se inicializan desde JInternalFrameBase, desde ParametroGeneralUsuario
public static String STIPO_TAMANIO_GENERAL="NORMAL";
public static String STIPO_TAMANIO_GENERAL_TABLA="NORMAL";
public static Boolean CONTIPO_TAMANIO_MANUAL=false;
public static Boolean CON_LLAMADA_SIMPLE=true;
public static Boolean CON_LLAMADA_SIMPLE_TOTAL=true;
public static Boolean ESTA_CARGADO_PORPARTE=false;
public int iWidthScroll=0;//(screenSize.width-screenSize.width/2)+(250*0);
public int iHeightScroll=0;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO);
//public int iWidthFormulario=515;//(screenSize.width-screenSize.width/2)+(250*0);
//public int iHeightFormulario=242;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO);
//Esto va en DetalleForm
//public int iHeightFormularioMaximo=0;
//public int iWidthFormularioMaximo=0;
public int iWidthTableDefinicion=0;
public double dStart = 0;
public double dEnd = 0;
public double dDif = 0;
/*
double start=(double)System.currentTimeMillis();
double end=0;
double dif=0;
end=(double)System.currentTimeMillis();
dif=end - start;
start=(double)System.currentTimeMillis();
System.out.println("Tiempo(ms) Carga TEST 1_2 DetalleMovimientoInventario: " + dif);
*/
public SistemaParameterReturnGeneral sistemaReturnGeneral;
public List<Opcion> opcionsRelacionadas=new ArrayList<Opcion>();
//ES AUXILIAR PARA WINDOWS FORMS
public CuentaContaDetaGrupoActiJInternalFrame() throws Exception {
super(PaginaTipo.PRINCIPAL);
//super("CuentaContaDetaGrupoActi No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable
try {
//Boolean cargarRelaciones=false;
initialize(null,false,false,false/*cargarRelaciones*/,null,null,null,null,null,null,PaginaTipo.PRINCIPAL);
} catch(Exception e) {
FuncionesSwing.manageException(this, e, null);
}
}
public CuentaContaDetaGrupoActiJInternalFrame(Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception {
super(paginaTipo);
//super("CuentaContaDetaGrupoActi No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable
try {
initialize(null,false,false,cargarRelaciones,null,null,null,null,null,null,paginaTipo);
} catch(Exception e) {
FuncionesSwing.manageException(this, e, null);
}
}
public CuentaContaDetaGrupoActiJInternalFrame(Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception {
super(paginaTipo);
//super("CuentaContaDetaGrupoActi No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable
try {
initialize(null,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,null,null,null,null,null,null,paginaTipo);
} catch(Exception e) {
FuncionesSwing.manageException(this, e, null);
}
}
public CuentaContaDetaGrupoActiJInternalFrame(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception {
super(paginaTipo);//,jdesktopPane
this.jDesktopPane=jdesktopPane;
this.dStart=(double)System.currentTimeMillis();
//super("CuentaContaDetaGrupoActi No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable
try {
long start_time=0;
long end_time=0;
if(Constantes2.ISDEVELOPING2) {
start_time = System.currentTimeMillis();
}
initialize(jdesktopPane,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo);
if(Constantes2.ISDEVELOPING2) {
end_time = System.currentTimeMillis();
String sTipo="Clase Padre Ventana";
Funciones2.getMensajeTiempoEjecucion(start_time, end_time, sTipo,false);
}
} catch(Exception e) {
FuncionesSwing.manageException(this, e, null);
}
}
public JInternalFrameBase getJInternalFrameParent() {
return jInternalFrameParent;
}
public void setJInternalFrameParent(JInternalFrameBase internalFrameParent) {
jInternalFrameParent = internalFrameParent;
}
public void setjButtonRecargarInformacion(JButton jButtonRecargarInformacionCuentaContaDetaGrupoActi) {
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi = jButtonRecargarInformacionCuentaContaDetaGrupoActi;
}
public JButton getjButtonProcesarInformacionCuentaContaDetaGrupoActi() {
return this.jButtonProcesarInformacionCuentaContaDetaGrupoActi;
}
public void setjButtonProcesarInformacion(JButton jButtonProcesarInformacionCuentaContaDetaGrupoActi) {
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi = jButtonProcesarInformacionCuentaContaDetaGrupoActi;
}
public JButton getjButtonRecargarInformacionCuentaContaDetaGrupoActi() {
return this.jButtonRecargarInformacionCuentaContaDetaGrupoActi;
}
public List<CuentaContaDetaGrupoActi> getcuentacontadetagrupoactis() {
return this.cuentacontadetagrupoactis;
}
public void setcuentacontadetagrupoactis(List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactis) {
this.cuentacontadetagrupoactis = cuentacontadetagrupoactis;
}
public List<CuentaContaDetaGrupoActi> getcuentacontadetagrupoactisAux() {
return this.cuentacontadetagrupoactisAux;
}
public void setcuentacontadetagrupoactisAux(List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactisAux) {
this.cuentacontadetagrupoactisAux = cuentacontadetagrupoactisAux;
}
public List<CuentaContaDetaGrupoActi> getcuentacontadetagrupoactisEliminados() {
return this.cuentacontadetagrupoactisEliminados;
}
public void setCuentaContaDetaGrupoActisEliminados(List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactisEliminados) {
this.cuentacontadetagrupoactisEliminados = cuentacontadetagrupoactisEliminados;
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposSeleccionarCuentaContaDetaGrupoActi() {
return jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposSeleccionarCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi) {
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi = jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi;
}
public void setBorderResaltarTiposSeleccionarCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
public JTextField getjTextFieldValorCampoGeneralCuentaContaDetaGrupoActi() {
return jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi;
}
public void setjTextFieldValorCampoGeneralCuentaContaDetaGrupoActi(
JTextField jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi) {
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi = jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi;
}
public void setBorderResaltarValorCampoGeneralCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
public JCheckBox getjCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi() {
return this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi;
}
public void setjCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi(
JCheckBox jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi) {
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi = jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi;
}
public void setBorderResaltarSeleccionarTodosCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
public JCheckBox getjCheckBoxSeleccionadosCuentaContaDetaGrupoActi() {
return this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi;
}
public void setjCheckBoxSeleccionadosCuentaContaDetaGrupoActi(
JCheckBox jCheckBoxSeleccionadosCuentaContaDetaGrupoActi) {
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi = jCheckBoxSeleccionadosCuentaContaDetaGrupoActi;
}
public void setBorderResaltarSeleccionadosCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi) {
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi = jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi;
}
public void setBorderResaltarTiposArchivosReportesCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposReportesCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposReportesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposReportesCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposReportesCuentaContaDetaGrupoActi) {
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi = jComboBoxTiposReportesCuentaContaDetaGrupoActi;
}
//@SuppressWarnings("rawtypes")
//public JComboBox getjComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi() {
// return jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi;
//}
//@SuppressWarnings("rawtypes")
//public void setjComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi(
// JComboBox jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi) {
// this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi = jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi;
//}
//@SuppressWarnings("rawtypes")
//public JComboBox getjComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi() {
// return jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi;
//}
//@SuppressWarnings("rawtypes")
//public void setjComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi(
// JComboBox jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi) {
// this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi = jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi;
//}
public void setBorderResaltarTiposReportesCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi) {
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi = jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi;
}
public void setBorderResaltarTiposGraficosReportesCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposPaginacionCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposPaginacionCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposPaginacionCuentaContaDetaGrupoActi) {
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi = jComboBoxTiposPaginacionCuentaContaDetaGrupoActi;
}
public void setBorderResaltarTiposPaginacionCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposRelacionesCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxTiposAccionesCuentaContaDetaGrupoActi() {
return this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposRelacionesCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposRelacionesCuentaContaDetaGrupoActi) {
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi = jComboBoxTiposRelacionesCuentaContaDetaGrupoActi;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxTiposAccionesCuentaContaDetaGrupoActi(
JComboBox jComboBoxTiposAccionesCuentaContaDetaGrupoActi) {
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi = jComboBoxTiposAccionesCuentaContaDetaGrupoActi;
}
public void setBorderResaltarTiposRelacionesCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
public void setBorderResaltarTiposAccionesCuentaContaDetaGrupoActi() {
Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi .setBorder(borderResaltar);
}
//public JCheckBox getjCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi() {
// return jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi;
//}
//public void setjCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi(
// JCheckBox jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi) {
// this.jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi = jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi;
//}
//public void setBorderResaltarConGraficoDinamicoCuentaContaDetaGrupoActi() {
// Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO");
// this.jTtoolBarCuentaContaDetaGrupoActi.setBorder(borderResaltar);
// this.jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi .setBorder(borderResaltar);
//}
/*
public JDesktopPane getJDesktopPane() {
return jDesktopPane;
}
public void setJDesktopPane(JDesktopPane desktopPane) {
jDesktopPane = desktopPane;
}
*/
private void initialize(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception {
this.cuentacontadetagrupoactiSessionBean=new CuentaContaDetaGrupoActiSessionBean();
this.cuentacontadetagrupoactiSessionBean.setConGuardarRelaciones(conGuardarRelaciones);
this.cuentacontadetagrupoactiSessionBean.setEsGuardarRelacionado(esGuardarRelacionado);
this.conCargarMinimo=this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado();
this.cargarRelaciones=cargarRelaciones;
if(!this.conCargarMinimo) {
}
//this.sTipoTamanioGeneral=CuentaContaDetaGrupoActiJInternalFrame.STIPO_TAMANIO_GENERAL;
//this.sTipoTamanioGeneralTabla=CuentaContaDetaGrupoActiJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA;
this.sTipoTamanioGeneral=FuncionesSwing.getTipoTamanioGeneral(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado);
this.sTipoTamanioGeneralTabla=FuncionesSwing.getTipoTamanioGeneralTabla(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado);
this.conTipoTamanioManual=FuncionesSwing.getConTipoTamanioManual(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado);
this.conTipoTamanioTodo=FuncionesSwing.getConTipoTamanioTodo(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado);
CuentaContaDetaGrupoActiJInternalFrame.STIPO_TAMANIO_GENERAL=this.sTipoTamanioGeneral;
CuentaContaDetaGrupoActiJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA=this.sTipoTamanioGeneralTabla;
CuentaContaDetaGrupoActiJInternalFrame.CONTIPO_TAMANIO_MANUAL=this.conTipoTamanioManual;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int iWidth=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO);
int iHeight=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO);
//this.setTitle(Funciones.GetTituloSistema(this.parametroGeneralSg,this.moduloActual,this.opcionActual,this.usuarioActual,"Cuenta Conta Deta Grupo Acti MANTENIMIENTO"));
if(iWidth > 650) {
iWidth=650;
}
if(iHeight > 660) {
iHeight=660;
}
this.setSize(iWidth,iHeight);
this.setFrameIcon(new ImageIcon(FuncionesSwing.getImagenBackground(Constantes2.S_ICON_IMAGE)));
this.setContentPane(this.getJContentPane(iWidth,iHeight,jdesktopPane,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo));
if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
this.setResizable(true);
this.setClosable(true);
this.setMaximizable(true);
this.iconable=true;
setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
if(Constantes.CON_VARIAS_VENTANAS) {
openFrameCount++;
if(openFrameCount==Constantes.INUM_MAX_VENTANAS) {
openFrameCount=0;
}
}
}
CuentaContaDetaGrupoActiJInternalFrame.ESTA_CARGADO_PORPARTE=true;
//super("CuentaContaDetaGrupoActi No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable
//SwingUtilities.updateComponentTreeUI(this);
}
public void inicializarToolBar() {
this.jTtoolBarCuentaContaDetaGrupoActi= new JToolBar("MENU PRINCIPAL");
//TOOLBAR
//PRINCIPAL
this.jButtonNuevoToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"nuevo","nuevo","Nuevo"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO"),"Nuevo",false);
this.jButtonNuevoGuardarCambiosToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoGuardarCambiosToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"nuevoguardarcambios","nuevoguardarcambios","Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"),"Nuevo",false);
this.jButtonGuardarCambiosTablaToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonGuardarCambiosTablaToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"guardarcambiostabla","guardarcambiostabla","Guardar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"),"Guardar",false);
this.jButtonDuplicarToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonDuplicarToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"duplicar","duplicar","Duplicar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR"),"Duplicar",false);
this.jButtonCopiarToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCopiarToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"copiar","copiar","Copiar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("COPIAR"),"Copiar",false);
this.jButtonVerFormToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonVerFormToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"ver_form","ver_form","Ver"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("VER_FORM"),"Ver",false);
this.jButtonRecargarInformacionToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"recargar","recargar","Recargar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR"),"Recargar",false);
this.jButtonAnterioresToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"anteriores","anteriores","Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES"),"<<",false);
this.jButtonSiguientesToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"siguientes","siguientes","Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES"),">>",false);
this.jButtonAbrirOrderByToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonAbrirOrderByToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"orden","orden","Orden" + FuncionesSwing.getKeyMensaje("ORDEN"),"Orden",false);
this.jButtonNuevoRelacionesToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoRelacionesToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"nuevo_relaciones","nuevo_relaciones","NUEVO RELACIONES" + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES"),"NUEVO RELACIONES",false);
this.jButtonMostrarOcultarTablaToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonMostrarOcultarTablaToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"mostrar_ocultar","mostrar_ocultar","Mostrar Ocultar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"),"Mostrar Ocultar",false);
this.jButtonCerrarToolBarCuentaContaDetaGrupoActi=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCerrarToolBarCuentaContaDetaGrupoActi,this.jTtoolBarCuentaContaDetaGrupoActi,
"cerrar","cerrar","Salir"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR"),"Salir",false);
//this.jButtonNuevoRelacionesToolBarCuentaContaDetaGrupoActi=new JButtonMe();
//protected JButton jButtonNuevoRelacionesToolBarCuentaContaDetaGrupoActi;
this.jButtonProcesarInformacionToolBarCuentaContaDetaGrupoActi=new JButtonMe();
//protected JButton jButtonProcesarInformacionToolBarCuentaContaDetaGrupoActi;
//protected JButton jButtonModificarToolBarCuentaContaDetaGrupoActi;
//PRINCIPAL
//DETALLE
//DETALLE_FIN
}
public void cargarMenus() {
this.jmenuBarCuentaContaDetaGrupoActi=new JMenuBarMe();
//PRINCIPAL
this.jmenuCuentaContaDetaGrupoActi=new JMenuMe("General");
this.jmenuArchivoCuentaContaDetaGrupoActi=new JMenuMe("Archivo");
this.jmenuAccionesCuentaContaDetaGrupoActi=new JMenuMe("Acciones");
this.jmenuDatosCuentaContaDetaGrupoActi=new JMenuMe("Datos");
//PRINCIPAL_FIN
//DETALLE
//DETALLE_FIN
this.jMenuItemNuevoCuentaContaDetaGrupoActi= new JMenuItem("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO"));
this.jMenuItemNuevoCuentaContaDetaGrupoActi.setActionCommand("Nuevo");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoCuentaContaDetaGrupoActi,"nuevo_button","Nuevo");
FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemDuplicarCuentaContaDetaGrupoActi= new JMenuItem("Duplicar" + FuncionesSwing.getKeyMensaje("DUPLICAR"));
this.jMenuItemDuplicarCuentaContaDetaGrupoActi.setActionCommand("Duplicar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDuplicarCuentaContaDetaGrupoActi,"duplicar_button","Duplicar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemDuplicarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi= new JMenuItem("Nuevo Rel" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"));
this.jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi.setActionCommand("Nuevo Rel");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi,"nuevorelaciones_button","Nuevo Rel");
FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemGuardarCambiosCuentaContaDetaGrupoActi= new JMenuItem("Guardar" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"));
this.jMenuItemGuardarCambiosCuentaContaDetaGrupoActi.setActionCommand("Guardar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosCuentaContaDetaGrupoActi,"guardarcambios_button","Guardar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemCopiarCuentaContaDetaGrupoActi= new JMenuItem("Copiar" + FuncionesSwing.getKeyMensaje("COPIAR"));
this.jMenuItemCopiarCuentaContaDetaGrupoActi.setActionCommand("Copiar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCopiarCuentaContaDetaGrupoActi,"copiar_button","Copiar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemCopiarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemVerFormCuentaContaDetaGrupoActi= new JMenuItem("Ver" + FuncionesSwing.getKeyMensaje("VER_FORM"));
this.jMenuItemVerFormCuentaContaDetaGrupoActi.setActionCommand("Ver");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemVerFormCuentaContaDetaGrupoActi,"ver_form_button","Ver");
FuncionesSwing.setBoldMenuItem(this.jMenuItemVerFormCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi= new JMenuItem("Guardar Tabla" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"));
this.jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi.setActionCommand("Guardar Tabla");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi,"guardarcambiostabla_button","Guardar Tabla");
FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemCerrarCuentaContaDetaGrupoActi= new JMenuItem("Salir" + FuncionesSwing.getKeyMensaje("CERRAR"));
this.jMenuItemCerrarCuentaContaDetaGrupoActi.setActionCommand("Cerrar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCerrarCuentaContaDetaGrupoActi,"cerrar_button","Salir");
FuncionesSwing.setBoldMenuItem(this.jMenuItemCerrarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemRecargarInformacionCuentaContaDetaGrupoActi= new JMenuItem("Recargar" + FuncionesSwing.getKeyMensaje("RECARGAR"));
this.jMenuItemRecargarInformacionCuentaContaDetaGrupoActi.setActionCommand("Recargar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemRecargarInformacionCuentaContaDetaGrupoActi,"recargar_button","Recargar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemRecargarInformacionCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemProcesarInformacionCuentaContaDetaGrupoActi= new JMenuItem("Procesar Informacion");
this.jMenuItemProcesarInformacionCuentaContaDetaGrupoActi.setActionCommand("Procesar Informacion");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemProcesarInformacionCuentaContaDetaGrupoActi,"procesar_button","Procesar Informacion");
this.jMenuItemAnterioresCuentaContaDetaGrupoActi= new JMenuItem("Anteriores" + FuncionesSwing.getKeyMensaje("ANTERIORES"));
this.jMenuItemAnterioresCuentaContaDetaGrupoActi.setActionCommand("Anteriores");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAnterioresCuentaContaDetaGrupoActi,"anteriores_button","Anteriores");
FuncionesSwing.setBoldMenuItem(this.jMenuItemAnterioresCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemSiguientesCuentaContaDetaGrupoActi= new JMenuItem("Siguientes" + FuncionesSwing.getKeyMensaje("SIGUIENTES"));
this.jMenuItemSiguientesCuentaContaDetaGrupoActi.setActionCommand("Siguientes");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemSiguientesCuentaContaDetaGrupoActi,"siguientes_button","Siguientes");
FuncionesSwing.setBoldMenuItem(this.jMenuItemSiguientesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemAbrirOrderByCuentaContaDetaGrupoActi= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN"));
this.jMenuItemAbrirOrderByCuentaContaDetaGrupoActi.setActionCommand("Orden");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAbrirOrderByCuentaContaDetaGrupoActi,"orden_button","Orden");
FuncionesSwing.setBoldMenuItem(this.jMenuItemAbrirOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemMostrarOcultarCuentaContaDetaGrupoActi= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"));
this.jMenuItemMostrarOcultarCuentaContaDetaGrupoActi.setActionCommand("Mostrar Ocultar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemMostrarOcultarCuentaContaDetaGrupoActi,"mostrar_ocultar_button","Mostrar Ocultar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemMostrarOcultarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemDetalleAbrirOrderByCuentaContaDetaGrupoActi= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN"));
this.jMenuItemDetalleAbrirOrderByCuentaContaDetaGrupoActi.setActionCommand("Orden");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleAbrirOrderByCuentaContaDetaGrupoActi,"orden_button","Orden");
FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleAbrirOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemDetalleMostarOcultarCuentaContaDetaGrupoActi= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"));
this.jMenuItemDetalleMostarOcultarCuentaContaDetaGrupoActi.setActionCommand("Mostrar Ocultar");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleMostarOcultarCuentaContaDetaGrupoActi,"mostrar_ocultar_button","Mostrar Ocultar");
FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleMostarOcultarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi= new JMenuItem("Nuevo Tabla" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"));
this.jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi.setActionCommand("Nuevo Tabla");
FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi,"nuevoguardarcambios_button","Nuevo");
FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
//PRINCIPAL
if(!this.conCargarMinimo) {
this.jmenuArchivoCuentaContaDetaGrupoActi.add(this.jMenuItemCerrarCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemNuevoCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemNuevoGuardarCambiosCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemNuevoRelacionesCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemGuardarCambiosTablaCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemDuplicarCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemCopiarCuentaContaDetaGrupoActi);
this.jmenuAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemVerFormCuentaContaDetaGrupoActi);
this.jmenuDatosCuentaContaDetaGrupoActi.add(this.jMenuItemRecargarInformacionCuentaContaDetaGrupoActi);
this.jmenuDatosCuentaContaDetaGrupoActi.add(this.jMenuItemAnterioresCuentaContaDetaGrupoActi);
this.jmenuDatosCuentaContaDetaGrupoActi.add(this.jMenuItemSiguientesCuentaContaDetaGrupoActi);
this.jmenuDatosCuentaContaDetaGrupoActi.add(this.jMenuItemAbrirOrderByCuentaContaDetaGrupoActi);
this.jmenuDatosCuentaContaDetaGrupoActi.add(this.jMenuItemMostrarOcultarCuentaContaDetaGrupoActi);
}
//PRINCIPAL_FIN
//DETALLE
//this.jmenuDetalleAccionesCuentaContaDetaGrupoActi.add(this.jMenuItemGuardarCambiosCuentaContaDetaGrupoActi);
//DETALLE_FIN
//RELACIONES
//RELACIONES
//PRINCIPAL
if(!this.conCargarMinimo) {
FuncionesSwing.setBoldMenu(this.jmenuArchivoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldMenu(this.jmenuAccionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldMenu(this.jmenuDatosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jmenuBarCuentaContaDetaGrupoActi.add(this.jmenuArchivoCuentaContaDetaGrupoActi);
this.jmenuBarCuentaContaDetaGrupoActi.add(this.jmenuAccionesCuentaContaDetaGrupoActi);
this.jmenuBarCuentaContaDetaGrupoActi.add(this.jmenuDatosCuentaContaDetaGrupoActi);
}
//PRINCIPAL_FIN
//DETALLE
//DETALLE_FIN
//AGREGA MENU A PANTALLA
if(!this.conCargarMinimo) {
this.setJMenuBar(this.jmenuBarCuentaContaDetaGrupoActi);
}
//AGREGA MENU DETALLE A PANTALLA
}
public void inicializarElementosBusquedasCuentaContaDetaGrupoActi() {
//BYDAN_BUSQUEDAS
//INDICES BUSQUEDA
this.jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi=new JPanelMe("fondo_formulario",true);//new JPanel();
this.jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.setToolTipText("Buscar Por Cuenta Contable ");
this.jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi= new JButtonMe();
this.jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi.setText("Buscar");
this.jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi.setToolTipText("Buscar Por Cuenta Contable ");
FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi,"buscar_button","Buscar Por Cuenta Contable ");
FuncionesSwing.setBoldButton(this.jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi = new JLabelMe();
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setText("Cuenta Contable :");
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setToolTipText("Cuenta Contable");
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2));
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2));
jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2));
FuncionesSwing.setBoldLabel(jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi= new JComboBoxMe();
jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,70),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,70),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,70),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
FuncionesSwing.setBoldComboBox(jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi= new JButtonMe();
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL));
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL));
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL));
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setText("Buscar");
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setToolTipText("Buscar");
this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi.setFocusable(false);
this.jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi=new JPanelMe("fondo_formulario",true);//new JPanel();
this.jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setToolTipText("Buscar Por Detalle Grupo Activo Fijo ");
this.jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi= new JButtonMe();
this.jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setText("Buscar");
this.jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setToolTipText("Buscar Por Detalle Grupo Activo Fijo ");
FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi,"buscar_button","Buscar Por Detalle Grupo Activo Fijo ");
FuncionesSwing.setBoldButton(this.jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi = new JLabelMe();
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setText("Detalle Grupo Activo Fijo :");
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setToolTipText("Detalle Grupo Activo Fijo");
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2*2));
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2*2));
jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,0),Constantes2.ISWING_ALTO_CONTROL_LABEL2*2));
FuncionesSwing.setBoldLabel(jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi= new JComboBoxMe();
jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0)));
FuncionesSwing.setBoldComboBox(jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi=new JTabbedPane();
this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,0)));
this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,0)));
this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,0)));
//this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Busqueda"));
this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
FuncionesSwing.setBoldTabbedPane(this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
//INDICES BUSQUEDA_FIN
}
//JPanel
//@SuppressWarnings({"unchecked" })//"rawtypes"
public JScrollPane getJContentPane(int iWidth,int iHeight,JDesktopPane jDesktopPane,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception {
//PARA TABLA PARAMETROS
String sKeyStrokeName="";
KeyStroke keyStrokeControl=null;
this.jContentPane = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.usuarioActual=usuarioActual;
this.resumenUsuarioActual=resumenUsuarioActual;
this.opcionActual=opcionActual;
this.moduloActual=moduloActual;
this.parametroGeneralSg=parametroGeneralSg;
this.parametroGeneralUsuario=parametroGeneralUsuario;
this.jDesktopPane=jDesktopPane;
this.conFuncionalidadRelaciones=parametroGeneralUsuario.getcon_guardar_relaciones();
int iGridyPrincipal=0;
this.inicializarToolBar();
//CARGAR MENUS
if(this.conCargarFormDetalle) { //true) {
//this.jInternalFrameDetalleCuentaContaDetaGrupoActi = new CuentaContaDetaGrupoActiDetalleJInternalFrame(paginaTipo);//JInternalFrameBase("Cuenta Conta Deta Grupo Acti DATOS");
this.jInternalFrameDetalleFormCuentaContaDetaGrupoActi = new CuentaContaDetaGrupoActiDetalleFormJInternalFrame(jDesktopPane,this.cuentacontadetagrupoactiSessionBean.getConGuardarRelaciones(),this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado(),cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo);
} else {
this.jInternalFrameDetalleFormCuentaContaDetaGrupoActi = null;//new CuentaContaDetaGrupoActiDetalleFormJInternalFrame("MINIMO");
}
this.cargarMenus();
this.gridaBagLayoutCuentaContaDetaGrupoActi= new GridBagLayout();
this.jTableDatosCuentaContaDetaGrupoActi = new JTableMe();
String sToolTipCuentaContaDetaGrupoActi="";
sToolTipCuentaContaDetaGrupoActi=CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO;
if(Constantes.ISDEVELOPING) {
sToolTipCuentaContaDetaGrupoActi+="(ActivosFijos.CuentaContaDetaGrupoActi)";
}
if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
sToolTipCuentaContaDetaGrupoActi+="_"+this.opcionActual.getId();
}
this.jTableDatosCuentaContaDetaGrupoActi.setToolTipText(sToolTipCuentaContaDetaGrupoActi);
//SE DEFINE EN DETALLE
//FuncionesSwing.setBoldLabelTable(this.jTableDatosCuentaContaDetaGrupoActi);
this.jTableDatosCuentaContaDetaGrupoActi.setAutoCreateRowSorter(true);
this.jTableDatosCuentaContaDetaGrupoActi.setRowHeight(Constantes.ISWING_ALTO_FILA_TABLA + Constantes.ISWING_ALTO_FILA_TABLA_EXTRA_FECHA);
//MULTIPLE SELECTION
this.jTableDatosCuentaContaDetaGrupoActi.setRowSelectionAllowed(true);
this.jTableDatosCuentaContaDetaGrupoActi.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
FuncionesSwing.setBoldTable(jTableDatosCuentaContaDetaGrupoActi,STIPO_TAMANIO_GENERAL,false,true,this);
this.jButtonNuevoCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonDuplicarCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonCopiarCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonVerFormCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonCerrarCuentaContaDetaGrupoActi = new JButtonMe();
this.jScrollPanelDatosCuentaContaDetaGrupoActi = new JScrollPane();
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi = new JScrollPane();
this.jPanelAccionesCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);
//if(!this.conCargarMinimo) {
;
//}
this.sPath=" <---> Acceso: Cuenta Conta Deta Grupo Acti";
if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Cuenta Conta Deta Grupo Actis" + this.sPath));
} else {
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Edicion Datos"));
this.jPanelAccionesCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Acciones"));
this.jPanelAccionesCuentaContaDetaGrupoActi.setToolTipText("Acciones");
this.jPanelAccionesCuentaContaDetaGrupoActi.setName("Acciones");
FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,false,this);
FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,false,this);
//if(!this.conCargarMinimo) {
;
//}
//ELEMENTOS TABLAS PARAMETOS
if(!this.conCargarMinimo) {
}
//ELEMENTOS TABLAS PARAMETOS_FIN
if(!this.conCargarMinimo) {
//REPORTE DINAMICO
//NO CARGAR INICIALMENTE, EN BOTON AL ABRIR
//this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi=new ReporteDinamicoJInternalFrame(CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO,this);
//this.cargarReporteDinamicoCuentaContaDetaGrupoActi();
//IMPORTACION
//NO CARGAR INICIALMENTE, EN BOTON AL ABRIR
//this.jInternalFrameImportacionCuentaContaDetaGrupoActi=new ImportacionJInternalFrame(CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO,this);
//this.cargarImportacionCuentaContaDetaGrupoActi();
}
String sMapKey = "";
InputMap inputMap =null;
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.setText("Orden");
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByCuentaContaDetaGrupoActi,"orden_button","Orden");
FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
sMapKey = "AbrirOrderBySistema";
inputMap = this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey);
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderBySistema"));
if(!this.conCargarMinimo) {
//NO CARGAR INICIALMENTE, EN BOTON AL ABRIR
//this.jInternalFrameOrderByCuentaContaDetaGrupoActi=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByCuentaContaDetaGrupoActi,false,this);
//this.cargarOrderByCuentaContaDetaGrupoActi(false);
} else {
//NO CARGAR INICIALMENTE, EN BOTON AL ABRIR
//this.jInternalFrameOrderByCuentaContaDetaGrupoActi=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByCuentaContaDetaGrupoActi,true,this);
//this.cargarOrderByCuentaContaDetaGrupoActi(true);
}
//VALORES PARA DISENO
/*
this.jTableDatosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(400,50));//430
this.jTableDatosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(400,50));//430
this.jTableDatosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(400,50));//430
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(400,50));
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(400,50));
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(400,50));
*/
this.jButtonNuevoCuentaContaDetaGrupoActi.setText("Nuevo");
this.jButtonDuplicarCuentaContaDetaGrupoActi.setText("Duplicar");
this.jButtonCopiarCuentaContaDetaGrupoActi.setText("Copiar");
this.jButtonVerFormCuentaContaDetaGrupoActi.setText("Ver");
this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi.setText("Nuevo Rel");
this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi.setText("Guardar");
this.jButtonCerrarCuentaContaDetaGrupoActi.setText("Salir");
FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoCuentaContaDetaGrupoActi,"nuevo_button","Nuevo",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonDuplicarCuentaContaDetaGrupoActi,"duplicar_button","Duplicar",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonCopiarCuentaContaDetaGrupoActi,"copiar_button","Copiar",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonVerFormCuentaContaDetaGrupoActi,"ver_form","Ver",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi,"nuevorelaciones_button","Nuevo Rel",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi,"guardarcambiostabla_button","Guardar",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarCuentaContaDetaGrupoActi,"cerrar_button","Salir",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.setBoldButton(this.jButtonNuevoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonDuplicarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonCopiarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonVerFormCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
FuncionesSwing.setBoldButton(this.jButtonCerrarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jButtonNuevoCuentaContaDetaGrupoActi.setToolTipText("Nuevo"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO"));
this.jButtonDuplicarCuentaContaDetaGrupoActi.setToolTipText("Duplicar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR"));
this.jButtonCopiarCuentaContaDetaGrupoActi.setToolTipText("Copiar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("COPIAR"));
this.jButtonVerFormCuentaContaDetaGrupoActi.setToolTipText("Ver"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("VER_FORM"));
this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi.setToolTipText("Nuevo Rel"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES"));
this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi.setToolTipText("Guardar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"));
this.jButtonCerrarCuentaContaDetaGrupoActi.setToolTipText("Salir"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR"));
//HOT KEYS
/*
N->Nuevo
N->Alt + Nuevo Relaciones (ANTES R)
A->Actualizar
E->Eliminar
S->Cerrar
C->->Mayus + Cancelar (ANTES Q->Quit)
G->Guardar Cambios
D->Duplicar
C->Alt + Cop?ar
O->Orden
N->Nuevo Tabla
R->Recargar Informacion Inicial (ANTES I)
Alt + Pag.Down->Siguientes
Alt + Pag.Up->Anteriores
NO UTILIZADOS
M->Modificar
*/
//String sMapKey = "";
//InputMap inputMap =null;
//NUEVO
sMapKey = "NuevoCuentaContaDetaGrupoActi";
inputMap = this.jButtonNuevoCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO") , FuncionesSwing.getMaskKey("NUEVO")), sMapKey);
this.jButtonNuevoCuentaContaDetaGrupoActi.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"NuevoCuentaContaDetaGrupoActi"));
//DUPLICAR
sMapKey = "DuplicarCuentaContaDetaGrupoActi";
inputMap = this.jButtonDuplicarCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("DUPLICAR") , FuncionesSwing.getMaskKey("DUPLICAR")), sMapKey);
this.jButtonDuplicarCuentaContaDetaGrupoActi.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"DuplicarCuentaContaDetaGrupoActi"));
//COPIAR
sMapKey = "CopiarCuentaContaDetaGrupoActi";
inputMap = this.jButtonCopiarCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("COPIAR") , FuncionesSwing.getMaskKey("COPIAR")), sMapKey);
this.jButtonCopiarCuentaContaDetaGrupoActi.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"CopiarCuentaContaDetaGrupoActi"));
//VEr FORM
sMapKey = "VerFormCuentaContaDetaGrupoActi";
inputMap = this.jButtonVerFormCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("VER_FORM") , FuncionesSwing.getMaskKey("VER_FORM")), sMapKey);
this.jButtonVerFormCuentaContaDetaGrupoActi.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"VerFormCuentaContaDetaGrupoActi"));
//NUEVO RELACIONES
sMapKey = "NuevoRelacionesCuentaContaDetaGrupoActi";
inputMap = this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_RELACIONES") , FuncionesSwing.getMaskKey("NUEVO_RELACIONES")), sMapKey);
this.jButtonNuevoRelacionesCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoRelacionesCuentaContaDetaGrupoActi"));
//MODIFICAR
/*
sMapKey = "ModificarCuentaContaDetaGrupoActi";
inputMap = this.jButtonModificarCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("MODIFICAR") , FuncionesSwing.getMaskKey("MODIFICAR")), sMapKey);
this.jButtonModificarCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"ModificarCuentaContaDetaGrupoActi"));
*/
//CERRAR
sMapKey = "CerrarCuentaContaDetaGrupoActi";
inputMap = this.jButtonCerrarCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("CERRAR") , FuncionesSwing.getMaskKey("CERRAR")), sMapKey);
this.jButtonCerrarCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"CerrarCuentaContaDetaGrupoActi"));
//GUARDAR CAMBIOS
sMapKey = "GuardarCambiosTablaCuentaContaDetaGrupoActi";
inputMap = this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("GUARDAR_CAMBIOS") , FuncionesSwing.getMaskKey("GUARDAR_CAMBIOS")), sMapKey);
this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"GuardarCambiosTablaCuentaContaDetaGrupoActi"));
//ABRIR ORDER BY
if(!this.conCargarMinimo) {
}
//HOT KEYS
this.jPanelParametrosReportesCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelPaginacionCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosAuxiliar2CuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosAuxiliar4CuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
//this.jPanelParametrosAuxiliar5CuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Reportes-Acciones"));
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.setName("jPanelParametrosReportesCuentaContaDetaGrupoActi");
this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Acciones"));
//this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi.setName("jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi");
FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,false,this);
FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,false,this);
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.setText("Recargar");
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.setToolTipText("Recargar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonRecargarInformacionCuentaContaDetaGrupoActi,"recargar_button","Recargar");
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setText("Procesar");
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setToolTipText("Procesar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setVisible(false);
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(185,25));
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(185,25));
this.jButtonProcesarInformacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(185,25));
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setText("TIPO");
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setToolTipText("Tipos De Archivo");
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setText("TIPO");
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi.setToolTipText("Tipos De Reporte");
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setText("TIPO");
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi.setToolTipText("Tipos De Reporte");
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi.setText("Paginacion");
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi.setToolTipText("Tipos De Paginacion");
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi.setText("Accion");
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi.setToolTipText("Tipos de Relaciones");
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi.setText("Accion");
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi.setToolTipText("Tipos de Acciones");
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi = new JComboBoxMe();
//this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi.setText("Accion");
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi.setToolTipText("Tipos de Seleccion");
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi=new JTextFieldMe();
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL));
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL));
this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL));
this.jLabelAccionesCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelAccionesCuentaContaDetaGrupoActi.setText("Acciones");
this.jLabelAccionesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelAccionesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelAccionesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi = new JCheckBoxMe();
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi.setText("Sel. Todos");
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi.setToolTipText("Sel. Todos");
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi = new JCheckBoxMe();
//this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi.setText("Seleccionados");
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi.setToolTipText("SELECCIONAR SELECCIONADOS");
this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi = new JCheckBoxMe();
//this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.setText("Con Maximo Alto Tabla");
this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.setToolTipText("Con Maximo Alto Tabla");
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi = new JCheckBoxMe();
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi.setText("Graf.");
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi.setToolTipText("Con Grafico");
this.jButtonAnterioresCuentaContaDetaGrupoActi = new JButtonMe();
//this.jButtonAnterioresCuentaContaDetaGrupoActi.setText("<<");
this.jButtonAnterioresCuentaContaDetaGrupoActi.setToolTipText("Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonAnterioresCuentaContaDetaGrupoActi,"anteriores_button","<<");
FuncionesSwing.setBoldButton(this.jButtonAnterioresCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jButtonSiguientesCuentaContaDetaGrupoActi = new JButtonMe();
//this.jButtonSiguientesCuentaContaDetaGrupoActi.setText(">>");
this.jButtonSiguientesCuentaContaDetaGrupoActi.setToolTipText("Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonSiguientesCuentaContaDetaGrupoActi,"siguientes_button",">>");
FuncionesSwing.setBoldButton(this.jButtonSiguientesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi.setText("Nue");
this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi.setToolTipText("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi,"nuevoguardarcambios_button","Nue",this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado());
FuncionesSwing.setBoldButton(this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
//HOT KEYS2
/*
T->Nuevo Tabla
*/
//NUEVO GUARDAR CAMBIOS O NUEVO TABLA
sMapKey = "NuevoGuardarCambiosCuentaContaDetaGrupoActi";
inputMap = this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_TABLA") , FuncionesSwing.getMaskKey("NUEVO_TABLA")), sMapKey);
this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoGuardarCambiosCuentaContaDetaGrupoActi"));
//RECARGAR
sMapKey = "RecargarInformacionCuentaContaDetaGrupoActi";
inputMap = this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("RECARGAR") , FuncionesSwing.getMaskKey("RECARGAR")), sMapKey);
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"RecargarInformacionCuentaContaDetaGrupoActi"));
//SIGUIENTES
sMapKey = "SiguientesCuentaContaDetaGrupoActi";
inputMap = this.jButtonSiguientesCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("SIGUIENTES") , FuncionesSwing.getMaskKey("SIGUIENTES")), sMapKey);
this.jButtonSiguientesCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"SiguientesCuentaContaDetaGrupoActi"));
//ANTERIORES
sMapKey = "AnterioresCuentaContaDetaGrupoActi";
inputMap = this.jButtonAnterioresCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ANTERIORES") , FuncionesSwing.getMaskKey("ANTERIORES")), sMapKey);
this.jButtonAnterioresCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AnterioresCuentaContaDetaGrupoActi"));
//HOT KEYS2
//DETALLE
//TOOLBAR
//INDICES BUSQUEDA
//INDICES BUSQUEDA_FIN
//INDICES BUSQUEDA
if(!this.conCargarMinimo) {
this.inicializarElementosBusquedasCuentaContaDetaGrupoActi();
}
//INDICES BUSQUEDA_FIN
//ELEMENTOS TABLAS PARAMETOS
if(!this.conCargarMinimo) {
}
//ELEMENTOS TABLAS PARAMETOS_FIN
//ELEMENTOS TABLAS PARAMETOS_FIN
//ESTA EN BEAN
/*
this.jTabbedPaneRelacionesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(this.getWidth(),CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES,0)));
this.jTabbedPaneRelacionesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(this.getWidth(),CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES,0)));
this.jTabbedPaneRelacionesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(this.getWidth(),CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(CuentaContaDetaGrupoActiBean.ALTO_TABPANE_RELACIONES,0)));
*/
int iPosXAccionPaginacion=0;
GridBagLayout gridaBagLayoutPaginacionCuentaContaDetaGrupoActi = new GridBagLayout();
this.jPanelPaginacionCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutPaginacionCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.EAST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonAnterioresCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonNuevoGuardarCambiosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonSiguientesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
iPosXAccionPaginacion=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonNuevoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()
&& !this.conCargarMinimo) {
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonGuardarCambiosTablaCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonDuplicarCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonCopiarCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonVerFormCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXAccionPaginacion++;
this.jPanelPaginacionCuentaContaDetaGrupoActi.add(this.jButtonCerrarCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(95,25));
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(95,25));
this.jButtonRecargarInformacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(95,25));
FuncionesSwing.setBoldButton(this.jButtonRecargarInformacionCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(105,20));
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(105,20));
this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(105,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(100,20));
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(100,20));
this.jComboBoxTiposReportesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(100,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(80,20));
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(80,20));
this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(80,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposGraficosReportesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(80,20));
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(80,20));
this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(80,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(145,20));
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(145,20));
this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(145,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposRelacionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(145,20));
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(145,20));
this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(145,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(145,20));
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(145,20));
this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(145,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(20,20));
this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(20,20));
this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(20,20));
FuncionesSwing.setBoldCheckBox(this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(60,20));
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(60,20));
this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(60,20));
FuncionesSwing.setBoldCheckBox(this.jCheckBoxConGraficoReporteCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(100,20));
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(100,20));
this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(100,20));
FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(20,20));
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(20,20));
this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(20,20));
FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
GridBagLayout gridaBagParametrosReportesCuentaContaDetaGrupoActi = new GridBagLayout();
GridBagLayout gridaBagParametrosReportesAccionesCuentaContaDetaGrupoActi = new GridBagLayout();
GridBagLayout gridaBagParametrosAuxiliar1CuentaContaDetaGrupoActi = new GridBagLayout();
GridBagLayout gridaBagParametrosAuxiliar2CuentaContaDetaGrupoActi = new GridBagLayout();
GridBagLayout gridaBagParametrosAuxiliar3CuentaContaDetaGrupoActi = new GridBagLayout();
GridBagLayout gridaBagParametrosAuxiliar4CuentaContaDetaGrupoActi = new GridBagLayout();
int iGridxParametrosReportes=0;
int iGridyParametrosReportes=0;
int iGridxParametrosAuxiliar=0;
int iGridyParametrosAuxiliar=0;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.setLayout(gridaBagParametrosReportesCuentaContaDetaGrupoActi);
this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi.setLayout(gridaBagParametrosReportesAccionesCuentaContaDetaGrupoActi);
this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi.setLayout(gridaBagParametrosAuxiliar1CuentaContaDetaGrupoActi);
this.jPanelParametrosAuxiliar2CuentaContaDetaGrupoActi.setLayout(gridaBagParametrosAuxiliar2CuentaContaDetaGrupoActi);
this.jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi.setLayout(gridaBagParametrosAuxiliar3CuentaContaDetaGrupoActi);
this.jPanelParametrosAuxiliar4CuentaContaDetaGrupoActi.setLayout(gridaBagParametrosAuxiliar4CuentaContaDetaGrupoActi);
//this.jPanelParametrosAuxiliar5CuentaContaDetaGrupoActi.setLayout(gridaBagParametrosAuxiliar2CuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jButtonRecargarInformacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//PAGINACION
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi.add(this.jComboBoxTiposPaginacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//CON ALTO MAXIMO TABLA
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi.add(this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//TIPOS ARCHIVOS REPORTES
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi.add(this.jComboBoxTiposArchivosReportesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jPanelParametrosAuxiliar1CuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR FIN
//AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES
iGridxParametrosAuxiliar=0;
iGridyParametrosAuxiliar=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar4CuentaContaDetaGrupoActi.add(this.jComboBoxTiposReportesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES
//USANDO AUXILIAR 4
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jPanelParametrosAuxiliar4CuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR 4 FIN
//TIPOS REPORTES
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jComboBoxTiposReportesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
//GENERAR REPORTE (jCheckBoxExportar)
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jCheckBoxGenerarReporteCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
iGridxParametrosAuxiliar=0;
iGridyParametrosAuxiliar=0;
//USANDO AUXILIAR
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jPanelParametrosAuxiliar2CuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR FIN
//PARAMETROS ACCIONES
//iGridxParametrosReportes=1;
iGridxParametrosReportes=0;
iGridyParametrosReportes=1;
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jLabelAccionesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
//PARAMETROS_ACCIONES-PARAMETROS_REPORTES
//ORDER BY
if(!this.conCargarMinimo) {
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jButtonAbrirOrderByCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
//PARAMETROS_ACCIONES-PARAMETROS_REPORTES
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jComboBoxTiposSeleccionarCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
iGridxParametrosAuxiliar=0;
iGridyParametrosAuxiliar=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi.add(this.jCheckBoxSeleccionarTodosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi.add(this.jCheckBoxSeleccionadosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR3
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
//this.jPanelParametrosReportes
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jPanelParametrosAuxiliar3CuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//USANDO AUXILIAR3 FIN
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jComboBoxTiposAccionesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyParametrosReportes;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iGridxParametrosReportes++;
this.jPanelParametrosReportesCuentaContaDetaGrupoActi.add(this.jTextFieldValorCampoGeneralCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
;
//ELEMENTOS TABLAS PARAMETOS
//SUBPANELES POR CAMPO
if(!this.conCargarMinimo) {
//SUBPANELES EN PANEL CAMPOS
}
//ELEMENTOS TABLAS PARAMETOS_FIN
/*
GridBagLayout gridaBagLayoutDatosCuentaContaDetaGrupoActi = new GridBagLayout();
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutDatosCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jScrollPanelDatosCuentaContaDetaGrupoActi.add(this.jTableDatosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
this.redimensionarTablaDatos(-1);
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setViewportView(this.jTableDatosCuentaContaDetaGrupoActi);
this.jTableDatosCuentaContaDetaGrupoActi.setFillsViewportHeight(true);
this.jTableDatosCuentaContaDetaGrupoActi.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
Integer iGridXParametrosAccionesFormulario=0;
Integer iGridYParametrosAccionesFormulario=0;
GridBagLayout gridaBagLayoutAccionesCuentaContaDetaGrupoActi= new GridBagLayout();
this.jPanelAccionesCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutAccionesCuentaContaDetaGrupoActi);
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jPanelAccionesCuentaContaDetaGrupoActi.add(this.jButtonNuevoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
int iPosXAccion=0;
if(!this.conCargarMinimo) {
//BYDAN_BUSQUEDAS
GridBagLayout gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi= new GridBagLayout();
gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi.rowHeights = new int[] {1};
gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi.columnWidths = new int[] {1};
gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi.rowWeights = new double[]{0.0, 0.0, 0.0};
gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi.columnWeights = new double[]{0.0, 1.0};
jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutFK_IdCuentaContableCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.add(jLabelid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 1;
jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.add(jComboBoxid_cuenta_contableFK_IdCuentaContableCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.EAST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.NONE;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.add(this.jButtonBuscarFK_IdCuentaContableid_cuenta_contableCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx =1;
jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi.add(jButtonFK_IdCuentaContableCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
jTabbedPaneBusquedasCuentaContaDetaGrupoActi.addTab("1.-Por Cuenta Contable ", jPanelFK_IdCuentaContableCuentaContaDetaGrupoActi);
jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setMnemonicAt(0, KeyEvent.VK_1);
GridBagLayout gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi= new GridBagLayout();
gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.rowHeights = new int[] {1};
gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.columnWidths = new int[] {1};
gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.rowWeights = new double[]{0.0, 0.0, 0.0};
gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.columnWeights = new double[]{0.0, 1.0};
jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.add(jLabelid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 0;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 1;
jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.add(jComboBoxid_detalle_grupo_activo_fijoFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.WEST;
gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
gridBagConstraintsCuentaContaDetaGrupoActi.gridy = 1;
gridBagConstraintsCuentaContaDetaGrupoActi.gridx =1;
jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi.add(jButtonFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi, gridBagConstraintsCuentaContaDetaGrupoActi);
jTabbedPaneBusquedasCuentaContaDetaGrupoActi.addTab("2.-Por Detalle Grupo Activo Fijo ", jPanelFK_IdDetalleGrupoActivoFijoCuentaContaDetaGrupoActi);
jTabbedPaneBusquedasCuentaContaDetaGrupoActi.setMnemonicAt(1, KeyEvent.VK_2);
}
//this.setJProgressBarToJPanel();
GridBagLayout gridaBagLayoutCuentaContaDetaGrupoActi = new GridBagLayout();
this.jContentPane.setLayout(gridaBagLayoutCuentaContaDetaGrupoActi);
if(this.parametroGeneralUsuario.getcon_botones_tool_bar() && !this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.fill =GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.CENTER;//.CENTER;NORTH
this.gridBagConstraintsCuentaContaDetaGrupoActi.ipadx = 100;
this.jContentPane.add(this.jTtoolBarCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
//PROCESANDO EN OTRA PANTALLA
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.fill =GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.CENTER;
this.gridBagConstraintsCuentaContaDetaGrupoActi.ipadx = 100;
this.jContentPane.add(this.jPanelProgressProcess, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
int iGridxBusquedasParametros=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
if(!this.conCargarMinimo) {
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill =GridBagConstraints.VERTICAL;//GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.anchor = GridBagConstraints.NORTHWEST;
this.gridBagConstraintsCuentaContaDetaGrupoActi.ipadx = 150;
if(!this.conCargarMinimo) {
this.jContentPane.add(this.jTabbedPaneBusquedasCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
}
//PARAMETROS TABLAS PARAMETROS
if(!this.conCargarMinimo) {
}
//PARAMETROS TABLAS PARAMETROS_FIN
//PARAMETROS REPORTES
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jContentPane.add(this.jPanelParametrosReportesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jContentPane.add(this.jPanelParametrosReportesAccionesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =0;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.BOTH;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.ipady =150;
this.jContentPane.add(this.jScrollPanelDatosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jContentPane.add(this.jPanelPaginacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
iWidthScroll=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO_RELSCROLL)+(250*0);
iHeightScroll=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO_RELSCROLL);
if(CuentaContaDetaGrupoActiJInternalFrame.CON_DATOS_FRAME) {
this.jPanelBusquedasParametrosCuentaContaDetaGrupoActi= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel();
int iGridyRelaciones=0;
GridBagLayout gridaBagLayoutBusquedasParametrosCuentaContaDetaGrupoActi = new GridBagLayout();
this.jPanelBusquedasParametrosCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutBusquedasParametrosCuentaContaDetaGrupoActi);
if(this.parametroGeneralUsuario.getcon_botones_tool_bar()) {
}
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi= new JScrollPane(jContentPane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthScroll,iHeightScroll));
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthScroll,iHeightScroll));
this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthScroll,iHeightScroll));
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
//if(!this.conCargarMinimo) {
//}
this.conMaximoRelaciones=true;
if(this.parametroGeneralUsuario.getcon_cargar_por_parte()) {
}
Boolean tieneColumnasOcultas=false;
if(!Constantes.ISDEVELOPING) {
} else {
if(tieneColumnasOcultas) {
}
}
} else {
//DISENO_DETALLE COMENTAR Y
//DISENO_DETALLE(Solo Descomentar Seccion Inferior)
//NOTA-DISENO_DETALLE(Si cambia lo de abajo, cambiar lo comentado, Al final no es lo mismo)
}
//DISENO_DETALLE-(Descomentar)
/*
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jContentPane.add(this.jPanelCamposCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = 0;
this.jContentPane.add(this.jPanelCamposOcultosCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iGridyPrincipal++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =0;
this.jContentPane.add(this.jPanelAccionesCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
*/
//pack();
return this.jScrollPanelDatosGeneralCuentaContaDetaGrupoActi;//jContentPane;
}
/*
public void cargarReporteDinamicoCuentaContaDetaGrupoActi() throws Exception {
int iWidthReporteDinamico=350;
int iHeightReporteDinamico=450;//250;400;
int iPosXReporteDinamico=0;
int iPosYReporteDinamico=0;
GridBagLayout gridaBagLayoutReporteDinamicoCuentaContaDetaGrupoActi = new GridBagLayout();
//PANEL
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos"));
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setName("jPanelReporteDinamicoCuentaContaDetaGrupoActi");
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutReporteDinamicoCuentaContaDetaGrupoActi);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi= new ReporteDinamicoJInternalFrame();
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi = new JScrollPane();
//PANEL_CONTROLES
//this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi= new JScrollPane();
//JINTERNAL FRAME
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setjInternalFrameParent(this);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setTitle("REPORTE DINAMICO");
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setSize(iWidthReporteDinamico+70,iHeightReporteDinamico+100);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y));
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setResizable(true);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setClosable(true);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setMaximizable(true);
//SCROLL PANEL
//this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
//this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
//this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico));
//this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Cuenta Conta Deta Grupo Actis"));
//CONTROLES-ELEMENTOS
//LABEL SELECT COLUMNAS
this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi.setText("Columnas Seleccion");
this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
iPosXReporteDinamico=0;
iPosYReporteDinamico=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jLabelColumnasSelectReporteCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//LISTA SELECT COLUMNAS
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi = new JList<Reporte>();
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi.setToolTipText("Tipos de Seleccion");
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(145,300));
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(145,300));
this.jListColumnasSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(145,300));
//SCROLL_PANEL_CONTROL
this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi=new JScrollPane(this.jListColumnasSelectReporteCuentaContaDetaGrupoActi);
this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(180,150));
this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(180,150));
this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(180,150));
this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("COLUMNAS"));
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
//this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jListColumnasSelectReporteCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//LABEL SELECT RELACIONES
this.jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi.setText("Relaciones Seleccion");
this.jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelRelacionesSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
//LABEL SELECT RELACIONES_FIN
//LISTA SELECT RELACIONES
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi = new JList<Reporte>();
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi.setToolTipText("Tipos de Seleccion");
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(145,300));
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(145,300));
this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(145,300));
//SCROLL_PANEL_CONTROL
this.jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi=new JScrollPane(this.jListRelacionesSelectReporteCuentaContaDetaGrupoActi);
this.jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(180,120));
this.jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(180,120));
this.jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(180,120));
this.jScrollRelacionesSelectReporteCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("RELACIONES"));
this.jCheckBoxConGraficoDinamicoCuentaContaDetaGrupoActi = new JCheckBoxMe();
this.jComboBoxColumnaCategoriaGraficoCuentaContaDetaGrupoActi = new JComboBoxMe();
this.jListColumnasValoresGraficoCuentaContaDetaGrupoActi = new JList<Reporte>();
//COMBO TIPOS REPORTES
this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi = new JComboBoxMe();
this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi.setToolTipText("Tipos De Reporte");
this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(100,20));
this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(100,20));
this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(100,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
//COMBO TIPOS REPORTES
//COMBO TIPOS ARCHIVOS
this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi = new JComboBoxMe();
this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi.setToolTipText("Tipos Archivos");
this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(100,20));
this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(100,20));
this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(100,20));
FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
//COMBO TIPOS ARCHIVOS
//LABEL GENERAR EXCEL
this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setText("Tipos de Reporte");
this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
iPosXReporteDinamico=0;
iPosYReporteDinamico++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jLabelGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON GENERAR EXCEL
this.jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setText("Generar Excel");
FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi,"generar_excel_reporte_dinamico_button","Generar EXCEL");
this.jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi.setToolTipText("Generar EXCEL"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
//this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
//this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
//this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jButtonGenerarExcelReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//COMBO TIPOS REPORTES
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jComboBoxTiposReportesDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//LABEL TIPOS DE ARCHIVO
this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi.setText("Tipos de Archivo");
this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
iPosXReporteDinamico=0;
iPosYReporteDinamico++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jLabelTiposArchivoReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//COMBO TIPOS ARCHIVOS
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jComboBoxTiposArchivosReportesDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON GENERAR
this.jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi.setText("Generar");
FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi,"generar_reporte_dinamico_button","Generar");
this.jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi.setToolTipText("Generar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
iPosXReporteDinamico=0;
iPosYReporteDinamico++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jButtonGenerarReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON CERRAR
this.jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi.setText("Cancelar");
FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi,"cerrar_reporte_dinamico_button","Cancelar");
this.jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi.setToolTipText("Cancelar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXReporteDinamico++;
this.jPanelReporteDinamicoCuentaContaDetaGrupoActi.add(this.jButtonCerrarReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//GLOBAL AGREGAR PANELES
GridBagLayout gridaBagLayoutReporteDinamicoPrincipalCuentaContaDetaGrupoActi = new GridBagLayout();
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi= new JScrollPane(jPanelReporteDinamicoCuentaContaDetaGrupoActi,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90));
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90));
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90));
this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Cuenta Conta Deta Grupo Actis"));
iPosXReporteDinamico=0;
iPosYReporteDinamico=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iPosYReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iPosXReporteDinamico;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.BOTH;
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true));
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.getContentPane().setLayout(gridaBagLayoutReporteDinamicoPrincipalCuentaContaDetaGrupoActi);
this.jInternalFrameReporteDinamicoCuentaContaDetaGrupoActi.getContentPane().add(this.jScrollPanelReporteDinamicoCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
*/
/*
public void cargarImportacionCuentaContaDetaGrupoActi() throws Exception {
int iWidthImportacion=350;
int iHeightImportacion=250;//400;
int iPosXImportacion=0;
int iPosYImportacion=0;
GridBagLayout gridaBagLayoutImportacionCuentaContaDetaGrupoActi = new GridBagLayout();
//PANEL
this.jPanelImportacionCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);
this.jPanelImportacionCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos"));
this.jPanelImportacionCuentaContaDetaGrupoActi.setName("jPanelImportacionCuentaContaDetaGrupoActi");
this.jPanelImportacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jPanelImportacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jPanelImportacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jPanelImportacionCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutImportacionCuentaContaDetaGrupoActi);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi= new ImportacionJInternalFrame();
//this.jInternalFrameImportacionCuentaContaDetaGrupoActi= new ImportacionJInternalFrame();
this.jScrollPanelImportacionCuentaContaDetaGrupoActi = new JScrollPane();
//PANEL_CONTROLES
//this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi= new JScrollPane();
//JINTERNAL FRAME
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setjInternalFrameParent(this);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setTitle("REPORTE DINAMICO");
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setSize(iWidthImportacion+70,iHeightImportacion+100);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y));
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setResizable(true);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setClosable(true);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setMaximizable(true);
//JINTERNAL FRAME IMPORTACION
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setjInternalFrameParent(this);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setTitle("IMPORTACION");
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setSize(iWidthImportacion+70,iHeightImportacion+100);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y));
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setResizable(true);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setClosable(true);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setMaximizable(true);
//SCROLL PANEL
this.jScrollPanelImportacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jScrollPanelImportacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jScrollPanelImportacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion));
this.jScrollPanelImportacionCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Cuenta Conta Deta Grupo Actis"));
//LABEL ARCHIVO IMPORTACION
this.jLabelArchivoImportacionCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelArchivoImportacionCuentaContaDetaGrupoActi.setText("ARCHIVO IMPORTACION");
this.jLabelArchivoImportacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelArchivoImportacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelArchivoImportacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
iPosXImportacion=0;
iPosYImportacion++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jLabelArchivoImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON ABRIR IMPORTACION
this.jFileChooserImportacionCuentaContaDetaGrupoActi = new JFileChooser();
this.jFileChooserImportacionCuentaContaDetaGrupoActi.setToolTipText("ESCOGER ARCHIVO"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
this.jButtonAbrirImportacionCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonAbrirImportacionCuentaContaDetaGrupoActi.setText("ESCOGER");
FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirImportacionCuentaContaDetaGrupoActi,"generar_importacion_button","ESCOGER");
this.jButtonAbrirImportacionCuentaContaDetaGrupoActi.setToolTipText("Generar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jButtonAbrirImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//LABEL PATH IMPORTACION
this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi = new JLabelMe();
this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi.setText("PATH ARCHIVO");
this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL));
iPosXImportacion=0;
iPosYImportacion++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.HORIZONTAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jLabelPathArchivoImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//PATH IMPORTACION
this.jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi=new JTextFieldMe();
this.jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL));
this.jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL));
this.jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL));
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jTextFieldPathArchivoImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON IMPORTACION
this.jButtonGenerarImportacionCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonGenerarImportacionCuentaContaDetaGrupoActi.setText("IMPORTAR");
FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarImportacionCuentaContaDetaGrupoActi,"generar_importacion_button","IMPORTAR");
this.jButtonGenerarImportacionCuentaContaDetaGrupoActi.setToolTipText("Generar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
iPosXImportacion=0;
iPosYImportacion++;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jButtonGenerarImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//BOTON CERRAR
this.jButtonCerrarImportacionCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonCerrarImportacionCuentaContaDetaGrupoActi.setText("Cancelar");
FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarImportacionCuentaContaDetaGrupoActi,"cerrar_reporte_dinamico_button","Cancelar");
this.jButtonCerrarImportacionCuentaContaDetaGrupoActi.setToolTipText("Cancelar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXImportacion++;
this.jPanelImportacionCuentaContaDetaGrupoActi.add(this.jButtonCerrarImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//GLOBAL AGREGAR PANELES
GridBagLayout gridaBagLayoutImportacionPrincipalCuentaContaDetaGrupoActi = new GridBagLayout();
this.jScrollPanelImportacionCuentaContaDetaGrupoActi= new JScrollPane(jPanelImportacionCuentaContaDetaGrupoActi,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
iPosXImportacion=0;
iPosYImportacion=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iPosYImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iPosXImportacion;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.BOTH;
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true));
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.getContentPane().setLayout(gridaBagLayoutImportacionPrincipalCuentaContaDetaGrupoActi);
this.jInternalFrameImportacionCuentaContaDetaGrupoActi.getContentPane().add(this.jScrollPanelImportacionCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
}
*/
/*
public void cargarOrderByCuentaContaDetaGrupoActi(Boolean cargaMinima) throws Exception {
String sMapKey = "";
InputMap inputMap =null;
int iWidthOrderBy=350;
int iHeightOrderBy=300;//400;
int iPosXOrderBy=0;
int iPosYOrderBy=0;
if(!cargaMinima) {
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.setText("Orden");
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN"));
FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByCuentaContaDetaGrupoActi,"orden_button","Orden");
FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
sMapKey = "AbrirOrderByCuentaContaDetaGrupoActi";
inputMap = this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL"));
inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey);
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderByCuentaContaDetaGrupoActi"));
GridBagLayout gridaBagLayoutOrderByCuentaContaDetaGrupoActi = new GridBagLayout();
//PANEL
this.jPanelOrderByCuentaContaDetaGrupoActi = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);
this.jPanelOrderByCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos"));
this.jPanelOrderByCuentaContaDetaGrupoActi.setName("jPanelOrderByCuentaContaDetaGrupoActi");
this.jPanelOrderByCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
this.jPanelOrderByCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
this.jPanelOrderByCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
FuncionesSwing.setBoldPanel(this.jPanelOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jPanelOrderByCuentaContaDetaGrupoActi.setLayout(gridaBagLayoutOrderByCuentaContaDetaGrupoActi);
this.jTableDatosCuentaContaDetaGrupoActiOrderBy = new JTableMe();
this.jTableDatosCuentaContaDetaGrupoActiOrderBy.setAutoCreateRowSorter(true);
FuncionesSwing.setBoldTable(jTableDatosCuentaContaDetaGrupoActiOrderBy,STIPO_TAMANIO_GENERAL,false,true,this);
this.jScrollPanelDatosCuentaContaDetaGrupoActiOrderBy = new JScrollPane();
this.jScrollPanelDatosCuentaContaDetaGrupoActiOrderBy.setBorder(javax.swing.BorderFactory.createTitledBorder("Orden"));
this.jScrollPanelDatosCuentaContaDetaGrupoActiOrderBy.setViewportView(this.jTableDatosCuentaContaDetaGrupoActiOrderBy);
this.jTableDatosCuentaContaDetaGrupoActiOrderBy.setFillsViewportHeight(true);
this.jTableDatosCuentaContaDetaGrupoActiOrderBy.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi= new OrderByJInternalFrame();
this.jInternalFrameOrderByCuentaContaDetaGrupoActi= new OrderByJInternalFrame();
this.jScrollPanelOrderByCuentaContaDetaGrupoActi = new JScrollPane();
//PANEL_CONTROLES
//this.jScrollColumnasSelectReporteCuentaContaDetaGrupoActi= new JScrollPane();
//JINTERNAL FRAME OrderBy
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setjInternalFrameParent(this);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setTitle("Orden");
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setSize(iWidthOrderBy+70,iHeightOrderBy+100);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y));
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setResizable(true);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setClosable(true);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setMaximizable(true);
//FuncionesSwing.setBoldPanel(this.jInternalFrameOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
//SCROLL PANEL
this.jScrollPanelOrderByCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
this.jScrollPanelOrderByCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
this.jScrollPanelOrderByCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy));
FuncionesSwing.setBoldScrollPanel(this.jScrollPanelOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.jScrollPanelOrderByCuentaContaDetaGrupoActi.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Cuenta Conta Deta Grupo Actis"));
//DATOS TOTALES
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iPosYOrderBy++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iPosXOrderBy;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.BOTH;
//this.gridBagConstraintsCuentaContaDetaGrupoActi.ipady =150;
this.jPanelOrderByCuentaContaDetaGrupoActi.add(jScrollPanelDatosCuentaContaDetaGrupoActiOrderBy, this.gridBagConstraintsCuentaContaDetaGrupoActi);//this.jTableDatosCuentaContaDetaGrupoActiTotales
//BOTON CERRAR
this.jButtonCerrarOrderByCuentaContaDetaGrupoActi = new JButtonMe();
this.jButtonCerrarOrderByCuentaContaDetaGrupoActi.setText("Salir");
FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarOrderByCuentaContaDetaGrupoActi,"cerrar","Salir");//cerrar_reporte_dinamico_button
this.jButtonCerrarOrderByCuentaContaDetaGrupoActi.setToolTipText("Cancelar"+" "+CuentaContaDetaGrupoActiConstantesFunciones.SCLASSWEBTITULO);
FuncionesSwing.setBoldButton(this.jButtonCerrarOrderByCuentaContaDetaGrupoActi, STIPO_TAMANIO_GENERAL,false,true,this);;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.VERTICAL;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy = iPosYOrderBy++;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx = iPosXOrderBy;
this.jPanelOrderByCuentaContaDetaGrupoActi.add(this.jButtonCerrarOrderByCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
//GLOBAL AGREGAR PANELES
GridBagLayout gridaBagLayoutOrderByPrincipalCuentaContaDetaGrupoActi = new GridBagLayout();
this.jScrollPanelOrderByCuentaContaDetaGrupoActi= new JScrollPane(jPanelOrderByCuentaContaDetaGrupoActi,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
iPosXOrderBy=0;
iPosYOrderBy=0;
this.gridBagConstraintsCuentaContaDetaGrupoActi = new GridBagConstraints();
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridy =iPosYOrderBy;
this.gridBagConstraintsCuentaContaDetaGrupoActi.gridx =iPosXOrderBy;
this.gridBagConstraintsCuentaContaDetaGrupoActi.fill = GridBagConstraints.BOTH;
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true));
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getContentPane().setLayout(gridaBagLayoutOrderByPrincipalCuentaContaDetaGrupoActi);
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getContentPane().add(this.jScrollPanelOrderByCuentaContaDetaGrupoActi, this.gridBagConstraintsCuentaContaDetaGrupoActi);
} else {
this.jButtonAbrirOrderByCuentaContaDetaGrupoActi = new JButtonMe();
}
}
*/
public void redimensionarTablaDatos(int iNumFilas) {
this.redimensionarTablaDatos(iNumFilas,0);
}
public void redimensionarTablaDatos(int iNumFilas,int iTamanioFilaTabla) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int iWidthTable=screenSize.width*2;//screenSize.width - (screenSize.width/8);
int iWidthTableScroll=screenSize.width - (screenSize.width/8);
int iWidthTableCalculado=0;//730
int iHeightTable=0;//screenSize.height/3;
int iHeightTableTotal=0;
//ANCHO COLUMNAS SIMPLES
iWidthTableCalculado+=430;
//ANCHO COLUMNAS OCULTAS
if(Constantes.ISDEVELOPING) {
iWidthTableCalculado+=300;
}
//ANCHO COLUMNAS RELACIONES
iWidthTableCalculado+=0;
//ESPACION PARA SELECT RELACIONES
if(this.conMaximoRelaciones
&& this.cuentacontadetagrupoactiSessionBean.getConGuardarRelaciones()
) {
}
//SI CALCULADO ES MENOR QUE MAXIMO
/*
if(iWidthTableCalculado<=iWidthTable) {
iWidthTable=iWidthTableCalculado;
}
*/
//SI TABLA ES MENOR QUE SCROLL
if(iWidthTableCalculado<=iWidthTableScroll) {
iWidthTableScroll=iWidthTableCalculado;
}
//NO VALE SIEMPRE PONE TAMANIO COLUMNA 200
/*
int iTotalWidth=0;
int iWidthColumn=0;
int iCountColumns=this.jTableDatosCuentaContaDetaGrupoActi.getColumnModel().getColumnCount();
if(iCountColumns>0) {
for(int i = 0; i < this.jTableDatosCuentaContaDetaGrupoActi.getColumnModel().getColumnCount(); i++) {
TableColumn column = this.jTableDatosCuentaContaDetaGrupoActi.getColumnModel().getColumn(i);
iWidthColumn=column.getWidth();
iTotalWidth+=iWidthColumn;
}
//iWidthTableCalculado=iTotalWidth;
}
*/
if(iTamanioFilaTabla<=0) {
iTamanioFilaTabla=this.jTableDatosCuentaContaDetaGrupoActi.getRowHeight();//CuentaContaDetaGrupoActiConstantesFunciones.ITAMANIOFILATABLA;
}
if(iNumFilas>0) {
iHeightTable=(iNumFilas * iTamanioFilaTabla);
} else {
iHeightTable=iTamanioFilaTabla;
}
iHeightTableTotal=iHeightTable;
if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
if(iHeightTable > CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) {
//SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O
if(!this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.isSelected()) {
iHeightTable=CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS;
} else {
iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30);
}
} else {
if(iHeightTable < CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) {
iHeightTable=CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS;
}
}
} else {
if(iHeightTable > CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) {
//SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O
if(!this.jCheckBoxConAltoMaximoTablaCuentaContaDetaGrupoActi.isSelected()) {
iHeightTable=CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS;
} else {
iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30);
}
} else {
if(iHeightTable < CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) {
iHeightTable=CuentaContaDetaGrupoActiConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS;
}
}
}
//OJO:SE DESHABILITA CALCULADO
//NO SE UTILIZA CALCULADO SI POR DEFINICION
if(iWidthTableDefinicion>0) {
iWidthTableCalculado=iWidthTableDefinicion;
}
this.jTableDatosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));
this.jTableDatosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));
this.jTableDatosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));//iWidthTable
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable));
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable));
this.jScrollPanelDatosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable));
//ORDER BY
//OrderBy
int iHeightTableOrderBy=0;
int iNumFilasOrderBy=this.arrOrderBy.size();
int iTamanioFilaTablaOrderBy=0;
if(this.jInternalFrameOrderByCuentaContaDetaGrupoActi!=null && this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjTableDatosOrderBy()!=null) {
//if(!this.cuentacontadetagrupoactiSessionBean.getEsGuardarRelacionado()) {
iTamanioFilaTablaOrderBy=this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjTableDatosOrderBy().getRowHeight();
if(iNumFilasOrderBy>0) {
iHeightTableOrderBy=iNumFilasOrderBy * iTamanioFilaTablaOrderBy;
} else {
iHeightTableOrderBy=iTamanioFilaTablaOrderBy;
}
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjTableDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTableCalculado/4
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjTableDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjTableDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTable
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjScrollPanelDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));//iHeightTableOrderBy,iWidthTableScroll
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjScrollPanelDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));
this.jInternalFrameOrderByCuentaContaDetaGrupoActi.getjScrollPanelDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));
}
//ORDER BY
//this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable));
//this.jScrollPanelDatosCuentaContaDetaGrupoActi.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable));
//this.jScrollPanelDatosCuentaContaDetaGrupoActi.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable));
//VERSION 0
/*
//SI CALCULADO ES MENOR QUE MAXIMO
if(iWidthTableCalculado<=iWidthTable) {
iWidthTable=iWidthTableCalculado;
}
//SI TABLA ES MENOR QUE SCROLL
if(iWidthTable<=iWidthTableScroll) {
iWidthTableScroll=iWidthTable;
}
*/
}
public void redimensionarTablaDatosConTamanio(int iTamanioFilaTabla) throws Exception {
int iSizeTabla=0;
//ARCHITECTURE
if(Constantes.ISUSAEJBLOGICLAYER) {
iSizeTabla=cuentacontadetagrupoactiLogic.getCuentaContaDetaGrupoActis().size();
} else if(Constantes.ISUSAEJBREMOTE || Constantes.ISUSAEJBHOME) {
iSizeTabla=cuentacontadetagrupoactis.size();
}
//ARCHITECTURE
this.redimensionarTablaDatos(iSizeTabla,iTamanioFilaTabla);
}
//PARA REPORTES
public static List<CuentaContaDetaGrupoActi> TraerCuentaContaDetaGrupoActiBeans(List<CuentaContaDetaGrupoActi> cuentacontadetagrupoactis,ArrayList<Classe> classes)throws Exception {
try {
for(CuentaContaDetaGrupoActi cuentacontadetagrupoacti:cuentacontadetagrupoactis) {
if(!(CuentaContaDetaGrupoActiConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_GENERICO)
|| CuentaContaDetaGrupoActiConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_TOTALES_GENERICO))
) {
cuentacontadetagrupoacti.setsDetalleGeneralEntityReporte(CuentaContaDetaGrupoActiConstantesFunciones.getCuentaContaDetaGrupoActiDescripcion(cuentacontadetagrupoacti));
} else {
//cuentacontadetagrupoacti.setsDetalleGeneralEntityReporte(cuentacontadetagrupoacti.getsDetalleGeneralEntityReporte());
}
//cuentacontadetagrupoactibeans.add(cuentacontadetagrupoactibean);
}
} catch(Exception ex) {
throw ex;
}
return cuentacontadetagrupoactis;
}
//PARA REPORTES FIN
}
| 53.62864 | 395 | 0.829884 |
e67f169372910b647b53d0af23bffff13b799b31 | 6,267 | package com.shzlabs.statussaver.data.local;
import android.content.Context;
import android.media.MediaScannerConnection;
import android.os.Environment;
import android.util.Log;
import com.shzlabs.statussaver.data.model.ImageModel;
import com.shzlabs.statussaver.util.FileUtil;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import rx.Observable;
import rx.subjects.PublishSubject;
/**
* Created by shaz on 5/3/17.
*/
public class FileHelper {
private static final String TAG = FileHelper.class.getSimpleName();
private static final String STATUS_SAVER_LOCAL_DIR_URI = "/StatusSaver";
private static final String WHATSAPP_STATUS_DIR_URI = "/WhatsApp/Media/.Statuses";
private Context ctx;
private PublishSubject<ImageModel> mediaStateChangeSubject = PublishSubject.create();
public FileHelper(Context context) {
this.ctx = context;
}
private String getStatusSaverDirPath() {
return Environment.getExternalStorageDirectory().toString()+ STATUS_SAVER_LOCAL_DIR_URI;
}
private String getWhatsappStatusDirPath() {
return Environment.getExternalStorageDirectory().toString()+ WHATSAPP_STATUS_DIR_URI;
}
private boolean isStatusDirAvailable() {
String absolutePath = getStatusSaverDirPath();
File fPath = new File(absolutePath);
if (fPath.exists()) {
return true;
}else{
return false;
}
}
private boolean isWhatsappDirAvailable() {
String absolutePath = getWhatsappStatusDirPath();
File fPath = new File(absolutePath);
if (fPath.exists()) {
return true;
}else{
return false;
}
}
private List<ImageModel> sortMediaByLastCreated(List<ImageModel> imageModels) {
Collections.sort(imageModels, new Comparator<ImageModel>() {
@Override
public int compare(ImageModel o1, ImageModel o2) {
long o1Value = o1.getLastModified();
long o2Value = o2.getLastModified();
return o1Value > o2Value ? -1 : (o1Value < o2Value) ? 1: 0;
}
});
return imageModels;
}
private boolean setupStatusSaverDirectory() {
String absolutePath = getStatusSaverDirPath();
File fPath = new File(absolutePath);
if (!fPath.exists()) {
if (!fPath.mkdir()) {
Log.d(TAG, "setupStatusSaverDirectory: Error creating directory");
return false;
}
}
return true;
}
private boolean isFileAlreadySaved(String fileName) {
File dir = new File(getStatusSaverDirPath(), fileName);
return dir.exists();
}
private boolean isFileVideoOrGif(String filename) {
String[] splits = filename.split("\\.");
String fileExtension = splits[splits.length-1];
switch (fileExtension) {
case "mp4":
case "gif":{
return true;
}
}
return false;
}
public List<ImageModel> getRecentImages() {
List<ImageModel> images = new ArrayList<>();
if (isWhatsappDirAvailable()) {
File directory = new File(getWhatsappStatusDirPath());
File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
ImageModel imageModel = new ImageModel(
files[i].getName(),
files[i].getAbsolutePath(),
files[i].lastModified(),
isFileAlreadySaved(files[i].getName()),
isFileVideoOrGif(files[i].getName()));
images.add(imageModel);
}
}
return sortMediaByLastCreated(images);
}
public List<ImageModel> getSavedImages() {
List<ImageModel> images = new ArrayList<>();
if (isStatusDirAvailable()) {
File directory = new File(getStatusSaverDirPath());
File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
ImageModel imageModel = new ImageModel(
files[i].getName(),
files[i].getAbsolutePath(),
files[i].lastModified(),
false,
isFileVideoOrGif(files[i].getName()));
images.add(imageModel);
}
}
return sortMediaByLastCreated(images);
}
public Observable<ImageModel> getMediaStateObservable() {
return mediaStateChangeSubject.asObservable();
}
public boolean saveMediaToLocalDir(ImageModel imageModel) {
if (!setupStatusSaverDirectory()) {
return false;
}
String absolutePath = imageModel.getCompletePath();
String fileName = imageModel.getFileName();
File sourcePath = new File(absolutePath);
File destPath = new File(getStatusSaverDirPath(), fileName);
try {
FileUtil.copyFile(sourcePath, destPath);
} catch (IOException e) {
Log.e(TAG, "saveMediaToLocalDir: Error copying files.");
e.printStackTrace();
return false;
}
// initiate media scan and put the new things into the path array to
// make the scanner aware of the location and the files you want to see
try {
MediaScannerConnection.scanFile(ctx, new String[] {absolutePath}, null, null);
} catch (Exception e) {
Log.e(TAG, "saveMediaToLocalDir: Media scanner error for new file");
e.printStackTrace();
}
mediaStateChangeSubject.onNext(imageModel);
return true;
}
public boolean deleteImageFromLocalDir(ImageModel imageModel) {
File file = new File(getStatusSaverDirPath(), imageModel.getFileName());
if (file.exists()) {
boolean status = file.delete();
if (status) {
mediaStateChangeSubject.onNext(imageModel);
return true;
}
}
return false;
}
}
| 32.138462 | 96 | 0.596617 |
b018f3602ceb8d6565953e4ae3a03379246e2317 | 1,136 | package cn.refactor.smoothanimatetoolbar.listeners;
import android.support.v7.widget.RecyclerView;
/**
* Create by andy (https://github.com/andyxialm)
* Create time: 16/9/16 21:55
* Description : ScrollUp and scrollDown listener
*/
public abstract class OnRecyclerViewScrollChangedListener extends RecyclerView.OnScrollListener implements BaseScrollListener {
private int mScrollThreshold;
private boolean mLastScrollDirectionToUp;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
boolean isSignificantDelta = Math.abs(dy) > mScrollThreshold;
if (isSignificantDelta) {
if (dy > 0) {
if (!mLastScrollDirectionToUp) {
mLastScrollDirectionToUp = true;
onScrollUp();
}
} else {
if (mLastScrollDirectionToUp) {
mLastScrollDirectionToUp = false;
onScrollDown();
}
}
}
}
public void setScrollThreshold(int scrollThreshold) {
mScrollThreshold = scrollThreshold;
}
}
| 30.702703 | 127 | 0.625 |
0eee0363654639c306228dfe9a4ca0b29b868e8d | 1,657 | package org.opencds.cqf.cql.evaluator.engine.retrieve;
import static java.util.Objects.requireNonNull;
import java.util.Collections;
import java.util.List;
import org.opencds.cqf.cql.engine.retrieve.RetrieveProvider;
import org.opencds.cqf.cql.engine.runtime.Code;
import org.opencds.cqf.cql.engine.runtime.Interval;
public class PriorityRetrieveProvider implements RetrieveProvider {
private List<RetrieveProvider> retrieveProviders;
;
public PriorityRetrieveProvider(List<RetrieveProvider> retrieveProviders) {
requireNonNull(retrieveProviders, "retrieveProviders can not be null.");
this.retrieveProviders = retrieveProviders;
}
@Override
public Iterable<Object> retrieve(String context, String contextPath, Object contextValue, String dataType,
String templateId, String codePath, Iterable<Code> codes, String valueSet, String datePath,
String dateLowPath, String dateHighPath, Interval dateRange) {
for (RetrieveProvider rp : retrieveProviders){
Iterable<Object> result = rp.retrieve(context, contextPath, contextValue, dataType, templateId, codePath, codes,
valueSet, datePath, dateLowPath, dateHighPath, dateRange);
if (result == null) {
// TODO: Change the semantics such that null means unknown while empty set means known empty
throw new IllegalStateException("retrieveProvider unexpectedly returned null. Should be an empty set.");
}
if (result.iterator().hasNext()) {
return result;
}
}
return Collections.emptySet();
}
} | 38.534884 | 125 | 0.705492 |
e55ab2d58af3386b63c54a7c0f46d3d403de1d00 | 2,493 | /* ******************************************************************************
* Copyright (c) 2006-2012 XMind Ltd. and others.
*
* This file is a part of XMind 3. XMind releases 3 and
* above are dual-licensed under the Eclipse Public License (EPL),
* which is available at http://www.eclipse.org/legal/epl-v10.html
* and the GNU Lesser General Public License (LGPL),
* which is available at http://www.gnu.org/licenses/lgpl.html
* See https://www.xmind.net/license.html for details.
*
* Contributors:
* XMind Ltd. - initial API and implementation
*******************************************************************************/
package org.xmind.core.internal.compatibility;
import org.xmind.core.Core;
import org.xmind.core.CoreException;
import org.xmind.core.internal.dom.DeserializerImpl;
import org.xmind.core.internal.dom.FileFormat_0_1;
import org.xmind.core.internal.dom.FileFormat_1;
import org.xmind.core.internal.dom.WorkbookImpl;
import org.xmind.core.io.CoreIOException;
public class Compatibility {
public static WorkbookImpl loadCompatibleWorkbook(
DeserializerImpl deserializer) throws CoreException {
WorkbookImpl workbook = null;
if (workbook == null) {
workbook = loadForFormat(new FileFormat_0_1(deserializer));
}
if (workbook == null) {
workbook = loadForFormat(new FileFormat_1(deserializer));
}
return workbook;
}
private static WorkbookImpl loadForFormat(FileFormat format)
throws CoreException {
try {
if (!format.identifies())
return null;
return format.load();
} catch (CoreIOException e) {
CoreException ce = e.getCoreException();
if (ce.getType() == Core.ERROR_WRONG_PASSWORD
|| ce.getType() == Core.ERROR_CANCELLATION) {
throw new CoreException(ce.getType(), ce.getCodeInfo(), e);
}
} catch (CoreException e) {
if (e.getType() == Core.ERROR_WRONG_PASSWORD
|| e.getType() == Core.ERROR_CANCELLATION) {
// if we encountered wrong password or cancellation,
// interrupt the loading process
throw e;
}
// otherwise, just continue to the next available format
} catch (Throwable e) {
// just continue to the next available format
}
return null;
}
} | 37.208955 | 81 | 0.591256 |
c6cbfdfb2f076343fb3178e3436201eb6f3d07fb | 4,860 | package org.dcsa.tnt.controller;
import org.dcsa.core.events.controller.AbstractEventController;
import org.dcsa.core.events.model.Event;
import org.dcsa.core.events.model.enums.*;
import org.dcsa.core.events.util.ExtendedGenericEventRequest;
import org.dcsa.core.extendedrequest.ExtendedRequest;
import org.dcsa.core.validator.EnumSubset;
import org.dcsa.core.validator.ValidEnum;
import org.dcsa.tnt.service.TNTEventService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import javax.validation.ConstraintViolationException;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@Validated
@RequestMapping(value = "events", produces = {MediaType.APPLICATION_JSON_VALUE})
public class EventController extends AbstractEventController<TNTEventService, Event> {
private final TNTEventService tntEventService;
public EventController(@Qualifier("TNTEventServiceImpl") TNTEventService tntEventService) {
this.tntEventService = tntEventService;
}
@Override
public TNTEventService getService() {
return tntEventService;
}
@Override
public String getType() {
return "Event";
}
@Override
protected ExtendedRequest<Event> newExtendedRequest() {
return new ExtendedGenericEventRequest(extendedParameters, r2dbcDialect) {
@Override
public void parseParameter(Map<String, List<String>> params) {
Map<String, List<String>> p = new HashMap<>(params);
// Add the eventType parameter (if it is missing) in order to limit the resultset
// to *only* SHIPMENT, TRANSPORT and EQUIPMENT events
p.putIfAbsent("eventType", List.of(
EventType.SHIPMENT.name() + "," +
EventType.TRANSPORT.name() + "," +
EventType.EQUIPMENT.name()));
super.parseParameter(p);
}
};
}
@GetMapping
public Flux<Event> findAll(
@RequestParam(value = "eventType", required = false)
@EnumSubset(anyOf = {"SHIPMENT", "TRANSPORT", "EQUIPMENT"})
String eventType,
@RequestParam(value = "shipmentEventTypeCode", required = false)
@ValidEnum(clazz = ShipmentEventTypeCode.class)
String shipmentEventTypeCode,
@RequestParam(value = "carrierBookingReference", required = false) @Size(max = 35)
String carrierBookingReference,
@RequestParam(value = "transportDocumentReference", required = false) @Size(max = 20)
String transportDocumentReference,
@RequestParam(value = "transportDocumentTypeCode", required = false)
@ValidEnum(clazz = TransportDocumentTypeCode.class)
String transportDocumentTypeCode,
@RequestParam(value = "transportEventTypeCode", required = false)
@ValidEnum(clazz = TransportEventTypeCode.class)
String transportEventTypeCode,
@RequestParam(value = "transportCallID", required = false) @Size(max = 100)
String transportCallID,
@RequestParam(value = "vesselIMONumber", required = false) @Size(max = 7)
String vesselIMONumber,
@RequestParam(value = "carrierVoyageNumber", required = false) @Size(max = 50)
String carrierVoyageNumber,
@RequestParam(value = "carrierServiceCode", required = false) @Size(max = 5)
String carrierServiceCode,
@RequestParam(value = "equipmentEventTypeCode", required = false)
@ValidEnum(clazz = EquipmentEventTypeCode.class)
String equipmentEventTypeCode,
@RequestParam(value = "equipmentReference", required = false) @Size(max = 15)
String equipmentReference,
@RequestParam(value = "limit", defaultValue = "1", required = false) @Min(1) int limit,
ServerHttpResponse response,
ServerHttpRequest request) {
return super.findAll(response, request);
}
@Override
public Mono<Event> create(@Valid @RequestBody Event event) {
return Mono.error(new ResponseStatusException(HttpStatus.FORBIDDEN));
}
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Invalid param value")
@ExceptionHandler(ConstraintViolationException.class)
public void badRequest() {}
}
| 42.631579 | 97 | 0.710905 |
b3bec5d2c3f1966ed2b863b64d536a57201e1f49 | 729 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package com.griddynamics.msd365fp.manualreview.analytics.config.properties;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
@ConstructorBinding
@ConfigurationProperties("spring.mail")
@Getter
@AllArgsConstructor
public class MailProperties {
private final String host;
private final int port;
private final String username;
private final String password;
private final String transportProtocol;
private final Boolean smtpAuth;
private final Boolean smtpStartTls;
}
| 27 | 75 | 0.806584 |
c8449c85bd0684831704bf60b919f183b8fee470 | 11,797 | package com.queatz.snappy.ui.slidescreen;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import com.queatz.snappy.MainApplication;
import com.queatz.snappy.Util;
import com.queatz.snappy.shared.Config;
/**
* Created by jacob on 10/19/14.
*/
public class SlideScreen extends ViewGroup {
public abstract static class SlideScreenAdapter {
public FragmentManager mFragmentManager;
public SlideScreenAdapter(FragmentManager fragmentManager) {
mFragmentManager = fragmentManager;
}
public abstract int getCount();
public abstract Fragment getSlide(int slide);
public FragmentManager getFragmentManager() {
return mFragmentManager;
}
}
private static class SlideAsChild {
public int position;
public Fragment fragment;
public SlideAsChild(int p, Fragment f) {
position = p;
fragment = f;
}
}
public interface OnSlideCallback {
void onSlide(int currentSlide, float offsetPercentage);
void onSlideChange(int currentSlide);
}
private SparseArray<SlideAsChild> mSlides;
private int mSlide;
protected float mOffset;
private OnSlideCallback mOnSlideCallback;
private SlideScreenAdapter mAdapter;
private SlideAnimation mAnimation;
private ExposeAnimation exposeAnimation;
private float mXFlingDelta;
private float mDownX, mDownY;
private boolean mSnatched, mUnsnatchable;
private boolean mChildIsUsingMotion;
private int slopRadius = (int) Util.px(96);
private int gap = (int) Util.px(128);
protected boolean expose = false;
protected float currentScale = 1;
public SlideScreen(Context context) {
super(context);
init(context);
}
public SlideScreen(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public SlideScreen(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
mSlides = new SparseArray<>();
mSnatched = false;
mUnsnatchable = false;
}
public void setOnSlideCallback(OnSlideCallback onSlideCallback) {
mOnSlideCallback = onSlideCallback;
}
public void setAdapter(SlideScreenAdapter adapter) {
mAdapter = adapter;
populate();
}
public SlideScreenAdapter getAdapter() {
return mAdapter;
}
public void setSlide(int slide) {
// When setting slide, close any keyboards that are open
((MainApplication) getContext().getApplicationContext()).team.view.keyboard(getWindowToken());
smoothSlideTo(slide);
}
public int getSlide() {
return mSlide;
}
public Fragment getSlideFragment(int slide) {
return mSlides.get(slide).fragment;
}
public void expose(boolean expose) {
this.expose = expose;
if (expose && currentScale >= 1) {
// Change background color
}
if(exposeAnimation != null) {
exposeAnimation.stop();
}
exposeAnimation = new ExposeAnimation(this, this.expose);
exposeAnimation.start();
}
public boolean isExpose() {
return expose;
}
private void smoothSlideTo(int slide) {
if(mAnimation != null) {
mAnimation.stop();
}
mAnimation = new SlideAnimation(this, slide);
mAnimation.start();
if(mOnSlideCallback != null)
mOnSlideCallback.onSlideChange(slide);
}
protected void setOffset(float offset) {
mOffset = Math.max(0, Math.min(mAdapter.getCount() - 1, offset));
mSlide = Math.round(mOffset);
positionChildren();
if(mOnSlideCallback != null) {
mOnSlideCallback.onSlide(mSlide, mOffset);
}
}
protected void setScale(float scale) {
this.currentScale = scale;
positionChildren();
}
private String getFragName(Object slide) {
String n = "slidescreen:" + getId() + ":" + slide;
Log.e(Config.LOG_TAG, n);
return n;
}
private void populate() {
removeAllViews();
FragmentTransaction transaction = mAdapter.getFragmentManager().beginTransaction();
for(int slide = 0; slide < mAdapter.getCount(); slide++) {
Fragment fragment = mAdapter.getSlide(slide);
mSlides.append(slide, new SlideAsChild(slide, fragment));
transaction.add(getId(), fragment, getFragName(slide));
}
transaction.commitAllowingStateLoss();
}
private SlideAsChild slideFromView(View view) {
for(int x = 0; x < mSlides.size(); x++) {
SlideAsChild child = mSlides.valueAt(x);
if(child.fragment.getView() == view)
return child;
}
return null;
}
private void positionChildren() {
int fr = (int) Math.floor(mOffset);
int to = fr + 1;
int width = getWidth() + (int) (gap * (1 - currentScale));
for(int c = 0; c < getChildCount(); c++) {
View view = getChildAt(c);
SlideAsChild child = slideFromView(view);
if(child == null)
continue;
int previousVisibility = view.getVisibility();
int expfrto = currentScale >= 1 ? 0 : 1;
view.setVisibility(
(child.position < fr - expfrto) ||
(child.position > ( mOffset == 0 ? fr : to) + expfrto) ?
View.GONE :
View.VISIBLE
);
if (view.getVisibility() != previousVisibility) {
if (previousVisibility == View.GONE) {
child.fragment.onResume();
} else {
child.fragment.onPause();
}
}
view.setScaleX(currentScale);
view.setScaleY(currentScale);
int l = (int) (currentScale * (width * child.position - (int) (mOffset * (float) width)));
try {
view.layout(l, 0, l + getWidth(), getHeight());
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
try {
positionChildren();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
for(int c = 0; c < getChildCount(); c++) {
getChildAt(c).measure(widthMeasureSpec, heightMeasureSpec);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float xdiff = 0;
if(event.getHistorySize() > 0) {
xdiff = event.getX() - event.getHistoricalX(0);
}
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
if(mAnimation != null && mAnimation.isAlive())
mAnimation.stop();
mSnatched = false;
mUnsnatchable = false;
mDownX = event.getRawX();
mDownY = event.getRawY();
mXFlingDelta = 0;
getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_MOVE:
setOffset(mOffset - xdiff / getWidth());
if (event.getHistorySize() > 0) {
int h = Math.min(10, event.getHistorySize() - 1);
mXFlingDelta = (
(event.getHistoricalX(h) - event.getX()) /
((float) (event.getEventTime() - event.getHistoricalEventTime(h)) / 1000.0f)
);
}
if(!mSnatched && !mUnsnatchable) {
if(shouldLetGo(event)) {
resolve(false);
getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
else {
mSnatched = shouldSnatch(event);
mUnsnatchable = isUnsnatchable(event);
if(mSnatched) {
getParent().requestDisallowInterceptTouchEvent(true);
}
}
}
break;
case MotionEvent.ACTION_UP:
getParent().requestDisallowInterceptTouchEvent(false);
if (expose && Math.abs(event.getX() - mDownX) < slopRadius && Math.abs(event.getY() - mDownY) < slopRadius) {
expose(false);
}
resolve(true);
return false;
}
return true;
}
@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
mChildIsUsingMotion = disallowIntercept;
if(getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(disallowIntercept);
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mSnatched = false;
mUnsnatchable = false;
mDownX = event.getRawX();
mDownY = event.getRawY();
mXFlingDelta = 0;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mChildIsUsingMotion = false;
mUnsnatchable = false;
mSnatched = false;
break;
case MotionEvent.ACTION_MOVE:
if(mSnatched || mChildIsUsingMotion || mUnsnatchable)
return mSnatched;
mSnatched = shouldSnatch(event);
mUnsnatchable = isUnsnatchable(event);
break;
}
return mSnatched;
}
private boolean isUnsnatchable(MotionEvent event) {
if (mSnatched) {
return false;
}
float xdif = event.getRawX() - mDownX;
float ydif = event.getRawY() - mDownY;
return Math.abs(xdif) < Math.abs(ydif) && Math.abs(ydif) > 16;
}
private boolean shouldSnatch(MotionEvent event) {
float xdif = event.getRawX() - mDownX;
float ydif = event.getRawY() - mDownY;
boolean edged = (xdif < 0 && mSlide >= mAdapter.getCount() - 1) ||
(xdif > 0 && mSlide <= 0);
return Math.abs(xdif) > Math.abs(ydif) && Math.abs(xdif) > 16 && !edged;
}
private boolean shouldLetGo(MotionEvent event) {
float xdif = event.getRawX() - mDownX;
float ydif = event.getRawY() - mDownY;
return Math.abs(ydif) > Math.abs(xdif) && Math.abs(ydif) > 16;
}
private void resolve(boolean fling) {
mSnatched = false;
int slide;
if (fling && Math.abs(mXFlingDelta) > 15) {
if (mXFlingDelta < 0)
slide = (int) Math.floor(mOffset);
else
slide = (int) Math.ceil(mOffset);
} else {
slide = Math.round(mOffset);
}
setSlide(slide);
}
}
| 29.418953 | 125 | 0.560312 |
909549b2b3cd83b9ba7417fe79134248055ba237 | 986 | package com.jme3x.jfx;
import java.net.URL;
import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.layout.Region;
public class FXMLWindow<ControllerType> extends AbstractWindow {
private String fxml;
private ControllerType controller;
public FXMLWindow(final String fxml) {
this.fxml = fxml;
}
public ControllerType getController() {
return this.controller;
}
@Override
protected Region innerInit() throws Exception {
final FXMLLoader fxmlLoader = new FXMLLoader();
final URL location = Thread.currentThread().getContextClassLoader().getResource(this.fxml);
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
final Region rv = fxmlLoader.load(location.openStream());
this.controller = fxmlLoader.getController();
return rv;
}
@Override
protected void afterInit() {
this.setEnforceMinimumSize(true);
this.setEnforceMaximumSize(true);
this.setSize(600, 300);
}
}
| 24.04878 | 93 | 0.769777 |
dd5db830793416316a0c80e82605925ff03b8fe6 | 1,984 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pinot.tools.admin.command.filesystem;
import java.util.HashMap;
import java.util.Map;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.filesystem.PinotFSFactory;
import org.apache.pinot.tools.Command;
import org.apache.pinot.tools.admin.command.FileSystemCommand;
import org.apache.pinot.tools.admin.command.QuickstartRunner;
import org.apache.pinot.tools.utils.PinotConfigUtils;
import picocli.CommandLine;
/**
* Base class for file operation classes
*/
public abstract class BaseFileOperation implements Command {
@CommandLine.ParentCommand
protected FileSystemCommand _parent;
public BaseFileOperation setParent(FileSystemCommand parent) {
_parent = parent;
return this;
}
protected void initialPinotFS()
throws Exception {
String configFile = _parent.getConfigFile();
Map<String, Object> configs =
configFile == null ? new HashMap<>() : PinotConfigUtils.readConfigFromFile(configFile);
PinotFSFactory.init(new PinotConfiguration(configs));
QuickstartRunner.registerDefaultPinotFS();
}
@Override
public boolean getHelp() {
return _parent.getHelp();
}
}
| 33.627119 | 95 | 0.762601 |
86fae68e50df59890286f91e12314f80441561b5 | 342 | package cn.sharesdk.framework.statistics;
public enum b
{
static
{
b[] arrayOfb = new b[2];
arrayOfb[0] = a;
arrayOfb[1] = b;
c = arrayOfb;
}
}
/* Location: E:\Progs\Dev\Android\Decompile\apktool\zssq\zssq-dex2jar.jar
* Qualified Name: cn.sharesdk.framework.statistics.b
* JD-Core Version: 0.6.0
*/ | 20.117647 | 83 | 0.622807 |
ee88bf0aacdb004b7b208b3159b4eb8060d9f9e3 | 2,798 | package drhd.sequalsk.transpiler.context.fileresolving.elementresolver;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import drhd.sequalsk.transpiler.context.fileresolving.fileresolver.PossibleFileReference;
import drhd.sequalsk.transpiler.context.utils.FileContextMode;
import drhd.sequalsk.transpiler.sequalskclient.request.TranspilerContext;
import org.jetbrains.kotlin.psi.KtReferenceExpression;
import java.util.HashMap;
import java.util.List;
/**
* Base class to analyze {@link KtReferenceExpression}s that are part of a file that a {@link TranspilerContext}
* is generated for.
* <p>
* It takes a single {@link KtReferenceExpression} as input and analyzes if that element is a reference to another
* project file. Basically it creates a list of {@link PossibleFileReference}s or {@link VirtualFile}s from that
* {@link KtReferenceExpression} - based on the configured {@link FileContextMode}.
* <p>
* Basically a {@link KtReferenceExpression} is "everything that you can click on and the IDE jumps to another
* location" - the location that the IDE jumps to is the PsiElement that the {@link KtReferenceExpression} is
* referencing to / has its reference to.
* <p>
*/
abstract public class PsiElementResolver<T extends KtReferenceExpression> {
/**
* This method analyzes the given KtReferenceExpression and turns it into {@link PossibleFileReference}s.
*/
abstract public List<PossibleFileReference> resolvePossibleReferences(T ktReferenceExpression);
/**
* This method analyzes the given KtReferenceExpression and resolves the actual virtual file.
*
* @return Hashmap with path as key and virtual file
*/
public HashMap<String, VirtualFile> resolveReferences(T ktReferenceExpression, List<String> projectKtFilenames) {
HashMap<String, VirtualFile> resolvedFiles = new HashMap<>();
for (PsiReference psiReference : ktReferenceExpression.getReferences()) {
PsiElement resolvedElement = psiReference.resolve();
if (validElement(resolvedElement)) {
VirtualFile virtualFile = resolvedElement.getContainingFile().getVirtualFile();
if (isProjectFile(virtualFile, projectKtFilenames)) {
resolvedFiles.put(virtualFile.getNameWithoutExtension(), virtualFile);
}
}
}
return resolvedFiles;
}
protected boolean validElement(PsiElement psiElement) {
return psiElement != null && psiElement.getContainingFile() != null;
}
protected boolean isProjectFile(VirtualFile virtualFile, List<String> projectKtFilenames) {
return projectKtFilenames.contains(virtualFile.getNameWithoutExtension());
}
}
| 44.412698 | 117 | 0.741244 |
ce8fb4a762ce3a11b800c769993da1bd388eb2b1 | 990 | /*
* Id: PlatformConvenienceFeeServiceException.java 13-Mar-2022 1:02:51 am SubhajoyLaskar
* Copyright (©) 2022 Subhajoy Laskar
* https://www.linkedin.com/in/subhajoylaskar
*/
package com.xyz.apps.ticketeer.pricing.conveniencefee.service;
import com.xyz.apps.ticketeer.general.service.ServiceException;
import com.xyz.apps.ticketeer.pricing.conveniencefee.resources.Messages;
/**
* The platform convenience fee service exception.
*
* @author Subhajoy Laskar
* @version 1.0
*/
public class PlatformConvenienceFeeServiceException extends ServiceException {
/** The serial version UID. */
private static final long serialVersionUID = 1946604874759038374L;
/**
* Instantiates a new platform convenience fee service exception.
*
* @param message the message
*/
public PlatformConvenienceFeeServiceException(final String messageKey, final Object ...messageArguments) {
super(Messages.resourceBundle(), messageKey, messageArguments);
}
}
| 30 | 110 | 0.755556 |
a13bab8d3f793e1adb91545b210871ea26bd4853 | 7,768 | package br.com.tassioauad.spotifystreamer.presenter;
import android.test.AndroidTestCase;
import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.ArrayList;
import java.util.List;
import br.com.tassioauad.spotifystreamer.model.api.ApiResultListener;
import br.com.tassioauad.spotifystreamer.model.api.TrackApi;
import br.com.tassioauad.spotifystreamer.model.api.exception.BadRequestException;
import br.com.tassioauad.spotifystreamer.model.api.exception.NotFoundException;
import br.com.tassioauad.spotifystreamer.model.entity.Artist;
import br.com.tassioauad.spotifystreamer.model.entity.Track;
import br.com.tassioauad.spotifystreamer.view.ListTopTrackView;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class ListTopTrackPresenterTest extends AndroidTestCase {
ListTopTrackPresenter presenter;
ListTopTrackView view;
TrackApi trackApi;
ArgumentCaptor<ApiResultListener> apiResultListenerArgumentCaptor;
@Override
protected void setUp() throws Exception {
super.setUp();
view = mock(ListTopTrackView.class);
trackApi = mock(TrackApi.class);
apiResultListenerArgumentCaptor = ArgumentCaptor.forClass(ApiResultListener.class);
}
public void testSearchByArtist_ValidArtist() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
List<Track> trackList = new ArrayList<>();
trackList.add(new Track());
apiResultListenerArgumentCaptor.getValue().onResult(trackList);
return null;
}
}).when(trackApi).findTopTenTrack(any(Artist.class));
return null;
}
}).when(trackApi).setApiResultListener(apiResultListenerArgumentCaptor.capture());
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.searchByArtist(new Artist());
verify(trackApi, times(1)).findTopTenTrack(any(Artist.class));
verify(view, times(1)).showTracks(anyListOf(Track.class));
verify(view, never()).anyTrackFounded();
verify(view, never()).lostConnection();
verify(view, times(1)).showLoadingWarn();
verify(view, times(1)).hideLoadingWarn();
}
public void testSearchByArtist_InvalidArtist() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
List<Track> trackList = new ArrayList<>();
apiResultListenerArgumentCaptor.getValue().onResult(trackList);
return null;
}
}).when(trackApi).findTopTenTrack(any(Artist.class));
return null;
}
}).when(trackApi).setApiResultListener(apiResultListenerArgumentCaptor.capture());
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.searchByArtist(new Artist());
verify(trackApi, times(1)).findTopTenTrack(any(Artist.class));
verify(view, never()).showTracks(anyListOf(Track.class));
verify(view, times(1)).anyTrackFounded();
verify(view, never()).lostConnection();
verify(view, times(1)).showLoadingWarn();
verify(view, times(1)).hideLoadingWarn();
}
public void testSearchByArtist_BadRequest() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
apiResultListenerArgumentCaptor.getValue().onException(new BadRequestException());
return null;
}
}).when(trackApi).findTopTenTrack(any(Artist.class));
return null;
}
}).when(trackApi).setApiResultListener(apiResultListenerArgumentCaptor.capture());
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.searchByArtist(new Artist());
verify(trackApi, times(1)).findTopTenTrack(any(Artist.class));
verify(view, never()).showTracks(anyListOf(Track.class));
verify(view, times(1)).anyTrackFounded();
verify(view, never()).lostConnection();
verify(view, times(1)).showLoadingWarn();
verify(view, times(1)).hideLoadingWarn();
}
public void testSearchByArtist_NotFound() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
apiResultListenerArgumentCaptor.getValue().onException(new NotFoundException());
return null;
}
}).when(trackApi).findTopTenTrack(any(Artist.class));
return null;
}
}).when(trackApi).setApiResultListener(apiResultListenerArgumentCaptor.capture());
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.searchByArtist(new Artist());
verify(trackApi, times(1)).findTopTenTrack(any(Artist.class));
verify(view, never()).showTracks(anyListOf(Track.class));
verify(view, never()).anyTrackFounded();
verify(view, times(1)).lostConnection();
verify(view, times(1)).showLoadingWarn();
verify(view, times(1)).hideLoadingWarn();
}
public void testSearchByArtist_OtherException() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
apiResultListenerArgumentCaptor.getValue().onException(new Exception());
return null;
}
}).when(trackApi).findTopTenTrack(any(Artist.class));
return null;
}
}).when(trackApi).setApiResultListener(apiResultListenerArgumentCaptor.capture());
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.searchByArtist(new Artist());
verify(trackApi, times(1)).findTopTenTrack(any(Artist.class));
verify(view, never()).showTracks(anyListOf(Track.class));
verify(view, times(1)).anyTrackFounded();
verify(view, never()).lostConnection();
verify(view, times(1)).showLoadingWarn();
verify(view, times(1)).hideLoadingWarn();
}
public void testFinish() {
presenter = new ListTopTrackPresenter(view, trackApi);
presenter.finish();
verify(trackApi, times(1)).stopAnyExecution();
}
}
| 41.989189 | 106 | 0.640577 |
7900c2d99b594d9fe35e0a318318987d9be2b9b1 | 3,851 | package com.android.smartlink.util;
import android.content.res.ColorStateList;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* User: LIUWEI
* Date: 2017-10-22
* Time: 10:19
*/
public class DataBindingAdapterUtil
{
public static View binding(View view, int variableId, Object value)
{
ViewDataBinding viewDataBinding = DataBindingUtil.bind(view);
viewDataBinding.setVariable(variableId, value);
viewDataBinding.executePendingBindings();
return view;
}
public static View binding(View view, int[] variableIds, Object[] values)
{
if (variableIds.length != values.length)
{
throw new IllegalArgumentException("variableIds array size not match values array!");
}
ViewDataBinding viewDataBinding = DataBindingUtil.bind(view);
for (int i = 0; i < variableIds.length; i++)
{
viewDataBinding.setVariable(variableIds[i], values[i]);
}
viewDataBinding.executePendingBindings();
return view;
}
public static void binding(ViewDataBinding viewDataBinding, int variableId, Object value)
{
viewDataBinding.setVariable(variableId, value);
viewDataBinding.executePendingBindings();
}
public static ViewDataBinding viewBinding(View view, int variableId, Object value)
{
ViewDataBinding viewDataBinding = DataBindingUtil.bind(view);
viewDataBinding.setVariable(variableId, value);
viewDataBinding.executePendingBindings();
return viewDataBinding;
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ImageView
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@BindingAdapter({"imageRes"}) //Used for data binding. DO NOT change it
public static void setImageRes(ImageView imageView, int drawableResId)
{
if (drawableResId > 0)
{
imageView.setImageResource(drawableResId);
}
}
@BindingAdapter({"imageRes"}) //Used for data binding. DO NOT change it
public static void setImageRes(ImageView imageView, String drawableResName)
{
if (!TextUtils.isEmpty(drawableResName))
{
imageView.setImageResource(ViewUtil.getDrawable(imageView.getContext(), drawableResName));
}
}
@BindingAdapter({"imageLevel"}) //Used for data binding. DO NOT change it
public static void setImageLevel(ImageView imageView, int level)
{
imageView.setImageLevel(level);
}
@BindingAdapter({"backgroundRes"}) //Used for data binding. DO NOT change it
public static void setBackgroundRes(View view, int color)
{
view.setBackgroundColor(color);
}
@BindingAdapter({"selected"})
public static void setSelected(View view, boolean selected)
{
view.setSelected(selected);
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// TextView
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@BindingAdapter({"color"})
public static void setColor(TextView textView, ColorStateList list)
{
textView.setTextColor(list);
}
}
| 33.198276 | 180 | 0.553882 |
a90a1f329f70ebb0f6f6200449a156c7e94476a5 | 1,278 | package no.nav.opptjening.skatt.client;
import no.nav.opptjening.skatt.client.schema.BeregnetSkattDto;
import org.jetbrains.annotations.NotNull;
public class BeregnetSkattMapper {
@NotNull
public BeregnetSkatt mapToBeregnetSkatt(@NotNull BeregnetSkattDto beregnetSkattDto) {
String personidentifikator = beregnetSkattDto.getPersonidentifikator();
String inntektsaar = beregnetSkattDto.getInntektsaar();
if (personidentifikator == null) {
throw new NullPointerException("Personidentifikator is null");
}
if (inntektsaar == null) {
throw new NullPointerException("Inntektsaar is null");
}
return new BeregnetSkatt(personidentifikator, inntektsaar,
beregnetSkattDto.getPersoninntektLoenn().orElse(null),
beregnetSkattDto.getPersoninntektFiskeFangstFamiliebarnehage().orElse(null),
beregnetSkattDto.getPersoninntektNaering().orElse(null),
beregnetSkattDto.getPersoninntektBarePensjonsdel().orElse(null),
beregnetSkattDto.getSvalbardLoennLoennstrekkordningen().orElse(null),
beregnetSkattDto.getSvalbardPersoninntektNaering().orElse(null),
beregnetSkattDto.isSkjermet());
}
}
| 45.642857 | 92 | 0.708138 |
768ce4a12932d70f4f2eb4bc53d6715447eadcb2 | 719 | package org.madawa.sorting;
import java.util.Arrays;
public class SelectionSort {
public static int[] selectionSort(int[] arr) {
for (int i = 0; i < arr.length - 1; ++i) {
int min = i;
for (int j = i + 1; j < arr.length; ++j) {
if (arr[min] > arr[j]) {
min = j;
}
}
if (i != min) {
int temp = arr[i];
arr[i] = arr[min];
arr[min] = temp;
}
}
return arr;
}
public static void main(String[] args) {
int[] ar = {12, 17, 6, 67, 5, 13, 81, 24};
System.out.println(Arrays.toString(selectionSort(ar)));
}
}
| 24.793103 | 63 | 0.422809 |
70089f2d422d72a05648d730a1ffba6464b4edb5 | 5,381 | /*
* Copyright (c) 2005, Graph Builder
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Graph Builder nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.graphbuilder.curve;
/**
A value-vector is a sequence of values that some curves use to define themselves,
sometimes called a knot-vector or a weight-vector. The values are stored using an
array.
*/
public class ValueVector {
protected int size = 0;
protected double[] value = null;
/**
Creates a ValueVector with initial capacity of 2.
*/
public ValueVector() {
value = new double[2];
}
/**
Creates a ValueVector using the specified array and initial size.
@throws IllegalArgumentException If the value array is null or size < 0 or size > data.length.
*/
public ValueVector(double[] value, int size) {
if (value == null)
throw new IllegalArgumentException("value array cannot be null.");
if (size < 0 || size > value.length)
throw new IllegalArgumentException("size >= 0 && size <= value.length required");
this.value = value;
this.size = size;
}
/**
Creates a ValueVector with the specified initial capacity.
*/
public ValueVector(int initialCapacity) {
value = new double[initialCapacity];
}
/**
Returns the number of values in the value array.
*/
public int size() {
return size;
}
/**
Returns the value at the specified index.
@throws IllegalArgumentException If index < 0 or index >= size.
*/
public double get(int index) {
if (index < 0 || index >= size)
throw new IllegalArgumentException("required: (index >= 0 && index < size) but: (index = " + index + ", size = " + size + ")");
return value[index];
}
/**
Sets the value at the specified index.
@throws IllegalArgumentException If index < 0 or index >= size.
*/
public void set(double d, int index) {
if (index < 0 || index >= size)
throw new IllegalArgumentException("required: (index >= 0 && index < size) but: (index = " + index + ", size = " + size + ")");
value[index] = d;
}
/**
Removes the value at the specified index. Values at a higher index are shifted to fill the space.
@throws IllegalArgumentException If index < 0 or index >= size.
*/
public void remove(int index) {
if (index < 0 || index >= size)
throw new IllegalArgumentException("required: (index >= 0 && index < size) but: (index = " + index + ", size = " + size + ")");
for (int i = index + 1; i < size; i++)
value[i-1] = value[i];
size--;
}
/**
Adds a value to the value array at index location size.
*/
public void add(double d) {
insert(d, size);
}
/**
Inserts the value at the specified index location. Values at an equal or higher index are shifted to make space.
@throws IllegalArgumentException If index < 0 or index > size.
*/
public void insert(double d, int index) {
if (index < 0 || index > size)
throw new IllegalArgumentException("required: (index >= 0 && index <= size) but: (index = " + index + ", size = " + size + ")");
ensureCapacity(size + 1);
for (int i = size; i > index; i--)
value[i] = value[i-1];
value[index] = d;
size++;
}
/**
Checks that the value array has the specified capacity, otherwise the capacity of the
value array is increased to be the maximum between twice the current capacity and the
specified capacity.
*/
public void ensureCapacity(int capacity) {
if (value.length < capacity) {
int x = 2 * value.length;
if (x < capacity) x = capacity;
double[] arr = new double[x];
for (int i = 0; i < size; i++)
arr[i] = value[i];
value = arr;
}
}
/**
Creates a new value array of exact size, copying the values from the old array into the
new one.
*/
public void trimArray() {
if (size < value.length) {
double[] arr = new double[size];
for (int i = 0; i < size; i++)
arr[i] = value[i];
value = arr;
}
}
}
| 30.925287 | 132 | 0.668091 |
0e33727df084ad72f87e96ce90e98fe3b89d3f83 | 269 | package ru.merkurev.sfgpetclinic.services;
import ru.merkurev.sfgpetclinic.model.Vet;
/**
* Interface for CRUD operations for {@link Vet}.
*
* @author Merkurev Sergei
* @version 0.1
* @since 0.1
*/
public interface VetService extends CrudService<Vet, Long> {
}
| 19.214286 | 60 | 0.724907 |
a2ff0a2c5f8efa0c9fb09c7ae711d05773882808 | 2,962 | package cn.jiguang.c.b;
import android.content.Context;
public final class b
{
public static int a;
private static final String[] z;
static
{
String[] arrayOfString = new String[5];
int j = 0;
Object localObject2 = "\002G[6S2JL#Q\002Jx<T\004\017J<U\004@K!\030\\\017";
int i = -1;
Object localObject1 = arrayOfString;
char[] arrayOfChar = ((String)localObject2).toCharArray();
int k = arrayOfChar.length;
int i1 = 0;
int m = 0;
int i3 = i;
localObject2 = arrayOfChar;
int i4 = j;
Object localObject3 = localObject1;
int n = k;
Object localObject4;
int i2;
if (k <= 1)
{
localObject4 = localObject1;
localObject1 = arrayOfChar;
i2 = i;
label67:
n = m;
label70:
localObject2 = localObject1;
i1 = localObject2[m];
switch (n % 5)
{
default:
i = 56;
}
}
for (;;)
{
localObject2[m] = ((char)(i ^ i1));
n += 1;
if (k == 0)
{
m = k;
break label70;
}
i1 = n;
n = k;
localObject3 = localObject4;
i4 = j;
localObject2 = localObject1;
i3 = i2;
i2 = i3;
localObject1 = localObject2;
j = i4;
localObject4 = localObject3;
k = n;
m = i1;
if (n > i1) {
break label67;
}
localObject1 = new String((char[])localObject2).intern();
switch (i3)
{
default:
localObject3[i4] = localObject1;
j = 1;
localObject2 = "O\\['N\bL[&Y\027Jx<T\004";
i = 0;
localObject1 = arrayOfString;
break;
case 0:
localObject3[i4] = localObject1;
j = 2;
localObject2 = "\002G[6S2JL#Q\002Jx<T\004\017[-[\004_J<W\017\001\020{";
i = 1;
localObject1 = arrayOfString;
break;
case 1:
localObject3[i4] = localObject1;
j = 3;
localObject2 = "+lQ']2JL#Q\002Jk!Q\r\\";
i = 2;
localObject1 = arrayOfString;
break;
case 2:
localObject3[i4] = localObject1;
j = 4;
localObject2 = "+K&PAFP<LAL_;j\024An K\t|['N\bL[u\002";
i = 3;
localObject1 = arrayOfString;
break;
case 3:
localObject3[i4] = localObject1;
z = arrayOfString;
a = -1;
return;
i = 97;
continue;
i = 47;
continue;
i = 62;
continue;
i = 85;
}
}
}
public static void a(Context paramContext)
{
new d(paramContext).start();
}
public static boolean a()
{
return a == 0;
}
public static void b()
{
cn.jiguang.c.f.d.a().a(new c());
}
public static boolean c()
{
return a == 1;
}
}
/* Location: /Users/gaoht/Downloads/zirom/classes-dex2jar.jar!/cn/jiguang/c/b/b.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 21.157143 | 98 | 0.505739 |
aa8e3fa52dbd6d4728af00ca79e6fbb4fd7dfa3f | 1,621 | package com.google.android.gms.measurement;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.internal.zzckn;
import com.google.firebase.analytics.FirebaseAnalytics.Param;
@KeepForSdk
public final class AppMeasurement$Param extends Param {
@KeepForSdk
public static final String FATAL = "fatal";
@KeepForSdk
public static final String TIMESTAMP = "timestamp";
public static final String[] zzitn = new String[]{"firebase_conversion", "engagement_time_msec", "exposure_time", "ad_event_id", "ad_unit_id", "firebase_error", "firebase_error_value", "firebase_error_length", "firebase_event_origin", "firebase_screen", "firebase_screen_class", "firebase_screen_id", "firebase_previous_screen", "firebase_previous_class", "firebase_previous_id", "message_device_time", "message_id", "message_name", "message_time", "previous_app_version", "previous_os_version", "topic", "update_with_analytics", "previous_first_open_count", "system_app", "system_app_update", "previous_install_count", "firebase_event_id", "firebase_extra_params_ct", "firebase_group_name", "firebase_list_length", "firebase_index", "firebase_event_name"};
public static final String[] zzito = new String[]{"_c", "_et", "_xt", "_aeid", "_ai", "_err", "_ev", "_el", "_o", "_sn", "_sc", "_si", "_pn", "_pc", "_pi", "_ndt", "_nmid", "_nmn", "_nmt", "_pv", "_po", "_nt", "_uwa", "_pfo", "_sys", "_sysu", "_pin", "_eid", "_epc", "_gn", "_ll", "_i", "_en"};
private AppMeasurement$Param() {
}
public static String zzik(String str) {
return zzckn.zza(str, zzitn, zzito);
}
}
| 70.478261 | 761 | 0.725478 |
cc88ed783c305c0e17b1460f8bc8a58cbfcc00f7 | 2,215 | /*
553. Optimal Division
Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.
However, you can add any number of parenthesis at any position to change the priority of operations. You should find out
how to add parenthesis to get the maximum result, and return the corresponding expression in string format.
Your expression should NOT contain redundant parenthesis.
Example:
Input: [1000,100,10,2]
Output: "1000/(100/10/2)"
Explanation:
1000/(100/10/2) = 1000/((100/10)/2) = 200
However, the bold parenthesis in "1000/((100/10)/2)" are redundant,
since they don't influence the operation priority. So you should return "1000/(100/10/2)".
Other cases:
1000/(100/10)/2 = 50
1000/(100/(10/2)) = 50
1000/100/10/2 = 0.5
1000/100/(10/2) = 2
Note:
The length of the input array is [1, 10].
Elements in the given array will be in range [2, 1000].
There is only one optimal division for each test case.
*/
/*
Using some simple math we can find the easy solution of this problem. Consider the input in the form of [a,b,c,d],
now we have to set priority of operations to maximize a/b/c/d. We know that to maximize fraction p/qp/q, qq(denominator) should be minimized.
So, to maximize a/b/c/da/b/c/d we have to first minimize b/c/d. Now our objective turns to minimize the expression b/c/d.
There are two possible combinations of this expression, b/(c/d) and (b/c)/d.
b/(c/d) (b/c)/d = b/c/d
(b*d)/c b/(d*c)
d/c 1/(d*c)
Obviously, d/c > 1/(d*c)d/c>1/(d∗c) for d>1d>1.
You can see that second combination will always be less than first one for numbers greater than 11. So,
the answer will be a/(b/c/d). Similarly for expression like a/b/c/d/e/f... answer will be a/(b/c/d/e/f...).
*/class Solution {
public String optimalDivision(int[] nums) {
if (nums.length == 1)
return nums[0] + "";
if (nums.length == 2)
return nums[0] + "/" + nums[1];
StringBuilder res = new StringBuilder(nums[0] + "/(" + nums[1]);
for (int i = 2; i < nums.length; i++) {
res.append("/" + nums[i]);
}
res.append(")");
return res.toString();
}
} | 40.272727 | 142 | 0.655982 |
a9c1c51d3253c5097630d0fbca63328918af8639 | 1,389 | package com.tvd12.ezyfoxserver.nio.testing;
import java.nio.ByteBuffer;
import org.testng.annotations.Test;
import com.tvd12.ezyfox.io.EzyArrays;
import com.tvd12.ezyfox.io.EzyBytes;
import com.tvd12.test.base.BaseTest;
import com.tvd12.test.performance.Performance;
public class ByteBufferAndByteArrayTest extends BaseTest {
@SuppressWarnings("unused")
@Test
public void test() {
byte[] bc = new byte[200];
for(int i = 0 ; i < 200 ; ++i) {
bc[i] = 1;
}
long time1 = Performance.create()
.test(() -> {
ByteBuffer byteBuffer = ByteBuffer.allocate(3 + 200);
byteBuffer.put((byte)0);
byteBuffer.putShort((short)47);
byteBuffer.put(bc);
byteBuffer.flip();
byte[] bytes = new byte[3 + 200];
byteBuffer.get(bytes);
})
.getTime();
long time2 = Performance.create()
.test(() -> {
byte[] bytes = new byte[3 + 200];
bytes[0] = 0;
EzyArrays.copy(EzyBytes.getBytes((short)47), bytes, 1);
EzyArrays.copy(bc, bytes, 3);
})
.getTime();
long time3 = Performance.create()
.test(() -> {
ByteBuffer byteBuffer = ByteBuffer.allocate(3276);
}).getTime();
long time4 = Performance.create()
.test(() -> {
byte[] bytes = new byte[3276];
}).getTime();
System.out.println(time1);
System.out.println(time2);
System.out.println(time3);
System.out.println(time4);
}
}
| 23.948276 | 60 | 0.634989 |
3f41566ff1b73baf0146209f8a4fa9fcbbb79663 | 3,604 | /**
* generated by Xtext 2.9.2
*/
package org.xtuml.bp.xtext.masl.masl.structure;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Object Service Definition</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#isInstance <em>Instance</em>}</li>
* <li>{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getRelationship <em>Relationship</em>}</li>
* <li>{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getObject <em>Object</em>}</li>
* </ul>
*
* @see org.xtuml.bp.xtext.masl.masl.structure.StructurePackage#getObjectServiceDefinition()
* @model
* @generated
*/
public interface ObjectServiceDefinition extends AbstractActionDefinition, AbstractService {
/**
* Returns the value of the '<em><b>Instance</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Instance</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Instance</em>' attribute.
* @see #setInstance(boolean)
* @see org.xtuml.bp.xtext.masl.masl.structure.StructurePackage#getObjectServiceDefinition_Instance()
* @model unique="false"
* @generated
*/
boolean isInstance();
/**
* Sets the value of the '{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#isInstance <em>Instance</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Instance</em>' attribute.
* @see #isInstance()
* @generated
*/
void setInstance(boolean value);
/**
* Returns the value of the '<em><b>Relationship</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Relationship</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Relationship</em>' reference.
* @see #setRelationship(RelationshipDefinition)
* @see org.xtuml.bp.xtext.masl.masl.structure.StructurePackage#getObjectServiceDefinition_Relationship()
* @model
* @generated
*/
RelationshipDefinition getRelationship();
/**
* Sets the value of the '{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getRelationship <em>Relationship</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Relationship</em>' reference.
* @see #getRelationship()
* @generated
*/
void setRelationship(RelationshipDefinition value);
/**
* Returns the value of the '<em><b>Object</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Object</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Object</em>' reference.
* @see #setObject(ObjectDeclaration)
* @see org.xtuml.bp.xtext.masl.masl.structure.StructurePackage#getObjectServiceDefinition_Object()
* @model
* @generated
*/
ObjectDeclaration getObject();
/**
* Sets the value of the '{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getObject <em>Object</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Object</em>' reference.
* @see #getObject()
* @generated
*/
void setObject(ObjectDeclaration value);
} // ObjectServiceDefinition
| 34.32381 | 147 | 0.672863 |
072b01a3e9509fab9246db88b90be58a9a0c9cf7 | 1,250 | package ski_pass;
import enums.Seasons;
import enums.Time;
import java.time.LocalDate;
import java.time.Month;
import java.util.Date;
public class TicketBySeason extends SkiPass {
private Seasons season;
TicketBySeason(Seasons season) {
time = Time.WEEKEND;
this.season = season;
}
@Override
public boolean isValid() {
LocalDate today = LocalDate.now();
return (season == Seasons.WINTER && (today.getMonth() == Month.DECEMBER ||
today.getMonth() == Month.JANUARY || today.getMonth() == Month.FEBRUARY)) ||
(season == Seasons.SPRING && (today.getMonth() == Month.MARCH ||
today.getMonth() == Month.APRIL || today.getMonth() == Month.MAY)) ||
(season == Seasons.SUMMER && (today.getMonth() == Month.JUNE ||
today.getMonth() == Month.JULY || today.getMonth() == Month.AUGUST)) ||
(season == Seasons.AUTUMN && (today.getMonth() == Month.SEPTEMBER ||
today.getMonth() == Month.OCTOBER || today.getMonth() == Month.NOVEMBER));
}
@Override
public void use() {
if (!isDateValid() || !isValid()) {
setUsesLeft(0);
}
}
}
| 32.051282 | 98 | 0.5632 |
8e90b20f157042e016236dfdab132d6b8b711693 | 3,290 | package xreliquary.items.alkahestry;
import lib.enderwizards.sandstone.util.ContentHelper;
import lib.enderwizards.sandstone.util.NBTHelper;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import xreliquary.Reliquary;
import xreliquary.lib.Names;
public class AlkahestryRedstoneRecipe implements IRecipe {
public static Item returnedItem;
@Override
public boolean matches(InventoryCrafting inv, World world) {
ItemStack tome = null;
int amount = 0;
int valid = 0;
for (int count = 0; count < inv.getSizeInventory(); count++) {
ItemStack stack = inv.getStackInSlot(count);
if (stack != null) {
if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(returnedItem))) {
tome = stack.copy();
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Items.redstone))) {
if (valid == 0)
valid = 1;
amount++;
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Blocks.redstone_block))) {
if (valid == 0)
valid = 1;
amount += 9;
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Items.glowstone_dust))) {
if (valid == 0)
valid = 1;
amount++;
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Blocks.glowstone))) {
if (valid == 0)
valid = 1;
amount += 4;
} else {
valid = 2;
}
}
}
return tome != null && valid == 1 && NBTHelper.getInteger("redstone", tome) + amount <= Reliquary.CONFIG.getInt(Names.alkahestry_tome, "redstone_limit");
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ItemStack tome = null;
int amount = 0;
for (int count = 0; count < inv.getSizeInventory(); count++) {
ItemStack stack = inv.getStackInSlot(count);
if (stack != null) {
if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(returnedItem))) {
tome = stack.copy();
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Blocks.redstone_block))) {
amount += 9;
} else if (ContentHelper.getIdent(stack.getItem()).equals(ContentHelper.getIdent(Items.redstone))) {
amount++;
}
}
}
NBTHelper.setInteger("redstone", tome, NBTHelper.getInteger("redstone", tome) + amount);
return tome;
}
@Override
public int getRecipeSize() {
return 9;
}
@Override
public ItemStack getRecipeOutput() {
return new ItemStack(returnedItem, 1);
}
}
| 37.816092 | 161 | 0.577508 |
8460cf12eb78d5d605314185edceff99b769cc52 | 813 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.jme3.gde.terraineditor.tools;
import com.jme3.gde.terraineditor.ExtraToolParams;
/**
* Parameters, and default values, for the fractal roughen tool
* @author Brent Owens
*/
public class RoughExtraToolParams implements ExtraToolParams{
public float roughness = 1.2f;
public float frequency = 0.2f;
public float amplitude = 1.0f;
public float lacunarity = 2.12f;
public float octaves = 8;
public float scale = 1.0f;
// the below parameters are not get in the UI yet:
float perturbMagnitude = 0.2f;
float erodeRadius = 5;
float erodeTalus = 0.011f;
float smoothRadius = 1;
float smoothEffect = 0.1f;
int iterations = 1;
}
| 24.636364 | 63 | 0.678967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.