List of usage examples for org.apache.commons.lang3 StringUtils trimToEmpty
public static String trimToEmpty(final String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null .
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the currCaChildrenServIndicator */ public String getCurrCaChildrenServIndicator() { return StringUtils.trimToEmpty(currCaChildrenServIndicator); }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the currentlyOtherDescription */ public String getCurrentlyOtherDescription() { return StringUtils.trimToEmpty(currentlyOtherDescription); }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the currentlyRegionalCenterIndicator */ public String getCurrentlyRegionalCenterIndicator() { return StringUtils.trimToEmpty(currentlyRegionalCenterIndicator); }
From source file:gtu._work.ui.RegexReplacer.java
private void initGUI() { try {/*from w w w .j a v a 2 s .c o m*/ BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { try { if (configHandler != null && jTabbedPane1.getSelectedIndex() == TabIndex.TEMPLATE.ordinal()) { System.out.println("-------ChangeEvent[" + jTabbedPane1.getSelectedIndex() + "]"); configHandler.reloadTemplateList(); } } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("source", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { replaceArea = new JTextArea(); jScrollPane1.setViewportView(replaceArea); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("param", null, jPanel2, null); { exeucte = new JButton(); jPanel2.add(exeucte, BorderLayout.SOUTH); exeucte.setText("exeucte"); exeucte.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exeucteActionPerformed(evt); } }); } { jPanel3 = new JPanel(); jPanel2.add(JCommonUtil.createScrollComponent(jPanel3), BorderLayout.CENTER); jPanel3.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, RowSpec.decode("default:grow"), })); { lblNewLabel = new JLabel("key"); jPanel3.add(lblNewLabel, "2, 2, right, default"); } { configKeyText = new JTextField(); jPanel3.add(configKeyText, "4, 2, fill, default"); configKeyText.setColumns(10); } { lblNewLabel_1 = new JLabel("from"); jPanel3.add(lblNewLabel_1, "2, 4, right, default"); } { repFromText = new JTextArea(); repFromText.setRows(3); jPanel3.add(JCommonUtil.createScrollComponent(repFromText), "4, 4, fill, default"); repFromText.setColumns(10); } { lblNewLabel_2 = new JLabel("to"); jPanel3.add(lblNewLabel_2, "2, 6, right, default"); } { repToText = new JTextArea(); repToText.setRows(3); // repToText.setPreferredSize(new Dimension(0, 50)); jPanel3.add(JCommonUtil.createScrollComponent(repToText), "4, 6, fill, default"); } } { addToTemplate = new JButton(); jPanel2.add(addToTemplate, BorderLayout.NORTH); addToTemplate.setText("add to template"); addToTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { configHandler.put(configKeyText.getText(), repFromText.getText(), repToText.getText(), tradeOffArea.getText()); configHandler.reloadTemplateList(); } }); } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jPanel5.setLayout(jPanel5Layout); jTabbedPane1.addTab("template", null, jPanel5, null); { jScrollPane3 = new JScrollPane(); jPanel5.add(jScrollPane3, BorderLayout.CENTER); { templateList = new JList(); jScrollPane3.setViewportView(templateList); } templateList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (templateList.getLeadSelectionIndex() == -1) { return; } PropConfigHandler.Config config = (PropConfigHandler.Config) JListUtil .getLeadSelectionObject(templateList); configKeyText.setText(config.configKeyText); repFromText.setText(config.fromVal); repToText.setText(config.toVal); tradeOffArea.setText(config.tradeOff); templateList.setToolTipText(config.fromVal + " <----> " + config.toVal); if (JMouseEventUtil.buttonLeftClick(2, evt)) { String replaceText = StringUtils.defaultString(replaceArea.getText()); replaceText = replacer(config.fromVal, config.toVal, replaceText); resultArea.setText(replaceText); jTabbedPane1.setSelectedIndex(TabIndex.RESULT.ordinal()); // pasteTextToClipboard(); } } }); templateList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(templateList).defaultJListKeyPressed(evt); } }); // ? JListUtil.newInstance(templateList).setItemColorTextProcess(new ItemColorTextHandler() { public Pair<String, Color> setColorAndText(Object value) { PropConfigHandler.Config config = (PropConfigHandler.Config) value; if (config.tradeOffScore != 0) { return Pair.of(null, Color.GREEN); } return null; } }); // ? } { scheduleExecute = new JButton(); jPanel5.add(scheduleExecute, BorderLayout.SOUTH); scheduleExecute.setText("schedule execute"); scheduleExecute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { scheduleExecuteActionPerformed(evt); } }); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("result", null, jPanel4, null); { jScrollPane2 = new JScrollPane(); jPanel4.add(jScrollPane2, BorderLayout.CENTER); { resultArea = new JTextArea(); jScrollPane2.setViewportView(resultArea); } } } } { configHandler = new PropConfigHandler(prop, propFile, templateList, replaceArea); JCommonUtil.setFont(repToText, repFromText, replaceArea, templateList); { tradeOffArea = new JTextArea(); tradeOffArea.setRows(3); // tradeOffArea.setPreferredSize(new Dimension(0, 50)); tradeOffArea.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { if (JMouseEventUtil.buttonLeftClick(2, e)) { String tradeOff = StringUtils.trimToEmpty(tradeOffArea.getText()); JSONObject json = null; if (StringUtils.isBlank(tradeOff)) { json = new JSONObject(); json.put(CONTAIN_ARRY_KEY, new JSONArray()); json.put(NOT_CONTAIN_ARRY_KEY, new JSONArray()); tradeOff = json.toString(); } else { json = JSONObject.fromObject(tradeOff); } // String selectItem = (String) JCommonUtil._JOptionPane_showInputDialog( "?!", "?", new Object[] { "NA", "equal", "not_equal", "ftl" }, "NA"); if ("NA".equals(selectItem)) { return; } String string = StringUtils.trimToEmpty( JCommonUtil._jOptionPane_showInputDialog(":")); string = StringUtils.trimToEmpty(string); if (StringUtils.isBlank(string)) { tradeOffArea.setText(json.toString()); return; } String arryKey = ""; String boolKey = ""; String strKey = ""; String intKey = ""; if (selectItem.equals("equal")) { arryKey = CONTAIN_ARRY_KEY; } else if (selectItem.equals("not_equal")) { arryKey = NOT_CONTAIN_ARRY_KEY; } else if (selectItem.equals("ftl")) { strKey = FREEMARKER_KEY; } else { throw new RuntimeException(" : " + selectItem); } if (StringUtils.isNotBlank(arryKey)) { if (!json.containsKey(arryKey)) { json.put(arryKey, new JSONArray()); } JSONArray arry = (JSONArray) json.get(arryKey); boolean findOk = false; for (int ii = 0; ii < arry.size(); ii++) { if (StringUtils.equalsIgnoreCase(arry.getString(ii), string)) { findOk = true; break; } } if (!findOk) { arry.add(string); } } else if (StringUtils.isNotBlank(strKey)) { json.put(strKey, string); } else if (StringUtils.isNotBlank(intKey)) { json.put(intKey, Integer.parseInt(string)); } else if (StringUtils.isNotBlank(boolKey)) { json.put(boolKey, Boolean.valueOf(string)); } tradeOffArea.setText(json.toString()); JCommonUtil._jOptionPane_showMessageDialog_info("?!"); } } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); { panel = new JPanel(); jPanel3.add(panel, "4, 8, fill, fill"); { multiLineCheckBox = new JCheckBox(""); panel.add(multiLineCheckBox); } { autoPasteToClipboardCheckbox = new JCheckBox(""); panel.add(autoPasteToClipboardCheckbox); } } { lblNewLabel_3 = new JLabel("? "); jPanel3.add(lblNewLabel_3, "2, 10"); } jPanel3.add(JCommonUtil.createScrollComponent(tradeOffArea), "4, 10, fill, fill"); } configHandler.reloadTemplateList(); } this.setSize(512, 350); JCommonUtil.setJFrameCenter(this); JCommonUtil.defaultToolTipDelay(); JCommonUtil.frameCloseDo(this, new WindowAdapter() { public void windowClosing(WindowEvent paramWindowEvent) { try { prop.store(new FileOutputStream(propFile), "regexText"); } catch (Exception e) { JCommonUtil.handleException("properties store error!", e); } setVisible(false); dispose(); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the deathDateVerifiedIndicator */ public String getDeathDateVerifiedIndicator() { return StringUtils.trimToEmpty(deathDateVerifiedIndicator); }
From source file:me.mayo.telnetkek.MainPanel.java
public final ServerEntry saveServers() { final Object selectedItem = txtServer.getSelectedItem(); if (selectedItem == null) { return null; }/*from w ww .j a va 2 s. co m*/ ServerEntry entry; if (selectedItem instanceof ServerEntry) { entry = (ServerEntry) selectedItem; } else { final String serverAddress = StringUtils.trimToNull(selectedItem.toString()); if (serverAddress == null) { return null; } String serverName = JOptionPane.showInputDialog(this, "Enter server name:", "Server Name", JOptionPane.PLAIN_MESSAGE); if (serverName == null) { return null; } serverName = StringUtils.trimToEmpty(serverName); if (serverName.isEmpty()) { serverName = "Unnamed"; } entry = new ServerEntry(serverName, serverAddress); TelnetKek.config.getServers().add(entry); } TelnetKek.config.save(); return entry; }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the deathPlace */ public String getDeathPlace() { return StringUtils.trimToEmpty(deathPlace); }
From source file:com.github.binlee1990.spider.movie.spider.MovieCrawler.java
private List<Album> createOrGetAlbumList(Document doc) { List<Album> albumList = Lists.newArrayList(); Elements albumElements = doc.select(".panel .fm-little li:has(a) a"); if (CollectionUtils.isNotEmpty(albumElements)) { albumElements.forEach(albumElement -> { String href = albumElement.attr("href").toString(); if (StringUtils.isNotBlank(href) && StringUtils.contains(href, "collection")) { String albumName = StringUtils.trimToEmpty(albumElement.text()); if (StringUtils.isNotBlank(albumName)) { Album album = createOrQueryAlbum(albumName); if (null != album) { albumList.add(album); }/*from w ww. j a v a2s. c o m*/ } } }); } return albumList; }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the deathReasonText */ public String getDeathReasonText() { return StringUtils.trimToEmpty(deathReasonText); }
From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java
/** * @return the driverLicenseNumber */ public String getDriverLicenseNumber() { return StringUtils.trimToEmpty(driverLicenseNumber); }