List of usage examples for javax.swing JLabel setText
@BeanProperty(preferred = true, visualUpdate = true, description = "Defines the single line of text this component will display.") public void setText(String text)
From source file:src.gui.ItSIMPLE.java
public Element solvePDDLProblemWithPlannersList(Element project, Element domain, Element problem, List<Element> planners, String path) { Element container = null;//w ww . ja v a2 s . co m if (project != null && problem != null) { //System.out.println("got here: " + problem.getChildText("name")); container = new Element("problem"); container.setAttribute("id", problem.getChildText("name")); container.addContent((Element) problem.getChild("name").clone()); //add metrics (domain and problem level) to the problem reference (container) //Element mainMetrics = PlanSimulator.createMetricsNode(problem, domain); //container.addContent(mainMetrics); Element thePlans = new Element("plans"); container.addContent(thePlans); String problemPath = problem.getAttributeValue("file"); //File problemFile = new File(problemPath); String domainPath = path + domain.getChildText("name"); //File domainFile = new File(domainPath); // execute planner //exe = new ExecPlanner(null, domainFile.getPath(), problemFile.getPath(), true); exe = new ExecPlanner(null, domainPath, problemPath, true); exe.setXMLDomain(domain); exe.setXMLProblem(problem); exe.setProblemName(problem.getChildText("name")); exe.setDomainName(domain.getChildText("name")); exe.setProjectName(project.getChildText("name")); exe.setShowReport(false); appendOutputPanelText(">> Solving " + problem.getChildText("name") + " with selected planner(s) \n"); JLabel status = ItSIMPLE.getInstance().getPlanSimStatusBar(); //TODO: check if each planners is enabled to be included in the run all procedure for (Iterator<Element> it = planners.iterator(); it.hasNext();) { //stop this 'for' if the user press STOP if (stopRunningPlanners) { break; } Element planner = it.next(); //hideSimProgressBar(); status.setText("Status: Solving planning problem ..."); /// set start datetime DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss yyyy-MM-dd"); Date date = new Date(); String dateTime = dateFormat.format(date); //put in the log file - TODO: reset it when necessary savetologfile("Starting: " + domain.getChildText("name").replaceAll(".pddl", "") + "; " + problem.getChildText("name").replaceAll(".pddl", "") + "; " + planner.getChildText("name")); /* String logfolder= itSettings.getChild("logfolder").getAttributeValue("path"); //logfolder= "/home/tiago/Dropbox/Experiments/"; //String logfolder= "resources/log/"; String logfilepath = logfolder +"logfile.txt"; try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logfilepath, true))); out.println("Starting ("+dateTime+"): "+domain.getChildText("name").replaceAll(".pddl", "")+"; "+problem.getChildText("name").replaceAll(".pddl", "")+"; "+planner.getChildText("name")); out.close(); } catch (IOException e) { //exception handling left as an exercise for the reader } */ try { appendOutputPanelText("\n Solving " + problem.getChildText("name") + " with planner " + planner.getChildText("name") + " \n"); status.setText("Status: Solving planning problem " + problem.getChildText("name") + " with planner " + planner.getChildText("name") + "... \n"); skipPlannerProblemButton.setToolTipText("<html>Skip planning:<br /><strong>Planner</strong>:" + planner.getChildText("name") + "<br/><strong>Problem</strong>:" + exe.getProblemName() + "<br/><strong>Started at</strong>:" + dateTime + "</html>"); exe.setChosenPlanner(planner); //Element result = exe.solveProblem(); //New approach if timeout and theads //Garantee that there will be the minimal information in a empty plan exe.setEmptyPlan(); Element result = null; plannerThread = new Thread() { public void run() { exe.solveProblem(); } }; //TODO: // 1. We must get if it was time out or not ant put it in the report (the result xml) // Master Time-Out boolean masterTimeOutEnabled = itPlanners.getChild("settings").getChild("timeout") .getAttributeValue("enabled").equals("true"); long masterTimeOutValue = 0; if (!itPlanners.getChild("settings").getChildText("timeout").trim().equals("")) { masterTimeOutValue = Long .parseLong(itPlanners.getChild("settings").getChildText("timeout")); } // Local Time-out boolean localTimeOutEnabled = planner.getChild("settings").getChild("timeout") .getAttributeValue("enabled").equals("true"); long localTimeOutValue = 0; if (!planner.getChild("settings").getChildText("timeout").trim().equals("")) { localTimeOutValue = Long.parseLong(planner.getChild("settings").getChildText("timeout")); } // Time-out value long timeout = 0; if (localTimeOutEnabled) timeout = localTimeOutValue; else if (masterTimeOutEnabled) timeout = masterTimeOutValue; timeout = timeout * 1000; // seconds to milliseconds if (timeout > 0) { simProgressBar.setVisible(true); simProgressBar.setValue(0); String barmax = Long.toString(timeout / 1000); simProgressBar.setMaximum(Integer.parseInt(barmax)); simProgressBar.setString("0 of " + barmax + " (s)"); //System.out.println(barmax); TimeKiller timeKiller = new TimeKiller(plannerThread, timeout); // Timeout long start = System.currentTimeMillis(); plannerThread.start(); //wait to finish normaly or by timeout long timespent = 0; String timespentStr = "0"; DecimalFormat df = new DecimalFormat("###.#"); while (!timeKiller.isFinished() && plannerThread.isAlive() && !forceFinish) { Thread.sleep(200); //sleep timespent = System.currentTimeMillis() - start; //timespentStr = Long.toString((System.currentTimeMillis() - start)/1000); timespentStr = Long.toString((timespent) / 1000); int barvalue = Integer.parseInt(timespentStr); simProgressBar.setValue(barvalue); String percentage = df.format(simProgressBar.getPercentComplete() * 100); simProgressBar .setString(timespentStr + " of " + barmax + " (s) - (" + percentage + "%)"); //simProgressBar.setToolTipText(timespentStr + " of "+ barmax +" (s)"); simProgressBar.repaint(); } if (forceFinish) { timeKiller.setFinished(true); exe.destroyProcess(); plannerThread.interrupt(); timeKiller.done(); forceFinish = false; //wait for plannerThread to finish while (plannerThread.isAlive()) { Thread.sleep(500); //sleep to finish all killing } //set the reason (skipped) and time in the statistics Element plan = exe.getPlan(); //System.out.println("forced " + timespentStr +" - "+ planner.getChildText("name")); Element statistics = plan.getChild("statistics"); statistics.getChild("toolTime").setText(timespentStr); Element plannerstatus = statistics.getChild("forcedQuit"); plannerstatus.setText("skipped"); //set datetime dateTime = dateFormat.format(date); plan.getChild("datetime").setText(dateTime); } else if (timeKiller.isTimeoutReached() || timespent >= timeout) { timeKiller.setFinished(true); exe.destroyProcess(); plannerThread.interrupt(); timeKiller.done(); //wait for plannerThread to finish while (plannerThread.isAlive()) { Thread.sleep(500); //sleep to finish all killing } //set the reason (timeout) and time in the statistics Element plan = exe.getPlan(); String thetimeoutstr = Long.toString(timeout / 1000); //System.out.println("timeout "+ thetimeoutstr+" - "+ planner.getChildText("name")); Element statistics = plan.getChild("statistics"); statistics.getChild("toolTime").setText(thetimeoutstr); Element plannerstatus = statistics.getChild("forcedQuit"); plannerstatus.setText("timeout"); //set datetime dateTime = dateFormat.format(date); plan.getChild("datetime").setText(dateTime); } } else { // without time-out simTimeSpent.setText(""); long start = System.currentTimeMillis(); plannerThread.start(); long timespent = 0; String timespentStr = "0"; while (plannerThread.isAlive() && !forceFinish) { Thread.sleep(200); //sleep timespent = System.currentTimeMillis() - start; timespentStr = Long.toString(timespent / 1000); simTimeSpent.setText(" Time: " + timespentStr + " (s)"); //System.out.println(timespent/1000); } Element plan = exe.getPlan(); if (forceFinish) { plannerThread.interrupt(); forceFinish = false; //set the reason and time in the statistics Element statistics = plan.getChild("statistics"); statistics.getChild("toolTime").setText(timespentStr); Element plannerstatus = statistics.getChild("forcedQuit"); plannerstatus.setText("skipped"); } } hideSimProgressBar(); simTimeSpent.setText(""); //garantee to destroy process exe.destroyProcess(); //LOG: put in the log file - TODO: reset it when necessary savetologfile("Finish: " + domain.getChildText("name").replaceAll(".pddl", "") + "; " + problem.getChildText("name").replaceAll(".pddl", "") + "; " + planner.getChildText("name") + "\n"); /* Date datefinish = new Date(); String dateTimefinish = dateFormat.format(datefinish); try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logfilepath, true))); out.println("Finish ("+dateTimefinish+"): "+domain.getChildText("name").replaceAll(".pddl", "")+"; "+problem.getChildText("name").replaceAll(".pddl", "")+"; "+planner.getChildText("name") +"\n"); out.close(); } catch (IOException e) { //exception handling left as an exercise for the reader } */ //get resulting plan (might have plan) result = exe.getPlan(); //End of new approach if timeout and theads if (result != null) { //Calculate metrics dataset. Add metrics data to the plan "xmlPlan/metrics" //Element metrics = PlanSimulator.createMetricsNode(problem, domain); //if (metrics != null && metrics.getChildren().size() > 0 && result.getChild("plan").getChildren().size() > 0) { // appendOutputPanelText(">> Calculating metrics for the plan given by " + planner.getChildText("name") + ". \n"); // PlanSimulator.createMetricDatasets(metrics, result, problem, domain, null); //} //result.addContent(metrics); thePlans.addContent((Element) result.clone()); //Log the resulting plan logplan(domain, problem, planner, result); /* //LOG: save file (xml) as a backup String currenttime = new Date().toString(); String backuppath = logfolder+"plans/"+domain.getChildText("name").replaceAll(".pddl", "")+"_"+problem.getChildText("name").replaceAll(".pddl", "")+"_"+planner.getChildText("name")+"_"+dateTimefinish+".xml"; //XMLUtilities.writeToFile(backuppath, result.getDocument()); try { FileWriter file = new FileWriter(backuppath); file.write(XMLUtilities.toString(result)); file.close(); } catch (IOException e1) { e1.printStackTrace(); } */ } else { appendOutputPanelText(" ## No plan from " + planner.getChildText("name") + "! \n"); } appendOutputPanelText(" (!) Done with " + planner.getChildText("name") + "! \n"); skipPlannerProblemButton.setToolTipText(""); } catch (Exception e) { } } status.setText( "Status: Done solving planning problem " + problem.getChildText("name") + " with planner(s)!"); appendOutputPanelText( ">> Done solving problem " + problem.getChildText("name") + " with selected planner(s)! \n"); } return container; }
From source file:org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorControllerBase.java
public JLabel getItemName(Object obj) { String className;//from www . j a v a2s .co m Icon icon = null; if (obj instanceof Embeddable) { className = ((Embeddable) obj).getClassName(); icon = CellRenderers.iconForObject(new Embeddable()); } else { className = ((ObjEntity) obj).getName(); icon = CellRenderers.iconForObject(new ObjEntity()); } JLabel labelIcon = new JLabel(); labelIcon.setIcon(icon); labelIcon.setVisible(true); labelIcon.setText(className); return labelIcon; }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getPriorityPanel(final ViewState state) { JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder()); panel.setLayout(new BorderLayout()); panel.add(new JLabel("Priority: "), BorderLayout.WEST); final JLabel priorityLabel = new JLabel(String.valueOf(DEFAULT_PRIORITY)); panel.add(priorityLabel, BorderLayout.CENTER); JSlider slider = new JSlider(0, 100, (int) 5 * 10); slider.setMajorTickSpacing(10);//from w w w.j a v a 2s.com slider.setMinorTickSpacing(1); slider.setPaintLabels(true); slider.setPaintTicks(true); slider.setSnapToTicks(false); Format f = new DecimalFormat("0.0"); Hashtable<Integer, JComponent> labels = new Hashtable<Integer, JComponent>(); for (int i = 0; i <= 10; i += 2) { JLabel label = new JLabel(f.format(i)); label.setFont(label.getFont().deriveFont(Font.PLAIN)); labels.put(i * 10, label); } slider.setLabelTable(labels); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { double value = ((JSlider) e.getSource()).getValue() / 10.0; priorityLabel.setText(value + ""); priorityLabel.revalidate(); if (!((JSlider) e.getSource()).getValueIsAdjusting()) { // FIXME: deal with priorities DefaultPropView.this.notifyListeners(); } } }); panel.add(slider, BorderLayout.SOUTH); return panel; }
From source file:org.broad.igv.hic.MainWindow.java
private void initComponents() { JPanel mainPanel = new JPanel(); JPanel toolbarPanel = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); toolbarPanel.setBorder(null);//w ww . j a v a 2 s .c o m toolbarPanel.setLayout(new GridLayout()); JPanel chrSelectionPanel = new JPanel(); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setMinimumSize(new Dimension(130, 57)); chrSelectionPanel.setPreferredSize(new Dimension(130, 57)); chrSelectionPanel.setLayout(new BorderLayout()); JPanel panel10 = new JPanel(); panel10.setBackground(new Color(204, 204, 204)); panel10.setLayout(new BorderLayout()); JLabel label3 = new JLabel(); label3.setText("Chromosomes"); label3.setHorizontalAlignment(SwingConstants.CENTER); panel10.add(label3, BorderLayout.CENTER); chrSelectionPanel.add(panel10, BorderLayout.PAGE_START); JPanel panel9 = new JPanel(); panel9.setBackground(new Color(238, 238, 238)); panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS)); //---- chrBox1 ---- chrBox1 = new JComboBox(); chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); panel9.add(chrBox1); //---- chrBox2 ---- chrBox2 = new JComboBox(); chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); panel9.add(chrBox2); //---- refreshButton ---- JideButton refreshButton = new JideButton(); refreshButton .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshButtonActionPerformed(e); } }); panel9.add(refreshButton); chrSelectionPanel.add(panel9, BorderLayout.CENTER); toolbarPanel.add(chrSelectionPanel); //======== displayOptionPanel ======== JPanel displayOptionPanel = new JPanel(); JPanel panel1 = new JPanel(); displayOptionComboBox = new JComboBox(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); //======== panel14 ======== JPanel panel14 = new JPanel(); panel14.setBackground(new Color(204, 204, 204)); panel14.setLayout(new BorderLayout()); //---- label4 ---- JLabel label4 = new JLabel(); label4.setText("Show"); label4.setHorizontalAlignment(SwingConstants.CENTER); panel14.add(label4, BorderLayout.CENTER); displayOptionPanel.add(panel14, BorderLayout.PAGE_START); //======== panel1 ======== panel1.setBorder(new EmptyBorder(0, 10, 0, 10)); panel1.setLayout(new GridLayout(1, 0, 20, 0)); //---- comboBox1 ---- displayOptionComboBox .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() })); displayOptionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayOptionComboBoxActionPerformed(e); } }); panel1.add(displayOptionComboBox); displayOptionPanel.add(panel1, BorderLayout.CENTER); toolbarPanel.add(displayOptionPanel); //======== colorRangePanel ======== JPanel colorRangePanel = new JPanel(); JLabel colorRangeLabel = new JLabel(); colorRangeSlider = new RangeSlider(); colorRangePanel.setBorder(LineBorder.createGrayLineBorder()); colorRangePanel.setMinimumSize(new Dimension(96, 70)); colorRangePanel.setPreferredSize(new Dimension(202, 70)); colorRangePanel.setMaximumSize(new Dimension(32769, 70)); colorRangePanel.setLayout(new BorderLayout()); //======== panel11 ======== JPanel colorLabelPanel = new JPanel(); colorLabelPanel.setBackground(new Color(204, 204, 204)); colorLabelPanel.setLayout(new BorderLayout()); //---- colorRangeLabel ---- colorRangeLabel.setText("Color Range"); colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER); colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared."); colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER); colorRangeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } } @Override public void mouseClicked(MouseEvent e) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } }); colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER); colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START); //---- colorRangeSlider ---- colorRangeSlider.setPaintTicks(true); colorRangeSlider.setPaintLabels(true); colorRangeSlider.setLowerValue(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setMaximumSize(new Dimension(32767, 52)); colorRangeSlider.setPreferredSize(new Dimension(200, 52)); colorRangeSlider.setMinimumSize(new Dimension(36, 52)); colorRangeSlider.setMaximum(2000); colorRangeSlider.setUpperValue(500); colorRangeSlider.setMinorTickSpacing(100); colorRangeSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorRangeSliderStateChanged(e); } }); colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END); // JPanel colorRangeTextPanel = new JPanel(); // colorRangeTextPanel.setLayout(new FlowLayout()); // JTextField minField = new JTextField(); // minField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(minField); // colorRangeTextPanel.add(new JLabel(" - ")); // JTextField maxField = new JTextField(); // maxField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(maxField); // colorRangeTextPanel.setPreferredSize(new Dimension(200, 52)); // colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END); toolbarPanel.add(colorRangePanel); //======== resolutionPanel ======== JLabel resolutionLabel = new JLabel(); JPanel resolutionPanel = new JPanel(); resolutionPanel.setBorder(LineBorder.createGrayLineBorder()); resolutionPanel.setLayout(new BorderLayout()); //======== panel12 ======== JPanel panel12 = new JPanel(); panel12.setBackground(new Color(204, 204, 204)); panel12.setLayout(new BorderLayout()); //---- resolutionLabel ---- resolutionLabel.setText("Resolution"); resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER); resolutionLabel.setBackground(new Color(204, 204, 204)); panel12.add(resolutionLabel, BorderLayout.CENTER); resolutionPanel.add(panel12, BorderLayout.PAGE_START); //======== panel2 ======== JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- resolutionSlider ---- resolutionSlider = new JSlider(); resolutionSlider.setMaximum(8); resolutionSlider.setMajorTickSpacing(1); resolutionSlider.setPaintTicks(true); resolutionSlider.setSnapToTicks(true); resolutionSlider.setPaintLabels(true); resolutionSlider.setMinorTickSpacing(1); Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>(); Font f = FontManager.getFont(8); for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) { if ((i + 1) % 2 == 0) { final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]); tickLabel.setFont(f); resolutionLabels.put(i, tickLabel); } } resolutionSlider.setLabelTable(resolutionLabels); // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice. resolutionSlider.addChangeListener(new ChangeListener() { // Change zoom level while staying centered on current location. // Centering is relative to the bounds of the data, which might not be the bounds of the window public void stateChanged(ChangeEvent e) { if (!resolutionSlider.getValueIsAdjusting()) { int idx = resolutionSlider.getValue(); idx = Math.max(0, Math.min(idx, MAX_ZOOM)); if (hic.zd != null && idx == hic.zd.getZoom()) { // Nothing to do return; } if (hic.xContext != null) { int centerLocationX = (int) hic.xContext .getChromosomePosition(getHeatmapPanel().getWidth() / 2); int centerLocationY = (int) hic.yContext .getChromosomePosition(getHeatmapPanel().getHeight() / 2); hic.setZoom(idx, centerLocationX, centerLocationY, false); } //zoomInButton.setEnabled(newZoom < MAX_ZOOM); //zoomOutButton.setEnabled(newZoom > 0); } } }); panel2.add(resolutionSlider); resolutionPanel.add(panel2, BorderLayout.CENTER); toolbarPanel.add(resolutionPanel); mainPanel.add(toolbarPanel, BorderLayout.NORTH); //======== hiCPanel ======== final JPanel hiCPanel = new JPanel(); hiCPanel.setLayout(new HiCLayout()); //---- rulerPanel2 ---- rulerPanel2 = new HiCRulerPanel(hic); rulerPanel2.setMaximumSize(new Dimension(4000, 50)); rulerPanel2.setMinimumSize(new Dimension(1, 50)); rulerPanel2.setPreferredSize(new Dimension(1, 50)); rulerPanel2.setBorder(null); JPanel panel2_5 = new JPanel(); panel2_5.setLayout(new BorderLayout()); panel2_5.add(rulerPanel2, BorderLayout.SOUTH); trackPanel = new TrackPanel(hic); trackPanel.setMaximumSize(new Dimension(4000, 50)); trackPanel.setPreferredSize(new Dimension(1, 50)); trackPanel.setMinimumSize(new Dimension(1, 50)); trackPanel.setBorder(null); // trackPanelScrollpane = new JScrollPane(); // trackPanelScrollpane.getViewport().add(trackPanel); // trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); // trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237)); // trackPanelScrollpane.setVisible(false); // panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH); // trackPanel.setVisible(false); panel2_5.add(trackPanel, BorderLayout.NORTH); hiCPanel.add(panel2_5, BorderLayout.NORTH); //---- rulerPanel1 ---- rulerPanel1 = new HiCRulerPanel(hic); rulerPanel1.setMaximumSize(new Dimension(50, 4000)); rulerPanel1.setPreferredSize(new Dimension(50, 500)); rulerPanel1.setBorder(null); rulerPanel1.setMinimumSize(new Dimension(50, 1)); hiCPanel.add(rulerPanel1, BorderLayout.WEST); //---- heatmapPanel ---- heatmapPanel = new HeatmapPanel(this, hic); heatmapPanel.setBorder(LineBorder.createBlackLineBorder()); heatmapPanel.setMaximumSize(new Dimension(500, 500)); heatmapPanel.setMinimumSize(new Dimension(500, 500)); heatmapPanel.setPreferredSize(new Dimension(500, 500)); heatmapPanel.setBackground(new Color(238, 238, 238)); hiCPanel.add(heatmapPanel, BorderLayout.CENTER); //======== panel8 ======== JPanel rightSidePanel = new JPanel(); rightSidePanel.setMaximumSize(new Dimension(120, 100)); rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0)); rightSidePanel.setLayout(null); //---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(this, hic); thumbnailPanel.setMaximumSize(new Dimension(100, 100)); thumbnailPanel.setMinimumSize(new Dimension(100, 100)); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBorder(LineBorder.createBlackLineBorder()); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize())); rightSidePanel.add(thumbnailPanel); //======== xPlotPanel ======== xPlotPanel = new JPanel(); xPlotPanel.setPreferredSize(new Dimension(250, 100)); xPlotPanel.setLayout(null); rightSidePanel.add(xPlotPanel); xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228); //======== yPlotPanel ======== yPlotPanel = new JPanel(); yPlotPanel.setPreferredSize(new Dimension(250, 100)); yPlotPanel.setLayout(null); rightSidePanel.add(yPlotPanel); yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); hiCPanel.add(rightSidePanel, BorderLayout.EAST); mainPanel.add(hiCPanel, BorderLayout.CENTER); contentPane.add(mainPanel, BorderLayout.CENTER); JMenuBar menuBar = createMenuBar(hiCPanel); contentPane.add(menuBar, BorderLayout.NORTH); // setup the glass pane to display a wait cursor when visible, and to grab all mouse events rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rootPane.getGlassPane().addMouseListener(new MouseAdapter() { }); }
From source file:org.cloudml.ui.graph.Visu.java
public void createFrame() { final VisualizationViewer<Vertex, Edge> vv = v.getVisualisationViewer(); vv.getRenderContext().setVertexIconTransformer(new Transformer<Vertex, Icon>() { public Icon transform(final Vertex v) { return new Icon() { public int getIconHeight() { return 40; }/* ww w . ja v a2s. c om*/ public int getIconWidth() { return 40; } public void paintIcon(java.awt.Component c, Graphics g, int x, int y) { ImageIcon img; if (v.getType() == "node") { img = new ImageIcon(this.getClass().getResource("/server.png")); } else if (v.getType() == "platform") { img = new ImageIcon(this.getClass().getResource("/dbms.png")); } else { img = new ImageIcon(this.getClass().getResource("/soft.png")); } ImageObserver io = new ImageObserver() { public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { // TODO Auto-generated method stub return false; } }; g.drawImage(img.getImage(), x, y, getIconHeight(), getIconWidth(), io); if (!vv.getPickedVertexState().isPicked(v)) { g.setColor(Color.black); } else { g.setColor(Color.red); properties.setModel(new CPIMTable(v)); runtimeProperties.setModel(new CPSMTable(v)); } g.drawString(v.getName(), x - 10, y + 50); } }; } }); // create a frame to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton save = new JButton("save"); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showDialog(frame, "save"); File result = fc.getSelectedFile(); JsonCodec codec = new JsonCodec(); OutputStream streamResult; try { streamResult = new FileOutputStream(result); codec.save(dmodel, streamResult); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); JButton saveImage = new JButton("save as image"); saveImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showDialog(frame, "save"); File result = fc.getSelectedFile(); JsonCodec codec = new JsonCodec(); v.writeJPEGImage(result); } }); //WE NEED TO UPDATE THE FACADE AND THE GUI JButton load = new JButton("load"); load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showDialog(frame, "load"); File result = fc.getSelectedFile(); JsonCodec codec = new JsonCodec(); try { InputStream stream = new FileInputStream(result); Deployment model = (Deployment) codec.load(stream); dmodel = model; v.setDeploymentModel(dmodel); ArrayList<Vertex> V = v.drawFromDeploymentModel(); nodeTypes.removeAll(); nodeTypes.setModel(fillList()); properties.setModel(new CPIMTable(V.get(0))); runtimeProperties.setModel(new CPSMTable(V.get(0))); CommandFactory fcommand = new CommandFactory(); CloudMlCommand load = fcommand.loadDeployment(result.getPath()); cml.fireAndWait(load); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JButton deploy = new JButton("Deploy!"); deploy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //cad.deploy(dmodel); System.out.println("deploy"); CommandFactory fcommand = new CommandFactory(); CloudMlCommand deploy = fcommand.deploy(); cml.fireAndWait(deploy); } }); //right panel JPanel intermediary = new JPanel(); intermediary.setLayout(new BoxLayout(intermediary, BoxLayout.PAGE_AXIS)); intermediary.setBorder(BorderFactory.createLineBorder(Color.black)); JLabel jlCPIM = new JLabel(); jlCPIM.setText("CPIM"); JLabel jlCPSM = new JLabel(); jlCPSM.setText("CPSM"); properties = new JTable(null); //properties.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); JTableHeader h = properties.getTableHeader(); JPanel props = new JPanel(); props.setLayout(new BorderLayout()); props.add(new JScrollPane(properties), BorderLayout.CENTER); props.add(h, BorderLayout.NORTH); runtimeProperties = new JTable(null); //runtimeProperties.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); JTableHeader h2 = runtimeProperties.getTableHeader(); JPanel runProps = new JPanel(); runProps.setLayout(new BorderLayout()); runProps.add(h2, BorderLayout.NORTH); runProps.add(new JScrollPane(runtimeProperties), BorderLayout.CENTER); intermediary.add(jlCPIM); intermediary.add(props); intermediary.add(jlCPSM); intermediary.add(runProps); content.add(intermediary, BorderLayout.EAST); //Left panel JPanel selection = new JPanel(); JLabel nodes = new JLabel(); nodes.setText("Types"); selection.setLayout(new BoxLayout(selection, BoxLayout.PAGE_AXIS)); nodeTypes = new JList(fillList()); nodeTypes.setLayoutOrientation(JList.VERTICAL); nodeTypes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); nodeTypes.setVisibleRowCount(10); JScrollPane types = new JScrollPane(nodeTypes); types.setPreferredSize(new Dimension(150, 80)); selection.add(nodes); selection.add(types); content.add(selection, BorderLayout.WEST); ((DefaultModalGraphMouse<Integer, Number>) gm) .add(new MyEditingGraphMousePlugin(0, vv, v.getGraph(), nodeTypes, dmodel)); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(save); controls.add(saveImage); controls.add(load); controls.add(deploy); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:org.codinjutsu.tools.jenkins.view.BuildParamDialog.java
private void addParameterInputs() { contentPanel.setLayout(new SpringLayout()); List<JobParameter> parameters = job.getParameters(); for (JobParameter jobParameter : parameters) { JComponent inputField = createInputField(jobParameter); String name = jobParameter.getName(); inputField.setName(name);// w w w .j a va 2 s. co m JLabel label = new JLabel(); label.setHorizontalAlignment(JLabel.TRAILING); label.setLabelFor(inputField); if (StringUtils.isEmpty(name)) { name = MISSING_NAME_LABEL; label.setIcon(ERROR_ICON); hasError = true; } label.setText(name + ":"); contentPanel.add(label); contentPanel.add(inputField); inputFieldByParameterMap.put(jobParameter, inputField); } SpringUtilities.makeCompactGrid(contentPanel, parameters.size(), 2, 6, 6, //initX, initY 6, 6); //xPad, yPad if (hasError) { buttonOK.setEnabled(false); } }
From source file:org.colombbus.tangara.EditorFrame.java
/** * This method initializes msgButtonsPanel * * @return javax.swing.JPanel//w ww.j a v a 2 s . c om */ private JPanel getMsgButtonsPanel() { if (msgButtonsPanel == null) { msgButtonsPanel = new JPanel(); msgButtonsPanel.setLayout(new BorderLayout()); msgButtonsPanel.setBackground(Color.white); msgButtonsPanel.add(getMsgButtons(), BorderLayout.WEST); JLabel endIcon = new JLabel(); endIcon.setText(""); //$NON-NLS-1$ endIcon.setBackground(Color.white); endIcon.setIcon(new ImageIcon(getClass().getResource("/org/colombbus/tangara/main_end.png"))); //$NON-NLS-1$ msgButtonsPanel.add(endIcon, BorderLayout.EAST); } return msgButtonsPanel; }
From source file:org.datanucleus.ide.idea.ui.DNEConfigForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL/*w w w . java 2 s.c om*/ */ private void $$$setupUI$$$() { createUIComponents(); parentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(1, 0, 0, 0), -1, -1)); configTabbedPane = new JTabbedPane(); parentPanel.add(configTabbedPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); configPanel = new JPanel(); configPanel.setLayout(new GridLayoutManager(5, 3, new Insets(6, 2, 2, 2), -1, -1)); configTabbedPane.addTab("Enhancer", configPanel); indexNotReadyPanel = new JPanel(); indexNotReadyPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(indexNotReadyPanel, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("Please wait until indexing is finished"); indexNotReadyPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(contentPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-3355444)), "Affected Modules")); final JScrollPane scrollPane1 = new JScrollPane(); panel1.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); affectedModulesTable = new JTable(); affectedModulesTable.setEnabled(true); affectedModulesTable.setFillsViewportHeight(false); affectedModulesTable.setPreferredScrollableViewportSize(new Dimension(450, 30)); scrollPane1.setViewportView(affectedModulesTable); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-3355444)), "Metadata and annotated classes for enhancement", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(-16777216))); infoPanel = new JPanel(); infoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel2.add(infoPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Please click 'Make Project' to see affected files"); infoPanel.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metaDataAndClassesScrollPane = new JScrollPane(); panel2.add(metaDataAndClassesScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); metadataAndClassesTable = new JTable(); metadataAndClassesTable.setFillsViewportHeight(false); metadataAndClassesTable.setFont(new Font(metadataAndClassesTable.getFont().getName(), metadataAndClassesTable.getFont().getStyle(), metadataAndClassesTable.getFont().getSize())); metadataAndClassesTable.setPreferredScrollableViewportSize(new Dimension(450, 100)); metaDataAndClassesScrollPane.setViewportView(metadataAndClassesTable); modifiersPanel = new JPanel(); modifiersPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 2, 0, 0), -1, -1)); configPanel.add(modifiersPanel, new GridConstraints(1, 0, 2, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText(" Metadata file extensions (use ';' to separate)"); modifiersPanel.add(label3, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); includeTestClassesCheckBox = new JCheckBox(); includeTestClassesCheckBox.setText("Include Test classes"); modifiersPanel.add(includeTestClassesCheckBox, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metadataExtensionTextField.setAlignmentX(0.5f); metadataExtensionTextField.setAutoscrolls(true); metadataExtensionTextField.setMargin(new Insets(1, 1, 1, 1)); modifiersPanel.add(metadataExtensionTextField, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); addToCompilerResourceCheckBox = new JCheckBox(); addToCompilerResourceCheckBox.setText("Add to compiler resource patterns"); modifiersPanel.add(addToCompilerResourceCheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); dependenciesPanel = new JPanel(); dependenciesPanel.setLayout(new GridLayoutManager(3, 1, new Insets(6, 2, 2, 2), -1, -1)); configTabbedPane.addTab("Dependencies", dependenciesPanel); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), 5, 5)); dependenciesPanel.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); depProjectModuleRadioButton.setText("Project Module Dependencies"); panel3.add(depProjectModuleRadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); depManualRadioButton.setText("Manual Dependencies"); panel3.add(depManualRadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel3.add(spacer1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); depManualUnsupportedLabel = new JLabel(); depManualUnsupportedLabel.setText("(Not supported by plugin extension)"); panel3.add(depManualUnsupportedLabel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); manualDependenciesDisabledInfoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); dependenciesPanel.add(manualDependenciesDisabledInfoPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setHorizontalAlignment(0); label4.setHorizontalTextPosition(0); label4.setText("Using Enhancer and it's Dependencies from Project Module"); manualDependenciesDisabledInfoPanel.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); dependenciesPanel.add(dependenciesAddDeletePanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); generalPanel = new JPanel(); generalPanel.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); parentPanel.add(generalPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); enableEnhancerCheckBox = new JCheckBox(); enableEnhancerCheckBox.setText("Enable Enhancer"); generalPanel.add(enableEnhancerCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); generalPanel.add(panel4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); jDORadioButton.setText("JDO"); panel4.add(jDORadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); jPARadioButton = new JRadioButton(); jPARadioButton.setText("JPA"); panel4.add(jPARadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel4.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); generalPanel.add(persistenceImplComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(jDORadioButton); buttonGroup.add(jPARadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(depProjectModuleRadioButton); buttonGroup.add(depManualRadioButton); }
From source file:org.datanucleus.ide.idea.ui.v10x.DNEConfigFormV10x.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from ww w . j a va 2s .com */ private void $$$setupUI$$$() { createUIComponents(); configPanel = new JPanel(); configPanel.setLayout(new GridLayoutManager(5, 3, new Insets(0, 0, 0, 0), -1, -1)); enableEnhancerCheckBox = new JCheckBox(); enableEnhancerCheckBox.setText("Enable Enhancer"); configPanel.add(enableEnhancerCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(panel1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); jDORadioButton = new JRadioButton(); jDORadioButton.setText("JDO"); panel1.add(jDORadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); jPARadioButton = new JRadioButton(); jPARadioButton.setText("JPA"); panel1.add(jPARadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); configPanel.add(persistenceImplComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText(" Metadata file extensions (use ';' to separate)"); configPanel.add(label1, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); includeTestClassesCheckBox = new JCheckBox(); includeTestClassesCheckBox.setText("Include Test classes"); configPanel.add(includeTestClassesCheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metadataExtensionTextField.setAlignmentX(0.5f); metadataExtensionTextField.setAutoscrolls(true); metadataExtensionTextField.setMargin(new Insets(1, 1, 1, 1)); configPanel.add(metadataExtensionTextField, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); addToCompilerResourceCheckBox = new JCheckBox(); addToCompilerResourceCheckBox.setText("Add to compiler resource patterns"); configPanel.add(addToCompilerResourceCheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); indexNotReadyPanel = new JPanel(); indexNotReadyPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(indexNotReadyPanel, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Please wait until indexing is finished"); indexNotReadyPanel.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(contentPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Affected Modules")); final JScrollPane scrollPane1 = new JScrollPane(); panel2.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); affectedModulesTable = new JTable(); affectedModulesTable.setEnabled(true); affectedModulesTable.setFillsViewportHeight(false); affectedModulesTable.setPreferredScrollableViewportSize(new Dimension(450, 30)); scrollPane1.setViewportView(affectedModulesTable); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel3.setBorder(BorderFactory.createTitledBorder("Metadata and annotated classes for enhancement")); infoPanel = new JPanel(); infoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel3.add(infoPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Please click 'Make Project' to see affected files"); infoPanel.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metaDataAndClassesScrollPane = new JScrollPane(); panel3.add(metaDataAndClassesScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); metadataAndClassesTable = new JTable(); metadataAndClassesTable.setFillsViewportHeight(false); metadataAndClassesTable.setFont(new Font(metadataAndClassesTable.getFont().getName(), metadataAndClassesTable.getFont().getStyle(), metadataAndClassesTable.getFont().getSize())); metadataAndClassesTable.setPreferredScrollableViewportSize(new Dimension(450, 100)); metaDataAndClassesScrollPane.setViewportView(metadataAndClassesTable); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(jDORadioButton); buttonGroup.add(jPARadioButton); }
From source file:org.interreg.docexplore.authoring.AuthoringToolFrame.java
public AuthoringToolFrame(final DocExploreDataLink link, final Startup startup) throws Exception { super("Authoring Tool"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.startup = startup; this.displayHelp = startup.showHelp; startup.screen.setText("Initializing history"); this.historyManager = new HistoryManager(50, new File(DocExploreTool.getHomeDir(), ".at-cache")); this.historyDialog = new JDialog(this, XMLResourceBundle.getBundledString("generalHistory")); historyDialog.add(new HistoryPanel(historyManager)); historyDialog.pack();/*from w w w . j ava2 s . c o m*/ setJMenuBar(this.menu = new AuthoringMenu(this)); startup.screen.setText("Initializing plugins"); plugins = new Vector<MetaDataPlugin>(); List<PluginConfig> pluginConfigs = startup.filterPlugins(MetaDataPlugin.class); for (PluginConfig config : pluginConfigs) { MetaDataPlugin plugin = null; if ((plugin = (MetaDataPlugin) config.clazz.newInstance()) != null) { plugins.add(plugin); plugin.setHost(config.jarFile, config.dependencies); System.out.println( "Loaded plugin '" + plugin.getName() + "' (" + plugin.getClass().getSimpleName() + ")"); } } startup.screen.setText("Initializing filters"); //filter = new FilterPanel(link); this.importOptions = new ImportOptions(this); startup.screen.setText("Initializing styles"); this.styleManager = new StyleManager(this); startup.screen.setText("Creating explorer data link"); this.linkExplorer = new DataLinkExplorer(this, link, null); //linkExplorer.toolPanel.add(filter); //linkExplorer.setFilter(filter); startup.screen.setText("Creating explorer"); //this.fileExplorer = new FileExplorer(this); this.explorer = new JPanel(new BorderLayout()); explorer.add( new JLabel("<html><font style=\"font-size:16\">" + XMLResourceBundle.getBundledString("generalLibraryLabel") + "</font></html>"), BorderLayout.NORTH); explorer.add(linkExplorer, BorderLayout.CENTER); //explorer.addTab(XMLResourceBundle.getBundledString("generalFilesLabel"), fileExplorer); startup.screen.setText("Creating editor data link"); recovery = defaultFile.exists(); DataLink fslink = new DataLinkFS2Source(defaultFile.getAbsolutePath()).getDataLink(); fslink.setProperty("autoWrite", false); final DocExploreDataLink editorLink = new DocExploreDataLink(); final JLabel titleLabel = new JLabel(); editorLink.addListener(new DocExploreDataLink.Listener() { public void dataLinkChanged(DataLink link) { String bookName = ""; try { List<Integer> books = editorLink.getLink().getAllBookIds(); if (!books.isEmpty()) { Book book = editorLink.getBook(books.get(0)); bookName = book.getName(); MetaDataKey key = editorLink.getOrCreateKey("styles", ""); List<MetaData> mds = book.getMetaDataListForKey(key); MetaData md = null; if (mds.isEmpty()) { md = new MetaData(editorLink, key, ""); book.addMetaData(md); } else md = mds.get(0); styleManager.setMD(md); } } catch (Exception e) { e.printStackTrace(); } String linkTitle = menu.curFile == null ? null : menu.curFile.getAbsolutePath(); titleLabel.setText("<html><font style=\"font-size:14\">" + XMLResourceBundle.getBundledString("generalPresentationLabel") + " : <b>" + bookName + "</b>" + (linkTitle != null ? " (" + linkTitle + ")" : "") + "</font></html>"); setTitle(XMLResourceBundle.getBundledString("frameTitle") + " " + (linkTitle != null ? linkTitle : "")); historyManager.reset(-1); repaint(); } }); editorLink.setLink(fslink); startup.screen.setText("Creating editor"); this.editor = new DataLinkExplorer(this, editorLink, new BookImporter()); for (ExplorerView view : editor.views) if (view instanceof PageEditorView) { this.mdEditor = new MetaDataEditor(((PageEditorView) view).editor); } editor.addListener(new Explorer.Listener() { @Override public void exploringChanged(Object object) { try { boolean isRegion = object instanceof Region; int div = splitPane.getDividerLocation(); mdEditor.setDocument(null); if (isRegion) mdEditor.setDocument((Region) object); if (isRegion != regionMode) splitPane.setRightComponent(isRegion ? mdEditor : explorer); regionMode = isRegion; validate(); splitPane.setDividerLocation(div); } catch (Exception e) { ErrorHandler.defaultHandler.submit(e); } } }); final JButton editBook = new JButton(new AbstractAction("", ImageUtils.getIcon("pencil-24x24.png")) { @Override public void actionPerformed(ActionEvent e) { try { Book book = editorLink.getBook(editorLink.getLink().getAllBookIds().get(0)); String name = JOptionPane.showInputDialog(AuthoringToolFrame.this, XMLResourceBundle.getBundledString("collectionAddBookMessage"), book.getName()); if (name == null) return; book.setName(name); editorLink.notifyDataLinkChanged(); editor.refreshPath(); } catch (Exception ex) { ErrorHandler.defaultHandler.submit(ex); } } }); editBook.setToolTipText(XMLResourceBundle.getBundledString("generalToolbarEdit")); this.splitPane = new JSplitPane(); JPanel editorPanel = new JPanel(new BorderLayout()); JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); titlePanel.add(titleLabel); titlePanel.add(editBook); //editorPanel.add(titlePanel, BorderLayout.NORTH); editorPanel.add(editor, BorderLayout.CENTER); splitPane.setLeftComponent(editorPanel); splitPane.setRightComponent(explorer); getContentPane().setLayout(new BorderLayout()); add(titlePanel, BorderLayout.NORTH); add(splitPane, BorderLayout.CENTER); this.clipboard = new MetaDataClipboard(this, new File(DocExploreTool.getHomeDir(), ".at-clipboard")); startup.screen.setText("Initializing exporter"); this.readerExporter = new ReaderExporter(this); this.webExporter = new WebExporter(this); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quit(); } public void windowOpened(WindowEvent e) { splitPane.setDividerLocation(getWidth() / 2); } }); this.oldSize = getWidth(); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { splitPane.setDividerLocation(splitPane.getDividerLocation() * getWidth() / oldSize); oldSize = getWidth(); } }); }