rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
List preliminaryResults = new ArrayList();
private void queryDatabaseForSeismogram(List resultCollector, RequestFilter request, boolean returnSeismograms, boolean ignoreNetworkTimes) throws SQLException { // Retrieve channel ID, begin time, and end time from the request // and place the times into a time table while // buffering the query by one second on each end. int[] chanId; EncodedCut cutter = new EncodedCut(request); try { if(ignoreNetworkTimes) { chanId = chanTable.getDBIdIgnoringNetworkId(request.channel_id.network_id.network_code, request.channel_id.station_code, request.channel_id.site_code, request.channel_id.channel_code); } else { chanId = new int[] {chanTable.getDBId(request.channel_id)}; } } catch(NotFound e) { logger.debug("Can not find channel ID in database."); return; } MicroSecondDate adjustedBeginTime = new MicroSecondDate(request.start_time).subtract(ONE_SECOND); MicroSecondDate adjustedEndTime = new MicroSecondDate(request.end_time).add(ONE_SECOND); for(int i = 0; i < chanId.length; i++) { // Populate databaseResults with all of the matching seismograms // from the database. select.setInt(1, chanId[i]); select.setTimestamp(2, adjustedEndTime.getTimestamp()); select.setTimestamp(3, adjustedBeginTime.getTimestamp()); databaseResults = select.executeQuery(); if(returnSeismograms) { try { List preliminaryResults = new ArrayList(); while(databaseResults.next()) { File seismogramFile = new File(databaseResults.getString(4)); SeismogramFileTypes filetype = SeismogramFileTypes.fromInt(databaseResults.getInt("filetype")); LocalSeismogramImpl[] curSeis; if(filetype.equals(SeismogramFileTypes.RT_130)) { List refTekSeis = getMatchingSeismogramsFromRefTek(seismogramFile.getCanonicalPath(), request.channel_id, adjustedBeginTime, adjustedEndTime); curSeis = (LocalSeismogramImpl[])refTekSeis.toArray(new LocalSeismogramImpl[refTekSeis.size()]); } else { URLDataSetSeismogram urlSeis = new URLDataSetSeismogram(seismogramFile.toURL(), filetype); curSeis = urlSeis.getSeismograms(); } for(int j = 0; j < curSeis.length; j++) { LocalSeismogram seis = cutter.apply(curSeis[j]); if(seis != null) { preliminaryResults.add(seis); } } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])preliminaryResults.toArray(new LocalSeismogramImpl[0]); for(int j = 0; j < seis.length; j++) { resultCollector.add(seis[j]); } } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while returning seismograms from the database." + "\n" + "The problem file is located at " + databaseResults.getString(4), e); } } else { try { while(databaseResults.next()) { RequestFilter req = new RequestFilter(chanTable.getId(databaseResults.getInt(1)), timeTable.get(databaseResults.getInt(2)), timeTable.get(databaseResults.getInt(3))); resultCollector.add(cutter.apply(req)); } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while querying the database for seismograms.", e); } } } }
preliminaryResults.add(seis);
resultCollector.add(seis);
private void queryDatabaseForSeismogram(List resultCollector, RequestFilter request, boolean returnSeismograms, boolean ignoreNetworkTimes) throws SQLException { // Retrieve channel ID, begin time, and end time from the request // and place the times into a time table while // buffering the query by one second on each end. int[] chanId; EncodedCut cutter = new EncodedCut(request); try { if(ignoreNetworkTimes) { chanId = chanTable.getDBIdIgnoringNetworkId(request.channel_id.network_id.network_code, request.channel_id.station_code, request.channel_id.site_code, request.channel_id.channel_code); } else { chanId = new int[] {chanTable.getDBId(request.channel_id)}; } } catch(NotFound e) { logger.debug("Can not find channel ID in database."); return; } MicroSecondDate adjustedBeginTime = new MicroSecondDate(request.start_time).subtract(ONE_SECOND); MicroSecondDate adjustedEndTime = new MicroSecondDate(request.end_time).add(ONE_SECOND); for(int i = 0; i < chanId.length; i++) { // Populate databaseResults with all of the matching seismograms // from the database. select.setInt(1, chanId[i]); select.setTimestamp(2, adjustedEndTime.getTimestamp()); select.setTimestamp(3, adjustedBeginTime.getTimestamp()); databaseResults = select.executeQuery(); if(returnSeismograms) { try { List preliminaryResults = new ArrayList(); while(databaseResults.next()) { File seismogramFile = new File(databaseResults.getString(4)); SeismogramFileTypes filetype = SeismogramFileTypes.fromInt(databaseResults.getInt("filetype")); LocalSeismogramImpl[] curSeis; if(filetype.equals(SeismogramFileTypes.RT_130)) { List refTekSeis = getMatchingSeismogramsFromRefTek(seismogramFile.getCanonicalPath(), request.channel_id, adjustedBeginTime, adjustedEndTime); curSeis = (LocalSeismogramImpl[])refTekSeis.toArray(new LocalSeismogramImpl[refTekSeis.size()]); } else { URLDataSetSeismogram urlSeis = new URLDataSetSeismogram(seismogramFile.toURL(), filetype); curSeis = urlSeis.getSeismograms(); } for(int j = 0; j < curSeis.length; j++) { LocalSeismogram seis = cutter.apply(curSeis[j]); if(seis != null) { preliminaryResults.add(seis); } } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])preliminaryResults.toArray(new LocalSeismogramImpl[0]); for(int j = 0; j < seis.length; j++) { resultCollector.add(seis[j]); } } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while returning seismograms from the database." + "\n" + "The problem file is located at " + databaseResults.getString(4), e); } } else { try { while(databaseResults.next()) { RequestFilter req = new RequestFilter(chanTable.getId(databaseResults.getInt(1)), timeTable.get(databaseResults.getInt(2)), timeTable.get(databaseResults.getInt(3))); resultCollector.add(cutter.apply(req)); } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while querying the database for seismograms.", e); } } } }
LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])preliminaryResults.toArray(new LocalSeismogramImpl[0]); for(int j = 0; j < seis.length; j++) { resultCollector.add(seis[j]); }
logger.debug("After adding " + seismogramFile + " there are " + resultCollector.size() + " items");
private void queryDatabaseForSeismogram(List resultCollector, RequestFilter request, boolean returnSeismograms, boolean ignoreNetworkTimes) throws SQLException { // Retrieve channel ID, begin time, and end time from the request // and place the times into a time table while // buffering the query by one second on each end. int[] chanId; EncodedCut cutter = new EncodedCut(request); try { if(ignoreNetworkTimes) { chanId = chanTable.getDBIdIgnoringNetworkId(request.channel_id.network_id.network_code, request.channel_id.station_code, request.channel_id.site_code, request.channel_id.channel_code); } else { chanId = new int[] {chanTable.getDBId(request.channel_id)}; } } catch(NotFound e) { logger.debug("Can not find channel ID in database."); return; } MicroSecondDate adjustedBeginTime = new MicroSecondDate(request.start_time).subtract(ONE_SECOND); MicroSecondDate adjustedEndTime = new MicroSecondDate(request.end_time).add(ONE_SECOND); for(int i = 0; i < chanId.length; i++) { // Populate databaseResults with all of the matching seismograms // from the database. select.setInt(1, chanId[i]); select.setTimestamp(2, adjustedEndTime.getTimestamp()); select.setTimestamp(3, adjustedBeginTime.getTimestamp()); databaseResults = select.executeQuery(); if(returnSeismograms) { try { List preliminaryResults = new ArrayList(); while(databaseResults.next()) { File seismogramFile = new File(databaseResults.getString(4)); SeismogramFileTypes filetype = SeismogramFileTypes.fromInt(databaseResults.getInt("filetype")); LocalSeismogramImpl[] curSeis; if(filetype.equals(SeismogramFileTypes.RT_130)) { List refTekSeis = getMatchingSeismogramsFromRefTek(seismogramFile.getCanonicalPath(), request.channel_id, adjustedBeginTime, adjustedEndTime); curSeis = (LocalSeismogramImpl[])refTekSeis.toArray(new LocalSeismogramImpl[refTekSeis.size()]); } else { URLDataSetSeismogram urlSeis = new URLDataSetSeismogram(seismogramFile.toURL(), filetype); curSeis = urlSeis.getSeismograms(); } for(int j = 0; j < curSeis.length; j++) { LocalSeismogram seis = cutter.apply(curSeis[j]); if(seis != null) { preliminaryResults.add(seis); } } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])preliminaryResults.toArray(new LocalSeismogramImpl[0]); for(int j = 0; j < seis.length; j++) { resultCollector.add(seis[j]); } } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while returning seismograms from the database." + "\n" + "The problem file is located at " + databaseResults.getString(4), e); } } else { try { while(databaseResults.next()) { RequestFilter req = new RequestFilter(chanTable.getId(databaseResults.getInt(1)), timeTable.get(databaseResults.getInt(2)), timeTable.get(databaseResults.getInt(3))); resultCollector.add(cutter.apply(req)); } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while querying the database for seismograms.", e); } } } }
resultCollector.add(cutter.apply(req));
req = cutter.apply(req); if(req != null) { resultCollector.add(req); }
private void queryDatabaseForSeismogram(List resultCollector, RequestFilter request, boolean returnSeismograms, boolean ignoreNetworkTimes) throws SQLException { // Retrieve channel ID, begin time, and end time from the request // and place the times into a time table while // buffering the query by one second on each end. int[] chanId; EncodedCut cutter = new EncodedCut(request); try { if(ignoreNetworkTimes) { chanId = chanTable.getDBIdIgnoringNetworkId(request.channel_id.network_id.network_code, request.channel_id.station_code, request.channel_id.site_code, request.channel_id.channel_code); } else { chanId = new int[] {chanTable.getDBId(request.channel_id)}; } } catch(NotFound e) { logger.debug("Can not find channel ID in database."); return; } MicroSecondDate adjustedBeginTime = new MicroSecondDate(request.start_time).subtract(ONE_SECOND); MicroSecondDate adjustedEndTime = new MicroSecondDate(request.end_time).add(ONE_SECOND); for(int i = 0; i < chanId.length; i++) { // Populate databaseResults with all of the matching seismograms // from the database. select.setInt(1, chanId[i]); select.setTimestamp(2, adjustedEndTime.getTimestamp()); select.setTimestamp(3, adjustedBeginTime.getTimestamp()); databaseResults = select.executeQuery(); if(returnSeismograms) { try { List preliminaryResults = new ArrayList(); while(databaseResults.next()) { File seismogramFile = new File(databaseResults.getString(4)); SeismogramFileTypes filetype = SeismogramFileTypes.fromInt(databaseResults.getInt("filetype")); LocalSeismogramImpl[] curSeis; if(filetype.equals(SeismogramFileTypes.RT_130)) { List refTekSeis = getMatchingSeismogramsFromRefTek(seismogramFile.getCanonicalPath(), request.channel_id, adjustedBeginTime, adjustedEndTime); curSeis = (LocalSeismogramImpl[])refTekSeis.toArray(new LocalSeismogramImpl[refTekSeis.size()]); } else { URLDataSetSeismogram urlSeis = new URLDataSetSeismogram(seismogramFile.toURL(), filetype); curSeis = urlSeis.getSeismograms(); } for(int j = 0; j < curSeis.length; j++) { LocalSeismogram seis = cutter.apply(curSeis[j]); if(seis != null) { preliminaryResults.add(seis); } } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])preliminaryResults.toArray(new LocalSeismogramImpl[0]); for(int j = 0; j < seis.length; j++) { resultCollector.add(seis[j]); } } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while returning seismograms from the database." + "\n" + "The problem file is located at " + databaseResults.getString(4), e); } } else { try { while(databaseResults.next()) { RequestFilter req = new RequestFilter(chanTable.getId(databaseResults.getInt(1)), timeTable.get(databaseResults.getInt(2)), timeTable.get(databaseResults.getInt(3))); resultCollector.add(cutter.apply(req)); } } catch(Exception e) { GlobalExceptionHandler.handle("Problem occured while querying the database for seismograms.", e); } } } }
public EncodedCut(RequestFilter rf) { super(rf);
public EncodedCut(MicroSecondDate begin, MicroSecondDate end) { super(begin, end);
public EncodedCut(RequestFilter rf) { super(rf); }
return new LocalSeismogramImpl(seis, ds);
LocalSeismogramImpl outSeis = new LocalSeismogramImpl(seis, ds); outSeis.begin_time = seis.getBeginTime() .add((TimeInterval)seis.getSampling() .getPeriod() .multiplyBy(firstUsedPoint)) .getFissuresTime(); outSeis.num_points = pointsInNewSeis; return outSeis;
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) throws FissuresException { if(!overlaps(seis)) { return null; } if(!seis.is_encoded()) { return super.apply(seis); } int beginIndex = getBeginIndex(seis); int endIndex = getEndIndex(seis); List outData = new ArrayList(); EncodedData[] ed = seis.get_as_encoded(); int currentPoint = 0; for(int i = 0; i < ed.length && currentPoint < endIndex; i++) { if(currentPoint + ed[i].num_points > beginIndex) { outData.add(ed[i]); } currentPoint += ed[i].num_points; } TimeSeriesDataSel ds = new TimeSeriesDataSel(); ds.encoded_values((EncodedData[])outData.toArray(new EncodedData[outData.size()])); logger.debug(outData.size() + " encoded segments matched cut"); return new LocalSeismogramImpl(seis, ds); }
public Document createDocument(DataSet dataset, File dataDirectory)
public Element createDocument(DataSet dataset, File dataDirectory)
public Document createDocument(DataSet dataset, File dataDirectory) throws ParserConfigurationException, MalformedURLException { DocumentBuilder docBuilder = XMLDataSet.getDocumentBuilder(); Document doc = docBuilder.newDocument(); Element element = doc.createElement("dataset"); insert(element, dataset, dataDirectory); doc.appendChild(element); return doc; }
doc.appendChild(element); return doc;
return element;
public Document createDocument(DataSet dataset, File dataDirectory) throws ParserConfigurationException, MalformedURLException { DocumentBuilder docBuilder = XMLDataSet.getDocumentBuilder(); Document doc = docBuilder.newDocument(); Element element = doc.createElement("dataset"); insert(element, dataset, dataDirectory); doc.appendChild(element); return doc; }
Attr id = doc.createAttribute("datasetid"); id.setValue(dataset.getId()); element.appendChild(id);
element.setAttribute("datasetid", dataset.getId());
public void insert(Element element, DataSet dataset, File directory) throws MalformedURLException { Document doc = element.getOwnerDocument(); Attr id = doc.createAttribute("datasetid"); id.setValue(dataset.getId()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", dataset.getName())); element.appendChild(XMLUtil.createTextElement(doc, "owner", dataset.getOwner())); String[] childDataSets = dataset.getDataSetNames(); for (int i = 0; i < childDataSets.length; i++) { Element child = doc.createElement("dataset"); insert(child, dataset.getDataSet(childDataSets[i]), directory); element.appendChild(child); } String[] childDSS = dataset.getDataSetSeismogramNames(); for (int i = 0; i < childDSS.length; i++) { DataSetSeismogram dss = dataset.getDataSetSeismogram(childDSS[i]); URLDataSetSeismogram urlDSS; if (saveLocally || ! (dss instanceof URLDataSetSeismogram)) { urlDSS = URLDataSetSeismogram.localize(dss, directory); } else { urlDSS = (URLDataSetSeismogram)dss; } Element child = doc.createElement("urlDataSetSeismogram"); urlDSS.insertInto(child); element.appendChild(child); } String[] paramNames = dataset.getParameterNames(); for (int i = 0; i < paramNames.length; i++) { Element parameter = doc.createElement("parameter"); XMLParameter.insert(parameter, paramNames[i], dataset.getParameter(paramNames[i])); element.appendChild(parameter); } }
Document doc = createDocument(dataset, saveDirectory); Writer xmlWriter = new Writer(true);
Element doc = createDocument(dataset, saveDirectory); Writer xmlWriter = new Writer();
public void save(DataSet dataset, File saveDirectory) throws IOException, ParserConfigurationException, MalformedURLException { File dataDir = new File(saveDirectory, "data"); Document doc = createDocument(dataset, saveDirectory); Writer xmlWriter = new Writer(true); BufferedWriter buf = new BufferedWriter(new FileWriter(new File(saveDirectory, dataset.getName()+".dsml"))); xmlWriter.setOutput(buf); xmlWriter.write(doc); buf.close(); }
logger.debug("Done with save to "+saveDirectory.toString());
public void save(DataSet dataset, File saveDirectory) throws IOException, ParserConfigurationException, MalformedURLException { File dataDir = new File(saveDirectory, "data"); Document doc = createDocument(dataset, saveDirectory); Writer xmlWriter = new Writer(true); BufferedWriter buf = new BufferedWriter(new FileWriter(new File(saveDirectory, dataset.getName()+".dsml"))); xmlWriter.setOutput(buf); xmlWriter.write(doc); buf.close(); }
if (findGroup(group.getAccount()) != null) { throw new CalFacadeException(CalFacadeException.duplicateAdminGroup); }
public void addGroup(BwGroup group) throws CalFacadeException { getSess().save(group); }
if (iHandler != null && !(iHandler instanceof HiddenInputHandler)) {
if (iHandler != null && !isHidden) {
private void generateDataSource(IWContext iwc) throws XMLException, Exception { Locale currentLocale = iwc.getCurrentLocale(); if(_queryPK != null) { QueryService service = (QueryService)(IBOLookup.getServiceInstance(iwc,QueryService.class)); _dataSource = service.generateQueryResult(_queryPK, iwc); } else if (_methodInvokeDoc != null) { List mDescs = _methodInvokeDoc.getMethodDescriptions(); if (mDescs != null) { Iterator it = mDescs.iterator(); if (it.hasNext()) { MethodDescription mDesc = (MethodDescription) it.next(); ClassDescription mainClassDesc = mDesc.getClassDescription(); Class mainClass = mainClassDesc.getClassObject(); String type = mainClassDesc.getType(); String methodName = mDesc.getName(); MethodInput input = mDesc.getInput(); List parameters = null; if (input != null) { parameters = input.getClassDescriptions(); } Object[] prmVal = null; Class[] paramTypes = null; if (parameters != null) { prmVal = new Object[parameters.size()]; paramTypes = new Class[parameters.size()]; ListIterator iterator = parameters.listIterator(); while (iterator.hasNext()) { int index = iterator.nextIndex(); ClassDescription clDesc = (ClassDescription) iterator.next(); Class prmClassType = clDesc.getClassObject(); paramTypes[index] = prmClassType; String[] prmValues = iwc.getParameterValues(getParameterName(clDesc.getName())); String prm = null; Object obj = null; if (prmValues != null && prmValues.length > 0) { prm = prmValues[0]; } ClassHandler cHandler = clDesc.getClassHandler(); InputHandler iHandler = null; if (cHandler != null) { iHandler = cHandler.getHandler(); } if (iHandler != null && !(iHandler instanceof HiddenInputHandler)) { obj = iHandler.getResultingObject(prmValues, iwc); String displayNameOfValue = iHandler.getDisplayNameOfValue(obj, iwc); if (displayNameOfValue != null) { _parameterMap.put(clDesc.getName(), displayNameOfValue); } } else { //ONLY HANDLES ONE VALUE! obj = getParameterObject(iwc, prm, prmClassType); _parameterMap.put(clDesc.getName(), prm); } _parameterMap.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":"); // switch (index) { // case 0: // obj = new IWTimestamp(23,12,1898).getDate(); // break; // case 1: // obj = new IWTimestamp(23,12,1920).getDate(); // break; // case 2: // obj = new // IWTimestamp(2002,7,10,15,17,39).getTimestamp(); // break; // case 3: // obj = new // IWTimestamp(2002,7,12,15,17,40).getTimestamp(); // break; // } prmVal[index] = obj; } } else { // prmVal = String[0]; } Object forInvocationOfMethod = null; if (ClassDescription.VALUE_TYPE_IDO_SESSION_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getSessionInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_SERVICE_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getServiceInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_ENTITY_HOME.equals(type)) { forInvocationOfMethod = IDOLookup.getHome(mainClass); //System.out.println("["+this.getClassName()+"]: // not implemented yet for this classType: // "+type); } else { //ClassDescription.VALUE_TYPE_CLASS.equals(type)) forInvocationOfMethod = mainClass.newInstance(); } MethodFinder mf = MethodFinder.getInstance(); Method method = mf.getMethodWithNameAndParameters(mainClass, methodName, paramTypes); try { _dataSource = (JRDataSource) method.invoke(forInvocationOfMethod, prmVal); } catch (InvocationTargetException e) { Throwable someException = e.getTargetException(); if (someException != null && someException instanceof Exception) { throw (Exception) someException; } else { throw e; } } if (_dataSource != null && _dataSource instanceof ReportableCollection) { _extraHeaderParameters = ((ReportableCollection) _dataSource).getExtraHeaderParameters(); if (_extraHeaderParameters != null) { _parameterMap.putAll(_extraHeaderParameters); } } } } } }
else {
else if (!isHidden){
private void generateDataSource(IWContext iwc) throws XMLException, Exception { Locale currentLocale = iwc.getCurrentLocale(); if(_queryPK != null) { QueryService service = (QueryService)(IBOLookup.getServiceInstance(iwc,QueryService.class)); _dataSource = service.generateQueryResult(_queryPK, iwc); } else if (_methodInvokeDoc != null) { List mDescs = _methodInvokeDoc.getMethodDescriptions(); if (mDescs != null) { Iterator it = mDescs.iterator(); if (it.hasNext()) { MethodDescription mDesc = (MethodDescription) it.next(); ClassDescription mainClassDesc = mDesc.getClassDescription(); Class mainClass = mainClassDesc.getClassObject(); String type = mainClassDesc.getType(); String methodName = mDesc.getName(); MethodInput input = mDesc.getInput(); List parameters = null; if (input != null) { parameters = input.getClassDescriptions(); } Object[] prmVal = null; Class[] paramTypes = null; if (parameters != null) { prmVal = new Object[parameters.size()]; paramTypes = new Class[parameters.size()]; ListIterator iterator = parameters.listIterator(); while (iterator.hasNext()) { int index = iterator.nextIndex(); ClassDescription clDesc = (ClassDescription) iterator.next(); Class prmClassType = clDesc.getClassObject(); paramTypes[index] = prmClassType; String[] prmValues = iwc.getParameterValues(getParameterName(clDesc.getName())); String prm = null; Object obj = null; if (prmValues != null && prmValues.length > 0) { prm = prmValues[0]; } ClassHandler cHandler = clDesc.getClassHandler(); InputHandler iHandler = null; if (cHandler != null) { iHandler = cHandler.getHandler(); } if (iHandler != null && !(iHandler instanceof HiddenInputHandler)) { obj = iHandler.getResultingObject(prmValues, iwc); String displayNameOfValue = iHandler.getDisplayNameOfValue(obj, iwc); if (displayNameOfValue != null) { _parameterMap.put(clDesc.getName(), displayNameOfValue); } } else { //ONLY HANDLES ONE VALUE! obj = getParameterObject(iwc, prm, prmClassType); _parameterMap.put(clDesc.getName(), prm); } _parameterMap.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":"); // switch (index) { // case 0: // obj = new IWTimestamp(23,12,1898).getDate(); // break; // case 1: // obj = new IWTimestamp(23,12,1920).getDate(); // break; // case 2: // obj = new // IWTimestamp(2002,7,10,15,17,39).getTimestamp(); // break; // case 3: // obj = new // IWTimestamp(2002,7,12,15,17,40).getTimestamp(); // break; // } prmVal[index] = obj; } } else { // prmVal = String[0]; } Object forInvocationOfMethod = null; if (ClassDescription.VALUE_TYPE_IDO_SESSION_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getSessionInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_SERVICE_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getServiceInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_ENTITY_HOME.equals(type)) { forInvocationOfMethod = IDOLookup.getHome(mainClass); //System.out.println("["+this.getClassName()+"]: // not implemented yet for this classType: // "+type); } else { //ClassDescription.VALUE_TYPE_CLASS.equals(type)) forInvocationOfMethod = mainClass.newInstance(); } MethodFinder mf = MethodFinder.getInstance(); Method method = mf.getMethodWithNameAndParameters(mainClass, methodName, paramTypes); try { _dataSource = (JRDataSource) method.invoke(forInvocationOfMethod, prmVal); } catch (InvocationTargetException e) { Throwable someException = e.getTargetException(); if (someException != null && someException instanceof Exception) { throw (Exception) someException; } else { throw e; } } if (_dataSource != null && _dataSource instanceof ReportableCollection) { _extraHeaderParameters = ((ReportableCollection) _dataSource).getExtraHeaderParameters(); if (_extraHeaderParameters != null) { _parameterMap.putAll(_extraHeaderParameters); } } } } } }
_parameterMap.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":");
if (!isHidden) { _parameterMap.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":"); }
private void generateDataSource(IWContext iwc) throws XMLException, Exception { Locale currentLocale = iwc.getCurrentLocale(); if(_queryPK != null) { QueryService service = (QueryService)(IBOLookup.getServiceInstance(iwc,QueryService.class)); _dataSource = service.generateQueryResult(_queryPK, iwc); } else if (_methodInvokeDoc != null) { List mDescs = _methodInvokeDoc.getMethodDescriptions(); if (mDescs != null) { Iterator it = mDescs.iterator(); if (it.hasNext()) { MethodDescription mDesc = (MethodDescription) it.next(); ClassDescription mainClassDesc = mDesc.getClassDescription(); Class mainClass = mainClassDesc.getClassObject(); String type = mainClassDesc.getType(); String methodName = mDesc.getName(); MethodInput input = mDesc.getInput(); List parameters = null; if (input != null) { parameters = input.getClassDescriptions(); } Object[] prmVal = null; Class[] paramTypes = null; if (parameters != null) { prmVal = new Object[parameters.size()]; paramTypes = new Class[parameters.size()]; ListIterator iterator = parameters.listIterator(); while (iterator.hasNext()) { int index = iterator.nextIndex(); ClassDescription clDesc = (ClassDescription) iterator.next(); Class prmClassType = clDesc.getClassObject(); paramTypes[index] = prmClassType; String[] prmValues = iwc.getParameterValues(getParameterName(clDesc.getName())); String prm = null; Object obj = null; if (prmValues != null && prmValues.length > 0) { prm = prmValues[0]; } ClassHandler cHandler = clDesc.getClassHandler(); InputHandler iHandler = null; if (cHandler != null) { iHandler = cHandler.getHandler(); } if (iHandler != null && !(iHandler instanceof HiddenInputHandler)) { obj = iHandler.getResultingObject(prmValues, iwc); String displayNameOfValue = iHandler.getDisplayNameOfValue(obj, iwc); if (displayNameOfValue != null) { _parameterMap.put(clDesc.getName(), displayNameOfValue); } } else { //ONLY HANDLES ONE VALUE! obj = getParameterObject(iwc, prm, prmClassType); _parameterMap.put(clDesc.getName(), prm); } _parameterMap.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":"); // switch (index) { // case 0: // obj = new IWTimestamp(23,12,1898).getDate(); // break; // case 1: // obj = new IWTimestamp(23,12,1920).getDate(); // break; // case 2: // obj = new // IWTimestamp(2002,7,10,15,17,39).getTimestamp(); // break; // case 3: // obj = new // IWTimestamp(2002,7,12,15,17,40).getTimestamp(); // break; // } prmVal[index] = obj; } } else { // prmVal = String[0]; } Object forInvocationOfMethod = null; if (ClassDescription.VALUE_TYPE_IDO_SESSION_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getSessionInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_SERVICE_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getServiceInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_ENTITY_HOME.equals(type)) { forInvocationOfMethod = IDOLookup.getHome(mainClass); //System.out.println("["+this.getClassName()+"]: // not implemented yet for this classType: // "+type); } else { //ClassDescription.VALUE_TYPE_CLASS.equals(type)) forInvocationOfMethod = mainClass.newInstance(); } MethodFinder mf = MethodFinder.getInstance(); Method method = mf.getMethodWithNameAndParameters(mainClass, methodName, paramTypes); try { _dataSource = (JRDataSource) method.invoke(forInvocationOfMethod, prmVal); } catch (InvocationTargetException e) { Throwable someException = e.getTargetException(); if (someException != null && someException instanceof Exception) { throw (Exception) someException; } else { throw e; } } if (_dataSource != null && _dataSource instanceof ReportableCollection) { _extraHeaderParameters = ((ReportableCollection) _dataSource).getExtraHeaderParameters(); if (_extraHeaderParameters != null) { _parameterMap.putAll(_extraHeaderParameters); } } } } } }
Iterator e = globalFilters.iterator(); while(e.hasNext()){ applyFilter((ColoredFilter)e.next()); } }
public void add(DataSetSeismogram[] seismos){ registrar.add(seismos); for(int i = 0; i < seismos.length; i++){ if(seismos[i] ! = null){ seismograms.add(seismos[i]); SeismogramShape newPlotter; if (autoColor) { newPlotter = new SeismogramShape(seismos[i], seisColors[seisCount%seisColors.length]); }else { newPlotter = new SeismogramShape(seismos[i], Color.blue); } // end of else if(parent != null){ newPlotter.setVisibility(parent.getOriginalVisibility()); } plotters.add(seisCount, newPlotter); seisCount++; } }
semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.PropertyEditPart.VISUAL_ID);
semanticHint = UMLVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID);
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.PropertyEditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } }
form.getErr().emit("org.bedework.error.nosuchevent", id);
form.getErr().emit("org.bedework.client.error.nosuchevent", id);
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getEventId(); if (id < 0) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } CalSvcI svci = form.getCalSvcI(); EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEvent proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); svci.addEvent(proxy, null); form.getMsg().emit("org.bedework.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
form.getMsg().emit("org.bedework.message.added.eventrefs", 1);
form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1);
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getEventId(); if (id < 0) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } CalSvcI svci = form.getCalSvcI(); EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEvent proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); svci.addEvent(proxy, null); form.getMsg().emit("org.bedework.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
if (!((this.queryAttributes != null && seed.keySet().containsAll(this.queryAttributes)) || (this.queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) {
args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } } else if (this.queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())) { if (this.log.isDebugEnabled()) { this.log.debug("Constructing argument name array from the defaultAttributeName"); } args = new Object[] { this.getDefaultAttributeName() }; } else { if (this.log.isDebugEnabled()) { this.log.debug("The seed does not contain the required information to run the query, returning null."); }
public final Map getUserAttributes(final Map seed) { // Checks to make sure the argument & state is valid if (seed == null) throw new IllegalArgumentException("The query seed Map cannot be null."); //Ensure the data needed to run the query is avalable if (!((this.queryAttributes != null && seed.keySet().containsAll(this.queryAttributes)) || (this.queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) { return null; } // Can't just to a toArray here since the order of the keys in the Map // may not match the order of the keys in the List and it is important to // the query. final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } return this.getUserAttributesIfNeeded(args); }
} final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName);
public final Map getUserAttributes(final Map seed) { // Checks to make sure the argument & state is valid if (seed == null) throw new IllegalArgumentException("The query seed Map cannot be null."); //Ensure the data needed to run the query is avalable if (!((this.queryAttributes != null && seed.keySet().containsAll(this.queryAttributes)) || (this.queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) { return null; } // Can't just to a toArray here since the order of the keys in the Map // may not match the order of the keys in the List and it is important to // the query. final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } return this.getUserAttributesIfNeeded(args); }
form.getErr().emit("org.bedework.error.missingsubscriptionid");
form.getErr().emit("org.bedework.client.error.missingsubscriptionid");
protected EventInfo findEvent(HttpServletRequest request, BwActionFormBase form) throws Throwable { EventInfo ev = null; /* XXX temp set up subscription here - we'll pass it to svci later */ int subid = getIntReqPar(request, "subid", -1); if (subid < 0) { form.getErr().emit("org.bedework.error.missingsubscriptionid"); return null; } CalSvcI svci = form.getCalSvcI(); BwSubscription sub = svci.getSubscription(subid); if (sub == null) { form.getErr().emit("org.bedework.error.missingsubscriptionid"); return null; } String guid = request.getParameter("guid"); if (Util.checkNull(guid) != null) { if (debug) { debugMsg("Get event by guid"); } String rid = Util.checkNull(request.getParameter("recurrenceId")); int retMethod = CalFacadeDefs.retrieveRecurMaster; Collection evs = svci.getEvent(guid, rid, retMethod); if (debug) { debugMsg("Get event by guid found " + evs.size()); } if (evs.size() == 1) { ev = (EventInfo)evs.iterator().next(); } else { // XXX this needs dealing with } } if (ev == null) { form.getErr().emit("org.bedework.error.nosuchevent", /*eid*/guid); return null; } else if (debug) { debugMsg("Get event by guid found " + ev.getEvent()); } ev.setSubscription(sub); return ev; }
form.getErr().emit("org.bedework.error.nosuchevent", guid);
form.getErr().emit("org.bedework.client.error.nosuchevent", guid);
protected EventInfo findEvent(HttpServletRequest request, BwActionFormBase form) throws Throwable { EventInfo ev = null; /* XXX temp set up subscription here - we'll pass it to svci later */ int subid = getIntReqPar(request, "subid", -1); if (subid < 0) { form.getErr().emit("org.bedework.error.missingsubscriptionid"); return null; } CalSvcI svci = form.getCalSvcI(); BwSubscription sub = svci.getSubscription(subid); if (sub == null) { form.getErr().emit("org.bedework.error.missingsubscriptionid"); return null; } String guid = request.getParameter("guid"); if (Util.checkNull(guid) != null) { if (debug) { debugMsg("Get event by guid"); } String rid = Util.checkNull(request.getParameter("recurrenceId")); int retMethod = CalFacadeDefs.retrieveRecurMaster; Collection evs = svci.getEvent(guid, rid, retMethod); if (debug) { debugMsg("Get event by guid found " + evs.size()); } if (evs.size() == 1) { ev = (EventInfo)evs.iterator().next(); } else { // XXX this needs dealing with } } if (ev == null) { form.getErr().emit("org.bedework.error.nosuchevent", /*eid*/guid); return null; } else if (debug) { debugMsg("Get event by guid found " + ev.getEvent()); } ev.setSubscription(sub); return ev; }
form.getErr().emit("org.bedework.error.exc", t.getMessage());
form.getErr().emit("org.bedework.client.error.exc", t.getMessage());
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.getCalSvcI().getUserAuth(s.getUser(), par); } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); return null; } form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { try { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); return null; } } return s; }
form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { try { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); return null; } }
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.getCalSvcI().getUserAuth(s.getUser(), par); } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); return null; } form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { try { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); return null; } } return s; }
form.getMsg().emit("org.bedework.message.cancelled");
form.getMsg().emit("org.bedework.client.message.cancelled");
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.getCalSvcI().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ form.initFields(); form.getMsg().emit("org.bedework.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
form.getErr().emit("org.bedework.error.noaccess", "for that action");
form.getErr().emit("org.bedework.client.error.noaccess", "for that action");
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.getCalSvcI().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ form.initFields(); form.getMsg().emit("org.bedework.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
form.getErr().emit("org.bedework.error.exc", t.getMessage());
form.getErr().emit("org.bedework.client.error.exc", t.getMessage());
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.getCalSvcI().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ form.initFields(); form.getMsg().emit("org.bedework.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
Vector v = new Vector();
ArrayList al = new ArrayList();
public Iterator getChildren(WebdavNsNode node) throws WebdavIntfException { try { CaldavBwNode uwnode = getBwnode(node); Vector v = new Vector(); if (!uwnode.getCollection()) { // Don't think we should have been called return v.iterator(); } if (debug) { debugMsg("About to get children for " + uwnode.getUri()); } Collection children = uwnode.getChildren(); String uri = uwnode.getUri(); BwCalendar parent = uwnode.getCDURI().getCal(); Iterator it = children.iterator(); while (it.hasNext()) { Object o = it.next(); BwCalendar cal = null; BwEvent ev = null; String name; if (o instanceof BwCalendar) { cal = (BwCalendar)o; name = cal.getName(); if (debug) { debugMsg("Found child " + cal); } } else if (o instanceof EventInfo) { cal = parent; EventInfo ei = (EventInfo)o; ev = ei.getEvent(); name = ev.getName(); } else { throw new WebdavIntfException("Unexpected return type"); } CaldavURI wi = findURI(uri + "/" + name, true, cal); getSvci(); if (wi.isCalendar()) { if (debug) { debugMsg("Add child as calendar"); } v.addElement(new CaldavCalNode(wi, svci, trans, debug)); } else { if (debug) { debugMsg("Add child as component"); } CaldavComponentNode cnode = new CaldavComponentNode(wi, svci, trans, debug); cnode.addEvent(ev); v.addElement(cnode); } } return v.iterator(); } catch (WebdavIntfException we) { throw we; } catch (Throwable t) { throw new WebdavIntfException(t); } }
return v.iterator();
return al.iterator();
public Iterator getChildren(WebdavNsNode node) throws WebdavIntfException { try { CaldavBwNode uwnode = getBwnode(node); Vector v = new Vector(); if (!uwnode.getCollection()) { // Don't think we should have been called return v.iterator(); } if (debug) { debugMsg("About to get children for " + uwnode.getUri()); } Collection children = uwnode.getChildren(); String uri = uwnode.getUri(); BwCalendar parent = uwnode.getCDURI().getCal(); Iterator it = children.iterator(); while (it.hasNext()) { Object o = it.next(); BwCalendar cal = null; BwEvent ev = null; String name; if (o instanceof BwCalendar) { cal = (BwCalendar)o; name = cal.getName(); if (debug) { debugMsg("Found child " + cal); } } else if (o instanceof EventInfo) { cal = parent; EventInfo ei = (EventInfo)o; ev = ei.getEvent(); name = ev.getName(); } else { throw new WebdavIntfException("Unexpected return type"); } CaldavURI wi = findURI(uri + "/" + name, true, cal); getSvci(); if (wi.isCalendar()) { if (debug) { debugMsg("Add child as calendar"); } v.addElement(new CaldavCalNode(wi, svci, trans, debug)); } else { if (debug) { debugMsg("Add child as component"); } CaldavComponentNode cnode = new CaldavComponentNode(wi, svci, trans, debug); cnode.addEvent(ev); v.addElement(cnode); } } return v.iterator(); } catch (WebdavIntfException we) { throw we; } catch (Throwable t) { throw new WebdavIntfException(t); } }
v.addElement(new CaldavCalNode(wi, svci, trans, debug));
al.add(new CaldavCalNode(wi, svci, trans, debug));
public Iterator getChildren(WebdavNsNode node) throws WebdavIntfException { try { CaldavBwNode uwnode = getBwnode(node); Vector v = new Vector(); if (!uwnode.getCollection()) { // Don't think we should have been called return v.iterator(); } if (debug) { debugMsg("About to get children for " + uwnode.getUri()); } Collection children = uwnode.getChildren(); String uri = uwnode.getUri(); BwCalendar parent = uwnode.getCDURI().getCal(); Iterator it = children.iterator(); while (it.hasNext()) { Object o = it.next(); BwCalendar cal = null; BwEvent ev = null; String name; if (o instanceof BwCalendar) { cal = (BwCalendar)o; name = cal.getName(); if (debug) { debugMsg("Found child " + cal); } } else if (o instanceof EventInfo) { cal = parent; EventInfo ei = (EventInfo)o; ev = ei.getEvent(); name = ev.getName(); } else { throw new WebdavIntfException("Unexpected return type"); } CaldavURI wi = findURI(uri + "/" + name, true, cal); getSvci(); if (wi.isCalendar()) { if (debug) { debugMsg("Add child as calendar"); } v.addElement(new CaldavCalNode(wi, svci, trans, debug)); } else { if (debug) { debugMsg("Add child as component"); } CaldavComponentNode cnode = new CaldavComponentNode(wi, svci, trans, debug); cnode.addEvent(ev); v.addElement(cnode); } } return v.iterator(); } catch (WebdavIntfException we) { throw we; } catch (Throwable t) { throw new WebdavIntfException(t); } }
v.addElement(cnode);
al.add(cnode);
public Iterator getChildren(WebdavNsNode node) throws WebdavIntfException { try { CaldavBwNode uwnode = getBwnode(node); Vector v = new Vector(); if (!uwnode.getCollection()) { // Don't think we should have been called return v.iterator(); } if (debug) { debugMsg("About to get children for " + uwnode.getUri()); } Collection children = uwnode.getChildren(); String uri = uwnode.getUri(); BwCalendar parent = uwnode.getCDURI().getCal(); Iterator it = children.iterator(); while (it.hasNext()) { Object o = it.next(); BwCalendar cal = null; BwEvent ev = null; String name; if (o instanceof BwCalendar) { cal = (BwCalendar)o; name = cal.getName(); if (debug) { debugMsg("Found child " + cal); } } else if (o instanceof EventInfo) { cal = parent; EventInfo ei = (EventInfo)o; ev = ei.getEvent(); name = ev.getName(); } else { throw new WebdavIntfException("Unexpected return type"); } CaldavURI wi = findURI(uri + "/" + name, true, cal); getSvci(); if (wi.isCalendar()) { if (debug) { debugMsg("Add child as calendar"); } v.addElement(new CaldavCalNode(wi, svci, trans, debug)); } else { if (debug) { debugMsg("Add child as component"); } CaldavComponentNode cnode = new CaldavComponentNode(wi, svci, trans, debug); cnode.addEvent(ev); v.addElement(cnode); } } return v.iterator(); } catch (WebdavIntfException we) { throw we; } catch (Throwable t) { throw new WebdavIntfException(t); } }
Collection nodes = new Vector();
Collection nodes = new ArrayList();
public Collection getFreeBusy(WebdavNsNode wdnode, FreeBusyQuery freeBusy) throws WebdavIntfException { try { CaldavBwNode uwnode = getBwnode(wdnode); if (!(uwnode instanceof CaldavCalNode)) { throw WebdavIntfException.badRequest(); } CaldavCalNode cnode = (CaldavCalNode)uwnode; String user = cnode.getCDURI().getOwner(); getSvci(); Iterator it = freeBusy.getFreeBusy(svci, user).iterator(); Collection nodes = new Vector(); while (it.hasNext()) { BwFreeBusy fb = (BwFreeBusy)it.next(); CaldavCalNode fbnode = (CaldavCalNode)cnode.clone(); fbnode.setFreeBusy(fb); nodes.add(fbnode); } return nodes; } catch (WebdavIntfException we) { throw we; } catch (Throwable t) { throw new WebdavIntfException(t); } }
String contextRoot = JspUtil.getContext(req); if ((contextRoot != null) && (contextRoot.startsWith("/"))) { contextRoot = contextRoot.substring(1); } if ((contextRoot == null) || (contextRoot.length() == 0)) { contextRoot = "root"; }
public void init(WebdavServlet servlet, HttpServletRequest req, Properties props, boolean debug) throws WebdavIntfException { super.init(servlet, req, props, debug); String contextRoot = JspUtil.getContext(req); if ((contextRoot != null) && (contextRoot.startsWith("/"))) { contextRoot = contextRoot.substring(1); } if ((contextRoot == null) || (contextRoot.length() == 0)) { contextRoot = "root"; } try { envPrefix = CalEnv.getProperty("org.bedework.envprefix." + contextRoot); namespacePrefix = WebdavUtils.getUrlPrefix(req); namespace = namespacePrefix + "/schema"; publicCalendarRoot = getSvci().getSyspars().getPublicCalendarRoot(); userCalendarRoot = getSvci().getSyspars().getUserCalendarRoot(); } catch (Throwable t) { throw new WebdavIntfException(t); } }
envPrefix = CalEnv.getProperty("org.bedework.envprefix." + contextRoot);
HttpSession session = req.getSession(); ServletContext sc = session.getServletContext(); String appName = sc.getInitParameter("bwappname"); if ((appName == null) || (appName.length() == 0)) { appName = "unknown-app-name"; } envPrefix = "org.bedework.app." + appName + ".";
public void init(WebdavServlet servlet, HttpServletRequest req, Properties props, boolean debug) throws WebdavIntfException { super.init(servlet, req, props, debug); String contextRoot = JspUtil.getContext(req); if ((contextRoot != null) && (contextRoot.startsWith("/"))) { contextRoot = contextRoot.substring(1); } if ((contextRoot == null) || (contextRoot.length() == 0)) { contextRoot = "root"; } try { envPrefix = CalEnv.getProperty("org.bedework.envprefix." + contextRoot); namespacePrefix = WebdavUtils.getUrlPrefix(req); namespace = namespacePrefix + "/schema"; publicCalendarRoot = getSvci().getSyspars().getPublicCalendarRoot(); userCalendarRoot = getSvci().getSyspars().getUserCalendarRoot(); } catch (Throwable t) { throw new WebdavIntfException(t); } }
Collection evnodes = new Vector();
Collection evnodes = new ArrayList();
public Collection query(WebdavNsNode wdnode, int retrieveRecur, Filter fltr) throws WebdavIntfException { CaldavBwNode node = getBwnode(wdnode); CalSvcI svci = getSvci(); Collection events; try { events = fltr.query(node, retrieveRecur, svci); } catch (WebdavException wde) { throw new WebdavIntfException(wde.getStatusCode()); } /* We now need to build a node for each of the events in the collection. For each event we first determine what calendar it's in. We then take the incoming uri, strip any calendar names off it and append the calendar name and event name to create the new uri. If there is no calendar name for the event we just give it the default. */ Collection evnodes = new Vector(); HashMap evnodeMap = new HashMap(); try { Iterator evit = events.iterator(); while (evit.hasNext()) { EventInfo ei = (EventInfo)evit.next(); BwEvent ev = ei.getEvent(); String uri = ev.getCalendar().getPath(); /* If no name was assigned use the guid */ String evName = ev.getName(); if (evName == null) { evName = ev.getGuid() + ".ics"; } String evuri = uri + "/" + evName; /* See if we've seen this one already - possible for recurring */ CaldavComponentNode evnode; evnode = (CaldavComponentNode)evnodeMap.get(evuri); if (evnode == null) { evnode = (CaldavComponentNode)getNode(evuri); } evnode.addEvent(ev); evnodes.add(evnode); evnodeMap.put(evuri, evnode); } evnodes = fltr.postFilter(evnodes); } catch (Throwable t) { error(t); throw WebdavIntfException.serverError(); } return evnodes; }
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = {"pdf"};
private String chooseOutputFile(String extension) { final JFileChooser fc; if (lastSaveLocation != null) { fc = new JFileChooser(lastSaveLocation); } else { fc = new JFileChooser(); } String extensions[] = new String[1]; extensions[0] = extension;
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = {"pdf"}; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(display); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile().getAbsolutePath(); } return null; }
fc.setDialogTitle("Save as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(display);
fc.setDialogTitle("Save to File"); fc.setSelectedFile(new File("output."+extension)); int returnVal = fc.showSaveDialog(null);
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = {"pdf"}; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(display); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile().getAbsolutePath(); } return null; }
return fc.getSelectedFile().getAbsolutePath();
File file = fc.getSelectedFile(); lastSaveLocation = file.getParentFile(); String newExtension = file.getName().substring(file.getName().lastIndexOf(".")+1); System.out.println("extension old="+file.getName()+" ext="+extension+" new="+newExtension); if ( ! newExtension.equalsIgnoreCase(extension)) { file = new File(file.getAbsolutePath()+"."+extension); } if (file.exists()) { Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display, "File "+file.getName()+" exists, replace?", "File Exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == JOptionPane.CANCEL_OPTION) { return null; } else if (n == JOptionPane.CANCEL_OPTION) { return chooseOutputFile(extension); } } String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else {
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = {"pdf"}; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(display); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile().getAbsolutePath(); } return null; }
String tmp = chooseOutputFile();
String tmp = chooseOutputFile("pdf");
public void createPDF() { if (display != null) { if (display instanceof VerticalSeismogramDisplay) { basicDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (basicDisplays == null) return; if (basicDisplays.size() == 0) { return; } } getImagesPerPage(basicDisplays.size()); if(seisPerPageSet){ String tmp = chooseOutputFile(); if (tmp != null) { createPDF(tmp); } } } }
"The number of seismograms selected must less than " + (numOfSeis + 1),
"The number of seismograms selected can be at most " + numOfSeis,
private void getImagesPerPage(int numSeis){ final int numOfSeis = numSeis; final JDialog dialog = new JDialog(); dialog.getContentPane().setLayout(new BorderLayout()); dialog.setTitle("Printing Options"); dialog.setModal(true); JLabel information = new JLabel("Seismograms per page: "); Integer[] numbers = new Integer[numOfSeis];//to initialize the combo box with correct values for(int i = 0; i < numOfSeis; i++){ numbers[i] = new Integer(i + 1); } final JComboBox options = new JComboBox(numbers); options.setEditable(true); options.setMaximumSize(options.getMinimumSize()); options.setPreferredSize(options.getMinimumSize()); if(numOfSeis < imagesPerPage){ imagesPerPage = numOfSeis; } options.setSelectedIndex(imagesPerPage-1); JButton next = new JButton("Next"); next.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dialog.dispose(); } }); JPanel north = new JPanel(new BorderLayout()); north.setBorder(EMPTY_BORDER); north.add(information, BorderLayout.WEST); north.add(options, BorderLayout.EAST); JPanel south = new JPanel(new BorderLayout()); south.setBorder(EMPTY_BORDER); south.add(cancel, BorderLayout.WEST); south.add(next, BorderLayout.EAST); dialog.getContentPane().add(north, BorderLayout.NORTH); dialog.getContentPane().add(south, BorderLayout.SOUTH); Toolkit tk = Toolkit.getDefaultToolkit(); dialog.setLocation(tk.getScreenSize().width/2, tk.getScreenSize().height/2); dialog.pack(); dialog.show(); }
"The number of seismograms selected must less than " + (numOfSeis + 1),
"The number of seismograms selected can be at most " + numOfSeis,
public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } }
this.events = new Vector();
this.events = new ArrayList();
public FormattedEvents(Collection events, CalendarInfo calInfo, CalTimezones ctz) { if (events == null) { this.events = new Vector(); } else { this.events = events; } this.calInfo = calInfo; this.ctz = ctz; }
seis.setProperty(seisNameKey, name);
seis.setName(name);
public void addSeismogram(LocalSeismogramImpl seis, AuditInfo[] audit) { seismogramNameCache = null; // Note this does not set the xlink, as the seis has not been saved anywhere yet. Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram");//doc.createElement("SacSeismogram"); String name =seis.getProperty(seisNameKey); if (name == null || name.length() == 0) { name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(name); seis.setProperty(seisNameKey, name); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); //localSeismogram.appendChild(seismogramAttr); Element propertyElement = doc.createElement("property"); propertyElement.appendChild(XMLUtil.createTextElement(doc, "name", "Name")); propertyElement.appendChild(XMLUtil.createTextElement(doc, "value", name)); ///seismogramAttr.appendChild(propertyElement); localSeismogram.appendChild(seismogramAttr); Property[] props = seis.getProperties(); //System.out.println("the length of the Properties of the seismogram are "+props.length); Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); propNameE.setNodeValue(props[i].name); propValueE = doc.createElement("value"); propValueE.setNodeValue(props[i].value); propE.appendChild(propNameE); propE.appendChild(propValueE); localSeismogram.appendChild(propE); } } config.appendChild(localSeismogram); seismogramCache.put(name, seis); logger.debug("added seis now "+getSeismogramNames().length+" seisnogram names."); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
seis.setProperty(seisNameKey, name);
seis.setName(name);
public void addSeismogramRef(LocalSeismogramImpl seis, URL seisURL, String name, Property[] props, ParameterRef[] parm_ids, AuditInfo[] audit) { seismogramNameCache = null; String baseStr = base.toString(); String seisStr = seisURL.toString(); if (seisStr.startsWith(baseStr)) { // use relative URL seisStr = seisStr.substring(baseStr.length()); } // end of if (seisStr.startsWith(baseStr)) Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram"); if(name == null || name.length() == 0) { name =seis.getProperty(seisNameKey); } if (name == null || name.length() == 0) { name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(name); seis.setProperty(seisNameKey, name); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); //localSeismogram.appendChild(seismogramAttr); Element propertyElement = doc.createElement("property"); propertyElement.appendChild(XMLUtil.createTextElement(doc, "name", "Name")); propertyElement.appendChild(XMLUtil.createTextElement(doc, "value", name)); //seismogramAttr.appendChild(propertyElement); localSeismogram.appendChild(seismogramAttr); Element data = doc.createElement("data"); data.setAttributeNS(xlinkNS, "xlink:type", "simple"); data.setAttributeNS(xlinkNS, "xlink:href", seisStr); data.setAttribute("seisType", "sac"); //Element nameE = doc.createElement("name"); // Text text = doc.createTextNode(name); //nameE.appendChild(text); //localSeismogram.appendChild(nameE); localSeismogram.appendChild(data); /* Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); text = doc.createTextNode(props[i].name); propNameE.appendChild(text); propValueE = doc.createElement("value"); text = doc.createTextNode(props[i].value); propValueE.appendChild(text); propE.appendChild(propNameE); propE.appendChild(propValueE); sac.appendChild(propE); } }*/ config.appendChild(localSeismogram); }
list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { return new JLabel(value.toString()); } }); try { Properties props = new Properties(ModuleContainer.getIdByClass(AudioPlayer.class)); props.load(); String s; for (int i = 0; (s = props.getString("entry"+i, null)) != null; i++) { try { add(new File(s)); } catch (Exception exc) { exc.printStackTrace(); } } } catch (Exception exc) { exc.printStackTrace(); }
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); this.owner = owner; try { dev = FactoryRegistry.systemRegistry().createAudioDevice(); } catch (Exception exc) { throw new RuntimeException(exc); } playList = new DefaultListModel(); final JList list = new JList(playList); JButton add = new JButton("Add File"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || f.toString().toLowerCase().endsWith(".mp3"); } public String getDescription() { return "*.mp3 files"; } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); playList.addElement(f); } } }); JButton del = new JButton("Delete File"); del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object[] arr = list.getSelectedValues(); if (arr != null) { for (int i = 0; i < arr.length; i++) { playList.removeElement(arr[i]); } } } }); JPanel p = new JPanel(); p.add(add); p.add(del); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); ControlPanel ctrlPanel = new ControlPanel(owner); add(ctrlPanel, BorderLayout.SOUTH); }
public void next() {
public synchronized void next() {
public void next() { pause(); playingIndex--; play(); }
playingIndex--;
playingIndex++;
public void next() { pause(); playingIndex--; play(); }
public void pause() {
public synchronized void pause() {
public void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); }
stream = null; player = null;
public void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
public void play() {
public synchronized void play() {
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
if (playingIndex == -1) {
if (playingIndex < 0) {
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
player.play();
Thread t = new Thread() { public void run() { try { player.play(); if (player.isComplete()) { next(); } } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } } }; t.setDaemon(true); t.start();
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
public void prev() {
public synchronized void prev() {
public void prev() { pause(); playingIndex++; play(); }
playingIndex++;
playingIndex--;
public void prev() { pause(); playingIndex++; play(); }
sess.save(user);
sess.update(user);
public void addUser(BwUser user) throws CalFacadeException { checkOpen(); user.setCategoryAccess(access.getDefaultPersonalAccess()); user.setLocationAccess(access.getDefaultPersonalAccess()); user.setSponsorAccess(access.getDefaultPersonalAccess()); user.setQuota(getSyspars().getDefaultUserQuota()); sess.save(user); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = "/" + getSyspars().getUserCalendarRoot(); sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.save(user); }
sess.saveOrUpdate(val);
sess.update(val);
private void logon(BwUser val) throws CalFacadeException { checkOpen(); Timestamp now = new Timestamp(System.currentTimeMillis()); val.setLogon(now); val.setLastAccess(now); sess.saveOrUpdate(val); }
null,
public CalSvcI getSvci() throws WebdavIntfException { if (svci != null) { if (!svci.isOpen()) { try { svci.open(); svci.beginTransaction(); } catch (Throwable t) { throw new WebdavIntfException(t); } } return svci; } try { svci = new CalSvc(); /* account is what we authenticated with. * user, if non-null, is the user calendar we want to access. */ CalSvcIPars pars = new CalSvcIPars(account, account, envPrefix, false, // publicAdmin true, // caldav null, // synchId debug); svci.init(pars); svci.open(); svci.beginTransaction(); trans = new IcalTranslator(svci.getIcalCallback(), debug); } catch (Throwable t) { throw new WebdavIntfException(t); } return svci; }
public BwOwnedDbentity(BwUser owner, boolean publick) {
public BwOwnedDbentity() {
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
this.owner = owner; this.publick = publick;
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
private void addProp(Vector v, QName tag, Object val) {
private void addProp(Collection c, QName tag, Object val) {
private void addProp(Vector v, QName tag, Object val) { if (val != null) { v.addElement(new WebdavProperty(tag, String.valueOf(val))); } }
v.addElement(new WebdavProperty(tag, String.valueOf(val)));
c.add(new WebdavProperty(tag, String.valueOf(val)));
private void addProp(Vector v, QName tag, Object val) { if (val != null) { v.addElement(new WebdavProperty(tag, String.valueOf(val))); } }
break;
allHere = false;
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true;
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive");
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
public void testPut() throws CodecException {
public void testPut() throws CodecException, SQLException {
public void testPut() throws CodecException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid);
public void testPut() throws CodecException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
form.setSubscriptions(svc.getSubscriptions());
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = getReqPar(request, "name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "notAdded"; } boolean makeDefaultView = false; String str = getReqPar(request, "makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.error.viewnotadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
if (form.getNewSession()) {
if (form.getNewSession() && !getPublicAdmin(form)) {
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; CalEnv env = getEnv(request, form); setConfig(request, form); setSessionAttr(request, "org.bedework.logprefix", form.retrieveConfig().getLogPrefix()); boolean guestMode = env.getAppBoolProperty("guestmode"); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = getReqPar(request, "adminUserId"); if (temp != null) { adminUserId = temp; } } BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } if (form.getNewSession()) { // Set to default view setView(null, form); } /* Set up ready for the action */ int temp = actionSetup(request, response, form); if (temp != forwardNoAction) { return forwards[temp]; } if (form.getNewSession()) { // Set the default skin BwPreferences prefs = form.fetchSvci().getUserPrefs(); String skinName = prefs.getSkinName(); form.getPresentationState().setSkinName(skinName); form.getPresentationState().setSkinNameSticky(true); } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } if (!getPublicAdmin(form)) { /* Set up or refresh frequently used information, */ getSubscriptions(form); } try { forward = doAction(request, response, s, form); if (!getPublicAdmin(form)) { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noAccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
openHibSess(); hibSave(o); closeHibSess();
if (false) { openHibSess(); hibSave(o); closeHibSess(); }
public void restoreFilter(BwFilter o) throws Throwable { openHibSess(); hibSave(o); closeHibSess(); }
if (atName.equals("xmlns") && atValue.equals("") == false)
if ((atName.equals("xmlns") && atValue.equals("")) == false)
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); Map nsMap = new HashMap(); String elPrefix = node.getPrefix(); if (elPrefix != null) { String nsURI = getNamespaceURI(elPrefix, element, rootNode); nsMap.put(elPrefix, nsURI); } Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String atPrefix = attr.getPrefix(); String atName = attr.getNodeName(); String atValue = normalize(attr.getNodeValue()); if (atPrefix != null && (atPrefix.equals("xmlns") || atPrefix.equals("xml")) == false) { String nsURI = getNamespaceURI(atPrefix, element, rootNode); nsMap.put(atPrefix, nsURI); } // Ignore xmlns='' if (atName.equals("xmlns") && atValue.equals("") == false) out.print(" " + atName + "='" + atValue + "'"); } // Add missing namespace declaration Iterator itPrefix = nsMap.keySet().iterator(); while (itPrefix.hasNext()) { String prefix = (String)itPrefix.next(); String nsURI = (String)nsMap.get(prefix); if (nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
System.out.println("THe e NEW AMPLITUDE is Min = "+getMinHorizontalAmplitude()+ " Max = "+getMaxHorizontalAmplitude());
public synchronized void addParticleMotionDisplay(DataSetSeismogram hseis, DataSetSeismogram vseis, TimeConfigRegistrar timeRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, String key, boolean horizPlane) { ParticleMotion particleMotion = new ParticleMotion(hseis, vseis, timeRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, color, key, horizPlane); displays.add(particleMotion); hunitRangeImpl = new UnitRangeImpl(getMinHorizontalAmplitude(), getMaxHorizontalAmplitude(), UnitImpl.COUNT); vunitRangeImpl = new UnitRangeImpl(getMinVerticalAmplitude(), getMaxVerticalAmplitude(), UnitImpl.COUNT); particleMotionDisplay.updateHorizontalAmpScale(hunitRangeImpl); particleMotionDisplay.updateVerticalAmpScale(vunitRangeImpl); }
logger.debug("IN DRAW AZIMUTH");
public void drawAzimuth(ParticleMotion particleMotion, Graphics2D graphics2D) { if(!particleMotion.isHorizontalPlane()) return; Shape sector = getSectorShape(); graphics2D.setColor(Color.blue); graphics2D.fill(sector); graphics2D.draw(sector); graphics2D.setStroke(new BasicStroke(2.0f)); graphics2D.setColor(Color.green); Shape azimuth = getAzimuthPath(); graphics2D.draw(azimuth); graphics2D.setStroke(new BasicStroke(1.0f)); }
logger.debug("IN DRAW LABELS");
public void drawLabels(ParticleMotion particleMotion, Graphics2D graphics2D) { Color color = new Color(0, 0, 0, 128); graphics2D.setColor(color); java.awt.Dimension dimension = getSize(); float fontSize = dimension.width / 20; if(fontSize < 4) fontSize = 4; else if(fontSize > 32) fontSize = 32; Font font = new Font("serif", Font.BOLD, (int)fontSize); graphics2D.setFont(font); String labelStr = new String(); labelStr = particleMotion.hseis.getSeismogram().getName(); int x = (dimension.width - (int)(labelStr.length()*fontSize)) / 2 - getInsets().left - getInsets().right; int y = dimension.height - 4; graphics2D.drawString(labelStr, x, y); labelStr = particleMotion.vseis.getSeismogram().getName(); x = font.getSize(); y = (dimension.height - (int)(labelStr.length()*fontSize)) / 2 - getInsets().top - getInsets().bottom; //get the original AffineTransform AffineTransform oldTransform = graphics2D.getTransform(); AffineTransform ct = AffineTransform.getTranslateInstance(x, y); graphics2D.transform(ct); graphics2D.transform(AffineTransform.getRotateInstance(Math.PI/2)); graphics2D.drawString(labelStr, 0, 0); //restore the original AffineTransform graphics2D.setTransform(oldTransform); }
if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); ((Graphics2D)g).draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION");
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
int[][] hPixels = SimplePlotUtil.compressYvalues(hseis,
int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.compressYvalues(hseis,
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
*/
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
int[][] vPixels = SimplePlotUtil.compressYvalues(vseis,
int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis,
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
for(int counter = 0; counter < len; counter++) {
/*for(int counter = 0; counter < len; counter++) {
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); } System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
}
}*/
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); } System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
logger.debug("IN PAINT COMPONENT");
public void paintComponent(Graphics g) { // if(setSelected == 1) g.setColor(Color.red); //else if(setSelected == 2) g.setColor(getBackground()); Graphics2D graphics2D = (Graphics2D)g; if(startPoint != null && endPoint != null) { graphics2D.setColor(Color.yellow); //logger.debug("Start Point "+startPoint.getX()+" "+startPoint.getY()); //logger.debug("End Point "+endPoint.getX()+" "+endPoint.getY()); java.awt.geom.Rectangle2D.Double rect = new java.awt.geom.Rectangle2D.Double(startPoint.getX(), startPoint.getY(), endPoint.getX() - startPoint.getX(), endPoint.getY() - startPoint.getY()); graphics2D.fill(rect); graphics2D.draw(rect); } int size = displays.size(); //first draw the azimuth if one of the display is horizontal plane for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); if(!displayKeys.contains(particleMotion.key)) continue; drawAzimuth(particleMotion, graphics2D); } for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; if(particleMotion.isSelected()) continue; drawParticleMotion(particleMotion, graphics2D); }//end of for System.out.println("ENd of the for"); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; //drawAzimuth(particleMotion, graphics2D); if(particleMotion.isSelected()) { particleMotion.setSelected(false); drawParticleMotion(particleMotion, g); } } }
Date endTime = Calendar.getInstance().getTime(); System.out.println("THE TIME TAKEN IS ********** "+ (endTime.getTime() - startTime.getTime()));
public void paintComponent(Graphics g) { // if(setSelected == 1) g.setColor(Color.red); //else if(setSelected == 2) g.setColor(getBackground()); Graphics2D graphics2D = (Graphics2D)g; if(startPoint != null && endPoint != null) { graphics2D.setColor(Color.yellow); //logger.debug("Start Point "+startPoint.getX()+" "+startPoint.getY()); //logger.debug("End Point "+endPoint.getX()+" "+endPoint.getY()); java.awt.geom.Rectangle2D.Double rect = new java.awt.geom.Rectangle2D.Double(startPoint.getX(), startPoint.getY(), endPoint.getX() - startPoint.getX(), endPoint.getY() - startPoint.getY()); graphics2D.fill(rect); graphics2D.draw(rect); } int size = displays.size(); //first draw the azimuth if one of the display is horizontal plane for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); if(!displayKeys.contains(particleMotion.key)) continue; drawAzimuth(particleMotion, graphics2D); } for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; if(particleMotion.isSelected()) continue; drawParticleMotion(particleMotion, graphics2D); }//end of for System.out.println("ENd of the for"); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; //drawAzimuth(particleMotion, graphics2D); if(particleMotion.isSelected()) { particleMotion.setSelected(false); drawParticleMotion(particleMotion, g); } } }
recalculateValues = true;
public void resize() { setSize(super.getSize()); //particleMotionDisplay.resize(); repaint(); }
param.setAttributeNS(xlinkNS, "type", "simple"); param.setAttributeNS(xlinkNS, "href", paramURL.toString());
param.setAttributeNS(xlinkNS, "xlink:type", "simple"); param.setAttributeNS(xlinkNS, "xlink:href", paramURL.toString());
public void addParameterRef(URL paramURL, String name, AuditInfo[] audit) { Document doc = config.getOwnerDocument(); Element param = doc.createElement("parameterRef"); param.setAttributeNS(xlinkNS, "type", "simple"); param.setAttributeNS(xlinkNS, "href", paramURL.toString()); Text text = doc.createTextNode(name); param.appendChild(text); config.appendChild(param); }
form.getErr().emit("org.bedework.client.missingfield", "name");
form.getErr().emit("org.bedework.client.error.missingfield", "name");
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
form.getErr().emit("org.bedework.client.notadded");
form.getErr().emit("org.bedework.client.error.viewnotadded");
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public SeismogramIterator(LocalSeismogramImpl[] seismograms){ this(seismograms, DisplayUtils.getFullTime(seismograms));
public SeismogramIterator(String name, LocalSeismogramImpl[] seismograms){ this(name, seismograms, DisplayUtils.getFullTime(seismograms));
public SeismogramIterator(LocalSeismogramImpl[] seismograms){ this(seismograms, DisplayUtils.getFullTime(seismograms)); }
SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){
Statistics stat = (Statistics)statisticsMap.get(seis); if(stat == null){
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }
statisticsMap.put(seis, stat);
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
public double[] minMaxMean(int startPoint, int endPoint){ double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; double meanStore = 0; for(int i = startPoint; i < endPoint; i++){ Object[] array = getSeisAtWithInternal(startPoint); LocalSeismogramImpl current = (LocalSeismogramImpl)array[0]; int internalStartPoint = ((Integer)array[1]).intValue(); if(!(current instanceof Gap)){ int lastPoint = ((int[])points.get(current))[1]; if((lastPoint - internalStartPoint) + i >= endPoint){ lastPoint = internalStartPoint + (endPoint - i); } Statistics curStat = getStatistics(current); double[] curMinMaxMean = curStat.minMaxMean(internalStartPoint, lastPoint); if(curMinMaxMean[0] < min){ min = curMinMaxMean[0]; } if(curMinMaxMean[1] > max){ max = curMinMaxMean[1]; } meanStore += curMinMaxMean[2]*(lastPoint-i); i +=lastPoint - internalStartPoint; } } double[] minMaxMean = {min, max, meanStore/(endPoint - startPoint)}; return minMaxMean; }
public double[] minMaxMean(){ return minMaxMean(currentPoint, lastPoint); }
public double[] minMaxMean(int startPoint, int endPoint){ double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; double meanStore = 0; for(int i = startPoint; i < endPoint; i++){ Object[] array = getSeisAtWithInternal(startPoint); LocalSeismogramImpl current = (LocalSeismogramImpl)array[0]; int internalStartPoint = ((Integer)array[1]).intValue(); if(!(current instanceof Gap)){ int lastPoint = ((int[])points.get(current))[1]; if((lastPoint - internalStartPoint) + i >= endPoint){ lastPoint = internalStartPoint + (endPoint - i); } Statistics curStat = getStatistics(current); double[] curMinMaxMean = curStat.minMaxMean(internalStartPoint, lastPoint); if(curMinMaxMean[0] < min){ min = curMinMaxMean[0]; } if(curMinMaxMean[1] > max){ max = curMinMaxMean[1]; } meanStore += curMinMaxMean[2]*(lastPoint-i); i +=lastPoint - internalStartPoint; } } double[] minMaxMean = {min, max, meanStore/(endPoint - startPoint)}; return minMaxMean; }
if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){
if(timeRange == DisplayUtils.ZERO_TIME){
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime());
long seisBegin = seisTimeRange.getBeginTime().getMicroSecondTime(); long seisEnd = seisTimeRange.getEndTime().getMicroSecondTime(); long timeBegin = timeRange.getBeginTime().getMicroSecondTime(); long timeEnd = timeRange.getEndTime().getMicroSecondTime(); currentPoint = (int)DisplayUtils.linearInterp(seisBegin, seisEnd, numPoints, timeBegin); lastPoint = (int)DisplayUtils.linearInterp(seisBegin, seisEnd, numPoints, timeEnd);
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
if (taggedEntityId(ent, name)) {
if (ownedEntityTags(ent, name)) {
public void field(String name) throws Exception { BwOrganizer ent = (BwOrganizer)top(); if (taggedEntityId(ent, name)) { return; } if (name.equals("cn")) { ent.setCn(stringFld()); } else if (name.equals("dir")) { ent.setDir(stringFld()); } else if (name.equals("lang")) { ent.setLanguage(stringFld()); } else if (name.equals("sent-by")) { ent.setSentBy(stringFld()); } else if (name.equals("organizer-uri")) { ent.setOrganizerUri(stringFld()); } else if (name.equals("orgseq")) { ent.setSeq(intFld()); } else { unknownTag(name); } }
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired,
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean publicEvent,
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
if (descriptionRequired) {
if (publicEvent) {
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
} else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength));
} else if (ev.getDescription().length() > maxDescLen) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(maxDescLen));
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
comp.update(file, true);
if (comp != null) { comp.update(file, true); }
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
comp.update(file, false);
if (comp != null) { comp.update(file, false); }
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
comp.update(file, false);
if (comp != null) { comp.update(file, false); }
public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); }
comp.update(file, true);
if (comp != null) { comp.update(file, true); }
public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); }