move folders
@@ -0,0 +1,99 @@
|
||||
package org.diylc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.PropertyInjector;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.gui.MainFrame;
|
||||
import org.diylc.swing.gui.TemplateDialog;
|
||||
|
||||
/**
|
||||
* Main class that runs DIYLC.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*
|
||||
* @see Presenter
|
||||
* @see MainFrame
|
||||
*/
|
||||
public class DIYLCStarter {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(DIYLCStarter.class);
|
||||
|
||||
private static final String SCRIPT_RUN = "org.diylc.scriptRun";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
URL url = DIYLCStarter.class.getResource("log4j.properties");
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(url.openStream());
|
||||
PropertyConfigurator.configure(properties);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not initialize log4j configuration", e);
|
||||
}
|
||||
|
||||
LOG.debug("Java version: " + System.getProperty("java.runtime.version") + " by "
|
||||
+ System.getProperty("java.vm.vendor"));
|
||||
LOG.debug("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
||||
|
||||
LOG.info("Starting DIYLC with working directory " + System.getProperty("user.dir"));
|
||||
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not set Look&Feel", e);
|
||||
}
|
||||
|
||||
String val = System.getProperty(SCRIPT_RUN);
|
||||
if (!"true".equals(val)) {
|
||||
int response =
|
||||
JOptionPane.showConfirmDialog(null, "It is not recommended to run DIYLC by clicking on the diylc.jar file.\n"
|
||||
+ "Please use diylc.exe on Windows or run.sh on OSX/Linux to ensure the best\n"
|
||||
+ "performance and reliability. Do you want to continue?", "DIYLC", JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
if (response != JOptionPane.YES_OPTION) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
MainFrame mainFrame = new MainFrame();
|
||||
mainFrame.setLocationRelativeTo(null);
|
||||
mainFrame.setVisible(true);
|
||||
if (args.length > 0) {
|
||||
mainFrame.getPresenter().loadProjectFromFile(args[0]);
|
||||
} else {
|
||||
boolean showTemplates = ConfigurationManager.getInstance().readBoolean(TemplateDialog.SHOW_TEMPLATES_KEY, true);
|
||||
if (showTemplates) {
|
||||
TemplateDialog templateDialog = new TemplateDialog(mainFrame, mainFrame.getPresenter());
|
||||
if (!templateDialog.getFiles().isEmpty()) {
|
||||
templateDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
properties = new Properties();
|
||||
try {
|
||||
LOG.info("Injecting default properties.");
|
||||
File f = new File("config.properties");
|
||||
if (f.exists()) {
|
||||
properties.load(new FileInputStream(f));
|
||||
PropertyInjector.injectProperties(properties);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not read config.properties file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.diylc.images;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
* Loads image resources as Icons.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public enum IconLoader {
|
||||
|
||||
Delete("delete.png"), Add("add.png"), FolderOut("folder_out.png"), Garbage("garbage.png"), DiskBlue("disk_blue.png"), SaveAs(
|
||||
"save_as.png"), Exit("exit.png"), DocumentPlainYellow("document_plain_yellow.png"), PhotoScenery(
|
||||
"photo_scenery.png"), LightBulbOn("lightbulb_on.png"), LightBulbOff("lightbulb_off.png"), NotebookAdd(
|
||||
"notebook_add.png"), FormGreen("form_green.png"), Gears("gears.png"), About("about.png"), WindowColors(
|
||||
"window_colors.png"), WindowGear("window_gear.png"), NavigateCheck("navigate_check.png"), Undo("undo.png"), Error(
|
||||
"error.png"), Warning("warning.png"), ZoomSmall("zoom_small.png"), MoveSmall("move_small.png"), Print("print.png"), PDF(
|
||||
"pdf.png"), Excel("excel.png"), CSV("csv.png"), HTML("html.png"), Image("image.png"), Cut("cut.png"), Copy(
|
||||
"copy.png"), Paste("paste.png"), Selection("selection.png"), BOM("bom.png"), BlackBoard("blackboard.png"), IdCard(
|
||||
"id_card.png"), IdCardAdd("id_card_add.png"), Chest("chest.png"), Upload("upload.png"), Wrench("wrench.png"), Group(
|
||||
"group.png"), Ungroup("ungroup.png"), TraceMask("trace_mask.png"), Faq("faq.png"), Component("component.png"), Plugin(
|
||||
"plugin.png"), Manual("manual.png"), Donate("donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
|
||||
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
|
||||
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png"), Pens("pens.png"), Sort("sort.png"), ElementsSelection(
|
||||
"elements_selection.png"), BranchAdd("branch_add.png"), BriefcaseAdd("briefcase_add.png"), BriefcaseInto(
|
||||
"briefcase_into.png"), RotateCW("rotate_cw.png"), RotateCCW("rotate_ccw.png"), ElementInto("element_into.png"), Arrow(
|
||||
"arrow.png"), Cloud("cloud.png"), CloudUp("cloud_up.png"), CloudGear("cloud_gear.png"), IdCardEdit(
|
||||
"id_card_edit.png"), KeyEdit("key_edit.png"), Find("find.png"), Dashboard("dashboard.png"), DataFind(
|
||||
"data_find.png"), CloudDownload("cloud-download.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
private IconLoader(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
java.net.URL imgURL = getClass().getResource(name);
|
||||
if (imgURL != null) {
|
||||
return new ImageIcon(imgURL, name);
|
||||
} else {
|
||||
System.err.println("Couldn't find file: " + name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
BufferedImage img = null;
|
||||
try {
|
||||
img = ImageIO.read(getClass().getResourceAsStream(name));
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't find file: " + name);
|
||||
}
|
||||
return img;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 729 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 714 B |
|
After Width: | Height: | Size: 993 B |
|
After Width: | Height: | Size: 537 B |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 863 B |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 846 B |
|
After Width: | Height: | Size: 951 B |
|
After Width: | Height: | Size: 850 B |
|
After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 960 B |
|
After Width: | Height: | Size: 717 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 835 B |
|
After Width: | Height: | Size: 730 B |
|
After Width: | Height: | Size: 901 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 595 B |
|
After Width: | Height: | Size: 781 B |
|
After Width: | Height: | Size: 601 B |
|
After Width: | Height: | Size: 833 B |
|
After Width: | Height: | Size: 914 B |
|
After Width: | Height: | Size: 876 B |
|
After Width: | Height: | Size: 853 B |
|
After Width: | Height: | Size: 596 B |
|
After Width: | Height: | Size: 765 B |
|
After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 597 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 845 B |
|
After Width: | Height: | Size: 928 B |
|
After Width: | Height: | Size: 697 B |
|
After Width: | Height: | Size: 595 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 892 B |
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 834 B |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 990 B |
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 842 B |
|
After Width: | Height: | Size: 910 B |
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 694 B |
|
After Width: | Height: | Size: 773 B |
|
After Width: | Height: | Size: 535 B |
|
After Width: | Height: | Size: 1004 B |
|
After Width: | Height: | Size: 995 B |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 656 B |
|
After Width: | Height: | Size: 675 B |
|
After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 832 B |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 898 B |
|
After Width: | Height: | Size: 852 B |
|
After Width: | Height: | Size: 894 B |
|
After Width: | Height: | Size: 933 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 924 B |
|
After Width: | Height: | Size: 789 B |
|
After Width: | Height: | Size: 785 B |
|
After Width: | Height: | Size: 833 B |
|
After Width: | Height: | Size: 798 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 747 B |
|
After Width: | Height: | Size: 709 B |
|
After Width: | Height: | Size: 816 B |
|
After Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 922 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 835 B |
|
After Width: | Height: | Size: 895 B |
|
After Width: | Height: | Size: 947 B |
|
After Width: | Height: | Size: 863 B |
|
After Width: | Height: | Size: 849 B |
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 376 B |
|
After Width: | Height: | Size: 550 B |
|
After Width: | Height: | Size: 826 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 879 B |
|
After Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 844 B |
|
After Width: | Height: | Size: 816 B |
|
After Width: | Height: | Size: 541 B |