List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java
/** * Test for {@link StaticFieldPropertyEditor#getValueSource(Object)}. *//* w w w . j a v a 2 s .c o m*/ public void test_getValueSource() throws Exception { StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); editor.configure(SwingConstants.class, new String[] { "LEFT", "*remove", "RIGHT" }); // assertEquals("javax.swing.SwingConstants.LEFT", editor.getValueSource(SwingConstants.LEFT)); assertNull(editor.getValueSource(null)); assertEquals("javax.swing.SwingConstants.RIGHT", editor.getValueSource(SwingConstants.RIGHT)); assertNull(editor.getValueSource(SwingConstants.NORTH)); }
From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java
/** * Test for {@link StaticFieldPropertyEditor#getText(Property)}. *///from w w w . j av a2s.c o m public void test_getText() throws Exception { StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); editor.configure(SwingConstants.class, new String[] { "LEFT:asLeft", "*remove", "RIGHT" }); // prepare for mocking IMocksControl mocksControl = EasyMock.createStrictControl(); Property property = mocksControl.createMock(Property.class); // LEFT:asLeft { mocksControl.reset(); expect(property.getValue()).andReturn(SwingConstants.LEFT); mocksControl.replay(); // assertEquals("asLeft", editor.getText(property)); mocksControl.verify(); } // RIGHT { mocksControl.reset(); expect(property.getValue()).andReturn(SwingConstants.RIGHT); mocksControl.replay(); // assertEquals("RIGHT", editor.getText(property)); mocksControl.verify(); } // UNKNOWN_VALUE { mocksControl.reset(); expect(property.getValue()).andReturn(Property.UNKNOWN_VALUE); mocksControl.replay(); // assertEquals(null, editor.getText(property)); mocksControl.verify(); } }
From source file:org.eobjects.datacleaner.panels.OpenAnalysisJobPanel.java
public OpenAnalysisJobPanel(final FileObject file, final AnalyzerBeansConfiguration configuration, final OpenAnalysisJobActionListener openAnalysisJobActionListener) { super(WidgetUtils.BG_COLOR_LESS_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT); _file = file;// www . ja v a 2 s .co m _openAnalysisJobActionListener = openAnalysisJobActionListener; setLayout(new BorderLayout()); setBorder(WidgetUtils.BORDER_LIST_ITEM); final AnalysisJobMetadata metadata = getMetadata(configuration); final String jobName = metadata.getJobName(); final String jobDescription = metadata.getJobDescription(); final String datastoreName = metadata.getDatastoreName(); final boolean isDemoJob = isDemoJob(metadata); final DCPanel labelListPanel = new DCPanel(); labelListPanel.setLayout(new VerticalLayout(4)); labelListPanel.setBorder(new EmptyBorder(4, 4, 4, 0)); final String title; final String filename = file.getName().getBaseName(); if (Strings.isNullOrEmpty(jobName)) { final String extension = FileFilters.ANALYSIS_XML.getExtension(); if (filename.toLowerCase().endsWith(extension)) { title = filename.substring(0, filename.length() - extension.length()); } else { title = filename; } } else { title = jobName; } final JButton titleButton = new JButton(title); titleButton.setFont(WidgetUtils.FONT_HEADER1); titleButton.setForeground(WidgetUtils.BG_COLOR_BLUE_MEDIUM); titleButton.setHorizontalAlignment(SwingConstants.LEFT); titleButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, WidgetUtils.BG_COLOR_MEDIUM)); titleButton.setToolTipText("Open job"); titleButton.setOpaque(false); titleButton.setMargin(new Insets(0, 0, 0, 0)); titleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); titleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { _openAnalysisJobActionListener.openFile(_file); } } }); final JButton executeButton = new JButton(executeIcon); executeButton.setOpaque(false); executeButton.setToolTipText("Execute job directly"); executeButton.setMargin(new Insets(0, 0, 0, 0)); executeButton.setBorderPainted(false); executeButton.setHorizontalAlignment(SwingConstants.RIGHT); executeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { final ImageIcon executeIconLarge = ImageManager.get().getImageIcon(IconUtils.ACTION_EXECUTE); final String question = "Are you sure you want to execute the job\n'" + title + "'?"; final int choice = JOptionPane.showConfirmDialog(null, question, "Execute job?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, executeIconLarge); if (choice == JOptionPane.YES_OPTION) { final Injector injector = _openAnalysisJobActionListener.openAnalysisJob(_file); if (injector != null) { final ResultWindow resultWindow = injector.getInstance(ResultWindow.class); resultWindow.open(); resultWindow.startAnalysis(); } } } } }); final DCPanel titlePanel = new DCPanel(); titlePanel.setLayout(new BorderLayout()); titlePanel.add(DCPanel.around(titleButton), BorderLayout.CENTER); titlePanel.add(executeButton, BorderLayout.EAST); labelListPanel.add(titlePanel); if (!Strings.isNullOrEmpty(jobDescription)) { String desc = StringUtils.replaceWhitespaces(jobDescription, " "); desc = StringUtils.replaceAll(desc, " ", " "); final JLabel label = new JLabel(desc); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); } final Icon icon; { if (!StringUtils.isNullOrEmpty(datastoreName)) { final JLabel label = new JLabel(" " + datastoreName); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); final Datastore datastore = configuration.getDatastoreCatalog().getDatastore(datastoreName); if (isDemoJob) { icon = demoBadgeIcon; } else { icon = IconUtils.getDatastoreSpecificAnalysisJobIcon(datastore); } } else { icon = ImageManager.get().getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_LARGE); } } final JLabel iconLabel = new JLabel(icon); iconLabel.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); add(iconLabel, BorderLayout.WEST); add(labelListPanel, BorderLayout.CENTER); }
From source file:org.fhaes.gui.AnalysisResultsPanel.java
/** * Draw the analysis results table depending on the current tree-node forcing the GUI to refresh regardless * //from ww w . ja v a 2s . c o m * @param forceRefresh */ public void setupTable(Boolean forceRefresh) { cl.show(cards, RESULTSPANEL); MainWindow.getInstance().getReportPanel().actionResultsHelp.setEnabled(true); goldFishPanel.setParamsText(); try { log.debug("Setting cursor to wait"); table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); treeResults.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); DefaultMutableTreeNode selectednode = (DefaultMutableTreeNode) treeResults .getLastSelectedPathComponent(); if (selectednode == null) { clearTable(); return; } log.debug("Node selected: " + selectednode.toString()); // If selection hasn't changed don't do anything if (previouslySelectedNode != null && selectednode.equals(previouslySelectedNode) && !forceRefresh) { log.debug("Node selection hasn't changed so not doing anything"); return; } previouslySelectedNode = selectednode; if (!(selectednode instanceof FHAESResultTreeNode)) { clearTable(); return; } FHAESResultTreeNode resultnode = (FHAESResultTreeNode) treeResults.getLastSelectedPathComponent(); FHAESResult result = resultnode.getFHAESResult(); panelResult.setBorder(new TitledBorder(null, result.getFullName(), TitledBorder.LEADING, TitledBorder.TOP, null, null)); if (result.equals(FHAESResult.SEASONALITY_SUMMARY)) { log.debug("Seasonality summary node selected"); if (seasonalitySummaryModel == null) { clearTable(); return; } table.setModel(seasonalitySummaryModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.INTERVAL_SUMMARY)) { log.debug("Interval summary node selected"); if (intervalsSummaryModel == null) { clearTable(); return; } table.setModel(intervalsSummaryModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.INTERVAL_EXCEEDENCE_TABLE)) { log.debug("Interval exceedence node selected"); if (intervalsExceedenceModel == null) { clearTable(); return; } table.setModel(intervalsExceedenceModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_00)) { if (this.bin00Model == null) { clearTable(); return; } table.setModel(bin00Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_01)) { if (this.bin01Model == null) { clearTable(); return; } table.setModel(bin01Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_10)) { if (this.bin10Model == null) { clearTable(); return; } table.setModel(bin10Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_11)) { if (this.bin11Model == null) { clearTable(); return; } table.setModel(bin11Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_SUM)) { if (this.binSumModel == null) { clearTable(); return; } table.setModel(binSumModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX)) { if (this.SJACModel == null) { clearTable(); return; } table.setModel(SJACModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX)) { if (this.SCOHModel == null) { clearTable(); return; } table.setModel(SCOHModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX_D)) { if (this.DSJACModel == null) { clearTable(); return; } table.setModel(DSJACModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX_D)) { if (this.DSCOHModel == null) { clearTable(); return; } table.setModel(DSCOHModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_NTP)) { log.debug("doing NTP"); if (this.NTPModel == null) { log.debug("fileNTP is null so clearing table"); clearTable(); return; } table.setModel(NTPModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_SITE)) { if (this.siteSummaryModel == null) { clearTable(); return; } table.setModel(siteSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_TREE)) { if (this.treeSummaryModel == null) { clearTable(); return; } table.setModel(treeSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.GENERAL_SUMMARY)) { if (this.generalSummaryModel == null) { clearTable(); return; } table.setModel(generalSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.SINGLE_FILE_SUMMARY)) { if (this.singleFileSummaryModel == null) { clearTable(); return; } table.setModel(singleFileSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.SINGLE_EVENT_SUMMARY)) { if (this.singleEventSummaryModel == null) { clearTable(); return; } table.setModel(singleEventSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); setTableColumnAlignment(SwingConstants.LEFT, 2); } else { log.warn("Unhandled FHAESResult type"); clearTable(); } table.packAll(); table.setColumnControlVisible(true); table.setAutoCreateRowSorter(true); } catch (Exception e) { log.debug("Caught exception loading table data"); } finally { log.debug("Clearing cursor"); table.setCursor(Cursor.getDefaultCursor()); treeResults.setCursor(Cursor.getDefaultCursor()); } }
From source file:org.gitools.ui.core.components.editor.EditorTabComponent.java
private void updateLabel() { if (editor.isDirty()) { label.setFont(label.getFont().deriveFont(Font.BOLD)); } else {//from w w w . j a v a 2s . c om label.setFont(label.getFont().deriveFont(Font.PLAIN)); } String name = editor.getName(); if (name == null) { name = "unnamed"; } String extension = ""; String filename = name; String newname; int i = name.lastIndexOf('.'); if (i > 0) { extension = "." + name.substring(i + 1); filename = name.substring(0, name.lastIndexOf('.')); } newname = StringUtils.abbreviate(filename, DEFAULT_EDITOR_TAB_LENGTH) + extension; label.setText(newname); label.setIcon(editor.getIcon()); label.setIconTextGap(3); label.setHorizontalTextPosition(SwingConstants.RIGHT); String toolTip = null; if (editor.getFile() != null) { toolTip = editor.getFile().getAbsolutePath(); } label.setToolTipText(toolTip); }
From source file:org.isatools.gui.datamanager.exportisa.ExportISAGUI.java
public void createGUI() { // header image add(UIHelper.wrapComponentInPanel(new JLabel(panelHeader, SwingConstants.RIGHT)), BorderLayout.NORTH); // add a checkable jtree with investigations & studies... JPanel availableSubmissionsContainer = new JPanel(new BorderLayout()); availableSubmissionsContainer.setOpaque(false); JPanel optionsContainer = new JPanel(); optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.LINE_AXIS)); optionsContainer.setOpaque(false);/*from ww w . j ava 2 s . com*/ JPanel optionsAndInformationPanel = new JPanel(); optionsAndInformationPanel.setLayout(new BoxLayout(optionsAndInformationPanel, BoxLayout.PAGE_AXIS)); optionsAndInformationPanel.setOpaque(false); JLabel fileInformation = UIHelper.createLabel("<html><i>where</i> to save the isatab files?</html>", UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR); fileInformation.setVerticalAlignment(JLabel.TOP); JPanel fileLocationOptionContainer = new JPanel(); fileLocationOptionContainer.setLayout(new BoxLayout(fileLocationOptionContainer, BoxLayout.PAGE_AXIS)); fileLocationOptionContainer.setOpaque(false); // add component for selection of output to repository or output to folder... fileLocationOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true); fileLocationOptionGroup.addOptionItem("BII repository", true); fileLocationOptionGroup.addOptionItem("Local file system"); localDirectoryLocation = new FileSelectionUtil("select output directory", createFileChooser(), UIHelper.VER_11_BOLD, UIHelper.GREY_COLOR); localDirectoryLocation.setVisible(false); localDirectoryLocation.setPreferredSize(new Dimension(150, 20)); fileLocationOptionGroup.addPropertyChangeListener("optionSelectionChange", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { localDirectoryLocation .setVisible(fileLocationOptionGroup.getSelectedItem().equals("Local file system")); revalidate(); } }); fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileInformation)); fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileLocationOptionGroup)); fileLocationOptionContainer.add(Box.createVerticalStrut(5)); fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(localDirectoryLocation)); optionsContainer.add(fileLocationOptionContainer); JPanel dataFileExportOptionContainer = new JPanel(); dataFileExportOptionContainer.setLayout(new BoxLayout(dataFileExportOptionContainer, BoxLayout.PAGE_AXIS)); dataFileExportOptionContainer.setOpaque(false); JLabel dataFileExportInformation = UIHelper.createLabel("<html>export data files?</html>", UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR); dataFileExportInformation.setVerticalAlignment(JLabel.TOP); dataFileExportOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true); dataFileExportOptionGroup.addOptionItem("yes", true); dataFileExportOptionGroup.addOptionItem("no"); dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportInformation)); dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportOptionGroup)); dataFileExportOptionContainer.add(Box.createVerticalStrut(25)); optionsContainer.add(dataFileExportOptionContainer); optionsAndInformationPanel.add(Box.createVerticalStrut(5)); optionsAndInformationPanel.add(optionsContainer); optionsAndInformationPanel.add(Box.createVerticalStrut(10)); JLabel information = UIHelper.createLabel( "<html>please <i>select</i> the submissions to be exported...</html>", UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR); information.setVerticalAlignment(JLabel.TOP); optionsAndInformationPanel.add(UIHelper.wrapComponentInPanel(information)); optionsAndInformationPanel.add(Box.createVerticalStrut(5)); availableSubmissionsContainer.add(optionsAndInformationPanel, BorderLayout.NORTH); retrieveAndProcessStudyInformation(); JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); treeScroller.getViewport().setOpaque(false); treeScroller.setOpaque(false); treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1)); treeScroller.setPreferredSize(new Dimension(380, 250)); availableSubmissionsContainer.add(treeScroller, BorderLayout.CENTER); add(availableSubmissionsContainer, BorderLayout.CENTER); add(createSouthPanel(), BorderLayout.SOUTH); }
From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java
private JPanel createStudySelectionPanel() { JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setOpaque(false);/*from w w w. j av a 2 s . co m*/ JPanel studyAccessionSelector = new JPanel(); studyAccessionSelector.setLayout(new BorderLayout()); studyAccessionSelector.setOpaque(false); JLabel information = new JLabel(unloadStudyHeader); information.setHorizontalAlignment(SwingConstants.RIGHT); information.setVerticalAlignment(SwingConstants.TOP); studyAccessionSelector.add(information, BorderLayout.NORTH); retrieveAndProcessStudyInformation(); JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); treeScroller.getViewport().setOpaque(false); treeScroller.setOpaque(false); treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1)); treeScroller.setPreferredSize(new Dimension(380, 210)); studyAccessionSelector.add(treeScroller); container.add(studyAccessionSelector); // and need a convert button! JPanel buttonCont = new JPanel(new BorderLayout()); buttonCont.setOpaque(false); final JLabel unload = new JLabel(this.unloadButton, JLabel.RIGHT); unload.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { unload.setIcon(unloadButtonOver); } public void mouseExited(MouseEvent mouseEvent) { unload.setIcon(StudyAccessionGUI.this.unloadButton); } public void mousePressed(MouseEvent mouseEvent) { Set<String> studiesToUnload = studyAvailabilityTree .getCheckedStudies(studyAvailabilityTree.getRoot()); log.info("going to unload: "); for (String acc : studiesToUnload) { log.info("study with acc " + acc); } doUnloading(studiesToUnload); } }); buttonCont.add(unload, BorderLayout.EAST); buttonCont.add(createBackToMainMenuButton(), BorderLayout.WEST); container.add(buttonCont); return container; }
From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java
private void createMainSector() { JPanel topContainer = new JPanel(); topContainer.setLayout(new BoxLayout(topContainer, BoxLayout.PAGE_AXIS)); topContainer.setBackground(UIHelper.BG_COLOR); // add logo to the top topContainer.add(createMenu());//from w w w . ja va 2 s. c o m JPanel headerImagePanel = new JPanel(new GridLayout(1, 2)); headerImagePanel.setOpaque(false); JLabel logo = new JLabel(""); logo.setOpaque(false); headerImagePanel.add(logo); tableInformationDisplay = UIHelper.createLabel("", UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, SwingConstants.RIGHT); tableInformationDisplay.setVerticalAlignment(SwingConstants.TOP); tableInformationDisplay.setHorizontalAlignment(SwingConstants.RIGHT); headerImagePanel.add(UIHelper.wrapComponentInPanel(tableInformationDisplay)); topContainer.add(headerImagePanel); topContainer.add(Box.createVerticalStrut(10)); add(topContainer, BorderLayout.NORTH); // create central console with majority of content! createNavigationPanel(); JPanel bottomContainer = new JPanel(); bottomContainer.setLayout(new BoxLayout(bottomContainer, BoxLayout.PAGE_AXIS)); bottomContainer.setBackground(UIHelper.BG_COLOR); add(bottomContainer, BorderLayout.SOUTH); }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);/*from w w w. j a v a 2 s . c o m*/ container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }
From source file:org.jajuk.ui.widgets.JajukJMenuBar.java
/** * Instantiates a new jajuk j menu bar./*w w w . j a va 2s. com*/ */ private JajukJMenuBar() { setAlignmentX(0.0f); // File menu file = new JMenu(Messages.getString("JajukJMenuBar.0")); jmiFileExit = new JMenuItem(ActionManager.getAction(JajukActions.EXIT)); file.add(jmiFileExit); // Properties menu properties = new JMenu(Messages.getString("JajukJMenuBar.5")); jmiNewProperty = new JMenuItem(ActionManager.getAction(CUSTOM_PROPERTIES_ADD)); jmiRemoveProperty = new JMenuItem(ActionManager.getAction(CUSTOM_PROPERTIES_REMOVE)); jmiActivateTags = new JMenuItem(ActionManager.getAction(EXTRA_TAGS_WIZARD)); properties.add(jmiNewProperty); properties.add(jmiRemoveProperty); properties.add(jmiActivateTags); // View menu views = new JMenu(Messages.getString("JajukJMenuBar.8")); jmiRestoreDefaultViews = new JMenuItem(ActionManager.getAction(VIEW_RESTORE_DEFAULTS)); jmiRestoreDefaultViewsAllPerpsectives = new JMenuItem( ActionManager.getAction(JajukActions.ALL_VIEW_RESTORE_DEFAULTS)); views.add(jmiRestoreDefaultViews); views.add(jmiRestoreDefaultViewsAllPerpsectives); views.addSeparator(); // Add the list of available views parsed in XML files at startup JMenu jmViews = new JMenu(Messages.getString("JajukJMenuBar.25")); for (final Class<? extends IView> view : ViewFactory.getKnownViews()) { JMenuItem jmi = null; try { jmi = new JMenuItem(view.newInstance().getDesc(), IconLoader.getIcon(JajukIcons.LOGO_FRAME)); } catch (Exception e1) { Log.error(e1); continue; } jmi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Simply add the new view in the current perspective PerspectiveAdapter current = (PerspectiveAdapter) PerspectiveManager.getCurrentPerspective(); IView newView = ViewFactory.createView(view, current, Math.abs(UtilSystem.getRandom().nextInt())); newView.initUI(); newView.setPopulated(); current.addDockable(newView); } }); jmViews.add(jmi); } views.add(jmViews); // Mode menu String modeText = Messages.getString("JajukJMenuBar.9"); mode = new JMenu(ActionUtil.strip(modeText)); jcbmiRepeat = new JCheckBoxMenuItem(ActionManager.getAction(REPEAT_MODE)); jcbmiRepeat.setSelected(Conf.getBoolean(Const.CONF_STATE_REPEAT)); jcbmiRepeatAll = new JCheckBoxMenuItem(ActionManager.getAction(REPEAT_ALL_MODE)); jcbmiRepeatAll.setSelected(Conf.getBoolean(Const.CONF_STATE_REPEAT_ALL)); jcbmiShuffle = new JCheckBoxMenuItem(ActionManager.getAction(SHUFFLE_MODE)); jcbmiShuffle.setSelected(Conf.getBoolean(Const.CONF_STATE_SHUFFLE)); jcbmiContinue = new JCheckBoxMenuItem(ActionManager.getAction(CONTINUE_MODE)); jcbmiContinue.setSelected(Conf.getBoolean(Const.CONF_STATE_CONTINUE)); jcbmiIntro = new JCheckBoxMenuItem(ActionManager.getAction(INTRO_MODE)); jcbmiIntro.setSelected(Conf.getBoolean(Const.CONF_STATE_INTRO)); jcbmiKaraoke = new JCheckBoxMenuItem(ActionManager.getAction(JajukActions.KARAOKE_MODE)); if (Conf.getBoolean(Const.CONF_BIT_PERFECT)) { jcbmiKaraoke.setEnabled(false); jcbmiKaraoke.setSelected(false); Conf.setProperty(Const.CONF_STATE_KARAOKE, Const.FALSE); } else { jcbmiKaraoke.setSelected(Conf.getBoolean(Const.CONF_STATE_KARAOKE)); } mode.add(jcbmiRepeat); mode.add(jcbmiRepeatAll); mode.add(jcbmiShuffle); mode.add(jcbmiContinue); mode.add(jcbmiIntro); mode.add(jcbmiKaraoke); // Smart Menu smart = new JMenu(Messages.getString("JajukJMenuBar.29")); jmiShuffle = new SizedJMenuItem(ActionManager.getAction(JajukActions.SHUFFLE_GLOBAL)); jmiBestof = new SizedJMenuItem(ActionManager.getAction(JajukActions.BEST_OF)); jmiNovelties = new SizedJMenuItem(ActionManager.getAction(JajukActions.NOVELTIES)); jmiFinishAlbum = new SizedJMenuItem(ActionManager.getAction(JajukActions.FINISH_ALBUM)); smart.add(jmiShuffle); smart.add(jmiBestof); smart.add(jmiNovelties); smart.add(jmiFinishAlbum); // Tools Menu tools = new JMenu(Messages.getString("JajukJMenuBar.28")); jmiduplicateFinder = new JMenuItem(ActionManager.getAction(JajukActions.FIND_DUPLICATE_FILES)); jmialarmClock = new JMenuItem(ActionManager.getAction(JajukActions.ALARM_CLOCK)); jmiprepareParty = new JMenuItem(ActionManager.getAction(JajukActions.PREPARE_PARTY)); tools.add(jmiduplicateFinder); tools.add(jmialarmClock); tools.add(jmiprepareParty); // tools.addSeparator(); // Configuration menu configuration = new JMenu(Messages.getString("JajukJMenuBar.21")); jmiDJ = new JMenuItem(ActionManager.getAction(CONFIGURE_DJS)); // Overwrite default icon jmiDJ.setIcon(IconLoader.getIcon(JajukIcons.DIGITAL_DJ_16X16)); jmiAmbience = new JMenuItem(ActionManager.getAction(CONFIGURE_AMBIENCES)); jmiWizard = new JMenuItem(ActionManager.getAction(SIMPLE_DEVICE_WIZARD)); jmiOptions = new JMenuItem(ActionManager.getAction(OPTIONS)); jmiUnmounted = new JCheckBoxMenuItem(ActionManager.getAction(JajukActions.UNMOUNTED)); jmiUnmounted.setSelected(Conf.getBoolean(Const.CONF_OPTIONS_HIDE_UNMOUNTED)); jmiUnmounted.putClientProperty(Const.DETAIL_ORIGIN, jmiUnmounted); jcbShowPopups = new JCheckBoxMenuItem(Messages.getString("ParameterView.228")); jcbShowPopups.setSelected(Conf.getBoolean(Const.CONF_SHOW_POPUPS)); jcbShowPopups.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Conf.setProperty(Const.CONF_SHOW_POPUPS, Boolean.toString(jcbShowPopups.isSelected())); // force parameter view to take this into account ObservationManager.notify(new JajukEvent(JajukEvents.PARAMETERS_CHANGE)); } }); jcbNoneInternetAccess = new JCheckBoxMenuItem(Messages.getString("ParameterView.264")); jcbNoneInternetAccess.setToolTipText(Messages.getString("ParameterView.265")); jcbNoneInternetAccess.setSelected(Conf.getBoolean(Const.CONF_NETWORK_NONE_INTERNET_ACCESS)); jcbNoneInternetAccess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Conf.setProperty(Const.CONF_NETWORK_NONE_INTERNET_ACCESS, Boolean.toString(jcbNoneInternetAccess.isSelected())); // force parameter view to take this into account ObservationManager.notify(new JajukEvent(JajukEvents.PARAMETERS_CHANGE)); } }); configuration.add(jmiUnmounted); configuration.add(jcbShowPopups); configuration.add(jcbNoneInternetAccess); configuration.addSeparator(); configuration.add(jmiDJ); configuration.add(jmiAmbience); configuration.add(jmiWizard); configuration.add(jmiOptions); // Help menu String helpText = Messages.getString("JajukJMenuBar.14"); help = new JMenu(ActionUtil.strip(helpText)); jmiHelp = new JMenuItem(ActionManager.getAction(HELP_REQUIRED)); jmiDonate = new JMenuItem(ActionManager.getAction(SHOW_DONATE)); jmiAbout = new JMenuItem(ActionManager.getAction(SHOW_ABOUT)); jmiTraces = new JMenuItem(ActionManager.getAction(SHOW_TRACES)); jmiTraces = new JMenuItem(ActionManager.getAction(SHOW_TRACES)); jmiCheckforUpdates = new JMenuItem(ActionManager.getAction(JajukActions.CHECK_FOR_UPDATES)); jmiTipOfTheDay = new JMenuItem(ActionManager.getAction(TIP_OF_THE_DAY)); help.add(jmiHelp); help.add(jmiTipOfTheDay); // Install this action only if Desktop class is supported, it is used to // open default mail client if (UtilSystem.isBrowserSupported()) { jmiQualityAgent = new JMenuItem(ActionManager.getAction(QUALITY)); help.add(jmiQualityAgent); } help.add(jmiTraces); help.add(jmiCheckforUpdates); help.add(jmiDonate); help.add(jmiAbout); mainmenu = new JMenuBar(); mainmenu.add(file); mainmenu.add(views); mainmenu.add(properties); mainmenu.add(mode); mainmenu.add(smart); mainmenu.add(tools); mainmenu.add(configuration); mainmenu.add(help); // Apply mnemonics (Alt + first char of the menu keystroke) applyMnemonics(); if (SessionService.isTestMode()) { jbGC = new JajukButton(ActionManager.getAction(JajukActions.GC)); } jbSlim = new JajukButton(ActionManager.getAction(JajukActions.SLIM_JAJUK)); jbFull = new JajukButton(ActionManager.getAction(JajukActions.FULLSCREEN_JAJUK)); JMenuBar eastmenu = new JMenuBar(); // only show GC-button in test-mode if (SessionService.isTestMode()) { eastmenu.add(jbGC); } eastmenu.add(jbSlim); eastmenu.add(jbFull); setLayout(new BorderLayout()); add(mainmenu, BorderLayout.WEST); add(eastmenu, BorderLayout.EAST); // Check for new release and display the icon if a new release is available SwingWorker<Void, Void> sw = new SwingWorker<Void, Void>() { @Override public Void doInBackground() { UpgradeManager.checkForUpdate(); return null; } @Override public void done() { // add the new release label if required if (UpgradeManager.getNewVersionName() != null) { jlUpdate = new JLabel(" ", IconLoader.getIcon(JajukIcons.UPDATE_MANAGER), SwingConstants.RIGHT); String newRelease = UpgradeManager.getNewVersionName(); if (newRelease != null) { jlUpdate.setToolTipText(Messages.getString("UpdateManager.0") + newRelease + Messages.getString("UpdateManager.1")); } add(Box.createHorizontalGlue()); add(jlUpdate); } } }; // Search online for upgrade if the option is set and if the none Internet // access option is not set if (Conf.getBoolean(Const.CONF_CHECK_FOR_UPDATE) && !Conf.getBoolean(Const.CONF_NETWORK_NONE_INTERNET_ACCESS)) { sw.execute(); } ObservationManager.register(this); }