mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
refactor some swing references
This commit is contained in:
@@ -1,14 +1,23 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>metric</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
<boolean>true</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>zoom</string>
|
<string>zoom</string>
|
||||||
<double>1.0</double>
|
<double>1.0</double>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>metric</string>
|
<string>lastPath</string>
|
||||||
<boolean>true</boolean>
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>default.org.diylc.components.misc.Label:Color</string>
|
||||||
|
<awt-color>
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</awt-color>
|
||||||
</entry>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
+15
-1
@@ -1,4 +1,4 @@
|
|||||||
package org.diylc.gui;
|
package org.diylc.core;
|
||||||
|
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
@@ -14,6 +14,20 @@ import org.diylc.common.IPlugInPort;
|
|||||||
*/
|
*/
|
||||||
public interface IView {
|
public interface IView {
|
||||||
|
|
||||||
|
public static final int ERROR_MESSAGE = 0;
|
||||||
|
public static final int INFORMATION_MESSAGE = 1;
|
||||||
|
public static final int WARNING_MESSAGE = 2;
|
||||||
|
public static final int QUESTION_MESSAGE = 3;
|
||||||
|
public static final int PLAIN_MESSAGE = -1;
|
||||||
|
public static final int DEFAULT_OPTION = -1;
|
||||||
|
public static final int YES_NO_OPTION = 0;
|
||||||
|
public static final int YES_NO_CANCEL_OPTION = 1;
|
||||||
|
public static final int OK_CANCEL_OPTION = 2;
|
||||||
|
public static final int YES_OPTION = 0;
|
||||||
|
public static final int NO_OPTION = 1;
|
||||||
|
public static final int CANCEL_OPTION = 2;
|
||||||
|
public static final int OK_OPTION = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a component to the view.
|
* Adds a component to the view.
|
||||||
*
|
*
|
||||||
@@ -29,6 +29,7 @@ import org.diylc.common.BadPositionException;
|
|||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.core.IView;
|
||||||
import org.diylc.images.IconLoader;
|
import org.diylc.images.IconLoader;
|
||||||
import org.diylc.plugins.canvas.CanvasPlugin;
|
import org.diylc.plugins.canvas.CanvasPlugin;
|
||||||
import org.diylc.plugins.clipboard.EditMenuPlugin;
|
import org.diylc.plugins.clipboard.EditMenuPlugin;
|
||||||
|
|||||||
+1
-1
@@ -21,8 +21,8 @@ import javax.swing.JPanel;
|
|||||||
import org.diylc.common.BadPositionException;
|
import org.diylc.common.BadPositionException;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.core.IView;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.gui.IView;
|
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
|
|
||||||
import com.diyfever.gui.IFileChooserAccessory;
|
import com.diyfever.gui.IFileChooserAccessory;
|
||||||
|
|||||||
+10
-11
@@ -22,7 +22,6 @@ import java.util.Set;
|
|||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.BadPositionException;
|
import org.diylc.common.BadPositionException;
|
||||||
@@ -35,9 +34,9 @@ import org.diylc.common.IPlugIn;
|
|||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.IView;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.gui.IView;
|
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
import com.diyfever.gui.miscutils.ConfigurationManager;
|
import com.diyfever.gui.miscutils.ConfigurationManager;
|
||||||
@@ -203,7 +202,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Could not create new file", e);
|
LOG.error("Could not create new file", e);
|
||||||
view.showMessage("Could not create a new file. Check the log for details.", "Error",
|
view.showMessage("Could not create a new file. Check the log for details.", "Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
IView.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +216,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOG.error("Could not load file", ex);
|
LOG.error("Could not load file", ex);
|
||||||
view.showMessage("Could not open file " + fileName + ". Check the log for details.",
|
view.showMessage("Could not open file " + fileName + ". Check the log for details.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,8 +225,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (projectFileManager.isModified()) {
|
if (projectFileManager.isModified()) {
|
||||||
int response = view.showConfirmDialog(
|
int response = view.showConfirmDialog(
|
||||||
"There are unsaved changes. Are you sure you want to abandon these changes?",
|
"There are unsaved changes. Are you sure you want to abandon these changes?",
|
||||||
"Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
"Warning", IView.YES_NO_OPTION, IView.WARNING_MESSAGE);
|
||||||
return response == JOptionPane.YES_OPTION;
|
return response == IView.YES_OPTION;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -240,7 +239,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOG.error("Could not save file", ex);
|
LOG.error("Could not save file", ex);
|
||||||
view.showMessage("Could not save file " + fileName + ". Check the log for details.",
|
view.showMessage("Could not save file " + fileName + ". Check the log for details.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +389,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
instantiationManager.instatiatePointByPoint(scaledPoint, currentProject);
|
instantiationManager.instatiatePointByPoint(scaledPoint, currentProject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
view.showMessage("Could not create component. Check log for details.",
|
view.showMessage("Could not create component. Check log for details.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
LOG.error("Could not create component", e);
|
LOG.error("Could not create component", e);
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, componentTypeSlot,
|
messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, componentTypeSlot,
|
||||||
@@ -1040,7 +1039,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.error("Could not apply selection properties", e);
|
LOG.error("Could not apply selection properties", e);
|
||||||
view.showMessage(
|
view.showMessage(
|
||||||
"Could not apply changes to the selection. Check the log for details.",
|
"Could not apply changes to the selection. Check the log for details.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
} finally {
|
} finally {
|
||||||
// Notify the listeners.
|
// Notify the listeners.
|
||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
@@ -1081,7 +1080,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Could not apply project properties", e);
|
LOG.error("Could not apply project properties", e);
|
||||||
view.showMessage("Could not apply changes to the project. Check the log for details.",
|
view.showMessage("Could not apply changes to the project. Check the log for details.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
} finally {
|
} finally {
|
||||||
// Notify the listeners.
|
// Notify the listeners.
|
||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
@@ -1112,7 +1111,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Could not set component type slot", e);
|
LOG.error("Could not set component type slot", e);
|
||||||
view.showMessage("Could not set component type slot. Check log for details.", "Error",
|
view.showMessage("Could not set component type slot. Check log for details.", "Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
IView.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user