Commit d3d1dea4 authored by Omar ALQAWASMEH's avatar Omar ALQAWASMEH
Browse files

latest GUI

parent fe469887
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ public class JTextAreaAppender extends AppenderSkeleton {
		final String message = layout.format(event);
		jTextArea.append(message);

		// TODO do we need this code
		if (layout.ignoresThrowable()) {
			for (String throwableRow : ArrayUtils.nullToEmpty(event.getThrowableStrRep())) {
				jTextArea.append(throwableRow + NEW_LINE);
+41 −39
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
@@ -137,6 +138,7 @@ public class Main {
		if (isTheConsoleActive == true) {

			openConsole(); // open console

		}

		else {
@@ -220,12 +222,26 @@ public class Main {
		loggerBase.addAppender(appender);
	}

	private static void setGUIAppenders() throws IOException {

		JTextAreaAppender jTextAreaAppender = new JTextAreaAppender(txtConsole);

		org.apache.log4j.Logger appenderRootLogger = org.apache.log4j.Logger.getRootLogger();

		Layout GUIlayout = new PatternLayout("%d{mm:ss,SSS} %t %-5p %c:%L - %m%n");

		jTextAreaAppender.setLayout(GUIlayout);

		appenderRootLogger.addAppender(jTextAreaAppender);

	}

	private static boolean openConsole() throws IOException, InterruptedException, URISyntaxException, JAXBException,
			ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException,
			CheckoutConflictException, GitAPIException {

		setGUIAppenders();

//LOG.info("Select a directory to start");
//		JFrame.setDefaultLookAndFeelDecorated(true);

		frame = new JFrame("Saref-Pipeline tests");
@@ -239,8 +255,6 @@ public class Main {

		frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH);

//JLabel argsLbl = new JLabel("Please choose among the arguments:");
//functionalitiesPanel.add(argsLbl);
		JLabel lbl = new JLabel("The list of arguments:");
		functionalitiesPanel.add(lbl);

@@ -253,7 +267,6 @@ public class Main {
		JLabel emptylbl3 = new JLabel();
		functionalitiesPanel.add(emptylbl3);

		
		JCheckBox remoteOnly_checkBox = new JCheckBox("Remote-only");
		remoteOnly_checkBox.setToolTipText("Do not check the directory itself.\n"
				+ " Only consider the repositories listed in the `.saref-repositories.yml` document.\n"
@@ -264,9 +277,9 @@ public class Main {
		ignoreGit_checkBox.setToolTipText("Only check the current state of the repository");
		functionalitiesPanel.add(ignoreGit_checkBox);


		JCheckBox includeMaster_checkBox = new JCheckBox("Include master");
		includeMaster_checkBox.setToolTipText("Check the master branches of the remote repositories listed in the `.saref-repositories.yml` document");
		includeMaster_checkBox.setToolTipText(
				"Check the master branches of the remote repositories listed in the `.saref-repositories.yml` document");
		functionalitiesPanel.add(includeMaster_checkBox);

		JCheckBox generateSite_checkBox = new JCheckBox("Don't generate site");
@@ -286,7 +299,6 @@ public class Main {
		ignoreTerms_checkBox.setToolTipText("Do not generate the website for terms");
		functionalitiesPanel.add(ignoreTerms_checkBox);

		
		JLabel emptylbl4 = new JLabel();
		functionalitiesPanel.add(emptylbl4);

@@ -295,6 +307,12 @@ public class Main {

//		JButton startBtn = new JButton("Start the pipeline");

//		JProgressBar bar = new JProgressBar();
//		bar.setIndeterminate(true);
//		bar.setStringPainted(true);
//		bar.setString("Please wait");
//		bar.setVisible(false);
//		functionalitiesPanel.add(bar);

		JButton startBtn = new JButton("Start the pipeline");

@@ -306,13 +324,10 @@ public class Main {
				int option = fileChooser.showOpenDialog(frame);
				if (option == JFileChooser.APPROVE_OPTION) {
					directory = fileChooser.getSelectedFile();

//			directory = new File(dirName).getCanonicalFile();

					fileSelected = true;
					startBtn.setEnabled(true);
				} else {
					System.out.println("Open command canceled");
					LOG.info("Open command canceled");
				}

			}
@@ -321,17 +336,17 @@ public class Main {
		functionalitiesPanel.add(fileChooserBtn);

		startBtn.setEnabled(false);
		
		
		
		startBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

				if (fileSelected == true) {

					startBtn.setEnabled(true);

					if (!remoteOnly_checkBox.isSelected() && !ignoreGit_checkBox.isSelected()
							&& !includeMaster_checkBox.isSelected() && !generateSite_checkBox.isSelected()
							&& !ignoreExamples_checkBox.isSelected() && !verbose_checkBox.isSelected()) {
							&& !ignoreExamples_checkBox.isSelected() && !verbose_checkBox.isSelected()
							&& !ignoreTerms_checkBox.isSelected()) {

						LOG.error("Please choose among the different options");
						return;
@@ -444,19 +459,6 @@ public class Main {
		return true;
	}

	private static void setGUIAppenders() throws IOException {

		JTextAreaAppender jTextAreaAppender = new JTextAreaAppender(txtConsole);

		org.apache.log4j.Logger appenderRootLogger = org.apache.log4j.Logger.getRootLogger();

		Layout GUIlayout = new PatternLayout("%d{mm:ss,SSS} %t %-5p %c:%L - %m%n");

		jTextAreaAppender.setLayout(GUIlayout);

		appenderRootLogger.addAppender(jTextAreaAppender);
	}

// ************************************************
	private static void prepareDirectory() throws IOException {
		target = new File(directory, Constants.TARGET_DIR);