package com.vci.client.uif.engine.client.tableArea; import java.awt.BorderLayout; import java.awt.Component; import java.util.HashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import com.vci.client.common.objects.UserObject; import com.vci.client.framework.delegate.RightManagementClientDelegate; import com.vci.client.portal.utility.DataModelFactory; import com.vci.client.portal.utility.PLDefination; import com.vci.client.portal.utility.UITools; import com.vci.client.ui.exception.VCIException; import com.vci.client.ui.process.QANProcessBar; import com.vci.client.ui.process.QANProcessBarFrame; import com.vci.client.ui.swing.VCISwingUtil; import com.vci.corba.portal.data.PLPageDefination; import com.vci.corba.portal.data.PLUILayout; import com.vci.corba.portal.data.PLTabPage; import com.vci.corba.portal.data.PortalVI; public class TablePanelTest extends JPanel{ /** * */ private static final long serialVersionUID = -8547626443017332324L; private void init() throws VCIException{ String ip = "192.168.0.100"; String userName = "1"; String password = "1"; com.vci.client.common.objects.ClientInfo client = new com.vci.client.common.objects.ClientInfo(); client.setIp(ip); //登陆用户信息 RightManagementClientDelegate delegate = new RightManagementClientDelegate(); UserObject checkLogin = delegate.checkLoginForBS(userName, password, client); } private PortalVI getPortalDefination(DataModelFactory factory, String type, String context, PLTabPage currentab) throws Throwable { PLUILayout contextDef = factory.getContextDefination(type, context); if (contextDef == null) { return null; } PLTabPage[] tabs = factory.getTabDefinationByContextId(contextDef.plOId); currentab.plOId = tabs[0].plOId; currentab.plName = tabs[0].plName; PLPageDefination[] definations = factory.getPageDefinationById(tabs[0].plOId); PLDefination defination = UITools.getPLDefination(definations[0].plDefination); PortalVI tableDef = factory.getTableDefinationByTypeAndTableName(type, defination.getTemplateId()); return tableDef; } public TablePanelTest() throws Throwable{ init(); TablePanel tp = new TablePanel(); String type = "Model"; String context = "ModelManagement"; type = "staff"; context = "staffManagement"; DataModelFactory factory = new DataModelFactory(); PLTabPage currenTab = new PLTabPage(); PLUILayout contextDef = factory.getContextDefination(type, context); PLTabPage[] tabs = factory.getTabDefinationByContextId(contextDef.plOId); currenTab.plOId = tabs[0].plOId; currenTab.plName = tabs[0].plName; PLPageDefination[] definations = factory.getPageDefinationById(tabs[0].plOId); PLDefination defination = UITools.getPLDefination(definations[0].plDefination); tp.preInit(type, context); tp.setType(type); tp.setContext(context); tp.setDefination(defination); tp.setTabId(tabs[0].plOId); Component compt = tp.init(); setLayout(new BorderLayout()); add(compt, BorderLayout.CENTER); } /** * @param args */ public static void main(String[] args) { // // TODO Auto-generated method stub // SwingUtilities.invokeLater(new Runnable() { // // @Override // public void run() { // // TODO Auto-generated method stub // try { // creatAndShowGUI(); // } catch (Throwable e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // }); String rule = "${t_oid.found}-${f_oid.notfound}"; boolean allFieldExist = true; int start = rule.indexOf("${"); int end = rule.indexOf("}"); HashMap map = new HashMap(); map.put("t_oid.found", ""); String defaultValue = rule; while(start >= 0 && end >= 0 && start < end && end < rule.length()){ String field = rule.substring(start+2, end); rule = rule.substring(end+1); if(!map.containsKey(field)){ allFieldExist = false; defaultValue = ""; break; } start = rule.indexOf("${"); end = rule.indexOf("}"); } System.out.println(defaultValue); Pattern ptn = Pattern.compile(".*$$\\{[0-9]+\\}.*"); String input = "{123}"; boolean matches = ptn.matcher(input).matches(); System.out.println(matches); Matcher m = ptn.matcher(input); int groupCount = m.groupCount(); for(int i = 0; i < groupCount; i++){ String group = m.group(i); System.out.println(group); } final QANProcessBarFrame frame = new QANProcessBarFrame(); Thread t = new Thread(){ public void run(){ for (int i = 0; i < 1000; i++) { frame.setContent(String.valueOf(i)); } frame.setProcessBarCancel(true); } }; final QANProcessBar bar = new QANProcessBar(t, frame, frame, "", false); bar.setVisible(true); } private static void creatAndShowGUI() throws Throwable{ JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new TablePanelTest()); f.pack(); VCISwingUtil.setClientMainFrame(f); f.setVisible(true); } }