Commit 0b1f2dd7 authored by Omar ALQAWASMEH's avatar Omar ALQAWASMEH
Browse files

GUI feautres implemented

parent b02b5075
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@
package fr.emse.gitlab.saref;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.text.DefaultCaret;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Layout;
@@ -107,9 +109,9 @@ public class JTextAreaAppender extends AppenderSkeleton {
			}
		}
		// scroll TextArea
		jTextArea.setCaretPosition(jTextArea.getText().length());
		
//		jTextArea.setCaretPosition(jTextArea.getText().length());
		jTextArea.update(jTextArea.getGraphics());
//		jTextArea.setCaretPosition(jTextArea.getDocument().getLength() - 1);

	}

+38 −22
Original line number Diff line number Diff line
@@ -126,11 +126,16 @@ public class Main {
	static boolean fileSelected = false;

	private static JTextArea txtConsole = new JTextArea("Select a directory to start\n");
	private static JScrollPane scroll = new JScrollPane();
	private static JFrame frame = new JFrame();
	private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4));
	private static JPanel infoPanel = new JPanel();
	private static JPanel textAreaPanel = new JPanel();
	public static boolean isTheConsoleActive = true;
	private static String lastPath;
	private static JFileChooser fileChooser;
	
	
	
	public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException,
			ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException,
@@ -267,16 +272,17 @@ public class Main {
		JLabel emptylbl3 = new JLabel();
		functionalitiesPanel.add(emptylbl3);

		JCheckBox ignoreGit_checkBox = new JCheckBox("No-git");
		ignoreGit_checkBox.setToolTipText("Only check the current state of the repository");
		ignoreGit_checkBox.setSelected(true);
		functionalitiesPanel.add(ignoreGit_checkBox);

		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"
				+ " Used to generate the website for several extensions.");
		functionalitiesPanel.add(remoteOnly_checkBox);

		JCheckBox ignoreGit_checkBox = new JCheckBox("No-git");
		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");
@@ -305,31 +311,39 @@ public class Main {
		JLabel emptylbl5 = new JLabel();
		functionalitiesPanel.add(emptylbl5);

//		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");

		JButton fileChooserBtn = new JButton("Choose a directory");
		fileChooserBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				JFileChooser fileChooser = new JFileChooser();
				
				if(lastPath!=null) {
					
					fileChooser = new JFileChooser(lastPath);
					
				}
				else {
					fileChooser = new JFileChooser();
				}
				
				fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
				int option = fileChooser.showOpenDialog(frame);
				if (option == JFileChooser.APPROVE_OPTION) {
					directory = fileChooser.getSelectedFile();
					fileSelected = true;
					startBtn.setEnabled(true);
					lblWelcomeToSarefpipeline.setText("SAREF ontologies pipeline tests for directory: " + directory);
					
					//lastPath=directory.getParentFile();
					
					lastPath=directory.getAbsolutePath();
					
				} else {
					LOG.info("Open command canceled");
				}

			
			
			}

		});
@@ -385,7 +399,6 @@ public class Main {
						e1.printStackTrace();
					}

					
					try {
						dataset = createFreshDataset();
					} catch (IOException e1) {
@@ -469,10 +482,12 @@ public class Main {
		frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER);
		txtConsole.setColumns(70);
		txtConsole.setRows(15);

		textAreaPanel.add(txtConsole);

		JScrollPane scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
		scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
				JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

		frame.add(scroll);

		frame.pack();
@@ -666,8 +681,9 @@ public class Main {
			LOG.error("Exception:", ex);
			ex.printStackTrace();
		}

		LOG.info(lastPath+ "\t\t omar");
		if (!isTheConsoleActive) {
			
			System.exit(code);
		}
	}
−2.38 KiB
Loading image diff...
−2.97 KiB
Loading image diff...