List of usage examples for com.jgoodies.forms.layout CellConstraints xyw
public CellConstraints xyw(int col, int row, int colSpan)
Examples:
cc.xyw(1, 3, 7); cc.xyw(1, 3, 2);
From source file:edu.ku.brc.specify.plugins.imgproc.ConfigDlg.java
License:Open Source License
@Override public void createUI() { super.createUI(); useNumCheckbox = new ValCheckBox("Use Picture Count", false, false); numPicsSpin = new ValSpinner(1, 10, false, false); barCodeInxSpin = new ValSpinner(1, 10, false, false); dstTxt = new ValTextField(); destination = new ValBrowseBtnPanel(dstTxt, true, true); CellConstraints cc = new CellConstraints(); PanelBuilder bldr = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,4px,p,4px,p,4px,p")); int y = 1;/*from ww w . j a v a2s . c om*/ bldr.add(UIHelper.createLabel(""), cc.xy(1, y)); bldr.add(useNumCheckbox, cc.xy(3, y)); y += 2; bldr.add(UIHelper.createI18NFormLabel("Number of Pictures"), cc.xy(1, y)); bldr.add(numPicsSpin, cc.xy(3, y)); y += 2; bldr.add(UIHelper.createI18NFormLabel("Barcode Picture Number"), cc.xy(1, y)); bldr.add(barCodeInxSpin, cc.xy(3, y)); y += 2; bldr.add(UIHelper.createI18NFormLabel("Destination"), cc.xy(1, y)); bldr.add(destination, cc.xyw(3, y, 2)); y += 2; bldr.setDefaultDialogBorder(); contentPanel = bldr.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); //okBtn.setEnabled(false); AppPreferences locPrefs = AppPreferences.getLocalPrefs(); useNumCheckbox.setSelected(locPrefs.getBoolean("IMGWRKFLW.USE_CNT", true)); numPicsSpin.setValue(locPrefs.getInt("IMGWRKFLW.PIC_CNT", 3)); barCodeInxSpin.setValue(locPrefs.getInt("IMGWRKFLW.PIC_INX", 0) + 1); dstTxt.setValue(locPrefs.get("IMGWRKFLW.PIC_DEST", "/Users/rods/Pictures/Eye-Fi/Pics"), ""); pack(); }
From source file:edu.ku.brc.specify.plugins.imgproc.ImageWorkFlowPanel.java
License:Open Source License
/** * // w w w.j a va 2 s . c om */ public void createUI(final int defWidth, final int defHeight) { CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,8px,f:p:g", "p,4px,f:max(150px;p):g,8px,p"), this); imageTray = new IconTray<Trayable>(IconTray.SINGLE_ROW, defWidth, defHeight); imageTray.setCellRenderer(new ImageTrayListCellRenderer()); //imageTray.setFixedCellHeight(120); imgProcPanel = new ImageProcessorPanel(imageTray, this); imgProcPanel.createUI(); statusBar = new JStatusBar(); list = new JList(new DefaultListModel()); JScrollPane sc = UIHelper.createScrollPane(list); pb.add(imgProcPanel, cc.xy(1, 1)); pb.add(sc, cc.xywh(3, 1, 1, 3)); pb.add(imageTray, cc.xyw(1, 3, 1)); pb.add(statusBar, cc.xyw(1, 5, 3)); pb.setDefaultDialogBorder(); dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(), "Image Processor", false, CustomDialog.OKCANCELAPPLY, this) { @Override public JButton getOkBtn() { imageTray.removeAllItems(); return super.getOkBtn(); } @Override protected void cancelButtonPressed() { ConfigDlg configDlg = new ConfigDlg(dlg); UIHelper.centerAndShow(configDlg); if (!configDlg.isCancelled()) { imgProcPanel.readSetupPrefs(); } } @Override protected void applyButtonPressed() { imgProcPanel.clearFiles(); } }; dlg.setOkLabel("Close"); dlg.setCancelLabel("Config"); dlg.setApplyLabel("Clear"); imgProcPanel.clearFiles(); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.DataSetDlg.java
License:Open Source License
@Override public void createUI() { CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,2px,p,8px")); DBTableInfo ti = DBTableIdMgr.getInstance().getInfoById(Institution.getClassTableId()); DBFieldInfo fi = ti.getFieldByName("name"); JLabel nmLabel = UIHelper.createFormLabel(fi.getTitle()); instNameTF = new ValTextField(); nameLen = fi.getLength();//from www . j a va2s . c o m statusLbl = UIHelper.createLabel(""); contentPanel = pb.getPanel(); int y = 1; pb.add(nmLabel, cc.xy(1, y)); pb.add(instNameTF, cc.xy(3, y)); y += 2; pb.add(statusLbl, cc.xyw(1, y, 3)); y += 2; pb.setDefaultDialogBorder(); KeyAdapter ka = new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { okBtn.setEnabled(isValidInput(instNameTF.getText())); } }; instNameTF.addKeyListener(ka); super.createUI(); String title = cloudInstId == null ? inst.getName() : ""; instNameTF.setText(title); okBtn.setEnabled(isValidInput(instNameTF.getText())); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.InstitutionConfigDlg.java
License:Open Source License
private JPanel createURLPanel() { //setTitle(getResourceString("IMAGE_SRC_TITLE")); useAttachTitle = getResourceString("ATTCH_MGR"); useDirectTitle = getResourceString("DIR_URL"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,4px")); label = createLabel(useAttachTitle + ":"); urlTextField = new ValTextField(40); statusLbl = createLabel(""); useAttchmentMgrRB = createI18NRadioButton("USE_ATT_MGR"); useDirectUrlRB = createI18NRadioButton("USE_DIR_URL"); int y = 1;/*from w w w . ja va2s . c o m*/ pb.add(createI18NLabel("HOW_IMG_ACCESS"), cc.xy(1, y)); y += 2; pb.add(useAttchmentMgrRB, cc.xyw(1, y, 4)); y += 2; pb.add(useDirectUrlRB, cc.xyw(1, y, 4)); y += 2; PanelBuilder pbInner = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p")); pbInner.add(label, cc.xy(1, 1)); pbInner.add(urlTextField, cc.xy(3, 1)); pb.add(pbInner.getPanel(), cc.xyw(1, y, 4)); y += 2; pb.add(statusLbl, cc.xyw(1, y, 4)); y += 2; pb.setDefaultDialogBorder(); KeyAdapter ka = new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { updateOKBtn(); } }; urlTextField.addKeyListener(ka); super.createUI(); ButtonGroup group = new ButtonGroup(); group.add(useAttchmentMgrRB); group.add(useDirectUrlRB); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radBtnSelected(); } }; useAttchmentMgrRB.addActionListener(al); useDirectUrlRB.addActionListener(al); // Set Data into form or initialize it String typeStr = AppPreferences.getRemote().get(getRemoteImageURLTypePrefName(), null); String imgURLPath = AppPreferences.getRemote().get(getRemoteImageURLPrefName(), null); //System.out.println(String.format("%s=%s", getRemoteImageURLTypePrefName(), typeStr)); //System.out.println(String.format("%s=%s", getRemoteImageURLPrefName(), imgURLPath)); if (isNotEmpty(typeStr) && isNotEmpty(imgURLPath)) { urlTextField.setText(imgURLPath); boolean isAttachMgr = isNotEmpty(typeStr) && typeStr.equals(ATTMGR); useAttchmentMgrRB.setSelected(isAttachMgr); useDirectUrlRB.setSelected(!isAttachMgr); } else { fillWithDefaultAttMgr(); } return pb.getPanel(); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.ManageDataSetsDlg.java
License:Open Source License
/** * //from w w w . j a v a2s . c om */ private void addUserToDS() { final Vector<String> wsList = new Vector<String>(); final Vector<String> instItems = new Vector<String>(); String addStr = getResourceString("ADD"); instItems.add(addStr); wsList.add(addStr); for (String fullName : cloudHelper.getInstList()) { String[] toks = StringUtils.split(fullName, '\t'); instItems.add(toks[0]); wsList.add(toks[1]); } final JTextField userNameTF = createTextField(20); final JTextField passwordTF = createTextField(20); final JLabel pwdLbl = createI18NFormLabel("Password"); final JLabel statusLbl = createLabel(""); final JCheckBox isNewUser = UIHelper.createCheckBox("Is New User"); final JLabel instLbl = createI18NFormLabel("Insitution"); final JComboBox instCmbx = UIHelper.createComboBox(instItems.toArray()); if (instItems.size() == 2) { instCmbx.setSelectedIndex(1); } CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,8px,p")); pb.add(createI18NLabel("Add New or Existing User to DataSet"), cc.xyw(1, 1, 3)); pb.add(createI18NFormLabel("Username"), cc.xy(1, 3)); pb.add(userNameTF, cc.xy(3, 3)); pb.add(pwdLbl, cc.xy(1, 5)); pb.add(passwordTF, cc.xy(3, 5)); pb.add(instLbl, cc.xy(1, 7)); pb.add(instCmbx, cc.xy(3, 7)); pb.add(isNewUser, cc.xy(3, 9)); pb.add(statusLbl, cc.xyw(1, 11, 3)); pb.setDefaultDialogBorder(); pwdLbl.setVisible(false); passwordTF.setVisible(false); instLbl.setVisible(false); instCmbx.setVisible(false); final CustomDialog dlg = new CustomDialog(this, "Add User", true, OKCANCEL, pb.getPanel()) { @Override protected void okButtonPressed() { String usrName = userNameTF.getText(); if (cloudHelper.isUserNameOK(usrName)) { String collGuid = datasetGUIDList.get(dataSetList.getSelectedIndex()); if (cloudHelper.addUserAccessToDataSet(usrName, collGuid)) { super.okButtonPressed(); } else { iPadDBExporterPlugin.setErrorMsg(statusLbl, String.format("Unable to add usr: %s to the DataSet guid: %s", usrName, collGuid)); } } else if (isNewUser.isSelected()) { String pwdStr = passwordTF.getText(); String guid = null; if (instCmbx.getSelectedIndex() == 0) { // InstDlg instDlg = new InstDlg(cloudHelper); // if (!instDlg.isInstOK()) // { // instDlg.createUI(); // instDlg.pack(); // centerAndShow(instDlg, 600, null); // if (instDlg.isCancelled()) // { // return; // } // //guid = instDlg.getGuid()(); // } } else { //webSite = wsList.get(instCmbx.getSelectedIndex()); } if (guid != null) { String collGuid = datasetGUIDList.get(dataSetList.getSelectedIndex()); if (cloudHelper.addNewUser(usrName, pwdStr, guid)) { if (cloudHelper.addUserAccessToDataSet(usrName, collGuid)) { ManageDataSetsDlg.this.loadUsersForDataSetsIntoJList(); super.okButtonPressed(); } else { iPadDBExporterPlugin.setErrorMsg(statusLbl, String.format("Unable to add%s to the DataSet %s", usrName, collGuid)); } } else { iPadDBExporterPlugin.setErrorMsg(statusLbl, String.format("Unable to add%s to the DataSet %s", usrName, collGuid)); } } else { // error } } else { iPadDBExporterPlugin.setErrorMsg(statusLbl, String.format("'%s' doesn't exist.", usrName)); } } }; KeyAdapter ka = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { statusLbl.setText(""); String usrNmStr = userNameTF.getText(); boolean hasData = StringUtils.isNotEmpty(usrNmStr) && (!isNewUser.isSelected() || StringUtils.isNotEmpty(passwordTF.getText())) && UIHelper.isValidEmailAddress(usrNmStr); dlg.getOkBtn().setEnabled(hasData); } }; userNameTF.addKeyListener(ka); passwordTF.addKeyListener(ka); final Color textColor = userNameTF.getForeground(); FocusAdapter fa = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { JTextField tf = (JTextField) e.getSource(); if (!tf.getForeground().equals(textColor)) { tf.setText(""); tf.setForeground(textColor); } } @Override public void focusLost(FocusEvent e) { JTextField tf = (JTextField) e.getSource(); if (tf.getText().length() == 0) { tf.setText("Enter email address"); tf.setForeground(Color.LIGHT_GRAY); } } }; userNameTF.addFocusListener(fa); userNameTF.setText("Enter email address"); userNameTF.setForeground(Color.LIGHT_GRAY); isNewUser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSel = isNewUser.isSelected(); pwdLbl.setVisible(isSel); passwordTF.setVisible(isSel); instLbl.setVisible(isSel); instCmbx.setVisible(isSel); Dimension s = dlg.getSize(); int hgt = isNewUser.getSize().height + 4 + instCmbx.getSize().height; s.height += isSel ? hgt : -hgt; dlg.setSize(s); } }); dlg.createUI(); dlg.getOkBtn().setEnabled(false); centerAndShow(dlg); if (!dlg.isCancelled()) { loadUsersForDataSetsIntoJList(); } }
From source file:edu.ku.brc.specify.prefs.GUIDPrefsPanel.java
License:Open Source License
/** * // w ww . j a va 2 s .co m */ protected void createUI() { ArrayList<String> list = new ArrayList<String>(CATEGORY_TYPE.values().length); for (CATEGORY_TYPE cat : CATEGORY_TYPE.values()) { list.add(cat.toString()); } Collections.sort(list); CellConstraints cc = new CellConstraints(); AppPreferences remote = AppPreferences.getRemote(); String rowDef = UIHelper.createDuplicateJGoodiesDef("p", "2px", CATEGORY_TYPE.values().length + 1); PanelBuilder pb = new PanelBuilder(new FormLayout("10px,p,f:p:g", rowDef + ",10px,p,10px,p"), this); pb.addSeparator(getResourceString("LSSEP"), cc.xyw(1, 1, 3)); int y = 3; for (CATEGORY_TYPE cat : CATEGORY_TYPE.values()) { String pName = PREF_NAME_PREFIX + cat.toString(); ValCheckBox vcb = new ValCheckBox(cat.toString(), false, false); checkBoxes.put(cat, vcb); vcb.setSelected(remote.getBoolean(pName, false)); pb.add(vcb, cc.xy(2, y)); DataChangeNotifier dcn = validator.createDataChangeNotifer(pName, vcb, null); vcb.addActionListener(dcn); y += 2; } pb.addSeparator(getResourceString("LSADD"), cc.xyw(1, y, 3)); y += 2; String pName = PREF_NAME_PREFIX + "UseVersioning"; useVersioning = new ValCheckBox("Use Versioning", false, false); // I18N useVersioning.setSelected(remote.getBoolean(pName, false)); DataChangeNotifier dcn = validator.createDataChangeNotifer(pName, useVersioning, null); useVersioning.addActionListener(dcn); JButton updateGUIDsBtn = UIHelper.createI18NButton("CREATE_GUIDS"); updateGUIDsBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { savePrefs(); createGUIDs(); } }); PanelBuilder pbInner = new PanelBuilder(new FormLayout("p,20px,p", "p")); //pbInner.add(useVersioning, cc.xy(1, 1)); pbInner.add(updateGUIDsBtn, cc.xy(1, 1)); pb.add(pbInner.getPanel(), cc.xyw(1, y, 3)); y += 2; pb.setDefaultDialogBorder(); }
From source file:edu.ku.brc.specify.prefs.MySQLPrefs.java
License:Open Source License
/** * Create the UI for the panel/* w w w. j a va 2 s .c o m*/ */ protected void createUI() { AppPreferences prefs = AppPreferences.getLocalPrefs(); CellConstraints cc = new CellConstraints(); backupBtn = createI18NButton("MYS_BACKUP"); restoreBtn = createI18NButton("MYS_RESTORE"); PanelBuilder btnPB = new PanelBuilder(new FormLayout("f:p:g,2px,p,5px,p,f:p:g", "p")); if (!UIRegistry.isMobile() && !UIRegistry.isEmbedded()) { btnPB.add(backupBtn, cc.xy(3, 1)); if (doShowRestore) { btnPB.add(restoreBtn, cc.xy(5, 1)); } } btnPB.setOpaque(false); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,p:g,f:p:g", "p,2dlu,p,2dlu,p,2dlu,p,14px,p"), this); pb.addSeparator(UIRegistry.getResourceString("BCKRSTR_OPTIONS"), cc.xyw(1, 1, 5)); pb.add(createI18NFormLabel("MYS_DUMP_PATH"), cc.xy(1, 3)); pb.add(mysqlDumpLocBP, cc.xyw(3, 3, 3)); pb.add(createI18NFormLabel("MYS_RESTR_PATH"), cc.xy(1, 5)); pb.add(mysqlLocBP, cc.xyw(3, 5, 3)); pb.add(createI18NFormLabel("MYS_BCK_PATH"), cc.xy(1, 7)); pb.add(backupLocBP, cc.xyw(3, 7, 3)); pb.add(btnPB.getPanel(), cc.xyw(1, 9, 5)); pb.setDefaultDialogBorder(); String mysqlLoc = prefs.get(MYSQL_LOC, null); String mysqlDumpLoc = prefs.get(MYSQLDUMP_LOC, null); String backupLoc = prefs.get(MYSQLBCK_LOC, null); if (StringUtils.isEmpty(mysqlLoc)) { mysqlLoc = MySQLBackupService.getDefaultMySQLLoc(); } if (StringUtils.isEmpty(mysqlDumpLoc)) { mysqlDumpLoc = MySQLBackupService.getDefaultMySQLDumpLoc(); } if (StringUtils.isEmpty(backupLoc)) { backupLoc = MySQLBackupService.getDefaultBackupLoc(); } mysqlLocBP.setValue(mysqlLoc, mysqlLoc); mysqlDumpLocBP.setValue(mysqlDumpLoc, mysqlDumpLoc); backupLocBP.setValue(backupLoc, backupLoc); DocumentListener dl = new DocumentAdaptor() { @Override protected void changed(final DocumentEvent e) { validator.setHasChanged(true); validator.validateRoot(); //form.getUIComponent().validate(); updateEnableUI(); } }; mysqlLocBP.getTextField().getDocument().addDocumentListener(dl); mysqlDumpLocBP.getTextField().getDocument().addDocumentListener(dl); backupLocBP.getTextField().getDocument().addDocumentListener(dl); backupBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (mgr == null || mgr.closePrefs()) { if (isOKToSave()) { savePrefs(); BackupServiceFactory.getInstance().doBackUp(); } } } }); restoreBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isOKToSave()) { savePrefs(); doRestore(); } } }); if (!doShowRestore && isSecurityOn()) { PermissionSettings perm = SecurityMgr.getInstance().getPermission(MYSQL_PREF_NAME); restoreBtn.setVisible(perm.canModify()); // this means Enabled backupBtn.setVisible(perm.canView()); // this means Enabled } }
From source file:edu.ku.brc.specify.Specify.java
License:Open Source License
/** * Shows the About dialog.//from w w w . ja v a 2 s . c o m */ public void doAbout() { AppContextMgr acm = AppContextMgr.getInstance(); boolean showDetailedAbout = acm.hasContext() && acm.getClassObject(Division.class) != null && acm.getClassObject(Discipline.class) != null && acm.getClassObject(Collection.class) != null; int baseNumRows = 14; String serverName = AppPreferences.getLocalPrefs().get("login.servers_selected", null); if (serverName != null) { baseNumRows++; } CellConstraints cc = new CellConstraints(); PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:p:g", "p,4px,p,4px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", baseNumRows))); JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$ PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g")); iconPB.add(iconLabel, cc.xy(1, 2)); if (showDetailedAbout) { final ArrayList<String> values = new ArrayList<String>(); DBTableIdMgr tableMgr = DBTableIdMgr.getInstance(); boolean hasReged = !RegisterSpecify.isAnonymous() && RegisterSpecify.hasInstitutionRegistered(); int y = 1; infoPB.addSeparator(getResourceString("Specify.SYS_INFO"), cc.xyw(1, y, 3)); y += 2; JLabel lbl = UIHelper.createLabel(databaseName); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.DB"), cc.xy(1, y)); addLabel(values, infoPB, lbl, cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openLocalPrefs(); } } }); int instId = Institution.getClassTableId(); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(instId)), cc.xy(1, y)); addLabel(values, infoPB, lbl = UIHelper.createLabel(acm.getClassObject(Institution.class).getName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(getGUIDTitle(instId)), cc.xy(1, y)); String noGUID = "<No GUID>"; String guidStr = acm.getClassObject(Institution.class).getGuid(); addLabel(values, infoPB, lbl = UIHelper.createLabel(guidStr != null ? guidStr : noGUID), cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openRemotePrefs(); } } }); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Division.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, lbl = UIHelper.createLabel(acm.getClassObject(Division.class).getName()), cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openGlobalPrefs(); } } }); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Discipline.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(acm.getClassObject(Discipline.class).getName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Collection.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(acm.getClassObject(Collection.class).getCollectionName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(getGUIDTitle(Collection.getClassTableId())), cc.xy(1, y)); guidStr = acm.getClassObject(Collection.class).getGuid(); addLabel(values, infoPB, UIHelper.createLabel(guidStr != null ? guidStr : noGUID), cc.xy(3, y)); y += 2; //addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y)); //addLabel(values, infoPB, UIHelper.createLabel(appBuildVersion),cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y)); UIRegistry.loadAndPushResourceBundle("bld"); addLabel(values, infoPB, UIHelper.createLabel(getResourceString("build")), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD_TM"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(getResourceString("buildtime")), cc.xy(3, y)); y += 2; UIRegistry.popResourceBundle(); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.REG"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createI18NLabel(hasReged ? "Specify.HASREG" : "Specify.NOTREG"), cc.xy(3, y)); y += 2; String isaNumber = RegisterSpecify.getISANumber(); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.ISANUM"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(StringUtils.isNotEmpty(isaNumber) ? isaNumber : ""), cc.xy(3, y)); y += 2; if (serverName != null) { addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.SERVER"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(StringUtils.isNotEmpty(serverName) ? serverName : ""), cc.xy(3, y)); y += 2; } if (StringUtils.contains(DBConnection.getInstance().getConnectionStr(), "mysql")) { Vector<Object[]> list = BasicSQLUtils.query("select version() as ve"); if (list != null && list.size() > 0) { addLabel(values, infoPB, UIHelper.createFormLabel("MySQL Version"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(list.get(0)[0].toString()), cc.xy(3, y)); y += 2; } } addLabel(values, infoPB, UIHelper.createFormLabel("Java Version"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(System.getProperty("java.version")), cc.xy(3, y)); y += 2; JButton copyCBBtn = createIconBtn("ClipboardCopy", IconManager.IconSize.Std24, "Specify.CPY_ABT_TO_TT", null); //copyCBBtn.setBackground(Color.WHITE); //copyCBBtn.setOpaque(true); //copyCBBtn.setBorder(BorderFactory.createEtchedBorder()); copyCBBtn.setEnabled(true); PanelBuilder cbPB = new PanelBuilder(new FormLayout("f:p:g,p", "p")); cbPB.add(copyCBBtn, cc.xy(2, 1)); copyCBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Copy to Clipboard StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.size(); i++) { sb.append(String.format("%s = %s\n", values.get(i), values.get(i + 1))); i++; } UIHelper.setTextToClipboard(sb.toString()); UIRegistry.displayInfoMsgDlgLocalized("Specify.CPY_ABT_TO_MSG"); } }); infoPB.add(cbPB.getPanel(), cc.xy(3, y)); y += 2; } String txt = getAboutText(appName, appVersion); JLabel txtLbl = createLabel(txt); txtLbl.setFont(UIRegistry.getDefaultFont()); final JEditorPane txtPane = new JEditorPane("text/html", txt); txtPane.setEditable(false); txtPane.setBackground(new JPanel().getBackground()); PanelBuilder pb = new PanelBuilder(new FormLayout("p,20px,f:min(400px;p):g,10px,8px,10px,p:g", "f:p:g")); pb.add(iconPB.getPanel(), cc.xy(1, 1)); pb.add(txtPane, cc.xy(3, 1)); Color bg = getBackground(); if (showDetailedAbout) { pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xy(5, 1)); pb.add(infoPB.getPanel(), cc.xy(7, 1)); } pb.setDefaultDialogBorder(); String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$ CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$ pb.getPanel()); String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$ aboutDlg.setOkLabel(okLabel); aboutDlg.createUI(); aboutDlg.pack(); // for some strange reason I can't get the dialog to size itself correctly Dimension size = aboutDlg.getSize(); size.height += 120; aboutDlg.setSize(size); txtPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { AttachmentUtils.openURI(event.getURL().toURI()); } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); } } } }); UIHelper.centerAndShow(aboutDlg); }
From source file:edu.ku.brc.specify.tasks.PageSetupDlg.java
License:Open Source License
@Override public void createUI() { super.createUI(); titleTxt = UIHelper.createTextField(20); pageSizeCBX = UIHelper.createComboBox(new String[] { getResourceString("PS_LTR"), getResourceString("PS_LGL"), getResourceString("PS_A4") }); ButtonGroup grp = new ButtonGroup(); portaitRB = new JRadioButton("Portrait"); landscapeRB = new JRadioButton("Landscape"); grp.add(portaitRB);/* ww w. j a v a2s . c om*/ grp.add(landscapeRB); CellConstraints cc = new CellConstraints(); PanelBuilder rbpb = new PanelBuilder(new FormLayout("p,4px,p", "p")); rbpb.add(portaitRB, cc.xy(1, 1)); rbpb.add(landscapeRB, cc.xy(3, 1)); portaitRB.setSelected(true); PanelBuilder pb = new PanelBuilder(new FormLayout("p,4px,p,f:p:g", "p,6px,p,6px,p,6px,p")); int y = 1; pb.add(UIHelper.createI18NFormLabel("PS_TITLE"), cc.xy(1, y)); pb.add(titleTxt, cc.xyw(3, y, 2)); y += 2; pb.add(UIHelper.createI18NFormLabel("PS_PAGESIZE"), cc.xy(1, y)); pb.add(pageSizeCBX, cc.xy(3, y)); y += 2; pb.add(UIHelper.createI18NFormLabel("PS_ORIENT"), cc.xy(1, y)); pb.add(rbpb.getPanel(), cc.xy(3, y)); y += 2; pb.setDefaultDialogBorder(); contentPanel = pb.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); pack(); pageSizeCBX.setSelectedIndex(0); }
From source file:edu.ku.brc.specify.tasks.StatsTrackerTask.java
License:Open Source License
@Override protected void showClosingFrame() { if (hasChanged) { ImageIcon img = IconManager.getIcon("SpecifySplash"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g,150px", "f:p:g,2px,p")); pb.setDefaultDialogBorder();/*from w w w . j av a 2 s. com*/ JLabel lbl = new JLabel(img); pb.add(lbl, cc.xyw(1, 1, 2)); lbl = UIHelper.createI18NLabel("SPECIFY_SHUTDOWN", SwingConstants.CENTER); lbl.setFont(lbl.getFont().deriveFont(18.0f)); pb.add(lbl, cc.xy(1, 3)); progress = new JProgressBar(0, 100); pb.add(progress, cc.xy(2, 3)); JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setContentPane(pb.getPanel()); frame.pack(); UIHelper.centerAndShow(frame); } }