diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..69ca266 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_miglayout_miglayout_core_5_0.xml b/.idea/libraries/Maven__com_miglayout_miglayout_core_5_0.xml new file mode 100644 index 0000000..64c5967 --- /dev/null +++ b/.idea/libraries/Maven__com_miglayout_miglayout_core_5_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_miglayout_miglayout_swing_5_0.xml b/.idea/libraries/Maven__com_miglayout_miglayout_swing_5_0.xml new file mode 100644 index 0000000..017985c --- /dev/null +++ b/.idea/libraries/Maven__com_miglayout_miglayout_swing_5_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/com_miglayout_miglayout_core_5_0.xml b/.idea/libraries/com_miglayout_miglayout_core_5_0.xml new file mode 100644 index 0000000..fd1e7fb --- /dev/null +++ b/.idea/libraries/com_miglayout_miglayout_core_5_0.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/com_miglayout_miglayout_swing_5_0.xml b/.idea/libraries/com_miglayout_miglayout_swing_5_0.xml new file mode 100644 index 0000000..21ff453 --- /dev/null +++ b/.idea/libraries/com_miglayout_miglayout_swing_5_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5755a99 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..68a4735 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..84cb8e0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,1096 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1501077381099 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No facets are configured + + + + + + + + + + + + + + + 1.8 + + + + + + + + TravisCustomizer + + + + + + + + 1.8 + + + + + + + + com.miglayout:miglayout-swing:5.0 + + + + + + + + + + \ No newline at end of file diff --git a/TravisCustomizer.iml b/TravisCustomizer.iml new file mode 100644 index 0000000..40defe7 --- /dev/null +++ b/TravisCustomizer.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/miglayout-core-5.0.jar b/lib/miglayout-core-5.0.jar new file mode 100644 index 0000000..1211b70 Binary files /dev/null and b/lib/miglayout-core-5.0.jar differ diff --git a/lib/miglayout-swing-5.0.jar b/lib/miglayout-swing-5.0.jar new file mode 100644 index 0000000..6a4df96 Binary files /dev/null and b/lib/miglayout-swing-5.0.jar differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..93f660d --- /dev/null +++ b/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.traviscustomizer + TravisCustomizer + 0.1-SNAPSHOT + + + + com.miglayout + miglayout-core + 5.0 + provided + + + com.miglayout + miglayout-swing + 5.0 + provided + + + + \ No newline at end of file diff --git a/src/main/java/NewFileWindow.java b/src/main/java/NewFileWindow.java new file mode 100644 index 0000000..c8aee98 --- /dev/null +++ b/src/main/java/NewFileWindow.java @@ -0,0 +1,192 @@ +import Panels.BeforeInstallPanel; +import Panels.InstallPanel; +import Panels.PreStepsPanel; +import Panels.StepPanel; + +import javax.swing.*; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.*; +import java.util.List; + + +/** + * Created by Cesar on 28/07/2017. + */ +public class NewFileWindow extends JFrame implements MouseListener { + + + public static String TITLE = "Creating new Travis File"; + + private DefaultMutableTreeNode travis, previousSteps, lifeCycle, beforeInstall, install, beforeScript, + script, afterSuccess, afterFailure, beforeDeploy, deploy, afterDeploy, afterScript, mailNotifications; + + private TreeModel treeModel; + private JTree lifeCycleTree; + + private JPanel lifeCyclePanel, currentStepPanel; + private List panelList; + + private PreStepsPanel preStepsPanel; + private BeforeInstallPanel beforeInstallPanel; + private InstallPanel installPanel; + + private CardLayout cl; + + private static String beforeInstallPath = "[YAML File, Life Cycle, Before Install]"; + private static String installPath = "[YAML File, Life Cycle, Install]"; + private static String beforeScriptPath = "[YAML File, Life Cycle, Before Script]"; + private static String scriptPath = "[YAML File, Life Cycle, Script]"; + private static String afterSuccessPath = "[YAML File, Life Cycle, After Success]"; + private static String afterFailurePath = "[YAML File, Life Cycle, After Failure]"; + private static String beforeDeployPath = "[YAML File, Life Cycle, Before Deploy]"; + private static String deployPath = "[YAML File, Life Cycle, Deploy]"; + private static String afterDeployPath = "[YAML File, Life Cycle, After Deploy]"; + private static String afterScriptPath = "[YAML File, Life Cycle, After Script]"; + + private static String previousStepsPath = "[YAML File, Previous Steps]"; + private static String lifeCyclePath = "[YAML File, Life Cycle]"; + private static String mailNotificationsPath = "[YAML File, Mail Notifications]"; + + + public NewFileWindow() + { + super(TITLE); + initializeComponents(); + this.setExtendedState(MAXIMIZED_BOTH); + } + + private void initializeComponents() + { + panelList = new ArrayList(); + currentStepPanel = new JPanel(); + lifeCyclePanel = new JPanel(); + + preStepsPanel = new PreStepsPanel(); + beforeInstallPanel = new BeforeInstallPanel(); + installPanel = new InstallPanel(); + + panelList.add(preStepsPanel); + panelList.add(beforeInstallPanel); + panelList.add(installPanel); + + + travis = new DefaultMutableTreeNode("YAML File"); + previousSteps = new DefaultMutableTreeNode("Previous Steps"); + lifeCycle = new DefaultMutableTreeNode("Life Cycle"); + beforeInstall = new DefaultMutableTreeNode("Before Install"); + install = new DefaultMutableTreeNode("Install"); + beforeScript = new DefaultMutableTreeNode("Before Script"); + script = new DefaultMutableTreeNode("Script"); + afterSuccess = new DefaultMutableTreeNode("After Success"); + afterFailure = new DefaultMutableTreeNode("After Failure"); + beforeDeploy = new DefaultMutableTreeNode("Before Deploy"); + deploy = new DefaultMutableTreeNode("Deploy"); + afterDeploy = new DefaultMutableTreeNode("After Deploy"); + afterScript = new DefaultMutableTreeNode("After Script"); + mailNotifications = new DefaultMutableTreeNode("Mail Notifications"); + + lifeCycle.add(beforeInstall); + lifeCycle.add(install); + lifeCycle.add(beforeScript); + lifeCycle.add(script); + lifeCycle.add(afterSuccess); + lifeCycle.add(afterFailure); + lifeCycle.add(beforeDeploy); + lifeCycle.add(deploy); + lifeCycle.add(afterDeploy); + lifeCycle.add(afterScript); + + travis.add(previousSteps); + travis.add(lifeCycle); + travis.add(mailNotifications); + + treeModel = new DefaultTreeModel(travis); + lifeCycleTree = new JTree(treeModel); + + lifeCycleTree.addMouseListener(this); + + + this.setLayout(new BorderLayout()); + currentStepPanel.setLayout(new CardLayout()); + lifeCyclePanel.add(lifeCycleTree); + this.add(lifeCyclePanel, BorderLayout.WEST); + currentStepPanel.add(new JPanel(), "Default Panel"); + currentStepPanel.add(preStepsPanel, "Pre Steps Panel"); + currentStepPanel.add(beforeInstallPanel, "Before Install Panel"); + currentStepPanel.add(installPanel, "Install Panel"); + this.add(currentStepPanel, BorderLayout.CENTER); + + } + + + public void mouseClicked(MouseEvent e) + { + TreePath tp = lifeCycleTree.getPathForLocation(e.getX(), e.getY()); + + if (tp != null) + { + String step = tp.toString(); + cl = (CardLayout)(currentStepPanel.getLayout()); + + if (step.equals(previousStepsPath)) + cl.show(currentStepPanel, "Pre Steps Panel"); + + else if (step.equals(beforeInstallPath)) + cl.show(currentStepPanel, "Before Install Panel"); + + else if (step.equals(installPath)) + cl.show(currentStepPanel, "Install Panel"); + + else if (step.equals(beforeScriptPath)) + System.out.println("BEFORE SCRIPT"); + + else if (step.equals(scriptPath)) + System.out.println("SCRIPT"); + + else if (step.equals(afterSuccessPath)) + System.out.println("AFTER SUCCESS"); + + else if (step.equals(afterFailurePath)) + System.out.println("AFTER FAILURE"); + + else if (step.equals(beforeDeployPath)) + System.out.println("BEFORE DEPLOY"); + + else if (step.equals(deployPath)) + System.out.println("DEPLOY"); + + else if (step.equals(afterDeployPath)) + System.out.println("AFTER DEPLOY"); + + else if (step.equals(afterScriptPath)) + System.out.println("AFTER SCRIPT"); + + else if (step.equals(mailNotificationsPath)) + System.out.println("MAIL NOTIFICATIONS"); + + } + + } + + public void mousePressed(MouseEvent e) { + + } + + public void mouseReleased(MouseEvent e) { + + } + + public void mouseEntered(MouseEvent e) { + + } + + public void mouseExited(MouseEvent e) { + + } +} diff --git a/src/main/java/Panels/BeforeInstallPanel.java b/src/main/java/Panels/BeforeInstallPanel.java new file mode 100644 index 0000000..f356953 --- /dev/null +++ b/src/main/java/Panels/BeforeInstallPanel.java @@ -0,0 +1,68 @@ +package Panels; + +import net.miginfocom.swing.MigLayout; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Cesar on 28/07/2017. + */ +public class BeforeInstallPanel extends StepPanel { + + + public static String STEP = "BEFORE INSTALL"; + public static String HELP = "Write the path(s) of the file(s) you want to assign execution permission. If more than one, separate the paths with %"; + private JLabel helpLabel; + + private JTextField permissionField; + + public BeforeInstallPanel() + { + super(STEP); + + } + + + protected void initializeComponents() + { + helpLabel = new JLabel(HELP); + permissionField = new JTextField(); + + centerPane.add(helpLabel,"spanx"); + //add(txt_file, "grow, spanx"); + centerPane.add(permissionField, "grow, spanx"); + centerPane.add(new JLabel("Filtering Options"), "top, growx, spanx 2, wrap, wmin 100"); + //add(andButton,"wrap"); + //add(orButton, "wrap"); + centerPane.add(new JLabel("Filters"), "spanx 3, wrap"); + //add(deleteAll); + //add(activeAll); + //add(deactiveAll, "spanx 3, wrap"); + //add(new JScrollPane(filtersTable), "spanx 3, grow, wrap"); + //add(new JScrollPane(descriptionArea),"spanx 3, grow, wrap"); + //add(filtersLabel, "spanx 3, wrap"); + //add(new JScrollPane(parametersTable),"spanx 3, grow, wrap"); + + } + + //Parsear la informaciĆ³n del JTextField para escribir correctamente en travis + public String getInfo() + { + String [] paths = permissionField.getText().split("%"); + String info = "before_install:\n"; + if(paths.length > 0) + { + for(int i = 0; i < paths.length; i++) + { + if (i == paths.length - 1) + info = info + "chmod +x "+paths[i]+"\n"; + else + info = info + "chmod +x "+paths[i]+" && "; + } + } + + return info; + } + +} diff --git a/src/main/java/Panels/ImagePanel.java b/src/main/java/Panels/ImagePanel.java new file mode 100644 index 0000000..9c32438 --- /dev/null +++ b/src/main/java/Panels/ImagePanel.java @@ -0,0 +1,33 @@ +package Panels; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Cesar on 01/08/2017. + */ +public class ImagePanel extends JPanel { + + public String imagePath; + Image image; + + public ImagePanel(String imagePath){ + this.imagePath = imagePath; + image = new ImageIcon(imagePath).getImage(); + + } + + @Override + public void paint(Graphics g) + { + super.paint(g); + if(image != null){ + g.drawImage(image, 0, 0, getWidth(),getHeight(),this); + + setOpaque(false); + }else{ + setOpaque(true); + } + } + +} diff --git a/src/main/java/Panels/InstallPanel.java b/src/main/java/Panels/InstallPanel.java new file mode 100644 index 0000000..d540fca --- /dev/null +++ b/src/main/java/Panels/InstallPanel.java @@ -0,0 +1,92 @@ +package Panels; + +import net.miginfocom.swing.MigLayout; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Cesar on 01/08/2017. + */ +public class InstallPanel extends StepPanel +{ + public static String STEP = "INSTALL"; + public static String HELP = "Write the command you want to execute. If you want to execute more than one, click the button"; + private JLabel helpLabel; + private JButton addButton; + + private JTextField commandField; + private List fieldList; + + public InstallPanel() + { + super(STEP); + + } + + + protected void initializeComponents() + { + helpLabel = new JLabel(HELP); + commandField = new JTextField(); + fieldList = new ArrayList(); + fieldList.add(commandField); + + addButton = new JButton("Add new command"); + addButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + addTextField(); + } + }); + + centerPane.add(helpLabel,"spanx"); + //add(txt_file, "grow, spanx"); + centerPane.add(addButton,"wrap"); + centerPane.add(new JLabel("Write the command"), "spanx 3, wrap"); + centerPane.add(commandField, "grow, spanx"); + //add(orButton, "wrap"); + + //add(deleteAll); + //add(activeAll); + //add(deactiveAll, "spanx 3, wrap"); + //add(new JScrollPane(filtersTable), "spanx 3, grow, wrap"); + //add(new JScrollPane(descriptionArea),"spanx 3, grow, wrap"); + //add(filtersLabel, "spanx 3, wrap"); + //add(new JScrollPane(parametersTable),"spanx 3, grow, wrap"); + + + } + + private void addTextField() + { + centerPane.add(new JLabel("Write the command"), "spanx 3, wrap"); + JTextField newField = new JTextField(); + fieldList.add(newField); + centerPane.add(newField, "grow, spanx"); + this.updateUI(); + + } + + public String getInfo() + { + String info = "install:\n"; + if(fieldList.size() > 0) + { + for(JTextField tf : fieldList) + { + info = info + "- "+tf.getText()+"\n"; + } + } + else + info += "true\n"; + + return info; + } + +} diff --git a/src/main/java/Panels/PreStepsPanel.java b/src/main/java/Panels/PreStepsPanel.java new file mode 100644 index 0000000..a0f2ca9 --- /dev/null +++ b/src/main/java/Panels/PreStepsPanel.java @@ -0,0 +1,223 @@ +package Panels; + +import net.miginfocom.swing.MigLayout; + +import javax.swing.*; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.DefaultTableModel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Cesar on 01/08/2017. + */ +public class PreStepsPanel extends StepPanel +{ + public static String STEP = "PRE STEPS"; + public static String [] LANGUAGE_OPTIONS = new String[]{"Java","Ruby"}; + public static String [] TABLE_HEADER = new String[]{"Variable","Value"}; + private JComboBox languageBox; + private JPanel languageOptionsPanel, newVarPane; + private JCheckBox sudoBox; + private String selectedLanguage; + private JTable envTable; + private JScrollPane scroll; + private DefaultTableModel envTableModel; + private JButton addVarButton, removeVarButton, removeAllVarButton; + private JTextField varNameField, varValueField, jdkVersionField; + + private Map var2valueMap; + + public PreStepsPanel() + { + super(STEP); + } + + protected void initializeComponents() + { + selectedLanguage = LANGUAGE_OPTIONS[0]; + varNameField = new JTextField(20); + varValueField = new JTextField(20); + jdkVersionField = new JTextField(20); + var2valueMap = new HashMap(); + languageBox = new JComboBox(); + languageOptionsPanel = new JPanel(); + languageOptionsPanel.setLayout(new MigLayout("", "[][grow][]", "[][][][][grow]")); + newVarPane = new JPanel(); + sudoBox = new JCheckBox(); + for(String option : LANGUAGE_OPTIONS) + languageBox.addItem(option); + + languageOptionsPanel.add(new JLabel("Choose your JDK version (default 1.8)"),"spanx"); + languageOptionsPanel.add(jdkVersionField,"spanx 3, wrap"); + + newVarPane.add(new JLabel("Name")); + newVarPane.add(varNameField); + newVarPane.add(Box.createHorizontalStrut(30)); + newVarPane.add(new JLabel("Value")); + newVarPane.add(varValueField); + + addVarButton = new JButton("Add variable"); + addVarButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int result = JOptionPane.showConfirmDialog(null, newVarPane, "Enter new variable name and value", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (result != JOptionPane.OK_OPTION) return; + + var2valueMap.put(varNameField.getText(), varValueField.getText()); + updateEnvironmentVariablesTable(); + + varNameField.setText(""); + varValueField.setText(""); + + } + }); + removeVarButton = new JButton("Remove selected variable"); + removeVarButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + + int selectedRow = envTable.getSelectedRow(); + String selectedVar = (String)envTable.getModel().getValueAt(selectedRow,0); + var2valueMap.remove(selectedVar); + updateEnvironmentVariablesTable(); + } + }); + removeAllVarButton = new JButton("Remove all variables"); + removeAllVarButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + + var2valueMap.clear(); + updateEnvironmentVariablesTable(); + } + }); + + envTableModel = new DefaultTableModel(TABLE_HEADER,0); + envTable = new JTable(envTableModel); + scroll = new JScrollPane(envTable); + + envTableModel.addTableModelListener(new TableModelListener() + { + public void tableChanged(TableModelEvent e) + { + var2valueMap.clear(); + String var, value; + for(int j = 0; j < envTable.getModel().getRowCount(); j++) + { + var = (String)envTableModel.getValueAt(j,0); + value = (String)envTableModel.getValueAt(j,1); + var2valueMap.put(var,value); + } + } + }); + + centerPane.add(new JLabel("Choose your project's language"),"spanx"); + //add(txt_file, "grow, spanx"); + centerPane.add(languageBox,"wrap"); + centerPane.add(new JScrollPane(languageOptionsPanel),"spanx 3, growx, wrap"); + // centerPane.add(commandField, "grow, spanx"); + + centerPane.add(new JLabel("Check if you need root permission")); + centerPane.add(sudoBox, "wrap"); + //add(deleteAll); + //add(activeAll); + //add(deactiveAll, "spanx 3, wrap"); + //add(new JScrollPane(filtersTable), "spanx 3, grow, wrap"); + //add(new JScrollPane(descriptionArea),"spanx 3, grow, wrap"); + //add(filtersLabel, "spanx 3, wrap"); + centerPane.add(new JLabel("Environment variables"),"spanx"); + centerPane.add(addVarButton); + centerPane.add(removeVarButton); + centerPane.add(removeAllVarButton, "spanx 3, wrap"); + centerPane.add(scroll, "spanx 3, grow, wrap"); + + languageBox.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + + languageOptionsPanel.removeAll(); + selectedLanguage = (String)e.getItem(); + if(selectedLanguage.equals("Java")) + { + languageOptionsPanel.add(new JLabel("Choose your JDK version (default 1.8)"),"spanx"); + languageOptionsPanel.add(jdkVersionField,"spanx 3, wrap"); + } + + else if(selectedLanguage.equals("Ruby")) + { + languageOptionsPanel.add(new JLabel("RUBYYYY")); + } + + else + languageOptionsPanel.add(new JLabel("UNKNOWN LANGUAGE")); + + languageOptionsPanel.updateUI(); + } + }); + + + } + + private void updateEnvironmentVariablesTable() + { + int numberOfVariables = var2valueMap.size(); + Object[][] newData = new Object[numberOfVariables][2]; + int counter = 0; + for(Map.Entry entry : var2valueMap.entrySet()) + { + newData[counter][0] = entry.getKey(); + newData[counter][1] = entry.getValue(); + counter++; + } + + ((DefaultTableModel)envTable.getModel()).setDataVector(newData, TABLE_HEADER); + } + + public String getInfo() + { + String info = ""; + info += "language: "+selectedLanguage.toLowerCase()+"\n"; + + if(selectedLanguage.equals("Java")) + { + if(jdkVersionField.getText().equals("")) + info += "jdk: 1.8\n"; + else + info += "jdk: "+jdkVersionField.getText()+"\n"; + } + + else if(selectedLanguage.equals("Ruby")) + { + + } + + else + { + + } + + + if(sudoBox.isSelected()) + info += "sudo: required\n"; + + else + info += "sudo: false"; + + info += "env:\n"; + + for(int i = 0; i < envTable.getRowCount(); i++) + info += "- "+envTable.getModel().getValueAt(i,0)+"=:"+envTable.getModel().getValueAt(i,1)+"\n"; + + return info; + } +} diff --git a/src/main/java/Panels/StepPanel.java b/src/main/java/Panels/StepPanel.java new file mode 100644 index 0000000..d2d4d19 --- /dev/null +++ b/src/main/java/Panels/StepPanel.java @@ -0,0 +1,53 @@ +package Panels; + +import net.miginfocom.swing.MigLayout; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by Cesar on 29/07/2017. + */ +public abstract class StepPanel extends JPanel +{ + + private String info; + private JButton saveButton; + private JPanel buttonPanel, titlePanel; + protected JPanel centerPane; + + public StepPanel(String step) + { + info = "default"; + this.setLayout(new BorderLayout()); + JLabel label = new JLabel(step+" STEP"); + buttonPanel = new JPanel(); + titlePanel = new JPanel(); + centerPane = new JPanel(); + titlePanel.setBackground(Color.YELLOW); + centerPane.setLayout(new MigLayout("", "[][grow][]", "[][][][][grow]")); + initializeComponents(); + saveButton = new JButton("Save"); + saveButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + info = getInfo(); + System.out.println(info); + } + }); + + buttonPanel.add(saveButton); + titlePanel.add(label); + this.add(buttonPanel, BorderLayout.SOUTH); + this.add(titlePanel, BorderLayout.NORTH); + this.add(new JScrollPane(centerPane), BorderLayout.CENTER); + } + + protected abstract void initializeComponents(); + public abstract String getInfo(); + +} diff --git a/src/main/java/TCInformation.java b/src/main/java/TCInformation.java new file mode 100644 index 0000000..eef65a4 --- /dev/null +++ b/src/main/java/TCInformation.java @@ -0,0 +1,12 @@ +/** + * Created by Cesar on 01/08/2017. + */ +public class TCInformation +{ + + public static String TCVersion = "0.1"; + private TCInformation() + { + + } +} diff --git a/src/main/java/TCLauncher.java b/src/main/java/TCLauncher.java new file mode 100644 index 0000000..36d163d --- /dev/null +++ b/src/main/java/TCLauncher.java @@ -0,0 +1,11 @@ +/** + * Created by Cesar on 26/07/2017. + */ +public class TCLauncher +{ + + public static void main (String [] args) + { + new TravisCustomizer(); + } +} diff --git a/src/main/java/TravisCustomizer.java b/src/main/java/TravisCustomizer.java new file mode 100644 index 0000000..6ab961e --- /dev/null +++ b/src/main/java/TravisCustomizer.java @@ -0,0 +1,79 @@ +import Panels.ImagePanel; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by Cesar on 26/07/2017. + */ +public class TravisCustomizer extends JFrame implements ActionListener +{ + + public static String TITLE = "Travis CI Customizer"; + + public static String ABOUT = "

Travis Customizer "+TCInformation.TCVersion+"

"; + + private JMenuBar menuBar; + private JMenu fileMenu; + private JMenuItem newFileItem, loadFileItem, closeItem; + private NewFileWindow nfWindow; + private ImagePanel imagePanel; + private JLabel aboutLabel; + + + public TravisCustomizer() + { + super(TITLE); + initializeComponents(); + setVisible(true); + this.setExtendedState(MAXIMIZED_BOTH); + this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } + + + private void initializeComponents() + { + this.setLayout(new BorderLayout()); + menuBar = new JMenuBar(); + fileMenu = new JMenu("File"); + newFileItem = new JMenuItem("New File"); + loadFileItem = new JMenuItem("Load File"); + closeItem = new JMenuItem("Close"); + + nfWindow = new NewFileWindow(); + + aboutLabel = new JLabel(ABOUT); + imagePanel = new ImagePanel("src/main/resources/TravisCustomizerLogo.png"); + + newFileItem.addActionListener(this); + loadFileItem.addActionListener(this); + closeItem.addActionListener(this); + + fileMenu.add(newFileItem); + fileMenu.add(loadFileItem); + fileMenu.add(closeItem); + menuBar.add(fileMenu); + setJMenuBar(menuBar); + this.add(imagePanel, BorderLayout.CENTER); + this.add(aboutLabel, BorderLayout.SOUTH); + + } + + public void actionPerformed(ActionEvent e) + { + + if(e.getSource() == closeItem) + askForClose(); + if(e.getSource() == newFileItem) + nfWindow.setVisible(true); + } + + + public static void askForClose() { + int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit Travis CI Customizer?", "Exit from Travis CI Customizer", JOptionPane.YES_NO_OPTION); + + if (result == JOptionPane.YES_OPTION) System.exit(0); + } +} diff --git a/src/main/resources/TravisCustomizerLogo.png b/src/main/resources/TravisCustomizerLogo.png new file mode 100644 index 0000000..8983be0 Binary files /dev/null and b/src/main/resources/TravisCustomizerLogo.png differ diff --git a/target/TravisCustomizer-0.1-SNAPSHOT.jar b/target/TravisCustomizer-0.1-SNAPSHOT.jar new file mode 100644 index 0000000..022d7d0 Binary files /dev/null and b/target/TravisCustomizer-0.1-SNAPSHOT.jar differ diff --git a/target/classes/NewFileWindow.class b/target/classes/NewFileWindow.class new file mode 100644 index 0000000..c083e10 Binary files /dev/null and b/target/classes/NewFileWindow.class differ diff --git a/target/classes/Panels/BeforeInstallPanel.class b/target/classes/Panels/BeforeInstallPanel.class new file mode 100644 index 0000000..909505f Binary files /dev/null and b/target/classes/Panels/BeforeInstallPanel.class differ diff --git a/target/classes/Panels/ImagePanel.class b/target/classes/Panels/ImagePanel.class new file mode 100644 index 0000000..03b8827 Binary files /dev/null and b/target/classes/Panels/ImagePanel.class differ diff --git a/target/classes/Panels/InstallPanel$1.class b/target/classes/Panels/InstallPanel$1.class new file mode 100644 index 0000000..7c9c855 Binary files /dev/null and b/target/classes/Panels/InstallPanel$1.class differ diff --git a/target/classes/Panels/InstallPanel.class b/target/classes/Panels/InstallPanel.class new file mode 100644 index 0000000..0af19ef Binary files /dev/null and b/target/classes/Panels/InstallPanel.class differ diff --git a/target/classes/Panels/PreStepsPanel$1.class b/target/classes/Panels/PreStepsPanel$1.class new file mode 100644 index 0000000..918f0ae Binary files /dev/null and b/target/classes/Panels/PreStepsPanel$1.class differ diff --git a/target/classes/Panels/PreStepsPanel$2.class b/target/classes/Panels/PreStepsPanel$2.class new file mode 100644 index 0000000..9d3a965 Binary files /dev/null and b/target/classes/Panels/PreStepsPanel$2.class differ diff --git a/target/classes/Panels/PreStepsPanel$3.class b/target/classes/Panels/PreStepsPanel$3.class new file mode 100644 index 0000000..2b2d2a8 Binary files /dev/null and b/target/classes/Panels/PreStepsPanel$3.class differ diff --git a/target/classes/Panels/PreStepsPanel$4.class b/target/classes/Panels/PreStepsPanel$4.class new file mode 100644 index 0000000..597589c Binary files /dev/null and b/target/classes/Panels/PreStepsPanel$4.class differ diff --git a/target/classes/Panels/PreStepsPanel$5.class b/target/classes/Panels/PreStepsPanel$5.class new file mode 100644 index 0000000..e096dae Binary files /dev/null and b/target/classes/Panels/PreStepsPanel$5.class differ diff --git a/target/classes/Panels/PreStepsPanel.class b/target/classes/Panels/PreStepsPanel.class new file mode 100644 index 0000000..229ec90 Binary files /dev/null and b/target/classes/Panels/PreStepsPanel.class differ diff --git a/target/classes/Panels/StepPanel$1.class b/target/classes/Panels/StepPanel$1.class new file mode 100644 index 0000000..0f08553 Binary files /dev/null and b/target/classes/Panels/StepPanel$1.class differ diff --git a/target/classes/Panels/StepPanel.class b/target/classes/Panels/StepPanel.class new file mode 100644 index 0000000..c441bc7 Binary files /dev/null and b/target/classes/Panels/StepPanel.class differ diff --git a/target/classes/TCInformation.class b/target/classes/TCInformation.class new file mode 100644 index 0000000..139bf57 Binary files /dev/null and b/target/classes/TCInformation.class differ diff --git a/target/classes/TCLauncher.class b/target/classes/TCLauncher.class new file mode 100644 index 0000000..548781e Binary files /dev/null and b/target/classes/TCLauncher.class differ diff --git a/target/classes/TravisCustomizer.class b/target/classes/TravisCustomizer.class new file mode 100644 index 0000000..75a134f Binary files /dev/null and b/target/classes/TravisCustomizer.class differ diff --git a/target/classes/TravisCustomizerLogo.png b/target/classes/TravisCustomizerLogo.png new file mode 100644 index 0000000..8983be0 Binary files /dev/null and b/target/classes/TravisCustomizerLogo.png differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..3273415 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Aug 01 11:17:36 CEST 2017 +version=0.1-SNAPSHOT +groupId=com.traviscustomizer +artifactId=TravisCustomizer diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..8fc9024 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,8 @@ +Panels\BeforeInstallPanel.class +Panels\StepPanel.class +NewFileWindow.class +TCLauncher.class +Panels\StepPanel$1.class +TCInformation.class +TravisCustomizer.class +Panels\ImagePanel.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..6a063b6 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,7 @@ +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\Panels\BeforeInstallPanel.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\Panels\StepPanel.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\TCInformation.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\TravisCustomizer.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\NewFileWindow.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\Panels\ImagePanel.java +C:\Users\Cesar\Desktop\TravisCustomizer\src\main\java\TCLauncher.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29