Commit 0bc5debb authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Anchor editing window, new layout and translation system

Bugfix subbitmap deletion
Bugfix slider position update according to global variables change
Automated search for commonly used strings and replacing by Language.get(...)
parent 785516a6
#Author/s: Daniel Dreibrodt
#General strings
NOTE_STARRED|* Attributes marked with a star must be specified.
NOTE_STARRED|* Attribute must be specified.
#Common strings
WIN_ITEM_GENERAL|General attributes
......@@ -12,6 +12,10 @@ WIN_ITEM_Y|Y:
WIN_ITEM_WIDTH|Width:
WIN_ITEM_HEIGHT|Height:
WIN_ITEM_VISIBLE|Visibility:
WIN_ITEM_LEFTTOP|Lefttop:
WIN_ITEM_LEFTTOP_TIP|Indicate to which corner of the Layout the top-left-hand corner of this iten is attached to, in case of resizing.
WIN_ITEM_RIGHTBOTTOM|Rightbottom:
WIN_ITEM_RIGHTBOTTOM_TIP|Indicate to which corner of the Layout the bottom-right-hand corner of this item is attached to, in case of resizing.
FILE_INDIR|in the same folder as the XML file
#Bitmap
......@@ -66,4 +70,14 @@ WIN_WINDOW_DD|Drag an drop:
WIN_WINDOW_DD_TIP|Indicates whether drag and drop of media files is allowed on this window.
WIN_WINDOW_PD|Play on drop:
WIN_WINDOW_PD_TIP|Indicates whether a dropped file is played directly (true) or only enqueued (false). This attribute has no effect if dragdrop is set to "false".
WIN_WINDOW_DD_PANEL|Drag and drop options
\ No newline at end of file
WIN_WINDOW_DD_PANEL|Drag and drop options
#Anchor
WIN_ANCHOR_TITLE|Anchor settings
WIN_ANCHOR_POINTS|Points:
WIN_ANCHOR_POINTS_TIP|Points defining the Bezier curve followed by the anchor. You don't need to change this parameter if all you want is a punctual anchor.
WIN_ANCHOR_RANGE|Range:
WIN_ANCHOR_RANGE_TIP|Range of the anchor's area of effect, in pixels.
WIN_ANCHOR_PRIORITY|Priority*:
WIN_ANCHOR_PRIORITY_TIP|Each anchor has a priority (priority attribute), and the anchor with the highest priority is the winner, which means that when moving its window all the other anchored windows will move too. To break the effect of 2 anchored windows, you need to move the window whose anchor has the lower priority.
WIN_ANCHOR_BOUNDARIES|Boundaries
......@@ -157,6 +157,7 @@ public class Config {
JLabel lang_l = new JLabel(Language.get("WIN_PREFS_LANG_L"));
File[] lang_files = new File("lang").listFiles(new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".txt");
}
......@@ -179,6 +180,7 @@ public class Config {
JButton ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
strings.put("autoupdate", String.valueOf(update_cb.isSelected()));
strings.put("language", (String)lang_cb.getSelectedItem());
......@@ -190,6 +192,7 @@ public class Config {
JButton cancel_btn = new JButton(Language.get("BUTTON_CANCEL"));
cancel_btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
frame.dispose();
......
......@@ -183,7 +183,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_file.add(m_file_vlt);
m_file.add(m_file_png);
m_file.addSeparator();
m_file.add(m_file_quit);
if(System.getProperty("os.name").indexOf("Mac")==-1) m_file.add(m_file_quit);
m_edit = new JMenu(Language.get("MENU_EDIT"));
m_edit.setMnemonic(Language.get("MENU_EDIT_MN").charAt(0));
......@@ -515,61 +515,61 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
jdesk.add(res_add_bitmap_pu);
items_add_pu = new JPopupMenu();
items_add_pu_tp = new JMenu(Language.get("WIN_ITEMS_PU_PANEL_ADD"));
items_add_pu_tp_anchor = new JMenuItem("Anchor");
items_add_pu_tp = new JMenu(Language.get("WIN_ITEMS_PU_PANEL_ADD"));
items_add_pu_tp_anchor = new JMenuItem(Language.get("ANCHOR"));
items_add_pu_tp_anchor.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_anchor);
items_add_pu_tp_button = new JMenuItem("Button");
items_add_pu_tp_button = new JMenuItem(Language.get("BUTTON"));
items_add_pu_tp_button.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_button);
items_add_pu_tp_checkbox = new JMenuItem("Checkbox");
items_add_pu_tp_checkbox.addActionListener(this);
items_add_pu_tp_checkbox = new JMenuItem(Language.get("CHECKBOX"));
items_add_pu_tp_checkbox.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_checkbox);
items_add_pu_tp_image = new JMenuItem("Image");
items_add_pu_tp_image = new JMenuItem(Language.get("IMAGE"));
items_add_pu_tp_image.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_image);
items_add_pu_tp_panel = new JMenuItem("Panel");
items_add_pu_tp_panel = new JMenuItem(Language.get("PANEL"));
items_add_pu_tp_panel.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_panel);
items_add_pu_tp_playtree = new JMenuItem("Playtree");
items_add_pu_tp_playtree = new JMenuItem(Language.get("PLAYTREE"));
items_add_pu_tp_playtree.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_playtree);
items_add_pu_tp_slider = new JMenuItem("Slider");
items_add_pu_tp_slider = new JMenuItem(Language.get("SLIDER"));
items_add_pu_tp_slider.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_slider);
items_add_pu_tp_text = new JMenuItem("Text");
items_add_pu_tp_text = new JMenuItem(Language.get("TEXT"));
items_add_pu_tp_text.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_text);
items_add_pu_tp_video = new JMenuItem("Video");
items_add_pu_tp_video = new JMenuItem(Language.get("VIDEO"));
items_add_pu_tp_video.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_video);
items_add_pu.add(items_add_pu_tp);
items_add_pu.addSeparator();
items_add_pu_anchor = new JMenuItem("Anchor");
items_add_pu_anchor = new JMenuItem(Language.get("ANCHOR"));
items_add_pu_anchor.addActionListener(this);
items_add_pu.add(items_add_pu_anchor);
items_add_pu_button = new JMenuItem("Button");
items_add_pu_button = new JMenuItem(Language.get("BUTTON"));
items_add_pu_button.addActionListener(this);
items_add_pu.add(items_add_pu_button);
items_add_pu_checkbox = new JMenuItem("Checkbox");
items_add_pu_checkbox = new JMenuItem(Language.get("CHECKBOX"));
items_add_pu_checkbox.addActionListener(this);
items_add_pu.add(items_add_pu_checkbox);
items_add_pu_image = new JMenuItem("Image");
items_add_pu_image = new JMenuItem(Language.get("IMAGE"));
items_add_pu_image.addActionListener(this);
items_add_pu.add(items_add_pu_image);
items_add_pu_panel = new JMenuItem("Panel");
items_add_pu_panel = new JMenuItem(Language.get("PANEL"));
items_add_pu_panel.addActionListener(this);
items_add_pu.add(items_add_pu_panel);
items_add_pu_playtree = new JMenuItem("Playtree");
items_add_pu_playtree = new JMenuItem(Language.get("PLAYTREE"));
items_add_pu_playtree.addActionListener(this);
items_add_pu.add(items_add_pu_playtree);
items_add_pu_slider = new JMenuItem("Slider");
items_add_pu_slider = new JMenuItem(Language.get("SLIDER"));
items_add_pu_slider.addActionListener(this);
items_add_pu.add(items_add_pu_slider);
items_add_pu_text = new JMenuItem("Text");
items_add_pu_text = new JMenuItem(Language.get("TEXT"));
items_add_pu_text.addActionListener(this);
items_add_pu.add(items_add_pu_text);
items_add_pu_video = new JMenuItem("Video");
items_add_pu_video = new JMenuItem(Language.get("VIDEO"));
items_add_pu_video.addActionListener(this);
items_add_pu.add(items_add_pu_video);
jdesk.add(items_add_pu);
......@@ -648,7 +648,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
opening = true;
String[] exts = { "xml","vlt" };
if(System.getProperty("os.name").indexOf("Mac")==-1) {
base_fc.setFileFilter(new CustomFileFilter(base_fc,exts,"*.xml (VLC XML-Skin Files), *.vlt (Packed XML-Skins)",false,vlc_dir));
base_fc.setFileFilter(new CustomFileFilter(base_fc,exts,"*.xml (VLC XML-Skin), *.vlt (VLC Theme)",false,vlc_dir));
int returnVal = base_fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
openFile(base_fc.getSelectedFile());
......@@ -664,8 +664,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
fd.setMode(FileDialog.LOAD);
fd.setFilenameFilter(new FilenameFilter() {
@Override
public boolean accept(File f, String s) {
return f.getName().toUpperCase().endsWith(".XML");
public boolean accept(File dir, String name) {
return name.toUpperCase().endsWith(".XML");
}
});
fd.setVisible(true);
......@@ -863,7 +863,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
if(vlt_saver==null) {
vlt_saver = new JFileChooser();
vlt_saver.setCurrentDirectory(new File(vlc_skins_dir));
vlt_saver.setFileFilter(new CustomFileFilter(vlt_saver,"vlt",".vlt (VideoLAN Theme)",false,""));
vlt_saver.setFileFilter(new CustomFileFilter(vlt_saver,"vlt",".vlt (VLC Theme)",false,""));
vlt_saver.setAcceptAllFileFilterUsed(false);
}
int returnVal = vlt_saver.showSaveDialog(this);
......@@ -1224,9 +1224,21 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1]);
if(n==0) {
Resource r = s.getResource(selected_resource);
ResourceDeletionEvent rde = new ResourceDeletionEvent(s,r,s.resources.indexOf(r));
hist.addEvent(rde);
s.resources.remove(r);
Bitmap parent = null;
if(r.getClass().equals(SubBitmap.class)) {
for(Resource i:s.resources) {
if(i.getClass().equals(Bitmap.class)) {
if(((Bitmap)i).SubBitmaps.contains(r)) parent = (Bitmap)i;
}
}
SubBitmapDeletionEvent sde = new SubBitmapDeletionEvent(s,parent,(SubBitmap)r,parent.SubBitmaps.indexOf(r));
hist.addEvent(sde);
parent.SubBitmaps.remove(r);
} else {
ResourceDeletionEvent rde = new ResourceDeletionEvent(s,r,s.resources.indexOf(r));
hist.addEvent(rde);
s.resources.remove(r);
}
s.updateResources();
}
}
......
......@@ -235,7 +235,7 @@ public class SliderBGGen extends JFrame implements ActionListener{
step1_next_btn = new JButton(Language.get("SBGGEN_NEXT"));
step1_next_btn.addActionListener(this);
step1_cancel_btn = new JButton(Language.get("SBGGEN_CANCEL"));
step1_cancel_btn.setActionCommand("cancel");
step1_cancel_btn.setActionCommand(Language.get("SBGGEN_CANCEL"));
step1_cancel_btn.addActionListener(this);
card_step1.add(step1_horz_s);
......@@ -376,7 +376,7 @@ public class SliderBGGen extends JFrame implements ActionListener{
step2_finish_btn = new JButton(Language.get("SBGGEN_FINISH"));
step2_finish_btn.addActionListener(this);
step2_cancel_btn = new JButton(Language.get("SBGGEN_CANCEL"));
step2_cancel_btn.setActionCommand("cancel");
step2_cancel_btn.setActionCommand(Language.get("BUTTON_CANCEL"));
step2_cancel_btn.addActionListener(this);
card_step2.add(step2_horz_s);
......@@ -394,8 +394,9 @@ public class SliderBGGen extends JFrame implements ActionListener{
setSize(540,450);
setResizable(false);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("cancel")) {
if(e.getActionCommand().equals(Language.get("SBGGEN_CANCEL"))) {
setVisible(false);
dispose();
}
......
......@@ -97,6 +97,7 @@ public class Anchor extends Item implements ActionListener{
}
b = new Bezier(xpos,ypos,Bezier.kCoordsBoth);
}
@Override
public void update() {
if(!created) {
id=id_tf.getText();
......@@ -130,96 +131,167 @@ public class Anchor extends Item implements ActionListener{
s.m.hist.addEvent(aee);
}
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Anchor settings");
frame = new JFrame(Language.get("WIN_ANCHOR_TITLE"));
frame.setResizable(false);
frame.setLayout(new FlowLayout());
if(!created) frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID:");
JLabel id_l = new JLabel(Language.get("WIN_ITEM_ID"));
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
JLabel x_l = new JLabel(Language.get("WIN_ITEM_X"));
x_tf = new JTextField();
x_tf.setDocument(new NumbersOnlyDocument());
JLabel y_l = new JLabel("Y:");
JLabel y_l = new JLabel(Language.get("WIN_ITEM_Y"));
y_tf = new JTextField();
y_tf.setDocument(new NumbersOnlyDocument());
JLabel points_l = new JLabel("Points:");
JLabel points_l = new JLabel(Language.get("WIN_ANCHOR_POINTS"));
points_tf = new JTextField();
points_tf.setToolTipText("Points defining the Bezier curve followed by the anchor. You don't need to change this parameter if all you want is a punctual anchor.");
JLabel range_l = new JLabel("Range:");
points_tf.setToolTipText(Language.get("WIN_ANCHOR_POINTS_TIP"));
JLabel range_l = new JLabel(Language.get("WIN_ANCHOR_RANGE"));
range_tf = new JTextField();
range_tf.setToolTipText("Range of action of the anchor, in pixels.");
range_tf.setToolTipText(Language.get("WIN_ANCHOR_RANGE_TIP"));
range_tf.setDocument(new NumbersOnlyDocument());
JLabel priority_l = new JLabel("Priority*:");
JLabel priority_l = new JLabel(Language.get("WIN_ANCHOR_PRIORITY"));
priority_tf = new JTextField();
priority_tf.setToolTipText("Each anchor has a priority (priority attribute), and the anchor with the highest priority is the winner, which means that when moving its window all the other anchored windows will move too. To break the effect of 2 anchored windows, you need to move the window whose anchor has the lower priority.");
priority_tf.setToolTipText(Language.get("WIN_ANCHOR_PRIORITY_TIP"));
priority_tf.setDocument(new NumbersOnlyDocument());
JLabel lefttop_l = new JLabel("Lefttop:");
JLabel lefttop_l = new JLabel(Language.get("WIN_ITEM_LEFTTOP"));
String[] lefttop_values = {"lefttop", "leftbottom", "righttop", "rightbottom"};
lefttop_cb = new JComboBox(lefttop_values);
lefttop_cb.setToolTipText("Indicate to which corner of the Layout the top-left-hand corner of this anchor is attached, in case of resizing.");
ok_btn = new JButton("OK");
lefttop_cb.setToolTipText(Language.get("WIN_ITEM_LEFTTOP_TIP"));
ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(this);
ok_btn.setPreferredSize(new Dimension(70,25));
cancel_btn = new JButton("Cancel");
cancel_btn = new JButton(Language.get("BUTTON_CANCEL"));
cancel_btn.addActionListener(this);
cancel_btn.setPreferredSize(new Dimension(70,25));
help_btn = new JButton("Help");
help_btn.addActionListener(this);
help_btn.setPreferredSize(new Dimension(70,25));
help_btn = new JButton(Language.get("BUTTON_HELP"));
help_btn.addActionListener(this);
JLabel star_l = new JLabel(Language.get("NOTE_STARRED"));
//Distance of textfields to WEST edge of container
Component[] labels = { id_l, priority_l, lefttop_l, x_l, y_l, range_l, points_l};
int tf_dx = Helper.maxWidth(labels)+10;
//Max. textfield width
int tf_wd = 200;
JPanel general = new JPanel(null);
general.add(id_l);
JPanel general = new JPanel();
general.add(id_l);
id_tf.setPreferredSize(new Dimension(tf_wd,id_tf.getPreferredSize().height));
general.add(id_tf);
id_l.setBounds(5,15,75,24);
id_tf.setBounds(85,15,150,24);
general.add(priority_l);
general.add(priority_tf);
priority_l.setBounds(5,45,75,24);
priority_tf.setBounds(85,45,150,24);
general.add(lefttop_l);
general.add(lefttop_cb);
lefttop_l.setBounds(5,75,75,24);
lefttop_cb.setBounds(85,75,150,24);
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes"));
general.setMinimumSize(new Dimension(240,110));
general.setPreferredSize(new Dimension(240,110));
general.setMaximumSize(new Dimension(240,110));
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), Language.get("WIN_ITEM_GENERAL")));
SpringLayout general_layout = new SpringLayout();
general_layout.putConstraint(SpringLayout.NORTH, id_l, 5, SpringLayout.NORTH, general);
general_layout.putConstraint(SpringLayout.WEST, id_l, 5, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.VERTICAL_CENTER, id_tf, 0, SpringLayout.VERTICAL_CENTER, id_l);
general_layout.putConstraint(SpringLayout.WEST, id_tf, tf_dx, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.NORTH, priority_l, 10, SpringLayout.SOUTH, id_l);
general_layout.putConstraint(SpringLayout.WEST, priority_l, 5, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.VERTICAL_CENTER, priority_tf, 0, SpringLayout.VERTICAL_CENTER, priority_l);
general_layout.putConstraint(SpringLayout.WEST, priority_tf, tf_dx, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.EAST, priority_tf, 0, SpringLayout.EAST, id_tf);
general_layout.putConstraint(SpringLayout.NORTH, lefttop_l, 10, SpringLayout.SOUTH, priority_l);
general_layout.putConstraint(SpringLayout.WEST, lefttop_l, 5, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.VERTICAL_CENTER, lefttop_cb, 0, SpringLayout.VERTICAL_CENTER, lefttop_l);
general_layout.putConstraint(SpringLayout.WEST, lefttop_cb, tf_dx, SpringLayout.WEST, general);
general_layout.putConstraint(SpringLayout.EAST, lefttop_cb, 0, SpringLayout.EAST, id_tf);
general_layout.putConstraint(SpringLayout.EAST, general, 5, SpringLayout.EAST, id_tf);
general_layout.putConstraint(SpringLayout.SOUTH, general, 10, SpringLayout.SOUTH, lefttop_l);
general.setLayout(general_layout);
frame.add(general);
JPanel bounds = new JPanel(null);
JPanel bounds = new JPanel();
bounds.add(x_l);
x_tf.setPreferredSize(new Dimension(tf_wd,x_tf.getPreferredSize().height));
bounds.add(x_tf);
x_l.setBounds(5,15,75,24);
x_tf.setBounds(85,15,150,24);
bounds.add(y_l);
bounds.add(y_tf);
y_l.setBounds(5,45,75,24);
y_tf.setBounds(85,45,150,24);
bounds.add(points_l);
bounds.add(points_tf);
points_l.setBounds(5,75,75,24);
points_tf.setBounds(85,75,150,24);
bounds.add(range_l);
bounds.add(range_tf);
range_l.setBounds(5,105,75,24);
range_tf.setBounds(85,105,150,24);
bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Boundaries"));
bounds.setMinimumSize(new Dimension(240,140));
bounds.setPreferredSize(new Dimension(240,140));
bounds.setMaximumSize(new Dimension(240,140));
frame.add(bounds);
bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), Language.get("WIN_ANCHOR_BOUNDARIES")));
SpringLayout bounds_layout = new SpringLayout();
bounds_layout.putConstraint(SpringLayout.NORTH, x_l, 5, SpringLayout.NORTH, bounds);
bounds_layout.putConstraint(SpringLayout.WEST, x_l, 5, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.VERTICAL_CENTER, id_tf, 0, SpringLayout.VERTICAL_CENTER, x_l);
bounds_layout.putConstraint(SpringLayout.WEST, x_tf, tf_dx, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.NORTH, y_l, 10, SpringLayout.SOUTH, x_l);
bounds_layout.putConstraint(SpringLayout.WEST, y_l, 5, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.VERTICAL_CENTER, y_tf, 0, SpringLayout.VERTICAL_CENTER, y_l);
bounds_layout.putConstraint(SpringLayout.WEST, y_tf, tf_dx, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.EAST, y_tf, 0, SpringLayout.EAST, x_tf);
bounds_layout.putConstraint(SpringLayout.NORTH, points_l, 10, SpringLayout.SOUTH, y_l);
bounds_layout.putConstraint(SpringLayout.WEST, points_l, 5, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.VERTICAL_CENTER, points_tf, 0, SpringLayout.VERTICAL_CENTER, points_l);
bounds_layout.putConstraint(SpringLayout.WEST, points_tf, tf_dx, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.EAST, points_tf, 0, SpringLayout.EAST, x_tf);
bounds_layout.putConstraint(SpringLayout.NORTH, range_l, 10, SpringLayout.SOUTH, points_l);
bounds_layout.putConstraint(SpringLayout.WEST, range_l, 5, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.VERTICAL_CENTER, range_tf, 0, SpringLayout.VERTICAL_CENTER, range_l);
bounds_layout.putConstraint(SpringLayout.WEST, range_tf, tf_dx, SpringLayout.WEST, bounds);
bounds_layout.putConstraint(SpringLayout.EAST, range_tf, 0, SpringLayout.EAST, x_tf);
bounds_layout.putConstraint(SpringLayout.EAST, bounds, 5, SpringLayout.EAST, x_tf);
bounds_layout.putConstraint(SpringLayout.SOUTH, bounds, 10, SpringLayout.SOUTH, range_l);
bounds.setLayout(bounds_layout);
frame.add(bounds);
frame.add(star_l);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
frame.add(help_btn);
SpringLayout layout = new SpringLayout();
layout.putConstraint(SpringLayout.NORTH, general, 5, SpringLayout.NORTH, frame.getContentPane());
layout.putConstraint(SpringLayout.WEST, general, 5, SpringLayout.WEST, frame.getContentPane());
//layout.putConstraint(SpringLayout.EAST, general, 5, SpringLayout.EAST, frame.getContentPane());
layout.putConstraint(SpringLayout.NORTH, bounds, 10, SpringLayout.SOUTH, general);
layout.putConstraint(SpringLayout.WEST, bounds, 5, SpringLayout.WEST, frame.getContentPane());
//layout.putConstraint(SpringLayout.EAST, bounds, 5, SpringLayout.EAST, frame.getContentPane());
frame.setMinimumSize(new Dimension(250,345));
frame.setPreferredSize(new Dimension(250,345));
frame.setMaximumSize(new Dimension(250,345));
layout.putConstraint(SpringLayout.NORTH, star_l, 10, SpringLayout.SOUTH, bounds);
layout.putConstraint(SpringLayout.WEST, star_l, 5, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.NORTH, ok_btn, 10, SpringLayout.SOUTH, star_l);
layout.putConstraint(SpringLayout.WEST, ok_btn, 5, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.NORTH, cancel_btn, 0, SpringLayout.NORTH, ok_btn);
layout.putConstraint(SpringLayout.WEST, cancel_btn, 5, SpringLayout.EAST, ok_btn);
layout.putConstraint(SpringLayout.NORTH, help_btn, 0, SpringLayout.NORTH, cancel_btn);
layout.putConstraint(SpringLayout.WEST, help_btn, 5, SpringLayout.EAST, cancel_btn);
layout.putConstraint(SpringLayout.SOUTH, frame.getContentPane(), 10, SpringLayout.SOUTH, ok_btn);
layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, general);
frame.setLayout(layout);
frame.pack();
frame.getRootPane().setDefaultButton(ok_btn);
}
id_tf.setText(id);
......@@ -231,15 +303,16 @@ public class Anchor extends Item implements ActionListener{
range_tf.setText(String.valueOf(range));
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
JOptionPane.showMessageDialog(frame,"Please enter a valid ID!","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,Language.get("ERROR_ID_INVALID_MSG"),Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
else if(!id_tf.getText().equals(id)) {
if(s.idExists(id_tf.getText())) {
JOptionPane.showMessageDialog(frame,"The ID \""+id_tf.getText()+"\" already exists, please choose another one.","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,Language.get("ERROR_ID_EXISTS_MSG").replaceAll("%i", id_tf.getText()),Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
}
......@@ -261,6 +334,7 @@ public class Anchor extends Item implements ActionListener{
frame = null;
}
}
@Override
public String returnCode(String indent) {
String code = indent+"<Anchor";
if (x!=X_DEFAULT) code+=" x=\""+String.valueOf(x)+"\"";
......@@ -271,9 +345,11 @@ public class Anchor extends Item implements ActionListener{
//if (id!=ID_DEFAULT) code+="<!-- id=\""+id+"\" -->";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
@Override
public void draw(Graphics2D g,int x_,int y_, int z) {
if(!created) return;
if(selected) {
......@@ -296,6 +372,7 @@ public class Anchor extends Item implements ActionListener{
int w = b.getWidth();
return (x_>=x+offsetx && x_<=x+offsetx+w && y_>=y+offsety && y_<=y+offsety+h);*/
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Anchor: "+id);
return node;
......
......@@ -152,19 +152,19 @@ public class Button extends Item implements ActionListener{
frame.setResizable(false);
frame.setLayout(new FlowLayout());
if(!created) frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
JLabel id_l = new JLabel(Language.get("WIN_ITEM_ID"));
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
JLabel x_l = new JLabel(Language.get("WIN_ITEM_X"));
x_tf = new JTextField();
x_tf.setDocument(new NumbersOnlyDocument());
JLabel y_l = new JLabel("Y:");
JLabel y_l = new JLabel(Language.get("WIN_ITEM_Y"));
y_tf = new JTextField();
y_tf.setDocument(new NumbersOnlyDocument());
String[] align_values = {"lefttop", "leftbottom", "righttop", "rightbottom"};
JLabel lefttop_l = new JLabel("Lefttop:");
JLabel lefttop_l = new JLabel(Language.get("WIN_ITEM_LEFTTOP"));
lefttop_cb = new JComboBox(align_values);
lefttop_cb.setToolTipText("Indicate to which corner of the Layout the top-left-hand corner of this item is attached, in case of resizing.");
JLabel rightbottom_l = new JLabel("Rightbottom:");
JLabel rightbottom_l = new JLabel(Language.get("WIN_ITEM_RIGHTBOTTOM"));
rightbottom_cb = new JComboBox(align_values);
rightbottom_cb.setToolTipText("Indicate to which corner of the Layout the bottom-right-hand corner of this item is attached, in case of resizing.");
Object[] bool_values = { true, false };
......@@ -174,7 +174,7 @@ public class Button extends Item implements ActionListener{
JLabel ykeepratio_l = new JLabel("Keep Y Ratio:");
ykeepratio_cb = new JComboBox(bool_values);
ykeepratio_cb.setToolTipText("When set to true, the behaviour of the vertical resizing is changed. For example, if initially the space to the top of the control is twice as big as the one to its bottom, this will stay the same during any vertical resizing. The height of the control stays constant.");
JLabel visible_l = new JLabel("Visibility:");
JLabel visible_l = new JLabel(Language.get("WIN_ITEM_VISIBLE"));
visible_tf = new JTextField();
visible_btn = new JButton("",s.m.help_icon);
visible_btn.addActionListener(this);
......@@ -195,13 +195,13 @@ public class Button extends Item implements ActionListener{
JLabel tooltiptext_l = new JLabel("Tooltiptext:");
tooltiptext_tf = new JTextField();
ok_btn = new JButton("OK");
ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(this);
ok_btn.setPreferredSize(new Dimension(70,25));
cancel_btn = new JButton("Cancel");
cancel_btn = new JButton(Language.get("BUTTON_CANCEL"));
cancel_btn.addActionListener(this);
cancel_btn.setPreferredSize(new Dimension(70,25));
help_btn = new JButton("Help");
help_btn = new JButton(Language.get("BUTTON_HELP"));
help_btn.addActionListener(this);
help_btn.setPreferredSize(new Dimension(70,25));
......@@ -244,7 +244,7 @@ public class Button extends Item implements ActionListener{
general.add(help_tf);
help_l.setBounds(5,255,75,24);
help_tf.setBounds(85,255,150,24);
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes"));
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), Language.get("WIN_ITEM_GENERAL")));
general.setMinimumSize(new Dimension(240,285));
general.setPreferredSize(new Dimension(240,285));
general.setMaximumSize(new Dimension(240,285));
......@@ -283,7 +283,7 @@ public class Button extends Item implements ActionListener{
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
frame.add(new JLabel(Language.get("NOTE_STARRED")));
frame.setMinimumSize(new Dimension(250,520));
frame.setPreferredSize(new Dimension(250,520));
......@@ -315,12 +315,12 @@ public class Button extends Item implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
JOptionPane.showMessageDialog(frame,"Please enter a valid ID!","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,Language.get("ERROR_ID_INVALID_MSG"),Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
else if(!id_tf.getText().equals(id)) {
if(s.idExists(id_tf.getText())) {
JOptionPane.showMessageDialog(frame,"The ID \""+id_tf.getText()+"\" already exists, please choose another one.","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,"The ID \""+id_tf.getText()+"\" already exists, please choose another one.",Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
}
......
......@@ -196,19 +196,19 @@ public class Checkbox extends Item implements ActionListener{
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
JLabel id_l = new JLabel(Language.get("WIN_ITEM_ID"));
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
JLabel x_l = new JLabel(Language.get("WIN_ITEM_X"));
x_tf = new JTextField();
x_tf.setDocument(new NumbersOnlyDocument());
JLabel y_l = new JLabel("Y:");
JLabel y_l = new JLabel(Language.get("WIN_ITEM_Y"));
y_tf = new JTextField();
y_tf.setDocument(new NumbersOnlyDocument());
String[] align_values = {"lefttop", "leftbottom", "righttop", "rightbottom"};
JLabel lefttop_l = new JLabel("Lefttop:");
JLabel lefttop_l = new JLabel(Language.get("WIN_ITEM_LEFTTOP"));
lefttop_cb = new JComboBox(align_values);
lefttop_cb.setToolTipText("Indicate to which corner of the Layout the top-left-hand corner of this item is attached, in case of resizing.");
JLabel rightbottom_l = new JLabel("Rightbottom:");
JLabel rightbottom_l = new JLabel(Language.get("WIN_ITEM_RIGHTBOTTOM"));
rightbottom_cb = new JComboBox(align_values);
rightbottom_cb.setToolTipText("Indicate to which corner of the Layout the bottom-right-hand corner of this item is attached, in case of resizing.");
Object[] bool_values = { true, false };
......@@ -218,7 +218,7 @@ public class Checkbox extends Item implements ActionListener{
JLabel ykeepratio_l = new JLabel("Keep Y Ratio:");
ykeepratio_cb = new JComboBox(bool_values);
ykeepratio_cb.setToolTipText("When set to true, the behaviour of the vertical resizing is changed. For example, if initially the space to the top of the control is twice as big as the one to its bottom, this will stay the same during any vertical resizing. The height of the control stays constant.");
JLabel visible_l = new JLabel("Visibility:");
JLabel visible_l = new JLabel(Language.get("WIN_ITEM_VISIBLE"));
visible_tf = new JTextField();
visible_btn = new JButton("",s.m.help_icon);
visible_btn.addActionListener(this);
......@@ -257,13 +257,13 @@ public class Checkbox extends Item implements ActionListener{
state_btn = new JButton("",s.m.help_icon);
state_btn.addActionListener(this);
ok_btn = new JButton("OK");
ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(this);
ok_btn.setPreferredSize(new Dimension(70,25));
cancel_btn = new JButton("Cancel");
cancel_btn = new JButton(Language.get("BUTTON_CANCEL"));
cancel_btn.addActionListener(this);
cancel_btn.setPreferredSize(new Dimension(70,25));
help_btn = new JButton("Help");
help_btn = new JButton(Language.get("BUTTON_HELP"));
help_btn.addActionListener(this);
help_btn.setPreferredSize(new Dimension(70,25));
......@@ -306,7 +306,7 @@ public class Checkbox extends Item implements ActionListener{
general.add(help_tf);
help_l.setBounds(240,135,75,24);
help_tf.setBounds(325,135,150,24);
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes"));
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), Language.get("WIN_ITEM_GENERAL")));
general.setMinimumSize(new Dimension(495,165));
general.setPreferredSize(new Dimension(495,165));
general.setMaximumSize(new Dimension(495,165));
......@@ -387,7 +387,7 @@ public class Checkbox extends Item implements ActionListener{
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
frame.add(new JLabel(Language.get("NOTE_STARRED")));
frame.setMinimumSize(new Dimension(505,450));
frame.setPreferredSize(new Dimension(505,450));
......@@ -425,12 +425,12 @@ public class Checkbox extends Item implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
JOptionPane.showMessageDialog(frame,"Please enter a valid ID!","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,Language.get("ERROR_ID_INVALID_MSG"),Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
else if(!id_tf.getText().equals(id)) {
if(s.idExists(id_tf.getText())) {
JOptionPane.showMessageDialog(frame,"The ID \""+id_tf.getText()+"\" already exists, please choose another one.","ID not valid",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,"The ID \""+id_tf.getText()+"\" already exists, please choose another one.",Language.get("ERROR_ID_INVALID_TITLE"),JOptionPane.INFORMATION_MESSAGE);
return;
}
}
......