List of usage examples for java.util StringTokenizer hasMoreElements
public boolean hasMoreElements()
From source file:net.wastl.webmail.server.WebMailSession.java
public void setEnv() { // This will soon replace "ENV": model.setStateVar("base uri", parent.getBasePath()); model.setStateVar("img base uri", parent.getImageBasePath() + "/" + user.getPreferredLocale().getLanguage() + "/" + user.getTheme()); model.setStateVar("webmail version", parent.getVersion()); model.setStateVar("operating system", System.getProperty("os.name") + " " + System.getProperty("os.version") + "/" + System.getProperty("os.arch")); model.setStateVar("java virtual machine", System.getProperty("java.vendor") + " " + System.getProperty("java.vm.name") + " " + System.getProperty("java.version")); model.setStateVar("last login", user.getLastLogin()); model.setStateVar("first login", user.getFirstLogin()); model.setStateVar("session id", session_code); model.setStateVar("date", formatDate(System.currentTimeMillis())); model.setStateVar("max attach size", parent.getStorage().getConfig("MAX ATTACH SIZE")); model.setStateVar("current attach size", "" + attachments_size); // Add all languages to the state model.removeAllStateVars("language"); String lang = parent.getConfig("languages"); StringTokenizer tok = new StringTokenizer(lang, " "); while (tok.hasMoreTokens()) { String t = tok.nextToken(); model.addStateVar("language", t); model.removeAllStateVars("themes_" + t); StringTokenizer tok2 = new StringTokenizer(parent.getConfig("THEMES_" + t.toUpperCase()), " "); while (tok2.hasMoreElements()) { model.addStateVar("themes_" + t, (String) tok2.nextToken()); }//from www. j a v a2 s . c o m } model.removeAllStateVars("protocol"); Provider[] storeProviders = parent.getStoreProviders(); for (int i = 0; i < storeProviders.length; i++) { model.addStateVar("protocol", storeProviders[i].getProtocol()); } model.setStateVar("themeset", "themes_" + user.getPreferredLocale().getLanguage().toLowerCase()); }
From source file:marytts.tools.voiceimport.HTKLabeler.java
/** * //from w w w .j ava 2 s.c o m * This computes a string of phonetic symbols out of an prompt allophones mary xml: * - standard phones are taken from "ph" attribute * @param tokens * @return */ private String collectTranscription(NodeList tokens) { // TODO: make delims argument // String Tokenizer devides transcriptions into syllables // syllable delimiters and stress symbols are retained String delims = "',-"; // String storing the original transcription begins with a pause String orig = " pau "; // get original phone String for (int tNr = 0; tNr < tokens.getLength(); tNr++) { Element token = (Element) tokens.item(tNr); // only look at it if there is a sampa to change if (token.hasAttribute("ph")) { String sampa = token.getAttribute("ph"); List<String> sylsAndDelims = new ArrayList<String>(); StringTokenizer sTok = new StringTokenizer(sampa, delims, true); while (sTok.hasMoreElements()) { String currTok = sTok.nextToken(); if (delims.indexOf(currTok) == -1) { // current Token is no delimiter for (Allophone ph : allophoneSet.splitIntoAllophones(currTok)) { // orig += ph.name() + " "; if (ph.name().trim().equals("_")) continue; orig += replaceTrickyPhones(ph.name().trim()) + " "; } // ... for each phone } // ... if no delimiter } // ... while there are more tokens } // TODO: simplify if (token.getTagName().equals("t")) { // if the following element is no boundary, insert a non-pause delimiter if (tNr == tokens.getLength() - 1 || !((Element) tokens.item(tNr + 1)).getTagName().equals("boundary")) { orig += "vssil "; // word boundary } } else if (token.getTagName().equals("boundary")) { orig += "ssil "; // phrase boundary } else { // should be "t" or "boundary" elements assert (false); } } // ... for each t-Element orig += "pau"; return orig; }
From source file:marytts.tools.voiceimport.HTKLabeler.java
private String collectTranscriptionAndWord(NodeList tokens) { // TODO: make delims argument // String Tokenizer devides transcriptions into syllables // syllable delimiters and stress symbols are retained String delims = "',-"; // String storing the original transcription begins with a pause String orig = " pau "; String word, HTKWORD;// www .j a va 2 s. com boolean first_word_phone = true; // get original phone String for (int tNr = 0; tNr < tokens.getLength(); tNr++) { Element token = (Element) tokens.item(tNr); // only look at it if there is a sampa to change if (token.hasAttribute("ph")) { word = token.getTextContent().trim(); HTKWORD = word.toUpperCase(); first_word_phone = true; String sampa = token.getAttribute("ph"); List<String> sylsAndDelims = new ArrayList<String>(); StringTokenizer sTok = new StringTokenizer(sampa, delims, true); while (sTok.hasMoreElements()) { String currTok = sTok.nextToken(); if (delims.indexOf(currTok) == -1) { // current Token is no delimiter for (Allophone ph : allophoneSet.splitIntoAllophones(currTok)) { // orig += ph.name() + " "; if (ph.name().trim().equals("_")) continue; orig += replaceTrickyPhones(ph.name().trim()); if (first_word_phone) { orig += "-" + HTKWORD + " "; first_word_phone = false; } else orig += " "; } // ... for each phone } // ... if no delimiter } // ... while there are more tokens } // TODO: simplify if (token.getTagName().equals("t")) { // if the following element is no boundary, insert a non-pause delimiter if (tNr == tokens.getLength() - 1 || !((Element) tokens.item(tNr + 1)).getTagName().equals("boundary")) { orig += "vssil "; // word boundary } } else if (token.getTagName().equals("boundary")) { orig += "ssil "; // phrase boundary } else { // should be "t" or "boundary" elements assert (false); } } // ... for each t-Element orig += "pau"; return orig; }
From source file:marytts.tools.voiceimport.HTKLabeler.java
/** * //from w w w.ja v a 2 s.c om * This computes a string of words out of an prompt allophones mary xml: * - standard phones are taken from "ph" attribute * @param tokens * @return */ private String collectWordTranscription(NodeList tokens) { // TODO: make delims argument // String Tokenizer devides transcriptions into syllables // syllable delimiters and stress symbols are retained String delims = "',-"; // String storing the original transcription begins with a pause String orig = " pau "; String HTKWORD_xml_transcription; String mary_transcription; String HTKWORD, word; // get original phone String for (int tNr = 0; tNr < tokens.getLength(); tNr++) { Element token = (Element) tokens.item(tNr); // only look at it if there is a sampa to change if (token.hasAttribute("ph")) { HTKWORD_xml_transcription = ""; mary_transcription = ""; String sampa = token.getAttribute("ph"); mary_transcription = sampa.trim().replace(" ", ""); List<String> sylsAndDelims = new ArrayList<String>(); StringTokenizer sTok = new StringTokenizer(sampa, delims, true); while (sTok.hasMoreElements()) { String currTok = sTok.nextToken(); if (delims.indexOf(currTok) == -1) { // current Token is no delimiter for (Allophone ph : allophoneSet.splitIntoAllophones(currTok)) { // orig += ph.name() + " "; if (ph.name().trim().equals("_")) continue; HTKWORD_xml_transcription += replaceTrickyPhones(ph.name().trim()) + " "; //globalwordlexicon += HTKWORD + " " + HTKWORD_xml_transcription; } // ... for each phone } // ... if no delimiter } // ... while there are more tokens word = token.getTextContent().trim(); HTKWORD = word.toUpperCase(); HTKWORD_xml_transcription = HTKWORD_xml_transcription.trim(); if ((token.hasAttribute("g2p_method") && token.getAttribute("g2p_method").equals("privatedict")) // this is for rawxml entry with token with ph attribute || !token.hasAttribute("g2p_method")) { HTKWORD = HTKWORD + "_" + HTKWORD_xml_transcription.replaceAll(" ", ""); //System.out.println("HTKWORD private lexicon or rawxml ph: " + HTKWORD); } // dictionary //System.out.println("HTKWORD: " + HTKWORD + " HTKWORD_xml_transcription: " + HTKWORD_xml_transcription); HTKdictionary.add(HTKWORD + " " + HTKWORD_xml_transcription); Totaldictionary .add(HTKWORD + " " + HTKWORD_xml_transcription.replace(" ", "") + " " + mary_transcription); String[] entries; entries = lexicon.lookup(word); //insert here all the different possible transcriptions for (int i = 0; i < entries.length; i++) { String HTKTranscription = entries[i]; mary_transcription = HTKTranscription.replace(" ", ""); HTKTranscription = HTKTranscription.replace("' ", ""); HTKTranscription = HTKTranscription.replace("- ", ""); //TODO: replaceTrickyPhones HTKTranscription HTKdictionary.add(HTKWORD + " " + HTKTranscription); Totaldictionary .add(HTKWORD + " " + HTKTranscription.replace(" ", "") + " " + mary_transcription); } orig += HTKWORD + " "; } // TODO: simplify if (token.getTagName().equals("t")) { // if the following element is no boundary, insert a non-pause delimiter if (tNr == tokens.getLength() - 1 || !((Element) tokens.item(tNr + 1)).getTagName().equals("boundary")) { orig += "vssil "; // word boundary } } else if (token.getTagName().equals("boundary")) { orig += "ssil "; // phrase boundary } else { // should be "t" or "boundary" elements assert (false); } } // ... for each t-Element orig += "pau"; return orig; }
From source file:uk.co.marcoratto.ftp.FtpParser.java
private void commandMPUT() { if (!connected) { System.out.println("Not connected."); return;/*from www . ja v a2 s . co m*/ } String localFiles = ""; String remoteFile = null; if (args.size() == 0) { localFiles = Utility.input("(local-files):", ""); } else { String sep = ""; for (int j = 0; j < args.size(); j++) { localFiles += sep + args.get(j); sep = " "; } } logger.info("localFiles=" + localFiles); StringTokenizer st = new StringTokenizer(localFiles, " "); String localFileFilter = null; while (st.hasMoreElements()) { localFileFilter = (String) st.nextElement(); logger.info("localFileFilter=" + localFileFilter); FileFilter fileFilter = new WildcardFileFilter(localFileFilter); File[] files = this.localDir.listFiles(fileFilter); logger.info("Found " + files.length + " files."); for (int j = 0; j < files.length; j++) { String localFile = files[j].getName(); remoteFile = localFile; if (this.prompt) { String yesOrNot = Utility.input("mput " + localFile + "?", ""); if (!(yesOrNot.trim().equalsIgnoreCase("n")) && (!yesOrNot.trim().equalsIgnoreCase("no"))) { this.upload(localFile, remoteFile); } } else { this.upload(localFile, remoteFile); } } } }
From source file:de.dal33t.powerfolder.Controller.java
/** * Starts a connection listener for each port found in config property * "port" ("," separeted), if "random-port" is set to "true" this "port" * entry will be ignored and a random port will be used (between 49152 and * 65535).//from w w w . j ava2 s .co m */ private boolean initializeListenerOnLocalPort() { if (ConfigurationEntry.NET_BIND_RANDOM_PORT.getValueBoolean(this)) { bindRandomPort(); } else { String ports = ConfigurationEntry.NET_BIND_PORT.getValue(this); if ("0".equals(ports)) { logWarning("Not opening connection listener. (port=0)"); } else { if (ports == null) { ports = String.valueOf(ConnectionListener.DEFAULT_PORT); } StringTokenizer nizer = new StringTokenizer(ports, ","); while (nizer.hasMoreElements()) { String portStr = nizer.nextToken(); try { int port = Integer.parseInt(portStr); boolean listenerOpened = openListener(port); if (listenerOpened && connectionListener != null) { // set reconnect on first successfull listener nodeManager.getMySelf().getInfo().setConnectAddress(connectionListener.getAddress()); } if (!listenerOpened && !isUIOpen()) { logSevere("Couldn't bind to port " + port); // exit(1); // fatalStartError(Translation // .getTranslation("dialog.bind_error")); // return false; // Shouldn't reach this! } } catch (NumberFormatException e) { logFine("Unable to read listener port ('" + portStr + "') from config"); } } // If this is the GUI version we didn't kill the program yet, // even though // there might have been multiple failed tries. if (connectionListener == null) { portBindFailureProblem(ports); } } } if (ConfigurationEntry.NET_FIREWALL_OPENPORT.getValueBoolean(this)) { if (FirewallUtil.isFirewallAccessible() && connectionListener != null) { Thread opener = new Thread(new Runnable() { @Override public void run() { try { logFine("Opening port on Firewall."); FirewallUtil.openport(connectionListener.getPort()); portWasOpened = true; } catch (IOException e) { logInfo("Unable to open port " + connectionListener.getPort() + "/TCP in Windows Firewall. " + e); } } }, "Portopener"); opener.start(); try { opener.join(12000); } catch (InterruptedException e) { logSevere("Opening of ports failed: " + e); } } } return true; }
From source file:gtu._work.ui.ExecuteOpener.java
private void initGUI() { final SwingActionUtil swingUtil = SwingActionUtil.newInstance(this); ToolTipManager.sharedInstance().setInitialDelay(0); try {/*from ww w.j a v a2s . c o m*/ { this.setTitle("execute browser"); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setPreferredSize(new java.awt.Dimension(870, 551)); this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("frame.mouseClicked", evt); } }); } { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1); jTabbedPane1.setPreferredSize(new java.awt.Dimension(384, 265)); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { swingUtil.invokeAction("jTabbedPane1.stateChanged", evt); } }); jTabbedPane1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("jTabbedPane1.mouseClicked", evt); } }); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("file list", null, jPanel1, null); { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jPanel1.add(jPanel4, BorderLayout.NORTH); jPanel4.setPreferredSize(new java.awt.Dimension(508, 81)); { jScrollPane1 = new JScrollPane(); jPanel4.add(jScrollPane1, BorderLayout.CENTER); { exeArea = new JTextArea(); jScrollPane1.setViewportView(exeArea); } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jPanel5.setLayout(jPanel5Layout); jPanel4.add(jPanel5, BorderLayout.EAST); jPanel5.setPreferredSize(new java.awt.Dimension(202, 81)); { addArea = new JButton(); jPanel5.add(addArea, BorderLayout.CENTER); addArea.setText("addArea"); addArea.setPreferredSize(new java.awt.Dimension(58, 30)); addArea.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("addArea.actionPerformed", evt); } }); } } { queryText = new JTextField(); jPanel4.add(queryText, BorderLayout.NORTH); queryText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { public void process(DocumentEvent event) { try { String query = JCommonUtil.getDocumentText(event); Pattern ptn = Pattern.compile(query); DefaultListModel model = new DefaultListModel(); for (Object key : prop.keySet()) { String val = key.toString(); if (val.contains(query)) { model.addElement(key); continue; } if (ptn.matcher(val).find()) { model.addElement(key); continue; } } execList.setModel(model); } catch (Exception ex) { } } })); } } { jPanel3 = new JPanel(); jPanel1.add(jPanel3, BorderLayout.CENTER); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(480, 220)); { jScrollPane2 = new JScrollPane(); jPanel3.add(jScrollPane2, BorderLayout.CENTER); { DefaultListModel execListModel = new DefaultListModel(); for (Object obj : prop.keySet()) { execListModel.addElement((String) obj); } execList = new JList(); jScrollPane2.setViewportView(execList); execList.setModel(execListModel); execList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("execList.keyPressed", evt); } }); execList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { swingUtil.invokeAction("execList.valueChanged", evt); } }); execList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("execList.mouseClicked", evt); } }); } } } { jPanel6 = new JPanel(); jPanel1.add(jPanel6, BorderLayout.SOUTH); jPanel6.setPreferredSize(new java.awt.Dimension(741, 47)); { saveList = new JButton(); jPanel6.add(saveList); saveList.setText("save list to default properties"); saveList.setPreferredSize(new java.awt.Dimension(227, 28)); saveList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("saveList.actionPerformed", evt); } }); } { clearExecList = new JButton(); jPanel6.add(clearExecList); clearExecList.setText("clear properties"); clearExecList.setPreferredSize(new java.awt.Dimension(170, 28)); clearExecList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("clearExecList.actionPerformed", evt); } }); } { reloadList = new JButton(); jPanel6.add(reloadList); reloadList.setText("reload list"); reloadList.setPreferredSize(new java.awt.Dimension(156, 28)); reloadList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("reloadList.actionPerformed", evt); } }); } { contentFilterBtn = new JButton(); jPanel6.add(contentFilterBtn); contentFilterBtn.setText("content filter"); contentFilterBtn.setPreferredSize(new java.awt.Dimension(176, 27)); contentFilterBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("contentFilterBtn.actionPerformed", evt); } }); } } } { jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jTabbedPane1.addTab("config", null, jPanel2, null); jPanel2.setPreferredSize(new java.awt.Dimension(573, 300)); jPanel2.setLayout(jPanel2Layout); { executeAll = new JButton(); jPanel2.add(executeAll); executeAll.setText("execute all files"); executeAll.setPreferredSize(new java.awt.Dimension(137, 27)); executeAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("execute.actionPerformed", evt); } }); } { browser = new JButton(); jPanel2.add(browser); browser.setText("add file"); browser.setPreferredSize(new java.awt.Dimension(140, 28)); browser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("browser.actionPerformed", evt); } }); } { loadProp = new JButton(); jPanel2.add(loadProp); loadProp.setText("load properties"); loadProp.setPreferredSize(new java.awt.Dimension(158, 32)); loadProp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadProp.actionPerformed", evt); } }); } { executeExport = new JButton(); jPanel2.add(executeExport); executeExport.setText("export list"); executeExport.setPreferredSize(new java.awt.Dimension(145, 31)); executeExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("executeExport.actionPerformed", evt); } }); } { exportListHasOrignTree = new JButton(); jPanel2.add(exportListHasOrignTree); exportListHasOrignTree.setText("export list has orign tree"); exportListHasOrignTree.setPreferredSize(new java.awt.Dimension(204, 32)); exportListHasOrignTree.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("exportListHasOrignTree.actionPerformed", evt); } }); } { moveFiles = new JButton(); jPanel2.add(moveFiles); moveFiles.setText("move selected"); moveFiles.setPreferredSize(new java.awt.Dimension(161, 31)); moveFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("moveFiles.actionPerformed", evt); } }); } { deleteSelected = new JButton(); jPanel2.add(deleteSelected); deleteSelected.setText("delete selected"); deleteSelected.setPreferredSize(new java.awt.Dimension(165, 31)); deleteSelected.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("deleteSelected.actionPerformed", evt); } }); } { loadClipboardPath = new JButton(); jPanel2.add(loadClipboardPath); loadClipboardPath.setText("load clipboard path"); loadClipboardPath.setPreferredSize(new java.awt.Dimension(222, 31)); loadClipboardPath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadClipboardPath.actionPerformed", evt); } }); } { deleteEmptyDir = new JButton(); jPanel2.add(deleteEmptyDir); deleteEmptyDir.setText("delete empty dir"); deleteEmptyDir.setPreferredSize(new java.awt.Dimension(222, 31)); deleteEmptyDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("deleteEmptyDir.actionPerformed", evt); } }); } { openSvnUpdate = new JButton(); jPanel2.add(openSvnUpdate); openSvnUpdate.setText("list svn new or modify file"); openSvnUpdate.setPreferredSize(new java.awt.Dimension(210, 34)); openSvnUpdate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("openSvnUpdate.actionPerformed", evt); } }); } } { jPanel7 = new JPanel(); BorderLayout jPanel7Layout = new BorderLayout(); jPanel7.setLayout(jPanel7Layout); jTabbedPane1.addTab("properties", null, jPanel7, null); { jScrollPane3 = new JScrollPane(); jPanel7.add(jScrollPane3, BorderLayout.CENTER); jScrollPane3.setPreferredSize(new java.awt.Dimension(741, 415)); { DefaultListModel propertiesListModel = new DefaultListModel(); propertiesList = new JList(); reloadCurrentDirPropertiesList(); jScrollPane3.setViewportView(propertiesList); propertiesList.setModel(propertiesListModel); propertiesList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("propertiesList.keyPressed", evt); } }); propertiesList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("propertiesList.mouseClicked", evt); } }); } } } { jPanel8 = new JPanel(); BorderLayout jPanel8Layout = new BorderLayout(); jTabbedPane1.addTab("scanner", null, jPanel8, null); jPanel8.setLayout(jPanel8Layout); { jPanel9 = new JPanel(); jPanel8.add(jPanel9, BorderLayout.NORTH); jPanel9.setPreferredSize(new java.awt.Dimension(741, 187)); { scanDirText = new JTextField(); scanDirText.setToolTipText("scan dir"); jPanel9.add(scanDirText); scanDirText.setPreferredSize(new java.awt.Dimension(225, 24)); scanDirText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("scanDirText.mouseClicked", evt); } }); } { jScrollPane6 = new JScrollPane(); jPanel9.add(jScrollPane6); jScrollPane6.setPreferredSize(new java.awt.Dimension(168, 69)); { scannerText = new JTextArea(); scannerText.setToolTipText("query condition"); jScrollPane6.setViewportView(scannerText); } } { fileScan = new JButton(); jPanel9.add(fileScan); fileScan.setText("start / stop"); fileScan.setPreferredSize(new java.awt.Dimension(113, 24)); fileScan.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("fileScan.actionPerformed", evt); } }); } { useRegexOnly = new JCheckBox(); jPanel9.add(useRegexOnly); useRegexOnly.setText("regex only"); } { DefaultComboBoxModel scanTypeModel = new DefaultComboBoxModel(); for (ScanType s : ScanType.values()) { scanTypeModel.addElement(s); } scanType = new JComboBox(); scanType.setToolTipText("scan type"); jPanel9.add(scanType); scanType.setModel(scanTypeModel); scanType.setPreferredSize(new java.awt.Dimension(147, 24)); } { DefaultComboBoxModel jComboBox1Model = new DefaultComboBoxModel(); for (FileOrDirType f : FileOrDirType.values()) { jComboBox1Model.addElement(f); } fileOrDirTypeCombo = new JComboBox(); jPanel9.add(fileOrDirTypeCombo); fileOrDirTypeCombo.setModel(jComboBox1Model); fileOrDirTypeCombo.setToolTipText("scan file or directory!"); } { addListToExecList = new JButton(); jPanel9.add(addListToExecList); addListToExecList.setText("add list to file list"); addListToExecList.setPreferredSize(new java.awt.Dimension(158, 24)); addListToExecList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("addListToExecList.actionPerformed", evt); } }); } { ignoreScanText = new JTextField(); ignoreScanText.setToolTipText("ignore scan condition"); ignoreScanText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } String ignore = null; if (StringUtils.isBlank(ignore = ignoreScanText.getText())) { return; } DefaultListModel model = (DefaultListModel) ignoreScanList.getModel(); model.addElement(ignore); } }); jPanel9.add(ignoreScanText); ignoreScanText.setPreferredSize(new java.awt.Dimension(153, 24)); } { jScrollPane5 = new JScrollPane(); jPanel9.add(jScrollPane5); jScrollPane5.setPreferredSize(new java.awt.Dimension(125, 73)); jScrollPane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); { DefaultListModel ignoreScanListModel = new DefaultListModel(); ignoreScanList = new JList(); ignoreScanList.setToolTipText("ignore scan condition list"); jScrollPane5.setViewportView(ignoreScanList); ignoreScanList.setModel(ignoreScanListModel); ignoreScanList.setPreferredSize(new java.awt.Dimension(125, 73)); ignoreScanList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(ignoreScanList).defaultJListKeyPressed(evt); } }); } } { innerScannerText = new JTextField(); innerScannerText.setToolTipText("inner scan query condition"); jPanel9.add(innerScannerText); innerScannerText.setPreferredSize(new java.awt.Dimension(164, 24)); innerScannerText.addMouseListener(new MouseAdapter() { Thread innerScanThread = null; boolean innerScanStop = false; public void mouseClicked(MouseEvent evt) { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } final String innerText = innerScannerText.getText(); if (arrayBackupForInnerScan == null) { return; } innerScanStop = true; if (innerScanThread == null || innerScanThread.getState() == Thread.State.TERMINATED) { innerScanThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { innerScanStop = false; System.out.println( toString() + " ... start!! ==> " + innerScanStop); DefaultListModel model = new DefaultListModel(); scanList.setModel(model); for (int ii = 0; ii < arrayBackupForInnerScan.length; ii++) { if (arrayBackupForInnerScan[ii].toString() .contains(innerText)) { model.addElement(arrayBackupForInnerScan[ii]); } if (innerScanStop) { System.out.println(toString() + " ... over!! ==> " + innerScanStop); break; } } System.out.println(toString() + " ... run over!! ==> " + innerScanStop); } }, "innerScanner_" + System.currentTimeMillis()); innerScanThread.setDaemon(true); innerScanThread.start(); } } }); } } { jScrollPane4 = new JScrollPane(); jPanel8.add(jScrollPane4, BorderLayout.CENTER); { DefaultListModel scanListModel = new DefaultListModel(); scanList = new JList(); jScrollPane4.setViewportView(scanList); scanList.setModel(scanListModel); scanList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("scanList.mouseClicked", evt); } }); scanList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("scanList.keyPressed", evt); } }); } } { scannerStatus = new JLabel(); jPanel8.add(scannerStatus, BorderLayout.SOUTH); scannerStatus.setPreferredSize(new java.awt.Dimension(741, 27)); } } } swingUtil.addAction("moveFiles.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.getSize() == 0 || execList.getSelectedValues().length == 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("no selected file can move!", "ERROR"); return; } File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); File file = null; List<File> list = new ArrayList<File>(); for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (file.exists() && file.isFile()) { list.add(file); } } File fromBaseDir = FileUtil.exportReceiveBaseDir(list); System.out.println("fromBaseDir = " + fromBaseDir); int cutLen = 0; if (fromBaseDir != null) { cutLen = fromBaseDir.getAbsolutePath().length(); } StringBuilder err = new StringBuilder(); File newFile = null; for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (file.exists() && file.isFile()) { newFile = new File(exportListTo + "/" + file.getParent().substring(cutLen), file.getName()); newFile.getParentFile().mkdirs(); System.out.println("move to : " + newFile); file.renameTo(newFile); if (!newFile.exists()) { err.append(file + "\n"); } } } if (err.length() > 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("move file error : \n" + err, "ERROR"); } else { JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "move file success : " + execList.getSelectedValues().length, "SUCCESS"); } } }); swingUtil.addAction("deleteSelected.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { StringBuilder sb = new StringBuilder(); for (Object obj : execList.getSelectedValues()) { sb.append(new File((String) obj).getName() + "\n"); } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil.newInstance() .confirmButtonYesNo().iconWaringMessage() .showConfirmDialog("are you sure delete file : \n" + sb, "DELETE")) { return; } File file = null; sb = new StringBuilder(); for (Object obj : execList.getSelectedValues()) { file = new File((String) obj); if (!file.exists()) { continue; } if (file.isDirectory() && file.list().length == 0) { if (!file.delete()) { sb.append(file.getName() + "\n"); } continue; } if (!file.delete()) { sb.append(file.getName() + "\n"); } } if (sb.length() != 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("delete error list :\n" + sb, "ERROR"); } else { JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog("delete completed!", "SUCCESS"); } } }); swingUtil.addAction("loadClipboardPath.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = new File(ClipboardUtil.getInstance().getContents()); if (!file.exists()) { return; } List<File> list = new ArrayList<File>(); FileUtil.searchFileMatchs(file, ".*", list); prop.clear(); for (File f : list) { if (f.isFile()) { prop.setProperty(f.getAbsolutePath(), ""); } } DefaultListModel model = new DefaultListModel(); for (Object key : prop.keySet()) { model.addElement(key); } execList.setModel(model); } }); swingUtil.addAction("deleteEmptyDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file is not correct!", "ERROR"); return; } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil.newInstance() .iconWaringMessage().confirmButtonYesNo() .showConfirmDialog("are you sure delete empty dir in \n" + file, "WARRNING")) { return; } List<File> delDir = new ArrayList<File>(); FileUtil.deleteEmptyDir(file, delDir); JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "delete dir list : \n" + delDir.toString().replace(',', '\n'), "DELETE"); } }); swingUtil.addAction("browser.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectFileAndDirectory().showOpenDialog() .getApproveSelectedFile(); if (file != null) { DefaultListModel model = (DefaultListModel) execList.getModel(); model.addElement(file.getAbsolutePath()); } } }); swingUtil.addAction("addArea.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { if (StringUtils.isBlank(exeArea.getText())) { return; } DefaultListModel model = (DefaultListModel) execList.getModel(); StringTokenizer token = new StringTokenizer(exeArea.getText(), "\t\n\r\f"); while (token.hasMoreElements()) { String val = ((String) token.nextElement()).trim(); model.addElement(val); prop.put(val, ""); } } }); swingUtil.addAction("execute.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { String val = (String) enu.nextElement(); exec(val); } } }); swingUtil.addAction("execList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(execList).defaultJListKeyPressed(evt); } }); //DEFAULT PROP SAVE swingUtil.addAction("saveList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { String orignName = JOptionPaneUtil.newInstance().iconPlainMessage() .showInputDialog("input properties file name", "SAVE"); File saveFile = null; if (StringUtils.isNotBlank(orignName)) { String fileName = orignName; if (!fileName.toLowerCase().endsWith(".properties")) { fileName += ".properties"; } fileName = ExecuteOpener.class.getSimpleName() + "_" + fileName; prop.clear(); DefaultListModel model = (DefaultListModel) execList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { String val = (String) enu.nextElement(); prop.put(val, ""); } saveFile = new File(jarPositionDir, fileName); } else { saveFile = currentPropFile; } prop.store(new FileOutputStream(saveFile), orignName); JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(saveFile, "PROPERTIES CREATE"); } }); swingUtil.addAction("clearExecList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { // prop.clear(); // reloadExecListProperties(prop); execList.setModel(new DefaultListModel()); } }); swingUtil.addAction("execList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { // right button single click event if (JMouseEventUtil.buttonRightClick(1, evt)) { JPopupMenuUtil popupUtil = JPopupMenuUtil.newInstance(execList).applyEvent(evt); if (execList.getSelectedValues().length == 1) { popupUtil.addJMenuItem( JFileExecuteUtil.newInstance(new File((String) execList.getSelectedValues()[0])) .createDefaultJMenuItems()); popupUtil.addJMenuItem("----------------", false); } popupUtil.addJMenuItem("eclipse home", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); for (Object obj : arry) { try { Runtime.getRuntime().exec(String.format("cmd /c call \"%s\" \"%s\"", "C:/?/eclipse_jee/eclipse.exe", obj)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } } }); popupUtil.addJMenuItem("eclipse company", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); for (Object obj : arry) { try { Runtime.getRuntime().exec(String.format("cmd /c call \"%s\" \"%s\"", "C:/?/iisi_eclipse/eclipse.exe", obj)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } } }); popupUtil.addJMenuItem("----------------", false); popupUtil// .addJMenuItem("sort list", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); Object[] arry = model.toArray(); Arrays.sort(arry); DefaultListModel model2 = new DefaultListModel(); for (Object obj : arry) { model2.addElement(obj); } execList.setModel(model2); } }).addJMenuItem("keep exists", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model2 = new DefaultListModel(); for (Object obj : model.toArray()) { if (new File((String) obj).exists()) { model2.addElement(obj); } } execList.setModel(model2); } }).addJMenuItem("remove duplicate", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model2 = new DefaultListModel(); Set<String> set = new HashSet<String>(); for (Object obj : model.toArray()) { set.add((String) obj); } for (String val : set) { model2.addElement(val); } execList.setModel(model2); } }).addJMenuItem("remove folder", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { if (new File((String) model.getElementAt(ii)).isDirectory()) { model.removeElementAt(ii); ii--; } } } }).addJMenuItem("remove empty folder", new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultListModel model = (DefaultListModel) execList.getModel(); File dir = null; for (int ii = 0; ii < model.getSize(); ii++) { dir = new File((String) model.getElementAt(ii)); if (dir.isDirectory() && dir.list().length == 0) { model.removeElementAt(ii); ii--; } } } }).addJMenuItem("----------------", false) .addJMenuItem("diff left : " + (diffLeft != null ? diffLeft.getName() : ""), true, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File value = new File( (String) JListUtil.getLeadSelectionObject(execList)); if (value != null && value.isFile() && value.exists()) { diffLeft = value; } } }) .addJMenuItem("diff right : " + (diffRight != null ? diffRight.getName() : ""), true, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File value = new File( (String) JListUtil.getLeadSelectionObject(execList)); if (value != null && value.isFile() && value.exists()) { diffRight = value; } } }) .addJMenuItem((diffLeft != null && diffRight != null) ? "diff compare" : "", (diffLeft != null && diffRight != null), new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Runtime.getRuntime().exec(String.format( "cmd /c call TortoiseMerge.exe /base:\"%s\" /theirs:\"%s\"", diffLeft, diffRight)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }) .addJMenuItem((execList.getSelectedValues().length == 2) ? "diff compare" : "", (execList.getSelectedValues().length == 2), new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Runtime.getRuntime().exec(String.format( "cmd /c call TortoiseMerge.exe /base:\"%s\" /theirs:\"%s\"", execList.getSelectedValues()[0], execList.getSelectedValues()[1])); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }) .addJMenuItem("----------------", false)// .show();// } // left button double click event int pos = execList.getLeadSelectionIndex(); if (pos == -1) { return; } if (((MouseEvent) evt).getClickCount() < 2) { return; } DefaultListModel model = (DefaultListModel) execList.getModel(); String val = (String) model.getElementAt(pos); exec(val); } }); swingUtil.addAction("loadProp.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file not correct!", "ERROR"); return; } reloadExecListProperties(file); setTitle("load prop : " + file.getName()); } }); swingUtil.addAction("reloadList.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { reloadExecListProperties(prop); } }); swingUtil.addAction("exportListHasOrignTree.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.isEmpty()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("no file can export!", "ERROR"); return; } List<File> allList = new ArrayList<File>(); for (int ii = 0; ii < model.getSize(); ii++) { allList.add(new File((String) model.getElementAt(ii))); } File baseDir = FileUtil.exportReceiveBaseDir(allList); System.out.println("common base dir : " + baseDir); boolean dynamicBaseDir = baseDir == null; File tmp = null; File copyTo = null; int realCopyCount = 0; File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); for (int ii = 0; ii < model.getSize(); ii++) { String val = (String) model.getElementAt(ii); if (StringUtils.isBlank(val)) { continue; } tmp = new File(val); if (tmp.isDirectory()) { continue; } File copyFrom = getCorrectFile(tmp); if (dynamicBaseDir) { baseDir = FileUtil.getRoot(copyFrom); } copyTo = FileUtil.exportFileToTargetPath(copyFrom, baseDir, exportListTo); if (!copyTo.getParentFile().exists()) { copyTo.getParentFile().mkdirs(); } System.out.println("## file : " + tmp + " -- > " + copyFrom); System.out.println("\t copy to : " + copyTo); FileUtil.copyFile(copyFrom, copyTo); realCopyCount++; } JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "copy completed!\ntotal : " + model.getSize() + "\ncopy : " + realCopyCount, "SUCCESS"); } }); swingUtil.addAction("executeExport.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) execList.getModel(); if (model.isEmpty()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("no file can export!", "ERROR"); return; } File tmp = null; File copyTo = null; int realCopyCount = 0; File exportListTo = FileUtil.getDefaultExportDir(ExecuteOpener.class, true); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(exportListTo + "/output_log.txt"), "BIG5")); for (int ii = 0; ii < model.getSize(); ii++) { String val = (String) model.getElementAt(ii); if (StringUtils.isBlank(val)) { continue; } tmp = new File(val); if (tmp.isDirectory()) { continue; } if (isNeedToCopy(exportListTo, tmp)) { File copyFrom = getCorrectFile(tmp); System.out.println("## file : " + tmp + " -- > " + copyFrom); copyTo = new File(exportListTo, copyFrom.getName()); for (int jj = 0; copyTo.exists(); jj++) { String name = copyFrom.getName(); int pos = name.lastIndexOf("."); String prefix = name.substring(0, pos); String rearfix = name.substring(pos); copyTo = new File(exportListTo, prefix + "_R" + jj + rearfix); } FileUtil.copyFile(copyFrom, copyTo); writer.write(tmp.getAbsolutePath() + (!tmp.getName().equals(copyTo.getName()) ? "\t [rename] : " + copyTo.getName() : "")); realCopyCount++; } else { writer.write(tmp.getAbsolutePath() + "\t [has same file, ommit!]"); } writer.newLine(); } writer.flush(); writer.close(); JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog( "copy completed!\ntotal : " + model.getSize() + "\ncopy : " + realCopyCount, "SUCCESS"); } }); swingUtil.addAction("jTabbedPane1.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } File file = new File(getTitle()); if (file.exists()) { JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(file, "current properties"); } ClipboardUtil.getInstance().setContents(file); } }); swingUtil.addAction("propertiesList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { File file = (File) propertiesList.getSelectedValue(); JPopupMenuUtil.newInstance(propertiesList).applyEvent(evt) .addJMenuItem("reload list", new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { reloadCurrentDirPropertiesList(); } }).addJMenuItem(JFileExecuteUtil.newInstance(file).createDefaultJMenuItems()).show(); if (file == null) { return; } if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } prop.clear(); prop.load(new FileInputStream(file)); currentPropFile = file; reloadExecListProperties(prop); setTitle("properties : " + file.getName()); } }); swingUtil.addAction("propertiesList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } JListUtil.newInstance(propertiesList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("jTabbedPane1.stateChanged", new Action() { public void action(EventObject evt) throws Exception { if (jTabbedPane1.getSelectedIndex() == 2) { reloadCurrentDirPropertiesList(); } } }); swingUtil.addAction("scanList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(scanList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("scanList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { System.out.println("index = " + scanList.getLeadSelectionIndex()); final Object[] vals = scanList.getSelectedValues(); if (vals == null || vals.length == 0) { return; } JPopupMenuUtil.newInstance(scanList).applyEvent(evt) .addJMenuItem("add to file list : " + vals.length, new ActionListener() { public void actionPerformed(ActionEvent arg0) { File file = null; DefaultListModel model = (DefaultListModel) execList.getModel(); for (Object v : vals) { file = (File) v; model.addElement(file.getAbsolutePath()); } } }).show(); } }); swingUtil.addAction("fileScan.actionPerformed", new Action() { Thread scanMainThread = null; public void action(EventObject evt) throws Exception { String scanText_ = scannerText.getText(); final boolean anyFileMatch = StringUtils.isEmpty(scanText_); final String scanText = anyFileMatch ? UUID.randomUUID().toString() : scanText_; final FileOrDirType fileOrDirType = (FileOrDirType) fileOrDirTypeCombo.getSelectedItem(); String scanDir_ = scanDirText.getText(); final File scanDir = new File(scanDir_); if (StringUtils.isEmpty(scanDir_)) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("scan dir text can't empty!", "ERROR"); return; } if (!scanDir.exists()) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("directory is't exists!", "ERROR"); return; } Object[] igArry_ = ((DefaultListModel) ignoreScanList.getModel()).toArray(); final String[] igArry = new String[igArry_.length]; for (int ii = 0; ii < igArry.length; ii++) { igArry[ii] = (String) igArry_[ii]; } final boolean ignoreCheck = igArry.length > 0; final DefaultListModel model = new DefaultListModel(); final StringTokenizer tok = new StringTokenizer(scanText); if (scanMainThread == null || scanMainThread.getState() == Thread.State.TERMINATED) { scanMainThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { ScanType scanTp; public void run() { currentScannerThreadStop = false; final long startTime = System.currentTimeMillis(); scanTp = (ScanType) scanType.getSelectedItem(); List<Thread> threadList = new ArrayList<Thread>(); final Map<String, Integer> matchCountMap = new HashMap<String, Integer>(); for (; tok.hasMoreElements();) { final String scanVal = (String) tok.nextElement(); System.out.println("add scan condition = " + scanVal); Pattern ppp = null; try { ppp = Pattern.compile(scanVal); } catch (Exception ex) { System.out.println(ex); } final Pattern scanTextPattern = ppp; Thread currentScannerThread = new Thread( Thread.currentThread().getThreadGroup(), new Runnable() { int matchCount = 0; void addElement(File file) { if (scanTp.filter(anyFileMatch, scanVal, scanTextPattern, file, ignoreCheck, igArry)) { for (int ii = 0;; ii++) { try { model.addElement(file); matchCount++; break; } catch (Exception ex) { System.err.println( file + ", error occor !!! ==> " + ex); if (ii > 10) { break; } } } } } void find(File file) { if (currentScannerThreadStop) { return; } if (file == null || !file.exists()) { System.out .println("file == null || !file.exists()\t" + file); return; } scannerStatus.setText( model.getSize() + " : " + file.getAbsolutePath()); if (file.isDirectory()) { if (file.listFiles() != null) { for (File f : file.listFiles()) { find(f); } } else { System.out .println("file.listFiles() == null!!\t" + file); } switch (fileOrDirType) { case DIRECTORY_ONLY: addElement(file); break; case ALL: addElement(file); break; } } if (file.isFile()) { switch (fileOrDirType) { case FILE_ONLY: addElement(file); break; case ALL: addElement(file); break; } } } public void run() { find(scanDir); matchCountMap.put(scanVal, matchCount); } }, "file_scann_" + System.currentTimeMillis()); currentScannerThread.setDaemon(true); currentScannerThread.start(); threadList.add(currentScannerThread); } for (;;) { try { Thread.sleep(1000); boolean allTerminated = true; for (int ii = 0; ii < threadList.size(); ii++) { if (threadList.get(ii).getState() != Thread.State.TERMINATED) { allTerminated = false; break; } } if (allTerminated) { System.out.println("all done..."); break; } } catch (InterruptedException e) { JCommonUtil.handleException(e); } } long endTime = System.currentTimeMillis() - startTime; String status = "scan completed \n during :" + endTime + "\n file : " + model.getSize() + "\n \tResult : \n " + matchCountMap; JOptionPaneUtil.newInstance().iconPlainMessage().showMessageDialog(status, "COMPLETED"); scannerStatus.setText(status); scanList.setModel(model); arrayBackupForInnerScan = ((DefaultListModel) scanList.getModel()).toArray(); currentScannerThreadStop = false; } }, "file_scann_main_" + System.currentTimeMillis()); scanMainThread.setDaemon(true); scanMainThread.start(); } else { if (JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption( "scanner is running \n want to stop??", "WARNING")) { currentScannerThreadStop = true; } } } }); swingUtil.addAction("scanDirText.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { return; } scanDirText.setText(dir.getAbsolutePath()); } }); swingUtil.addAction("addListToExecList.actionPerformed", new Action() { Thread moveThread = null; public void action(EventObject evt) throws Exception { if (moveThread != null && moveThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("add list process already running!"); return; } moveThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { DefaultListModel model = (DefaultListModel) scanList.getModel(); DefaultListModel model2 = (DefaultListModel) execList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { File f = (File) model.getElementAt(ii); model2.addElement(f.getAbsolutePath()); } if (model.getSize() > 1000) { JCommonUtil._jOptionPane_showMessageDialog_info( "add list completed!\n" + model.getSize()); } } }, "addListToExecList.actionPerformed_" + System.currentTimeMillis()); moveThread.setDaemon(true); moveThread.start(); } }); swingUtil.addAction("openSvnUpdate.actionPerformed", new Action() { Pattern svnPattern = Pattern.compile("^(?:[M|\\?])\\s+\\d*\\s+(.+)$"); Thread svnThread = null; public void action(EventObject evt) throws Exception { if (svnThread != null && svnThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("svn scan process already running!"); return; } final File svnDir = JCommonUtil._jFileChooser_selectDirectoryOnly(); if (svnDir == null) { JCommonUtil._jOptionPane_showMessageDialog_error("dir is not correct!"); return; } svnThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { try { Process process = Runtime.getRuntime() .exec(String.format("svn status -u \"%s\"", svnDir)); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream())); Matcher matcher = null; File file = null; DefaultListModel model = new DefaultListModel(); List<File> scanList = new ArrayList<File>(); for (String line = null; (line = reader.readLine()) != null;) { matcher = svnPattern.matcher(line); if (matcher.find()) { file = new File(matcher.group(1)); if (file.isFile()) { model.addElement(file.getAbsolutePath()); } if (file.isDirectory()) { scanList.clear(); FileUtil.searchFileMatchs(file, ".*", scanList); for (File f : scanList) { model.addElement(f.getAbsolutePath()); } } } else { System.out.println("ignore : [" + line + "]"); } } reader.close(); execList.setModel(model); setTitle("svn : " + svnDir); JCommonUtil._jOptionPane_showMessageDialog_info("svn scan completed!"); } catch (IOException e) { JCommonUtil.handleException(e); } } }, "svn_scan" + System.currentTimeMillis()); svnThread.setDaemon(true); svnThread.start(); } }); swingUtil.addAction("contentFilterBtn.actionPerformed", new Action() { Thread thread = null; String encode = Charset.defaultCharset().displayName(); public void action(EventObject evt) throws Exception { if (thread != null && thread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error("scan process already running!"); return; } final String filter = JCommonUtil._jOptionPane_showInputDialog("input filter content?"); if (StringUtils.isEmpty(filter)) { JCommonUtil._jOptionPane_showMessageDialog_error("filter is empty!"); return; } Pattern tmpPattern = null; try { tmpPattern = Pattern.compile(filter); } catch (Exception ex) { } final Pattern filterPattern = tmpPattern; try { encode = JCommonUtil._jOptionPane_showInputDialog("input encode?", encode); } catch (Exception ex) { JCommonUtil._jOptionPane_showMessageDialog_error("error encode!"); return; } thread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { DefaultListModel model = (DefaultListModel) execList.getModel(); DefaultListModel model_ = new DefaultListModel(); File file = null; BufferedReader reader = null; for (int ii = 0; ii < model.getSize(); ii++) { file = new File((String) model.getElementAt(ii)); if (!file.exists()) { continue; } try { reader = new BufferedReader( new InputStreamReader(new FileInputStream(file), encode)); for (String line = null; (line = reader.readLine()) != null;) { if (line.contains(filter)) { model_.addElement(file.getAbsolutePath()); break; } if (filterPattern != null && filterPattern.matcher(line).find()) { model_.addElement(file.getAbsolutePath()); break; } } reader.close(); } catch (Exception e) { JCommonUtil.handleException(e); } } execList.setModel(model_); JCommonUtil._jOptionPane_showMessageDialog_info("completed!"); } }, UUID.randomUUID().toString()); thread.setDaemon(true); thread.start(); } }); swingUtil.addAction("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new Action() { public void action(EventObject evt) throws Exception { } }); this.setSize(870, 551); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.apache.geode.internal.cache.xmlcache.CacheXmlParser.java
/** * When a <code>region-attributes</code> element is first encountered, we create a * {@link RegionAttributesCreation}, populate it accordingly, and push it on the stack. *///from ww w. ja va 2 s . c o m private void startRegionAttributes(Attributes atts) { RegionAttributesCreation attrs = new RegionAttributesCreation(this.cache); String scope = atts.getValue(SCOPE); if (scope == null) { } else if (scope.equals(LOCAL)) { attrs.setScope(Scope.LOCAL); } else if (scope.equals(DISTRIBUTED_NO_ACK)) { attrs.setScope(Scope.DISTRIBUTED_NO_ACK); } else if (scope.equals(DISTRIBUTED_ACK)) { attrs.setScope(Scope.DISTRIBUTED_ACK); } else if (scope.equals(GLOBAL)) { attrs.setScope(Scope.GLOBAL); } else { throw new InternalGemFireException( LocalizedStrings.CacheXmlParser_UNKNOWN_SCOPE_0.toLocalizedString(scope)); } String mirror = atts.getValue(MIRROR_TYPE); if (mirror == null) { } else if (mirror.equals(NONE)) { attrs.setMirrorType(MirrorType.NONE); } else if (mirror.equals(KEYS)) { attrs.setMirrorType(MirrorType.KEYS); } else if (mirror.equals(KEYS_VALUES)) { attrs.setMirrorType(MirrorType.KEYS_VALUES); } else { throw new InternalGemFireException( LocalizedStrings.CacheXmlParser_UNKNOWN_MIRROR_TYPE_0.toLocalizedString(mirror)); } { String dp = atts.getValue(DATA_POLICY); if (dp == null) { } else if (dp.equals(NORMAL_DP)) { attrs.setDataPolicy(DataPolicy.NORMAL); } else if (dp.equals(PRELOADED_DP)) { attrs.setDataPolicy(DataPolicy.PRELOADED); } else if (dp.equals(EMPTY_DP)) { attrs.setDataPolicy(DataPolicy.EMPTY); } else if (dp.equals(REPLICATE_DP)) { attrs.setDataPolicy(DataPolicy.REPLICATE); } else if (dp.equals(PERSISTENT_REPLICATE_DP)) { attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); } else if (dp.equals(PARTITION_DP)) { attrs.setDataPolicy(DataPolicy.PARTITION); } else if (dp.equals(PERSISTENT_PARTITION_DP)) { attrs.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); } else { throw new InternalGemFireException( LocalizedStrings.CacheXmlParser_UNKNOWN_DATA_POLICY_0.toLocalizedString(dp)); } } String initialCapacity = atts.getValue(INITIAL_CAPACITY); if (initialCapacity != null) { attrs.setInitialCapacity(parseInt(initialCapacity)); } String concurrencyLevel = atts.getValue(CONCURRENCY_LEVEL); if (concurrencyLevel != null) { attrs.setConcurrencyLevel(parseInt(concurrencyLevel)); } String concurrencyChecksEnabled = atts.getValue(CONCURRENCY_CHECKS_ENABLED); if (concurrencyChecksEnabled != null) { attrs.setConcurrencyChecksEnabled(Boolean.valueOf(concurrencyChecksEnabled).booleanValue()); } String loadFactor = atts.getValue(LOAD_FACTOR); if (loadFactor != null) { attrs.setLoadFactor(parseFloat(loadFactor)); } String statisticsEnabled = atts.getValue(STATISTICS_ENABLED); if (statisticsEnabled != null) { attrs.setStatisticsEnabled(Boolean.valueOf(statisticsEnabled).booleanValue()); } String ignoreJTA = atts.getValue(IGNORE_JTA); if (ignoreJTA != null) { attrs.setIgnoreJTA(Boolean.valueOf(ignoreJTA).booleanValue()); } String isLockGrantor = atts.getValue(IS_LOCK_GRANTOR); if (isLockGrantor != null) { attrs.setLockGrantor(Boolean.valueOf(isLockGrantor).booleanValue()); } String persistBackup = atts.getValue(PERSIST_BACKUP); if (persistBackup != null) { attrs.setPersistBackup(Boolean.valueOf(persistBackup).booleanValue()); } String earlyAck = atts.getValue(EARLY_ACK); if (earlyAck != null) { attrs.setEarlyAck(Boolean.valueOf(earlyAck).booleanValue()); } String mcastEnabled = atts.getValue(MULTICAST_ENABLED); if (mcastEnabled != null) { attrs.setMulticastEnabled(Boolean.valueOf(mcastEnabled).booleanValue()); } String indexUpdateType = atts.getValue(INDEX_UPDATE_TYPE); attrs.setIndexMaintenanceSynchronous( indexUpdateType == null || indexUpdateType.equals(INDEX_UPDATE_TYPE_SYNCH)); String poolName = atts.getValue(POOL_NAME); if (poolName != null) { attrs.setPoolName(poolName); } String diskStoreName = atts.getValue(DISK_STORE_NAME); if (diskStoreName != null) { attrs.setDiskStoreName(diskStoreName); } String isDiskSynchronous = atts.getValue(DISK_SYNCHRONOUS); if (isDiskSynchronous != null) { attrs.setDiskSynchronous(Boolean.valueOf(isDiskSynchronous).booleanValue()); } String id = atts.getValue(ID); if (id != null) { attrs.setId(id); } String refid = atts.getValue(REFID); if (refid != null) { attrs.setRefid(refid); } String enableSubscriptionConflation = atts.getValue(ENABLE_SUBSCRIPTION_CONFLATION); if (enableSubscriptionConflation != null) { attrs.setEnableSubscriptionConflation(Boolean.valueOf(enableSubscriptionConflation).booleanValue()); } String enableBridgeConflation = atts.getValue(ENABLE_BRIDGE_CONFLATION); // as of 5.7 enable-bridge-conflation is deprecated. // so ignore it if enable-subscription-conflation is set if (enableBridgeConflation != null && enableSubscriptionConflation == null) { attrs.setEnableSubscriptionConflation(Boolean.valueOf(enableBridgeConflation).booleanValue()); } if (enableBridgeConflation == null && enableSubscriptionConflation == null) { // 4.1 compatibility enableBridgeConflation = atts.getValue("enable-conflation"); if (enableBridgeConflation != null) { attrs.setEnableSubscriptionConflation(Boolean.valueOf(enableBridgeConflation).booleanValue()); } } /* * deprecated in prPersistSprint1 String publisherStr = atts.getValue(PUBLISHER); if * (publisherStr != null) { attrs.setPublisher(Boolean.valueOf(publisherStr).booleanValue()); } */ String enableAsyncConflation = atts.getValue(ENABLE_ASYNC_CONFLATION); if (enableAsyncConflation != null) { attrs.setEnableAsyncConflation(Boolean.valueOf(enableAsyncConflation).booleanValue()); } String cloningEnabledStr = atts.getValue(CLONING_ENABLED); if (cloningEnabledStr != null) { attrs.setCloningEnable(Boolean.valueOf(cloningEnabledStr).booleanValue()); } String gatewaySenderIds = atts.getValue(GATEWAY_SENDER_IDS); if (gatewaySenderIds != null && (gatewaySenderIds.length() != 0)) { StringTokenizer st = new StringTokenizer(gatewaySenderIds, ","); while (st.hasMoreElements()) { attrs.addGatewaySenderId(st.nextToken()); } } String asyncEventQueueIds = atts.getValue(ASYNC_EVENT_QUEUE_IDS); if (asyncEventQueueIds != null && (asyncEventQueueIds.length() != 0)) { StringTokenizer st = new StringTokenizer(asyncEventQueueIds, ","); while (st.hasMoreElements()) { attrs.addAsyncEventQueueId(st.nextToken()); } } String offHeapStr = atts.getValue(OFF_HEAP); if (offHeapStr != null) { attrs.setOffHeap(Boolean.valueOf(offHeapStr).booleanValue()); } stack.push(attrs); }
From source file:org.kchine.r.server.DirectJNI.java
public static String[] getROptions() { String[] roptions = new String[] { "--no-save" }; if (System.getProperty("proxy_host") != null && !System.getProperty("proxy_host").equals("")) { roptions = new String[] { "--no-save", "--internet2" }; }/*from w w w . j a v a 2s. c om*/ if (System.getProperty("r.options") != null && !System.getProperty("r.options").equals("")) { Vector<String> roptionsVector = new Vector<String>(); StringTokenizer st = new StringTokenizer(System.getProperty("r.options"), " "); while (st.hasMoreElements()) roptionsVector.add((String) st.nextElement()); roptions = roptionsVector.toArray(new String[0]); } System.out.println("r options:" + Arrays.toString(roptions)); return roptions; }
From source file:usbong.android.utils.UsbongScreenProcessor.java
public void init() { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 Resources myRes = udtea.getResources(); Drawable myDrawableImage;/* w ww. j a v a 2s.c o m*/ //added by Mike, Feb. 13, 2013 udtea.isAnOptionalNode = UsbongUtils.isAnOptionalNode(udtea.currUsbongNode); String myStringToken = ""; // if (usedBackButton) { // System.out.println(">>>>>> udtea.currAnswer: "+udtea.currAnswer); StringTokenizer st = new StringTokenizer(udtea.currAnswer, ","); if ((st != null) && (st.hasMoreTokens())) { myStringToken = st.nextToken(); udtea.currAnswer = udtea.currAnswer.replace(myStringToken + ",", ""); } StringTokenizer st_two = new StringTokenizer(udtea.currAnswer, ";"); if (st_two != null) { if (udtea.currAnswer.length() > 1) { myStringToken = st_two.nextToken(); //get next element (i.e. 1 in "Y,1;") } else { myStringToken = ""; } } if (udtea.currScreen == udtea.MULTIPLE_RADIO_BUTTONS_SCREEN) { udtea.setContentView(R.layout.multiple_radio_buttons_screen); udtea.initBackNextButtons(); TextView myMultipleRadioButtonsScreenTextView = (TextView) udtea .findViewById(R.id.radio_buttons_textview); myMultipleRadioButtonsScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myMultipleRadioButtonsScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); RadioGroup radioGroup = (RadioGroup) udtea.findViewById(R.id.multiple_radio_buttons_radiogroup); int totalRadioButtonsInContainer = udtea.radioButtonsContainer.size(); for (int i = 0; i < totalRadioButtonsInContainer; i++) { View radioButtonView = new RadioButton(udtea.getBaseContext()); RadioButton radioButton = (RadioButton) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), radioButtonView, UsbongUtils.IS_RADIOBUTTON, udtea.radioButtonsContainer.elementAt(i).toString()); radioButton.setTextSize(20); radioButton.setId(i); radioButton.setTextColor(Color.parseColor("#4a452a")); int myStringTokenInt; try { myStringTokenInt = Integer.parseInt(myStringToken); } catch (NumberFormatException e) {//if myStringToken is not an int; myStringTokenInt = -1; } if ((!myStringToken.equals("")) && (i == myStringTokenInt)) { radioButton.setChecked(true); } else { radioButton.setChecked(false); } radioGroup.addView(radioButton); } } else if (udtea.currScreen == udtea.MULTIPLE_RADIO_BUTTONS_WITH_ANSWER_SCREEN) { udtea.setContentView(R.layout.multiple_radio_buttons_screen); udtea.initBackNextButtons(); String myMultipleRadioButtonsWithAnswerScreenStringToken = ""; // Log.d(">>>>>>>>udtea.currUsbongNode", udtea.currUsbongNode); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNode.replace("Answer=", "~"); StringTokenizer myMultipleRadioButtonsWithAnswerScreenStringTokenizer = new StringTokenizer( udtea.currUsbongNodeWithoutAnswer, "~"); if (myMultipleRadioButtonsWithAnswerScreenStringTokenizer != null) { myMultipleRadioButtonsWithAnswerScreenStringToken = myMultipleRadioButtonsWithAnswerScreenStringTokenizer .nextToken(); while (myMultipleRadioButtonsWithAnswerScreenStringTokenizer.hasMoreTokens()) { //get last element (i.e. 0 in "radioButtonsWithAnswer~You see your teacher approaching you. What do you do?Answer=0") myMultipleRadioButtonsWithAnswerScreenStringToken = myMultipleRadioButtonsWithAnswerScreenStringTokenizer .nextToken(); } } udtea.myMultipleRadioButtonsWithAnswerScreenAnswer = myMultipleRadioButtonsWithAnswerScreenStringToken .toString(); // Log.d(">>>>>>>>udtea.myMultipleRadioButtonsWithAnswerScreenAnswer", udtea.myMultipleRadioButtonsWithAnswerScreenAnswer); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNodeWithoutAnswer.substring(0, udtea.currUsbongNodeWithoutAnswer.length() - udtea.myMultipleRadioButtonsWithAnswerScreenAnswer.length() - 1); //do a -1 for the last tilde // Log.d(">>>>>>>>udtea.currUsbongNodeWithoutAnswer", udtea.currUsbongNodeWithoutAnswer); TextView myMultipleRadioButtonsWithAnswerScreenTextView = (TextView) udtea .findViewById(R.id.radio_buttons_textview); myMultipleRadioButtonsWithAnswerScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myMultipleRadioButtonsWithAnswerScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNodeWithoutAnswer); RadioGroup myMultipleRadioButtonsWithAnswerRadioGroup = (RadioGroup) udtea .findViewById(R.id.multiple_radio_buttons_radiogroup); int myMultipleRadioButtonsWithAnswerTotalRadioButtonsInContainer = udtea.radioButtonsContainer.size(); for (int i = 0; i < myMultipleRadioButtonsWithAnswerTotalRadioButtonsInContainer; i++) { View radioButtonView = new RadioButton(udtea.getBaseContext()); RadioButton radioButton = (RadioButton) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), radioButtonView, UsbongUtils.IS_RADIOBUTTON, udtea.radioButtonsContainer.elementAt(i).toString()); radioButton.setTextSize(20); radioButton.setId(i); radioButton.setTextColor(Color.parseColor("#4a452a")); if ((!myStringToken.equals("")) && (i == Integer.parseInt(myStringToken))) { radioButton.setChecked(true); } else { radioButton.setChecked(false); } myMultipleRadioButtonsWithAnswerRadioGroup.addView(radioButton); } } else if (udtea.currScreen == udtea.LINK_SCREEN) { //use same contentView as multiple_radio_buttons_screen udtea.setContentView(R.layout.multiple_radio_buttons_screen); udtea.initBackNextButtons(); TextView myLinkScreenTextView = (TextView) udtea.findViewById(R.id.radio_buttons_textview); myLinkScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myLinkScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); RadioGroup myLinkScreenRadioGroup = (RadioGroup) udtea .findViewById(R.id.multiple_radio_buttons_radiogroup); int myLinkScreenTotalRadioButtonsInContainer = udtea.radioButtonsContainer.size(); for (int i = 0; i < myLinkScreenTotalRadioButtonsInContainer; i++) { View radioButtonView = new RadioButton(udtea.getBaseContext()); RadioButton radioButton = (RadioButton) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), radioButtonView, UsbongUtils.IS_RADIOBUTTON, UsbongUtils.trimUsbongNodeName(udtea.radioButtonsContainer.elementAt(i).toString())); Log.d(">>>>>radioButton", radioButton.getText().toString()); // radioButton.setChecked(false); radioButton.setTextSize(20); radioButton.setId(i); radioButton.setTextColor(Color.parseColor("#4a452a")); if ((!myStringToken.equals("")) && (i == Integer.parseInt(myStringToken))) { radioButton.setChecked(true); } else { radioButton.setChecked(false); } myLinkScreenRadioGroup.addView(radioButton); } } else if (udtea.currScreen == udtea.MULTIPLE_CHECKBOXES_SCREEN) { udtea.setContentView(R.layout.multiple_checkboxes_screen); udtea.initBackNextButtons(); TextView myMultipleCheckBoxesScreenTextView = (TextView) udtea.findViewById(R.id.checkboxes_textview); myMultipleCheckBoxesScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myMultipleCheckBoxesScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); LinearLayout myMultipleCheckboxesLinearLayout = (LinearLayout) udtea .findViewById(R.id.multiple_checkboxes_linearlayout); int totalCheckBoxesInContainer = udtea.checkBoxesContainer.size(); StringTokenizer myMultipleCheckboxStringTokenizer = new StringTokenizer(myStringToken, ","); Vector<String> myCheckedAnswers = new Vector<String>(); // int counter=0; while (myMultipleCheckboxStringTokenizer.countTokens() > 0) { String myMultipleCheckboxStringToken = myMultipleCheckboxStringTokenizer.nextToken(); if (myMultipleCheckboxStringToken != null) { myCheckedAnswers.add(myMultipleCheckboxStringToken); } else { break; } // counter++; } for (int i = 0; i < totalCheckBoxesInContainer; i++) { CheckBox checkBox = new CheckBox(udtea.getBaseContext()); // checkBox.setText(StringEscapeUtils.unescapeJava(udtea.checkBoxesContainer.elementAt(i).toString())); checkBox = (CheckBox) UsbongUtils.applyTagsInView(UsbongDecisionTreeEngineActivity.getInstance(), checkBox, UsbongUtils.IS_CHECKBOX, StringEscapeUtils.unescapeJava(udtea.checkBoxesContainer.elementAt(i).toString())); for (int k = 0; k < myCheckedAnswers.size(); k++) { try { if (i == Integer.parseInt(myCheckedAnswers.elementAt(k))) { checkBox.setChecked(true); } } catch (NumberFormatException e) {//if myCheckedAnswers.elementAt(k) is not an int; continue; } } checkBox.setTextSize(20); checkBox.setTextColor(Color.parseColor("#4a452a")); myMultipleCheckboxesLinearLayout.addView(checkBox); } } else if (udtea.currScreen == udtea.AUDIO_RECORD_SCREEN) { udtea.setContentView(R.layout.audio_recorder_screen); udtea.initRecordAudioScreen(); udtea.initBackNextButtons(); TextView myAudioRecorderTextView = (TextView) udtea.findViewById(R.id.audio_recorder_textview); myAudioRecorderTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myAudioRecorderTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); Button recordButton = (Button) udtea.findViewById(R.id.record_button); Button stopButton = (Button) udtea.findViewById(R.id.stop_button); Button playButton = (Button) udtea.findViewById(R.id.play_button); if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { recordButton.setText((String) udtea.getResources().getText(R.string.UsbongRecordTextViewFILIPINO)); stopButton.setText((String) udtea.getResources().getText(R.string.UsbongStopTextViewFILIPINO)); playButton.setText((String) udtea.getResources().getText(R.string.UsbongPlayTextViewFILIPINO)); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { recordButton.setText((String) udtea.getResources().getText(R.string.UsbongRecordTextViewJAPANESE)); stopButton.setText((String) udtea.getResources().getText(R.string.UsbongStopTextViewJAPANESE)); playButton.setText((String) udtea.getResources().getText(R.string.UsbongPlayTextViewJAPANESE)); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { recordButton.setText((String) udtea.getResources().getText(R.string.UsbongRecordTextViewENGLISH)); stopButton.setText((String) udtea.getResources().getText(R.string.UsbongStopTextViewENGLISH)); playButton.setText((String) udtea.getResources().getText(R.string.UsbongPlayTextViewENGLISH)); } } else if (udtea.currScreen == udtea.PHOTO_CAPTURE_SCREEN) { udtea.setContentView(R.layout.photo_capture_screen); if (!udtea.performedCapturePhoto) { udtea.initTakePhotoScreen(); } udtea.initBackNextButtons(); TextView myPhotoCaptureScreenTextView = (TextView) udtea.findViewById(R.id.photo_capture_textview); myPhotoCaptureScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myPhotoCaptureScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); Button photoCaptureButton = (Button) udtea.findViewById(R.id.photo_capture_button); if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { photoCaptureButton .setText((String) udtea.getResources().getText(R.string.UsbongTakePhotoTextViewFILIPINO)); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { photoCaptureButton .setText((String) udtea.getResources().getText(R.string.UsbongTakePhotoTextViewJAPANESE)); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { photoCaptureButton .setText((String) udtea.getResources().getText(R.string.UsbongTakePhotoTextViewENGLISH)); } } else if (udtea.currScreen == udtea.PAINT_SCREEN) { udtea.setContentView(R.layout.paint_screen); if (!udtea.performedRunPaint) { udtea.initPaintScreen(); } udtea.initBackNextButtons(); TextView myPaintScreenTextView = (TextView) udtea.findViewById(R.id.paint_textview); myPaintScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myPaintScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); Button paintButton = (Button) udtea.findViewById(R.id.paint_button); if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { paintButton.setText((String) udtea.getResources().getText(R.string.UsbongRunPaintTextViewFILIPINO)); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { paintButton.setText((String) udtea.getResources().getText(R.string.UsbongRunPaintTextViewJAPANESE)); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { paintButton.setText((String) udtea.getResources().getText(R.string.UsbongRunPaintTextViewENGLISH)); } } else if (udtea.currScreen == udtea.QR_CODE_READER_SCREEN) { udtea.setContentView(R.layout.qr_code_reader_screen); if (!udtea.performedGetQRCode) { udtea.initQRCodeReaderScreen(); } udtea.initBackNextButtons(); TextView myQRCodeReaderScreenTextView = (TextView) udtea.findViewById(R.id.qr_code_reader_textview); myQRCodeReaderScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myQRCodeReaderScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); Button qrCodeReaderButton = (Button) udtea.findViewById(R.id.qr_code_reader_button); if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { qrCodeReaderButton.setText( (String) udtea.getResources().getText(R.string.UsbongQRCodeReaderTextViewFILIPINO)); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { qrCodeReaderButton.setText( (String) udtea.getResources().getText(R.string.UsbongQRCodeReaderTextViewJAPANESE)); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { qrCodeReaderButton .setText((String) udtea.getResources().getText(R.string.UsbongQRCodeReaderTextViewENGLISH)); } } else if (udtea.currScreen == udtea.TEXTFIELD_SCREEN) { udtea.setContentView(R.layout.textfield_screen); udtea.initBackNextButtons(); TextView myTextFieldScreenTextView = (TextView) udtea.findViewById(R.id.textfield_textview); myTextFieldScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextFieldScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); EditText myTextFieldScreenEditText = (EditText) udtea.findViewById(R.id.textfield_edittext); myTextFieldScreenEditText.setText(myStringToken); } else if (udtea.currScreen == udtea.TEXTFIELD_WITH_ANSWER_SCREEN) { udtea.setContentView(R.layout.textfield_screen); udtea.initBackNextButtons(); String myTextFieldWithAnswerScreenStringToken = ""; // Log.d(">>>>>>>>udtea.currUsbongNode", udtea.currUsbongNode); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNode.replace("Answer=", "~"); StringTokenizer myTextFieldWithAnswerScreenStringTokenizer = new StringTokenizer( udtea.currUsbongNodeWithoutAnswer, "~"); if (myTextFieldWithAnswerScreenStringTokenizer != null) { myTextFieldWithAnswerScreenStringToken = myTextFieldWithAnswerScreenStringTokenizer.nextToken(); while (myTextFieldWithAnswerScreenStringTokenizer.hasMoreTokens()) { //get last element (i.e. Mike in "textFieldWithAnswer~Who is the founder of Usbong (nickname)?Answer=Mike") myTextFieldWithAnswerScreenStringToken = myTextFieldWithAnswerScreenStringTokenizer.nextToken(); } } udtea.myTextFieldWithAnswerScreenAnswer = myTextFieldWithAnswerScreenStringToken.toString(); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNodeWithoutAnswer.substring(0, udtea.currUsbongNodeWithoutAnswer.length() - udtea.myTextFieldWithAnswerScreenAnswer.length() - 1); //do a -1 for the last tilde TextView myTextFieldWithAnswerScreenTextView = (TextView) udtea.findViewById(R.id.textfield_textview); myTextFieldWithAnswerScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextFieldWithAnswerScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNodeWithoutAnswer); EditText myTextFieldScreenWithAnswerEditText = (EditText) udtea.findViewById(R.id.textfield_edittext); myTextFieldScreenWithAnswerEditText.setText(myStringToken); } else if (udtea.currScreen == udtea.TEXTAREA_SCREEN) { udtea.setContentView(R.layout.textarea_screen); udtea.initBackNextButtons(); TextView myTextAreaScreenTextView = (TextView) udtea.findViewById(R.id.textarea_textview); myTextAreaScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextAreaScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); EditText myTextAreaScreenEditText = (EditText) udtea.findViewById(R.id.textarea_edittext); myTextAreaScreenEditText.setText(myStringToken); } else if (udtea.currScreen == udtea.TEXTAREA_WITH_ANSWER_SCREEN) { udtea.setContentView(R.layout.textarea_screen); udtea.initBackNextButtons(); String myTextAreaWithAnswerScreenStringToken = ""; // Log.d(">>>>>>>>udtea.currUsbongNode", udtea.currUsbongNode); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNode.replace("Answer=", "~"); StringTokenizer myTextAreaWithAnswerScreenStringTokenizer = new StringTokenizer( udtea.currUsbongNodeWithoutAnswer, "~"); if (myTextAreaWithAnswerScreenStringTokenizer != null) { myTextAreaWithAnswerScreenStringToken = myTextAreaWithAnswerScreenStringTokenizer.nextToken(); while (myTextAreaWithAnswerScreenStringTokenizer.hasMoreTokens()) { //get last element (i.e. Mike in "textFieldWithAnswer~Who is the founder of Usbong (nickname)?Answer=Mike") myTextAreaWithAnswerScreenStringToken = myTextAreaWithAnswerScreenStringTokenizer.nextToken(); } } udtea.myTextAreaWithAnswerScreenAnswer = myTextAreaWithAnswerScreenStringToken.toString(); udtea.currUsbongNodeWithoutAnswer = udtea.currUsbongNodeWithoutAnswer.substring(0, udtea.currUsbongNodeWithoutAnswer.length() - udtea.myTextAreaWithAnswerScreenAnswer.length() - 1); //do a -1 for the last tilde TextView myTextAreaWithAnswerScreenTextView = (TextView) udtea.findViewById(R.id.textarea_textview); myTextAreaWithAnswerScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextAreaWithAnswerScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNodeWithoutAnswer); EditText myTextAreaScreenWithAnswerEditText = (EditText) udtea.findViewById(R.id.textarea_edittext); myTextAreaScreenWithAnswerEditText.setText(myStringToken); } else if (udtea.currScreen == udtea.TEXTFIELD_WITH_UNIT_SCREEN) { udtea.setContentView(R.layout.textfield_with_unit_screen); udtea.initBackNextButtons(); TextView myTextFieldWithUnitScreenTextView = (TextView) udtea.findViewById(R.id.textfield_textview); myTextFieldWithUnitScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextFieldWithUnitScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); EditText myEditText = (EditText) udtea.findViewById(R.id.textfield_edittext); myEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); myEditText.setText(myStringToken); TextView myUnitScreenTextView = (TextView) udtea.findViewById(R.id.textfieldunit_textview); myUnitScreenTextView.setText(udtea.textFieldUnit); } else if (udtea.currScreen == udtea.TEXTFIELD_NUMERICAL_SCREEN) { udtea.setContentView(R.layout.textfield_screen); udtea.initBackNextButtons(); TextView myTextFieldNumericalScreenTextView = (TextView) udtea.findViewById(R.id.textfield_textview); myTextFieldNumericalScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextFieldNumericalScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); EditText myTextFieldNumericalScreenEditText = (EditText) udtea.findViewById(R.id.textfield_edittext); myTextFieldNumericalScreenEditText .setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); myTextFieldNumericalScreenEditText.setText(myStringToken); } else if (udtea.currScreen == udtea.CLASSIFICATION_SCREEN) { udtea.setContentView(R.layout.classification_screen); udtea.initBackNextButtons(); TextView myClassificationScreenTextView = (TextView) udtea.findViewById(R.id.classification_textview); myClassificationScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myClassificationScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); LinearLayout myClassificationLinearLayout = (LinearLayout) udtea .findViewById(R.id.classification_linearlayout); int totalClassificationsInContainer = udtea.classificationContainer.size(); for (int i = 0; i < totalClassificationsInContainer; i++) { TextView myTextView = new TextView(udtea.getBaseContext()); //consider removing this code below; not needed; Mike, May 23, 2013 myTextView = (TextView) UsbongUtils.applyTagsInView(UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); int bulletCount = i + 1; if (UsbongUtils.USE_UNESCAPE) { myTextView.setText(bulletCount + ") " + StringEscapeUtils .unescapeJava(udtea.classificationContainer.elementAt(i).toString())); } else { myTextView.setText(bulletCount + ") " + UsbongUtils .trimUsbongNodeName(udtea.classificationContainer.elementAt(i).toString())); } //add 5 so that the text does not touch the left border myTextView.setPadding(udtea.padding_in_px, 0, 0, 0); myTextView.setTextSize(24); // myTextView.setTextColor(Color.WHITE); myTextView.setTextColor(Color.parseColor("#4a452a")); myClassificationLinearLayout.addView(myTextView); } } else if (udtea.currScreen == udtea.DCAT_SUMMARY_SCREEN) { udtea.setContentView(R.layout.dcat_summary_screen); udtea.initBackNextButtons(); TextView myDCATSummaryScreenTextView = (TextView) udtea.findViewById(R.id.dcat_summary_textview); myDCATSummaryScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myDCATSummaryScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); udtea.myDcatSummaryStringBuffer = new StringBuffer(); String weightsString = "1.9;2.1;2.6;1.8;2.4;1.8;.7;1.0;1.6;2.6;6.9;5.7;3.3;2.2;3.3;3.3;2;2;1.7;1.9;3.9;1.3;2.5;.8"; StringTokenizer myWeightsStringTokenizer = new StringTokenizer(weightsString, ";"); String myWeightString = myWeightsStringTokenizer.nextToken(); // // while (st.hasMoreTokens()) { // myStringToken = st.nextToken(); // } // double myWeightedScoreInt = 0; double myNegotiatedWeightedScoreInt = 0; double[][] dcatSum = new double[8][4]; final int sumWeightedRatingIndex = 0; final int sumWeightedScoreIndex = 1; final int sumNegotiatedRatingIndex = 2; final int sumNegotiatedScoreIndex = 3; int currStandard = 0;//standard 1 // boolean hasReachedNegotiated=false; boolean hasReachedStandardTotal = false; LinearLayout myDCATSummaryLinearLayout = (LinearLayout) udtea .findViewById(R.id.dcat_summary_linearlayout); int totalElementsInDCATSummaryBasedOnUsbongNodeContainer = udtea.usbongNodeContainer.size(); // for (int i=0; i<totalElementsInDCATSummaryBasedOnUsbongNodeContainer.usbongNodeContainer; i++) { for (int i = 0; i < totalElementsInDCATSummaryBasedOnUsbongNodeContainer; i++) { TextView myTextView = new TextView(udtea.getBaseContext()); myTextView.setPadding(udtea.padding_in_px, 0, 0, 0); //add 5 so that the text does not touch the left border myTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); myTextView.setTextColor(Color.parseColor("#4a452a")); //the only way to check if the element is already the last item in the standard //is if the next element in the node container has "STANDARD", but not the first standard if ((i + 1 >= totalElementsInDCATSummaryBasedOnUsbongNodeContainer) || (i + 1 < totalElementsInDCATSummaryBasedOnUsbongNodeContainer) && ((udtea.usbongNodeContainer.elementAt(i + 1).toString().contains("STANDARD"))) && (!(udtea.usbongNodeContainer.elementAt(i + 1).toString().contains("STANDARD ONE")))) { int tempCurrStandard = currStandard + 1; //do a +1 since currStandard begins at 0 TextView myIssuesTextView = new TextView(udtea.getBaseContext()); //added by Mike, May 31, 2013 if (!udtea.usbongAnswerContainer.elementAt(i).toString().contains("dcat_end,")) { String s = udtea.usbongAnswerContainer.elementAt(i).toString().replace(";", ""); s = s.replace("A,", ""); if (!s.equals("")) { myIssuesTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myIssuesTextView, UsbongUtils.IS_TEXTVIEW, "ISSUES: " + s + "{br}"); } else { myIssuesTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myIssuesTextView, UsbongUtils.IS_TEXTVIEW, "ISSUES: none{br}"); } myIssuesTextView.setPadding(udtea.padding_in_px, 0, 0, 0); //add 5 so that the text does not touch the left border myIssuesTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); myIssuesTextView.setTextColor(Color.parseColor("#4a452a")); myDCATSummaryLinearLayout.addView(myIssuesTextView); udtea.myDcatSummaryStringBuffer.append(myIssuesTextView.getText().toString() + "\n"); } if (myWeightsStringTokenizer.hasMoreElements()) { //get the next weight myWeightString = myWeightsStringTokenizer.nextToken(); } myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, "//--------------------" + " STANDARD " + tempCurrStandard + " (TOTAL){br}" + "Total (Rating): " + String.format("%.2f", dcatSum[currStandard][sumWeightedRatingIndex]) + "{br}" + "Total (Weighted Score): " + String.format("%.2f", dcatSum[currStandard][sumWeightedScoreIndex]) + "{br}" + "Total (Negotiated Rating): " + String.format("%.2f", dcatSum[currStandard][sumNegotiatedRatingIndex]) + "{br}" + "Total (Negotiated WS): " + String.format("%.2f", dcatSum[currStandard][sumNegotiatedScoreIndex]) + "{br}" + "//--------------------"); hasReachedStandardTotal = true; currStandard++; } if (hasReachedStandardTotal) { hasReachedStandardTotal = false; } else if (udtea.usbongNodeContainer.elementAt(i).toString().contains("ISSUES")) { String s = udtea.usbongAnswerContainer.elementAt(i).toString().replace(";", ""); s = s.replace("A,", ""); if (!s.equals("")) { myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, "ISSUES: " + s + "{br}"); } else { myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, "ISSUES: none{br}"); } if (myWeightsStringTokenizer.hasMoreElements()) { //get the next weight myWeightString = myWeightsStringTokenizer.nextToken(); } } else if (udtea.usbongNodeContainer.elementAt(i).toString().contains("Weighted")) { TextView myWeightedTextView = new TextView(udtea.getBaseContext()); myWeightedTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myWeightedTextView, UsbongUtils.IS_TEXTVIEW, udtea.usbongNodeContainer.elementAt(i).toString().replace("{br}(Weighted Score)", "")); myWeightedTextView.setPadding(udtea.padding_in_px, 0, 0, 0); //add 5 so that the text does not touch the left border myWeightedTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); myWeightedTextView.setTextColor(Color.parseColor("#4a452a")); myDCATSummaryLinearLayout.addView(myWeightedTextView); udtea.myDcatSummaryStringBuffer.append(myWeightedTextView.getText().toString() + "\n"); int weightedAnswer; //added by Mike, July 8, 2013 try { weightedAnswer = Integer .parseInt(udtea.usbongAnswerContainer.elementAt(i).toString().replace(";", "")); } catch (Exception e) { //if there's no answer selected weightedAnswer = 0; } if (weightedAnswer <= 0) { weightedAnswer = 0; } //the weight is in double myWeightedScoreInt = weightedAnswer * Double.parseDouble(myWeightString); if (myWeightedScoreInt <= 0) { myWeightedScoreInt = 0; myTextView.setBackgroundColor(Color.YELLOW); } dcatSum[currStandard][sumWeightedRatingIndex] += weightedAnswer; dcatSum[currStandard][sumWeightedScoreIndex] += myWeightedScoreInt; myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, "Weighted: " + myWeightedScoreInt); } else if (udtea.usbongNodeContainer.elementAt(i).toString().contains("Negotiated")) { //added by Mike, July 8, 2013 int negotiatedAnswer; try { negotiatedAnswer = Integer .parseInt(udtea.usbongAnswerContainer.elementAt(i).toString().replace(";", "")); } catch (Exception e) { //if there's no answer selected negotiatedAnswer = 0; } if (negotiatedAnswer <= 0) { negotiatedAnswer = 0; } //the weight is in double myNegotiatedWeightedScoreInt = negotiatedAnswer * Double.parseDouble(myWeightString); if (myNegotiatedWeightedScoreInt <= 0) { myNegotiatedWeightedScoreInt = 0; myTextView.setBackgroundColor(Color.YELLOW); } dcatSum[currStandard][sumNegotiatedRatingIndex] += negotiatedAnswer; dcatSum[currStandard][sumNegotiatedScoreIndex] += myNegotiatedWeightedScoreInt; myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, "Negotiated: " + myNegotiatedWeightedScoreInt); // hasReachedNegotiated=true; } else { myTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextView, UsbongUtils.IS_TEXTVIEW, udtea.usbongNodeContainer.elementAt(i).toString() + "{br}"); } // if (!hasReachedStandardTotal) { myDCATSummaryLinearLayout.addView(myTextView); udtea.myDcatSummaryStringBuffer.append(myTextView.getText().toString() + "\n"); Log.d(">>>>>myTextView.getText().toString()", myTextView.getText().toString()); // } // else { // hasReachedStandardTotal=false; // } } } else if (udtea.currScreen == udtea.DATE_SCREEN) { udtea.setContentView(R.layout.date_screen); udtea.initBackNextButtons(); TextView myDateScreenTextView = (TextView) udtea.findViewById(R.id.date_textview); myDateScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myDateScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); //Reference: http://code.google.com/p/android/issues/detail?id=2037 //last accessed: 21 Aug. 2012 Configuration userConfig = new Configuration(); Settings.System.getConfiguration(udtea.getContentResolver(), userConfig); Calendar date = Calendar.getInstance(userConfig.locale); //Reference: http://www.androidpeople.com/android-spinner-default-value; //last accessed: 21 Aug. 2012 //month------------------------------- int month = date.get(Calendar.MONTH); //first month of the year is 0 Spinner dateMonthSpinner = (Spinner) udtea.findViewById(R.id.date_month_spinner); udtea.monthAdapter = ArrayAdapter.createFromResource(((Activity) udtea), R.array.months_array, android.R.layout.simple_spinner_item); // udtea.monthAdapter = ArrayAdapter.createFromResource( // this, R.array.months_array, R.layout.date_textview); udtea.monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dateMonthSpinner.setAdapter(udtea.monthAdapter); dateMonthSpinner.setSelection(month); // System.out.println(">>>>>>>>>>>>>> month"+month); // Log.d(">>>>>>myStringToken",myStringToken); for (int i = 0; i < udtea.monthAdapter.getCount(); i++) { // Log.d(">>>>>>udtea.monthAdapter ",udtea.monthAdapter .getItem(i).toString()); if (myStringToken.contains(udtea.monthAdapter.getItem(i).toString())) { dateMonthSpinner.setSelection(i); //added by Mike, March 4, 2013 myStringToken = myStringToken.replace(udtea.monthAdapter.getItem(i).toString(), ""); } } //------------------------------------- //day---------------------------------- //Reference: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html#MONTH //last accessed: 21 Aug 2012 int day = date.get(Calendar.DAY_OF_MONTH); //first day of the month is 1 day = day - 1; //do this to offset, when retrieving the day in strings.xml Spinner dateDaySpinner = (Spinner) udtea.findViewById(R.id.date_day_spinner); udtea.dayAdapter = ArrayAdapter.createFromResource(((Activity) udtea), R.array.day_array, android.R.layout.simple_spinner_item); udtea.dayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dateDaySpinner.setAdapter(udtea.dayAdapter); dateDaySpinner.setSelection(day); // System.out.println(">>>>>>>>>>>>>> day"+day); // Log.d(">>>>>myStringToken",myStringToken); // System.out.println(">>>>>>>> myStringToken"+myStringToken); StringTokenizer myDateStringTokenizer = new StringTokenizer(myStringToken, ","); String myDayStringToken = ""; if (!myStringToken.equals("")) { myDayStringToken = myDateStringTokenizer.nextToken(); } for (int i = 0; i < udtea.dayAdapter.getCount(); i++) { if (myDayStringToken.contains(udtea.dayAdapter.getItem(i).toString())) { dateDaySpinner.setSelection(i); myStringToken = myStringToken.replace(udtea.dayAdapter.getItem(i).toString() + ",", ""); // System.out.println(">>>>>>>>>>>myStringToken: "+myStringToken); } } //------------------------------------- //year--------------------------------- int year = date.get(Calendar.YEAR); EditText myDateYearEditText = (EditText) udtea.findViewById(R.id.date_edittext); myDateYearEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); //added by Mike, March 4, 2013 if (myStringToken.equals("")) { myDateYearEditText.setText("" + year); } else { myDateYearEditText.setText(myStringToken); } } else if (udtea.currScreen == udtea.TEXT_DISPLAY_SCREEN) { udtea.setContentView(R.layout.text_display_screen); udtea.initBackNextButtons(); TextView myTextDisplayScreenTextView = (TextView) udtea.findViewById(R.id.text_display_textview); myTextDisplayScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextDisplayScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); // Log.d(">>>>>","inside udtea.currScreen == udtea.TEXT_DISPLAY_SCREEN"); // myTextDisplayScreenTextView = (TextView) UsbongUtils.applyHintsInView(UsbongDecisionTreeEngineActivity.getInstance(), myTextDisplayScreenTextView, UsbongUtils.IS_TEXTVIEW); // Log.d(">>>>>","after myTextDisplayScreenTextView"); } else if (udtea.currScreen == udtea.TIMESTAMP_DISPLAY_SCREEN) { udtea.setContentView(R.layout.timestamp_display_screen); udtea.initBackNextButtons(); TextView myTimeDisplayScreenTextView = (TextView) udtea.findViewById(R.id.time_display_textview); udtea.timestampString = UsbongUtils.getCurrTimeStamp(); myTimeDisplayScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTimeDisplayScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode + "{br}" + udtea.timestampString); } else if (udtea.currScreen == udtea.SIMPLE_ENCRYPT_SCREEN) { udtea.setContentView(R.layout.simple_encrypt_screen); udtea.initBackNextButtons(); TextView myEncryptScreenTextView = (TextView) udtea.findViewById(R.id.encrypt_textview); myEncryptScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myEncryptScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); String message = ""; if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { message = (String) udtea.getResources().getText(R.string.UsbongEncryptAlertMessageFILIPINO); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { message = (String) udtea.getResources().getText(R.string.UsbongEncryptAlertMessageJAPANESE); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { message = (String) udtea.getResources().getText(R.string.UsbongEncryptAlertMessageENGLISH); } new AlertDialog.Builder(udtea).setTitle("Hey!").setMessage(message) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).show(); } else if (udtea.currScreen == udtea.IMAGE_DISPLAY_SCREEN) { udtea.setContentView(R.layout.image_display_screen); udtea.initBackNextButtons(); ImageView myImageDisplayScreenImageView = (ImageView) udtea.findViewById(R.id.special_imageview); // if (!UsbongUtils.setImageDisplay(myImageDisplayScreenImageView, myTree+".utree/res/" +UsbongUtils.getResName(udtea.currUsbongNode))) { if (!UsbongUtils.setImageDisplay(myImageDisplayScreenImageView, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myImageDisplayScreenImageView.setImageDrawable(myDrawableImage); } } else if (udtea.currScreen == udtea.CLICKABLE_IMAGE_DISPLAY_SCREEN) { udtea.setContentView(R.layout.clickable_image_display_screen); udtea.initBackNextButtons(); ImageButton myClickableImageDisplayScreenImageButton = (ImageButton) udtea .findViewById(R.id.clickable_image_display_imagebutton); if (!UsbongUtils.setClickableImageDisplay(myClickableImageDisplayScreenImageButton, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myClickableImageDisplayScreenImageButton.setBackgroundDrawable(myDrawableImage); } myClickableImageDisplayScreenImageButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // myMessage = UsbongUtils.applyTagsInString(udtea.currUsbongNode).toString(); TextView tv = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), new TextView(UsbongDecisionTreeEngineActivity.getInstance()), UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); if (tv.toString().equals("")) { tv.setText("No message."); } tv.setTextSize((UsbongDecisionTreeEngineActivity.getInstance().getResources() .getDimension(R.dimen.textsize))); new AlertDialog.Builder(udtea).setTitle("Hey!") // .setMessage(myMessage) .setView(tv).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).show(); } }); } else if (udtea.currScreen == udtea.TEXT_CLICKABLE_IMAGE_DISPLAY_SCREEN) { udtea.setContentView(R.layout.text_clickable_image_display_screen); udtea.initBackNextButtons(); TextView myTextClickableImageDisplayTextView = (TextView) udtea .findViewById(R.id.text_clickable_image_display_textview); myTextClickableImageDisplayTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextClickableImageDisplayTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); ImageButton myTextClickableImageDisplayScreenImageButton = (ImageButton) udtea .findViewById(R.id.clickable_image_display_imagebutton); if (!UsbongUtils.setClickableImageDisplay(myTextClickableImageDisplayScreenImageButton, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myTextClickableImageDisplayScreenImageButton.setBackgroundDrawable(myDrawableImage); } myTextClickableImageDisplayScreenImageButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // myMessage = UsbongUtils.applyTagsInString(udtea.currUsbongNode).toString(); TextView tv = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), new TextView(udtea), UsbongUtils.IS_TEXTVIEW, UsbongUtils.getAlertName(udtea.currUsbongNode)); if (tv.toString().equals("")) { tv.setText("No message."); } tv.setTextSize((UsbongDecisionTreeEngineActivity.getInstance().getResources() .getDimension(R.dimen.textsize))); new AlertDialog.Builder(udtea).setTitle("Hey!") // .setMessage(myMessage) .setView(tv).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).show(); } }); } else if (udtea.currScreen == udtea.CLICKABLE_IMAGE_TEXT_DISPLAY_SCREEN) { udtea.setContentView(R.layout.clickable_image_text_display_screen); udtea.initBackNextButtons(); TextView myClickableImageTextDisplayTextView = (TextView) udtea .findViewById(R.id.clickable_image_text_display_textview); myClickableImageTextDisplayTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myClickableImageTextDisplayTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); ImageButton myClickableImageTextDisplayScreenImageButton = (ImageButton) udtea .findViewById(R.id.clickable_image_display_imagebutton); if (!UsbongUtils.setClickableImageDisplay(myClickableImageTextDisplayScreenImageButton, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myClickableImageTextDisplayScreenImageButton.setBackgroundDrawable(myDrawableImage); } myClickableImageTextDisplayScreenImageButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // myMessage = UsbongUtils.applyTagsInString(udtea.currUsbongNode).toString(); TextView tv = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), new TextView(udtea), UsbongUtils.IS_TEXTVIEW, UsbongUtils.getAlertName(udtea.currUsbongNode)); if (tv.toString().equals("")) { tv.setText("No message."); } tv.setTextSize((UsbongDecisionTreeEngineActivity.getInstance().getResources() .getDimension(R.dimen.textsize))); new AlertDialog.Builder(udtea).setTitle("Hey!") // .setMessage(myMessage) .setView(tv).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).show(); } }); } else if (udtea.currScreen == udtea.VIDEO_FROM_FILE_SCREEN) { udtea.setContentView(R.layout.video_from_file_screen); udtea.initBackNextButtons(); VideoView myVideoFromFileScreenVideoView = (VideoView) udtea .findViewById(R.id.video_from_file_videoview); myVideoFromFileScreenVideoView.setVideoPath( UsbongUtils.getPathOfVideoFile(udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))); //added by Mike, Sept. 9, 2013 myVideoFromFileScreenVideoView.setMediaController(new MediaController(((Activity) udtea))); myVideoFromFileScreenVideoView.start(); } else if (udtea.currScreen == udtea.VIDEO_FROM_FILE_WITH_TEXT_SCREEN) { udtea.setContentView(R.layout.video_from_file_with_text_screen); udtea.initBackNextButtons(); TextView myVideoFromFileWithTextTextView = (TextView) udtea .findViewById(R.id.video_from_file_with_text_textview); myVideoFromFileWithTextTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myVideoFromFileWithTextTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); VideoView myVideoFromFileWithTextScreenVideoView = (VideoView) udtea .findViewById(R.id.video_from_file_with_text_videoview); myVideoFromFileWithTextScreenVideoView.setVideoPath( UsbongUtils.getPathOfVideoFile(udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))); myVideoFromFileWithTextScreenVideoView.setMediaController(new MediaController(((Activity) udtea))); myVideoFromFileWithTextScreenVideoView.start(); } else if (udtea.currScreen == udtea.TEXT_IMAGE_DISPLAY_SCREEN) { udtea.setContentView(R.layout.text_image_display_screen); udtea.initBackNextButtons(); TextView myTextImageDisplayTextView = (TextView) udtea.findViewById(R.id.text_image_display_textview); myTextImageDisplayTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myTextImageDisplayTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); ImageView myTextImageDisplayImageView = (ImageView) udtea.findViewById(R.id.image_display_imageview); // if (!UsbongUtils.setImageDisplay(myTextImageDisplayImageView, myTree+".utree/res/" +UsbongUtils.getResName(udtea.currUsbongNode))) { if (!UsbongUtils.setImageDisplay(myTextImageDisplayImageView, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myTextImageDisplayImageView.setImageDrawable(myDrawableImage); } } else if (udtea.currScreen == udtea.IMAGE_TEXT_DISPLAY_SCREEN) { udtea.setContentView(R.layout.image_text_display_screen); udtea.initBackNextButtons(); TextView myImageTextDisplayTextView = (TextView) udtea.findViewById(R.id.image_text_display_textview); myImageTextDisplayTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myImageTextDisplayTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); ImageView myImageTextDisplayImageView = (ImageView) udtea.findViewById(R.id.image_display_imageview); if (!UsbongUtils.setImageDisplay(myImageTextDisplayImageView, udtea.myTree, UsbongUtils.getResName(udtea.currUsbongNode))) { //Reference: http://www.anddev.org/tinytut_-_get_resources_by_name__getidentifier_-t460.html; last accessed 14 Sept 2011 // Resources myRes = getResources(); myDrawableImage = myRes .getDrawable(myRes.getIdentifier("no_image", "drawable", udtea.myPackageName)); myImageTextDisplayImageView.setImageDrawable(myDrawableImage); } } else if (udtea.currScreen == udtea.GPS_LOCATION_SCREEN) { udtea.setContentView(R.layout.gps_location_screen); udtea.initBackNextButtons(); TextView myGPSLocationTextView = (TextView) udtea.findViewById(R.id.gps_location_textview); myGPSLocationTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myGPSLocationTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); // TextView myLongitudeTextView = (TextView)udtea.findViewById(R.id.longitude_textview); // TextView myLatitudeTextView = (TextView)udtea.findViewById(R.id.latitude_textview); hasGottenGPSLocation = false; locationResult = new LocationResult() { @Override public void gotLocation(Location location) { //Got the location! System.out.println(">>>>>>>>>>>>>>>>>location: " + location); if (udtea.currScreen == udtea.GPS_LOCATION_SCREEN) { if (location != null) { myLongitude = location.getLongitude() + ""; myLatitude = location.getLatitude() + ""; myLongitudeTextView = (TextView) udtea.findViewById(R.id.longitude_textview); myLatitudeTextView = (TextView) udtea.findViewById(R.id.latitude_textview); hasGottenGPSLocation = true; udtea.runOnUiThread(new Runnable() { @Override public void run() { myLongitudeTextView.setText("long: " + myLongitude); myLatitudeTextView.setText("lat: " + myLatitude); } }); } else { Toast.makeText(UsbongDecisionTreeEngineActivity.getInstance(), "Error getting location. Please make sure you are not inside a building.", Toast.LENGTH_SHORT).show(); } } else { hasGottenGPSLocation = true; //to stop the cycling progress bar } } }; // myLoadingProgressBar = new ProgressBar(udtea); // myLoadingProgressBar.setIndeterminate(false); // myLoadingProgressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER); udtea.myLocation = new FedorMyLocation(); udtea.myLocation.getLocation(udtea, locationResult); myLoadingProgressBar = (ProgressBar) udtea.findViewById(R.id.progressBar); new ProgressTask().execute(); } else if (udtea.currScreen == udtea.YES_NO_DECISION_SCREEN) { udtea.setContentView(R.layout.yes_no_decision_screen); udtea.initBackNextButtons(); TextView myYesNoDecisionScreenTextView = (TextView) udtea.findViewById(R.id.yes_no_decision_textview); myYesNoDecisionScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), myYesNoDecisionScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); RadioButton myYesRadioButton = (RadioButton) udtea.findViewById(R.id.yes_radiobutton); myYesRadioButton.setText(udtea.yesStringValue); myYesRadioButton.setTextSize(20); RadioButton myNoRadioButton = (RadioButton) udtea.findViewById(R.id.no_radiobutton); myNoRadioButton.setText(udtea.noStringValue); myNoRadioButton.setTextSize(20); if (myStringToken.equals("N")) { myNoRadioButton.setChecked(true); } else if ((myStringToken.equals("Y"))) { myYesRadioButton.setChecked(true); } } else if (udtea.currScreen == udtea.SEND_TO_CLOUD_BASED_SERVICE_SCREEN) { udtea.setContentView(R.layout.yes_no_decision_screen); udtea.initBackNextButtons(); TextView mySendToCloudBasedServiceScreenTextView = (TextView) udtea .findViewById(R.id.yes_no_decision_textview); mySendToCloudBasedServiceScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), mySendToCloudBasedServiceScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); RadioButton mySendToCloudBasedServiceScreenYesRadioButton = (RadioButton) udtea .findViewById(R.id.yes_radiobutton); mySendToCloudBasedServiceScreenYesRadioButton.setText(udtea.yesStringValue); mySendToCloudBasedServiceScreenYesRadioButton.setTextSize(20); RadioButton mySendToCloudBasedServiceScreenNoRadioButton = (RadioButton) udtea .findViewById(R.id.no_radiobutton); mySendToCloudBasedServiceScreenNoRadioButton.setText(udtea.noStringValue); mySendToCloudBasedServiceScreenNoRadioButton.setTextSize(20); if (myStringToken.equals("N")) { mySendToCloudBasedServiceScreenNoRadioButton.setChecked(true); } else if ((myStringToken.equals("Y"))) { mySendToCloudBasedServiceScreenYesRadioButton.setChecked(true); } } else if (udtea.currScreen == udtea.SEND_TO_WEBSERVER_SCREEN) { udtea.setContentView(R.layout.send_to_webserver_screen); udtea.initBackNextButtons(); TextView mySendToWebserverScreenTextView = (TextView) udtea .findViewById(R.id.send_to_webserver_textview); mySendToWebserverScreenTextView = (TextView) UsbongUtils.applyTagsInView( UsbongDecisionTreeEngineActivity.getInstance(), mySendToWebserverScreenTextView, UsbongUtils.IS_TEXTVIEW, udtea.currUsbongNode); TextView myWebserverURLScreenTextView = (TextView) udtea.findViewById(R.id.webserver_url_textview); if (!UsbongUtils.getDestinationServerURL().toString().equals("")) { myWebserverURLScreenTextView.setText("[" + UsbongUtils.getDestinationServerURL() + "]"); } else { myWebserverURLScreenTextView.setText("[Warning: No URL specified in Settings.]"); } RadioButton mySendToWebserverYesRadioButton = (RadioButton) udtea.findViewById(R.id.yes_radiobutton); mySendToWebserverYesRadioButton.setText(udtea.yesStringValue); mySendToWebserverYesRadioButton.setTextSize(20); RadioButton mySendToWebserverNoRadioButton = (RadioButton) udtea.findViewById(R.id.no_radiobutton); mySendToWebserverNoRadioButton.setText(udtea.noStringValue); mySendToWebserverNoRadioButton.setTextSize(20); if (myStringToken.equals("N")) { mySendToWebserverNoRadioButton.setChecked(true); } else if ((myStringToken.equals("Y"))) { mySendToWebserverYesRadioButton.setChecked(true); } } else if (udtea.currScreen == udtea.END_STATE_SCREEN) { udtea.setContentView(R.layout.end_state_screen); TextView endStateTextView = (TextView) udtea.findViewById(R.id.end_state_textview); if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_FILIPINO) { endStateTextView .setText((String) udtea.getResources().getText(R.string.UsbongEndStateTextViewFILIPINO)); } else if (udtea.currLanguageBeingUsed == UsbongUtils.LANGUAGE_JAPANESE) { endStateTextView .setText((String) udtea.getResources().getText(R.string.UsbongEndStateTextViewJAPANESE)); } else { //if (udtea.currLanguageBeingUsed==UsbongUtils.LANGUAGE_ENGLISH) { endStateTextView .setText((String) udtea.getResources().getText(R.string.UsbongEndStateTextViewENGLISH)); } udtea.initBackNextButtons(); } View myLayout = udtea.findViewById(R.id.parent_layout_id); if (!UsbongUtils.setBackgroundImage(myLayout, udtea.myTree, "bg")) { myLayout.setBackgroundResource(R.drawable.bg);//default bg } if ((!udtea.usedBackButton) && (!udtea.hasReturnedFromAnotherActivity)) { udtea.usbongNodeContainer.addElement(udtea.currUsbongNode); udtea.usbongNodeContainerCounter++; } else { udtea.usedBackButton = false; udtea.hasReturnedFromAnotherActivity = false; } }