Java Code Examples for org.apache.jmeter.gui.GuiPackage#getInstance()
The following examples show how to use
org.apache.jmeter.gui.GuiPackage#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeightedSwitchControllerGui.java From jmeter-bzm-plugins with Apache License 2.0 | 6 votes |
@Override public void configure(TestElement element) { // from model to GUI super.configure(element); log.debug("Props: " + this.isShowing() + " " + isVisible() + " " + isEnabled() + " " + isFocusOwner()); GuiPackage gp = GuiPackage.getInstance(); if (gp != null && element instanceof WeightedSwitchController) { WeightedSwitchController wsc = (WeightedSwitchController) element; CollectionProperty oldData = wsc.getData(); grid.getModel().clearData(); isRandomChoiceCheckBox.setSelected(wsc.isRandomChoice()); if (isShowing()) { fillGridFromTree(wsc, oldData); } else { JMeterPluginsUtils.collectionPropertyToTableModelRows(oldData, grid.getModel()); } } }
Example 2
Source File: DebuggerDialog.java From jmeter-debugger with Apache License 2.0 | 6 votes |
@Override public void componentShown(ComponentEvent e) { log.debug("Showing dialog"); if (GuiPackage.getInstance() != null) { savedDirty = GuiPackage.getInstance().isDirty(); } this.debugger = new Debugger(this, this); tgCombo.removeAllItems(); for (AbstractThreadGroup group : debugger.getThreadGroups()) { tgCombo.addItem(group); } AbstractThreadGroup selectedThreadGroup = debugger.getSelectedThreadGroup(); if (selectedThreadGroup != null) { changeComboValue(selectedThreadGroup); } tgCombo.setEnabled(tgCombo.getItemCount() > 0); start.setEnabled(tgCombo.getItemCount() > 0); start.requestFocus(); clearListeners(); }
Example 3
Source File: DebuggerMenuItem.java From jmeter-debugger with Apache License 2.0 | 5 votes |
private void addToolbarIcon() { GuiPackage instance = GuiPackage.getInstance(); if (instance != null) { final MainFrame mf = instance.getMainFrame(); final ComponentFinder<JMeterToolBar> finder = new ComponentFinder<>(JMeterToolBar.class); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JMeterToolBar toolbar = null; while (toolbar == null) { try { Thread.sleep(1000); } catch (InterruptedException e) { log.debug("Did not add btn to toolbar", e); } log.debug("Searching for toolbar"); toolbar = finder.findComponentIn(mf); } int pos = 21; Component toolbarButton = getToolbarButton(); toolbarButton.setSize(toolbar.getComponent(pos).getSize()); toolbar.add(toolbarButton, pos); } }); } }
Example 4
Source File: DebuggerDialog.java From jmeter-debugger with Apache License 2.0 | 5 votes |
@Override public void componentHidden(ComponentEvent e) { log.debug("Closing dialog"); debugger.stop(); if (GuiPackage.getInstance() != null) { GuiPackage.getInstance().setDirty(savedDirty); } clearListeners(); clearStatusPane(); }
Example 5
Source File: DebuggerDialog.java From jmeter-debugger with Apache License 2.0 | 5 votes |
private void clearListeners() { GuiPackage guiPackage = GuiPackage.getInstance(); for (JMeterTreeNode node : guiPackage.getTreeModel().getNodesOfType(Clearable.class)) { JMeterGUIComponent guiComp = guiPackage.getGui(node.getTestElement()); if (guiComp instanceof Clearable){ Clearable item = (Clearable) guiComp; try { item.clearData(); } catch (Exception ex) { log.error("Can't clear: {} {}", node, guiComp, ex); } } } }
Example 6
Source File: DebuggerDialog.java From jmeter-debugger with Apache License 2.0 | 5 votes |
private synchronized void displayElementGui(TestElement wrpElm) { GuiPackage gui = GuiPackage.getInstance(); if (gui != null) { JMeterGUIComponent egui = gui.getGui(wrpElm); egui.configure(wrpElm); egui.modifyTestElement(wrpElm); elementContainer.removeAll(); if (egui instanceof Component) { // egui.setEnabled(false); elementContainer.add((Component) egui, BorderLayout.CENTER); } elementContainer.updateUI(); } }
Example 7
Source File: DebuggerDialogTest.java From jmeter-debugger with Apache License 2.0 | 5 votes |
@Test public void testGui() throws Exception { if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { return; } String actions = ActionRouter.class.getProtectionDomain().getCodeSource().getLocation().getFile(); String renderers = RenderAsHTML.class.getProtectionDomain().getCodeSource().getLocation().getFile(); JMeterUtils.setProperty("search_paths", actions + ";" + renderers); TestProvider prov = new TestProvider(); JMeterTreeModel mdl = prov.getTreeModel(); JMeterTreeListener a = new JMeterTreeListener(); a.setActionHandler(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { log.debug("Action " + actionEvent); } }); a.setModel(mdl); GuiPackage.getInstance(a, mdl); DebuggerDialog obj = new DebuggerDialogMock(prov.getTreeModel()); obj.componentShown(null); obj.started(); obj.statusRefresh(JMeterContextService.getContext()); obj.frozenAt(new SamplerDebug()); obj.continuing(); obj.stopped(); obj.componentHidden(null); }
Example 8
Source File: GraphPanel.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private void addGraphTab() { ImageIcon graphIcon = createImageIcon("/kg/apc/jmeter/img/graph.png"); graphPanelObject = new GraphPanelChart(GuiPackage.getInstance() != null); graphPanelObject.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); JGraphPanel graphTab = new JGraphPanel(); graphTab.add(graphPanelObject, BorderLayout.CENTER); addTab("Chart", graphIcon, graphTab, "View chart"); }
Example 9
Source File: AbstractGraphPanelVisualizer.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private void addRowToCompositeModels(String rowName, AbstractGraphRow row) { GuiPackage gui = GuiPackage.getInstance(); if (gui == null) { log.debug("No GUI Package present, ignored adding to composite"); return; } JMeterTreeModel testTree = gui.getTreeModel(); for (JMeterTreeNode obj : testTree.getNodesOfType(CompositeResultCollector.class)) { CompositeResultCollector compositeResultCollector = (CompositeResultCollector) obj.getTestElement(); compositeResultCollector.getCompositeModel().addRow(rowName, row); } }
Example 10
Source File: AbstractGraphPanelVisualizer.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private void clearRowsFromCompositeModels(String vizualizerName) { GuiPackage gui = GuiPackage.getInstance(); if (gui == null) { log.debug("No GUI Package present, ignored removing from composite"); return; } JMeterTreeModel testTree = gui.getTreeModel(); for (JMeterTreeNode obj : testTree.getNodesOfType(CompositeResultCollector.class)) { //System.out.println("obj"); CompositeResultCollector compositeResultCollector = (CompositeResultCollector) obj.getTestElement(); compositeResultCollector.getCompositeModel().clearRows(vizualizerName); } }
Example 11
Source File: BrowseAction.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = getFileChooser(); if (chooser != null) { if(GuiPackage.getInstance() != null) { int returnVal = chooser.showOpenDialog(GuiPackage.getInstance().getMainFrame()); if(returnVal == JFileChooser.APPROVE_OPTION) { control.setText(chooser.getSelectedFile().getPath()); } lastPath = chooser.getCurrentDirectory().getPath(); } } }
Example 12
Source File: HttpSimpleTableControl.java From jmeter-plugins with Apache License 2.0 | 5 votes |
public void startHttpSimpleTable() throws IOException { log.info("Creating HTTP Simple Table Server..."); log.info("Port=" + getPort()); log.info("Dataset directory=" + getDataDir()); log.info("Timestamp=" + getTimestamp()); log.info("STS Version=" + HttpSimpleTableServer.STS_VERSION); server = new HttpSimpleTableServer(getPort(), getTimestamp(), getDataDir()); server.start(); GuiPackage instance = GuiPackage.getInstance(); if (instance != null) { instance.register(server); } }
Example 13
Source File: HttpSimpleTableControl.java From jmeter-plugins with Apache License 2.0 | 5 votes |
public void stopHttpSimpleTable() { if (server != null) { server.stopServer(); GuiPackage instance = GuiPackage.getInstance(); if (instance != null) { instance.unregister(server); } server = null; } }
Example 14
Source File: ThreadCountsAccessor.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private static void refreshUI() { long ts = System.currentTimeMillis(); if (ts - lastUpdate < 1000) { return; // throttle down updates } lastUpdate = ts; GuiPackage gp = GuiPackage.getInstance(); if (gp != null) {// check there is a GUI gp.getMainFrame().updateCounts(); } }
Example 15
Source File: DebuggerDialog.java From jmeter-debugger with Apache License 2.0 | 4 votes |
@Override public HashTree getTestTree() { GuiPackage gui = GuiPackage.getInstance(); return gui.getTreeModel().getTestPlan(); }
Example 16
Source File: DebuggerDialogTest.java From jmeter-debugger with Apache License 2.0 | 4 votes |
@Test public void displayGUI() throws InterruptedException, IOException, IllegalUserActionException { if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { TestProvider prov = new TestProvider("/com/blazemeter/jmeter/debugger/vars.jmx", "vars.jmx"); JMeterTreeModel mdl = prov.getTreeModel(); JMeterTreeListener a = new JMeterTreeListener(); a.setActionHandler(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { log.debug("Action " + actionEvent); } }); a.setModel(mdl); GuiPackage.getInstance(a, mdl); String actions = ActionRouter.class.getProtectionDomain().getCodeSource().getLocation().getFile(); String renderers = RenderAsHTML.class.getProtectionDomain().getCodeSource().getLocation().getFile(); JMeterUtils.setProperty("search_paths", actions + ";" + renderers); MainFrame mf = new MainFrame(mdl, a); // does important stuff inside ComponentFinder<JMeterToolBar> finder = new ComponentFinder<>(JMeterToolBar.class); JMeterToolBar tb = finder.findComponentIn(mf); tb.add(new JButton("test")); new TimeFunction(); long now = System.currentTimeMillis(); JMeterUtils.setProperty("START.MS", Long.toString(now)); Date today = new Date(now); JMeterUtils.setProperty("START.YMD", new SimpleDateFormat("yyyyMMdd").format(today)); JMeterUtils.setProperty("START.HMS", new SimpleDateFormat("HHmmss").format(today)); DebuggerDialogMock frame = new DebuggerDialogMock(mdl); frame.setPreferredSize(new Dimension(800, 600)); frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); frame.pack(); frame.setVisible(true); while (frame.isVisible()) { Thread.sleep(1000); } } }