List of usage examples for javax.swing JTabbedPane addTab
public void addTab(String title, Component component)
component
represented by a title
and no icon. From source file:org.drugis.mtc.gui.GeneratedCodeWindow.java
private void initComponents() { setLayout(new BorderLayout()); add(createToolBar(), BorderLayout.NORTH); JTabbedPane tabbedPane = new JTabbedPane(); for (GeneratedFile file : d_files) { tabbedPane.addTab(file.extension, new JScrollPane(new JTextArea(file.text))); }//from w w w . j av a2 s . com add(tabbedPane, BorderLayout.CENTER); }
From source file:org.freeplane.core.resources.components.OptionPanel.java
/** * This method builds the preferences panel. * A list of IPropertyControl is iterated through and * if the IPropertyControl is an instance of TabProperty, * it creates a new "tab" that can be clicked to reveal the appropriate panel. * If the previous selected tab was saved on close, * the appropriate tab is reopened./*from ww w . j a v a2 s . com*/ * * @param controlsTree This is the data that needs to be built */ public void buildPanel(final DefaultMutableTreeNode controlsTree) { final JPanel centralPanel = new JPanel(); centralPanel.setLayout(new GridLayout(1, 1)); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); FormLayout bottomLayout = null; DefaultFormBuilder bottomBuilder = null; initControls(controlsTree); final Iterator<IPropertyControl> iterator = controls.iterator(); int tabIndex = 0; while (iterator.hasNext()) { final IPropertyControl control = iterator.next(); if (control instanceof TabProperty) { final TabProperty newTab = (TabProperty) control; bottomLayout = new FormLayout(newTab.getName(), ""); bottomBuilder = new DefaultFormBuilder(bottomLayout); bottomBuilder.setDefaultDialogBorder(); final JScrollPane bottomComponent = new JScrollPane(bottomBuilder.getPanel()); UITools.setScrollbarIncrement(bottomComponent); final String tabName = TextUtils.getOptionalText(newTab.getLabel()); tabStringToIndexMap.put(tabName, tabIndex); tabIndexToStringMap.put(tabIndex, tabName); tabbedPane.addTab(tabName, bottomComponent); tabIndex++; } else { control.layout(bottomBuilder); } } tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent event) { final JTabbedPane c = (JTabbedPane) event.getSource(); selectedPanel = tabIndexToStringMap.get(c.getSelectedIndex()); } }); centralPanel.add(tabbedPane); if (selectedPanel != null && tabStringToIndexMap.containsKey(selectedPanel)) { // Without the containsKey call the loading of the tab "behaviour"/"behavior" gives a nullpointer exception tabbedPane.setSelectedIndex(tabStringToIndexMap.get(selectedPanel)); } topDialog.getContentPane().add(centralPanel, BorderLayout.CENTER); final JButton cancelButton = new JButton(); MenuBuilder.setLabelAndMnemonic(cancelButton, TextUtils.getRawText("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { closeWindow(); } }); final JButton okButton = new JButton(); MenuBuilder.setLabelAndMnemonic(okButton, TextUtils.getRawText("ok")); okButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { if (validate()) { closeWindow(); feedback.writeProperties(getOptionProperties()); } } }); topDialog.getRootPane().setDefaultButton(okButton); topDialog.getContentPane().add(ButtonBarFactory.buildOKCancelBar(cancelButton, okButton), BorderLayout.SOUTH); }
From source file:org.gtdfree.GTDFree.java
/** * This method initializes aboutDialog * /*from w w w . ja v a 2 s . com*/ * @return javax.swing.JDialog */ private JDialog getAboutDialog() { if (aboutDialog == null) { aboutDialog = new JDialog(getJFrame(), true); aboutDialog.setTitle(Messages.getString("GTDFree.About.Free")); //$NON-NLS-1$ Image i = ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_logo); //$NON-NLS-1$ ImageIcon ii = new ImageIcon(i); JTabbedPane jtp = new JTabbedPane(); JPanel jp = new JPanel(); jp.setLayout(new GridBagLayout()); JLabel jl = new JLabel("GTD-Free", ii, SwingConstants.CENTER); //$NON-NLS-1$ jl.setIconTextGap(22); jl.setFont(jl.getFont().deriveFont((float) 24)); jp.add(jl, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); String s = "Version " + ApplicationHelper.getVersion(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 11, 4, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBType") //$NON-NLS-1$ + getEngine().getGTDModel().getDataRepository().getDatabaseType(); jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 2, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBloc") + getEngine().getDataFolder(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 11, 4, 11), 0, 0)); jp.add(new JLabel("Copyright 2008,2009 ikesan@users.sourceforge.net", SwingConstants.CENTER), //$NON-NLS-1$ new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("About", jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); TableModel tm = new AbstractTableModel() { private static final long serialVersionUID = -8449423008172417278L; private String[] props; private String[] getProperties() { if (props == null) { props = System.getProperties().keySet().toArray(new String[System.getProperties().size()]); Arrays.sort(props); } return props; } @Override public String getColumnName(int column) { switch (column) { case 0: return Messages.getString("GTDFree.About.Prop"); //$NON-NLS-1$ case 1: return Messages.getString("GTDFree.About.Val"); //$NON-NLS-1$ default: return null; } } public int getColumnCount() { return 2; } public int getRowCount() { return getProperties().length; } public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return getProperties()[rowIndex]; case 1: return System.getProperty(getProperties()[rowIndex]); default: return null; } } }; JTable jt = new JTable(tm); jp.add(new JScrollPane(jt), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab(Messages.getString("GTDFree.About.SysP"), jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); JTextArea ta = new JTextArea(); ta.setEditable(false); ta.setText(ApplicationHelper.loadLicense()); ta.setCaretPosition(0); jp.add(new JScrollPane(ta), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("License", jp); //$NON-NLS-1$ aboutDialog.setContentPane(jtp); aboutDialog.setSize(550, 300); //aboutDialog.pack(); aboutDialog.setLocationRelativeTo(getJFrame()); } return aboutDialog; }
From source file:org.kuali.test.creator.TestCreator.java
private void loadSplitPanes() { if (hsplitPane != null) { desktopPane.remove(hsplitPane);/*from w w w .j ava 2 s. co m*/ } hsplitPane = new JSplitPane(); vsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JPanel p = new JPanel(new BorderLayout()); p.add(new JScrollPane(testRepositoryTree = new RepositoryTree(this)), BorderLayout.CENTER); hsplitPane.setDividerLocation(150); hsplitPane.setOneTouchExpandable(true); vsplitPane.setDividerLocation(250); vsplitPane.setTopComponent(p); vsplitPane.setBottomComponent(platformTestsPanel = new PlatformTestsPanel(this)); testRepositoryTree.addTreeSelectionListener(platformTestsPanel); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(Constants.REPOSITORY, vsplitPane); tabbedPane.addTab(Constants.DATABASES, new JScrollPane(databaseTree = new DatabaseTree(this, getConfiguration()))); tabbedPane.addTab(Constants.WEBSERVICES, new JScrollPane(webServiceTree = new WebServiceTree(this, getConfiguration()))); tabbedPane.addTab(Constants.JMX, new JScrollPane(jmxTree = new JmxTree(this, getConfiguration()))); hsplitPane.setLeftComponent(tabbedPane); hsplitPane.setRightComponent(createTestPanel = new CreateTestPanel(this)); Preferences proot = Preferences.userRoot(); Preferences node = proot.node(Constants.PREFS_ROOT_NODE); hsplitPane.setDividerLocation(node.getInt(Constants.PREFS_HORIZONTAL_DIVIDER_LOCATION, Constants.DEFAULT_HORIZONTAL_DIVIDER_LOCATION)); vsplitPane.setDividerLocation(node.getInt(Constants.PREFS_VERTICAL_DIVIDER_LOCATION, Constants.DEFAULT_VERTICAL_DIVIDER_LOCATION)); desktopPane.add(hsplitPane, BorderLayout.CENTER); }
From source file:org.languagetool.gui.ConfigurationDialog.java
public boolean show(List<Rule> rules) { configChanged = false;//from w w w .j a v a2s . co m if (original != null) { config.restoreState(original); } dialog = new JDialog(owner, true); dialog.setTitle(messages.getString("guiConfigWindowTitle")); // close dialog when user presses Escape key: KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent actionEvent) { dialog.setVisible(false); } }; JRootPane rootPane = dialog.getRootPane(); rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); configurableRules.clear(); Language lang = config.getLanguage(); if (lang == null) { lang = Languages.getLanguageForLocale(Locale.getDefault()); } String specialTabNames[] = config.getSpecialTabNames(); int numConfigTrees = 2 + specialTabNames.length; configTree = new JTree[numConfigTrees]; JPanel checkBoxPanel[] = new JPanel[numConfigTrees]; DefaultMutableTreeNode rootNode; GridBagConstraints cons; for (int i = 0; i < numConfigTrees; i++) { checkBoxPanel[i] = new JPanel(); cons = new GridBagConstraints(); checkBoxPanel[i].setLayout(new GridBagLayout()); cons.anchor = GridBagConstraints.NORTHWEST; cons.gridx = 0; cons.weightx = 1.0; cons.weighty = 1.0; cons.fill = GridBagConstraints.HORIZONTAL; Collections.sort(rules, new CategoryComparator()); if (i == 0) { rootNode = createTree(rules, false, null); // grammar options } else if (i == 1) { rootNode = createTree(rules, true, null); // Style options } else { rootNode = createTree(rules, true, specialTabNames[i - 2]); // Special tab options } configTree[i] = new JTree(getTreeModel(rootNode)); configTree[i].applyComponentOrientation(ComponentOrientation.getOrientation(lang.getLocale())); configTree[i].setRootVisible(false); configTree[i].setEditable(false); configTree[i].setCellRenderer(new CheckBoxTreeCellRenderer()); TreeListener.install(configTree[i]); checkBoxPanel[i].add(configTree[i], cons); configTree[i].addMouseListener(getMouseAdapter()); } JPanel portPanel = new JPanel(); portPanel.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; cons.gridy = 0; cons.anchor = GridBagConstraints.WEST; cons.fill = GridBagConstraints.NONE; cons.weightx = 0.0f; if (!insideOffice) { createNonOfficeElements(cons, portPanel); } else { createOfficeElements(cons, portPanel); } JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); JButton okButton = new JButton(Tools.getLabel(messages.getString("guiOKButton"))); okButton.setMnemonic(Tools.getMnemonic(messages.getString("guiOKButton"))); okButton.setActionCommand(ACTION_COMMAND_OK); okButton.addActionListener(this); JButton cancelButton = new JButton(Tools.getLabel(messages.getString("guiCancelButton"))); cancelButton.setMnemonic(Tools.getMnemonic(messages.getString("guiCancelButton"))); cancelButton.setActionCommand(ACTION_COMMAND_CANCEL); cancelButton.addActionListener(this); cons = new GridBagConstraints(); cons.insets = new Insets(0, 4, 0, 0); buttonPanel.add(okButton, cons); buttonPanel.add(cancelButton, cons); JTabbedPane tabpane = new JTabbedPane(); JPanel jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 0.0f; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.NORTHWEST; cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(getMotherTonguePanel(cons), cons); if (insideOffice) { cons.gridy += 3; } else { cons.gridy++; } cons.anchor = GridBagConstraints.WEST; jPane.add(getNgramPanel(cons), cons); cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(getWord2VecPanel(cons), cons); cons.gridy++; cons.anchor = GridBagConstraints.WEST; jPane.add(portPanel, cons); cons.fill = GridBagConstraints.HORIZONTAL; cons.anchor = GridBagConstraints.WEST; for (JPanel extra : extraPanels) { //in case it wasn't in a containment hierarchy when user changed L&F SwingUtilities.updateComponentTreeUI(extra); cons.gridy++; jPane.add(extra, cons); } cons.gridy++; cons.fill = GridBagConstraints.BOTH; cons.weighty = 1.0f; jPane.add(new JPanel(), cons); tabpane.addTab(messages.getString("guiGeneral"), jPane); jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[0]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(0), cons); tabpane.addTab(messages.getString("guiGrammarRules"), jPane); jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[1]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(1), cons); cons.gridx = 0; cons.gridy++; cons.weightx = 5.0f; cons.weighty = 5.0f; cons.fill = GridBagConstraints.BOTH; cons.anchor = GridBagConstraints.WEST; jPane.add(new JScrollPane(getSpecialRuleValuePanel()), cons); tabpane.addTab(messages.getString("guiStyleRules"), jPane); for (int i = 0; i < specialTabNames.length; i++) { jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(checkBoxPanel[i + 2]), cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridx = 0; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.LINE_END; jPane.add(getTreeButtonPanel(i + 2), cons); tabpane.addTab(specialTabNames[i], jPane); } jPane = new JPanel(); jPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; if (insideOffice) { JLabel versionText = new JLabel(messages.getString("guiUColorHint")); versionText.setForeground(Color.blue); jPane.add(versionText, cons); cons.gridy++; } cons.weightx = 2.0f; cons.weighty = 2.0f; cons.fill = GridBagConstraints.BOTH; jPane.add(new JScrollPane(getUnderlineColorPanel(rules)), cons); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.insets = new Insets(4, 4, 4, 4); cons.gridx = 0; cons.gridy = 0; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.fill = GridBagConstraints.BOTH; cons.anchor = GridBagConstraints.NORTHWEST; contentPane.add(tabpane, cons); cons.weightx = 0.0f; cons.weighty = 0.0f; cons.gridy++; cons.fill = GridBagConstraints.NONE; cons.anchor = GridBagConstraints.EAST; contentPane.add(buttonPanel, cons); dialog.pack(); // center on screen: Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dialog.getSize(); dialog.setLocation(screenSize.width / 2 - frameSize.width / 2, screenSize.height / 2 - frameSize.height / 2); dialog.setLocationByPlatform(true); // add Color tab after dimension was set tabpane.addTab(messages.getString("guiUnderlineColor"), jPane); for (JPanel extra : this.extraPanels) { if (extra instanceof SavablePanel) { ((SavablePanel) extra).componentShowing(); } } dialog.setVisible(true); return configChanged; }
From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java
/** * UI Setup operations.//from w ww . j a va 2s . c o m */ private void setupUI() { setTitle("Nebula Grid - Execution Node"); setSize(WIDTH, HEIGHT); setJMenuBar(setupMenu()); setLayout(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); add(tabs, BorderLayout.CENTER); tabs.addTab("Control Center", setupGeneral()); tabs.addTab("History", setupHistory()); resetActiveJobInfo(); setStatus("Not Connected"); updateGridInfo(); updateExecutionTime(); setupTrayIcon(this); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,/* w w w . ja va 2s.com*/ new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
From source file:org.nuclos.client.main.mainframe.workspace.WorkspaceEditor.java
public WorkspaceEditor(WorkspaceVO wovo) { final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance(); this.wovo = wovo; this.backup = new WorkspaceVO(); this.backup.importHeader(wovo.getWoDesc()); boolean showAlwaysReset = wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN); contentPanel = new JPanel(); initJPanel(contentPanel,//from w w w .j a v a2s.co m new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, 20, 20, 20, showAlwaysReset ? 20 : 0, 10, 20, TableLayout.FILL, TableLayout.PREFERRED }); contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel lbName = new JLabel(localeDelegate.getMessage("WorkspaceEditor.2", "Name"), JLabel.TRAILING); contentPanel.add(lbName, "0, 0"); tfName = new JTextField(15); lbName.setLabelFor(tfName); contentPanel.add(tfName, "1, 0"); chckHideName = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.3", "Name ausblenden")); contentPanel.add(chckHideName, "2, 0, 3, 0"); chckHide = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.8", "Auswahl Button ausblenden")); if (wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN)) { contentPanel.add(chckHide, "4, 0"); } chckAlwaysOpenAtLogin = new JCheckBox( localeDelegate.getMessage("WorkspaceEditor.11", "Immer bei Anmeldung ffnen")); contentPanel.add(chckAlwaysOpenAtLogin, "1, 1"); JLabel lbMainFrame = new JLabel(localeDelegate.getMessage("WorkspaceEditor.9", "Hauptfenster"), JLabel.TRAILING); contentPanel.add(lbMainFrame, "0, 2"); chckHideMenuBar = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.10", "Nur Standard Menuleiste")); contentPanel.add(chckHideMenuBar, "1, 2"); chckUseLastFrameSettings = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.12", "Letzte Fenster Einstellungen bernehmen (Gre und Position)")); contentPanel.add(chckUseLastFrameSettings, "1, 3, 5, 3"); chckAlwaysReset = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.alwaysreset", "Zuletzt geffnete Tabs immer zurcksetzen")); if (showAlwaysReset) { contentPanel.add(chckAlwaysReset, "1, 4, 5, 4"); } JTabbedPane tbbdPane = new JTabbedPane(); nuclosIconChooser = new ResourceIconChooser(WorkspaceChooserController.ICON_SIZE, NuclosResourceCategory.ENTITY_ICON); nuclosIconChooser.removeBorder(); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.4", "Icon"), nuclosIconChooser); JPanel parameterPanel = new JPanel(new BorderLayout()); parameterModel = new ParameterModel(); jtbParameter = new JTable(parameterModel); JScrollPane parameterScroller = new JScrollPane(jtbParameter); jtbParameter.setFillsViewportHeight(true); jtbParameter.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jtbParameter.getColumnModel().getColumn(0).setPreferredWidth(100); jtbParameter.getColumnModel().getColumn(1).setPreferredWidth(400); parameterPanel.add(parameterScroller, BorderLayout.CENTER); JToolBar parameterTools = UIUtils.createNonFloatableToolBar(JToolBar.VERTICAL); parameterTools.add(new ParameterAddButton()); btRemoveParameter = new ParameterRemoveButton(); btRemoveParameter.setEnabled(false); parameterTools.add(btRemoveParameter); parameterPanel.add(parameterTools, BorderLayout.WEST); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.13", "Parameter"), parameterPanel); contentPanel.add(tbbdPane, "1, 6, 5, 7"); JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2)); btSave = new JButton(localeDelegate.getMessage("WorkspaceEditor.5", "Speichern")); btCancel = new JButton(localeDelegate.getMessage("WorkspaceEditor.6", "Abbrechen")); actionsPanel.add(btSave); actionsPanel.add(btCancel); contentPanel.add(actionsPanel, "0, 8, 5, 8"); tfName.setText(wovo.getWoDesc().getName()); chckHide.setSelected(wovo.getWoDesc().isHide()); chckHideName.setSelected(wovo.getWoDesc().isHideName()); chckHideMenuBar.setSelected(wovo.getWoDesc().isHideMenuBar()); chckAlwaysOpenAtLogin.setSelected(wovo.getWoDesc().isAlwaysOpenAtLogin()); chckUseLastFrameSettings.setSelected(wovo.getWoDesc().isUseLastFrameSettings()); chckAlwaysReset.setSelected(wovo.getWoDesc().isAlwaysReset()); nuclosIconChooser.setSelected(wovo.getWoDesc().getNuclosResource()); parameterModel.setParamters(wovo.getWoDesc().getParameters()); dialog = new JDialog(Main.getInstance().getMainFrame(), localeDelegate.getMessage("WorkspaceEditor.1", "Arbeitsumgebung Eigenschaften"), true); dialog.setContentPane(contentPanel); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.getRootPane().setDefaultButton(btSave); Rectangle mfBounds = Main.getInstance().getMainFrame().getBounds(); dialog.setBounds(mfBounds.x + (mfBounds.width / 2) - 300, mfBounds.y + (mfBounds.height / 2) - 200, 600, 400); dialog.setResizable(false); initListener(); dialog.setVisible(true); }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected void addFileToLogsTab(JTabbedPane logsTabbedPane, String logFile) { if (!hideLogTab(logFile) && !controller.getLogsMap().containsKey(logFile)) { logsTabbedPane.addTab(new File(logFile).getName(), buildLogPanel(logFile)); }// w w w .j av a 2 s . c o m }
From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java
protected Component createContentPane() { // Create the connection panel final JPanel queryContentPanel = new JPanel(new BorderLayout()); queryContentPanel.add(BorderLayout.NORTH, createQueryListPanel()); queryContentPanel.add(BorderLayout.CENTER, createQueryDetailsPanel()); // Create the content panel final JPanel dialogContent = new JPanel(new BorderLayout()); dialogContent.add(BorderLayout.WEST, connectionComponent); dialogContent.add(BorderLayout.CENTER, queryContentPanel); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(Messages.getString("JdbcDataSourceDialog.DataSource"), dialogContent); tabbedPane.addTab(Messages.getString("JdbcDataSourceDialog.GlobalScripting"), createGlobalScriptTab()); final JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(BorderLayout.SOUTH, createPreviewButtonsPanel()); contentPane.add(BorderLayout.CENTER, tabbedPane); contentPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); // Return the center panel return contentPane; }