diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java index 13514fb1..ef0a5445 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java @@ -271,15 +271,9 @@ public interface IPlugInPort { */ List getMutualSelectionProperties(); - /** - * Applies specified properties to all the selected components. If some of - * the properties are not applicable to some of the selected components an - * exception will be thrown. - * - * @param properties - */ - void applyPropertiesToSelection(List properties); - + + void editSelection(); + /** * @return a list of editable properties of the current project. */ diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java index 273d188a..31c80cbf 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java @@ -483,7 +483,8 @@ public class Presenter implements IPlugInPort { } } - private void editSelection() { + @Override + public void editSelection() { List properties = getMutualSelectionProperties(); if (properties != null && !properties.isEmpty()) { Set defaultedProperties = new HashSet(); @@ -1192,8 +1193,7 @@ public class Presenter implements IPlugInPort { } } - @Override - public void applyPropertiesToSelection(List properties) { + private void applyPropertiesToSelection(List properties) { LOG.debug(String.format("applyPropertiesToSelection(%s)", properties)); Project oldProject = cloner.deepClone(currentProject); try { diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/ActionFactory.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/ActionFactory.java index d1dbc7f0..ea20f4a1 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/ActionFactory.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/ActionFactory.java @@ -727,19 +727,7 @@ public class ActionFactory { LOG.info("Nothing to edit"); return; } - PropertyEditorDialog editor = DialogFactory.getInstance().createPropertyEditorDialog( - properties, "Edit Selection"); - editor.setVisible(true); - if (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) { - plugInPort.applyPropertiesToSelection(properties); - } - // Save default values. - for (PropertyWrapper property : editor.getDefaultedProperties()) { - if (property.getValue() != null) { - plugInPort.setSelectionDefaultPropertyValue(property.getName(), property - .getValue()); - } - } + plugInPort.editSelection(); } } diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/canvas/CanvasPanel.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/canvas/CanvasPanel.java index 29aa47b7..81eb232d 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/canvas/CanvasPanel.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/canvas/CanvasPanel.java @@ -21,22 +21,14 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.VolatileImage; import java.util.EnumSet; -import java.util.List; import javax.swing.AbstractAction; import javax.swing.JComponent; -import javax.swing.JOptionPane; import javax.swing.KeyStroke; -import org.apache.log4j.Logger; import org.diylc.common.DrawOption; import org.diylc.common.IPlugInPort; -import org.diylc.common.PropertyWrapper; -import org.diylc.presenter.Presenter; -import org.diylc.swing.gui.DialogFactory; -import org.diylc.swing.gui.editor.PropertyEditorDialog; -import com.diyfever.gui.ButtonDialog; import com.diyfever.gui.miscutils.ConfigurationManager; /** @@ -46,8 +38,6 @@ import com.diyfever.gui.miscutils.ConfigurationManager; */ class CanvasPanel extends JComponent implements Autoscroll { - private static final Logger LOG = Logger.getLogger(CanvasPanel.class); - private static final long serialVersionUID = 1L; private IPlugInPort plugInPort; @@ -190,61 +180,8 @@ class CanvasPanel extends JComponent implements Autoscroll { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { - // if (e.getClickCount() == 2) { - // List properties = plugInPort - // .getMutualSelectionProperties(); - // if (properties == null || properties.isEmpty()) { - // // properties = plugInPort.getProjectProperties(); - // // PropertyEditorDialog editor = - // // DialogFactory.getInstance() - // // .createPropertyEditorDialog(properties, - // // "Edit Project"); - // // editor.setVisible(true); - // // if - // // - // (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) - // // { - // // plugInPort.applyPropertiesToProject(properties); - // // // Save default values. - // // for (PropertyWrapper property : - // // editor.getDefaultedProperties()) { - // // if (property.getValue() != null) { - // // - // plugInPort.setProjectDefaultPropertyValue(property.getName(), - // // property.getValue()); - // // } - // // } - // // } - // } else { - // PropertyEditorDialog editor = DialogFactory.getInstance() - // .createPropertyEditorDialog(properties, - // "Edit Selection"); - // editor.setVisible(true); - // if - // (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) - // { - // try { - // plugInPort.applyPropertiesToSelection(properties); - // } catch (Exception e1) { - // JOptionPane.showMessageDialog(CanvasPanel.this, - // "Error occured while editing selection. Check the log for details.", - // "Error", JOptionPane.ERROR_MESSAGE); - // LOG.error("Error applying properties", e1); - // } - // // Save default values. - // for (PropertyWrapper property : - // editor.getDefaultedProperties()) { - // if (property.getValue() != null) { - // plugInPort.setSelectionDefaultPropertyValue(property - // .getName(), property.getValue()); - // } - // } - // } - // } - // } else { plugInPort.mouseClicked(e.getPoint(), e.isControlDown(), e.isShiftDown(), e .isAltDown(), e.getClickCount()); - // } } } });