List of usage examples for javax.swing UIManager getColor
public static Color getColor(Object key)
From source file:DateChooserPanel.java
/** * Constructs a new date chooser panel.//from w ww . j a va2 s . co m * * @param calendar the calendar controlling the date. * @param controlPanel a flag that indicates whether or not the 'today' * button should appear on the panel. */ public DateChooserPanel(final Calendar calendar, final boolean controlPanel) { super(new BorderLayout()); this.chosenDateButtonColor = UIManager.getColor("textHighlight"); this.chosenMonthButtonColor = UIManager.getColor("control"); this.chosenOtherButtonColor = UIManager.getColor("controlShadow"); // the default date is today... this.chosenDate = calendar; this.firstDayOfWeek = calendar.getFirstDayOfWeek(); this.WEEK_DAYS = new int[7]; for (int i = 0; i < 7; i++) { this.WEEK_DAYS[i] = ((this.firstDayOfWeek + i - 1) % 7) + 1; } add(constructSelectionPanel(), BorderLayout.NORTH); add(getCalendarPanel(), BorderLayout.CENTER); if (controlPanel) { add(constructControlPanel(), BorderLayout.SOUTH); } setDate(calendar.getTime()); }
From source file:org.griphyn.vdl.karajan.monitor.monitors.swing.GraphPanel.java
private void createChart() { chart = ChartFactory.createTimeSeriesChart(null, "Time", null, null, false, false, false); cp = new ChartPanel(chart); // avoid stretching fonts and such cp.setMaximumDrawWidth(Integer.MAX_VALUE); cp.setMaximumDrawHeight(Integer.MAX_VALUE); XYPlot plot = chart.getXYPlot();/* w ww .j a v a 2 s. c o m*/ plot.setBackgroundPaint(UIManager.getColor("TextField.background")); plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairLockedOnData(false); cp.addChartMouseListener(this); cp.setLayout(new DummyLayoutManager()); cp.add(toolTip = new JToolTip()); toolTip.setVisible(false); cp.addMouseListener(new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { disableToolTip(); } }); chart.addChangeListener(new ChartChangeListener() { @Override public void chartChanged(ChartChangeEvent e) { if (e.getType() == ChartChangeEventType.DATASET_UPDATED) { updateMaxRange(); updateToolTipLocation(); } } }); for (String s : enabled) { addSeries(sampler.getSeries(s)); } JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(cp, BorderLayout.CENTER); legend = new JPanel(); legend.setLayout(new FlowLayout()); rebuildLegend(); this.add(p, BorderLayout.CENTER); this.add(legend, BorderLayout.SOUTH); }
From source file:es.emergya.ui.gis.ControlPanel.java
public ControlPanel(final CustomMapView view) { super(new FlowLayout(FlowLayout.LEADING, 12, 0)); this.view = view; // Posicion: panel con un label de icono y un textfield JPanel posPanel = new JPanel(); posPanel.setOpaque(true);//from w ww.java 2s. c om posPanel.setVisible(true); JLabel mouseLocIcon = new JLabel(LogicConstants.getIcon("map_icon_coordenadas")); posPanel.add(mouseLocIcon); final JTextField posField = new JTextField(15); posField.setEditable(false); posField.setBorder(null); posField.setForeground(UIManager.getColor("Label.foreground")); posField.setFont(UIManager.getFont("Label.font")); posPanel.add(posField); view.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { LatLon ll = ((ICustomMapView) e.getSource()).getLatLon(e.getX(), e.getY()); String position = ""; String format = LogicConstants.get("FORMATO_COORDENADAS_MAPA", "UTM"); if (format.equals(LogicConstants.COORD_UTM)) { UTM u = new UTM(LogicConstants.getInt("ZONA_UTM")); EastNorth en = u.latlon2eastNorth(ll); position = String.format("x: %.1f y: %.1f", en.getX(), en.getY()); } else { position = String.format("Lat: %.4f Lon: %.4f", ll.lat(), ll.lon()); } posField.setText(position); validate(); } @Override public void mouseDragged(MouseEvent e) { } }); posPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(posPanel); // Panel de centrado: label, desplegable y parte cambiante JPanel centerPanel = new JPanel(); centerPanel.add(new JLabel(i18n.getString("map.centerIn"))); centerOptions = new JComboBox(new String[] { i18n.getString("map.street"), i18n.getString("map.resource"), i18n.getString("map.incidence"), i18n.getString("map.location") }); centerPanel.add(centerOptions); centerData = new JPanel(new CardLayout()); centerPanel.add(centerData); JPanel centerStreet = new JPanel(); street = new JTextField(30); street.setName(i18n.getString("map.street")); autocompleteKeyListener = new AutocompleteKeyListener(street); street.addKeyListener(autocompleteKeyListener); street.addActionListener(this); centerStreet.add(street); centerData.add(centerStreet, i18n.getString("map.street")); JPanel centerResource = new JPanel(); resources = new JComboBox(avaliableResources); resources.setName(i18n.getString("map.resource")); resources.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); resources.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { isComboResourcesShowing = true; } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { isComboResourcesShowing = false; } @Override public void popupMenuCanceled(PopupMenuEvent e) { // view.repaint(); } }); centerResource.add(resources); centerData.add(centerResource, i18n.getString("map.resource")); centerResource = new JPanel(); incidences = new JComboBox(avaliableIncidences); incidences.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); incidences.setName(i18n.getString("map.incidence")); incidences.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { isComboIncidencesShowing = true; } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { isComboIncidencesShowing = false; } @Override public void popupMenuCanceled(PopupMenuEvent e) { } }); centerResource.add(incidences); centerData.add(centerResource, i18n.getString("map.incidence")); JPanel centerLocation = new JPanel(); cx = new JTextField(10); cx.setName("x"); cx.addActionListener(this); centerLocation.add(cx); cy = new JTextField(10); cy.setName("y"); cy.addActionListener(this); centerLocation.add(cy); centerData.add(centerLocation, i18n.getString("map.location")); centerOptions.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { ((CardLayout) centerData.getLayout()).show(centerData, (String) e.getItem()); } }); JButton centerButton = new JButton(i18n.getString("map.center")); centerButton.addActionListener(this); centerPanel.add(centerButton); add(centerPanel); }
From source file:net.sf.vfsjfilechooser.accessories.bookmarks.BookmarksManagerPanel.java
public BookmarksManagerPanel(BookmarksDialog parentDialog, VFSJFileChooser chooser) { this.parentDialog = parentDialog; this.chooser = chooser; model = new Bookmarks(); table = new JTable(model); scrollPane = new JScrollPane(table); table.setPreferredScrollableViewportSize(tableSize); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); bCancel = new JButton(VFSResources.getMessage("VFSJFileChooser.closeButtonText")); bOpen = new JButton(VFSResources.getMessage("VFSJFileChooser.openButtonText")); bOpen.setIcon(//from ww w . j a v a 2 s.c om new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/document-open.png"))); bOpen.setHorizontalAlignment(SwingConstants.LEFT); bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText")); bAdd.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-add.png"))); bAdd.setHorizontalAlignment(SwingConstants.LEFT); bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText")); bEdit.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/book_edit.png"))); bEdit.setHorizontalAlignment(SwingConstants.LEFT); bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText")); bDelete.setIcon( new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-remove.png"))); bDelete.setHorizontalAlignment(SwingConstants.LEFT); bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText")); bMoveUp.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-up.png"))); bMoveUp.setHorizontalAlignment(SwingConstants.LEFT); bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText")); bMoveDown.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-down.png"))); bMoveDown.setHorizontalAlignment(SwingConstants.LEFT); final ActionHandler ah = new ActionHandler(); bOpen.addActionListener(ah); bCancel.addActionListener(ah); bEdit.addActionListener(ah); bAdd.addActionListener(ah); bDelete.addActionListener(ah); bMoveUp.addActionListener(ah); bMoveDown.addActionListener(ah); final Box south = Box.createHorizontalBox(); south.add(Box.createHorizontalGlue()); south.add(bCancel); south.add(Box.createHorizontalGlue()); final JPanel buttons = new JPanel(new GridLayout(0, 1, 5, 5)); buttons.add(bAdd); buttons.add(bEdit); buttons.add(bDelete); buttons.add(bOpen); buttons.add(Box.createVerticalStrut(10)); buttons.add(bMoveUp); buttons.add(bMoveDown); JPanel east = new JPanel(); east.add(buttons, BorderLayout.NORTH); east.add(new JPanel(), BorderLayout.CENTER); // don't ask setLayout(new BorderLayout(10, 10)); add(scrollPane, BorderLayout.CENTER); add(south, BorderLayout.SOUTH); add(east, BorderLayout.EAST); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, UIManager.getColor("Panel.background"))); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Constructor/*w ww .j av a 2s .c o m*/ * * @param compactLayout * if false, there will be message type selectors in the panel */ public ChatServicePanel(boolean compactLayout) { super(new BorderLayout()); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area if (compactLayout) { messageText = new JTextField(); ((JTextField) messageText).addActionListener(this); sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } // Add buttons ButtonGroup group = new ButtonGroup(); messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group); warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group); alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); msgTypePanel.add(messageTypeBtn); msgTypePanel.add(warningTypeBtn); msgTypePanel.add(alertTypeBtn); } if (compactLayout) { sendBtn = new JButton("Send"); sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } else { sendBtn = new JButton("Send", ICON_MESSAGE); sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height)); sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } sendBtn.setEnabled(false); messageText.setEditable(false); sendBtn.addActionListener(this); }
From source file:com.googlecode.vfsjfilechooser2.accessories.bookmarks.BookmarksManagerPanel.java
public BookmarksManagerPanel(BookmarksDialog parentDialog, VFSJFileChooser chooser) { this.parentDialog = parentDialog; this.chooser = chooser; model = new Bookmarks(); table = new JTable(model); scrollPane = new JScrollPane(table); table.setPreferredScrollableViewportSize(tableSize); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); bCancel = new JButton(VFSResources.getMessage("VFSJFileChooser.closeButtonText")); bOpen = new JButton(VFSResources.getMessage("VFSJFileChooser.openButtonText")); bOpen.setIcon(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/document-open.png"))); bOpen.setHorizontalAlignment(SwingConstants.LEFT); bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText")); bAdd.setIcon(//from w w w . j ava 2 s .com new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-add.png"))); bAdd.setHorizontalAlignment(SwingConstants.LEFT); bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText")); bEdit.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/book_edit.png"))); bEdit.setHorizontalAlignment(SwingConstants.LEFT); bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText")); bDelete.setIcon(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-remove.png"))); bDelete.setHorizontalAlignment(SwingConstants.LEFT); bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText")); bMoveUp.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/go-up.png"))); bMoveUp.setHorizontalAlignment(SwingConstants.LEFT); bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText")); bMoveDown.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/go-down.png"))); bMoveDown.setHorizontalAlignment(SwingConstants.LEFT); final ActionHandler ah = new ActionHandler(); bOpen.addActionListener(ah); bCancel.addActionListener(ah); bEdit.addActionListener(ah); bAdd.addActionListener(ah); bDelete.addActionListener(ah); bMoveUp.addActionListener(ah); bMoveDown.addActionListener(ah); final Box south = Box.createHorizontalBox(); south.add(Box.createHorizontalGlue()); south.add(bCancel); south.add(Box.createHorizontalGlue()); final JPanel buttons = new JPanel(new GridLayout(0, 1, 5, 5)); buttons.add(bAdd); buttons.add(bEdit); buttons.add(bDelete); buttons.add(bOpen); buttons.add(Box.createVerticalStrut(10)); buttons.add(bMoveUp); buttons.add(bMoveDown); JPanel east = new JPanel(); east.add(buttons, BorderLayout.NORTH); east.add(new JPanel(), BorderLayout.CENTER); // don't ask setLayout(new BorderLayout(10, 10)); add(scrollPane, BorderLayout.CENTER); add(south, BorderLayout.SOUTH); add(east, BorderLayout.EAST); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, UIManager.getColor("Panel.background"))); }
From source file:com.prezerak.windmill.gui.AveragesPanel.java
private void initialize() { setLayout(new BorderLayout(0, 0)); JPanel controlsPanel = new JPanel(); controlsPanel.setBackground(UIManager.getColor("Button.background")); controlsPanel.setBorder(null);/* ww w . java2 s . c o m*/ add(controlsPanel, BorderLayout.SOUTH); controlsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("100px"), FormFactory.UNRELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("101px"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("69px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(46dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(25dlu;default)"), }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px"), FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), })); JButton btnReport = new JButton("Wind Report"); controlsPanel.add(btnReport, "2, 2, fill, fill"); btnReport.addActionListener(this); btnReport.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnReport.setActionCommand("Report"); btnAlarmReport = new JButton("Alarm Report"); btnAlarmReport.setActionCommand("Alarm Report"); btnAlarmReport.addActionListener(this); btnAlarmReport.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(btnAlarmReport, "4, 2"); rdbtnVelocity = new JRadioButton("velocity"); controlsPanel.add(rdbtnVelocity, "10, 2, left, default"); rdbtnVelocity.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnVelocity.setSelected(true); rdbtnVelocity.addItemListener(this); rdbtnDirection = new JRadioButton("direction"); controlsPanel.add(rdbtnDirection, "12, 2, left, default"); rdbtnDirection.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnDirection.setSelected(true); rdbtnDirection.addItemListener(this); JButton btnPrintGraph = new JButton("Print Graph"); controlsPanel.add(btnPrintGraph, "2, 4, fill, top"); btnPrintGraph.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnPrintGraph.setActionCommand("Print Graph"); btnPrintGraph.addActionListener(this); JButton btnBackToReal = new JButton("Back to Real Time "); controlsPanel.add(btnBackToReal, "4, 4, fill, top"); btnBackToReal.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnBackToReal.setActionCommand("Back to Real"); btnBackToReal.addActionListener(this); rdbtnGust = new JRadioButton("Gust"); rdbtnGust.setSelected(true); rdbtnGust.addItemListener(this); rdbtnGust.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(rdbtnGust, "10, 4, left, default"); rdbtnHigh = new JRadioButton("High"); rdbtnHigh.setSelected(true); rdbtnHigh.addItemListener(this); rdbtnHigh.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(rdbtnHigh, "12, 4, left, default"); rdbtnHigher = new JRadioButton("Higher"); rdbtnHigher.setSelected(true); rdbtnHigher.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnHigher.addItemListener(this); controlsPanel.add(rdbtnHigher, "14, 4, left, default"); }
From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java
Color getBackgroundColor(final JList list, final int index, final boolean isSelected) { Color background;/*from w ww .j av a 2s.co m*/ // check if this cell represents the current DnD drop location final JList.DropLocation dropLocation = list.getDropLocation(); if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) { background = Color.RED; } else if (isSelected) { background = UIManager.getColor("Tree.selectionBackground"); } else { background = Color.WHITE; } return background; }
From source file:com.github.alexfalappa.nbspringboot.cfgprops.completion.CfgPropCompletionItem.java
@Override public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) { String leftHtmlText = getText(); if (configurationMeta.isDeprecated()) { leftHtmlText = "<s>" + leftHtmlText + "</s>"; }//from www .ja va 2 s .c om final Color color = Utils.isErrorDeprecated(configurationMeta) ? UIManager.getColor("nb.errorForeground") : UIManager.getColor("List.foreground"); CompletionUtilities.renderHtml(fieldIcon, leftHtmlText, getTextRight(), g, defaultFont, (selected ? UIManager.getColor("List.selectionForeground") : color), width, height, selected); }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI/*from w ww . j av a2s . c o m*/ * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }