Added ability to view (but not modify) tables over your user level

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@325 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
Jared Gould 2006-11-04 15:36:21 +00:00
parent 09fe1e3f8c
commit 290f17ac1d
3 changed files with 21 additions and 6 deletions

View File

@ -44,7 +44,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL
private RomTree imageList = new RomTree(imageRoot); private RomTree imageList = new RomTree(imageRoot);
private Settings settings = new Settings(); private Settings settings = new Settings();
private String version = "0.4.0 Beta"; private String version = "0.4.0 Beta";
private String versionDate = "11/03/2006"; private String versionDate = "11/06/2006";
private String titleText = "Enginuity v" + version; private String titleText = "Enginuity v" + version;
public MDIDesktopPane rightPanel = new MDIDesktopPane(); public MDIDesktopPane rightPanel = new MDIDesktopPane();
private Rom lastSelectedRom = null; private Rom lastSelectedRom = null;

View File

@ -641,33 +641,48 @@ public abstract class Table extends JPanel implements Serializable {
} }
public void increment(double increment) { public void increment(double increment) {
if (!isStatic && !locked) { if (!isStatic && !locked && !(userLevel > settings.getUserLevel())) {
for (DataCell cell : data) { for (DataCell cell : data) {
if (cell.isSelected()) { if (cell.isSelected()) {
cell.increment(increment); cell.increment(increment);
} }
} }
} else if (userLevel > settings.getUserLevel()) {
JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" +
userLevel + " or greater. Click View->User Level to change your userlevel.",
"Table cannot be modified",
JOptionPane.INFORMATION_MESSAGE);
} }
} }
public void multiply(double factor) { public void multiply(double factor) {
if (!isStatic && !locked) { if (!isStatic && !locked && !(userLevel > settings.getUserLevel())) {
for (DataCell cell : data) { for (DataCell cell : data) {
if (cell.isSelected()) { if (cell.isSelected()) {
cell.multiply(factor); cell.multiply(factor);
} }
} }
} else if (userLevel > settings.getUserLevel()) {
JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" +
userLevel + " or greater. Click View->User Level to change your userlevel.",
"Table cannot be modified",
JOptionPane.INFORMATION_MESSAGE);
} }
colorize(); colorize();
} }
public void setRealValue(String realValue) { public void setRealValue(String realValue) {
if (!isStatic && !locked) { if (!isStatic && !locked && !(userLevel > settings.getUserLevel())) {
for (DataCell cell : data) { for (DataCell cell : data) {
if (cell.isSelected()) { if (cell.isSelected()) {
cell.setRealValue(realValue); cell.setRealValue(realValue);
} }
} }
} else if (userLevel > settings.getUserLevel()) {
JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" +
userLevel + " or greater. Click View->User Level to change your userlevel.",
"Table cannot be modified",
JOptionPane.INFORMATION_MESSAGE);
} }
colorize(); colorize();
} }

View File

@ -42,9 +42,9 @@ public class RomTree extends JTree implements MouseListener {
TableTreeNode node = (TableTreeNode) selectedRow; TableTreeNode node = (TableTreeNode) selectedRow;
if (!(node.getTable().getUserLevel() > container.getSettings().getUserLevel())) { //if (!(node.getTable().getUserLevel() > container.getSettings().getUserLevel())) {
container.displayTable(node.getFrame()); container.displayTable(node.getFrame());
} //}
} }