List of usage examples for javax.swing JProgressBar JProgressBar
public JProgressBar(int min, int max)
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI//from w w w . j ava 2 s. c o m * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }
From source file:edu.ku.brc.specify.config.init.SpecifyDBSetupWizard.java
/** * @param wizardType// w w w . jav a 2 s . co m * @param listener */ public SpecifyDBSetupWizard(final WizardType wizardType, final WizardListener listener) { super(); this.wizardType = wizardType; this.listener = listener; System.setProperty(DBMSUserMgr.factoryName, "edu.ku.brc.dbsupport.MySQLDMBSUserMgr"); /*setupXMLPath = UIRegistry.getUserHomeAppDir() + File.separator + "setup_prefs.xml"; try { props.loadFromXML(new FileInputStream(new File(setupXMLPath))); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSetupWizard.class, ex); }*/ HelpMgr.setLoadingPage("Load"); cardPanel = new JPanel(cardLayout); cancelBtn = createButton(UIRegistry.getResourceString("CANCEL")); helpBtn = createButton(UIRegistry.getResourceString("HELP")); JPanel btnBar; backBtn = createButton(UIRegistry.getResourceString("BACK")); nextBtn = createButton(UIRegistry.getResourceString("NEXT")); CellConstraints cc = new CellConstraints(); PanelBuilder bbpb = new PanelBuilder(new FormLayout("f:p:g,p,4px,p,4px,p,4px,p,4px", "p")); bbpb.add(helpBtn, cc.xy(2, 1)); bbpb.add(backBtn, cc.xy(4, 1)); bbpb.add(nextBtn, cc.xy(6, 1)); bbpb.add(cancelBtn, cc.xy(8, 1)); btnBar = bbpb.getPanel(); boolean doTesting = AppPreferences.getLocalPrefs().getBoolean("wizard.defaults", false); if (doTesting && wizardType == WizardType.Institution) { props.put("hostName", "localhost"); props.put("dbName", "testfish"); props.put("dbUserName", "Specify"); props.put("dbPassword", "Specify"); props.put("saUserName", "Master"); props.put("saPassword", "Master"); props.put("firstName", "Test"); props.put("lastName", "User"); props.put("middleInitial", "a"); props.put("email", "tester@ku.edu"); props.put("usrUsername", "testuser"); props.put("usrPassword", "testuser"); props.put("instName", "KU natural History Museum"); props.put("instAbbrev", "KU-NHM"); props.put("divName", "Fish"); props.put("divAbbrev", "IT"); props.put("collName", "Fish"); props.put("collPrefix", "KUFSH"); // Address props.put("addr1", "1345 Jayhawk Blvd"); props.put("addr2", "606 Dyche Hall"); props.put("city", "Lawrence"); props.put("state", "KS"); props.put("country", "USA"); props.put("zip", "66044"); props.put("phone", "785-864-5555"); props.put("addtaxon", true); } else { props.put("hostName", "localhost"); props.put("dbName", "specify"); } props.put("userType", SpecifyUserTypes.UserType.Manager.toString()); UIFieldFormatterMgr.setDoingLocal(true); String accessionFmt = null; if (wizardType == WizardType.Institution) { props.put("fromwizard", "true"); dbPanel = new DatabasePanel(nextBtn, backBtn, getHelpCntxt("wizard_mysql_username"), true); panels.add(dbPanel); HelpMgr.registerComponent(helpBtn, dbPanel.getHelpContext()); if (listener != null) { listener.helpContextChanged(dbPanel.getHelpContext()); } panels.add(new MasterUserPanel("SA", "ENTER_SA_INFO", getHelpCntxt("wizard_master_username"), new String[] { "SA_USERNAME", "SA_PASSWORD" }, new String[] { "saUserName", "saPassword" }, new Integer[] { 32, 32 }, nextBtn, backBtn, true)); panels.add(new GenericFormPanel("SECURITY", "SECURITY_INFO", getHelpCntxt("wizard_security_on"), new String[] { "SECURITY_ON" }, new String[] { "security_on" }, new String[] { "checkbox" }, nextBtn, backBtn, true)); userInfoPanel = new UserInfoPanel("AGENT", "ENTER_COLMGR_INFO", getHelpCntxt("wizard_create_it_user"), new String[] { "FIRSTNAME", "LASTNAME", "MIDNAME", "EMAIL", null, "USERLOGININFO", "USERNAME", "PASSWORD" }, new String[] { "firstName", "lastName", "middleInitial", "email", " ", "-", "usrUsername", "usrPassword" }, new boolean[] { true, true, false, true, true, false, true, true }, new Integer[] { 50, 120, 50, 50, null, null, 64, 32 }, nextBtn, backBtn); panels.add(userInfoPanel); panels.add(new GenericFormPanel("INST", "ENTER_INST_INFO", getHelpCntxt("wizard_create_institution"), new String[] { "NAME", "ABBREV", null, "INST_ADDR", "ADDR1", "ADDR2", "CITY", "STATE", "COUNTRY", "ZIP", "PHONE" }, new String[] { "instName", "instAbbrev", " ", "-", "addr1", "addr2", "city", "state", "country", "zip", "phone" }, new boolean[] { true, true, false, false, true, false, true, true, true, true, true }, new Integer[] { 255, 32, 50, null, 255, 255, 64, 64, 64, 32, 50 }, nextBtn, backBtn, true)); accessionPanel = new GenericFormPanel("ACCESSIONGLOBALLY", "ENTER_ACC_INFO", getHelpCntxt("wizard_choose_accession_level"), new String[] { "ACCGLOBALLY" }, new String[] { "accglobal" }, new String[] { "checkbox" }, nextBtn, backBtn, true); panels.add(accessionPanel); if (wizardType == WizardType.Institution) { accessionPickerGbl = new FormatterPickerPanel("ACCNOFMT", getHelpCntxt("wizard_create_accession_number"), nextBtn, backBtn, false, null); panels.add(accessionPickerGbl); } storageTDPanel = new TreeDefSetupPanel(StorageTreeDef.class, getResourceString("Storage"), "Storage", getHelpCntxt("wizard_configure_storage_tree"), "CONFIG_TREEDEF", nextBtn, backBtn, null); panels.add(storageTDPanel); panels.add(new InstSetupPanel("CREATEINST", "CREATEINST", getHelpCntxt("wizard_create_institution"), new String[] {}, new String[] {}, new Integer[] {}, nextBtn, backBtn, true)); } if (wizardType == WizardType.Institution || wizardType == WizardType.Division) { DivisionPanel divPanel = new DivisionPanel("DIV", "ENTER_DIV_INFO", getHelpCntxt("wizard_enter_division"), new String[] { "NAME", "ABBREV" }, new String[] { "divName", "divAbbrev" }, new Integer[] { 255, 64 }, nextBtn, backBtn, true); panels.add(divPanel); if (wizardType == WizardType.Division) { HelpMgr.registerComponent(helpBtn, divPanel.getHelpContext()); } } if (wizardType != WizardType.Institution) { Institution institution = AppContextMgr.getInstance().getClassObject(Institution.class); Division division = AppContextMgr.getInstance().getClassObject(Division.class); if (!institution.getIsAccessionsGlobal()) { String sql = "SELECT ans.FormatName FROM autonumberingscheme ans Inner Join autonumsch_div ad ON ans.AutoNumberingSchemeID = ad.AutoNumberingSchemeID " + "INNER JOIN division d ON ad.DivisionID = d.UserGroupScopeId WHERE d.DivisionID = " + division.getId(); log.debug(sql); Vector<Object> rows = BasicSQLUtils.querySingleCol(sql); if (rows.size() == 1) { accessionFmt = rows.get(0).toString(); } else { log.error("The return " + rows.size()); } } } if (wizardType == WizardType.Institution || wizardType == WizardType.Division || wizardType == WizardType.Discipline) { nextBtn.setEnabled(false); disciplinePanel = new DisciplinePanel(getHelpCntxt("wizard_choose_discipline_type"), nextBtn, backBtn); panels.add(disciplinePanel); if (wizardType == WizardType.Discipline) { HelpMgr.registerComponent(helpBtn, disciplinePanel.getHelpContext()); } taxonTDPanel = new TreeDefSetupPanel(TaxonTreeDef.class, getResourceString("Taxon"), "Taxon", getHelpCntxt("wizard_configure_taxon_tree"), "CONFIG_TREEDEF", nextBtn, backBtn, disciplinePanel); panels.add(taxonTDPanel); panels.add(new TaxonLoadSetupPanel(getHelpCntxt("wizard_preload_taxon"), nextBtn, backBtn)); geoTDPanel = new TreeDefSetupPanel(GeographyTreeDef.class, getResourceString("Geography"), "Geography", getHelpCntxt("wizard_configure_geography_tree"), "CONFIG_TREEDEF", nextBtn, backBtn, disciplinePanel); panels.add(geoTDPanel); } CollectionPanel colPanel = new CollectionPanel("COLLECTION", "ENTER_COL_INFO", getHelpCntxt("wizard_create_collection"), new String[] { "NAME", "PREFIX", }, new String[] { "collName", "collPrefix", }, new Integer[] { 50, 50 }, nextBtn, backBtn, true); panels.add(colPanel); if (wizardType == WizardType.Collection) { HelpMgr.registerComponent(helpBtn, colPanel.getHelpContext()); } catNumPicker = new FormatterPickerPanel("CATNOFMT", getHelpCntxt("wizard_create_catalog_number"), nextBtn, backBtn, true, null); panels.add(catNumPicker); if (wizardType != WizardType.Institution) { Division division = AppContextMgr.getInstance().getClassObject(Division.class); String sql = "SELECT COUNT(*) FROM division d INNER JOIN collection c ON d.UserGroupScopeId = c.DisciplineID WHERE d.UserGroupScopeId = " + division.getId(); log.debug(sql); int numCollectionsByDiv = BasicSQLUtils.getCountAsInt(sql); if (numCollectionsByDiv == 0) { Institution inst = AppContextMgr.getInstance().getClassObject(Institution.class); if (inst != null && !inst.getIsAccessionsGlobal()) { //if (wizardType != WizardType.Division) { accessionPickerCol = new FormatterPickerPanel("ACCNOFMT", getHelpCntxt("wizard_create_accession_number"), nextBtn, backBtn, false, accessionFmt); accessionPickerCol.setDoingDisciplineCollection(wizardType != WizardType.Division); panels.add(accessionPickerCol); } } } } else { accessionPickerCol = new FormatterPickerPanel("ACCNOFMT", getHelpCntxt("wizard_create_accession_number"), nextBtn, backBtn, false, null); panels.add(accessionPickerCol); } panels.add(new SummaryPanel("SUMMARY", getHelpCntxt("wizard_summary"), nextBtn, backBtn, panels)); lastStep = panels.size(); if (backBtn != null) { backBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (step > 0) { if (disciplinePanel != null) { DisciplineType disciplineType = disciplinePanel.getDisciplineType(); if (disciplineType != null && disciplineType.isPaleo() && panels.get(step - 1) instanceof TaxonLoadSetupPanel) { //step--; } } if (panels.get(step - 1) == accessionPickerGbl) { if (!((Boolean) props.get("accglobal"))) { step--; } } if (panels.get(step - 1) == accessionPickerCol) { boolean isAccGlobal; if (accessionPanel != null) { accessionPanel.getValues(props); isAccGlobal = (Boolean) props.get("accglobal"); } else { Institution inst = AppContextMgr.getInstance().getClassObject(Institution.class); isAccGlobal = inst != null && !inst.getIsAccessionsGlobal(); } if (isAccGlobal) { step--; } } step--; panels.get(step).doingPrev(); HelpMgr.registerComponent(helpBtn, panels.get(step).getHelpContext()); cardLayout.show(cardPanel, Integer.toString(step)); } updateBtnBar(); if (listener != null) { listener.panelChanged(getResourceString(panels.get(step).getPanelName() + ".TITLE")); listener.helpContextChanged(panels.get(step).getHelpContext()); } } }); backBtn.setEnabled(false); } nextBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (step == lastStep - 2) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Component c = SpecifyDBSetupWizard.this.getParent(); while (!(c instanceof Window) && c != null) { c = c.getParent(); } if (c != null) { ((Window) c).pack(); } } }); } if (step < lastStep - 1) { DisciplineType disciplineType = null; if (disciplinePanel == null) { Discipline discipline = AppContextMgr.getInstance().getClassObject(Discipline.class); disciplineType = DisciplineType.getByName(discipline.getType()); } else { disciplineType = disciplinePanel.getDisciplineType(); } panels.get(step).getValues(props); panels.get(step).aboutToLeave(); if (step == 1) { String isCnvUploadVal = props.getProperty(DatabasePanel.DB_STRUCT_ONLY); boolean isCnvUpload = StringUtils.isNotEmpty(isCnvUploadVal) ? isCnvUploadVal.equals("true") : false; if (isCnvUpload) { setupLoginPrefs(); JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), getResourceString("CONVUPLD_DONE"), getResourceString("COMPLETE"), JOptionPane.INFORMATION_MESSAGE); SpecifyDBSetupWizard.this.listener.finished(); return; } } if (disciplineType != null && disciplineType.isPaleo() && panels.get(step) instanceof TreeDefSetupPanel && ((TreeDefSetupPanel) panels.get(step)).getClassType() == TaxonTreeDef.class) { //step++; } if (panels.get(step) == accessionPanel) { accessionPanel.getValues(props); if (!((Boolean) props.get("accglobal"))) { step++; } } if (panels.get(step) == catNumPicker) { if (accessionPanel != null) { accessionPanel.getValues(props); boolean isAccGlobal = (Boolean) props.get("accglobal"); if (isAccGlobal) { step++; } } } advanceToNextPanel(); } else { nextBtn.setEnabled(false); if (wizardType == WizardType.Institution) { configSetup(); configureDatabase(); } else { //SpecifyDBSetupWizard.this.listener.hide(); SpecifyDBSetupWizard.this.listener.finished(); } } } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (SpecifyDBSetupWizard.this.listener != null) { if (step == lastStep) { SpecifyDBSetupWizard.this.listener.finished(); } else { if (UIHelper.promptForAction("QUIT", "NO", "CANCEL", getResourceString("SURE_QUIT"))) { SpecifyDBSetupWizard.this.listener.cancelled(); } } } } }); for (int i = 0; i < panels.size(); i++) { cardPanel.add(Integer.toString(i), panels.get(i)); panels.get(i).setValues(props); } cardLayout.show(cardPanel, "0"); if (dbPanel != null) { dbPanel.updateBtnUI(); } PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,10px,p")); builder.add(cardPanel, cc.xy(1, 1)); builder.add(btnBar, cc.xy(1, 3)); builder.setDefaultDialogBorder(); setLayout(new BorderLayout()); PanelBuilder iconBldr = new PanelBuilder(new FormLayout("20px, f:p:g,p,f:p:g,8px", "20px,t:p,f:p:g, 8px")); JLabel iconLbl = new JLabel(IconManager.getIcon(getIconName())); iconLbl.setVerticalAlignment(SwingConstants.TOP); iconBldr.add(iconLbl, cc.xy(2, 3)); add(iconBldr.getPanel(), BorderLayout.WEST); add(builder.getPanel(), BorderLayout.CENTER); progressBar = new JProgressBar(0, lastStep - 1); progressBar.setStringPainted(true); add(progressBar, BorderLayout.SOUTH); panels.get(0).updateBtnUI(); }
From source file:com.sec.ose.osi.ui.frm.main.manage.JPanManageMain.java
JProgressBar getJAnalyzeProgressBar() { if (jAnalyzeProgressBar == null) { jAnalyzeProgressBar = new JProgressBar(0, 100); jAnalyzeProgressBar.setVisible(false); jAnalyzeProgressBar.setForeground(Color.GREEN); }/*from w w w .j av a 2 s.c o m*/ return jAnalyzeProgressBar; }
From source file:jchrest.gui.VisualSearchPane.java
private JPanel runAnalysisButtons(JSpinner numFixations) { JPanel panel = new JPanel(); _analyseAction = new AnalyseAction(numFixations); JButton analyseButton = new JButton(_analyseAction); analyseButton.setToolTipText("Analyse CHREST model on all scenes"); _stopAnalysisAction = new StopAnalysisAction(); _stopAnalysisAction.setEnabled(false); JButton stopAnalysisButton = new JButton(_stopAnalysisAction); stopAnalysisButton.setToolTipText("Stop the current analysis"); _feedbackAnalysis = new JProgressBar(0, 100); _feedbackAnalysis.setToolTipText("Proportion of scenes analysed"); _feedbackAnalysis.setValue(0);/*w w w .j a va 2 s .c om*/ _feedbackAnalysis.setStringPainted(true); panel.add(analyseButton); panel.add(stopAnalysisButton); panel.add(_feedbackAnalysis); return panel; }
From source file:com.entertailion.java.fling.FlingFrame.java
/** * Create a progress indicator//from w w w .j a v a2 s.c o m */ private void createProgressDialog() { progressDialog = new JDialog(this, resourceBundle.getString("progress.title"), true); JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); progressDialog.add(BorderLayout.CENTER, progressBar); progressDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); progressDialog.setSize(300, 75); progressDialog.setLocationRelativeTo(this); }
From source file:org.jdesktop.swingworker.AccumulativeRunnable.java
public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Prime Numbers Demo"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JTextArea textArea = new JTextArea(); textArea.setEditable(false);//w w w . j a va 2s . com frame.add(new JScrollPane(textArea), BorderLayout.CENTER); PrimeNumbersTask task = new PrimeNumbersTask(textArea, 10000); final JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setIndeterminate(true); frame.add(progressBar, BorderLayout.NORTH); frame.setSize(500, 500); frame.setVisible(true); task.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progressBar.setIndeterminate(false); progressBar.setValue((Integer)evt.getNewValue()); } } }); task.execute(); return; }
From source file:app.RunApp.java
/** * Initializes the default configuration of the app *//*from w ww . j a v a 2 s .com*/ private void initConfig() { /* * Preprocess */ buttonGroup1.add(radioRandomHoldout); radioRandomHoldout.setToolTipText("Split the dataset into random train and test files"); textRandomHoldout.setToolTipText("Percentage of train instances"); buttonGroup1.add(radioIterativeStratifiedHoldout); radioIterativeStratifiedHoldout .setToolTipText("Split the dataset into train and test files by Iterative stratified method"); textIterativeStratifiedHoldout.setToolTipText("Percentage of train instances"); buttonGroup1.add(radioLPStratifiedHoldout); radioLPStratifiedHoldout .setToolTipText("Split the dataset into train and test files by Label Powerset stratified method"); textLPStratifiedHoldout.setToolTipText("Percentage of train instances"); buttonGroup1.add(radioRandomCV); radioRandomCV.setToolTipText("Generates random cross-validation files for selected number of folds"); textRandomCV.setToolTipText("Number of folds for cross-validation"); buttonGroup1.add(radioIterativeStratifiedCV); radioIterativeStratifiedCV.setToolTipText( "Generates Iterative stratified cross-validation files for selected number of folds"); textIterativeStratifiedCV.setToolTipText("Number of folds for cross-validation"); buttonGroup1.add(radioLPStratifiedCV); radioLPStratifiedCV.setToolTipText( "Generates Label Powerset stratified cross-validation files for selected number of folds"); textLPStratifiedCV.setToolTipText("Number of folds for cross-validation"); buttonGroup1.add(radioNoSplit); radioNoSplit.setToolTipText("Not generate any partition of the dataset"); buttonGroup2.add(radioBRFS); radioBRFS.setToolTipText("Feature selection by Binary Relevance Feature Selection method"); textBRFS.setToolTipText("Number of features to select"); labelBRFSComb.setToolTipText("Combiantion approach mode"); jComboBoxBRFSComb.setToolTipText("<html>Combiantion approach mode: <br>" + "max: maximum <br>" + "avg: average <br>" + "min: minumum </html>"); labelBRFSNorm.setToolTipText("Normalization mode"); jComboBoxBRFSNorm.setToolTipText("<html>Normalization mode: <br>" + "dl: divide by length <br>" + "dm: divide by maximum <br>" + "none: no normalization </html>"); labelBRFSOut.setToolTipText("Scoring mode"); jComboBoxBRFSOut.setToolTipText( "<html>Scoring mode: <br>" + "eval: evaluation score <br>" + "rank: ranking score </html>"); buttonGroup2.add(radioRandomFS); radioRandomFS.setToolTipText("Random selection of the features"); textRandomFS.setToolTipText("Number of features to select"); buttonGroup2.add(radioNoFS); radioNoFS.setToolTipText("No feature selection is done"); jButtonStartPreprocess.setToolTipText("Start preprocessing"); jButtonSaveDatasets.setToolTipText("Save dataset files in a folder"); jComboBoxSaveFormat.setToolTipText("Select Mulan or Meka format to save datasets"); buttonGroup3.add(radioNoIS); radioNoIS.setToolTipText("No instance selection is done"); buttonGroup3.add(radioRandomIS); radioRandomIS.setToolTipText("Random selection of the instances"); textRandomIS.setToolTipText("Number of instances to select"); radioRandomHoldout.setSelected(true); radioNoFS.setSelected(true); radioNoIS.setSelected(true); textRandomHoldout.setEnabled(true); textRandomHoldout.setEnabled(true); textIterativeStratifiedHoldout.setEnabled(false); textRandomCV.setEnabled(false); textIterativeStratifiedCV.setEnabled(false); /* * Transformations */ radioBRTrans.setSelected(true); buttonGroup4.add(radioBRTrans); radioBRTrans.setToolTipText("Generates a binary dataset for each label"); buttonGroup4.add(radioLPTrans); radioLPTrans.setToolTipText( "Generates a multi-class dataset where each class is each one of the labelsets in the MLDataset"); buttonGroup4.add(radioIncludeLabelsTrans); radioIncludeLabelsTrans.setToolTipText( "<html>Generates a binary dataset, replicating the instance, where each one is augmented <br> with a label name and the class indicates if the label was associated or not</html>"); radioIncludeLabelsTrans.setToolTipText( "<html>Generates a binary dataset where each instance is replicated as many times as the number of labels.<br>" + "Each new instance is augmented with a label name and the class indicates if the label was associated or not.</html>"); buttonGroup4.add(radioRemoveLabelsTrans); radioRemoveLabelsTrans.setToolTipText("Remove all the labels of the dataset"); jButtonStartTrans.setToolTipText("Start transformation"); jButtonSaveDatasetsTrans.setToolTipText("Save dataset files in a folder"); /* * Dependences */ buttonShowCoOcurrence.setToolTipText("Show graph with labels selected in table"); buttonShowMostFrequent.setToolTipText("Show graph with n most frequent labels"); textMostFrequent.setToolTipText("Number of most frequent labels to show"); buttonShowMostRelated.setToolTipText("Show graph with n most related labels"); textMostRelated.setToolTipText("Number of most related labels to show"); buttonShowMostFrequentURelated .setToolTipText("Show graph with n most frequent union n most related labels"); textMostFrequentURelated.setToolTipText("Show graph with n most frequent union n most related labels"); buttonShowHeatMap.setToolTipText("Show heatmap with labels selected in table"); buttonShowMostFrequentHeatMap.setToolTipText("Show heatmap with n most frequent labels"); textMostFrequentHeatMap.setToolTipText("Number of most frequent labels to show"); buttonShowMostRelatedHeatMap.setToolTipText("Show heatmap with n most related labels"); textMostRelatedHeatMap.setToolTipText("Number of most related labels to show"); buttonShowMostFrequentURelatedHeatMap .setToolTipText("Show heatmap with n most frequent union n most related labels"); textMostFrequentURelatedHeatMap .setToolTipText("Show graph with n most frequent union n most related labels"); jTableChiPhi = setChiPhiTableHelp(jTableChiPhi); jTableCoocurrences = setCoocurrenceTableHelp(jTableCoocurrences); jTableHeatmap = setHeatmapTableHelp(jTableHeatmap); initChiPhiJTable(); //Config jTable Co-ocurrence values jTableCoocurrences.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); JScrollPane scrollPane = new JScrollPane(jTableCoocurrences, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setBounds(20, 20, 780, 390); jTableCoocurrences.setBorder(BorderFactory.createLineBorder(Color.black)); panelCoOcurrenceValues.add(scrollPane, BorderLayout.CENTER); //Config jTable heatmap values jTableHeatmap.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); scrollPane = new JScrollPane(jTableHeatmap, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setBounds(20, 20, 780, 390); jTableHeatmap.setBorder(BorderFactory.createLineBorder(Color.black)); panelHeatmapValues.add(scrollPane, BorderLayout.CENTER); createButtonExportDependencesTable(jTableChiPhi, fixedTableChiPhi, panelChiPhi, exportChiPhiTable, 710, 415, "ChiPhi"); // chiLabel and phiLabel values createButtonExportDependencesTable(jTableCoocurrences, fixedTableCoocurrences, panelCoOcurrenceValues, exportCoocurrenceTable, 710, 415, "Coocurrence");//graph values createButtonExportDependencesTable(jTableHeatmap, fixedTableHeatmap, panelHeatmapValues, exportHeatmapTable, 710, 415, "Heatmap");//heatmap values createButtonExportDependencesChart(panelCoOcurrence, exportCoocurrenceGraph, 720, 440); createButtonExportDependencesChart(panelHeatmapGraph, exportHeatmapGraph, 720, 440); Border border = BorderFactory.createLineBorder(Color.gray, 1); panelHeatmap.setBorder(border); jTableChiPhi.setBorder(border); jTableCoocurrences.setBorder(border); jTableHeatmap.setBorder(border); /* * Charts */ labelFrequencyChart = createJChart(panelExamplesPerLabel, "bar", "Frequency", "Labels", false, "Label frequency"); labelsetsFrequencyChart = createJChart(panelExamplesPerLabelset, "bar", "Frequency", "Labelsets", false, "Labelset frequency"); labelsHistogramChart = createJChart(panelLabelsPerExample, "bar", "Frequency", "Number of labels", false, "Labels histogram"); labelsBoxDiagram = createGraph(panelBoxDiagram); attributesBoxDiagram2 = createGraph(panelBoxDiagramAtt); IRInterClassChart = createJChart(panelIRperLabelInterClass, "bar", "IR inter-class", "Labels", false, "IR inter class"); IRIntraClassChart = createJChart(panelIRperLabelIntraClass, "bar", "IR intra-class", "Labels", false, "IR intra class"); IRLabelsetsChart = createJChart(panelIRperLabelset, "bar", "IR", "Labelsets", false, "IR per labelset"); jLabelIR.setVisible(false); /* * Metrics */ jTablePrincipal = setMetricsHelp(jTablePrincipal); createMetricsTable(jTablePrincipal, panelSummary, buttonAll, buttonNone, buttonInvert, buttonCalculate, buttonSave, buttonClear, 30, 190, 780, 280); //tab Database //35,155,500,355 jTableMulti = setMetricsHelp(jTableMulti); createMultiMetricsTable(jTableMulti, jPanelMulti, buttonAll, buttonNone, buttonInvert, buttonCalculate, buttonSave, 25, 15, 510, 420); //tab Multi jButtonSaveDatasets.setEnabled(false); jComboBoxSaveFormat.setEnabled(false); /* * Progress bar */ progressBar = new JProgressBar(0, 100); progressBar.setValue(0); progressFrame = new JFrame(); progressFrame.setBounds(this.getX() + this.getWidth() / 2 - 100, this.getY() + this.getHeight() / 2 - 15, 200, 30); progressFrame.setResizable(false); progressFrame.setUndecorated(true); progressFrame.add(progressBar); //Default tab TabPrincipal.setEnabledAt(1, false); TabPrincipal.setEnabledAt(2, false); TabPrincipal.setEnabledAt(3, false); TabPrincipal.setEnabledAt(4, false); TabPrincipal.setEnabledAt(5, false); TabPrincipal.setEnabledAt(6, true); //Multiple datasets table enabled TabPrincipal.setEnabledAt(7, false); }
From source file:JNLPAppletLauncher.java
private void initLoaderLayout() { setLayout(new BorderLayout()); loaderPanel = new JPanel(new BorderLayout()); if (getBooleanParameter("progressbar")) { progressBar = new JProgressBar(0, 100); progressBar.setBorderPainted(true); progressBar.setStringPainted(true); progressBar.setString("Loading..."); }//from ww w. j ava 2s .c om boolean includeImage = false; ImageIcon image = null; if (subAppletImageURL != null) { image = new ImageIcon(subAppletImageURL); includeImage = true; } add(loaderPanel, BorderLayout.SOUTH); if (includeImage) { loaderPanel.add(new JLabel(image), BorderLayout.CENTER); if (progressBar != null) { loaderPanel.add(progressBar, BorderLayout.SOUTH); } } else { if (progressBar != null) { loaderPanel.add(progressBar, BorderLayout.CENTER); } } }
From source file:edu.ku.brc.ui.UIHelper.java
public static JProgressBar createProgressBar(final int start, final int end) { JProgressBar pb = new JProgressBar(start, end); setControlSize(pb);/*from w ww . j a v a2 s.c o m*/ return pb; }
From source file:src.gui.ItSIMPLE.java
/** * This method initializes planSimPane//from w ww .j a v a 2 s . c o m * * @return the planSimPane */ private JPanel getPlanSimPane() { if (planSimPane == null) { planSimPane = new JPanel(new BorderLayout()); planSimPane.add(getPlanSimSplitPane(), BorderLayout.CENTER); planSimStatusBar = new JLabel("Status:"); planSimStatusBar.setHorizontalAlignment(SwingConstants.RIGHT); //planSimPane.add(planSimStatusBar, BorderLayout.SOUTH); simProgressBar = new JProgressBar(0, 100); simProgressBar.setValue(0); simProgressBar.setStringPainted(true); simProgressBar.setPreferredSize(new java.awt.Dimension(200, 18)); simProgressBar.setVisible(false); simTimeSpent = new JLabel(""); JPanel timeCtrlPlanSimPane = new JPanel(new BorderLayout()); timeCtrlPlanSimPane.add(simProgressBar, BorderLayout.CENTER); timeCtrlPlanSimPane.add(simTimeSpent, BorderLayout.WEST); JPanel bottomPlanSimPane = new JPanel(new BorderLayout()); bottomPlanSimPane.add(planSimStatusBar, BorderLayout.CENTER); //bottomPlanSimPane.add(simProgressBar, BorderLayout.EAST); bottomPlanSimPane.add(timeCtrlPlanSimPane, BorderLayout.EAST); planSimPane.add(bottomPlanSimPane, BorderLayout.SOUTH); } return planSimPane; }