List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java
/** * This method initializes jPanel//from w ww . j a v a2 s. c o m * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jPanel.add(getSelectionChartPanel()); jPanel.add(Box.createVerticalStrut(10)); jPanel.add(getCardPanel()); jPanel.add(new JSeparator(JSeparator.HORIZONTAL)); } return jPanel; }
From source file:burp.BurpExtender.java
private JPanel createMainPanel() { JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); // Create Settings Panel JPanel settings = new JPanel(new GridBagLayout()); createTitle("Settings", settings); KeyListener projectEnter = new KeyAdapter() { @Override/*from w w w. ja v a 2s . c o m*/ public void keyPressed(KeyEvent k) { if (k.getKeyCode() == KeyEvent.VK_ENTER) updateProjects(); } }; serverUrl = labelTextField("Server URL: ", settings, callbacks.loadExtensionSetting(BurpExtender.SERVER_KEY)); serverUrl.addKeyListener(projectEnter); serverUrl.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.SERVER_KEY, callbacks)); apiKey = labelTextField("API Key: ", settings, callbacks.loadExtensionSetting(BurpExtender.API_KEY)); apiKey.addKeyListener(projectEnter); apiKey.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.API_KEY, callbacks)); JButton targetRefresh = new JButton(); targetRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateTargets(); } }); targetUrl = createComboBox("Target URL: ", settings, 3, targetRefresh); projectRefresh = new JButton(); projectRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Thread updateThread = new Thread() { public void run() { NameValuePair selected = getProject(); if (selected != null) callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, selected.getValue()); updateProjects(); } }; updateThread.start(); } }); projectBox = createComboBox("Projects: ", settings, 4, projectRefresh); GridBagConstraints setGBC = new GridBagConstraints(); setGBC.gridy = 3; setGBC.anchor = GridBagConstraints.NORTHWEST; main.add(settings, setGBC); // Separator Insets ins = new Insets(10, 10, 2, 10); JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); callbacks.customizeUiComponent(sep); GridBagConstraints sepGBC = new GridBagConstraints(); sepGBC.gridwidth = 3; sepGBC.gridx = 0; sepGBC.fill = GridBagConstraints.HORIZONTAL; sepGBC.insets = ins; main.add(sep, sepGBC); // Create Export Button JButton exportBtn = new JButton(); exportBtn.setText("Send to Code Dx"); exportBtn.addActionListener(new ExportActionListener(this, callbacks)); callbacks.customizeUiComponent(exportBtn); GridBagConstraints btnGBC = new GridBagConstraints(); btnGBC.gridx = 0; btnGBC.weightx = 1.0; btnGBC.weighty = 1.0; btnGBC.insets = ins; btnGBC.anchor = GridBagConstraints.NORTHWEST; main.add(exportBtn, btnGBC); updateTargets(); return main; }
From source file:com.diversityarrays.kdxplore.heatmap.HeatMapPanel.java
public HeatMapPanel(VisualisationTool vtool, int unique, SelectedValueStore svs, PlotInfoProvider pip, String title,/*from www. j a v a 2s .co m*/ HeatMapModelData<T> heatMapModelData, SuppressionHandler suppressionHandler) { super(title, svs, vtool.getVisualisationToolId(), unique, Arrays.asList(heatMapModelData.zTraitInstance), suppressionHandler); context = heatMapModelData.context; xValueRetriever = heatMapModelData.xValueRetriever; yValueRetriever = heatMapModelData.yValueRetriever; askAboutValueForUnscored = !ValueRetriever.isEitherOneXorY(xValueRetriever, yValueRetriever); traitInstanceValueRetriever = heatMapModelData.traitInstanceValueRetriever; this.zTraitInstance = heatMapModelData.zTraitInstance; // this.plotSpecimensByPoint = heatMapModelData.model.getCellLegend(); this.plotInfoProvider = pip; this.title = title; if (heatMapModelData.plotPointsByMark.isEmpty()) { markInfo = null; } else { markInfo = new MarkInfo(Msg.LABEL_MARK_INFO_PLOT_TYPE(), heatMapModelData.plotPointsByMark); } this.heatMap = createHeatMap(heatMapModelData); this.heatMap.addPropertyChangeListener(HeatMapPane.PROPERTY_SELECTION_CHANGE, heatMapPaneSelectionChangeListener); messagesTextArea.setEditable(false); tabbedPane.addTab(TAB_MESSAGES, new JScrollPane(messagesTextArea)); tabbedPane.addTab(TAB_CURATION, createCurationControls()); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tabbedPane, heatMap); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.0); add(splitPane, BorderLayout.CENTER); int cellValueCount = heatMap.getValueModel().getUniqueCellValueCount(); Gradient[] gradients = Gradient.createBuiltins(cellValueCount); Gradient initial = null; for (Gradient g : gradients) { if (Gradient.RAINBOW_NAME.equals(g.getName())) { initial = g; break; } } gradientComboBox = new JComboBox<Gradient>(gradients); gradientComboBox.setRenderer(new GradientComboBoxRenderer()); gradientComboBox.addItemListener(gradientItemListener); // gradientItemListener will to model.setGradient() gradientComboBox.setSelectedItem(initial); Box box = Box.createHorizontalBox(); box.add(syncedOption); box.add(gradientComboBox); box.add(Box.createHorizontalGlue()); // if (RunMode.getRunMode().isDeveloper()) { // box.add(useBlankTilesOption); // } box.add(new JSeparator(JSeparator.VERTICAL)); box.add(opacityLabel); box.add(unselectedOpacitySpinner); add(box, BorderLayout.SOUTH); opacityLabel.setToolTipText("Sets the opacity of unselected cells"); unselectedOpacitySpinner.setToolTipText("Sets the opacity of unselected cells"); // useBlankTilesOption.setSelected(heatMap.getUseBlankTiles()); unselectedOpacityModel.setValue(heatMap.getUnselectedOpacity()); // useBlankTilesOption.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // handleUseBlankTilesChanged(); // } // }); unselectedOpacityModel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { handleOpacityChange(); } }); updateMessagesWithMissingOrBad(null, heatMapModelData); applyDecoratorsToHeatMap(heatMapModelData); }
From source file:com.diversityarrays.kdxplore.field.OriginDirectionTraversalChoicePanel.java
public OriginDirectionTraversalChoicePanel(Closure<Void> onChange) { this.onChange = onChange; Border lineBorder = new LineBorder(Color.BLACK); JComponent topsep, leftsep, rightsep, botsep; topsep = new JSeparator(JSeparator.VERTICAL); botsep = new JSeparator(JSeparator.VERTICAL); topsep.setBorder(lineBorder);/*www . j av a 2 s. c om*/ botsep.setBorder(lineBorder); leftsep = new JSeparator(JSeparator.HORIZONTAL); rightsep = new JSeparator(JSeparator.HORIZONTAL); GBH gbh = new GBH(this); int y = 0; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ul); gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, crb_ul_right); // gbh.add(2,y, 1,2, GBH.VERT, 1,1, GBH.CENTER, topsep); gbh.add(3, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, crb_ur_left); gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ur); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ul_down, new Insets(10, 0, 0, 0))); // gbh.add(1,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx); // gbh.add(2,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx); gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ur_down, new Insets(10, 0, 0, 0))); ++y; gbh.add(0, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, leftsep); JLabel label = gbh.add(1, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, "Origin & Direction"); gbh.add(4, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, rightsep); ++y; label.setHorizontalAlignment(JLabel.CENTER); label.setBorder(lineBorder); gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ll_up, new Insets(0, 0, 10, 0))); // gbh.add(1,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx); // gbh.add(2,y, 1,2, GBH.VERT, 1,1, GBH.CENTER, botsep); // gbh.add(2,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx); gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_lr_up, new Insets(0, 0, 10, 0))); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ll); gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, crb_ll_right); gbh.add(3, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, crb_lr_left); gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_lr); ++y; gbh.add(0, y, 5, 1, GBH.HORZ, 1, 1, GBH.CENTER, new JSeparator(JSeparator.HORIZONTAL)); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Traversal:"); gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, rbPanel); ++y; }
From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java
/** * This method initializes jPanel1//from ww w .ja v a 2 s .c om * * @return javax.swing.JPanel */ private JPanel getJPanel1() { if (jPanel1 == null) { jPanel1 = new JPanel(); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.X_AXIS)); jPanel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel intermediaryPanel = new JPanel(); intermediaryPanel.setLayout(new BoxLayout(intermediaryPanel, BoxLayout.Y_AXIS)); nodesTable = new JTable(); nodesModel = new ClusterNodesSummaryModel(); nodesTable.setModel(nodesModel); JLabel nodesTableTitle = new JLabel("Nodes status"); nodesTableTitle.setAlignmentX(JLabel.CENTER_ALIGNMENT); nodesTableTitle.setFont(new Font("Dialog", Font.BOLD, 14)); intermediaryPanel.add(Box.createVerticalStrut(5)); intermediaryPanel.add(nodesTableTitle); intermediaryPanel.add(Box.createVerticalStrut(10)); intermediaryPanel.add(nodesTable.getTableHeader()); intermediaryPanel.add(nodesTable); intermediaryPanel.add(Box.createVerticalStrut(10)); intermediaryPanel.add(new JSeparator(JSeparator.HORIZONTAL)); jPanel1.add(Box.createHorizontalGlue()); jPanel1.add(intermediaryPanel); jPanel1.add(Box.createHorizontalGlue()); LoggingManager.log(Level.FINER, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getJPanel1", "Cluster nodes summary table added"); } return jPanel1; }
From source file:coreferenceresolver.gui.MarkupGUI.java
private JScrollPane newReviewPanel(Review review, int reviewId) throws BadLocationException { //Model/*from w w w . jav a2 s .co m*/ ReviewElement reviewElement = new ReviewElement(); ScrollablePanel reviewPanel = new ScrollablePanel(); reviewPanel.setLayout(new BoxLayout(reviewPanel, BoxLayout.PAGE_AXIS)); JTextField title = new JTextField("NEW REVIEW " + reviewId); title.setBackground(Color.pink); reviewPanel.add(title); JTextArea reviewContentTxtArea = new JTextArea(); reviewContentTxtArea.setLineWrap(true); reviewContentTxtArea.setWrapStyleWord(true); reviewContentTxtArea.setEditable(false); reviewContentTxtArea.setText(review.getRawContent()); int chainId = 0; for (CorefChain cc : review.getCorefChains()) { for (int npId : cc.getChain()) { NounPhrase np = review.getNounPhrases().get(npId); Object highlighTag = reviewContentTxtArea.getHighlighter().addHighlight(np.getOffsetBegin(), np.getOffsetEnd() + 1, highlightPainters.get(chainId)); this.markupReviews.get(reviewId).getNounPhrases().get(npId).highlighterTag = highlighTag; } ++chainId; } reviewPanel.add(reviewContentTxtArea); ScrollablePanel markupsPanel = new ScrollablePanel(); markupsPanel.setLayout(new BoxLayout(markupsPanel, BoxLayout.PAGE_AXIS)); for (int i = 0; i < review.getNounPhrases().size(); ++i) { JScrollPane newMarkupPanel = newMarkupPanel(review.getNounPhrases().get(i), reviewElement); markupsPanel.add(newMarkupPanel); } JScrollPane scrollMarkupsPanel = new JScrollPane(markupsPanel); //Add Dimension for scrolling Dimension curScreenDimen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); scrollMarkupsPanel.setPreferredSize(new Dimension((int) curScreenDimen.getWidth() - 50, 400)); reviewPanel.add(scrollMarkupsPanel); //MODEL reviewElement.reviewTextArea = reviewContentTxtArea; reviewElements.add(reviewElement); reviewPanel.add(new JSeparator(SwingConstants.HORIZONTAL)); reviewPanel.add(Box.createVerticalStrut(20)); JScrollPane scrollReviewPanel = new JScrollPane(reviewPanel); return scrollReviewPanel; }
From source file:com.diversityarrays.kdxplore.heatmap.HeatMapPanel.java
private JComponent createCurationControls() { rejectSamplesAction.setEnabled(false); acceptSamplesAction.setEnabled(false); deActivatePlotsAction.setEnabled(false); reActivatePlotsAction.setEnabled(false); // | deactivate // accept suppress | reactivate JPanel panel = new JPanel(); GBH gbh = new GBH(panel, 2, 2, 2, 2); gbh.add(0, 0, 1, 1, GBH.NONE, 1, 1, GBH.WEST, new JButton(acceptSamplesAction)); gbh.add(1, 0, 1, 1, GBH.NONE, 1, 1, GBH.WEST, new JButton(rejectSamplesAction)); // if (! askAboutValueForUnscored) { // // TODO i18n // gbh.add(0,1, 2,1, GBH.HORZ, 1,1, GBH.CENTER, "Unscored samples ignored"); // }/* ww w . j a v a 2s.c o m*/ if (xValueRetriever.isPlotColumn() && yValueRetriever.isPlotRow()) { gbh.add(2, 0, 1, 2, GBH.VERT, 1, 1, GBH.CENTER, new JSeparator(JSeparator.VERTICAL)); gbh.add(3, 0, 1, 1, GBH.NONE, 1, 1, GBH.EAST, new JButton(deActivatePlotsAction)); gbh.add(3, 1, 1, 1, GBH.NONE, 1, 1, GBH.EAST, new JButton(reActivatePlotsAction)); } if (markInfo != null) { JComboBox<String> combo = new JComboBox<>(); combo.addItem(NO_MARK); for (String s : markInfo.plotPointsByMark.keySet()) { combo.addItem(s); } combo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<Point> points = null; Object item = combo.getSelectedItem(); if (item != null && !NO_MARK.equals(item)) { points = markInfo.plotPointsByMark.get(item); markName = item.toString(); } if (Check.isEmpty(points)) { heatMap.removeDecoratedPoints(markInfoRenderer); } else { heatMap.setDecoratedPoints(markInfoRenderer, points.toArray(new Point[points.size()])); } } }); Box newBox = Box.createHorizontalBox(); newBox.add(new JLabel(markInfo.label)); newBox.add(combo); gbh.add(0, 2, 4, 1, GBH.HORZ, 1, 1, GBH.CENTER, newBox); } return panel; }
From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java
private JComponent createTopComponent(Action extraAction) { // refreshSpecimenList.setEnabled(false); loadAction.setEnabled(true);//from w ww.j a va 2 s . co m Box specimenGroupControls = Box.createHorizontalBox(); specimenGroupControls.add(downloadGroupsButton); if (extraAction != null) { specimenGroupControls.add(new JButton(extraAction)); } specimenGroupControls.add(new JSeparator(JSeparator.VERTICAL)); // specimenGroupControls.add(new JButton(refreshSpecimenList)); specimenGroupControls.add(new JButton(loadAction)); specimenGroupTableModel = new SpecimenGroupTableModel(); specimenGroupTable = new JTable(specimenGroupTableModel); specimenGroupTable.setAutoCreateRowSorter(true); TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(specimenGroupTable, true); specimenGroupTable.setTransferHandler(tth); PromptScrollPane pane = new PromptScrollPane("No Specimen Groups Found"); pane.add(specimenGroupTable); specimenGroupTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); specimenGroupTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { List<Specimen> list = null; int vrow = specimenGroupTable.getSelectedRow(); if (vrow >= 0) { int mrow = specimenGroupTable.convertRowIndexToModel(vrow); if (mrow >= 0) { list = specimenGroupTableModel.getSpecimensAt(mrow); } } specimenTableModel.setData(list); } } }); JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(specimenGroupControls, BorderLayout.NORTH); containerPanel.add(new TitledTablePanel("Specimen Groups", specimenGroupTable, "No Specimen Groups Loaded"), BorderLayout.CENTER); return containerPanel; }
From source file:logdruid.ui.chart.GraphPanel.java
public void load(JPanel panel_2) { startDateJSpinner = (JSpinner) panel_2.getComponent(2); endDateJSPinner = (JSpinner) panel_2.getComponent(3); // scrollPane.setV panel.removeAll();/*from w w w. ja va 2 s .c o m*/ Dimension panelSize = this.getSize(); add(scrollPane, BorderLayout.CENTER); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // scrollPane.set trying to replace scroll where it was JCheckBox relativeCheckBox = (JCheckBox) panel_2.getComponent(5); estimatedTime = System.currentTimeMillis() - startTime; logger.info("gathering time: " + estimatedTime); startTime = System.currentTimeMillis(); // Map<Source, Map<String, MineResult>> Map<Source, Map<String, MineResult>> treeMap = new TreeMap<Source, Map<String, MineResult>>( mineResultSet.mineResults); Iterator mineResultSetIterator = treeMap.entrySet().iterator(); int ite = 0; logger.debug("mineResultSet size: " + mineResultSet.mineResults.size()); while (mineResultSetIterator.hasNext()) { final Map.Entry pairs = (Map.Entry) mineResultSetIterator.next(); logger.debug("mineResultSet key/source: " + ((Source) pairs.getKey()).getSourceName()); JCheckBox checkBox = (JCheckBox) panel_1.getComponent(ite++); logger.debug("checkbox: " + checkBox.getText() + ", " + checkBox.isSelected()); if (checkBox.isSelected()) { Map mrArrayList = (Map<String, MineResult>) pairs.getValue(); ArrayList<String> mineResultGroup = new ArrayList<String>(); Set<String> mrss = mrArrayList.keySet(); mineResultGroup.addAll(mrss); Collections.sort(mineResultGroup, new AlphanumComparator()); Iterator mrArrayListIterator = mineResultGroup.iterator(); while (mrArrayListIterator.hasNext()) { String key = (String) mrArrayListIterator.next(); logger.debug(key); final MineResult mr = (MineResult) mrArrayList.get(key); Map<String, ExtendedTimeSeries> statMap = mr.getStatTimeseriesMap(); Map<String, ExtendedTimeSeries> eventMap = mr.getEventTimeseriesMap(); // logger.info("mineResultSet hash size: " // +mr.getTimeseriesMap().size()); // logger.info("mineResultSet hash content: " + // mr.getStatTimeseriesMap()); logger.debug("mineResultSet mr.getStartDate(): " + mr.getStartDate() + " mineResultSet mr.getEndDate(): " + mr.getEndDate()); logger.debug("mineResultSet (Date)jsp.getValue(): " + (Date) startDateJSpinner.getValue()); logger.debug("mineResultSet (Date)jsp2.getValue(): " + (Date) endDateJSPinner.getValue()); if (mr.getStartDate() != null && mr.getEndDate() != null) { if ((mr.getStartDate().before((Date) endDateJSPinner.getValue())) && (mr.getEndDate().after((Date) startDateJSpinner.getValue()))) { ArrayList<String> mineResultGroup2 = new ArrayList<String>(); Set<String> mrss2 = statMap.keySet(); mineResultGroup2.addAll(mrss2); Collections.sort(mineResultGroup2, new AlphanumComparator()); Iterator statMapIterator = mineResultGroup2.iterator(); // Iterator statMapIterator = statMap.entrySet().iterator(); if (!statMap.entrySet().isEmpty() || !eventMap.entrySet().isEmpty()) { JPanel checkboxPanel = new JPanel(new WrapLayout()); checkboxPanel.setBackground(Color.white); int count = 1; chart = ChartFactory.createXYAreaChart(// Title mr.getSourceID() + " " + mr.getGroup(), // + null, // X-Axis // label null, // Y-Axis label null, // Dataset PlotOrientation.VERTICAL, false, // Show // legend true, // tooltips false // url ); TextTitle my_Chart_title = new TextTitle(mr.getSourceID() + " " + mr.getGroup(), new Font("Verdana", Font.BOLD, 17)); chart.setTitle(my_Chart_title); XYPlot plot = (XYPlot) chart.getPlot(); ValueAxis range = plot.getRangeAxis(); range.setVisible(false); final DateAxis domainAxis1 = new DateAxis(); domainAxis1.setTickLabelsVisible(true); // domainAxis1.setTickMarksVisible(true); logger.debug("getRange: " + domainAxis1.getRange()); if (relativeCheckBox.isSelected()) { domainAxis1.setRange((Date) startDateJSpinner.getValue(), (Date) endDateJSPinner.getValue()); } else { Date startDate = mr.getStartDate(); Date endDate = mr.getEndDate(); if (mr.getStartDate().before((Date) startDateJSpinner.getValue())) { startDate = (Date) startDateJSpinner.getValue(); logger.debug("setMinimumDate: " + (Date) startDateJSpinner.getValue()); } if (mr.getEndDate().after((Date) endDateJSPinner.getValue())) { endDate = (Date) endDateJSPinner.getValue(); logger.debug("setMaximumDate: " + (Date) endDateJSPinner.getValue()); } if (startDate.before(endDate)) { domainAxis1.setRange(startDate, endDate); } } XYToolTipGenerator tt1 = new XYToolTipGenerator() { public String generateToolTip(XYDataset dataset, int series, int item) { StringBuffer sb = new StringBuffer(); String htmlStr = "<html>"; Number x; FastDateFormat sdf = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss"); x = dataset.getX(series, item); sb.append(htmlStr); if (x != null) { sb.append("<p style='color:#000000;'>" + (sdf.format(x)) + "</p>"); sb.append("<p style='color:#000000;'>" + dataset.getSeriesKey(series).toString() + ": " + form.format(dataset.getYValue(0, item)) + "</p>"); if (mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) != null) { sb.append( "<p style='color:#0000FF;'>" + cd.sourceFileArrayListMap .get(pairs.getKey()).get(mr .getFileLineForDate( new Date(x.longValue()), dataset.getSeriesKey(series) .toString()) .getFileId()) .getFile().getName() + ":" + mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) .getLineNumber() + "</p>"); } } return sb.toString(); } }; while (statMapIterator.hasNext()) { TimeSeriesCollection dataset = new TimeSeriesCollection(); String me = (String) statMapIterator.next(); ExtendedTimeSeries ts = (ExtendedTimeSeries) statMap.get(me); // logger.info(((TimeSeries) // me.getValue()).getMaxY()); if (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() > 0) dataset.addSeries(ts.getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me + " nb records: " + ((ExtendedTimeSeries) statMap.get(me)) .getTimeSeries().getItemCount()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY())); XYPlot plot1 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.toString()); axis4.setAutoRange(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(false); plot1.setDomainCrosshairVisible(true); plot1.setRangeCrosshairVisible(true); axis4.setRange(new Range( ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY(), ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot1.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot1.setDomainAxis(domainAxis); plot1.setForegroundAlpha(0.5f); plot1.setDataset(count, dataset); plot1.mapDatasetToRangeAxis(count, count); final XYAreaRenderer renderer = new XYAreaRenderer(); // XYAreaRenderer2 // also // nice if ((((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() - ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries() .getMinY()) > 0) { // renderer.setToolTipGenerator(new // StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,new // FastDateFormat("d-MMM-yyyy HH:mm:ss"), // new DecimalFormat("#,##0.00"))); } renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); renderer.setSeriesToolTipGenerator(0, tt1); plot1.setRenderer(count, renderer); int hits = 0; // ts.getStat()[1] int matchs = 0; if (((ExtendedTimeSeries) statMap.get(me)).getStat() != null) { hits = ((ExtendedTimeSeries) statMap.get(me)).getStat()[1]; // matchs= ((ExtendedTimeSeries) statMap.get(me)).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.toString() + "(" + hits + ")", 0)); Boolean selected = true; jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } Iterator eventMapIterator = eventMap.entrySet().iterator(); while (eventMapIterator.hasNext()) { // HistogramDataset histoDataSet=new HistogramDataset(); TimeSeriesCollection dataset = new TimeSeriesCollection(); Map.Entry me = (Map.Entry) eventMapIterator.next(); // if (dataset.getEndXValue(series, item)) if (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY() > 0) dataset.addSeries(((ExtendedTimeSeries) me.getValue()).getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me.getKey() + " nb records: " + ((ExtendedTimeSeries) me.getValue()).getTimeSeries().getItemCount()); logger.debug("mineResultSet hash content: " + mr.getEventTimeseriesMap()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMinY())); XYPlot plot2 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.getKey().toString()); axis4.setAutoRange(true); // axis4.setInverted(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(true); // axis4.setRange(new Range(((TimeSeries) // axis4.setRange(new Range(((TimeSeries) // me.getValue()).getMinY(), ((TimeSeries) // me.getValue()).getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot2.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; // domainAxis.setLowerMargin(0.001); // domainAxis.setUpperMargin(0.0); plot2.setDomainCrosshairVisible(true); plot2.setRangeCrosshairVisible(true); //plot2.setRangeCrosshairLockedOnData(true); plot2.setDomainAxis(domainAxis); plot2.setForegroundAlpha(0.5f); plot2.setDataset(count, dataset); plot2.mapDatasetToRangeAxis(count, count); XYBarRenderer rend = new XYBarRenderer(); // XYErrorRenderer rend.setShadowVisible(false); rend.setDrawBarOutline(true); Stroke stroke = new BasicStroke(5); rend.setBaseStroke(stroke); final XYItemRenderer renderer = rend; renderer.setSeriesToolTipGenerator(0, tt1); // renderer.setItemLabelsVisible(true); renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); plot2.setRenderer(count, renderer); int hits = 0; int matchs = 0; if (((ExtendedTimeSeries) me.getValue()).getStat() != null) { hits = ((ExtendedTimeSeries) me.getValue()).getStat()[1]; // matchs= ((ExtendedTimeSeries) me.getValue()).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.getKey().toString() + "(" + hits + ")", 0)); jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } JPanel pan = new JPanel(); pan.setLayout(new BorderLayout()); pan.setPreferredSize(new Dimension(600, Integer.parseInt((String) Preferences.getPreference("chartSize")))); // pan.setPreferredSize(panelSize); panel.add(pan); final ChartPanel cpanel = new ChartPanel(chart); cpanel.setMinimumDrawWidth(0); cpanel.setMinimumDrawHeight(0); cpanel.setMaximumDrawWidth(1920); cpanel.setMaximumDrawHeight(1200); // cpanel.setInitialDelay(0); cpanel.setDismissDelay(9999999); cpanel.setInitialDelay(50); cpanel.setReshowDelay(200); cpanel.setPreferredSize(new Dimension(600, 350)); // cpanel.restoreAutoBounds(); fix the tooltip // missing problem but then relative display is // broken panel.add(new JSeparator(SwingConstants.HORIZONTAL)); pan.add(cpanel, BorderLayout.CENTER); // checkboxPanel.setPreferredSize(new Dimension(600, // 0)); cpanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent chartmouseevent) { // chartmouseevent.getEntity(). ChartEntity entity = chartmouseevent.getEntity(); if (entity instanceof XYItemEntity) { XYItemEntity item = ((XYItemEntity) entity); if (item.getDataset() instanceof TimeSeriesCollection) { TimeSeriesCollection data = (TimeSeriesCollection) item .getDataset(); TimeSeries series = data.getSeries(item.getSeriesIndex()); TimeSeriesDataItem dataitem = series.getDataItem(item.getItem()); // logger.info(" Serie: "+series.getKey().toString() // + // " Period : "+dataitem.getPeriod().toString()); // mr.getFileForDate(new Date // (x.longValue()) ; int x = chartmouseevent.getTrigger().getX(); // logger.info(mr.getFileForDate(dataitem.getPeriod().getEnd())); int y = chartmouseevent.getTrigger().getY(); String myString = ""; if (dataitem.getPeriod() != null) { logger.info(dataitem.getPeriod().getEnd()); // myString = mr.getFileForDate(dataitem.getPeriod().getEnd()).toString(); String lineString = "" + mr.getFileLineForDate(dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getLineNumber(); String fileString = cd.sourceFileArrayListMap .get(pairs.getKey()) .get(mr.getFileLineForDate( dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getFileId()) .getFile().getAbsolutePath(); String command = Preferences.getPreference("editorCommand"); command = command.replace("$line", lineString); command = command.replace("$file", fileString); logger.info(command); Runtime rt = Runtime.getRuntime(); try { rt.exec(command); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } StringSelection stringSelection = new StringSelection( fileString); Clipboard clpbrd = Toolkit.getDefaultToolkit() .getSystemClipboard(); clpbrd.setContents(stringSelection, null); // cpanel.getGraphics().drawString("file name copied", x - 5, y - 5); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch // block e.printStackTrace(); } } // logger.info(mr.getFileForDate(dataitem.getPeriod().getStart())); } } } public void chartMouseMoved(ChartMouseEvent e) { } }); pan.add(checkboxPanel, BorderLayout.SOUTH); } } } else { logger.debug("mr dates null: " + mr.getGroup() + mr.getSourceID() + mr.getLogFiles()); } } } } // Map=miner.mine(sourceFiles,repo); estimatedTime = System.currentTimeMillis() - startTime; revalidate(); logger.info("display time: " + estimatedTime); }
From source file:com.mirth.connect.client.ui.DashboardPanel.java
private void initComponents() { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); splitPane.setOneTouchExpandable(true); topPanel = new JPanel(); topPanel.setBackground(UIConstants.BACKGROUND_COLOR); dashboardTable = null;// w w w.j a va 2s .c o m dashboardTableScrollPane = new JScrollPane(); dashboardTableScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); dashboardTableScrollPane.setViewportView(dashboardTable); dashboardTableScrollPane.setDoubleBuffered(true); controlPanel = new JPanel(); controlPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(164, 164, 164))); controlPanel.setPreferredSize(new Dimension(100, 20)); tagFilterButton = new IconButton(); tagFilterButton .setIcon(new ImageIcon(getClass().getResource("/com/mirth/connect/client/ui/images/wrench.png"))); // NOI18N tagFilterButton.setToolTipText("Show Channel Filter"); tagFilterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { tagFilterButtonActionPerformed(); } }); tagsLabel = new JLabel(); ButtonGroup showStatsButtonGroup = new ButtonGroup(); showCurrentStatsButton = new JRadioButton("Current Statistics"); showCurrentStatsButton.setSelected(true); showCurrentStatsButton .setToolTipText("Show the statistics accumulated since the last time the statistics were reset"); showCurrentStatsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { showCurrentStatsButtonActionPerformed(); } }); showStatsButtonGroup.add(showCurrentStatsButton); showLifetimeStatsButton = new JRadioButton("Lifetime Statistics"); showLifetimeStatsButton .setToolTipText("Show the statistics accumulated over the entire lifetime of the channel"); showLifetimeStatsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { showLifetimeStatsButtonActionPerformed(); } }); showStatsButtonGroup.add(showLifetimeStatsButton); pluginContainerPanel = new JPanel(); controlSeparator = new JSeparator(SwingConstants.VERTICAL); ButtonGroup tableModeButtonGroup = new ButtonGroup(); tableModeGroupsButton = new IconToggleButton(UIConstants.ICON_GROUP); tableModeGroupsButton.setToolTipText("Groups"); tableModeGroupsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { switchTableMode(true); } }); tableModeButtonGroup.add(tableModeGroupsButton); tableModeChannelsButton = new IconToggleButton(UIConstants.ICON_CHANNEL); tableModeChannelsButton.setToolTipText("Channels"); tableModeChannelsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { switchTableMode(false); } }); tableModeButtonGroup.add(tableModeChannelsButton); tabPane = new JTabbedPane(); splitPane.setTopComponent(topPanel); splitPane.setBottomComponent(tabPane); }