You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <chr...@us...> - 2006-06-06 02:50:58
|
Revision: 131 Author: christianhujer Date: 2006-06-04 16:05:11 -0700 (Sun, 04 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=131&view=rev Log Message: ----------- Some unification and refactoring. Removed some unused methods. Unified naming of CMainControl references. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMainStatusbar.java trunk/daimonin/src/daieditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-04 21:59:07 UTC (rev 130) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-04 23:05:11 UTC (rev 131) @@ -69,8 +69,8 @@ private final CArchPanel archPanel; /* Build Panel */ - CArchPanelPan(final CArchPanel controlPanel, final CMainControl control) { - mainControl = control; + CArchPanelPan(final CArchPanel controlPanel, final CMainControl mainControl) { + this.mainControl = mainControl; archPanel = controlPanel; list = new StringBuffer(""); listcounter = 0; @@ -81,7 +81,7 @@ panelDesktop.setLayout(new BorderLayout()); jbox = new JComboBox(); - mainControl.setBoldFont(jbox); + this.mainControl.setBoldFont(jbox); model = new DefaultListModel(); theList = new JList(model); Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-04 21:59:07 UTC (rev 130) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-04 23:05:11 UTC (rev 131) @@ -156,11 +156,11 @@ * @param atList the list of CF type-data * @param aobj the ArchObject to be displayed by this dialog * @param defaobj the default ArchObject of 'arch' - * @param mcntrl main control + * @param mainControl main control */ CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final ArchObject defaobj, - final CMainControl mcntrl) { - super(mcntrl.getMainView(), "CF Attribute Dialog", false); + final CMainControl mainControl) { + super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -173,7 +173,7 @@ attrHead = null; listNr = 0; - mainControl = mcntrl; // reference to the main control + this.mainControl = mainControl; // reference to the main control typelist = atList; // refernce to the typelist CAttribDialog.setDefaultBounds(); // set width/height etc @@ -181,7 +181,7 @@ // refernce to the ArchObject if (aobj.isMulti() && aobj.getMapMultiHead() != null) { arch = aobj.getMapMultiHead(); - defarch = mainControl.getArchObjectStack().getArch(arch.getNodeNr()); + defarch = this.mainControl.getArchObjectStack().getArch(arch.getNodeNr()); } else { arch = aobj; defarch = defaobj; // refernce to the default ArchObject @@ -296,8 +296,8 @@ this.setResizable(true); // now draw the whole thing: - setBounds(mainControl.getMainView().getX() + (mainControl.getMainView().getWidth() - width) / 2, - mainControl.getMainView().getY() + (mainControl.getMainView().getHeight() - height) / 2 - 20, + setBounds(this.mainControl.getMainView().getX() + (this.mainControl.getMainView().getWidth() - width) / 2, + this.mainControl.getMainView().getY() + (this.mainControl.getMainView().getHeight() - height) / 2 - 20, width, height); setVisible(true); } Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-04 21:59:07 UTC (rev 130) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-04 23:05:11 UTC (rev 131) @@ -104,23 +104,23 @@ System.out.println("Running java version " + System.getProperty("java.version")); // Create the application and give it the parameters - final CMainControl controller = new CMainControl(); + final CMainControl mainControl = new CMainControl(); // Initialise the application - controller.init(doShow); - controller.refreshMenusAndToolbars(); - controller.getArchObjectStack().loadArches(); + mainControl.init(doShow); + mainControl.refreshMenusAndToolbars(); + mainControl.getArchObjectStack().loadArches(); System.gc(); // process commandline parameters: if (inlist != null) { /*open file and read instructions*/ - processFile(controller, inlist); + processFile(mainControl, inlist); System.exit(0); } // open initial maps for (final String infile : infiles) { - if (controller.openFile(new File(infile)) == null) { + if (mainControl.openFile(new File(infile)) == null) { log.warn("Cannot load file " + infile); } else { log.info("Successfully loaded " + infile); @@ -128,28 +128,28 @@ } if (outfile != null) { - controller.createImageWanted(outfile); // create map image + mainControl.createImageWanted(outfile); // create map image System.exit(0); // exit } - controller.refreshMenusAndToolbars(); + mainControl.refreshMenusAndToolbars(); } - private static void makeImage(final CMainControl controller, final String in, final String out) { + private static void makeImage(final CMainControl mainControl, final String in, final String out) { if (log.isInfoEnabled()) { log.info("converting " + in + " to " + out); } final File f = new File(in); if (f.canRead()) { - controller.openFile(f); - controller.createImageWanted(out); - controller.closeCurrentLevelWanted(); + mainControl.openFile(f); + mainControl.createImageWanted(out); + mainControl.closeCurrentLevelWanted(); } } - private static void processFile(final CMainControl controller, final String filelist) { + private static void processFile(final CMainControl mainControl, final String filelist) { try { BufferedReader reader = new BufferedReader(new FileReader(filelist)); try { @@ -160,7 +160,7 @@ log.info("done."); System.exit(0); } - makeImage(controller, in, out); + makeImage(mainControl, in, out); } } catch (final IOException e) { log.info("done."); Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-06-04 21:59:07 UTC (rev 130) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-06-04 23:05:11 UTC (rev 131) @@ -54,7 +54,7 @@ public class CMainMenu extends JMenuBar { /** Controller of this menu view. */ - private final CMainControl m_control; + private final CMainControl mainControl; private AggregateMenuLocation mainLocation; @@ -201,10 +201,10 @@ /** * Constructs a main menu. - * @param control The controller of this main menu. + * @param mainControl The controller of this main menu. */ - CMainMenu(CMainControl control) { - m_control = control; // reference to main control + CMainMenu(CMainControl mainControl) { + this.mainControl = mainControl; // reference to main control buildAggregates(); buildFileMenu(); buildEditMenu(); @@ -257,7 +257,7 @@ m_new.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.newLevelWanted(); + mainControl.newLevelWanted(); } }); menuManager.addMenuEntry("main.file", m_new); @@ -269,7 +269,7 @@ m_open.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.openFileWanted(); + mainControl.openFileWanted(); } }); menuManager.addMenuEntry("main.file", m_open); @@ -281,7 +281,7 @@ m_close.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.closeCurrentLevelWanted(); + mainControl.closeCurrentLevelWanted(); } }); menuManager.addMenuEntry("main.file", m_close); @@ -295,7 +295,7 @@ m_save.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.saveCurrentLevelWanted(); + mainControl.saveCurrentLevelWanted(); } }); menuManager.addMenuEntry("main.file", m_save); @@ -307,7 +307,7 @@ m_saveAs.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.saveCurrentLevelAsWanted(); + mainControl.saveCurrentLevelAsWanted(); } }); menuManager.addMenuEntry("main.file", m_saveAs); @@ -318,7 +318,7 @@ m_revert.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.revertCurrentLevelWanted(); + mainControl.revertCurrentLevelWanted(); } }); menuManager.addMenuEntry("main.file", m_revert); @@ -329,7 +329,7 @@ m_createImg.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.createImageWanted(); + mainControl.createImageWanted(); } }); menuManager.addMenuEntry("main.file", m_createImg); @@ -343,7 +343,7 @@ m_options.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.optionsWanted(); + mainControl.optionsWanted(); } }); menuManager.addMenuEntry("main.file", m_options); @@ -356,7 +356,7 @@ m_exit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.exitWanted(); + mainControl.exitWanted(); } }); menuManager.addMenuEntry("main.file", m_exit); @@ -381,7 +381,7 @@ m_undo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - // m_control.undoWanted(); + // mainControl.undoWanted(); } }); menuManager.addMenuEntry("main.edit", m_undo); @@ -394,7 +394,7 @@ m_redo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - // m_control.redoWanted(); + // mainControl.redoWanted(); } }); menuManager.addMenuEntry("main.edit", m_redo); @@ -406,7 +406,7 @@ m_clear.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); m_clear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.clearWanted(); + mainControl.clearWanted(); } }); menuManager.addMenuEntry("main.edit", m_clear); @@ -418,7 +418,7 @@ m_cut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.cutWanted(); + mainControl.cutWanted(); } }); menuManager.addMenuEntry("main.edit", m_cut); @@ -430,7 +430,7 @@ m_copy.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.copyWanted(); + mainControl.copyWanted(); } }); menuManager.addMenuEntry("main.edit", m_copy); @@ -442,7 +442,7 @@ m_paste.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.pasteWanted(); + mainControl.pasteWanted(); } }); menuManager.addMenuEntry("main.edit", m_paste); @@ -456,7 +456,7 @@ m_replace.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.replaceWanted(); + mainControl.replaceWanted(); } }); menuManager.addMenuEntry("main.edit", m_replace); @@ -468,7 +468,7 @@ m_fill_above.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.fillWanted(false); + mainControl.fillWanted(false); } }); menuManager.addMenuEntry("main.edit", m_fill_above); @@ -480,7 +480,7 @@ m_fill_below.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.fillWanted(true); + mainControl.fillWanted(true); } }); menuManager.addMenuEntry("main.edit", m_fill_below); @@ -506,7 +506,7 @@ for (int i = 0; i < aInfos.length; i++) { CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(aInfos[i].getName()); //TODO fix this - //m_control.setBoldFont(menuItem); + //mainControl.setBoldFont(menuItem); if (strSelectedLNFName.compareTo(aInfos[i].getClassName()) == 0) { menuItem.setChecked(true); } @@ -524,44 +524,44 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // open font-dialog and let user choose new font - Font newfont = JFontChooser.showDialog(m_control.getMainView(), "Choose Font", - m_control.getPlainFont() == null ? m_control.getMainView().getFont() : m_control.getPlainFont()); - if (newfont != null && !(newfont.getName().equals(m_control.getMainView().getFont().getName()) - && newfont.getSize() == m_control.getMainView().getFont().getSize())) { + Font newfont = JFontChooser.showDialog(mainControl.getMainView(), "Choose Font", + mainControl.getPlainFont() == null ? mainControl.getMainView().getFont() : mainControl.getPlainFont()); + if (newfont != null && !(newfont.getName().equals(mainControl.getMainView().getFont().getName()) + && newfont.getSize() == mainControl.getMainView().getFont().getSize())) { // set new font - m_control.newPlainFont(new Font(newfont.getName(), Font.PLAIN, newfont.getSize())); - m_control.newBoldFont(new Font(newfont.getName(), Font.BOLD, newfont.getSize())); + mainControl.newPlainFont(new Font(newfont.getName(), Font.PLAIN, newfont.getSize())); + mainControl.newBoldFont(new Font(newfont.getName(), Font.BOLD, newfont.getSize())); - JFontChooser.setUIFont(m_control.getPlainFont()); + JFontChooser.setUIFont(mainControl.getPlainFont()); // update fonts - m_control.getMainView().updateMapArchPanelFont(); + mainControl.getMainView().updateMapArchPanelFont(); updateFont(true); - m_control.getMainView().updateStatusBarFont(); - m_control.getMainView().updateArchPanelFont(); + mainControl.getMainView().updateStatusBarFont(); + mainControl.getMainView().updateArchPanelFont(); CFTreasureListTree.getInstance().updateFont(); ScriptEditControl.getInstance().updateGlobalFont(); } else { // update fonts - m_control.newPlainFont(JFontChooser.getDefaultFont()); - m_control.newBoldFont(new Font(JFontChooser.getDefaultFont().getFontName(), Font.BOLD, JFontChooser.getDefaultFont().getSize())); - JFontChooser.setUIFont(m_control.getPlainFont()); + mainControl.newPlainFont(JFontChooser.getDefaultFont()); + mainControl.newBoldFont(new Font(JFontChooser.getDefaultFont().getFontName(), Font.BOLD, JFontChooser.getDefaultFont().getSize())); + JFontChooser.setUIFont(mainControl.getPlainFont()); - m_control.getMainView().updateMapArchPanelFont(); + mainControl.getMainView().updateMapArchPanelFont(); updateFont(true); - m_control.getMainView().updateStatusBarFont(); - m_control.getMainView().updateArchPanelFont(); + mainControl.getMainView().updateStatusBarFont(); + mainControl.getMainView().updateArchPanelFont(); CFTreasureListTree.getInstance().updateFont(); ScriptEditControl.getInstance().updateGlobalFont(); // revert to default fonts - m_control.newPlainFont(null); - m_control.newBoldFont(null); + mainControl.newPlainFont(null); + mainControl.newBoldFont(null); CSettings.getInstance(IGUIConstants.APP_NAME).clearProperty(CMainControl.USE_FONT); } - m_control.getMainView().refreshMapArchPanel(); - m_control.getMainView().refreshMapTileList(); + mainControl.getMainView().refreshMapArchPanel(); + mainControl.getMainView().refreshMapTileList(); } }); menuManager.addMenuEntry("main.view", m_font); @@ -569,117 +569,117 @@ menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); se_monster = new CheckBoxMenuEntry("Show Monsters"); - se_monster.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_MONSTER)); + se_monster.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_MONSTER)); se_monster.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_monster.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_MONSTER); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_MONSTER); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_MONSTER); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_MONSTER); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_monster); se_exit = new CheckBoxMenuEntry("Show Exits"); - se_exit.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_EXIT)); + se_exit.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_EXIT)); se_exit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_exit.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_EXIT); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_EXIT); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_EXIT); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_EXIT); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_exit); se_background = new CheckBoxMenuEntry("Show Background"); - se_background.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND)); + se_background.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND)); se_background.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_background.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_BACKGROUND); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_BACKGROUND); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_background); se_door = new CheckBoxMenuEntry("Show Doors & Keys"); - se_door.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_DOOR)); + se_door.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_DOOR)); se_door.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_door.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_DOOR); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_DOOR); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_DOOR); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_DOOR); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_door); se_wall = new CheckBoxMenuEntry("Show Wall"); - se_wall.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_WALL)); + se_wall.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_WALL)); se_wall.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_wall.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_WALL); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_WALL); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_WALL); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_WALL); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_wall); se_equip = new CheckBoxMenuEntry("Show Equipment"); - se_equip.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_EQUIP)); + se_equip.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_EQUIP)); se_equip.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_equip.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_EQUIP); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_EQUIP); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_EQUIP); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_EQUIP); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_equip); se_treasure = new CheckBoxMenuEntry("Show Treasure"); - se_treasure.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_TREASURE)); + se_treasure.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_TREASURE)); se_treasure.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_treasure.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_TREASURE); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_TREASURE); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_TREASURE); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_TREASURE); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_treasure); se_connected = new CheckBoxMenuEntry("Show Connected"); - se_connected.setChecked(m_control.isTileEdit(IGUIConstants.TILE_EDIT_CONNECTED)); + se_connected.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_CONNECTED)); se_connected.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_connected.isChecked()) { - m_control.selectEditType(IGUIConstants.TILE_EDIT_CONNECTED); + mainControl.selectEditType(IGUIConstants.TILE_EDIT_CONNECTED); } else { - m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_CONNECTED); + mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_CONNECTED); } - m_control.refreshCurrentMap(); + mainControl.refreshCurrentMap(); } }); menuManager.addMenuEntry("main.view", se_connected); @@ -689,7 +689,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // set tileEdit to zero (-> show all) - m_control.setTileEdit(0); + mainControl.setTileEdit(0); se_monster.setChecked(false); se_exit.setChecked(false); se_background.setChecked(false); @@ -698,7 +698,7 @@ se_equip.setChecked(false); se_treasure.setChecked(false); se_connected.setChecked(false); - m_control.refreshCurrentMap(); // redraw map + mainControl.refreshCurrentMap(); // redraw map } }); menuManager.addMenuEntry("main.view", m_show_all); @@ -718,12 +718,12 @@ m_autojoin = new CheckBoxMenuEntry("Auto-Joining"); m_autojoin.setMnemonic('A'); m_autojoin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, Event.CTRL_MASK)); - m_autojoin.setChecked(m_control.getAutojoin()); + m_autojoin.setChecked(mainControl.getAutojoin()); m_autojoin.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { // toggle autojoining state on/off - m_control.setAutojoin(m_autojoin.isChecked()); + mainControl.setAutojoin(m_autojoin.isChecked()); } }); menuManager.addMenuEntry("main.map", m_autojoin); @@ -732,12 +732,12 @@ m_gridToggle = new CheckBoxMenuEntry("Show Grid"); m_gridToggle.setMnemonic('G'); - m_gridToggle.setChecked(m_control.isGridVisible()); + m_gridToggle.setChecked(mainControl.isGridVisible()); m_gridToggle.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.setGridVisibility(m_gridToggle.isChecked()); + mainControl.setGridVisibility(m_gridToggle.isChecked()); } }); menuManager.addMenuEntry("main.map", m_gridToggle); @@ -748,7 +748,7 @@ m_enterExit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterExitWanted(); + mainControl.enterExitWanted(); } }); menuManager.addMenuEntry("main.map", m_enterExit); @@ -759,7 +759,7 @@ m_enterNorth.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.NORTH); + mainControl.enterTileWanted(IGUIConstants.NORTH); } }); menuManager.addMenuEntry("main.map", m_enterNorth); @@ -769,7 +769,7 @@ m_enterEast.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.EAST); + mainControl.enterTileWanted(IGUIConstants.EAST); } }); menuManager.addMenuEntry("main.map", m_enterEast); @@ -779,7 +779,7 @@ m_enterSouth.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.SOUTH); + mainControl.enterTileWanted(IGUIConstants.SOUTH); } }); menuManager.addMenuEntry("main.map", m_enterSouth); @@ -789,7 +789,7 @@ m_enterWest.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.WEST); + mainControl.enterTileWanted(IGUIConstants.WEST); } }); menuManager.addMenuEntry("main.map", m_enterWest); @@ -799,7 +799,7 @@ m_enterUpper.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.TOP); + mainControl.enterTileWanted(IGUIConstants.TOP); } }); menuManager.addMenuEntry("main.map", m_enterUpper); @@ -809,7 +809,7 @@ m_enterLower.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.enterTileWanted(IGUIConstants.BOTTOM); + mainControl.enterTileWanted(IGUIConstants.BOTTOM); } }); menuManager.addMenuEntry("main.map", m_enterLower); @@ -820,7 +820,7 @@ m_showTiles.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.toggleShowTiles(); + mainControl.toggleShowTiles(); } }); menuManager.addMenuEntry("main.map", m_showTiles); @@ -832,7 +832,7 @@ m_properties.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.mapPropertiesWanted(); + mainControl.mapPropertiesWanted(); } }); menuManager.addMenuEntry("main.map", m_properties); @@ -856,7 +856,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // lock pickmaps - m_control.setPickmapsLocked(m_lockPickmaps.isChecked()); + mainControl.setPickmapsLocked(m_lockPickmaps.isChecked()); m_newPickmap.setEnabled(!m_lockPickmaps.isChecked()); boolean isArchLoadComplete = ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE; @@ -887,7 +887,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // create new pickmap - m_control.newPickmapWanted(); + mainControl.newPickmapWanted(); } }); menuManager.addMenuEntry("main.pickmaps", m_newPickmap); @@ -899,7 +899,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // close pickmap - m_control.closeActivePickmapWanted(); + mainControl.closeActivePickmapWanted(); } }); menuManager.addMenuEntry("main.pickmaps", m_deletePickmap); @@ -912,7 +912,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // load pickmap as normal map - m_control.openActivePickmapAsMapWanted(); + mainControl.openActivePickmapAsMapWanted(); } }); menuManager.addMenuEntry("main.pickmaps", m_loadPickmap); @@ -924,7 +924,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // save pickmap - m_control.saveActivePickmapWanted(); + mainControl.saveActivePickmapWanted(); } }); menuManager.addMenuEntry("main.pickmaps", m_savePickmap); @@ -936,7 +936,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { // revert pickmap - m_control.revertActivePickmapWanted(); + mainControl.revertActivePickmapWanted(); } }); menuManager.addMenuEntry("main.pickmaps", m_revertPickmap); @@ -960,8 +960,8 @@ public void actionPerformed(ActionEvent event) { //TODO fix this //menu_collect.setPopupMenuVisible(false); - m_control.getMainView().update(m_control.getMainView().getGraphics()); - m_control.collectCFArches(); + mainControl.getMainView().update(mainControl.getMainView().getGraphics()); + mainControl.collectCFArches(); } }); menuManager.addMenuEntry("main.resources", m_collectArch); @@ -971,7 +971,7 @@ m_spellC.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.getTypelist().importSpellsWanted(m_control); + mainControl.getTypelist().importSpellsWanted(mainControl); } }); menuManager.addMenuEntry("main.resources", m_spellC); @@ -1008,7 +1008,7 @@ public void buildAnalyzeMenu() { MenuManager menuManager = MenuManager.getMenuManager(); - CFilterControl filter = m_control.getFilterControl(); + CFilterControl filter = mainControl.getFilterControl(); BasicMenuEntry entry = filter.createMenuEntry(); entry.setVisible(true); entry.setMnemonic('y'); @@ -1026,7 +1026,7 @@ menuManager.addMenuLocation(menu_analyze); menuManager.addMenuEntry("main", entry); entry.setMnemonic('y'); - CFilterControl filter = m_control.getFilterControl(); + CFilterControl filter = mainControl.getFilterControl(); m_analyze_show = new JMenu("Filter View"); m_analyze_show.setMnemonic('v'); m_analyze_show.setEnabled(false); @@ -1036,13 +1036,13 @@ String action; action = ((JCheckBoxMenuItem)event.getSource()).getText(); if (action.equals("Apply filter")) { - m_control.getFilterControl().setFilterOut( + mainControl.getFilterControl().setFilterOut( ((JMenuItem)event.getSource()).isSelected()); } else if (action.equals("Invert matches")) { - m_control.getFilterControl().setFilterOutFilterInverted( + mainControl.getFilterControl().setFilterOutFilterInverted( ((JMenuItem)event.getSource()).isSelected()); } else { - m_control.getFilterControl().setFilterOutFilterEnabled( + mainControl.getFilterControl().setFilterOutFilterEnabled( action, (((JCheckBoxMenuItem)event.getSource()).getSelectedObjects() != null)); } @@ -1098,13 +1098,13 @@ String action; action = ((JMenuItem)event.getSource()).getText(); if (action.equals("Apply filter")) { - m_control.getFilterControl().setHighLight( + mainControl.getFilterControl().setHighLight( ref, ((JMenuItem)event.getSource()).isSelected()); } else if (action.equals("Invert matches")) { - m_control.getFilterControl().setHighLightFilterInverted( + mainControl.getFilterControl().setHighLightFilterInverted( ref, ((JMenuItem)event.getSource()).isSelected()); } else { - m_control.getFilterControl().setHighLightFilterEnabled( + mainControl.getFilterControl().setHighLightFilterEnabled( ref, action, (((JCheckBoxMenuItem)event.getSource()).getSelectedObjects() != null)); } @@ -1147,7 +1147,7 @@ m_helpMenu.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.openHelpWindow(); + mainControl.openHelpWindow(); } }); menu_help.add(m_helpMenu); @@ -1157,7 +1157,7 @@ m_aboutMenu.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.showMessage("About " + IGUIConstants.APP_NAME, + mainControl.showMessage("About " + IGUIConstants.APP_NAME, " Version " + IGUIConstants.VERSION + "\n (c) 2001 Michael Toennies\n" + " Andreas Vogl\n"); } @@ -1177,7 +1177,7 @@ m_newWindow.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - //m_control.newWindowWanted(); + //mainControl.newWindowWanted(); } }); menu_window.add(m_newWindow); @@ -1189,7 +1189,7 @@ m_closeAll.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.closeAllLevelsWanted(); + mainControl.closeAllLevelsWanted(); } }); menu_window.add(m_closeAll); @@ -1198,8 +1198,8 @@ } private void buildBshMenu() { - m_control.getScriptController().getView().setMainMenu(this); - add(m_control.getScriptController().getView().getMenu()); + mainControl.getScriptController().getView().setMainMenu(this); + add(mainControl.getScriptController().getView().getMenu()); } /** Rebuilds the window menu. */ @@ -1210,7 +1210,7 @@ menu_window.add(m_closeAll); int index = 1; - Enumeration windows = m_control.getAllLevelWindows(); + Enumeration windows = mainControl.getAllLevelWindows(); if (windows != null) { menu_window.addSeparator(); while (windows.hasMoreElements()) { @@ -1226,7 +1226,7 @@ menuItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { - m_control.setCurrentLevelView(view); + mainControl.setCurrentLevelView(view); } }); menu_window.add(menuItem); @@ -1248,7 +1248,7 @@ * @param state true when there is an active pickmap */ public void setActivePickmapsEnabled(boolean state) { - if (!m_control.isPickmapsLocked()) { + if (!mainControl.isPickmapsLocked()) { m_deletePickmap.setEnabled(state); m_loadPickmap.setEnabled(state); m_revertPickmap.setEnabled(state); @@ -1270,14 +1270,14 @@ m_enterExit.setEnabled(false); // autojoining is only allowed if the definitions file is available - m_autojoin.setEnabled(m_control.getJoinlist() != null); + m_autojoin.setEnabled(mainControl.getJoinlist() != null); // collect arches is only allowed if we run from individual archfiles m_collectArch.setEnabled(isArchLoadComplete && !ArchObjectStack.isLoadedFromArchive()); if (isArchLoadComplete) { m_viewTreasure.setEnabled(true); - if (!m_control.isPickmapsLocked() && m_control.getMainView().isPickmapActive()) { + if (!mainControl.isPickmapsLocked() && mainControl.getMainView().isPickmapActive()) { m_deletePickmap.setEnabled(true); m_loadPickmap.setEnabled(true); m_revertPickmap.setEnabled(true); @@ -1296,10 +1296,10 @@ m_savePickmap.setEnabled(false); } - m_newPickmap.setEnabled(!m_control.isPickmapsLocked()); + m_newPickmap.setEnabled(!mainControl.isPickmapsLocked()); // is there a valid open map view? - if (m_control.getCurrentMap() == null) { + if (mainControl.getCurrentMap() == null) { m_save.setEnabled(false); m_close.setEnabled(false); m_saveAs.setEnabled(false); @@ -1330,18 +1330,18 @@ } else { // yes... m_gridToggle.setEnabled(true); m_createImg.setEnabled(true); - boolean fLevelEdited = m_control.isLevelEdited(); + boolean fLevelEdited = mainControl.isLevelEdited(); m_close.setEnabled(fLevelEdited); - m_save.setEnabled(m_control.isPlainSaveEnabled()); + m_save.setEnabled(mainControl.isPlainSaveEnabled()); m_saveAs.setEnabled(fLevelEdited); m_properties.setEnabled(true); m_replace.setEnabled(true); - m_gridToggle.setChecked(m_control.isGridVisible()); + m_gridToggle.setChecked(mainControl.isGridVisible()); // revert is only allowed when map has been modified - m_revert.setEnabled(m_control.getCurrentMap().isLevelChanged()); + m_revert.setEnabled(mainControl.getCurrentMap().isLevelChanged()); // enter north/east/south/west map is only allowed when such tile-paths exist in the maparch BasicMenuEntry tmenu = null; @@ -1367,8 +1367,8 @@ tmenu = m_enterLower; break; } - if (m_control.getCurrentMap().getMapTilePath(direction) != null && - m_control.getCurrentMap().getMapTilePath(direction).length() > 0) { + if (mainControl.getCurrentMap().getMapTilePath(direction) != null && + mainControl.getCurrentMap().getMapTilePath(direction).length() > 0) { tmenu.setEnabled(true); foundATile = true; } else { @@ -1376,9 +1376,9 @@ } } m_showTiles.setEnabled(foundATile); - m_showTiles.setChecked(m_control.getCurrentMap().isTileShow()); + m_showTiles.setChecked(mainControl.getCurrentMap().isTileShow()); // Cut/Copy only when there is a highlighted tile selection - if (m_control.getCurrentMap().getMapView().isHighlight()) { + if (mainControl.getCurrentMap().getMapView().isHighlight()) { m_clear.setEnabled(true); m_cut.setEnabled(true); m_copy.setEnabled(true); @@ -1386,7 +1386,7 @@ m_fill_below.setEnabled(true); m_enterExit.setEnabled(true); - m_paste.setEnabled(!m_control.isCopyBufferEmpty()); + m_paste.setEnabled(!mainControl.isCopyBufferEmpty()); } else { m_clear.setEnabled(false); m_cut.setEnabled(false); @@ -1398,7 +1398,7 @@ } /*extract datas from filterControl and transfert to menu*/ //TODO FIX THIS - /*CFilterControl f_control = m_control.getFilterControl(); + /*CFilterControl f_control = mainControl.getFilterControl(); for (int i = 0; i < 3; i++) { m_analyze_highLight[i].setEnabled(true); m_analyze_highLight_activate[i].setEnabled(true); @@ -1431,75 +1431,75 @@ * @param do_redraw if true, menu is redrawn at the end */ public void updateFont(boolean do_redraw) { - //m_control.setBoldFont(menu_file); - //m_control.setBoldFont(menu_edit); - //m_control.setBoldFont(menu_view); - //m_control.setBoldFont(menu_map); - //m_control.setBoldFont(menu_pickmaps); - //m_control.setBoldFont(menu_collect); - //m_control.setBoldFont(menu_analyze); - //m_control.setBoldFont(menu_script); - m_control.setBoldFont(menu_help); - m_control.setBoldFont(menu_window); + //mainControl.setBoldFont(menu_file); + //mainControl.setBoldFont(menu_edit); + //mainControl.setBoldFont(menu_view); + //mainControl.setBoldFont(menu_map); + //mainControl.setBoldFont(menu_pickmaps); + //mainControl.setBoldFont(menu_collect); + //mainControl.setBoldFont(menu_analyze); + //mainControl.setBoldFont(menu_script); + mainControl.setBoldFont(menu_help); + mainControl.setBoldFont(menu_window); // TODO fix this - /*m_control.setBoldFont(m_new); - m_control.setBoldFont(m_open); - m_control.setBoldFont(m_close); - m_control.setBoldFont(m_save); - m_control.setBoldFont(m_saveAs); - m_control.setBoldFont(m_revert); - m_control.setBoldFont(m_options); - m_control.setBoldFont(m_exit);*/ + /*mainControl.setBoldFont(m_new); + mainControl.setBoldFont(m_open); + mainControl.setBoldFont(m_close); + mainControl.setBoldFont(m_save); + mainControl.setBoldFont(m_saveAs); + mainControl.setBoldFont(m_revert); + mainControl.setBoldFont(m_options); + mainControl.setBoldFont(m_exit);*/ - /*m_control.setBoldFont(m_newPickmap); - m_control.setBoldFont(m_deletePickmap); - m_control.setBoldFont(m_savePickmap); + /*mainControl.setBoldFont(m_newPickmap); + mainControl.setBoldFont(m_deletePickmap); + mainControl.setBoldFont(m_savePickmap); m_ontrol.setBoldFont(m_revertPickmap);*/ - /*m_control.setBoldFont(m_collectArch); - m_control.setBoldFont(m_spellC); - m_control.setBoldFont(m_viewTreasure);*/ + /*mainControl.setBoldFont(m_collectArch); + mainControl.setBoldFont(m_spellC); + mainControl.setBoldFont(m_viewTreasure);*/ - //m_control.setBoldFont(m_scriptMenu); - //m_control.setBoldFont(m_analyzeMenu); - m_control.setBoldFont(m_helpMenu); - m_control.setBoldFont(m_aboutMenu); + //mainControl.setBoldFont(m_scriptMenu); + //mainControl.setBoldFont(m_analyzeMenu); + mainControl.setBoldFont(m_helpMenu); + mainControl.setBoldFont(m_aboutMenu); - /*m_control.setBoldFont(m_autojoin); - m_control.setBoldFont(m_gridToggle); - m_control.setBoldFont(m_properties); - m_control.setBoldFont(m_enterExit); - m_control.setBoldFont(m_enterNorth); - m_control.setBoldFont(m_enterEast); - m_control.setBoldFont(m_enterSouth); - m_control.setBoldFont(m_enterWest); - m_control.setBoldFont(m_enterUpper); - m_control.setBoldFont(m_enterLower);*/ + /*mainControl.setBoldFont(m_autojoin); + mainControl.setBoldFont(m_gridToggle); + mainControl.setBoldFont(m_properties); + mainControl.setBoldFont(m_enterExit); + mainControl.setBoldFont(m_enterNorth); + mainControl.setBoldFont(m_enterEast); + mainControl.setBoldFont(m_enterSouth); + mainControl.setBoldFont(m_enterWest); + mainControl.setBoldFont(m_enterUpper); + mainControl.setBoldFont(m_enterLower);*/ - /*m_control.setBoldFont(m_undo); - m_control.setBoldFont(m_redo); - m_control.setBoldFont(m_clear); - m_control.setBoldFont(m_cut); - m_control.setBoldFont(m_copy); - m_control.setBoldFont(m_paste); - m_control.setBoldFont(m_replace); - m_control.setBoldFont(m_fill_above); - m_control.setBoldFont(m_fill_below);*/ + /*mainControl.setBoldFont(m_undo); + mainControl.setBoldFont(m_redo); + mainControl.setBoldFont(m_clear); + mainControl.setBoldFont(m_cut); + mainControl.setBoldFont(m_copy); + mainControl.setBoldFont(m_paste); + mainControl.setBoldFont(m_replace); + mainControl.setBoldFont(m_fill_above); + mainControl.setBoldFont(m_fill_below);*/ - /*m_control.setBoldFont(m_font); - m_control.setBoldFont(se_monster); - m_control.setBoldFont(se_exit); - m_control.setBoldFont(se_background); - m_control.setBoldFont(se_door); - m_control.setBoldFont(se_wall); - m_control.setBoldFont(se_equip); - m_control.setBoldFont(se_treasure); - m_control.setBoldFont(se_connected); - m_control.setBoldFont(m_show_all);*/ + /*mainControl.setBoldFont(m_font); + mainControl.setBoldFont(se_monster); + mainControl.setBoldFont(se_exit); + mainControl.setBoldFont(se_background); + mainControl.setBoldFont(se_door); + mainControl.setBoldFont(se_wall); + mainControl.setBoldFont(se_equip); + mainControl.setBoldFont(se_treasure); + mainControl.setBoldFont(se_connected); + mainControl.setBoldFont(m_show_all);*/ - m_control.setBoldFont(m_newWindow); - m_control.setBoldFont(m_closeAll); + mainControl.setBoldFont(m_newWindow); + mainControl.setBoldFont(m_closeAll); if (do_redraw) { refresh(); @@ -1509,9 +1509,9 @@ /** Notifies that the application is about to exit. */ void appExitNotify() { CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - if (m_control.getPlainFont() != null) { - settings.setProperty(CMainControl.USE_FONT, m_control.getPlainFont().getName() + "|" - + m_control.getPlainFont().getSize()); + if (mainControl.getPlainFont() != null) { + settings.setProperty(CMainControl.USE_FONT, mainControl.getPlainFont().getName() + "|" + + mainControl.getPlainFont().getSize()); } } @@ -1524,9 +1524,11 @@ } public void actionPerformed(ActionEvent event) { - m_control.setLookNFeel(m_strClassName); + mainControl.setLookNFeel(m_strClassName); CSettings.getInstance(IGUIConstants.APP_NAME).setProperty( CMainView.SELECTED_LNF_KEY, m_strClassName); } - } -} + + } // class CLNFActionListener + +} // class CMainMenu Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-06-04 21:59:07 UTC (rev 130) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-06-04 23:05:11 UTC (rev 131) @@ -25,9 +25,11 @@ package cfeditor; import java.awt.BorderLayout; +import java.text.NumberFormat; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.BevelBorder; +import org.jetbrains.annotations.Nullable; /** * <code>CMainStatusbar</code> implements the main statusbar of the @@ -37,7 +39,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMainStatusbar extends JPanel { +public final class CMainStatusbar extends JPanel { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -62,7 +64,7 @@ * as its controller. * @param mainControl The controller of this view. */ - CMainStatusbar(final CMainControl mainControl) { + public CMainStatusbar(final CMainControl mainControl) { this.mainControl = mainControl; setLayout(new BorderLayout()); @@ -106,12 +108,12 @@ * Sets the one line text displayed to the user. * @param strText The text to be set. */ - public void setText(String strText) { + public void setText(final String strText) { status.setText(strText); repaint(); } - void setStatusText(String string) { + void setStatusText(final String string) { levelStatus.setText(string != null ? string : " "); } @@ -122,36 +124,12 @@ refresh(); } - /** - * Sets the level info panels text based on the information from the level - * controller. - *@param level The level whose info is to be displayed. - */ - /* - void setLevelInfo(CLevelControl level) { - if (level != null) { - levelStatus.setText( - "Level: "+level.getLevelWidth()+"x"+level.getLevelHeight()+ - " Tile: "+level.getTileWidth()+"x"+level.getTileHeight()+ - " Tile Data: "+level.getBitsPerTile()+ - " / "+level.getDataBits()+" bits"); - } else { - levelStatus.setText( - "Level: -x- "+ - " Tile: -x- "+ - " Tile Data: - "+ - "/ - bits"); - } - repaint(); - } - */ - /** Refreshes the memory usage info panel. */ void refresh() { - Runtime runtime = Runtime.getRuntime(); - long freeMem = runtime.freeMemory(); - long totMem = runtime.totalMemory(); - long usedMem = totMem - freeMem; + final Runtime runtime = Runtime.getRuntime(); + final long freeMem = runtime.freeMemory(); + final long totMem = runtime.totalMemory(); + final long usedMem = totMem - freeMem; memory.setText(" ( " + mainControl.getArchObjectStack().getArchObjCount() + "/" + mainControl.getArchObjectStack().getArchCount() @@ -160,27 +138,32 @@ repaint(); } + /** The DecimalFormat to use for formatting the numbers in {@link #getMemoryString(long)}.. */ + private static final NumberFormat FORMAT = NumberFormat.getInstance(); + + static { + FORMAT.setMinimumFractionDigits(1); + FORMAT.setMaximumFractionDigits(1); + } + + /** The units used by {@link #getMemoryString(long)}. */ + private static final String[] UNITS = {"Bytes", "KB", "MB", "GB"}; + /** - * Returns the given memory amount (long) as a string scales the value + * Returns the given memory amount as a string scales the value * to be bytes, kilobytes or megabytes. + * @param mem memory amount to calculate + * @return String for <var>memory</var> */ - private String ge... [truncated message content] |
From: <chr...@us...> - 2006-06-06 02:50:54
|
Revision: 132 Author: christianhujer Date: 2006-06-04 16:13:05 -0700 (Sun, 04 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=132&view=rev Log Message: ----------- Cosmetic changes. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-04 23:05:11 UTC (rev 131) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-04 23:13:05 UTC (rev 132) @@ -332,4 +332,5 @@ fireMapCursorChangedPosEvent(); } } -} + +} // class MapCursor Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-04 23:05:11 UTC (rev 131) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-04 23:13:05 UTC (rev 132) @@ -37,4 +37,5 @@ @Override public MapCursor getSource() { return (MapCursor) super.getSource(); } + } // class MapCursorEvent Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-04 23:05:11 UTC (rev 131) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-04 23:13:05 UTC (rev 132) @@ -36,4 +36,5 @@ * @param e MapCursorEvent */ void mapCursorChangedMode(MapCursorEvent e); + } // interface MapCursorListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-06 02:46:31
|
Revision: 134 Author: christianhujer Date: 2006-06-05 14:42:45 -0700 (Mon, 05 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=134&view=rev Log Message: ----------- Code beautification. Made filters implement Java Event Listening. Changed Listener handling to thread safe code. Extracted filter type constants to enums. Modified Paths: -------------- trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java trunk/crossfire/src/cfeditor/filter/ConfigEvent.java trunk/crossfire/src/cfeditor/filter/ConfigListener.java trunk/crossfire/src/cfeditor/filter/Filter.java trunk/crossfire/src/cfeditor/filter/FilterConfig.java trunk/crossfire/src/cfeditor/filter/NamedFilterConfig.java trunk/crossfire/src/cfeditor/filter/NamedFilterEvent.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/filter/NamedFilterListener.java trunk/crossfire/src/cfeditor/filter/SimpleFilterConfig.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java Added Paths: ----------- trunk/crossfire/src/cfeditor/filter/ConfigEventType.java trunk/crossfire/src/cfeditor/filter/NamedFilterEventType.java Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-05 21:42:45 UTC (rev 134) @@ -51,7 +51,7 @@ */ public class ArchObject implements Cloneable { - private static final Logger log = Logger.getLogger(ArchObject.class); + private static final Logger LOG = Logger.getLogger(ArchObject.class); public static final int TYPE_UNSET = -666; // means the arch has no type set @@ -59,9 +59,9 @@ private static CFArchTypeList typelist; // static reference to the typelist (-> find syntax errors) - private static int my_id_counter = 0; + private static int myIdCounter = 0; - private int my_id; // the one and only id + private int myId; // the one and only id // unique arch object id at editor runtime private String faceName; // face name : 1 @@ -99,7 +99,7 @@ private boolean editflag; // if true, object is in a editor // for example in the map arch panel - private boolean artifacts_flag; // if set, this is not a "real" arch + private boolean artifactsFlag; // if set, this is not a "real" arch // It will NOT be included in the arch collection private ArchObject next; // to chain ArchObjects in maps @@ -112,19 +112,19 @@ * Enclosing container; if null, this object is not in a container but in a * map. */ - private ArchObject _env = null; + private ArchObject env = null; /** - * All inventory objects. Set to {@link java.util.Collections#EMPTY_LIST} + * All inventory objects. Set to {@link Collections#EMPTY_LIST} * (to save space) if the object has no inventory. */ - private List _inv = Collections.EMPTY_LIST; + private List<ArchObject> inv = Collections.EMPTY_LIST; - private int arch_type; // CF object type of the arch + private int archType; // CF object type of the arch - private int intern_temp; // used for drawing + private int internTemp; // used for drawing - private int edit_type; // for view settings + private int editType; // for view settings private AutojoinList join; // if nonzero, pointing to the list of autojoining archetypes @@ -135,7 +135,7 @@ multi = null; // this object stays 'null' for all single-tile arches script = null; // this object stays 'null' unless there are events defined - my_id = my_id_counter++; // increase ID counter for every new arch created + myId = myIdCounter++; // increase ID counter for every new arch created archName = null; archText = new StringBuffer(""); @@ -143,10 +143,10 @@ archTextCount = 0; // lines inserted in archText objName = null; - intern_temp = 0; + internTemp = 0; noface = true; // this sucker has no face - artifacts_flag = false; // will be true for arches from the artifacts file + artifactsFlag = false; // will be true for arches from the artifacts file faceName = null; // if there is a face cmd, this is the face name facenr = -1; // if we have a face AND we have loaded the face, this is his number. // if faceName != null and facenr == -1, we haven't loaded the face @@ -154,29 +154,29 @@ editflag = false; join = null; // no autojoin list per default - arch_type = ArchObject.TYPE_UNSET; // type must be set + archType = TYPE_UNSET; // type must be set nodenr = -1; // as default we are not in a node list next = null; prev = null; tempptr = null; mapx = 0; mapy = 0; - edit_type = 0; + editType = 0; } // set static references: arch stack and typelist - public static void setArchStack(ArchObjectStack stack) { + public static void setArchStack(final ArchObjectStack stack) { archstack = stack; } - public static void setTypeList(CFArchTypeList tlist) { + public static void setTypeList(final CFArchTypeList tlist) { typelist = tlist; } // edit type is the editable value from arch // here it is used to identify the layer type public int getEditType() { - return edit_type; + return editType; } /** @return the default <code>ArchObject</code> for this arch */ @@ -193,86 +193,85 @@ * Get the EditType of an ArchObject (e.g. floor, monster, etc). * These are determined by the various attributes of the arch * (->archText). - * @param check_type bitmask containing the edit type(s) to be calculated - * @return new edit_type for this arch + * @param checkType bitmask containing the edit type(s) to be calculated + * @return new editType for this arch */ - public int calculateEditType(int check_type) { - int no_pick, no_pass; // some attributes - ArchObject defarch = getDefaultArch(); // default arch + public int calculateEditType(int checkType) { + final ArchObject defarch = getDefaultArch(); // default arch - /* if one of the types in check_type already is in edit_type, + /* if one of the types in check_type already is in editType, // we exclude that one - if ((check_type&edit_type) != 0) { - check_type -= (check_type&edit_type); + if ((check_type&editType) != 0) { + check_type -= (check_type&editType); } */ // bail out if nothing to do - if (check_type == 0) { - return edit_type; + if (checkType == 0) { + return editType; } - if (edit_type == IGUIConstants.TILE_EDIT_NONE) { - edit_type = 0; - } else if (edit_type != 0) { + if (editType == IGUIConstants.TILE_EDIT_NONE) { + editType = 0; + } else if (editType != 0) { // all flags from 'check_type' must be unset in this arch because they get recalculated now - edit_type &= ~check_type; + editType &= ~checkType; } - if ((check_type & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 && + if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 && getAttributeValue("is_floor", defarch) == 1 && getAttributeValue("no_pick", defarch) == 1) { // Backgroud: floors - edit_type |= IGUIConstants.TILE_EDIT_BACKGROUND; + editType |= IGUIConstants.TILE_EDIT_BACKGROUND; } - if ((check_type & IGUIConstants.TILE_EDIT_MONSTER) != 0 && + if ((checkType & IGUIConstants.TILE_EDIT_MONSTER) != 0 && getAttributeValue("alive", defarch) == 1 && (getAttributeValue("monster", defarch) == 1 || getAttributeValue("generator", defarch) == 1)) { // Monster: monsters/npcs/generators - edit_type |= IGUIConstants.TILE_EDIT_MONSTER; + editType |= IGUIConstants.TILE_EDIT_MONSTER; } - if ((check_type & IGUIConstants.TILE_EDIT_WALL) != 0 && - arch_type == 0 && getAttributeValue("no_pass", defarch) == 1) { + if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 && + archType == 0 && getAttributeValue("no_pass", defarch) == 1) { // Walls - edit_type |= IGUIConstants.TILE_EDIT_WALL; + editType |= IGUIConstants.TILE_EDIT_WALL; } - if ((check_type & IGUIConstants.TILE_EDIT_CONNECTED) != 0 && + if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 && getAttributeValue("connected", defarch) != 0) { // Connected Objects - edit_type |= IGUIConstants.TILE_EDIT_CONNECTED; + editType |= IGUIConstants.TILE_EDIT_CONNECTED; } - if ((check_type & IGUIConstants.TILE_EDIT_EXIT) != 0 && - arch_type == 66 || arch_type == 41 || arch_type == 95) { + if ((checkType & IGUIConstants.TILE_EDIT_EXIT) != 0 && + archType == 66 || archType == 41 || archType == 95) { // Exit: teleporter/exit/trapdoors - edit_type |= IGUIConstants.TILE_EDIT_EXIT; + editType |= IGUIConstants.TILE_EDIT_EXIT; } - if ((check_type & IGUIConstants.TILE_EDIT_TREASURE) != 0 && - getAttributeValue("no_pick", defarch) == 0 && (arch_type == 4 || - arch_type == 5 || arch_type == 36 || arch_type == 60 || - arch_type == 85 || arch_type == 111 || arch_type == 123 || - arch_type == 124 || arch_type == 130)) { + if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 && + getAttributeValue("no_pick", defarch) == 0 && (archType == 4 || + archType == 5 || archType == 36 || archType == 60 || + archType == 85 || archType == 111 || archType == 123 || + archType == 124 || archType == 130)) { // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls - edit_type |= IGUIConstants.TILE_EDIT_TREASURE; + editType |= IGUIConstants.TILE_EDIT_TREASURE; } - if ((check_type & IGUIConstants.TILE_EDIT_DOOR) != 0 && - arch_type == 20 || arch_type == 23 || arch_type == 26 || - arch_type == 91 || arch_type == 21 || arch_type == 24) { + if ((checkType & IGUIConstants.TILE_EDIT_DOOR) != 0 && + archType == 20 || archType == 23 || archType == 26 || + archType == 91 || archType == 21 || archType == 24) { // Door: door/special door/gates + keys - edit_type |= IGUIConstants.TILE_EDIT_DOOR; + editType |= IGUIConstants.TILE_EDIT_DOOR; } - if ((check_type & IGUIConstants.TILE_EDIT_EQUIP) != 0 && - getAttributeValue("no_pick", defarch) == 0 && ((arch_type >= 13 && - arch_type <= 16) || arch_type == 33 || arch_type == 34 || - arch_type == 35 || arch_type == 39 || arch_type == 70 || - arch_type == 87 || arch_type == 99 || arch_type == 100 || - arch_type == 104 || arch_type == 109 || arch_type == 113 || - arch_type == 122 || arch_type == 3)) { + if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 && + getAttributeValue("no_pick", defarch) == 0 && ((archType >= 13 && + archType <= 16) || archType == 33 || archType == 34 || + archType == 35 || archType == 39 || archType == 70 || + archType == 87 || archType == 99 || archType == 100 || + archType == 104 || archType == 109 || archType == 113 || + archType == 122 || archType == 3)) { // Equipment: weapons/armour/wands/rods - edit_type |= IGUIConstants.TILE_EDIT_EQUIP; + editType |= IGUIConstants.TILE_EDIT_EQUIP; } - return edit_type; + return editType; } /** @@ -286,27 +285,27 @@ * we just want to ignore the default arch * @return <value>, zero if not found */ - public int getAttributeValue(String attr, ArchObject defarch) { - String AText = archText.toString(); // The "real" Archtext from arch & defarch - String line; // tmp string - int i, j; - int result = 0; // returned value + public int getAttributeValue(String attr, final ArchObject defarch) { + String aText = archText.toString(); // The "real" Archtext from arch & defarch + int j; // Add all attributes from defarch that don't already exist in AText if (defarch != null) { - AText = AText + diffArchText(defarch.getArchText(), true); + aText = aText + diffArchText(defarch.getArchText(), true); } - if (!AText.endsWith("\n")) { - AText = AText.concat("\n"); // string should end with '\n', see below + if (!aText.endsWith("\n")) { + aText = aText.concat("\n"); // string should end with '\n', see below } attr = attr.trim() + " "; // attr must be followed by space // Check line by line for the string 'attr' - for (i = 0, j = 0; i < AText.length(); i++) { - if (AText.charAt(i) == '\n') { - line = AText.substring(j, i).trim(); // get one line from 'AText' + int i; + int result = 0; + for (i = 0, j = 0; i < aText.length(); i++) { + if (aText.charAt(i) == '\n') { + String line = aText.substring(j, i).trim(); try { // try to read the value behind 'attr' @@ -334,12 +333,11 @@ * we just want to ignore the default arch * @return <string>, "" if not found */ - public String getAttributeString(String attr, ArchObject defarch) { - String AText = archText.toString(); // The "real" Archtext from arch & defarch - String line; // tmp string - int i, j; - String result = ""; // returned String + public String getAttributeString(String attr, final ArchObject defarch) { + String aText = archText.toString(); // The "real" Archtext from arch & defarch + int j; attr = attr.trim() + " "; // attr must be followed by space + String result = ""; if (defarch == getDefaultArch()) { result = getCachedAttributeValue(attr); if (result != null) { @@ -349,17 +347,18 @@ } // Add all attributes from defarch that don't already exist in AText if (defarch != null) { - AText = AText + diffArchText(defarch.getArchText(), true); + aText = aText + diffArchText(defarch.getArchText(), true); } - if (!AText.endsWith("\n")) { - AText = AText.concat("\n"); // string should end with '\n', see below + if (!aText.endsWith("\n")) { + aText = aText.concat("\n"); // string should end with '\n', see below } // Check line by line for the string 'attr' - for (i = 0, j = 0; i < AText.length(); i++) { - if (AText.charAt(i) == '\n') { - line = AText.substring(j, i).trim(); // get one line from 'AText' + int i; + for (i = 0, j = 0; i < aText.length(); i++) { + if (aText.charAt(i) == '\n') { + String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (line.startsWith(attr)) { @@ -381,23 +380,23 @@ * @param attr search for "attr <string>" * @param value value to set */ - public void setAttributeString(String attr, String value) { - String AText = archText.toString(); // The "real" Archtext from arch - String line; // tmp string - boolean exists = false; - int i, j; - String result = ""; // returned String + public void setAttributeString(String attr, final String value) { + String aText = archText.toString(); // The "real" Archtext from arch + int j; attr = attr.trim() + " "; // attr must be followed by space - if (!AText.endsWith("\n")) { - AText = AText.concat("\n"); // string should end with '\n', see below + if (!aText.endsWith("\n")) { + aText = aText.concat("\n"); // string should end with '\n', see below } // Check line by line for the string 'attr' - for (i = 0, j = 0; i < AText.length(); i++) { - if (AText.charAt(i) == '\n') { - line = AText.substring(j, i).trim(); // get one line from 'AText' + boolean exists = false; + int i; + String result = ""; + for (i = 0, j = 0; i < aText.length(); i++) { + if (aText.charAt(i) == '\n') { + String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (!line.startsWith(attr)) { @@ -426,21 +425,21 @@ * @param attr search for "attr <string>" */ public void removeAttribute(String attr) { - String AText = archText.toString(); // The "real" Archtext from arch - String line; // tmp string - int i, j; - String result = ""; // returned String + String aText = archText.toString(); // The "real" Archtext from arch + int j; attr = attr.trim() + " "; // attr must be followed by space - if (!AText.endsWith("\n")) { - AText = AText.concat("\n"); // string should end with '\n', see below + if (!aText.endsWith("\n")) { + aText = aText.concat("\n"); // string should end with '\n', see below } // Check line by line for the string 'attr' - for (i = 0, j = 0; i < AText.length(); i++) { - if (AText.charAt(i) == '\n') { - line = AText.substring(j, i).trim(); // get one line from 'AText' + int i; + String result = ""; + for (i = 0, j = 0; i < aText.length(); i++) { + if (aText.charAt(i) == '\n') { + String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (!line.startsWith(attr)) { @@ -461,40 +460,40 @@ * If there is elevation data in the other arch, move it to here. * @param arch the other arch */ - public void propagateElevation(ArchObject arch) { + public void propagateElevation(final ArchObject arch) { if (arch == null) { return; } - String elevation = arch.getAttributeString("elevation", null); + final String elevation = arch.getAttributeString("elevation", null); if (!elevation.equals("")) { setAttributeString("elevation", elevation); arch.removeAttribute("elevation"); } } - public void setEditType(int t) { - edit_type = t; + public void setEditType(final int t) { + editType = t; } public int getInternTemp() { - return intern_temp; + return internTemp; } - public void setInternTemp(int t) { - intern_temp = t; + public void setInternTemp(final int t) { + internTemp = t; } public int getMyID() { - return my_id; + return myId; } - public void setMyID(int num) { - my_id = num; + public void setMyID(final int num) { + myId = num; } public ArchObject getContainer() { - return _env; + return env; } /** @@ -502,27 +501,27 @@ * @return the topmost container */ public ArchObject getTopContainer() { - ArchObject tmp_arch; + ArchObject tmpArch; - for (tmp_arch = this; tmp_arch.getContainer() != null; - tmp_arch = tmp_arch.getContainer()) { + for (tmpArch = this; tmpArch.getContainer() != null; + tmpArch = tmpArch.getContainer()) { ; } - return tmp_arch; + return tmpArch; } - public void setArtifactFlag(boolean aflag) { - artifacts_flag = aflag; + public void setArtifactFlag(final boolean aflag) { + artifactsFlag = aflag; } public boolean getArtifactFlag() { - return artifacts_flag; + return artifactsFlag; } /** Return a ListIterator for all inventory {@link ArchObject}s. */ public ListIterator getInventory() { - return Collections.unmodifiableList(_inv).listIterator(); + return Collections.unmodifiableList(inv).listIterator(); } /** @@ -531,18 +530,18 @@ * has to be a free (unlinked) instance of <code>ArchObject</code>.) * @param arch the <code>ArchObject</code> to be placed in the inventory */ - public void addInvObj(ArchObject arch) { + public void addInvObj(final ArchObject arch) { // arch must not be already in a container - if (arch._env != null) { + if (arch.env != null) { throw new IllegalArgumentException(); } - if (_inv == Collections.EMPTY_LIST) { - _inv = new LinkedList(); + if (inv == Collections.EMPTY_LIST) { + inv = new LinkedList(); } - _inv.add(arch); - arch._env = this; + inv.add(arch); + arch.env = this; arch.setMapX(getMapX()); arch.setMapY(getMapY()); @@ -551,29 +550,29 @@ /** Remove 'this' arch from the inventory-list and delete all it's pointers */ public void removeInvObj() { // object's inventory must have already been deleted - if (_inv != Collections.EMPTY_LIST) { + if (inv != Collections.EMPTY_LIST) { throw new IllegalArgumentException(); } // object must be in a container - if (_env == null) { + if (env == null) { throw new IllegalArgumentException(); } // remove this object from its parent container - if (!_env._inv.remove(this)) { + if (!env.inv.remove(this)) { throw new AssertionError(); } - if (_env._inv.size() == 0) { - _env._inv = Collections.EMPTY_LIST; + if (env.inv.size() == 0) { + env.inv = Collections.EMPTY_LIST; } } /** Remove all inventory objects. */ public void clearInventory() { - while (_inv.size() > 0) { - ArchObject inv = (ArchObject) _inv.get(0); + while (inv.size() > 0) { + final ArchObject inv = this.inv.get(0); inv.clearInventory(); inv.removeInvObj(); } @@ -584,11 +583,9 @@ * @return number of objects in the inventory */ public int countInvObjects() { - int count = _inv.size(); - Iterator it = _inv.iterator(); - while (it.hasNext()) { - ArchObject arch = (ArchObject) it.next(); - count += arch.countInvObjects(); + int count = inv.size(); + for (final ArchObject anInv : inv) { + count += anInv.countInvObjects(); } return count; } @@ -626,21 +623,21 @@ return 0; } - public void setRefMaxMX(int x) { + public void setRefMaxMX(final int x) { //if (multi == null) { // multi = new MultiArchData(); //} multi.setRefMaxxm(x); } - public void setRefMaxMY(int y) { + public void setRefMaxMY(final int y) { //if (multi == null) { // multi = new MultiArchData(); //} multi.setRefMaxym(y); } - public void setRefMaxX(int x) { + public void setRefMaxX(final int x) { //if (multi == null) { // multi = new MultiArchData(); //} @@ -652,7 +649,7 @@ } } - public void setRefMaxY(int y) { + public void setRefMaxY(final int y) { //if (multi == null) { // multi = new MultiArchData(); //} @@ -665,7 +662,7 @@ } } - public void setRefFlag(boolean bool) { + public void setRefFlag(final boolean bool) { //if (multi == null) { // multi = new MultiArchData(); //} @@ -681,7 +678,7 @@ } // this chained multi tiles on map for fast access. better then number and search trash - public void setMapMultiHead(ArchObject arch) { + public void setMapMultiHead(final ArchObject arch) { if (multi == null) { multi = new MultiArchData(); } @@ -689,7 +686,7 @@ multi.setHead(arch); // this points to head. Heads DON'T points to himself } - public void setMapMultiNext(ArchObject arch) { + public void setMapMultiNext(final ArchObject arch) { if (multi == null) { multi = new MultiArchData(); } @@ -721,7 +718,7 @@ return 0; } - public void setMultiShapeID(int value) { + public void setMultiShapeID(final int value) { if (multi == null) { multi = new MultiArchData(); } @@ -737,7 +734,7 @@ return 0; } - public void setMultiPartNr(int value) { + public void setMultiPartNr(final int value) { if (multi == null) { multi = new MultiArchData(); } @@ -753,7 +750,7 @@ return false; } - public void setLowestPart(boolean state) { + public void setLowestPart(final boolean state) { if (multi == null) { multi = new MultiArchData(); } @@ -765,7 +762,7 @@ // RefNr == -1 : single tile // RefNr == NodeNr : head (first) tile of a multi tile arch // RefNr != NodeNr : part of multi tile arch - public void setRefNr(int nr) { + public void setRefNr(final int nr) { if (multi == null) { if (nr != -1) { multi = new MultiArchData(); @@ -789,7 +786,7 @@ } // refx/refy: Offset of this multi tile from head tile - public void setRefX(int xoff) { + public void setRefX(final int xoff) { if (multi == null) { multi = new MultiArchData(); } @@ -797,7 +794,7 @@ multi.setRefX(xoff); } - public void setRefY(int yoff) { + public void setRefY(final int yoff) { if (multi == null) { multi = new MultiArchData(); } @@ -821,7 +818,7 @@ return 0; } - public void setRefCount(int count) { + public void setRefCount(final int count) { if (multi == null) { if (count != 0) { multi = new MultiArchData(); @@ -858,18 +855,18 @@ // ----- end multi-arch get/set ----- public int getArchTypNr() { - return arch_type; + return archType; } - public void setArchTypNr(int type) { - arch_type = type; + public void setArchTypNr(final int type) { + archType = type; } - public void setMapX(int x) { + public void setMapX(final int x) { mapx = x; } - public void setMapY(int y) { + public void setMapY(final int y) { mapy = y; } @@ -881,11 +878,11 @@ return mapy; } - public void setNextArch(ArchObject arch) { + public void setNextArch(final ArchObject arch) { next = arch; } - public void setPrevArch(ArchObject arch) { + public void setPrevArch(final ArchObject arch) { prev = arch; } @@ -893,7 +890,7 @@ return tempptr; } - public void setTemp(ArchObject temp) { + public void setTemp(final ArchObject temp) { tempptr = temp; } @@ -906,7 +903,7 @@ } /* Set the default face. Number is index of face list */ - public void setFaceNr(int nr) { + public void setFaceNr(final int nr) { facenr = nr; } @@ -919,12 +916,12 @@ return noface; } - public void setFaceFlag(boolean flag) { + public void setFaceFlag(final boolean flag) { noface = flag; } /* Set Node number. Node number is the index of the default arch node list */ - public void setNodeNr(int nr) { + public void setNodeNr(final int nr) { nodenr = nr; } @@ -934,7 +931,7 @@ } // Arch name - public void setArchName(String name) { + public void setArchName(final String name) { archName = name != null ? name.intern() : null; } @@ -948,7 +945,7 @@ * @param defaultArch the default arch (if available, faster to use it than look it up again) * @return best suitable descriptive name */ - public String getBestName(ArchObject defaultArch) { + public String getBestName(final ArchObject defaultArch) { if (getObjName() != null && getObjName().length() > 0) { return getObjName(); } else if (defaultArch != null && defaultArch.getObjName() != null && defaultArch.getObjName().length() > 0) { @@ -963,7 +960,7 @@ } // Obj name - public void setObjName(String name) { + public void setObjName(final String name) { objName = name != null ? name.intern() : null; } @@ -972,7 +969,7 @@ } // face name - public void setFaceName(String name) { + public void setFaceName(final String name) { faceName = name != null ? name.intern() : null; } @@ -984,7 +981,7 @@ * append 'text' to the archText of this arch * @param text text to add */ - public void addArchText(String text) { + public void addArchText(final String text) { archText.append(text); } @@ -992,7 +989,7 @@ * set 'text' = archText of this arch * @param text set this text */ - public void setArchText(String text) { + public void setArchText(final String text) { archText.delete(0, archText.length()); archText.append(text); clearCachedAttributeValue(); @@ -1015,40 +1012,38 @@ * Get all entries from the given archtext 'atxt' that don't exist * in 'this' archtext. * @param atxt archtext to compare 'this'-arch with - * @param ignore_values if true: the values in the archtext-entries + * @param ignoreValues if true: the values in the archtext-entries * are ignored at the comparison * @return all lines from 'atxt' that don't occur in 'this' arch */ - public String diffArchText(String atxt, boolean ignore_values) { - String line = ""; // tmp string - String result = ""; // return string - String test; - int i, j; - int pos; - char c; + public String diffArchText(String atxt, final boolean ignoreValues) { + int j; if (!atxt.endsWith("\n")) { atxt = atxt.concat("\n"); // string should end with '\n', see below } // Check line by line for comparison + String line = ""; + String result = ""; + int i; for (i = 0, j = 0; i < atxt.length(); i++) { if (atxt.charAt(i) == '\n') { line = atxt.substring(j, i).trim(); // get one line from 'atxt' // if 'line' does NOT exist in 'this' arch, we take it: - if (ignore_values) { + if (ignoreValues) { // cut away everything after the first space in that line // because we want to ignore the "value part": if (line.length() > 0 && line.indexOf(" ") > 0 && - diffTextString(this.getArchText(), line.substring(0, line.indexOf(" ") + 1), ignore_values) == null) { + diffTextString(getArchText(), line.substring(0, line.indexOf(" ") + 1), ignoreValues) == null) { result = result.concat(line + "\n"); } } else { // not ignoring the value-part try { - test = diffTextString(this.getArchText(), line, ignore_values); - c = '\n'; + String test = diffTextString(this.getArchText(), line, ignoreValues); + char c = '\n'; if (test != null) { c = test.charAt(0); } @@ -1077,24 +1072,25 @@ * If not found, null is returned. * @param base full text to search * @param str string (attribute) to look for - * @param ignore_values if true, lines are matched against 'str' only till the first space (" ") + * @param ignoreValues if true, lines are matched against 'str' only till the first space (" ") */ - @Nullable private static String diffTextString(String base, String str, boolean ignore_values) { - int i, j; - String line = ""; + @Nullable private static String diffTextString(String base, final String str, final boolean ignoreValues) { + int j; if (!base.endsWith("\n")) { base = base.concat("\n"); // string should end with '\n' } + String line = ""; if (!line.endsWith("\n")) { line = line.concat("\n"); // string should end with '\n' } // Check line by line for comparison + int i; for (i = 0, j = 0; i < base.length(); i++) { if (base.charAt(i) == '\n') { line = base.substring(j, i).trim(); // get one line from base - if (ignore_values) { + if (ignoreValues) { if (str.compareTo(line.substring(0, line.indexOf(" ") + 1)) == 0) { return line; } @@ -1123,7 +1119,7 @@ } // MSGText! - public void addMsgText(String text) { + public void addMsgText(final String text) { if (msgText == null) { msgText = new StringBuffer(); } @@ -1144,7 +1140,7 @@ } // ANIMText! - public void addAnimText(String text) { + public void addAnimText(final String text) { if (animText == null) { animText = new StringBuffer(""); } @@ -1165,7 +1161,7 @@ return loreText.toString(); } - public void addLoreText(String text) { + public void addLoreText(final String text) { if (loreText == null) { loreText = new StringBuffer(""); } @@ -1179,7 +1175,7 @@ } // set/get autojoin list - public void setJoinList(AutojoinList jlist) { + public void setJoinList(final AutojoinList jlist) { join = jlist; } @@ -1196,8 +1192,8 @@ * @param posy map y coords. for the returned clone * @return clone instance of this <code>ArchObject</code> */ - public ArchObject getClone(int posx, int posy) { - ArchObject clone = new ArchObject(); // The clone is a new object! + public ArchObject getClone(final int posx, final int posy) { + final ArchObject clone = new ArchObject(); // The clone is a new object! clone.faceName = faceName; // face name clone.archName = archName; // arch Name @@ -1238,9 +1234,9 @@ clone.noface = noface; // if true, arch has no face as default clone.facenr = facenr; // the index of faceImages[] clone.editflag = editflag; // if true, object is in a editor - clone.edit_type = edit_type; // bitmask for view-settings + clone.editType = editType; // bitmask for view-settings - clone.arch_type = arch_type; // type attribute of the arch + clone.archType = archType; // type attribute of the arch // set coords: clone.mapx = posx; @@ -1248,9 +1244,9 @@ // If 'this' arch is a container, we have to create clones // of the whole inventory (recursively) and link them in: - Iterator it = _inv.iterator(); + final Iterator<ArchObject> it = inv.iterator(); while (it.hasNext()) { - ArchObject tmp = (ArchObject) it.next(); + final ArchObject tmp = it.next(); clone.addInvObj(tmp.getClone(posx, posy)); } @@ -1262,7 +1258,7 @@ * inside), otherwise false */ public boolean isContainer() { - return _inv.size() > 0; + return inv.size() > 0; } /** @return true if 'this' arch is part of a multisquare object */ @@ -1270,21 +1266,21 @@ return multi != null && (multi.getRefflag() || multi.getRefCount() > 0); } - public void addEventPlugin(String eventType, String pluginName) { + public void addEventPlugin(final String eventType, final String pluginName) { if (script == null) { script = new ScriptArchData(); } script.addEventData(eventType, pluginName, ScriptArchData.EDATA_PLUGIN_NAME); } - public void addEventOptions(String eventType, String eventOptions) { + public void addEventOptions(final String eventType, final String eventOptions) { if (script == null) { script = new ScriptArchData(); } script.addEventData(eventType, eventOptions, ScriptArchData.EDATA_EVENT_OPTIONS); } - public void addEventScript(String eventType, String filePath) { + public void addEventScript(final String eventType, final String filePath) { if (script == null) { script = new ScriptArchData(); } @@ -1324,7 +1320,7 @@ * Set contents of JList to all existing scripted events. * @param list the JList which displays all events for this arch */ - public void addEventsToJList(JList list) { + public void addEventsToJList(final JList list) { if (script != null) { script.addEventsToJList(list); } @@ -1338,7 +1334,7 @@ * @param eventList JList from the MapArchPanel (script tab) which displays the events * @param mapanel the MapArchPanel */ - public void modifyEventScript(String eventType, int task, JList eventList, CMapArchPanel mapanel) { + public void modifyEventScript(final String eventType, final int task, final JList eventList, final CMapArchPanel mapanel) { if (script != null) { script.modifyEventScript(eventType, task, eventList); @@ -1355,18 +1351,18 @@ * @param eventList JList from the MapArchPanel (script tab) which displays the events * @param mapanel the MapArchPanel */ - public void addEventScript(JList eventList, CMapArchPanel mapanel) { + public void addEventScript(final JList eventList, final CMapArchPanel mapanel) { if (script == null) { script = new ScriptArchData(); } script.addEventScript(eventList, this); - if (!script.isEmpty()) { - mapanel.setScriptPanelButtonState(true, true, true, true); - script.addEventsToJList(eventList); - } else { + if (script.isEmpty()) { script = null; // delete ScriptArchData object if empty mapanel.setScriptPanelButtonState(true, false, false, false); + } else { + mapanel.setScriptPanelButtonState(true, true, true, true); + script.addEventsToJList(eventList); } } @@ -1385,28 +1381,25 @@ * If no such "errors" encountered, null is returned. */ @Nullable public String getSyntaxErrors(CFArchType type) { - ArchObject defarch = getDefaultArch(); if (typelist != null && archText != null && archText.length() > 0) { String errors = ""; // return value: all error lines // open a reading stream for the archText - StringReader sread = new StringReader(archText.toString()); - BufferedReader sstream = new BufferedReader(sread); + final StringReader sread = new StringReader(archText.toString()); + final BufferedReader sstream = new BufferedReader(sread); try { - String line = null; // read line - String attr_key; // key-part of the attribute in 'line' - boolean does_match; // true if line matches (/ is correct) if (type == null) { type = typelist.getTypeOfArch(this); // the type of this arch } - if (log.isDebugEnabled()) { - log.debug("Applying type: " + type.getTypeName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Applying type: " + type.getTypeName()); } + String line = null; do { line = sstream.readLine(); // read one line @@ -1414,28 +1407,29 @@ line = line.trim(); // get only the key-part of the attribute + String attrKey; if (line.indexOf(" ") <= 0) { // this line doesn't even have the proper format: "key value" // we assume the missing value part means zero-value - attr_key = line; + attrKey = line; } else { - attr_key = line.substring(0, line.indexOf(" ")); + attrKey = line.substring(0, line.indexOf(" ")); } - if (log.isDebugEnabled()) { - log.debug("read attribute '" + line + "' -> "); + if (LOG.isDebugEnabled()) { + LOG.debug("read attribute '" + line + "' -> "); } // now check if there's a match in the definitions - does_match = false; - for (int t = 0; t < type.getAttr().length && !does_match; t++) { - if (type.getAttr()[t].getNameOld().equals(attr_key)) { + boolean doesMatch = false; + for (int t = 0; t < type.getAttr().length && !doesMatch; t++) { + if (type.getAttr()[t].getNameOld().equals(attrKey)) { // found a match: - does_match = true; + doesMatch = true; } } - if (!does_match) { + if (!doesMatch) { errors += line.trim() + "\n"; // append line to the errors /* // the attribute doesn't match the definitions, @@ -1459,7 +1453,7 @@ sstream.close(); sread.close(); } catch (IOException e) { - log.error("in getSyntaxErrors: Cannot close StringReader", e); + LOG.error("in getSyntaxErrors: Cannot close StringReader", e); } // return errors, or null if empty @@ -1473,11 +1467,11 @@ } } - private void setCachedAttributeValue(String name, String value) { + private void setCachedAttributeValue(final String name, final String value) { cachedAttribute.put(name, value); } - private void unSetCachedAttributeValue(String name) { + private void unSetCachedAttributeValue(final String name) { cachedAttribute.remove(name); } @@ -1485,7 +1479,8 @@ cachedAttribute.clear(); } - private String getCachedAttributeValue(String name) { + private String getCachedAttributeValue(final String name) { return (String) cachedAttribute.get(name); } -} + +} // class ArchObject Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-06-05 21:42:45 UTC (rev 134) @@ -42,7 +42,7 @@ * @param y * @param refreshMap * @param join - * @deprecated use {@link #ArchObjectIteratorDeleteMapArch(cfeditor.CMapModel, ArchObject, java.awt.Point, boolean, boolean)} instead + * @deprecated use {@link #ArchObjectIteratorDeleteMapArch(CMapModel, ArchObject, Point, boolean, boolean)} instead */ @Deprecated public ArchObjectIteratorDeleteMapArch(final CMapModel mapModel, final ArchObject archObject, final int x, final int y, final boolean refreshMap, final boolean join) { this(mapModel, archObject, new Point(x, y), refreshMap, join); Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-05 21:42:45 UTC (rev 134) @@ -186,21 +186,9 @@ */ @Nullable public ArchObject parseDefArchFromStream(final BufferedReader myInput, final ArchObject defArch, final String line, final String archName, int index) { - String newCath; // display cathegory - int firstArch, archmoreCount; //Open the file for reading try { - boolean msgflag = false; - boolean loreflag = false; - boolean animflag = false; - boolean parsearch = false; - boolean archmore = false; - firstArch = -1; // we have no multi part/multi file monsters, this is first - archmoreCount = 0; // thats part nr x of first_arch multi arch - String oldCath = "<xxx>"; - newCath = "no cathegory info"; // default cathegory - boolean isNewCathegory = true; // start with new clean ArchObject instance ArchObject arch; @@ -218,6 +206,16 @@ thisLine2 = line; // pre read "Object" from artifacts file loader } + boolean msgflag = false; + boolean loreflag = false; + boolean animflag = false; + boolean parsearch = false; + boolean archmore = false; + String oldCath = "<xxx>"; + boolean isNewCathegory = true; + int firstArch = -1; + String newCath = "no cathegory info"; + int archmoreCount = 0; while (thisLine2 != null) { final String thisLine = thisLine2.trim(); Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-05 21:42:45 UTC (rev 134) @@ -176,7 +176,7 @@ return archNodeList[0]; } - int i = node.arch.getNodeNr(); + final int i = node.arch.getNodeNr(); if (i + 1 < archNodeListCount) { return archNodeList[i + 1]; } @@ -259,7 +259,7 @@ final Date timeFinish = new Date(); // get finishing time final long diff = timeFinish.getTime() - timeStart.getTime(); if (LOG.isInfoEnabled()) { - LOG.info("Arch collect took " + diff / 1000. + " Seconds"); + LOG.info("Arch collect took " + diff / 1000.0 + " Seconds"); } // load pickmaps @@ -275,13 +275,11 @@ * "archtypes" and "crossfire.0" */ private void loadArchFromCollected() { - String line; // input line - loadFromArchive = true; // load from the collected files try { // open the resource file - final String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; + final String baseDir = IGUIConstants.CONFIG_DIR; final CFileReader stream = new CFileReader(baseDir, IGUIConstants.ARCH_FILE); // load all arches @@ -1039,5 +1037,7 @@ this.arch = data; this.next = null; } - } -} + + } // class ArchObjectNode + +} // class ArchObjectStack Modified: trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java 2006-06-05 21:42:45 UTC (rev 134) @@ -71,4 +71,4 @@ return numAnimObjects; } -} // End of class +} // class AnimationObjects Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-06-05 21:42:45 UTC (rev 134) @@ -11,7 +11,6 @@ import cfeditor.menu.BasicMenuEntry; import cfeditor.menu.FilterCheckBoxEntry; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -29,27 +28,26 @@ */ public class AttributeFilter implements Filter { - private static final Logger log = Logger.getLogger(AttributeFilter.class); + private static final Logger LOG = Logger.getLogger(AttributeFilter.class); - private final HashMap attrList; + private final Map<String, String> attrList; private int matchType = -1; /** Creates an AttributeFilter */ public AttributeFilter() { - super(); - attrList = new HashMap(); + attrList = new HashMap<String, String>(); } - public void addAttribute(String name, String value) { + public void addAttribute(final String name, final String value) { attrList.put(name, value); } - public void removeAttribute(String name, String value) { + public void removeAttribute(final String name, final String value) { attrList.remove(name); } - public void setType(int type) { + public void setType(final int type) { matchType = type; } @@ -57,101 +55,97 @@ matchType = -1; } - /* (non-Javadoc) - * @see cfeditor.filter.Filter#match(cfeditor.ArchObject) - */ - public boolean match(FilterConfig config, ArchObject o) { + /** {@inheritDoc} */ + public boolean match(final FilterConfig config, final ArchObject object) { boolean hasChecked = false; - Set pairs = attrList.entrySet(); + final Set<Map.Entry<String, String>> pairs = attrList.entrySet(); if (!pairs.isEmpty()) { hasChecked = true; - Iterator it = pairs.iterator(); - ArchObject def = o.getDefaultArch(); - while (it.hasNext()) { - Map.Entry ent = (Map.Entry) it.next(); - String key = ent.getKey().toString(); - String val = ent.getValue().toString(); - if (!o.getAttributeString(key, def).equals(val)) { + final ArchObject def = object.getDefaultArch(); + for (final Map.Entry<String, String> ent : pairs) { + final String key = ent.getKey(); + final String val = ent.getValue(); + if (!object.getAttributeString(key, def).equals(val)) { return false; } } } if (matchType >= 0) { hasChecked = true; - if (log.isDebugEnabled()) { - log.debug("checking type for " + o.getBestName(o.getDefaultArch())); - log.debug("o.getArchTypNr() != matchType: " + o.getArchTypNr() + " != " + matchType); + if (LOG.isDebugEnabled()) { + LOG.debug("checking type for " + object.getBestName(object.getDefaultArch())); + LOG.debug("o.getArchTypNr() != matchType: " + object.getArchTypNr() + " != " + matchType); } - if (o.getArchTypNr() != matchType) { + if (object.getArchTypNr() != matchType) { return false; } } return hasChecked; } - /* (non-Javadoc) - * @see cfeditor.filter.Filter#reset() - */ - public boolean reset(FilterConfig config) { + /** {@inheritDoc} */ + public boolean reset(final FilterConfig config) { return false; } - /* (non-Javadoc) - * @see cfeditor.filter.Filter#hasGlobalMatch() - */ - public boolean hasGlobalMatch(FilterConfig config) { + /** {@inheritDoc} */ + public boolean hasGlobalMatch(final FilterConfig config) { return false; } + /** {@inheritDoc} */ public FilterConfig createConfig() { - log.debug("CreateConfig"); + LOG.debug("CreateConfig"); return new SimpleFilterConfig(); } - public BasicMenuEntry createMenuEntry(FilterConfig config) { - FilterCheckBoxEntry entry = new FilterCheckBoxEntry(config); - return entry; + /** {@inheritDoc} */ + public BasicMenuEntry createMenuEntry(final FilterConfig config) { + return new FilterCheckBoxEntry(config); } - public void fromXML(Element e, FilterConfig config) { + /** {@inheritDoc} */ + public void fromXML(final Element e, final FilterConfig config) { if (e == null) { return; } - Element value = e.getChild("value"); + final Element value = e.getChild("value"); if (value == null) { return; } - SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")).booleanValue(); + final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; + final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); if (enabled) { sConfig.enable(); } else { sConfig.disable(); } - List properties = value.getChildren("property"); - for (Iterator i = properties.iterator(); i.hasNext();) { - Element property = (Element) i.next(); - String pName = property.getChildTextTrim("name"); - String pValue = property.getChildTextTrim("value"); + final List<Element> properties = value.getChildren("property"); + for (final Element property : properties) { + final String pName = property.getChildTextTrim("name"); + final String pValue = property.getChildTextTrim("value"); + // XXX This might be a bug: should this be value or pValue? If value is correct, why does pValue exist? sConfig.setProperty(pName, value); } } - public Element toXML(FilterConfig config) { - Element value = new Element("value"); - SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - Element enabled = new Element("enabled"); + /** {@inheritDoc} */ + public Element toXML(final FilterConfig config) { + final Element value = new Element("value"); + final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; + final Element enabled = new Element("enabled"); enabled.addContent(Boolean.toString(sConfig.isEnabled())); value.addContent(enabled); - String[] keys = sConfig.getProperties(); - for (int i = 0; i < keys.length; i++) { - Element property = new Element("property"); - property.addContent(sConfig.getProperty(keys[i]).toString()); + final String[] keys = sConfig.getProperties(); + for (final String key : keys) { + final Element property = new Element("property"); + property.addContent(sConfig.getProperty(key).toString()); value.addContent(property); } return value; } -} + +} // class AttibuteFilter Modified: trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java 2006-06-04 23:23:06 UTC (rev 133) +++ trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java 2006-06-05 21:42:45 UTC (rev 134) @@ -7,8 +7,7 @@ package cfeditor.filter; -import java.util.HashSet; -import java.util.Iterator; +import javax.swing.event.EventListenerList; import org.apache.log4j.Logger; /** @@ -17,34 +16,35 @@ * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ +@SuppressWarnings({"AbstractClassWithoutAbstractMethods"}) public abstract class BasicFilterConfig implements FilterConfig { - private static final Logger log = Logger.getLogger(BasicFilterConfig.class); + private static final Logger LOG = Logger.getLogger(BasicFilterConfig.class); private boolean enabled = false; - private final HashSet listeners = new HashSet(); + private final EventListenerList listenerList = new EventListenerList(); public void disable() { - if (log.isDebugEnabled()) { - log.debug("disabling filter " + this); + if (LOG.isDebugEnabled()) { + LOG.debug("disabling filter " + this); } if (enabled) { enabled = false; - ConfigEvent e = new ConfigEvent(ConfigEvent.EVENT_DISABLE, this); + final ConfigEvent e = new ConfigEvent(ConfigEventType.DISABLE, this); fireEvent(e); } } public void enable() { - if (log.isDebugEnabled()) { - log.debug("enabling filter " + this); + if (LOG.isDebugEnabled()) { + LOG.debug("enabling filter " + this); } if (!enabled) { enabled = true; - ConfigEvent e = new ConfigEvent(ConfigEvent.EVENT_ENABLE, this); + final ConfigEvent e = new ConfigEvent(ConfigEventType.ENABLE, this); fireEvent(e); } } @@ -53,17 +53,22 @@ return enabled; } - protected void fireEvent(ConfigEvent e) { - for (Iterator i = listeners.iterator(); i.hasNext();) { - ((ConfigListener) i.next()).configChanged(e); + protected void fireEvent(final ConfigEvent e) { + final Object[] listeners = listenerList.getListenerList(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + //noinspection ObjectEquality + if (listeners[i] == ConfigListener.class) { + ((ConfigListener) listeners[i + 1]).configChanged(e); + } } } - public void addConfigChangeListener(ConfigListener listener) { - listeners.add(listener); + public void addConfigChangeListener(final ConfigListener listener) { + listenerList.add(ConfigListener.class, listener); } - public void removeConfigChangeListener(ConfigListener listener) { - listeners.remove(listener); + public void removeConfigChangeListener(final C... [truncated message content] |
From: <chr...@us...> - 2006-06-06 02:12:16
|
Revision: 130 Author: christianhujer Date: 2006-06-04 14:59:07 -0700 (Sun, 04 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=130&view=rev Log Message: ----------- Updated to latest screenshots. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-04 01:05:07 UTC (rev 129) +++ trunk/src/doc/start.xhtml 2006-06-04 21:59:07 UTC (rev 130) @@ -17,8 +17,8 @@ <body> <div style="float:right;text-align:center;font-size:75%;"> <h2>Screenshots</h2> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34870"><img src="http://sourceforge.net/dbimage.php?id=74485" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=348691"><img src="http://sourceforge.net/dbimage.php?id=74487" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34870"><img src="http://sourceforge.net/dbimage.php?id=74487" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34873"><img src="http://sourceforge.net/dbimage.php?id=74493" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> </div> <p> Latest release version: <strong>- (no release yet)</strong> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-06 00:23:18
|
Revision: 135 Author: christianhujer Date: 2006-06-05 17:22:26 -0700 (Mon, 05 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=135&view=rev Log Message: ----------- Introduced src/app/net/sf/gridarta/arch package with an ArchObject interface designed for covering required commons of Daimonin ArchObjects and Crossfire ArchObjects. Modified Paths: -------------- trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/daimonin/src/daieditor/arch/match/package.html Added Paths: ----------- trunk/src/app/net/sf/gridarta/arch/ trunk/src/app/net/sf/gridarta/arch/ArchObject.java trunk/src/app/net/sf/gridarta/arch/package.html Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-05 21:42:45 UTC (rev 134) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-06 00:22:26 UTC (rev 135) @@ -49,7 +49,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ArchObject implements Cloneable { +public class ArchObject implements Cloneable, net.sf.gridarta.arch.ArchObject { private static final Logger LOG = Logger.getLogger(ArchObject.class); @@ -333,7 +333,7 @@ * we just want to ignore the default arch * @return <string>, "" if not found */ - public String getAttributeString(String attr, final ArchObject defarch) { + public String getAttributeString(String attr, @Nullable final ArchObject defarch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch int j; attr = attr.trim() + " "; // attr must be followed by space @@ -375,6 +375,16 @@ return result; } + /** {@inheritDoc} */ + public String getAttributeString(final String attr, final boolean useDefArch) { + return getAttributeString(attr, useDefArch ? getDefaultArch() : null); + } + + /** {@inheritDoc} */ + public String getAttributeString(final String attr) { + return getAttributeString(attr, true); + } + /** * Set the String of an arch attribute in the archText. * @param attr search for "attr <string>" Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-05 21:42:45 UTC (rev 134) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-06 00:22:26 UTC (rev 135) @@ -52,7 +52,7 @@ * @todo the archobject should be directly asked for a face, and eventually it should cache faces itself ; that would speed up painting maps * @todo this class maybe could be split into 3 classes: AbstractArchObject as abstract base class, DefArchObject for default arches and ArchObject for normal arches. */ -public final class ArchObject /*extends NamedObject*/ extends ArchObjectContainer implements Cloneable { +public final class ArchObject /*extends NamedObject*/ extends ArchObjectContainer implements Cloneable, net.sf.gridarta.arch.ArchObject { /** Reference to main control. */ private static CMainControl mainControl; @@ -457,17 +457,21 @@ return result; } - /** - * Get the String of an arch attribute from the archText both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, an empty String "" is returned. - * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it - * @return <string>, "" if not found - */ + /** {@inheritDoc} */ public String getAttributeString(final String attr, final boolean useDefArch) { return getAttributeString(attr, useDefArch ? defaultArch : null); } + /** {@inheritDoc} */ + public String getAttributeString(final String attr) { + return getAttributeString(attr, true); + } + + /** + * Sets edit Type. + * + * @param t edit Type. + */ public void setEditType(final int t) { editType = t; } Modified: trunk/daimonin/src/daieditor/arch/match/package.html =================================================================== --- trunk/daimonin/src/daieditor/arch/match/package.html 2006-06-05 21:42:45 UTC (rev 134) +++ trunk/daimonin/src/daieditor/arch/match/package.html 2006-06-06 00:22:26 UTC (rev 135) @@ -7,8 +7,11 @@ </head> <body> <p> - This package contains classes related to matching ArchObjects. - These classes are used for instance for choosing which objects to render transparent or at all. + This package contains classes related to matching ArchObjects, socalled ArchObjectMatcher. + An ArchObjectMatcher matches an ArchObject by checking whether it fulfills certain conditions. </p> + <p> + One application is used for instance for choosing which objects to render transparent or at all. + </p> </body> </html> Added: trunk/src/app/net/sf/gridarta/arch/ArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/arch/ArchObject.java (rev 0) +++ trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-06-06 00:22:26 UTC (rev 135) @@ -0,0 +1,29 @@ +package net.sf.gridarta.arch; + +/** + * This interface serves as a common interface for ArchObjects for Daimonin and Crossfire to allow classes that use ArchObjects being reused and moved to Gridarta. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface ArchObject { + + /** + * Get the value of an attribute of this ArchObject. + * @param attr attribute name to get value for + * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it + * @return attribute value or empty String ("") if no such attribute + * @see #getAttributeString(String) + */ + String getAttributeString(String attr, boolean useDefArch); + + /** + * Get the value of an attribute of this ArchObject or its default arch. + * <p /> + * This methods corresponds to {#getAttributeString(String, boolean)} with <code>useDefArch == true</code>. + * @param attr attribute name to get value for + * @return attribute value or empty String ("") if no such attribute + * @see #getAttributeString(String, boolean) + */ + String getAttributeString(String attr); + +} // interface ArchObject Property changes on: trunk/src/app/net/sf/gridarta/arch/ArchObject.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/arch/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/arch/package.html (rev 0) +++ trunk/src/app/net/sf/gridarta/arch/package.html 2006-06-06 00:22:26 UTC (rev 135) @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p> + This package containes classes and subpackages related to Arches. + </p> + <p> + Arches are: + </p> + <ul> + <li> + Archetypes, which are programmed types of objects inside the server. + </li> + <li> + Default ArchObjects, which are templates for ArchObjects. + A DefaultArchObject has an Archetype. + </li> + <li> + ArchObject Instances, which are objects inside maps. + An ArchObject has a DefaultArchObject which it derives attributes and Archetype from, but it may override all attributes including the Archetype. + </li> + <li> + ArchObject Attributes are attributes of ArchObjects (or Default ArchObjects) describing the properties of game objects. + Strictly speaking, the Archetype also is such an attribute. + </li> + </ul> + </body> +</html> Property changes on: trunk/src/app/net/sf/gridarta/arch/package.html ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-04 01:05:22
|
Revision: 129 Author: christianhujer Date: 2006-06-03 18:05:07 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=129&view=rev Log Message: ----------- Some work on adding final, adding deprecation, documenting deprecation, removing usage of deprecated, improving inner classes, renaming symbols to code style. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CSettings.java trunk/crossfire/src/cfeditor/CStartupScreen.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-04 01:05:07 UTC (rev 129) @@ -107,6 +107,10 @@ mapModel.appExitNotify(); // and then the model } + /** + * Returns flag that indicates whether this is a pickmap or not. + * @return flag that indicates whether this is a pickmap or not. + */ public boolean isPickmap() { return isPickmap; } @@ -115,15 +119,25 @@ return mapView.isGridVisible(); } - public void setGridVisibility(boolean fVisible) { + public void setGridVisibility(final boolean fVisible) { mapView.setGridVisibility(fVisible); } + /** + * Returns contains the edit types that have already been (requested and) + * calculated (edit types get calculated only when needed to save time) + * @return contains the edit types that have already been (requested and) + */ public int getActiveEditType() { return activeEditType; } - public void setActiveEditType(int newType) { + /** + * Sets contains the edit types that have already been (requested and) + * calculated (edit types get calculated only when needed to save time) + * @param newType contains the edit types that have already been (requested and) + */ + public void setActiveEditType(final int newType) { activeEditType = newType; } @@ -132,7 +146,7 @@ * @param checkType edit type * @return true if this edit type is active */ - public boolean hasEditType(int checkType) { + public boolean hasEditType(final int checkType) { return (activeEditType & checkType) != 0; } @@ -142,16 +156,16 @@ * save that state in 'activeEditType' so we don't need to do it again. * @param newType new edit type */ - public void addEditType(int newType) { + public void addEditType(final int newType) { // calculate only if needed final Dimension size = mapModel.getMapSize(); final Point pos = new Point(); if (!hasEditType(newType)) { for (pos.x = 0; pos.x < size.width; pos.x++) { for (pos.y = 0; pos.y < size.height; pos.y++) { - final Iterator it = mapModel.getArchObjects(pos); + final Iterator<ArchObject> it = mapModel.getArchObjects(pos); while (it.hasNext()) { - final ArchObject arch = (ArchObject) it.next(); + final ArchObject arch = it.next(); // calculate the new edit type if (arch.getRefFlag() && arch.getMapMultiHead() != null) { // multi tails get the value from their head @@ -232,8 +246,16 @@ return addArchToMap(archnr, pos, intern, join, false); } - /** wrapper method for addArchToMap, always inserting new arches on top */ - @Deprecated public boolean addArchToMap(int archnr, int xx, int yy, int intern, boolean join) { + /** wrapper method for addArchToMap, always inserting new arches on top. + * @param archnr + * @param xx + * @param yy + * @param intern + * @param join + * @return + * @deprecated use {@link #addArchToMap(int, Point, int, boolean)} instead + */ + @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join) { return addArchToMap(archnr, new Point(xx, yy), intern, join, false); } @@ -241,7 +263,7 @@ return mapModel.insertArchToMap(newarch, archnr, next, pos, join); } - public void addArchObjectToMap(ArchObject arch, boolean insertBelow) { + public void addArchObjectToMap(final ArchObject arch, final boolean insertBelow) { mapModel.addArchObjectToMap(arch, insertBelow); } @@ -384,7 +406,7 @@ /** * Returns the map size of the mapModel. - * @return map size. + * @return map size */ public Dimension getMapSize() { return mapModel.getMapSize(); @@ -392,7 +414,8 @@ /** * Returns the width of the level. - * @return map width. + * @return map width + * @deprecated use {@link #getMapSize()} instead. */ @Deprecated public int getMapWidth() { return getMapSize().width; @@ -400,7 +423,8 @@ /** * Returns the height of the level. - * @return map height. + * @return map height + * @deprecated use {@link #getMapSize()} instead. */ @Deprecated public int getMapHeight() { return getMapSize().height; @@ -416,7 +440,7 @@ /** * Returns the width of the level + neighbors tile maps if any. - * @return global width. + * @return global width */ // TODO implement this int getDisplayMapWidth() { @@ -429,7 +453,7 @@ /** * Returns the height of the level + neighbors tile maps if any. - * @return global height. + * @return global height */ int getDisplayMapHeight() { if (showTiles) { @@ -443,7 +467,7 @@ return showTiles; } - void setTileShow(boolean show) { + void setTileShow(final boolean show) { showTiles = show; if (show) { /*Do the tile maps loading :)*/ @@ -468,7 +492,7 @@ /** * Check if the coordinates posx, posy are valid (located within the * borders of the map). - * @param pos coordinate to check. + * @param pos coordinate to check * @return true if this point is located within the map boundaries */ public boolean pointValid(final Point pos) { Modified: trunk/crossfire/src/cfeditor/CMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-04 01:05:07 UTC (rev 129) @@ -709,7 +709,7 @@ // first, try to find the tile we had selected node = null; - final Iterator it = getArchObjects(pos.x, pos.y); + final Iterator it = getArchObjects(pos); while (it.hasNext()) { node = (ArchObject) it.next(); @@ -966,7 +966,7 @@ ArchObject exit = m_main_control.getMainView().getMapTileSelection(); if (exit == null || !ExitTypes.contains(exit)) { // if not, we check the whole selected spot for an exit - final Iterator it = getArchObjects(hspot.x, hspot.y); + final Iterator it = getArchObjects(hspot); while (it.hasNext()) { exit = (ArchObject) it.next(); if (ExitTypes.contains(exit)) { Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-04 01:05:07 UTC (rev 129) @@ -1071,7 +1071,7 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - private final CMapModel _model; + private final CMapModel mapModel; /** 32x32 Image and Icon for temprary storing tiles before drawing */ private Image tmpImage; @@ -1092,7 +1092,7 @@ /** Constructor */ CIsoLevelRenderer(CMapModel model, boolean pickmap) { - _model = model; + mapModel = model; af = new AttributeFilter(); af.addAttribute("no_pass", "1"); @@ -1207,13 +1207,13 @@ } ystart = y * IGUIConstants.TILE_ISO_YLEN2 + (isPickmap ? 0 : IGUIConstants.TILE_ISO_YLEN); for (int x = 0; x < mapSize.width; x++) { - if (!_model.containsArchObject(x, y)) { + if (!mapModel.containsArchObject(x, y)) { // empty square if (!isPickmap) { mainControl.getUnknownTileIcon().paintIcon(this, grfx, xstart, ystart); } } else { - Iterator it = _model.getArchObjects(x, y); + Iterator it = mapModel.getArchObjects(x, y); while (it.hasNext()) { node = (ArchObject) it.next(); Modified: trunk/crossfire/src/cfeditor/CSettings.java =================================================================== --- trunk/crossfire/src/cfeditor/CSettings.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/CSettings.java 2006-06-04 01:05:07 UTC (rev 129) @@ -28,7 +28,8 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import org.apache.log4j.Logger; @@ -41,19 +42,20 @@ * the properties are not saved! * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @deprecated This should be replaced by java.util.prefs */ -public class CSettings { +@Deprecated public class CSettings { - private static final Logger log = Logger.getLogger(CSettings.class); + private static final Logger LOG = Logger.getLogger(CSettings.class); /** The properties object that contains the settings. */ - private final Properties m_properties = new Properties(); + private final Properties properties = new Properties(); /** The file that is used to store the settings or null if none specified. */ - private String m_strFile; + private String strFile; /** The shared hashtable that maps filenames to settings instances. */ - private static final Hashtable m_hashFromNameToInstance = new Hashtable(); + private static final Map<String, CSettings> hashFromNameToInstance = new HashMap<String, CSettings>(); /** * Returns the settings instance for the given filename. If no such instance @@ -61,14 +63,14 @@ * @param strFile The filename whose settings object instance we want. * @return The settings instance for the given filename. */ - public static CSettings getInstance(String strFile) { - if (m_hashFromNameToInstance.containsKey(strFile)) { - return (CSettings) m_hashFromNameToInstance.get(strFile); + public static CSettings getInstance(final String strFile) { + if (hashFromNameToInstance.containsKey(strFile)) { + return hashFromNameToInstance.get(strFile); } - CSettings instance = new CSettings(strFile); + final CSettings instance = new CSettings(strFile); instance.loadSettings(); - m_hashFromNameToInstance.put(strFile, instance); + hashFromNameToInstance.put(strFile, instance); return instance; } @@ -79,15 +81,16 @@ * standard configuration for resource files. * @param strFile */ - private CSettings(String strFile) { - m_strFile = CResourceLoader.getHomeFileName(strFile); + private CSettings(final String strFile) { + this.strFile = CResourceLoader.getHomeFileName(strFile); } /** Loads the settings from the file. */ public synchronized void loadSettings() { try { - m_properties.load(new FileInputStream(m_strFile)); - } catch (IOException ioe) { + properties.load(new FileInputStream(strFile)); + } catch (final IOException ioe) { + // TODO } } @@ -97,16 +100,16 @@ * called, the settings are not saved to anywhere. */ public synchronized void saveSettings() { - if (m_strFile == null) { + if (strFile == null) { return; } try { - if (log.isDebugEnabled()) { - log.debug("SAVE SETTINGS: " + (new File(m_strFile)).getAbsolutePath()); + if (LOG.isDebugEnabled()) { + LOG.debug("SAVE SETTINGS: " + (new File(strFile)).getAbsolutePath()); } - m_properties.store(new FileOutputStream(m_strFile), ""); - } catch (IOException ioe) { + properties.store(new FileOutputStream(strFile), ""); + } catch (final IOException ioe) { } } @@ -115,8 +118,8 @@ * list. The method returns <code>null</code> if the * property is not found. * @param strKey The key that identifies the property. */ - public synchronized String getProperty(String strKey) { - return m_properties.getProperty(strKey); + public synchronized String getProperty(final String strKey) { + return properties.getProperty(strKey); } /** @@ -126,8 +129,8 @@ * @param strKey the key that identifies the property * @param strDefaultValue the default value to use */ - public synchronized String getProperty(String strKey, String strDefaultValue) { - String strValue = m_properties.getProperty(strKey); + public synchronized String getProperty(final String strKey, final String strDefaultValue) { + final String strValue = properties.getProperty(strKey); if (strValue == null) { setProperty(strKey, strDefaultValue); return strDefaultValue; @@ -142,15 +145,15 @@ * @param strKey the key that identifies the property * @param strValue the value of the property */ - public synchronized void setProperty(String strKey, String strValue) { - m_properties.put(strKey, strValue); + public synchronized void setProperty(final String strKey, final String strValue) { + properties.setProperty(strKey, strValue); } /** * Removes the key-value pair of specified key from the property table. * @param strKey the key that identifies the property */ - public synchronized void clearProperty(String strKey) { - m_properties.remove(strKey); + public synchronized void clearProperty(final String strKey) { + properties.remove(strKey); } } Modified: trunk/crossfire/src/cfeditor/CStartupScreen.java =================================================================== --- trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-06-04 01:05:07 UTC (rev 129) @@ -48,57 +48,57 @@ public class CStartupScreen extends Window { /** The image shown by this startup screen. */ - private ImageIcon m_image; + private ImageIcon image; - private Timer m_autoCloseTimer; + private Timer autoCloseTimer; - private MouseListener m_clickListener; + private MouseListener clickListener; private static final long serialVersionUID = 5107663950987715313L; /** Constructs and shows a startup screen. */ - public CStartupScreen(Frame parentFrame) { + public CStartupScreen(final Frame parentFrame) { super(parentFrame); - m_image = CGUIUtils.getIcon(IGUIConstants.STARTUP_IMAGE); - if (m_image == null) { + image = CGUIUtils.getIcon(IGUIConstants.STARTUP_IMAGE); + if (image == null) { return; } // Center the startup screen to the parent frame - int width = m_image.getIconWidth(); - int height = m_image.getIconHeight(); + final int width = image.getIconWidth(); + final int height = image.getIconHeight(); - Rectangle bounds = parentFrame.getBounds(); - bounds.x += (bounds.width - width) / 2; - bounds.y += (bounds.height - height) / 2; + final Rectangle bounds = parentFrame.getBounds(); + bounds.x += bounds.width - width >> 1; + bounds.y += bounds.height - height >> 1; bounds.width = width; bounds.height = height; setBounds(bounds); - m_clickListener = new MouseAdapter() { - @Override public void mouseClicked(MouseEvent event) { + clickListener = new MouseAdapter() { + @Override public void mouseClicked(final MouseEvent event) { close(); } }; - addMouseListener(m_clickListener); + addMouseListener(clickListener); } /** Performes all actions needed to close the window. */ private void close() { - if (m_clickListener != null) { - removeMouseListener(m_clickListener); - m_clickListener = null; + if (clickListener != null) { + removeMouseListener(clickListener); + clickListener = null; } - if (m_autoCloseTimer != null) { - m_autoCloseTimer.stop(); - m_autoCloseTimer = null; + if (autoCloseTimer != null) { + autoCloseTimer.stop(); + autoCloseTimer = null; } - m_image = null; + image = null; setVisible(false); dispose(); @@ -108,8 +108,8 @@ * Overridden to paint the loaded startup image. * @param grfx The graphics context to paint to. */ - @Override public void paint(Graphics grfx) { - m_image.paintIcon(this, grfx, 0, 0); + @Override public void paint(final Graphics grfx) { + image.paintIcon(this, grfx, 0, 0); //grfx.drawImage(pinga, 0, 0, null); } @@ -117,19 +117,20 @@ * Overridden to startup a timer that then closes this window after * a few seconds. */ - @Override public void setVisible(boolean visible) { + @Override public void setVisible(final boolean visible) { if (visible) { super.setVisible(true); - m_autoCloseTimer = new Timer(3000, new ActionListener() { - public void actionPerformed(ActionEvent event) { + autoCloseTimer = new Timer(3000, new ActionListener() { + public void actionPerformed(final ActionEvent event) { close(); } }); - m_autoCloseTimer.setInitialDelay(3000); - m_autoCloseTimer.setRepeats(false); - m_autoCloseTimer.start(); + autoCloseTimer.setInitialDelay(3000); + autoCloseTimer.setRepeats(false); + autoCloseTimer.start(); } else { super.setVisible(false); } } -} + +} // class CStartupScreen Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-04 01:05:07 UTC (rev 129) @@ -26,6 +26,7 @@ import cfeditor.arch.ArchObject; import java.awt.Color; +import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ActionEvent; @@ -61,7 +62,7 @@ private static ReplaceDialog instance = null; - private final CMainControl m_control; + private final CMainControl mainControl; private boolean isBuilt; @@ -87,20 +88,20 @@ /** * Construct instance. - * @param cm + * @param mainControl */ - private ReplaceDialog(CMainControl cm) { - super(cm.getMainView(), "Replace", false); - setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); - m_control = cm; + private ReplaceDialog(final CMainControl mainControl) { + super(mainControl.getMainView(), "Replace", false); + setDefaultCloseOperation(HIDE_ON_CLOSE); + this.mainControl = mainControl; isBuilt = false; rfArchName = null; replaceArch = null; } - public static void init(CMainControl cm) { + public static void init(final CMainControl mainControl) { if (instance == null) { - instance = new ReplaceDialog(cm); + instance = new ReplaceDialog(mainControl); } } @@ -115,39 +116,39 @@ /** * Replace objects on the map. - * @param m_ctrl MapControl of the active map where the action was invoked + * @param mapControl MapControl of the active map where the action was invoked */ - public void display(CMapControl m_ctrl) { - replaceArch = m_control.getArchPanelSelection(); // selected arch + public void display(final CMapControl mapControl) { + replaceArch = mainControl.getArchPanelSelection(); // selected arch if (!isBuilt) { - JPanel main_panel = new JPanel(); - main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS)); - main_panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); + final JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); // first line: heading JPanel line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel labelon = new JLabel("On"); + final JLabel labelon = new JLabel("On"); labelon.setForeground(Color.black); line.add(labelon); line.add(Box.createVerticalStrut(3)); replaceEntireBox = new JComboBox(new String[]{"entire map", "selected squares of"}); replaceEntireBox.setBackground(Color.white); - if (m_ctrl.getMapView().isHighlight()) { + if (mapControl.getMapView().isHighlight()) { replaceEntireBox.setSelectedIndex(1); } else { replaceEntireBox.setSelectedIndex(0); } line.add(replaceEntireBox); line.add(Box.createVerticalStrut(3)); - rfHeading = new JLabel("\"" + m_ctrl.getMapFileName() + "\":"); + rfHeading = new JLabel("\"" + mapControl.getMapFileName() + "\":"); rfHeading.setForeground(Color.black); line.add(rfHeading); - main_panel.add(line); + mainPanel.add(line); // second line: replace what? line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label1 = new JLabel("delete objects with"); + final JLabel label1 = new JLabel("delete objects with"); line.add(label1); line.add(Box.createVerticalStrut(5)); @@ -159,11 +160,11 @@ replaceInput1 = new JTextField(20); line.add(replaceInput1); - main_panel.add(line); + mainPanel.add(line); // third line: replace by? line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label2 = new JLabel("and replace by"); + final JLabel label2 = new JLabel("and replace by"); line.add(label2); line.add(Box.createVerticalStrut(5)); replaceWithBox = new JComboBox(new String[]{"object", "nothing"}); @@ -173,13 +174,13 @@ replaceWithBox.setSelectedIndex(0); } replaceWithBox.setBackground(Color.white); - replaceWithBox.addItemListener(new ReplaceWithBoxAL(this, replaceWithBox)); + replaceWithBox.addItemListener(new ReplaceWithBoxAL()); line.add(replaceWithBox); iconLabel = new JLabel(); if (replaceArch != null) { colonLabel = new JLabel(":"); - iconLabel.setIcon(m_control.getArchObjectStack().getFace(replaceArch.getFaceNr())); + iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceNr())); rfArchName = new JLabel(" " + replaceArch.getBestName(replaceArch.getDefaultArch())); } else { colonLabel = new JLabel(""); @@ -188,40 +189,40 @@ line.add(colonLabel); line.add(Box.createVerticalStrut(5)); rfArchName.setForeground(Color.black); - m_control.setPlainFont(rfArchName); + mainControl.setPlainFont(rfArchName); line.add(iconLabel); line.add(rfArchName); - main_panel.add(line); + mainPanel.add(line); // button panel: - main_panel.add(Box.createVerticalStrut(10)); + mainPanel.add(Box.createVerticalStrut(10)); line = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JButton okButton = new JButton("OK"); - okButtonListener = new OkButtonAL(this, m_ctrl); + final JButton okButton = new JButton("OK"); + okButtonListener = new OkButtonAL(mapControl); okButton.addActionListener(okButtonListener); line.add(okButton); - JButton cancelButton = new JButton("Cancel"); + final JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { setVisible(false); } }); line.add(cancelButton); - main_panel.add(line); + mainPanel.add(line); - getContentPane().add(main_panel); + getContentPane().add(mainPanel); pack(); - setLocationRelativeTo(m_control.getMainView()); + setLocationRelativeTo(mainControl.getMainView()); setVisible(true); isBuilt = true; } else { // just set fields and show - rfHeading.setText("\"" + m_ctrl.getMapFileName() + "\":"); + rfHeading.setText("\"" + mapControl.getMapFileName() + "\":"); replaceInput1.setText(""); - okButtonListener.setMapControl(m_ctrl); + okButtonListener.setMapControl(mapControl); if (replaceArch == null) { replaceWithBox.setSelectedIndex(1); iconLabel.setIcon(null); @@ -229,12 +230,12 @@ colonLabel.setText(""); } else { replaceWithBox.setSelectedIndex(0); - iconLabel.setIcon(m_control.getArchObjectStack().getFace(replaceArch.getFaceNr())); + iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceNr())); rfArchName.setText(" " + replaceArch.getBestName(replaceArch.getDefaultArch())); colonLabel.setText(":"); } - if (m_ctrl.getMapView().isHighlight()) { + if (mapControl.getMapView().isHighlight()) { replaceEntireBox.setSelectedIndex(1); // selected squares } else { replaceEntireBox.setSelectedIndex(0); // entire map @@ -253,13 +254,13 @@ * changed if true, the frame is always packed (packing resizes but also * causes flicker) */ - public void updateArchSelection(ArchObject newArch, boolean alwaysPack) { + public void updateArchSelection(final ArchObject newArch, final boolean alwaysPack) { if (isShowing() && replaceWithBox.getSelectedIndex() == 0) { replaceArch = newArch; if (newArch != null) { - Icon oldIcon = iconLabel.getIcon(); + final Icon oldIcon = iconLabel.getIcon(); - iconLabel.setIcon(m_control.getArchObjectStack().getFace(newArch.getFaceNr())); + iconLabel.setIcon(mainControl.getArchObjectStack().getFace(newArch.getFaceNr())); rfArchName.setText(" " + newArch.getBestName(newArch.getDefaultArch())); colonLabel.setText(":"); @@ -279,7 +280,7 @@ /** * This method performs the actual replace action on a map. - * @param mc MapControl of the map where the action was invoked + * @param mapControl MapControl of the map where the action was invoked * @param matchCriteria matching criteria for replace * @param matchString this is what to search for * @param entireMap if true, the entire map is affected - if false, only @@ -288,21 +289,22 @@ * replaced * @return number of arches that have been replaced */ - private int doReplace(CMapControl mc, int matchCriteria, String matchString, boolean entireMap, boolean deleteOnly) { - int replaceCount = 0; // count how many arches have been replaced + private int doReplace(final CMapControl mapControl, final int matchCriteria, final String matchString, final boolean entireMap, final boolean deleteOnly) { - if (mc == null) { + if (mapControl == null) { return 0; } // define area of effect - Point startp, offset; + final Point startp; + final Point offset; if (entireMap) { startp = new Point(0, 0); - offset = new Point(mc.getMapWidth() - 1, mc.getMapHeight() - 1); + final Dimension mapSize = mapControl.getMapSize(); + offset = new Point(mapSize.width - 1, mapSize.height - 1); } else { - startp = mc.getMapView().getHighlightStart(); // start of highlighted rect - offset = mc.getMapView().getHighlightOffset(); // offset of rect from startp + startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect + offset = mapControl.getMapView().getHighlightOffset(); // offset of rect from startp } // convert negative 'offset' into positive by flipping 'startp' @@ -317,12 +319,13 @@ // cycle through all tile coordinates between startpoint and offset: final Point pos = new Point(); + int replaceCount = 0; for (pos.x = startp.x; pos.x - startp.x <= offset.x; pos.x++) { for (pos.y = startp.y; pos.y - startp.y <= offset.y; pos.y++) { - final Iterator it = mc.getArchObjectsDeleteMapArch(pos, false, false); + final Iterator<ArchObject> it = mapControl.getArchObjectsDeleteMapArch(pos, false, false); while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); + final ArchObject node = it.next(); if ((!node.isMulti() || node.getRefCount() > 0) && ((matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString)) || @@ -339,11 +342,11 @@ if (replaceArch.getRefCount() == 0 && replaceArch.getMapMultiHead() != null) { replaceArch = replaceArch.getMapMultiHead(); } - mc.addArchToMap(replaceArch.getNodeNr(), pos, 0, false); + mapControl.addArchToMap(replaceArch.getNodeNr(), pos, 0, false); // TODO: if from pickmap it could have special attributes -> copy them } else { - mc.insertArchToMap(replaceArch, 0, prevArch, pos, false); + mapControl.insertArchToMap(replaceArch, 0, prevArch, pos, false); } } replaceCount++; @@ -353,104 +356,96 @@ } // now the map and toolbars must be redrawn - mc.repaint(); - m_control.getMainView().refreshMapTileList(); + mapControl.repaint(); + mainControl.getMainView().refreshMapTileList(); return replaceCount; } - // ----------------------- SUBCLASSES ----------------------- - /** Item-listener for the "replace with"-selection box. */ private class ReplaceWithBoxAL implements ItemListener { - ReplaceDialog frame; // the entire frame + private int lastSelectedIndex; - int lastSelectedIndex; - - JComboBox box; - /** * Constructor. - * @param frame the dialog mainframe */ - public ReplaceWithBoxAL(ReplaceDialog frame, JComboBox box) { - this.frame = frame; - this.box = box; - lastSelectedIndex = box.getSelectedIndex(); + ReplaceWithBoxAL() { + lastSelectedIndex = replaceWithBox.getSelectedIndex(); } /** * A (new) type has been selected in the box. * @param event the occured <code>ItemEvent</code> (button pressed) */ - public void itemStateChanged(ItemEvent event) { + public void itemStateChanged(final ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED && - lastSelectedIndex != box.getSelectedIndex()) { - if (box.getSelectedIndex() == 0) { + lastSelectedIndex != replaceWithBox.getSelectedIndex()) { + if (replaceWithBox.getSelectedIndex() == 0) { // replace with arch - replaceArch = m_control.getArchPanelSelection(); // selected arch + replaceArch = mainControl.getArchPanelSelection(); // selected arch updateArchSelection(replaceArch, true); - } else if (box.getSelectedIndex() == 1) { + } else if (replaceWithBox.getSelectedIndex() == 1) { // replace with nothing iconLabel.setIcon(null); rfArchName.setText(""); colonLabel.setText(""); pack(); } - lastSelectedIndex = box.getSelectedIndex(); + lastSelectedIndex = replaceWithBox.getSelectedIndex(); } } - } + } // class ReplaceWithBoxAL + /** Listener class for the ok-button of the replace dialog. */ public class OkButtonAL implements ActionListener { - CMapControl mc; // map control + private CMapControl mapControl; // map control - ReplaceDialog frame; // the entire frame - - public OkButtonAL(ReplaceDialog frame, CMapControl mc) { - this.frame = frame; - this.mc = mc; + public OkButtonAL(final CMapControl mapControl) { + this.mapControl = mapControl; } - public void setMapControl(CMapControl mc) { - this.mc = mc; + public void setMapControl(final CMapControl mapControl) { + this.mapControl = mapControl; } - public void actionPerformed(ActionEvent event) { - int replaceCount; // how many arches have been replaced - int matchCriteria = 0; - String matchString = replaceInput1.getText().trim(); - boolean deleteOnly = frame.replaceWithBox.getSelectedIndex() == 1; - boolean entireMap = replaceEntireBox.getSelectedIndex() == 0; + public void actionPerformed(final ActionEvent event) { + final String matchString = replaceInput1.getText().trim(); + final boolean deleteOnly = replaceWithBox.getSelectedIndex() == 1; + final boolean entireMap = replaceEntireBox.getSelectedIndex() == 0; - if (mc == null || mc.isClosing()) { - frame.setVisible(false); - m_control.showMessage("Replace", "Map \"" + mc.getMapFileName() + "\" is no longer available.\n", JOptionPane.ERROR_MESSAGE); - } else if (!entireMap && !mc.getMapView().isHighlight()) { + if (mapControl == null || mapControl.isClosing()) { + setVisible(false); + mainControl.showMessage("Replace", "Map \"" + mapControl.getMapFileName() + "\" is no longer available.\n", JOptionPane.ERROR_MESSAGE); + } else if (!entireMap && !mapControl.getMapView().isHighlight()) { // user selected "replace highlighted" but nothing is highlighted - m_control.showMessage("Replace", "You chose to replace on selected squares of\n" + - "map \"" + mc.getMapFileName() + "\", but there is no selected area.", JOptionPane.ERROR_MESSAGE); + mainControl.showMessage("Replace", "You chose to replace on selected squares of\n" + + "map \"" + mapControl.getMapFileName() + "\", but there is no selected area.", JOptionPane.ERROR_MESSAGE); } else { + final int matchCriteria; if (replaceCriteria.getSelectedIndex() == 0) { matchCriteria = ReplaceDialog.MATCH_ARCH_NAME; } else if (replaceCriteria.getSelectedIndex() == 1) { matchCriteria = ReplaceDialog.MATCH_OBJ_NAME; + } else { + matchCriteria = 0; } - replaceCount = frame.doReplace(mc, matchCriteria, matchString, entireMap, deleteOnly); + final int replaceCount = doReplace(mapControl, matchCriteria, matchString, entireMap, deleteOnly); if (replaceCount > 0) { - frame.setVisible(false); + setVisible(false); if (replaceCount == 1) { - m_control.showMessage("Replace", "1 object has been replaced."); + mainControl.showMessage("Replace", "1 object has been replaced."); } else { - m_control.showMessage("Replace", replaceCount + " objects have been replaced."); + mainControl.showMessage("Replace", replaceCount + " objects have been replaced."); } } else { - m_control.showMessage("Replace", "No matching object found.", JOptionPane.ERROR_MESSAGE); + mainControl.showMessage("Replace", "No matching object found.", JOptionPane.ERROR_MESSAGE); } } } - } -} + + } // class OkButtonAL + +} // class ReplaceDialog Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java 2006-06-04 01:05:07 UTC (rev 129) @@ -6,35 +6,39 @@ import java.util.NoSuchElementException; /** - * The class ArchObjectIterator implements an {@link java.util.Iterator} that + * The class ArchObjectIterator implements an {@link Iterator} that * returns all {@link ArchObject}s in a map location. * @author Andreas Kirschbaum */ -public class ArchObjectIterator implements Iterator { +public class ArchObjectIterator implements Iterator<ArchObject> { - protected ArchObject _nextArchObject; + protected ArchObject nextArchObject; - protected ArchObject _currArchObject = null; + protected ArchObject currArchObject = null; - public ArchObjectIterator(ArchObject archObject) { - _nextArchObject = archObject; + public ArchObjectIterator(final ArchObject archObject) { + nextArchObject = archObject; } + /** {@inheritDoc} */ public boolean hasNext() { - return _nextArchObject != null; + return nextArchObject != null; } - public Object next() { - if (_nextArchObject == null) { + /** {@inheritDoc} */ + public ArchObject next() { + if (nextArchObject == null) { throw new NoSuchElementException(); } - _currArchObject = _nextArchObject; - _nextArchObject = _currArchObject.getNextArch(); - return _currArchObject; + currArchObject = nextArchObject; + nextArchObject = currArchObject.getNextArch(); + return currArchObject; } + /** {@inheritDoc} */ public void remove() { throw new UnsupportedOperationException(); } -} + +} // class ArchObjectIterator Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-06-04 01:05:07 UTC (rev 129) @@ -7,30 +7,32 @@ /** * The class ArchObjectIterator implements an {@link ArchObjectIterator} that - * implements the {@link java.util.Iterator#remove()} operation via {@link + * implements the {@link Iterator#remove()} operation via {@link * CMapModel#deleteArchMapObject(ArchObject)}. * @author Andreas Kirschbaum */ -public class ArchObjectIteratorDeleteArchMapObject extends ArchObjectIterator implements Iterator { +public class ArchObjectIteratorDeleteArchMapObject extends ArchObjectIterator { - private final CMapModel _model; + private final CMapModel model; - public ArchObjectIteratorDeleteArchMapObject(CMapModel model, ArchObject archObject) { + public ArchObjectIteratorDeleteArchMapObject(final CMapModel model, final ArchObject archObject) { super(archObject); if (model == null) { throw new IllegalArgumentException(); } - _model = model; + this.model = model; } + /** {@inheritDoc} */ @Override public void remove() { - if (_currArchObject == null) { + if (currArchObject == null) { throw new IllegalStateException(); } - _model.deleteArchMapObject(_currArchObject); - _currArchObject = null; + model.deleteArchMapObject(currArchObject); + currArchObject = null; } -} + +} // class ArchObjectIteratorDeleteArchMapObject Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-06-03 23:18:32 UTC (rev 128) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-06-04 01:05:07 UTC (rev 129) @@ -4,45 +4,58 @@ import cfeditor.CMapModel; import java.util.Iterator; +import java.awt.Point; /** * The class ArchObjectIterator implements an {@link ArchObjectIterator} that - * implements the {@link java.util.Iterator#remove()} operation via {@link + * implements the {@link Iterator#remove()} operation via {@link * CMapModel#deleteMapArch(int, int, int, boolean, boolean)}. * @author Andreas Kirschbaum */ -public class ArchObjectIteratorDeleteMapArch extends ArchObjectIterator implements Iterator { +public class ArchObjectIteratorDeleteMapArch extends ArchObjectIterator { - private final CMapModel _model; + private final CMapModel mapModel; - private final int _x; + private final Point pos; - private final int _y; + private final boolean refreshMap; - private final boolean _refreshMap; + private final boolean join; - private final boolean _join; - - public ArchObjectIteratorDeleteMapArch(CMapModel model, ArchObject archObject, int x, int y, boolean refreshMap, boolean join) { + public ArchObjectIteratorDeleteMapArch(final CMapModel mapModel, final ArchObject archObject, final Point pos, final boolean refreshMap, final boolean join) { super(archObject); - if (model == null) { + if (mapModel == null) { throw new IllegalArgumentException(); } - _model = model; - _x = x; - _y = y; - _refreshMap = refreshMap; - _join = join; + this.mapModel = mapModel; + this.pos = pos; + this.refreshMap = refreshMap; + this.join = join; } + /** + * @param mapModel + * @param archObject + * @param x + * @param y + * @param refreshMap + * @param join + * @deprecated use {@link #ArchObjectIteratorDeleteMapArch(cfeditor.CMapModel, ArchObject, java.awt.Point, boolean, boolean)} instead + */ + @Deprecated public ArchObjectIteratorDeleteMapArch(final CMapModel mapModel, final ArchObject archObject, final int x, final int y, final boolean refreshMap, final boolean join) { + this(mapModel, archObject, new Point(x, y), refreshMap, join); + } + + /** {@inheritDoc} */ @Override public void remove() { - if (_currArchObject == null) { + if (currArchObject == null) { throw new IllegalStateException(); } - _model.deleteMapArch(_currArchObject.getMyID(), _x, _y, _refreshMap, _join); - _currArchObject = null; + mapModel.deleteMapArch(currArchObject.getMyID(), pos, refreshMap, join); + currArchObject = null; } -} + +} // class ArchObjectIteratorDeleteMapArch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 23:18:53
|
Revision: 128 Author: christianhujer Date: 2006-06-03 16:18:32 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=128&view=rev Log Message: ----------- Unified application name in copyright messages of unified code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/CommonConstants.java trunk/src/app/net/sf/gridarta/GridderException.java trunk/src/app/net/sf/gridarta/gui/GSplitPane.java trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java trunk/src/app/net/sf/gridarta/help/Help.java trunk/src/app/net/sf/gridarta/help/HtmlPane.java Modified: trunk/src/app/net/sf/gridarta/CommonConstants.java =================================================================== --- trunk/src/app/net/sf/gridarta/CommonConstants.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/CommonConstants.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Crossfire Java Editor. + * Gridarta Map Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * Modified: trunk/src/app/net/sf/gridarta/GridderException.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridderException.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/GridderException.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Crossfire Java Editor. + * Gridarta Map Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * Modified: trunk/src/app/net/sf/gridarta/gui/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Gridarta Java Editor. + * Gridarta Map Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * Copyright (C) 2005 Christian Hujer Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2006 Daniel Viegas * * This program is free software; you can redistribute it and/or Modified: trunk/src/app/net/sf/gridarta/help/Help.java =================================================================== --- trunk/src/app/net/sf/gridarta/help/Help.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/help/Help.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * Modified: trunk/src/app/net/sf/gridarta/help/HtmlPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/help/HtmlPane.java 2006-06-03 23:15:20 UTC (rev 127) +++ trunk/src/app/net/sf/gridarta/help/HtmlPane.java 2006-06-03 23:18:32 UTC (rev 128) @@ -1,5 +1,5 @@ /* - * Daimonin Java Editor. + * Gridarta Map Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 23:15:48
|
Revision: 127 Author: christianhujer Date: 2006-06-03 16:15:20 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=127&view=rev Log Message: ----------- Renamed DSplitPane to GSplitPane. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapArchPanel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/GSplitPane.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/DSplitPane.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-03 23:14:42 UTC (rev 126) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-03 23:15:20 UTC (rev 127) @@ -37,7 +37,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.gui.DSplitPane; +import net.sf.gridarta.gui.GSplitPane; /** * The <code>CArchPanel</code> holds the tile palette. @@ -62,7 +62,7 @@ private final JTabbedPane archAndPickPane; /** Our split pane. */ - private final DSplitPane splitPane; + private final GSplitPane splitPane; /** The Tab panel with arch lists. */ private final JTabbedPane tabDesktop; @@ -101,7 +101,7 @@ // this listener informs the mainview which panel is active: archlist or pickmaps? CPickmapPanel.getInstance().addArchNPickChangeListener(archAndPickPane); - splitPane = new DSplitPane(JSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); + splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); // calculate default value in case there is no settings file final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-03 23:14:42 UTC (rev 126) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-03 23:15:20 UTC (rev 127) @@ -31,7 +31,7 @@ import daieditor.map.MapControl; import daieditor.map.validation.ErrorCollector; import daieditor.map.validation.ErrorHandler; -import net.sf.gridarta.gui.DSplitPane; +import net.sf.gridarta.gui.GSplitPane; import java.awt.BorderLayout; import java.awt.Point; import java.awt.Rectangle; @@ -131,13 +131,13 @@ private JDesktopPane mapDesktop; /** The split pane. */ - private DSplitPane splitPane; + private GSplitPane splitPane; /** All open level views. */ - private DSplitPane splitDownPane; + private GSplitPane splitDownPane; /** All open level views. */ - private DSplitPane splitRightPane; + private GSplitPane splitRightPane; /** All open level views. */ private final List<CMapViewIFrame> mapViews = synchronizedList(new ArrayList<CMapViewIFrame>()); @@ -220,16 +220,16 @@ mapArchPanel = new CMapArchPanel(mainControl, this); if (!mapTileListBottom) { - splitRightPane = new DSplitPane(HORIZONTAL_SPLIT, mapDesktop, mapTileList); + splitRightPane = new GSplitPane(HORIZONTAL_SPLIT, mapDesktop, mapTileList); splitRightPane.setDividerLocation(divLocationRight); - splitDownPane = new DSplitPane(VERTICAL_SPLIT, splitRightPane, mapArchPanel); + splitDownPane = new GSplitPane(VERTICAL_SPLIT, splitRightPane, mapArchPanel); } else { - splitRightPane = new DSplitPane(HORIZONTAL_SPLIT, mapArchPanel, mapTileList); + splitRightPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, mapTileList); splitRightPane.setDividerLocation(divLocationRight); - splitDownPane = new DSplitPane(VERTICAL_SPLIT, mapDesktop, splitRightPane); + splitDownPane = new GSplitPane(VERTICAL_SPLIT, mapDesktop, splitRightPane); } splitDownPane.setDividerLocation(divLocationDown); - splitPane = new DSplitPane(HORIZONTAL_SPLIT, archPanel, splitDownPane); + splitPane = new GSplitPane(HORIZONTAL_SPLIT, archPanel, splitDownPane); splitPane.setDividerLocation(divLocation); centerPanel.add(splitPane, BorderLayout.CENTER); Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-03 23:14:42 UTC (rev 126) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-03 23:15:20 UTC (rev 127) @@ -68,7 +68,7 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; -import net.sf.gridarta.gui.DSplitPane; +import net.sf.gridarta.gui.GSplitPane; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; @@ -140,7 +140,7 @@ */ private ButtonGroup directionButtonGroup = new ButtonGroup(); - private final DSplitPane splitPane; + private final GSplitPane splitPane; private final JTabbedPane panelDesktop; @@ -208,7 +208,7 @@ panelDesktop = new JTabbedPane(TOP); mapArchPanel.setLayout(new BorderLayout()); - splitPane = new DSplitPane(HORIZONTAL_SPLIT, mapArchPanel, scrollPane2); + splitPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, scrollPane2); final JPanel buttonPanel = new JPanel(); Deleted: trunk/src/app/net/sf/gridarta/gui/DSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DSplitPane.java 2006-06-03 23:14:42 UTC (rev 126) +++ trunk/src/app/net/sf/gridarta/gui/DSplitPane.java 2006-06-03 23:15:20 UTC (rev 127) @@ -1,64 +0,0 @@ -/* - * Gridarta Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * Copyright (C) 2005 Christian Hujer - * Copyright (C) 2006 The Gridarta Developers - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package net.sf.gridarta.gui; - -import java.awt.Component; -import javax.swing.JSplitPane; - -/** - * Splitpane subclass that keeps its size even upon L'n'F change. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class DSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** - * Create a new DSplitPane. - * @param newOrientation {@link JSplitPane#HORIZONTAL_SPLIT} or {@link JSplitPane.VERTICAL_SPLIT}. - * @param newLeftComponent the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane - * @param newRightComponent the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane - */ - public DSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - setOneTouchExpandable(true); - } - - /** {@inheritDoc} */ - // Overridden to store and restore the divider location upon UI change. - @Override public void updateUI() { - final int dividerLocationBackup = getDividerLocation(); - //final int dividerSizeBackup = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocationBackup); - //setDividerSize(dividerSizeBackup); - } - -} // class DSplitPane Copied: trunk/src/app/net/sf/gridarta/gui/GSplitPane.java (from rev 121, trunk/src/app/net/sf/gridarta/gui/DSplitPane.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GSplitPane.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-06-03 23:15:20 UTC (rev 127) @@ -0,0 +1,64 @@ +/* + * Gridarta Java Editor. + * Copyright (C) 2000 Michael Toennies + * Copyright (C) 2001 Andreas Vogl + * Copyright (C) 2005 Christian Hujer + * Copyright (C) 2006 The Gridarta Developers + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui; + +import java.awt.Component; +import javax.swing.JSplitPane; + +/** + * Splitpane subclass that keeps its size even upon L'n'F change. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class GSplitPane extends JSplitPane { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** + * Create a new DSplitPane. + * @param newOrientation {@link JSplitPane#HORIZONTAL_SPLIT} or {@link JSplitPane.VERTICAL_SPLIT}. + * @param newLeftComponent the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane + * @param newRightComponent the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane + */ + public GSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { + super(newOrientation, newLeftComponent, newRightComponent); + setOneTouchExpandable(true); + } + + /** {@inheritDoc} */ + // Overridden to store and restore the divider location upon UI change. + @Override public void updateUI() { + final int dividerLocationBackup = getDividerLocation(); + //final int dividerSizeBackup = getDividerSize(); + super.updateUI(); + setDividerLocation(dividerLocationBackup); + //setDividerSize(dividerSizeBackup); + } + +} // class DSplitPane Property changes on: trunk/src/app/net/sf/gridarta/gui/GSplitPane.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 23:14:57
|
Revision: 126 Author: christianhujer Date: 2006-06-03 16:14:42 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=126&view=rev Log Message: ----------- Removed unused originator field from GridderException. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainView.java trunk/src/app/net/sf/gridarta/GridderException.java Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 23:14:02 UTC (rev 125) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 23:14:42 UTC (rev 126) @@ -543,7 +543,7 @@ * @param error The error to be shown. */ void showError(GridderException error) { - JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME + " Error in " + error.getOriginator(), JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); + JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME, JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); } /** Modified: trunk/src/app/net/sf/gridarta/GridderException.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridderException.java 2006-06-03 23:14:02 UTC (rev 125) +++ trunk/src/app/net/sf/gridarta/GridderException.java 2006-06-03 23:14:42 UTC (rev 126) @@ -35,37 +35,12 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /** The originator of the error. */ - private final Object originator; - /** * Create a CGridderException. * @param msg message */ public GridderException(final String msg) { - this(msg, null); - } - - /** - * Create a CGridderException. - * @param msg Message - * @param originator Originator - */ - public GridderException(final String msg, final Object originator) { super(msg); - this.originator = originator; } - /** - * Returns the originator of the error. - * @return the originator of the error. - */ - public String getOriginator() { - if (originator != null) { - return originator.getClass().getName(); - } - - return "unknown"; - } - } // class CGridderException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 23:14:16
|
Revision: 125 Author: christianhujer Date: 2006-06-03 16:14:02 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=125&view=rev Log Message: ----------- Changed to new screenshots (untested due to ssh.sf.net outage). Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-03 23:13:03 UTC (rev 124) +++ trunk/src/doc/start.xhtml 2006-06-03 23:14:02 UTC (rev 125) @@ -17,8 +17,8 @@ <body> <div style="float:right;text-align:center;font-size:75%;"> <h2>Screenshots</h2> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34850"><img src="http://sourceforge.net/dbimage.php?id=74447" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34851"><img src="http://sourceforge.net/dbimage.php?id=74449" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34870"><img src="http://sourceforge.net/dbimage.php?id=74485" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=348691"><img src="http://sourceforge.net/dbimage.php?id=74487" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> </div> <p> Latest release version: <strong>- (no release yet)</strong> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 23:13:14
|
Revision: 124 Author: christianhujer Date: 2006-06-03 16:13:03 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=124&view=rev Log Message: ----------- made build fail if rsync fails. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-06-03 22:12:29 UTC (rev 123) +++ trunk/build.xml 2006-06-03 23:13:03 UTC (rev 124) @@ -385,7 +385,7 @@ <svn javahl="${user.svn.javahl}"> <commit file="src/doc/api/start.xhtml" message="Updating API link to include ${project.version}." /> </svn> - <exec executable="rsync"> + <exec executable="rsync" failonerror="true"> <arg line="-auzv -e ssh dest/doc/api/ ${user.rsync.username}@${user.rsync.host}:${user.rsync.dir}/htdocs/api/" /> </exec> <sshexec @@ -413,7 +413,7 @@ description = "uploads the latest editorial documentation." depends = "editorialDoc" > - <exec executable="rsync"> + <exec executable="rsync" failonerror="true"> <arg line="-auzv --exclude=api/*/ -e ssh dest/doc/ ${user.rsync.username}@${user.rsync.host}:${user.rsync.dir}/htdocs/" /> </exec> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 22:22:31
|
Revision: 123 Author: christianhujer Date: 2006-06-03 15:12:29 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=123&view=rev Log Message: ----------- Renamed CGridderException to GridderException. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/MapTilePane.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/GridderException.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/CGridderException.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 22:12:29 UTC (rev 123) @@ -27,7 +27,7 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -1265,7 +1265,7 @@ JOptionPane.showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); - throw new CGridderException(""); // bail out + throw new GridderException(""); // bail out } } } else if (dType == CFArchAttrib.T_STRING) { @@ -1350,7 +1350,7 @@ JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", JOptionPane.ERROR_MESSAGE); - throw new CGridderException(""); // bail out + throw new GridderException(""); // bail out } if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null)) @@ -1467,7 +1467,7 @@ mainControl.getMainView().refreshMapArchPanel(); return true; // apply succeeded - } catch (final CGridderException e) { + } catch (final GridderException e) { } return false; // error (-> try again) Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 22:12:29 UTC (rev 123) @@ -27,7 +27,7 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -647,7 +647,7 @@ input.setText(" " + getSelectedTreasureList()); } frame.setVisible(false); - } catch (CGridderException ex) { + } catch (GridderException ex) { // user selected an invalid treasurelist - do nothing } } @@ -694,9 +694,9 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws CGridderException when user selected an invalid treasurelist (e.g. a god-list) + * @throws GridderException when user selected an invalid treasurelist (e.g. a god-list) */ - @Nullable private String getSelectedTreasureList() throws CGridderException { + @Nullable private String getSelectedTreasureList() throws GridderException { // return null when nothing is selected if (isSelectionEmpty()) { return null; @@ -723,7 +723,7 @@ CMainControl.getInstance().showMessage("Invalid Selection", "The " + trNode.getTreasureObj().getName() + " treasurelists must not be used in maps.\n" + "These lists are reserved for internal use in the Crossfire server."); - throw new CGridderException("invalid selection"); + throw new GridderException("invalid selection"); } return trNode.getTreasureObj().getName(); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 22:12:29 UTC (rev 123) @@ -53,7 +53,7 @@ import org.jetbrains.annotations.Nullable; import net.sf.japi.util.filter.file.EndingFileFilter; import net.sf.japi.swing.ActionFactory; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * The main controller of the level editor. Basically the main application. @@ -958,7 +958,7 @@ try { start = mapFileDecoder.decodeMapFile(file); // parse mapfile maparch = mapFileDecoder.getMapArch(); // get map arch - } catch (CGridderException e) { + } catch (GridderException e) { // popup display showMessage("Couldn't load Map", e.getMessage()); return null; @@ -1802,7 +1802,7 @@ noarchTileIconX = CGUIUtils.getSysIcon(IGUIConstants.TILE_NOARCH); } - public void handleErrors(CGridderException error) { + public void handleErrors(GridderException error) { Toolkit.getDefaultToolkit().beep(); mainView.showError(error); } Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 22:12:29 UTC (rev 123) @@ -26,7 +26,7 @@ import cfeditor.arch.ArchObject; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -542,7 +542,7 @@ * Shows the given error in the UI. * @param error The error to be shown. */ - void showError(CGridderException error) { + void showError(GridderException error) { JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME + " Error in " + error.getOriginator(), JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); } Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-03 22:12:29 UTC (rev 123) @@ -31,7 +31,7 @@ import java.awt.Point; import java.io.File; import java.util.Iterator; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * The <code>CMapControl</code> @@ -191,7 +191,7 @@ * Handles the given error. * @param error a generic error */ - public void handleErrors(CGridderException error) { + public void handleErrors(GridderException error) { mainControl.handleErrors(error); } Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-03 22:12:29 UTC (rev 123) @@ -31,7 +31,7 @@ import java.io.IOException; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * This class handles the reading of a mapfile and parsing the data @@ -69,9 +69,9 @@ * This method returns a list of arches, connected with the temp pointers. * @param file mapfile * @return first <code>ArchObject</code> in the list - * @throws CGridderException when file content invalid + * @throws GridderException when file content invalid */ - public ArchObject decodeMapFile(final File file) throws CGridderException { + public ArchObject decodeMapFile(final File file) throws GridderException { try { FileReader fr = new FileReader(file); @@ -85,7 +85,7 @@ // first of all we read the map arch (if that fails we throw an exception) maparch = new MapArchObject(); if (!maparch.parseMapArch(myInput, file.getName())) { - throw new CGridderException("The file '" + file.getName() + "' does not\n" + + throw new GridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Crossfire map format!\n"); } //maparch.setName(file.getName()); @@ -108,7 +108,7 @@ tarch = tarch.getTemp(); } - throw new CGridderException("The file '" + file.getName() + "' cannot be loaded: " + e.getMessage()); + throw new GridderException("The file '" + file.getName() + "' cannot be loaded: " + e.getMessage()); } // finally... here we go Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-03 22:12:29 UTC (rev 123) @@ -51,7 +51,7 @@ import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * Dialog used to ask the user the properties for the new level. @@ -519,7 +519,7 @@ "You must specify a Map Name."); return false; } - } catch (CGridderException e) { + } catch (GridderException e) { mainControl.showMessage("Invalid Entry", e.getMessage()); return false; } @@ -601,9 +601,9 @@ * @param s string to be parse * @param label attribute label for errormessage * @return value of String 's', zero if 's' is empty - * @throws CGridderException when parsing fails + * @throws GridderException when parsing fails */ - private int parseProperty(String s, String label) throws CGridderException { + private int parseProperty(String s, String label) throws GridderException { int r; // return value if (s.length() == 0) { @@ -614,12 +614,12 @@ r = Integer.parseInt(s); // trying to parse } catch (NumberFormatException illegalNumbers) { // 's' is not a number - throw new CGridderException(label + ": '" + s + "' is not a numerical integer value."); + throw new GridderException(label + ": '" + s + "' is not a numerical integer value."); } // negative values are not allowed if (r < 0) { - throw new CGridderException(label + ": '" + s + "' is negative."); + throw new GridderException(label + ": '" + s + "' is negative."); } return r; // everything okay @@ -632,9 +632,9 @@ * @param s string to be parse * @param label attribute label for errormessage * @return value of String 's', zero if 's' is empty - * @throws CGridderException when parsing fails + * @throws GridderException when parsing fails */ - private double parsePropertyToDouble(String s, String label) throws CGridderException { + private double parsePropertyToDouble(String s, String label) throws GridderException { double r; // return value if (s.length() == 0) { @@ -645,12 +645,12 @@ r = Double.parseDouble(s); // trying to parse } catch (NumberFormatException illegalNumbers) { // 's' is not a number - throw new CGridderException(label + ": '" + s + "' is not a numerical double value."); + throw new GridderException(label + ": '" + s + "' is not a numerical double value."); } // negative values are not allowed if (r < 0) { - throw new CGridderException(label + ": '" + s + "' is negative."); + throw new GridderException(label + ": '" + s + "' is negative."); } return r; // everything okay Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-03 22:12:29 UTC (rev 123) @@ -34,7 +34,7 @@ import javax.swing.event.ChangeListener; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * The <code>CPickmapPanel</code> manages the pickmap panel @@ -160,7 +160,7 @@ tabpane.insertTab(mapFile.getName(), null, bmapview, null, i); return true; } - } catch (CGridderException e) { + } catch (GridderException e) { // loading failed - could be a system file in that directory, // or something else. Doesn't deserve more attention than a printout. if (!mapFile.getName().startsWith(".")) { Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-03 22:12:29 UTC (rev 123) @@ -45,7 +45,7 @@ import daieditor.arch.NamedObject; import daieditor.arch.NamedObjects; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -1089,7 +1089,7 @@ } catch (final NumberFormatException e) { // parsing failed: wrong entry!! showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", ERROR_MESSAGE); - throw new CGridderException(""); // bail out + throw new GridderException(""); // bail out } } } else if (dType == STRING || dType == FACENAME || dType == ANIMNAME) { @@ -1186,7 +1186,7 @@ // The user has specified a WRONG treasurelist name, and it does not come // from the default arch. -> Error and out. showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + '\'' + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); - throw new CGridderException(""); // bail out + throw new GridderException(""); // bail out } if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), false)) @@ -1293,7 +1293,7 @@ mainControl.getMainView().refreshMapTileList(); mainControl.getCurrentMap().repaint(); return true; // apply succeeded - } catch (final CGridderException e) { + } catch (final GridderException e) { System.err.println(e); // Really ignore this? } Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-03 22:12:29 UTC (rev 123) @@ -27,7 +27,7 @@ import static daieditor.CGUIUtils.getSysIcon; import daieditor.arch.ArchObject; import net.sf.gridarta.help.Help; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import static java.awt.Color.gray; import java.awt.Component; @@ -621,7 +621,7 @@ input.setText(' ' + getSelectedTreasureList()); } frame.setVisible(false); - } catch (final CGridderException ex) { + } catch (final GridderException ex) { // user selected an invalid treasurelist - do nothing } } @@ -667,9 +667,9 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws net.sf.gridarta.CGridderException when user selected an invalid treasurelist (e.g. a god-list) + * @throws net.sf.gridarta.GridderException when user selected an invalid treasurelist (e.g. a god-list) */ - @Nullable private String getSelectedTreasureList() throws CGridderException { + @Nullable private String getSelectedTreasureList() throws GridderException { // return null when nothing is selected if (isSelectionEmpty()) { return null; @@ -693,7 +693,7 @@ final TreasureTreeNode trNode = (TreasureTreeNode) node; if (trNode.getTreasureObj().getType() == TreasureObj.FOLDER) { showMessageDialog(this, "The " + trNode.getTreasureObj().getName() + " treasurelists must not be used in maps.\nThese lists are reserved for internal use in the Daimonin server.", "Invalid Selection", WARNING_MESSAGE); - throw new CGridderException("invalid selection"); + throw new GridderException("invalid selection"); } return trNode.getTreasureObj().getName(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-03 22:12:29 UTC (rev 123) @@ -37,7 +37,7 @@ import daieditor.arch.match.MutableOrArchObjectMatcher; import daieditor.arch.match.ViewArchObjectMatcherManager; import net.sf.gridarta.gui.HideFileFilterProxy; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import daieditor.gui.MapFileFilter; import daieditor.gui.map.MapCursorControl; import daieditor.gui.map.MapPreviewAccessory; @@ -1228,7 +1228,7 @@ } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainView, "openFileLoadMap", e.getMessage()); return false; - } catch (final CGridderException e) { + } catch (final GridderException e) { ACTION_FACTORY.showMessageDialog(mainView, "openFileLoadMap", e.getMessage()); return false; } catch (final OutOfMemoryError ignore) { Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-03 22:12:29 UTC (rev 123) @@ -35,7 +35,7 @@ import java.util.ArrayList; import java.util.List; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * This class handles the reading of a mapfile and parsing the data @@ -68,10 +68,10 @@ * @param file mapfile * @param mapDir map directory * @return first <code>ArchObject</code> in the list - * @throws net.sf.gridarta.CGridderException when file content invalid + * @throws net.sf.gridarta.GridderException when file content invalid * @todo remove mainControl param and replace with mapDir param */ - public synchronized List<ArchObject> decodeMapFile(final File file, final String mapDir) throws CGridderException, FileNotFoundException, IOException { + public synchronized List<ArchObject> decodeMapFile(final File file, final String mapDir) throws GridderException, FileNotFoundException, IOException { BufferedReader myInput = null; try { @@ -92,7 +92,7 @@ fname = file.getCanonicalPath(); } if (!maparch.parseMapArch(myInput, fname)) { - throw new CGridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Daimonin map format!\n"); + throw new GridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Daimonin map format!\n"); } //maparch.setName(file.getName()); Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-03 22:12:29 UTC (rev 123) @@ -38,7 +38,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; /** * The <code>CPickmapPanel</code> manages the pickmap panel @@ -166,7 +166,7 @@ bmapview.getMapControl().setPickmap(true); return true; } - } catch (final CGridderException e) { + } catch (final GridderException e) { // loading failed - could be a system file in that directory, // or something else. Doesn't deserve more attention than a printout. if (!mapFile.getName().startsWith(".")) { Modified: trunk/daimonin/src/daieditor/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-03 22:12:29 UTC (rev 123) @@ -56,7 +56,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; -import net.sf.gridarta.CGridderException; +import net.sf.gridarta.GridderException; import org.jetbrains.annotations.Nullable; /** @@ -761,7 +761,7 @@ maphead = null; /*mainControl.showMessage("Invalid Path", "Failed to load file for tiled map.\n" + newfile.getAbsolutePath());*/ } - } catch (final CGridderException e) { + } catch (final GridderException e) { maphead = null; /* mainControl.showMessage("Couldn't load Map", e.getMessage());*/ } @@ -780,7 +780,7 @@ return maphead; } - private static TileMapHeader loadMapFileHeader(final File file) throws CGridderException { + private static TileMapHeader loadMapFileHeader(final File file) throws GridderException { TileMapHeader maphead = null; @@ -791,7 +791,7 @@ // first of all we read the map arch (if that fails we throw an exception) final MapArchObject maparch = new MapArchObject(); if (!maparch.parseMapArch(myInput, file.getName())) { - throw new CGridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Daimonin map format!\n"); + throw new GridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Daimonin map format!\n"); } maphead = new TileMapHeader(maparch); Deleted: trunk/src/app/net/sf/gridarta/CGridderException.java =================================================================== --- trunk/src/app/net/sf/gridarta/CGridderException.java 2006-06-03 22:08:41 UTC (rev 122) +++ trunk/src/app/net/sf/gridarta/CGridderException.java 2006-06-03 22:12:29 UTC (rev 123) @@ -1,71 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package net.sf.gridarta; - -/** - * <code>CGridderException</code> class that is used to transfer error messages - * and other error information inside the Gridder application. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @deprecated this exception has no semantic value and therefore should be removed - */ -@Deprecated public final class CGridderException extends Exception { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The originator of the error. */ - private final Object originator; - - /** - * Create a CGridderException. - * @param msg message - */ - public CGridderException(final String msg) { - this(msg, null); - } - - /** - * Create a CGridderException. - * @param msg Message - * @param originator Originator - */ - public CGridderException(final String msg, final Object originator) { - super(msg); - this.originator = originator; - } - - /** - * Returns the originator of the error. - * @return the originator of the error. - */ - public String getOriginator() { - if (originator != null) { - return originator.getClass().getName(); - } - - return "unknown"; - } - -} // class CGridderException Copied: trunk/src/app/net/sf/gridarta/GridderException.java (from rev 122, trunk/src/app/net/sf/gridarta/CGridderException.java) =================================================================== --- trunk/src/app/net/sf/gridarta/GridderException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/GridderException.java 2006-06-03 22:12:29 UTC (rev 123) @@ -0,0 +1,71 @@ +/* + * Crossfire Java Editor. + * Copyright (C) 2000 Michael Toennies + * Copyright (C) 2001 Andreas Vogl + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta; + +/** + * <code>CGridderException</code> class that is used to transfer error messages + * and other error information inside the Gridder application. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @deprecated this exception has no semantic value and therefore should be removed + */ +@Deprecated public final class GridderException extends Exception { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The originator of the error. */ + private final Object originator; + + /** + * Create a CGridderException. + * @param msg message + */ + public GridderException(final String msg) { + this(msg, null); + } + + /** + * Create a CGridderException. + * @param msg Message + * @param originator Originator + */ + public GridderException(final String msg, final Object originator) { + super(msg); + this.originator = originator; + } + + /** + * Returns the originator of the error. + * @return the originator of the error. + */ + public String getOriginator() { + if (originator != null) { + return originator.getClass().getName(); + } + + return "unknown"; + } + +} // class CGridderException Property changes on: trunk/src/app/net/sf/gridarta/GridderException.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 22:22:31
|
Revision: 121 Author: christianhujer Date: 2006-06-03 15:00:45 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=121&view=rev Log Message: ----------- Improved splitpane. Unified CGridderException. Improved some I/O code. Beautified some code. Changed access to arch and face tables in cfeditor's ArchObjectStack. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CGridderException.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/CGridderException.java trunk/src/app/net/sf/gridarta/gui/DSplitPane.java trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-03 22:00:45 UTC (rev 121) @@ -137,28 +137,22 @@ sectionFlag = false; } else if (count < 16) { // add a new archid to the buffer - Object entry = null; // hashtable entry - try { - // try to parse the arch node_nr from the hashtable - entry = archstack.getArchHashTable().get(line); // get hashtable entry - if (entry != null) { - nbuf[count] = Integer.parseInt(entry.toString()); // get int value + // try to parse the arch node_nr from the hashtable + final int entry = ArchObjectStack.getArchIndex(line); + if (entry != -1) { + nbuf[count] = entry; - if (!archstack.getArch(nbuf[count]).isMulti()) { - count++; // no multipart, this one's okay - } else { - log.warn("In file " + filename + ": Arch '" + line + "' is a multipart."); - } + if (!archstack.getArch(nbuf[count]).isMulti()) { + count++; // no multipart, this one's okay } else { - // (If no arches exist at all, errormessages are suppressed here) - if (archstack.getArchCount() >= 1) { - log.warn("In file " + filename + ": Arch '" + line + "' not found."); - } + log.warn("In file " + filename + ": Arch '" + line + "' is a multipart."); } - } catch (NumberFormatException e) { - // parsing failed (should not happen) - log.error("ArchObjectStack Hashtable entry '" + entry.toString() + "' not parseable as int!", e); + } else { + // (If no arches exist at all, errormessages are suppressed here) + if (archstack.getArchCount() >= 1) { + log.warn("In file " + filename + ": Arch '" + line + "' not found."); + } } } else { count++; // too many arches Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 22:00:45 UTC (rev 121) @@ -25,6 +25,7 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.arch.ArchObjectStack; import net.sf.gridarta.help.Help; import java.awt.BorderLayout; import java.awt.Color; @@ -1413,20 +1414,12 @@ if (faceChanged) { if (arch.getFaceName() != null) { // we have a non-default face - final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(arch.getFaceName()); - if (index != null) { - arch.setFaceNr(index); - } else { - arch.setFaceNr(-1); - } + final int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + arch.setFaceNr(index); } else { // we have the default face - final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(defarch.getFaceName()); - if (index != null) { - arch.setFaceNr(index); - } else { - arch.setFaceNr(-1); - } + final int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); + arch.setFaceNr(index); } mainControl.getCurrentMap().repaint(); // repaint map } Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 22:00:45 UTC (rev 121) @@ -1001,11 +1001,11 @@ } } else if (content.getType() != TreasureObj.FOLDER) { // normal arch: display the face icon - Integer num = (Integer) (CMainControl.getInstance().getArchObjectStack().getArchHashTable().get(content.getName())); - if (num != null && ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE) { - ArchObject arch = CMainControl.getInstance().getArch(num.intValue()); + final int num = ArchObjectStack.getArchIndex(content.getName()); + if (num != -1 && ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE) { + final ArchObject arch = CMainControl.getInstance().getArch(num); if (arch != null) { - if (num.intValue() != -1 && !arch.getFaceFlag()) { + if (!arch.getFaceFlag()) { setIcon(CMainControl.getInstance().getFace(arch.getFaceNr())); } else { setIcon(noface); Modified: trunk/crossfire/src/cfeditor/CGridderException.java =================================================================== --- trunk/crossfire/src/cfeditor/CGridderException.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/CGridderException.java 2006-06-03 22:00:45 UTC (rev 121) @@ -38,13 +38,21 @@ /** The originator of the error. */ private final Object originator; - public CGridderException(final String strMessage) { - super(strMessage); - originator = null; + /** + * Create a CGridderException. + * @param msg message + */ + public CGridderException(final String msg) { + this(msg, null); } - public CGridderException(final String strMessage, final Object originator) { - super(strMessage); + /** + * Create a CGridderException. + * @param msg Message + * @param originator Originator + */ + public CGridderException(final String msg, final Object originator) { + super(msg); this.originator = originator; } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 22:00:45 UTC (rev 121) @@ -1020,29 +1020,27 @@ */ boolean collectTempList(ArchObject arch, File f) { ArchObject previous = null; // previous arch in loop - Integer index; - int i; + int index; // first: attach our map sucker to a default arch we have loaded for (; arch != null;) { - index = (Integer) archList.getArchHashTable().get(arch.getArchName()); - if (index == null) { + index = ArchObjectStack.getArchIndex(arch.getArchName()); + if (index == -1) { // we had an unknown arch here!! // showMessage("Error Loading Map File "+f.getName(), "\n Found Unknown Arch < "+arch.getArchName()+" >"); // return false; } else { - i = index.intValue(); - arch.setNodeNr(i); // our default arch! + arch.setNodeNr(index); // our default arch! } // 2nd: attach the right face... // if there was no special face added in map, get it from def object if (arch.getFaceName() != null) { - index = (Integer) archList.getFaceHashTable().get(arch.getFaceName()); - if (index == null) { // just warn here we have not the gfx + index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + if (index == -1) { // just warn here we have not the gfx //showMessage("LOAD FILE", "Arch: "+arch.getFaceName()+" Face: " +arch.getFaceName()+" Face Name Unknown"); } else { - arch.setFaceNr(index.intValue()); + arch.setFaceNr(index); } } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-03 22:00:45 UTC (rev 121) @@ -25,6 +25,7 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.arch.ArchObjectStack; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -385,26 +386,12 @@ if (arch.getFaceName() != null) { // we have a non-default face - Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(arch.getFaceName()); - if (index != null) { - arch.setFaceNr(index.intValue()); - } else { - arch.setFaceNr(-1); - } + int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + arch.setFaceNr(index); } else { // we have the default face - Integer index = null; - try { - index = (Integer) (mainControl.getArchObjectStack().getFaceHashTable().get(defarch.getFaceName())); - } catch (NumberFormatException e) { - } catch (NullPointerException e) { - } - - if (index != null) { - arch.setFaceNr(index.intValue()); - } else { - arch.setFaceNr(-1); - } + int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); + arch.setFaceNr(index); } // the msg TEXT!! ("msg ... endmsg") Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-03 22:00:45 UTC (rev 121) @@ -33,8 +33,9 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.DataConversionException; @@ -48,25 +49,26 @@ * The <code>ArchObjectParser</code> class handles the parsing of arches. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public final class ArchObjectParser { - private static final Logger log = Logger.getLogger(ArchObjectParser.class); + private static final Logger LOG = Logger.getLogger(ArchObjectParser.class); // name of the system-arch containing path of starting map public static final String STARTARCH_NAME = "map"; // table with type numbers as keys (Integer), and type names as values (String) - private Hashtable archTypeNumbers; + private Map<Integer,String> archTypeNumbers; - private final CMainControl m_control; + private final CMainControl mainControl; /** * Constructor - * @param control main control + * @param mainControl main control */ - public ArchObjectParser(final CMainControl control) { - m_control = control; + public ArchObjectParser(final CMainControl mainControl) { + this.mainControl = mainControl; archTypeNumbers = null; } @@ -76,63 +78,64 @@ * Hashtable 'archTypeNumbers'. */ public void loadTypeNumbers() { - CFileReader reader = null; // input reader - archTypeNumbers = new Hashtable(); + archTypeNumbers = new HashMap<Integer,String>(); try { // open reading stream to the spells xml file - final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); - reader = new CFileReader(baseDir, IGUIConstants.TYPENR_FILE); + final String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR; + final CFileReader reader = new CFileReader(baseDir, IGUIConstants.TYPENR_FILE); + try { - // parse xml document - final SAXBuilder builder = new SAXBuilder(); - builder.setValidation(true); - final Document doc = builder.build(reader.getReader()); + // parse xml document + final SAXBuilder builder = new SAXBuilder(); + builder.setValidation(true); + final Document doc = builder.build(reader.getReader()); - // retrieve the spell data from the xml - final Element root = doc.getRootElement(); - final Attribute a; - if (root == null || !root.getName().equalsIgnoreCase("typenumbers")) { - log.warn("File '" + IGUIConstants.TYPENR_FILE + "' lacks root element 'typenumbers'."); - } else { - final List types = root.getChildren("type"); - if (types == null || types.size() == 0) { - log.warn("File '" + IGUIConstants.TYPENR_FILE + "' has no content."); + // retrieve the spell data from the xml + final Element root = doc.getRootElement(); + final Attribute a; + if (root == null || !"typenumbers".equalsIgnoreCase(root.getName())) { + LOG.warn("File '" + IGUIConstants.TYPENR_FILE + "' lacks root element 'typenumbers'."); } else { - // process all 'type' elements from the xml file - int i; - for (i = 0; i < types.size(); i++) { - final Element type_elem = (Element) types.get(i); + final List types = root.getChildren("type"); + if (types == null || types.size() == 0) { + LOG.warn("File '" + IGUIConstants.TYPENR_FILE + "' has no content."); + } else { + // process all 'type' elements from the xml file + int i; + for (i = 0; i < types.size(); i++) { + final Element typeElem = (Element) types.get(i); - if (type_elem.getAttribute("number") == null) { - log.warn("In File '" + IGUIConstants.TYPENR_FILE + "': Found 'type' element without 'number'"); - } else if (type_elem.getAttribute("name") == null) { - log.warn("In File '" + IGUIConstants.TYPENR_FILE + "': Found 'type' element without 'name'"); - } else { - try { - // parse type number and -name, then add it to the table 'archTypeNumbers' - final Integer typenum = new Integer(type_elem.getAttribute("number").getIntValue()); - archTypeNumbers.put(typenum, type_elem.getAttribute("name").getValue()); - } catch (final DataConversionException de) { - log.error("In '" + IGUIConstants.TYPENR_FILE + "':\n type number '" + type_elem.getAttribute("number").getValue() + "' is not an integer."); + if (typeElem.getAttribute("number") == null) { + LOG.warn("In File '" + IGUIConstants.TYPENR_FILE + "': Found 'type' element without 'number'"); + } else if (typeElem.getAttribute("name") == null) { + LOG.warn("In File '" + IGUIConstants.TYPENR_FILE + "': Found 'type' element without 'name'"); + } else { + try { + // parse type number and -name, then add it to the table 'archTypeNumbers' + archTypeNumbers.put(typeElem.getAttribute("number").getIntValue(), typeElem.getAttribute("name").getValue()); + } catch (final DataConversionException de) { + LOG.error("In '" + IGUIConstants.TYPENR_FILE + "':\n type number '" + typeElem.getAttribute("number").getValue() + "' is not an integer."); + } } } - } - // loading successful - if (log.isInfoEnabled()) { - log.info("" + i + " typenumbers loaded."); + // loading successful + if (LOG.isInfoEnabled()) { + LOG.info("" + i + " typenumbers loaded."); + } } } + } catch (final IOException e) { + LOG.error("Error while reading file '" + IGUIConstants.TYPENR_FILE + "'!", e); + } finally { + reader.close(); } } catch (final JDOMException e) { - log.error("Parsing error in '" + IGUIConstants.TYPENR_FILE + "'", e); - } catch (final IOException e) { - log.error("Cannot read file '" + IGUIConstants.TYPENR_FILE + "'!"); + LOG.error("Parsing error in '" + IGUIConstants.TYPENR_FILE + "'", e); + } catch (final FileNotFoundException e) { + LOG.error("Cannot read file '" + IGUIConstants.TYPENR_FILE + "'!", e); } - if (reader != null) { - reader.close(); - } } /** @@ -141,10 +144,8 @@ * @return name of this type, as defined in "typenumbers.xml" */ public String getArchTypeName(final int index) { - final Integer tnum = new Integer(index); - - if (archTypeNumbers != null && archTypeNumbers.containsKey(tnum)) { - return (String) archTypeNumbers.get(tnum); + if (archTypeNumbers != null && archTypeNumbers.containsKey(index)) { + return archTypeNumbers.get(index); } return "*UNKNOWN" + index + "*"; // this type is unknown } @@ -157,18 +158,16 @@ public void parseDefArch(final String fname, final int index) { //Open the file for reading try { - final FileReader fr = new FileReader(fname); - final BufferedReader myInput = new BufferedReader(fr); - - // do the actual parsing - parseDefArchFromStream(myInput, index); - - myInput.close(); - fr.close(); + final BufferedReader in = new BufferedReader(new FileReader(fname)); + try { + parseDefArchFromStream(in, index); + } finally { + in.close(); + } } catch (final FileNotFoundException e) { - log.error("Archfile " + fname + " could not be found"); + LOG.error("Archfile " + fname + " could not be found"); } catch (final IOException e) { - log.error("IOException in parseDefArch!"); + LOG.error("IOException in parseDefArch!"); } } @@ -180,39 +179,39 @@ * Here we take a default arch from a filestream, parses the data and * put the result on the arch stack in CMainControl. * @param myInput <code>BufferedReader</code> file stream of arch data - * @param def_arch default arch (only for artifacts) + * @param defArch default arch (only for artifacts) * @param line first line, pre-parsed (only for artifacts) - * @param arch_name arch-object name (only for artifacts) + * @param archName arch-object name (only for artifacts) * @param index current index on the ArchPanel */ - @Nullable public ArchObject parseDefArchFromStream(final BufferedReader myInput, final ArchObject def_arch, final String line, final String arch_name, int index) { - String thisLine2; // read line, original spaces - String oldCath, newCath; // display cathegory - boolean parsearch, archmore, msgflag, animflag, loreflag, scriptflag, isNewCathegory; - int first_arch, archmore_count, x, y; - ArchObject arch; + @Nullable + public ArchObject parseDefArchFromStream(final BufferedReader myInput, final ArchObject defArch, final String line, final String archName, int index) { + String newCath; // display cathegory + int firstArch, archmoreCount; //Open the file for reading try { - msgflag = false; - loreflag = false; - animflag = false; - parsearch = false; // we try to find a arch object - archmore = false; // no arch before... - first_arch = -1; // we have no multi part/multi file monsters, this is first - archmore_count = 0; // thats part nr x of first_arch multi arch - oldCath = "<xxx>"; // old cathegory + boolean msgflag = false; + boolean loreflag = false; + boolean animflag = false; + boolean parsearch = false; + boolean archmore = false; + firstArch = -1; // we have no multi part/multi file monsters, this is first + archmoreCount = 0; // thats part nr x of first_arch multi arch + String oldCath = "<xxx>"; newCath = "no cathegory info"; // default cathegory - isNewCathegory = true; + boolean isNewCathegory = true; // start with new clean ArchObject instance - if (def_arch == null) { + ArchObject arch; + if (defArch == null) { arch = new ArchObject(); } else { - arch = def_arch.getClone(0, 0); + arch = defArch.getClone(0, 0); } arch.resetArchText(); + String thisLine2; if (line == null) { thisLine2 = myInput.readLine(); } else { @@ -231,11 +230,11 @@ if (!parsearch) { if (thisLine.regionMatches(0, "More", 0, 4)) { - if (first_arch == -1) { - first_arch = m_control.getArchCount() - 1; // if more && !-1 last was first - m_control.getArch(first_arch).setRefNr(first_arch); + if (firstArch == -1) { + firstArch = mainControl.getArchCount() - 1; // if more && !-1 last was first + mainControl.getArch(firstArch).setRefNr(firstArch); } - m_control.getArch(first_arch).setRefCount(m_control.getArch(first_arch).getRefCount() + 1); + mainControl.getArch(firstArch).setRefCount(mainControl.getArch(firstArch).getRefCount() + 1); archmore = true; } else if (thisLine.regionMatches(0, "Object", 0, 6)) { @@ -245,19 +244,19 @@ parsearch = true; if (archmore) { - archmore_count++; - if (log.isDebugEnabled()) { - log.debug("multi part object: part " + archmore_count); + archmoreCount++; + if (LOG.isDebugEnabled()) { + LOG.debug("multi part object: part " + archmoreCount); } } else { - first_arch = -1; - archmore_count = 0; + firstArch = -1; + archmoreCount = 0; } - if (arch_name == null) { + if (archName == null) { arch.setArchName(thisLine.substring(7)); } else { - arch.setArchName(arch_name); + arch.setArchName(archName); } } } else { @@ -269,7 +268,7 @@ } } else if (animflag) { if (thisLine.regionMatches(0, "mina", 0, 4)) { - m_control.getAnimationObject().addAnimObject(arch.getArchName(), arch.getAnimText()); + mainControl.getAnimationObject().addAnimObject(arch.getArchName(), arch.getAnimText()); arch.addArchText("animation " + arch.getArchName() + "\n"); // here we must add this to AnimationObject @@ -285,31 +284,31 @@ arch.addLoreText(thisLine + "\n"); } } else if (thisLine.regionMatches(0, "Object", 0, 6)) { - log.error("Find inventory Object in def arch: " + thisLine); + LOG.error("Find inventory Object in def arch: " + thisLine); } else if (thisLine.regionMatches(0, "end", 0, 3)) { //if (arch.getArchTypNr() == 0) { - if (log.isDebugEnabled()) { - log.debug("Arch " + arch.getArchName() + " has no type info!"); + if (LOG.isDebugEnabled()) { + LOG.debug("Arch " + arch.getArchName() + " has no type info!"); } //} // we got full arch parsearch = false; // we write this sucker - arch.setRefNr(first_arch); - if (first_arch != -1) { + arch.setRefNr(firstArch); + if (firstArch != -1) { // add to head our x/y position so he can setup refmax - m_control.getArch(first_arch).setRefMaxX(arch.getRefX()); - m_control.getArch(first_arch).setRefMaxY(arch.getRefY()); + mainControl.getArch(firstArch).setRefMaxX(arch.getRefX()); + mainControl.getArch(firstArch).setRefMaxY(arch.getRefY()); arch.setRefFlag(true); // mark it as ref } else { - m_control.incArchObjCount(); + mainControl.incArchObjCount(); // add arch to the archpanel - only if it is not the map arch if (!arch.getArchName().equals(STARTARCH_NAME)) { - if (!ArchObjectStack.isLoadedFromArchive() || arch_name != null) { + if (!ArchObjectStack.isLoadedFromArchive() || archName != null) { // loading from individual files, so we simply add it to list // ArchObjectStack.loadArchFromFiles() takes care of the panels - m_control.addArchPanelArch(m_control.getArchCount(), index); + mainControl.addArchPanelArch(mainControl.getArchCount(), index); } else { // loading from collected files, so we need process panels here if (isNewCathegory) { @@ -320,9 +319,9 @@ if (!oldCath.startsWith(folder)) { // an entire new panel must be opened - m_control.addArchPanel(folder); - m_control.addArchPanelCombo("show all"); - m_control.addArchPanelCombo(folder); + mainControl.addArchPanel(folder); + mainControl.addArchPanelCombo("show all"); + mainControl.addArchPanelCombo(folder); index = 1; } @@ -332,7 +331,7 @@ index = 1; // add to the base folder } else if (!oldCath.endsWith(folder)) { // a new JComboBox must be added - index = m_control.addArchPanelCombo(folder); + index = mainControl.addArchPanelCombo(folder); } } else { index = 1; // add to the base folder @@ -341,12 +340,12 @@ isNewCathegory = false; oldCath = newCath; } - m_control.addArchPanelArch(m_control.getArchCount(), index); + mainControl.addArchPanelArch(mainControl.getArchCount(), index); } } } postParseDefArch(arch); - m_control.addArchToList(arch); + mainControl.addArchToList(arch); if (IGUIConstants.isoView && archmore) { calcLowestMulti(arch); @@ -354,10 +353,10 @@ archmore = false; // we assume this is last... but perhaps.. // if this arch was from Artifacts file - return here: - if (arch_name != null) { + if (archName != null) { arch.setArtifactFlag(true); // here we add all unchanged arch text lines from def_arch back to arch - arch.addArchText(arch.diffArchText(def_arch.getArchText(), true)); + arch.addArchText(arch.diffArchText(defArch.getArchText(), true)); return arch; } arch = null; @@ -373,30 +372,30 @@ } else if (thisLine.equals("lore")) { loreflag = true; } else if (thisLine.regionMatches(0, "visibility ", 0, 11)) { - if (log.isDebugEnabled()) { - log.debug("Remove visibility: " + arch.getArchName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Remove visibility: " + arch.getArchName()); } } else if (thisLine.regionMatches(0, "magicmap ", 0, 9)) { - if (log.isDebugEnabled()) { - log.debug("Remove magicmap: " + arch.getArchName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Remove magicmap: " + arch.getArchName()); } } else if (thisLine.regionMatches(0, "color_fg ", 0, 9)) { - if (log.isDebugEnabled()) { - log.debug("Remove color_fg: " + arch.getArchName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Remove color_fg: " + arch.getArchName()); } } else if (thisLine.regionMatches(0, "color_bg ", 0, 9)) { - if (log.isDebugEnabled()) { - log.debug("Remove color_bg: " + arch.getArchName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Remove color_bg: " + arch.getArchName()); } } else if (thisLine.regionMatches(0, "x ", 0, 2)) { if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.warn("Find x cmd in single tile or head (add it to arch text): " + arch.getArchName()); + LOG.warn("Find x cmd in single tile or head (add it to arch text): " + arch.getArchName()); arch.addArchText(thisLine + "\n"); } arch.setRefX(Integer.parseInt(thisLine.substring(2))); } else if (thisLine.regionMatches(0, "y ", 0, 2)) { if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.warn("Find y cmd in single tile or head (add it to arch text): " + arch.getArchName()); + LOG.warn("Find y cmd in single tile or head (add it to arch text): " + arch.getArchName()); arch.addArchText(thisLine + "\n"); } arch.setRefY(Integer.parseInt(thisLine.substring(2))); @@ -405,13 +404,14 @@ final int i = Integer.parseInt(thisLine.substring(5)); arch.setArchTypNr(i); if (i == 0) { - log.warn("Arch " + arch.getArchName() + " type number is zero. (" + thisLine.substring(5) + ")"); + LOG.warn("Arch " + arch.getArchName() + " type number is zero. (" + thisLine.substring(5) + ")"); } } catch (final Exception e) { - log.warn("Arch " + arch.getArchName() + " has a invalid type nr. (" + thisLine.substring(5) + ")"); + LOG.warn("Arch " + arch.getArchName() + " has a invalid type nr. (" + thisLine.substring(5) + ")"); arch.addArchText(thisLine + "\n"); } } else if (thisLine.regionMatches(0, "face ", 0, 5)) { + int x; for (x = 4; x < thisLine.length(); x++) { if (thisLine.charAt(x) != ' ') { break; @@ -432,10 +432,10 @@ arch.setMultiShapeID(i); if (i <= 0 || i >= MultiPositionData.Y_DIM) { - log.warn("Arch " + arch.getArchName() + " mpart_id number is '" + thisLine.substring(9) + "'"); + LOG.warn("Arch " + arch.getArchName() + " mpart_id number is '" + thisLine.substring(9) + "'"); } } catch (final Exception e) { - log.warn("Arch " + arch.getArchName() + " has a invalid mpart_id (" + thisLine.substring(9) + ")"); + LOG.warn("Arch " + arch.getArchName() + " has a invalid mpart_id (" + thisLine.substring(9) + ")"); arch.addArchText(thisLine + "\n"); } } else if (IGUIConstants.isoView && thisLine.startsWith("mpart_nr ")) { @@ -444,21 +444,21 @@ final int i = Integer.parseInt(thisLine.substring(9).trim()); arch.setMultiPartNr(i); } catch (final Exception e) { - log.warn("Arch " + arch.getArchName() + " has a invalid mpart_nr (" + thisLine.substring(9) + ")"); + LOG.warn("Arch " + arch.getArchName() + " has a invalid mpart_nr (" + thisLine.substring(9) + ")"); arch.addArchText(thisLine + "\n"); } } else { arch.addArchText(thisLine + "\n"); } - if (log.isDebugEnabled()) { - log.debug("add String: " + thisLine); + if (LOG.isDebugEnabled()) { + LOG.debug("add String: " + thisLine); } } } thisLine2 = myInput.readLine(); } // while loop ends here } catch (final IOException e) { - log.error("Error: ", e); + LOG.error("Error: ", e); } return null; } @@ -469,8 +469,7 @@ * @param arch default arch to be parsed */ public static void postParseDefArch(final ArchObject arch) { - boolean scriptflag = false; - final String text = new String(arch.getArchText()); + final String text = arch.getArchText(); arch.resetArchText(); final int len = text.length(); @@ -479,6 +478,7 @@ arch.setArchTypNr(0); } + boolean scriptflag = false; for (int i = 0, s = 0; i < len; i++) { if (text.charAt(i) == 0x0a) { @@ -526,16 +526,16 @@ * if at save time msg-maparch == msg-default, we ignore it * in every other case (even "" text) we save * @param arch map arch to be parsed - * @param edit_type edit type(s) to be calculated for the arch + * @param editType edit type(s) to be calculated for the arch */ - public void postParseMapArch(final ArchObject arch, final int edit_type) { + public void postParseMapArch(final ArchObject arch, final int editType) { if (arch.getNodeNr() == -1) { return; } - final String text = new String(arch.getArchText()); + final String text = arch.getArchText(); final int len = text.length(); - final ArchObject defarch = m_control.getArch(arch.getNodeNr()); + final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); arch.resetArchText(); for (int i = 0, s = 0; i < len; i++) { @@ -564,19 +564,6 @@ arch.setArchTypNr(defarch.getArchTypNr()); } - // if the type is still unset, then we take the default one - if (IGUIConstants.isoView) { - if (defarch.getMultiShapeID() > 0 && arch.getMultiShapeID() == 0) { - arch.setMultiShapeID(defarch.getMultiShapeID()); - } - if (defarch.getMultiPartNr() > 0 && arch.getMultiPartNr() == 0) { - arch.setMultiPartNr(defarch.getMultiPartNr()); - } - if (defarch.isLowestPart()) { - arch.setLowestPart(true); - } - } - if (arch.isMulti() || defarch.isMulti()) { if (!arch.isMD()) { // make sure the MultiArchData is initialized arch.initMultiData(); @@ -606,8 +593,8 @@ // Finally, we calculate the desired edit_type of the arch if (arch.getRefFlag() && arch.getMapMultiHead() != null) { arch.setEditType(arch.getMapMultiHead().getEditType()); // copy from head - } else if (edit_type != 0) { - arch.setEditType(arch.calculateEditType(edit_type)); // calculate new + } else if (editType != 0) { + arch.setEditType(arch.calculateEditType(editType)); // calculate new } } @@ -620,7 +607,7 @@ * @param arch multipart head that needs tail attached */ public void expandMulti(final ArchObject arch) { - final ArchObject defarch = m_control.getArch(arch.getNodeNr()); // default arch + final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); // default arch // is it a multi head? if (arch != null && defarch != null && defarch.getRefCount() > 0 && @@ -630,27 +617,28 @@ final int count = defarch.getRefCount(); // how many parts have we got ArchObject newarch = null; // newly inserted arch ArchObject oldarch = arch; // previous arch - final ArchObject tmp_next = arch.getTemp(); // next arch on tmp list after multi + final ArchObject tmpNext = arch.getTemp(); // next arch on tmp list after multi // do insertion for all non-head parts of the multi for (int c = 1; c <= count; c++) { - newarch = m_control.getArchObjectStack().newArchObjectInstance(defarch.getNodeNr() + c); + newarch = mainControl.getArchObjectStack().newArchObjectInstance(defarch.getNodeNr() + c); + assert newarch != null; newarch.setMapMultiHead(arch); // set link to multi head oldarch.setMapMultiNext(newarch); // set link between multi arches oldarch.setTemp(newarch); // attach to temp list // set map position (x, y) - newarch.setMapX(arch.getMapX() + m_control.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefX()); - newarch.setMapY(arch.getMapY() + m_control.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefY()); + newarch.setMapX(arch.getMapX() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefX()); + newarch.setMapY(arch.getMapY() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefY()); oldarch = newarch; // next loop oldarch = current newarch // now attach the default arch and stuff // (don't need edit type as we copy from head) - m_control.getArchObjectParser().postParseMapArch(newarch, 0); + mainControl.getArchObjectParser().postParseMapArch(newarch, 0); } - newarch.setTemp(tmp_next); // re-attach the the last multi to the tmp list + newarch.setTemp(tmpNext); // re-attach the the last multi to the tmp list } } @@ -664,43 +652,42 @@ * arch. Therefore, the new start arch is returned. */ public ArchObject sortTempList(ArchObject start) { - ArchObject last_before = null; // the last arch on the list (before sorting) + ArchObject lastBefore = null; // the last arch on the list (before sorting) ArchObject last = null; // the very last arch on the list - ArchObject new_start = null; // return value: new start arch of list - boolean found_multi = false; // true when multi found (see below) - boolean order_wrong = false; // is the order correct or not? + boolean foundMulti = false; // true when multi found (see below) + boolean orderWrong = false; // is the order correct or not? // First we cycle through the whole list and check if the // order is already correct or not (only Crossedit saves in wrong order). // This takes practically no time and assures we don't waste any. for (ArchObject tmp = start; tmp != null; tmp = tmp.getTemp()) { - if (!found_multi && tmp.isMulti()) { - found_multi = true; // first multi appeared - } else if (found_multi && !tmp.isMulti() && + if (!foundMulti && tmp.isMulti()) { + foundMulti = true; // first multi appeared + } else if (foundMulti && !tmp.isMulti() && (tmp.getContainer() == null || !tmp.getTopContainer().isMulti())) { - order_wrong = true; // order is wrong (found non-multi after multi) + orderWrong = true; // order is wrong (found non-multi after multi) } if (tmp.getTemp() == null) { - last_before = last = tmp; + lastBefore = last = tmp; } } // if the last arch is a multi, it must be the head, not the tail - if (last_before.getRefFlag() && last_before.getMapMultiHead() != null) { - last_before = last_before.getMapMultiHead(); + if (lastBefore.getRefFlag() && lastBefore.getMapMultiHead() != null) { + lastBefore = lastBefore.getMapMultiHead(); } - if (order_wrong) { + if (orderWrong) { // The order is wrong, so we gotta correct it now - ArchObject previous = null; // previous arch in loop - boolean increment = true; // if true, do increment after loop - if (log.isInfoEnabled()) { - log.info("Resorted multipart arches."); + if (LOG.isInfoEnabled()) { + LOG.info("Resorted multipart arches."); } - for (ArchObject tmp = start; tmp != null && tmp != last_before;) { + ArchObject previous = null; + boolean increment = true; + for (ArchObject tmp = start; tmp != null && tmp != lastBefore;) { if (tmp.getRefCount() > 0 && tmp.getMapMultiNext() != null) { // Got a multi head - Now we move his ass to the end of the list: last.setTemp(tmp); // attach the head to the end @@ -733,7 +720,7 @@ // make sure we don't ever get into an infinite loop if (tmp != null && tmp.getTemp() == tmp) { - log.warn("sortTempList: Arch '" + tmp.getArchName() + "' pointing on itself!"); + LOG.warn("sortTempList: Arch '" + tmp.getArchName() + "' pointing on itself!"); tmp = null; // exit the loop } } @@ -766,7 +753,7 @@ } // get next multipart piece - tmp = m_control.getArch(tmp.getNodeNr() - 1); + tmp = mainControl.getArch(tmp.getNodeNr() - 1); count++; } t = MultiPositionData.getYOffset(tmp.getMultiShapeID(), tmp.getMultiPartNr()); @@ -778,7 +765,8 @@ for (int i = 0; count >= 0; count--, i++) { t = MultiPositionData.getYOffset(tmp.getMultiShapeID(), tmp.getMultiPartNr()); tmp.setLowestPart(t <= minYOffset); - tmp = m_control.getArch(tmp.getNodeNr() + 1); + tmp = mainControl.getArch(tmp.getNodeNr() + 1); } } -} + +} // class ArchObjectParser Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-03 20:49:09 UTC (rev 120) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-03 22:00:45 UTC (rev 121) @@ -35,30 +35,27 @@ import cfeditor.CSettings; import cfeditor.FaceObject; import cfeditor.IGUIConstants; -import cfeditor.arch.anim.AnimationObject; -import cfeditor.arch.anim.AnimationObjects; import java.awt.Color; import java.awt.GridLayout; import java.io.BufferedOutputStream; import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.ByteArrayInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; import java.util.Date; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; +import javax.swing.SwingConstants; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -69,7 +66,7 @@ */ public final class ArchObjectStack { - private static final Logger log = Logger.getLogger(ArchObjectStack.class); + private static final Logger LOG = Logger.getLogger(ArchObjectStack.class); // load status: is archstack fully loaded? public static final int IS_EMPTY = 0; @@ -78,17 +75,14 @@ public static final int IS_COMPLETE = 2; - private static int load_status = IS_EMPTY; + private static int loadStatus = IS_EMPTY; /** * true when arches were loaded from the big collected archive files, * false when arches were loaded from individual archfiles */ - private static boolean load_from_archive = false; + private static boolean loadFromArchive = false; - /** Used to exclude our artifact arches from counts. */ - private static int artifact_count = 0; - // this is the static part.. i want fast access later private final ArchObjectNode[] archNodeList = new ArchObjectNode[10000]; @@ -97,9 +91,9 @@ // The hash tables hold the name and the index for the field // if one can show me, that storing and accessing names AND objects // in the table is faster than in the static arrays, we can change this - private static final Hashtable faceHashTable = new Hashtable(); + private static final Map<String, Integer> faceMap = new HashMap<String, Integer>(); - private static final Hashtable archHashTable = new Hashtable(); + private static final Map<String, Integer> archMap = new HashMap<String, Integer>(); private int archNodeListCount; // ALL default arches loaded @@ -107,12 +101,12 @@ private int faceListCount; // all loaded face pictures - private final CMainControl m_control; + private final CMainControl mainControl; - private int folder_level; + private int folderLevel; public ArchObjectStack(final CMainControl control) { - m_control = control; + mainControl = control; archNodeListCount = 0; faceListCount = 0; archObjCount = 0; @@ -128,19 +122,29 @@ } public static int getLoadStatus() { - return load_status; + return loadStatus; } public static boolean isLoadedFromArchive() { - return load_from_archive; + return loadFromArchive; } - public Hashtable getFaceHashTable() { - return faceHashTable; + /** Returns the index of a face in the face map or -1. + * @param faceName name of face to get index for + * @return index of face in map or -1 if face is not in map + * @deprecated the index system is slow and unmaintainable and therefore will be removed + */ + @Deprecated public static int getFaceIndex(final String faceName) { + return faceMap.containsKey(faceName) ? faceMap.get(faceName) : -1; } - public Hashtable getArchHashTable() { - return archHashTable; + /** Returns the index of an arch in the arch map or -1. + * @param archName name of arch to get index for + * @return index of arch in map or -1 if arch is not in map + * @deprecated the index system is slow and unmaintainable and therefore will be removed + */ + @Deprecated public static int getArchIndex(final String archName) { + return archMap.containsKey(archName) ? archMap.get(archName) : -1; } @Nullable public ImageIcon getFace(final int i) { @@ -194,7 +198,7 @@ } final ArchObject arch = new ArchObject(); - arch.setArchName(new String(archNodeList[i].arch.getArchName())); + arch.setArchName(archNodeList[i].arch.getArchName()); if (!archNodeList[i].arch.getFaceFlag()) { arch.setFaceNr(archNodeList[i].arch.getFaceNr()); } @@ -207,60 +211,55 @@ public void addArchToList(final ArchObject data) { final ArchObjectNode newnode = new ArchObjectNode(data); newnode.arch.setNodeNr(archNodeListCount); - archHashTable.put(data.getArchName(), new Integer(archNodeListCount)); + archMap.put(data.getArchName(), archNodeListCount); archNodeList[archNodeListCount++] = newnode; } /** load the arches */ public void loadArches() { - final Date time_start = new Date(); // get starting time - load_status = IS_LOADING; // status: loading - log.info("Start to collect arches..."); + final Date timeStart = new Date(); // get starting time + loadStatus = IS_LOADING; // status: loading + LOG.info("Start to collect arches..."); CMainStatusbar.getInstance().setText(" Loading Arches... "); // browse arch archive // load object from a arch file you found - final File f = new File(m_control.getArchDefaultFolder()); - folder_level = 0; - m_control.disableTabPane(); + final File f = new File(mainControl.getArchDefaultFolder()); + folderLevel = 0; + mainControl.disableTabPane(); // here we go... - if (m_control.isArchLoadedFromCollection()) { + if (mainControl.isArchLoadedFromCollection()) { loadArchFromCollected(); // collect arches & images from collection } else { loadArchFromFiles(f, 0); // collect arches & images from individual files } - // at this time only use Daimonin artifacts file in this way - if (IGUIConstants.isoView) { - loadArchesFromArtifacts(m_control.getArchDefaultFolder() + File.separator + IGUIConstants.ARTIFACTS_FILE); - } - CMainStatusbar.getInstance().setText(" Sorting..."); connectFaces(); // attach faces to arches - m_control.enableTabPane(); - m_control.getMainView().finishArchPanelBuildProccess(); + mainControl.enableTabPane(); + mainControl.getMainView().finishArchPanelBuildProccess(); System.gc(); // load the autojoin lists CMainStatusbar.getInstance().setText(" Loading Autojoin Tables..."); - m_control.loadJoinlist(); + mainControl.loadJoinlist(); CMainStatusbar.getInstance().setText(" Ready."); // print message if no arches were found if (getArchCount() == 0) { - load_status = IS_EMPTY; // status: stack is empty - m_control.showMessage("No Archfiles", "No archfiles could be found. If you have no archfiles\n" + + loadStatus = IS_EMPTY; // status: stack is empty + mainControl.showMessage("No Archfiles", "No archfiles could be found. If you have no archfiles\n" + "yet, you need to download them. If you do, make sure\n" + "the path is correct under menu 'File->Options'.\n"); } else { // display the time it took to collect arches: - load_status = IS_COMPLETE; // status: stack completed - final Date time_finish = new Date(); // get finishing time - final long diff = time_finish.getTime() - time_start.getTime(); - if (log.isInfoEnabled()) { - log.info("Arch collect took " + diff / 1000. + " Seconds"); + loadStatus = IS_COMPLETE; // status: stack completed + final Date timeFinish = new Date(); // get finishing time + final long diff = timeFinish.getTime() - timeStart.getTime(); + if (LOG.isInfoEnabled()) { + LOG.info("Arch collect took " + diff / 1000. + " Seconds"); } // load pickmaps @@ -272,103 +271,26 @@ } /** - * Load "pseudo arches" from file "artifacts" - * WARNING: Don't include multi arches in the artifacts file - * This code can't handle it nor the real server - */ - private void loadArchesFromArtifacts(final String fname) { - int line_count = 0; - Integer index; - ArchObject arch, def_arch; - String thisLine, name = "", def_arch_name = "", obj_title = ""; - m_control.addArchPanel("Artifacts"); - m_control.addArchPanelCombo("show all"); - - //Open the file for reading - try { - final FileReader fr = new FileReader(fname); - final BufferedReader myInput = new BufferedReader(fr); - - // do the actual parsing - //parseDefArchFromStream(myInput, 0); - while ((thisLine = myInput.readLine()) != null) { - line_count++; - thisLine = thisLine.trim(); - - // ignore white space lines or '#' comment lines - if (!thisLine.regionMatches(0, "#", 0, 1) && thisLine.length() != 0) { - if (thisLine.regionMatches(0, "name ", 0, 5)) { - name = thisLine.substring(5); - } - - if (thisLine.regionMatches(0, "def_arch ", 0, 9)) { - def_arch_name = thisLine.substring(9); - } - - if (thisLine.regionMatches(0, "Object", 0, 6)) { - obj_title = ""; - if (thisLine.length() > 7) { - obj_title = thisLine.substring(7); - } - - // at this point we MUST have a legal name and def arch - index = null; - if (def_arch_name.length() > 0) { - index = (Integer) getArchHashTable().get(def_arch_name); - } - - if (name.length() == 0 || def_arch_name.length() == 0 || index == null) { - log.warn("Artifacts file: Line " + line_count + " Object >" + obj_title + "< has missing name or def_arch"); - } else { // the next line of our file is part of a arch parse until a "end" comes - // first get our base arch - def_arch = getArch(index.intValue()); - // now the ... [truncated message content] |
From: <chr...@us...> - 2006-06-03 22:22:29
|
Revision: 122 Author: christianhujer Date: 2006-06-03 15:08:41 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=122&view=rev Log Message: ----------- Moved unified CGridderException to gridarta. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/MapTilePane.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/CGridderException.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CGridderException.java trunk/daimonin/src/daieditor/CGridderException.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-03 22:08:41 UTC (rev 122) @@ -27,6 +27,7 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-03 22:08:41 UTC (rev 122) @@ -27,6 +27,7 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; Deleted: trunk/crossfire/src/cfeditor/CGridderException.java =================================================================== --- trunk/crossfire/src/cfeditor/CGridderException.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CGridderException.java 2006-06-03 22:08:41 UTC (rev 122) @@ -1,71 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -/** - * <code>CGridderException</code> class that is used to transfer error messages - * and other error information inside the Gridder application. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @deprecated this exception has no semantic value and therefore should be removed - */ -@Deprecated public final class CGridderException extends Exception { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The originator of the error. */ - private final Object originator; - - /** - * Create a CGridderException. - * @param msg message - */ - public CGridderException(final String msg) { - this(msg, null); - } - - /** - * Create a CGridderException. - * @param msg Message - * @param originator Originator - */ - public CGridderException(final String msg, final Object originator) { - super(msg); - this.originator = originator; - } - - /** - * Returns the originator of the error. - * @return the originator of the error. - */ - public String getOriginator() { - if (originator != null) { - return originator.getClass().getName(); - } - - return "unknown"; - } - -} // class CGridderException Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-03 22:08:41 UTC (rev 122) @@ -53,6 +53,7 @@ import org.jetbrains.annotations.Nullable; import net.sf.japi.util.filter.file.EndingFileFilter; import net.sf.japi.swing.ActionFactory; +import net.sf.gridarta.CGridderException; /** * The main controller of the level editor. Basically the main application. Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-03 22:08:41 UTC (rev 122) @@ -26,6 +26,7 @@ import cfeditor.arch.ArchObject; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-03 22:08:41 UTC (rev 122) @@ -31,6 +31,7 @@ import java.awt.Point; import java.io.File; import java.util.Iterator; +import net.sf.gridarta.CGridderException; /** * The <code>CMapControl</code> Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-03 22:08:41 UTC (rev 122) @@ -31,6 +31,7 @@ import java.io.IOException; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.CGridderException; /** * This class handles the reading of a mapfile and parsing the data Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-03 22:08:41 UTC (rev 122) @@ -51,6 +51,7 @@ import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; /** * Dialog used to ask the user the properties for the new level. Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-03 22:08:41 UTC (rev 122) @@ -34,6 +34,7 @@ import javax.swing.event.ChangeListener; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.CGridderException; /** * The <code>CPickmapPanel</code> manages the pickmap panel Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-03 22:08:41 UTC (rev 122) @@ -45,6 +45,7 @@ import daieditor.arch.NamedObject; import daieditor.arch.NamedObjects; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-03 22:08:41 UTC (rev 122) @@ -27,6 +27,7 @@ import static daieditor.CGUIUtils.getSysIcon; import daieditor.arch.ArchObject; import net.sf.gridarta.help.Help; +import net.sf.gridarta.CGridderException; import java.awt.BorderLayout; import static java.awt.Color.gray; import java.awt.Component; @@ -666,7 +667,7 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws CGridderException when user selected an invalid treasurelist (e.g. a god-list) + * @throws net.sf.gridarta.CGridderException when user selected an invalid treasurelist (e.g. a god-list) */ @Nullable private String getSelectedTreasureList() throws CGridderException { // return null when nothing is selected Deleted: trunk/daimonin/src/daieditor/CGridderException.java =================================================================== --- trunk/daimonin/src/daieditor/CGridderException.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CGridderException.java 2006-06-03 22:08:41 UTC (rev 122) @@ -1,71 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package daieditor; - -/** - * <code>CGridderException</code> class that is used to transfer error messages - * and other error information inside the Gridder application. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @deprecated this exception has no semantic value and therefore should be removed - */ -@Deprecated public final class CGridderException extends Exception { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The originator of the error. */ - private final Object originator; - - /** - * Create a CGridderException. - * @param msg message - */ - public CGridderException(final String msg) { - this(msg, null); - } - - /** - * Create a CGridderException. - * @param msg Message - * @param originator Originator - */ - public CGridderException(final String msg, final Object originator) { - super(msg); - this.originator = originator; - } - - /** - * Returns the originator of the error. - * @return the originator of the error. - */ - public String getOriginator() { - if (originator != null) { - return originator.getClass().getName(); - } - - return "unknown"; - } - -} // class CGridderException Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-03 22:08:41 UTC (rev 122) @@ -37,6 +37,7 @@ import daieditor.arch.match.MutableOrArchObjectMatcher; import daieditor.arch.match.ViewArchObjectMatcherManager; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.CGridderException; import daieditor.gui.MapFileFilter; import daieditor.gui.map.MapCursorControl; import daieditor.gui.map.MapPreviewAccessory; Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-03 22:08:41 UTC (rev 122) @@ -35,6 +35,7 @@ import java.util.ArrayList; import java.util.List; import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.CGridderException; /** * This class handles the reading of a mapfile and parsing the data @@ -67,7 +68,7 @@ * @param file mapfile * @param mapDir map directory * @return first <code>ArchObject</code> in the list - * @throws CGridderException when file content invalid + * @throws net.sf.gridarta.CGridderException when file content invalid * @todo remove mainControl param and replace with mapDir param */ public synchronized List<ArchObject> decodeMapFile(final File file, final String mapDir) throws CGridderException, FileNotFoundException, IOException { Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-03 22:08:41 UTC (rev 122) @@ -38,6 +38,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; +import net.sf.gridarta.CGridderException; /** * The <code>CPickmapPanel</code> manages the pickmap panel Modified: trunk/daimonin/src/daieditor/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-03 22:00:45 UTC (rev 121) +++ trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-03 22:08:41 UTC (rev 122) @@ -56,6 +56,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; +import net.sf.gridarta.CGridderException; import org.jetbrains.annotations.Nullable; /** Copied: trunk/src/app/net/sf/gridarta/CGridderException.java (from rev 121, trunk/crossfire/src/cfeditor/CGridderException.java) =================================================================== --- trunk/src/app/net/sf/gridarta/CGridderException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/CGridderException.java 2006-06-03 22:08:41 UTC (rev 122) @@ -0,0 +1,71 @@ +/* + * Crossfire Java Editor. + * Copyright (C) 2000 Michael Toennies + * Copyright (C) 2001 Andreas Vogl + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta; + +/** + * <code>CGridderException</code> class that is used to transfer error messages + * and other error information inside the Gridder application. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @deprecated this exception has no semantic value and therefore should be removed + */ +@Deprecated public final class CGridderException extends Exception { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The originator of the error. */ + private final Object originator; + + /** + * Create a CGridderException. + * @param msg message + */ + public CGridderException(final String msg) { + this(msg, null); + } + + /** + * Create a CGridderException. + * @param msg Message + * @param originator Originator + */ + public CGridderException(final String msg, final Object originator) { + super(msg); + this.originator = originator; + } + + /** + * Returns the originator of the error. + * @return the originator of the error. + */ + public String getOriginator() { + if (originator != null) { + return originator.getClass().getName(); + } + + return "unknown"; + } + +} // class CGridderException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 20:49:25
|
Revision: 120 Author: christianhujer Date: 2006-06-03 13:49:09 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=120&view=rev Log Message: ----------- Fixed bogus whitespace normalization. Modified Paths: -------------- trunk/src/doc/cleanupXhtml11.xslt Modified: trunk/src/doc/cleanupXhtml11.xslt =================================================================== --- trunk/src/doc/cleanupXhtml11.xslt 2006-06-03 20:42:31 UTC (rev 119) +++ trunk/src/doc/cleanupXhtml11.xslt 2006-06-03 20:49:09 UTC (rev 120) @@ -80,7 +80,7 @@ <!--<xsl:template match="@xmlns:*"/>--> <xsl:template match="text()"> - <xsl:value-of select="helper:normalize(xs:string(.), preceding-sibling::node()[1], following-sibling::node()[1], parent::node())"/> + <xsl:value-of select="helper:normalize(.)"/> <!--xsl:choose> <xsl:when test=". = ' '"><xsl:text> </xsl:text></xsl:when> <xsl:otherwise> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 20:44:56
|
Revision: 119 Author: christianhujer Date: 2006-06-03 13:42:31 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=119&view=rev Log Message: ----------- Added screenshots Added Paths: ----------- trunk/src/screenshots/ trunk/src/screenshots/README trunk/src/screenshots/gridarta4crossfire1-FM.png trunk/src/screenshots/gridarta4crossfire1-SF.jpg trunk/src/screenshots/gridarta4crossfire1-gimp.png trunk/src/screenshots/gridarta4crossfire1-orig.png trunk/src/screenshots/gridarta4daimonin1-FM.png trunk/src/screenshots/gridarta4daimonin1-SF.jpg trunk/src/screenshots/gridarta4daimonin1-gimp.png trunk/src/screenshots/gridarta4daimonin1-orig.png Property changes on: trunk/src/screenshots ___________________________________________________________________ Name: svn:ignore + .xvpics Added: trunk/src/screenshots/README =================================================================== --- trunk/src/screenshots/README (rev 0) +++ trunk/src/screenshots/README 2006-06-03 20:42:31 UTC (rev 119) @@ -0,0 +1,11 @@ +On Screenshots +============== + +To be really useful, please create screenshots in 1280x960 without window borders. +(If your OS / window manager doesn't support this, get yourself something better!) + +Either yourself or somebody else should create the following versions: +* screeniename-orig.png Original version as saved by screenshot tool (e.g. ksnapshot) +* screeniename-gimp.png After saving it with gimp as progressive PNG with compression level 9 +* screeniename-FM.png Scaled to 800x600 progressive compression 9 PNG +* screeniename-SF.jpg Scaled to 640x480 progressige compression 75% JPEG Property changes on: trunk/src/screenshots/README ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/screenshots/gridarta4crossfire1-FM.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4crossfire1-FM.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/src/screenshots/gridarta4crossfire1-SF.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4crossfire1-SF.jpg ___________________________________________________________________ Name: svn:mime-type + image/jpeg Added: trunk/src/screenshots/gridarta4crossfire1-gimp.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4crossfire1-gimp.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/src/screenshots/gridarta4crossfire1-orig.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4crossfire1-orig.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/src/screenshots/gridarta4daimonin1-FM.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4daimonin1-FM.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/src/screenshots/gridarta4daimonin1-SF.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4daimonin1-SF.jpg ___________________________________________________________________ Name: svn:mime-type + image/jpeg Added: trunk/src/screenshots/gridarta4daimonin1-gimp.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4daimonin1-gimp.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/src/screenshots/gridarta4daimonin1-orig.png =================================================================== (Binary files differ) Property changes on: trunk/src/screenshots/gridarta4daimonin1-orig.png ___________________________________________________________________ Name: svn:mime-type + image/png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 20:40:07
|
Revision: 118 Author: christianhujer Date: 2006-06-03 13:39:56 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=118&view=rev Log Message: ----------- Improved codestyle documentation. Modified Paths: -------------- trunk/src/doc/dev/codeStyle.xhtml Added Paths: ----------- trunk/src/doc/dev/SafeCopy.java Property Changed: ---------------- trunk/src/doc/dev/ Property changes on: trunk/src/doc/dev ___________________________________________________________________ Name: svn:ignore - changelog.xhtml changelog.xml + changelog.xhtml changelog.xml *.java.xhtml *.class Added: trunk/src/doc/dev/SafeCopy.java =================================================================== --- trunk/src/doc/dev/SafeCopy.java (rev 0) +++ trunk/src/doc/dev/SafeCopy.java 2006-06-03 20:39:56 UTC (rev 118) @@ -0,0 +1,28 @@ +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class SafeCopy { + public static void main(final String... args) { + try { + final InputStream in = new FileInputStream(args[0]); + try { + final OutputStream out = new FileOutputStream(args[1]); + try { + final byte[] buf = new byte[4096]; + for (int bytesRead; (bytesRead = in.read(buf)) != -1;) { + out.write(buf, 0, bytesRead); + } + } finally { + out.close(); + } + } finally { + in.close(); + } + } catch (final IOException e) { + System.err.println(e); + } + } +} Property changes on: trunk/src/doc/dev/SafeCopy.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2006-06-03 16:58:35 UTC (rev 117) +++ trunk/src/doc/dev/codeStyle.xhtml 2006-06-03 20:39:56 UTC (rev 118) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<!DOCTYPE html PUBLIC "-//JAPI//DTD XHTML 1.1 + XInclude 1.0//EN" "../dtd/xhtml11_xinclude10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> @@ -16,15 +16,45 @@ <p> Additionally, the following set of rules applies: </p> + <h2>Small Rules</h2> + <p> + ("small" in the sense how long it takes to describe them, not in their importance!) + </p> <ul> <li>Imports are sorted alphabetically by package, within a package alphabetically by class.</li> <li>The *-form of import is not allowed.</li> <li>Use inline comments rarely. If you have to use inline comments to explain what code does, something is wrong with the code.</li> - <li> - Field initialization with the automatic default value is only allowed if the automatic default value carries semantics that are used later. - In all other circumstances, which means in most cases, fields must not be initialized with the automatic default value. - (The automatic default value is <code>null</code>, zero (any mutations of <code>0</code> resp. <code>0.0</code>) or <code>false</code>.) - </li> </ul> + <h2>Field Initialization</h2> + <p> + Field initialization with the automatic default value is only allowed if the automatic default value carries semantics that are used later. + In all other circumstances, which means in most cases, fields must not be initialized with the automatic default value. + (The automatic default value is <code>null</code>, zero (any mutations of <code>0</code> resp. <code>0.0</code>) or <code>false</code>.) + </p> + <h2>Stream I/O Handling</h2> + <p> + The following example code shows how streams should be opened / closed: + </p> + <pre class="listing"><xi:include href="SafeCopy.java.xhtml" xpointer="/1/2/1/1" /></pre> + <p> + Rationale: + </p> + <ul> + <li>The stream references needn't be nulled because they loose scope instantly after being closed.</li> + <li>The stream references can't be null.</li> + <li>The stream references can be declared final.</li> + <li>Compared with these features, the code is relatively short.</li> + <li>The disadvantage of nesting tries is only really an issue for more than two streams, which is a really rare case.</li> + </ul> + <p> + The single catch for multiple streams is okay because the following cases can happen: + </p> + <ul> + <li>work okay, stream open, close okay - good.</li> + <li>work okay, stream open, close exception - interested in close exception.</li> + <li>work exception, stream open, close okay - interested in work exception.</li> + <li>work exception, stream closed, close won't throw an exception (API spec) - interested in work exception.</li> + <li>work exception, stream undefined, close exception - close exception is probably as good as work exception.</li> + </ul> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-03 16:58:47
|
Revision: 117 Author: akirschbaum Date: 2006-06-03 09:58:35 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=117&view=rev Log Message: ----------- Add final where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-03 16:21:36 UTC (rev 116) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-03 16:58:35 UTC (rev 117) @@ -49,7 +49,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ArchObjectParser { +public final class ArchObjectParser { private static final Logger log = Logger.getLogger(ArchObjectParser.class); @@ -65,7 +65,7 @@ * Constructor * @param control main control */ - public ArchObjectParser(CMainControl control) { + public ArchObjectParser(final CMainControl control) { m_control = control; archTypeNumbers = null; } @@ -81,29 +81,28 @@ try { // open reading stream to the spells xml file - String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); reader = new CFileReader(baseDir, IGUIConstants.TYPENR_FILE); // parse xml document - SAXBuilder builder = new SAXBuilder(); + final SAXBuilder builder = new SAXBuilder(); builder.setValidation(true); - Document doc = builder.build(reader.getReader()); + final Document doc = builder.build(reader.getReader()); // retrieve the spell data from the xml - Element root = doc.getRootElement(); - Element type_elem; - Attribute a; + final Element root = doc.getRootElement(); + final Attribute a; if (root == null || !root.getName().equalsIgnoreCase("typenumbers")) { log.warn("File '" + IGUIConstants.TYPENR_FILE + "' lacks root element 'typenumbers'."); } else { - List types = root.getChildren("type"); + final List types = root.getChildren("type"); if (types == null || types.size() == 0) { log.warn("File '" + IGUIConstants.TYPENR_FILE + "' has no content."); } else { // process all 'type' elements from the xml file int i; for (i = 0; i < types.size(); i++) { - type_elem = (Element) types.get(i); + final Element type_elem = (Element) types.get(i); if (type_elem.getAttribute("number") == null) { log.warn("In File '" + IGUIConstants.TYPENR_FILE + "': Found 'type' element without 'number'"); @@ -112,9 +111,9 @@ } else { try { // parse type number and -name, then add it to the table 'archTypeNumbers' - Integer typenum = new Integer(type_elem.getAttribute("number").getIntValue()); + final Integer typenum = new Integer(type_elem.getAttribute("number").getIntValue()); archTypeNumbers.put(typenum, type_elem.getAttribute("name").getValue()); - } catch (DataConversionException de) { + } catch (final DataConversionException de) { log.error("In '" + IGUIConstants.TYPENR_FILE + "':\n type number '" + type_elem.getAttribute("number").getValue() + "' is not an integer."); } } @@ -126,9 +125,9 @@ } } } - } catch (JDOMException e) { + } catch (final JDOMException e) { log.error("Parsing error in '" + IGUIConstants.TYPENR_FILE + "'", e); - } catch (IOException e) { + } catch (final IOException e) { log.error("Cannot read file '" + IGUIConstants.TYPENR_FILE + "'!"); } if (reader != null) { @@ -141,8 +140,8 @@ * @param index type number * @return name of this type, as defined in "typenumbers.xml" */ - public String getArchTypeName(int index) { - Integer tnum = new Integer(index); + public String getArchTypeName(final int index) { + final Integer tnum = new Integer(index); if (archTypeNumbers != null && archTypeNumbers.containsKey(tnum)) { return (String) archTypeNumbers.get(tnum); @@ -155,25 +154,25 @@ * @param fname filename of the arch definition file (*.arc) * @param index current subdirectory-index on the ArchPanel (-> ComboBoxes) */ - public void parseDefArch(String fname, int index) { + public void parseDefArch(final String fname, final int index) { //Open the file for reading try { - FileReader fr = new FileReader(fname); - BufferedReader myInput = new BufferedReader(fr); + final FileReader fr = new FileReader(fname); + final BufferedReader myInput = new BufferedReader(fr); // do the actual parsing parseDefArchFromStream(myInput, index); myInput.close(); fr.close(); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.error("Archfile " + fname + " could not be found"); - } catch (IOException e) { + } catch (final IOException e) { log.error("IOException in parseDefArch!"); } } - public void parseDefArchFromStream(BufferedReader myInput, int index) { + public void parseDefArchFromStream(final BufferedReader myInput, final int index) { parseDefArchFromStream(myInput, null, null, null, index); } @@ -186,8 +185,7 @@ * @param arch_name arch-object name (only for artifacts) * @param index current index on the ArchPanel */ - @Nullable public ArchObject parseDefArchFromStream(BufferedReader myInput, ArchObject def_arch, String line, String arch_name, int index) { - String thisLine; // read line with trimmed spaces + @Nullable public ArchObject parseDefArchFromStream(final BufferedReader myInput, final ArchObject def_arch, final String line, final String arch_name, int index) { String thisLine2; // read line, original spaces String oldCath, newCath; // display cathegory boolean parsearch, archmore, msgflag, animflag, loreflag, scriptflag, isNewCathegory; @@ -222,7 +220,7 @@ } while (thisLine2 != null) { - thisLine = thisLine2.trim(); + final String thisLine = thisLine2.trim(); if (thisLine.regionMatches(0, "#", 0, 1)) { // skip comments @@ -404,12 +402,12 @@ arch.setRefY(Integer.parseInt(thisLine.substring(2))); } else if (thisLine.regionMatches(0, "type ", 0, 5)) { try { - int i = Integer.parseInt(thisLine.substring(5)); + final int i = Integer.parseInt(thisLine.substring(5)); arch.setArchTypNr(i); if (i == 0) { log.warn("Arch " + arch.getArchName() + " type number is zero. (" + thisLine.substring(5) + ")"); } - } catch (Exception e) { + } catch (final Exception e) { log.warn("Arch " + arch.getArchName() + " has a invalid type nr. (" + thisLine.substring(5) + ")"); arch.addArchText(thisLine + "\n"); } @@ -430,22 +428,22 @@ } else if (IGUIConstants.isoView && thisLine.startsWith("mpart_id ")) { // shape ID for multiparts try { - int i = Integer.parseInt(thisLine.substring(9).trim()); + final int i = Integer.parseInt(thisLine.substring(9).trim()); arch.setMultiShapeID(i); if (i <= 0 || i >= MultiPositionData.Y_DIM) { log.warn("Arch " + arch.getArchName() + " mpart_id number is '" + thisLine.substring(9) + "'"); } - } catch (Exception e) { + } catch (final Exception e) { log.warn("Arch " + arch.getArchName() + " has a invalid mpart_id (" + thisLine.substring(9) + ")"); arch.addArchText(thisLine + "\n"); } } else if (IGUIConstants.isoView && thisLine.startsWith("mpart_nr ")) { // part nr for multiparts try { - int i = Integer.parseInt(thisLine.substring(9).trim()); + final int i = Integer.parseInt(thisLine.substring(9).trim()); arch.setMultiPartNr(i); - } catch (Exception e) { + } catch (final Exception e) { log.warn("Arch " + arch.getArchName() + " has a invalid mpart_nr (" + thisLine.substring(9) + ")"); arch.addArchText(thisLine + "\n"); } @@ -459,7 +457,7 @@ } thisLine2 = myInput.readLine(); } // while loop ends here - } catch (IOException e) { + } catch (final IOException e) { log.error("Error: ", e); } return null; @@ -470,11 +468,11 @@ * cut off from load parsing * @param arch default arch to be parsed */ - public void postParseDefArch(ArchObject arch) { + public static void postParseDefArch(final ArchObject arch) { boolean scriptflag = false; - String text = new String(arch.getArchText()); + final String text = new String(arch.getArchText()); arch.resetArchText(); - int len = text.length(); + final int len = text.length(); // if no type was set, zero is taken if (arch.getArchTypNr() == ArchObject.TYPE_UNSET) { @@ -530,14 +528,14 @@ * @param arch map arch to be parsed * @param edit_type edit type(s) to be calculated for the arch */ - public void postParseMapArch(ArchObject arch, int edit_type) { + public void postParseMapArch(final ArchObject arch, final int edit_type) { if (arch.getNodeNr() == -1) { return; } - String text = new String(arch.getArchText()); - int len = text.length(); - ArchObject defarch = m_control.getArch(arch.getNodeNr()); + final String text = new String(arch.getArchText()); + final int len = text.length(); + final ArchObject defarch = m_control.getArch(arch.getNodeNr()); arch.resetArchText(); for (int i = 0, s = 0; i < len; i++) { @@ -621,18 +619,18 @@ * The ArchObjectStack should be fully initialized at this point. * @param arch multipart head that needs tail attached */ - public void expandMulti(ArchObject arch) { - ArchObject defarch = m_control.getArch(arch.getNodeNr()); // default arch + public void expandMulti(final ArchObject arch) { + final ArchObject defarch = m_control.getArch(arch.getNodeNr()); // default arch // is it a multi head? if (arch != null && defarch != null && defarch.getRefCount() > 0 && arch.getMapMultiNext() == null && arch.getMapMultiHead() == null) { // we have a multi head and need to insert his tail now - int count = defarch.getRefCount(); // how many parts have we got + final int count = defarch.getRefCount(); // how many parts have we got ArchObject newarch = null; // newly inserted arch ArchObject oldarch = arch; // previous arch - ArchObject tmp_next = arch.getTemp(); // next arch on tmp list after multi + final ArchObject tmp_next = arch.getTemp(); // next arch on tmp list after multi // do insertion for all non-head parts of the multi for (int c = 1; c <= count; c++) { @@ -754,7 +752,7 @@ * better if it was called only once per multipart.) * @param arch last tail part of this multi */ - private void calcLowestMulti(ArchObject arch) { + private void calcLowestMulti(final ArchObject arch) { ArchObject tmp = arch; int minYOffset = 10000; // minimal offset int count = 0; // count number of tiles Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-03 16:21:36 UTC (rev 116) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-03 16:58:35 UTC (rev 117) @@ -67,7 +67,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ArchObjectStack { +public final class ArchObjectStack { private static final Logger log = Logger.getLogger(ArchObjectStack.class); @@ -111,7 +111,7 @@ private int folder_level; - public ArchObjectStack(CMainControl control) { + public ArchObjectStack(final CMainControl control) { m_control = control; archNodeListCount = 0; faceListCount = 0; @@ -143,7 +143,7 @@ return archHashTable; } - @Nullable public ImageIcon getFace(int i) { + @Nullable public ImageIcon getFace(final int i) { if (i >= 0 && i < faceListCount) { return faceObjects[i].getFace(); } @@ -151,7 +151,7 @@ return null; } - @Nullable public String getFaceName(int i) { + @Nullable public String getFaceName(final int i) { if (i >= 0 && i < faceListCount) { return faceObjects[i].getName(); } @@ -167,7 +167,7 @@ return faceListCount; } - @Nullable public ArchObjectNode getNextNode(ArchObjectNode node) { + @Nullable public ArchObjectNode getNextNode(final ArchObjectNode node) { if (node == null) { return archNodeList[0]; } @@ -180,7 +180,7 @@ return null; } - @Nullable public ArchObject getArch(int i) { + @Nullable public ArchObject getArch(final int i) { if (i >= 0 && i < archNodeListCount) { return archNodeList[i].arch; } @@ -188,12 +188,12 @@ return null; } - @Nullable public ArchObject newArchObjectInstance(int i) { + @Nullable public ArchObject newArchObjectInstance(final int i) { if (i < 0 && i >= archNodeListCount) { return null; } - ArchObject arch = new ArchObject(); + final ArchObject arch = new ArchObject(); arch.setArchName(new String(archNodeList[i].arch.getArchName())); if (!archNodeList[i].arch.getFaceFlag()) { arch.setFaceNr(archNodeList[i].arch.getFaceNr()); @@ -204,8 +204,8 @@ } // add a arch to our list - public void addArchToList(ArchObject data) { - ArchObjectNode newnode = new ArchObjectNode(data); + public void addArchToList(final ArchObject data) { + final ArchObjectNode newnode = new ArchObjectNode(data); newnode.arch.setNodeNr(archNodeListCount); archHashTable.put(data.getArchName(), new Integer(archNodeListCount)); archNodeList[archNodeListCount++] = newnode; @@ -213,14 +213,14 @@ /** load the arches */ public void loadArches() { - Date time_start = new Date(); // get starting time + final Date time_start = new Date(); // get starting time load_status = IS_LOADING; // status: loading log.info("Start to collect arches..."); CMainStatusbar.getInstance().setText(" Loading Arches... "); // browse arch archive // load object from a arch file you found - File f = new File(m_control.getArchDefaultFolder()); + final File f = new File(m_control.getArchDefaultFolder()); folder_level = 0; m_control.disableTabPane(); @@ -257,8 +257,8 @@ } else { // display the time it took to collect arches: load_status = IS_COMPLETE; // status: stack completed - Date time_finish = new Date(); // get finishing time - long diff = time_finish.getTime() - time_start.getTime(); + final Date time_finish = new Date(); // get finishing time + final long diff = time_finish.getTime() - time_start.getTime(); if (log.isInfoEnabled()) { log.info("Arch collect took " + diff / 1000. + " Seconds"); } @@ -276,7 +276,7 @@ * WARNING: Don't include multi arches in the artifacts file * This code can't handle it nor the real server */ - private void loadArchesFromArtifacts(String fname) { + private void loadArchesFromArtifacts(final String fname) { int line_count = 0; Integer index; ArchObject arch, def_arch; @@ -286,8 +286,8 @@ //Open the file for reading try { - FileReader fr = new FileReader(fname); - BufferedReader myInput = new BufferedReader(fr); + final FileReader fr = new FileReader(fname); + final BufferedReader myInput = new BufferedReader(fr); // do the actual parsing //parseDefArchFromStream(myInput, 0); @@ -337,9 +337,9 @@ myInput.close(); fr.close(); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.error("Artifacts file could not be found"); - } catch (IOException e) { + } catch (final IOException e) { log.error("IOException in reading Artifacts!", e); } } @@ -355,8 +355,8 @@ try { // open the resource file - String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR); - CFileReader stream = new CFileReader(baseDir, IGUIConstants.ARCH_FILE); + final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR); + final CFileReader stream = new CFileReader(baseDir, IGUIConstants.ARCH_FILE); // load all arches m_control.getArchObjectParser().parseDefArchFromStream(stream.getReader(), 0); @@ -369,7 +369,7 @@ } else { loadAllCrossfirePNGFromCollect(); } - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { // no need for a message here, CFileReader takes care of this } } @@ -380,12 +380,11 @@ * @param f file path where we currently are * @param index counter for arches */ - private void loadArchFromFiles(File f, int index) { + private void loadArchFromFiles(final File f, int index) { int len; - String name; + final String name = f.getName(); load_from_archive = false; // don't load from the collected files - name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels if (!name.equalsIgnoreCase("cvs") && !name.equalsIgnoreCase("dev") && !name.startsWith(".")) { @@ -401,7 +400,7 @@ folder_level++; - String[] children = f.list(); + final String[] children = f.list(); for (int i = 0; i < children.length; i++) { loadArchFromFiles(new File(f, children[i]), index); } @@ -436,14 +435,14 @@ * longer used and so is this code. * @param fname filename */ - private void parseDefFace(String fname) { - int x, y; + private void parseDefFace(final String fname) { + final int x, y; String thisLine, thisLine2, anim_name = null, anim_text = null; boolean animflag = false; try { - FileReader fr = new FileReader(fname); - BufferedReader myInput = new BufferedReader(fr); + final FileReader fr = new FileReader(fname); + final BufferedReader myInput = new BufferedReader(fr); while ((thisLine2 = myInput.readLine()) != null) { // hm, thats ugly, but i need to cut off the damn white spaces @@ -489,7 +488,7 @@ } myInput.close(); fr.close(); - } catch (IOException e) { + } catch (final IOException e) { log.warn("Error reading face file: " + e); } } @@ -500,14 +499,14 @@ try { // open a bytestream to the resource file - String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; - CFileInputStream stream = new CFileInputStream(baseDir, IGUIConstants.PNG_FILE); + final String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; + final CFileInputStream stream = new CFileInputStream(baseDir, IGUIConstants.PNG_FILE); try { char c, l; // read-in byte character byte[] buf; // tmp. byte buffer to store the png data int t, size, r; - String tag = "IMAGE"; // this is the starting string for a new png + final String tag = "IMAGE"; // this is the starting string for a new png boolean face_complete; // true when a facename was read successfully boolean crappy_facepath = false; // true when facepathes with '.' detected @@ -612,12 +611,12 @@ // make sure we free all unneeded memory System.runFinalization(); System.gc(); - } catch (IOException e) { + } catch (final IOException e) { log.warn("Read error in file '" + IGUIConstants.PNG_FILE + "'.", e); stream.close(); return; } - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.warn("file " + IGUIConstants.PNG_FILE + " not found!"); } } @@ -626,16 +625,16 @@ private void loadAllDaimoninPNGFromCollect() { String face; // face name of png - ByteArrayInputStream pngdata; // byte input stream to read pngdata from the buffer + final ByteArrayInputStream pngdata; // byte input stream to read pngdata from the buffer try { // open a bytestream to the resource file - CFileInputStream stream = new CFileInputStream(m_control.getArchDefaultFolder(), IGUIConstants.PNG_FILE); + final CFileInputStream stream = new CFileInputStream(m_control.getArchDefaultFolder(), IGUIConstants.PNG_FILE); try { char c; // read-in byte character byte[] buf; // tmp. byte buffer to store the png data int t, size, r; - String tag = "IMAGE"; // this is the starting string for a new png + final String tag = "IMAGE"; // this is the starting string for a new png // load all pngs do { @@ -730,12 +729,12 @@ // make sure we free all unneeded memory System.runFinalization(); System.gc(); - } catch (IOException e) { + } catch (final IOException e) { log.warn("Read error in file '" + IGUIConstants.PNG_FILE + "'."); stream.close(); return; } - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.warn("file " + IGUIConstants.PNG_FILE + " not found!"); } } @@ -746,9 +745,9 @@ * @param fname filename, absolute path * @param name name of the png (e.g. blocked.111.png) */ - private void addPNGFace(String fname, String name) { - File f = new File(fname); - long size = f.length(); + private void addPNGFace(final String fname, final String name) { + final File f = new File(fname); + final long size = f.length(); faceObjects[faceListCount] = new FaceObject(null, fname, 0, (int) f.length()); // generating the face name: @@ -786,14 +785,12 @@ public void connectFaces() { int i, s; - String aname; - Integer num; // run through arches for (s = 0; s < archNodeListCount; s++) { - aname = archNodeList[s].arch.getFaceName(); + final String aname = archNodeList[s].arch.getFaceName(); if (aname != null) { - num = (Integer) faceHashTable.get(aname); + final Integer num = (Integer) faceHashTable.get(aname); if (num != null) { archNodeList[s].arch.setFaceNr(num.intValue()); } @@ -823,8 +820,9 @@ */ private void collectCFArches() { ArchObject arch; - String def = "00000", numstring, num; - byte b[] = new byte[1024 * 50]; // hm, 50 kb should be enough + final String def = "00000"; + String numstring, num; + final byte b[] = new byte[1024 * 50]; // hm, 50 kb should be enough int num_bytes, nr, tmp; File dfile = null; // data file for writing @@ -832,13 +830,13 @@ // open the process bar int updateProg = 0; // counts when the progress bar should be next updated - CollectProgressBar pbar = new CollectProgressBar(m_control.getArchObjectStack().getArchCount(), + final CollectProgressBar pbar = new CollectProgressBar(m_control.getArchObjectStack().getArchCount(), "Collecting Arches..."); try { // create the resource-directorys if they don't exist yet if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { - File dir = new File(IGUIConstants.CONFIG_DIR); + final File dir = new File(IGUIConstants.CONFIG_DIR); if (!dir.exists() || !dir.isDirectory()) { // create the config dir new File("resource").mkdir(); @@ -851,7 +849,7 @@ } // now open the output-stream - DataOutputStream binFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dfile))); + final DataOutputStream binFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dfile))); int count = 0; // count how much arches we've collected @@ -860,8 +858,8 @@ for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); node != null; node = node.next) { - int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers - String[] cathList = node.data.getListCathegoryArray(); // list of cath. strings + final int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers + final String[] cathList = node.data.getListCathegoryArray(); // list of cath. strings int multiparts = 0; @@ -1007,8 +1005,7 @@ pbar.setValue(count); binFile.close(); - binFile = null; - } catch (IOException e) { + } catch (final IOException e) { log.error("Error: Exception collecting: archfile", e); return; } @@ -1016,10 +1013,10 @@ /* try { CMainStatusbar.getInstance().setText("Collect Archfile: write animations"); - DataOutputStream binFile = new DataOutputStream( + final DataOutputStream binFile = new DataOutputStream( new BufferedOutputStream(new FileOutputStream("animations"))); - int count = m_control.animationObject.getAnimObjectCounter(); + final int count = m_control.animationObject.getAnimObjectCounter(); // sort it... Arrays.sort(m_control.animationObject.nameStringTable(), 0, count); @@ -1031,7 +1028,7 @@ } binFile.close(); binFile = null; - } catch (IOException e) { + } catch (final IOException e) { System.out.println("Error: Exception collecting: animation file\n"); return; } @@ -1048,29 +1045,28 @@ dfile = new File(IGUIConstants.PNG_FILE); } - FileInputStream fin = null; - DataOutputStream binFile = new DataOutputStream( + final DataOutputStream binFile = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(dfile))); // write number 0 dummy entry - String pname; num = Integer.toString(0); numstring = def.substring(0, 5 - num.length()) + num; num_bytes = 0; + final FileInputStream fin1; try { - fin = new FileInputStream(faceObjects[0].getPath()); - } catch (ArrayIndexOutOfBoundsException e) { + fin1 = new FileInputStream(faceObjects[0].getPath()); + } catch (final ArrayIndexOutOfBoundsException e) { log.warn("You have to give me the name of a file to open."); return; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.warn("Could not open input file " + faceObjects[0].getPath()); return; } try { - num_bytes = fin.read(b, 0, 50000); - } catch (IOException e) { + num_bytes = fin1.read(b, 0, 50000); + } catch (final IOException e) { log.error("Unexpected exception: ", e); return; } @@ -1080,32 +1076,31 @@ return; } - fin.close(); - fin = null; + fin1.close(); binFile.writeBytes("IMAGE " + numstring + " " + num_bytes + " ./arch/system/bug.111\n"); binFile.write(b, 0, num_bytes); // now write all pngs into the file pbar.setLabel("Collecting Images...", 0, faceListCount); for (int i = 0; i < faceListCount; i++) { - fin = null; num_bytes = 0; + final FileInputStream fin2; try { // try to open the png image file - fin = new FileInputStream(faceObjects[i].getPath()); - } catch (ArrayIndexOutOfBoundsException e) { + fin2 = new FileInputStream(faceObjects[i].getPath()); + } catch (final ArrayIndexOutOfBoundsException e) { log.warn("You have to give me the name of a file to open."); return; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.warn("Could not open input file " + faceObjects[i].getPath()); return; } try { // read size and byte-data from png file - num_bytes = fin.read(b, 0, 50000); - } catch (IOException e) { + num_bytes = fin2.read(b, 0, 50000); + } catch (final IOException e) { log.error("Unexpected exception ", e); return; } @@ -1116,21 +1111,21 @@ } // close png file - fin.close(); - fin = null; + fin2.close(); // create path string + final String pname1; if ((tmp = faceObjects[i].getPath().indexOf("arch" + File.separator)) >= 0) { // cut off the path before "arch" - pname = faceObjects[i].getPath().substring(tmp).replace('\\', '/').replace('.', '%'); + pname1 = faceObjects[i].getPath().substring(tmp).replace('\\', '/').replace('.', '%'); } else if ((tmp = faceObjects[i].getPath().indexOf("arch")) >= 0) { // cut off the path before "arch" - pname = faceObjects[i].getPath().substring(tmp).replace('\\', '/').replace('.', '%'); + pname1 = faceObjects[i].getPath().substring(tmp).replace('\\', '/').replace('.', '%'); } else { // hope nobody renames his arch-dir and ends up in here - pname = "arch" + faceObjects[i].getPath().substring(m_control.getArchDefaultFolder().length()).replace('\\', '/'); + pname1 = "arch" + faceObjects[i].getPath().substring(m_control.getArchDefaultFolder().length()).replace('\\', '/'); } - pname = "./" + pname.substring(0, pname.lastIndexOf("/") + 1); + final String pname = "./" + pname1.substring(0, pname1.lastIndexOf("/") + 1); // now write this png data into the big collected png file binFile.writeBytes("IMAGE " + numstring + " " + num_bytes + " " + pname + faceObjects[i].getName() + "\n"); @@ -1145,8 +1140,7 @@ // close png file binFile.close(); - binFile = null; - } catch (IOException e) { + } catch (final IOException e) { log.error("Exception collecting images", e); } @@ -1162,8 +1156,9 @@ */ private void collectDaimoninArches() { ArchObject arch; - String def = "00000", numstring, num; - byte b[] = new byte[1024 * 50]; // hm, 50 kb should be enough + final String def = "00000"; + String numstring, num; + final byte b[] = new byte[1024 * 50]; // hm, 50 kb should be enough int num_bytes, nr; File dfile = null; // data file for writing @@ -1171,14 +1166,14 @@ // open the process bar int updateProg = 0; // counts when the progress bar should be next updated - CollectProgressBar pbar = new CollectProgressBar(m_control.getArchObjectStack().getArchCount(), + final CollectProgressBar pbar = new CollectProgressBar(m_control.getArchObjectStack().getArchCount(), "Collecting Arches..."); try { artifact_count = 0; dfile = new File(m_control.getArchDefaultFolder() + File.separator + IGUIConstants.ARCH_FILE); // now open the output-stream - DataOutputStream binFile = new DataOutputStream( + final DataOutputStream binFile = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(dfile))); int count = 0; // count how much arches we've collected @@ -1188,8 +1183,8 @@ for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); node != null; node = node.next) { - int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers - String[] cathList = node.data.getListCathegoryArray(); // list of cath. strings + final int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers + final String[] cathList = node.data.getListCathegoryArray(); // list of cath. strings int multiparts = 0; @@ -1365,19 +1360,18 @@ pbar.setValue(count); binFile.close(); - binFile = null; - } catch (IOException e) { + } catch (final IOException e) { log.error("Exception collecting: archfile", e); return; } try { CMainStatusbar.getInstance().setText("Collect Archfile: write animations"); - DataOutputStream binFile = new DataOutputStream( + final DataOutputStream binFile = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(m_control.getArchDefaultFolder() + File.separator + "animations"))); final AnimationObjects animObjects = m_control.getAnimationObject(); - int count_ani = animObjects.getNumAnimObjects(); + final int count_ani = animObjects.getNumAnimObjects(); // sort it... pbar.setLabel("Collecting Animations...", 0, count_ani); @@ -1388,8 +1382,7 @@ } } binFile.close(); - binFile = null; - } catch (IOException e) { + } catch (final IOException e) { log.error("Exception collecting: animation file", e); return; } @@ -1400,22 +1393,21 @@ // create the resource-directorys if they don't exist yet dfile = null; - FileWriter al = new FileWriter(m_control.getArchDefaultFolder() + File.separator + IGUIConstants.BMAPS_FILE); - BufferedWriter textFile = new BufferedWriter(al); + final FileWriter al = new FileWriter(m_control.getArchDefaultFolder() + File.separator + IGUIConstants.BMAPS_FILE); + final BufferedWriter textFile = new BufferedWriter(al); dfile = new File(m_control.getArchDefaultFolder() + File.separator + IGUIConstants.PNG_FILE); - FileInputStream fin = null; - DataOutputStream binFile = new DataOutputStream( + final DataOutputStream binFile = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(dfile))); // write number 0 dummy entry - String pname; num = Integer.toString(0); numstring = def.substring(0, 5 - num.length()) + num; num_bytes = 0; + final FileInputStream fin1; try { - fin = new FileInputStream(faceObjects[0].getPath()); + fin1 = new FileInputStream(faceObjects[0].getPath()); } catch (ArrayIndexOutOfBoundsException e) { log.warn("You have to give me the name of a file to open."); return; @@ -1425,8 +1417,8 @@ } try { - num_bytes = fin.read(b, 0, 50000); - } catch (IOException e) { + num_bytes = fin1.read(b, 0, 50000); + } catch (final IOException e) { log.error("Unexpected exception ", e); return; } @@ -1435,8 +1427,7 @@ log.warn("Unexpected EOF: " + faceObjects[0].getPath() + " >> " + num_bytes); return; } - fin.close(); - fin = null; + fin1.close(); binFile.writeBytes("IMAGE " + numstring + " " + num_bytes + " bug.111\n"); binFile.write(b, 0, num_bytes); textFile.write(numstring + " bug.111\n"); @@ -1444,26 +1435,26 @@ // now write all pngs into the file pbar.setLabel("Collecting Images...", 0, faceListCount); for (int i = 0; i < faceListCount; i++) { - fin = null; num_bytes = 0; num = Integer.toString(i + 1); numstring = def.substring(0, 5 - num.length()) + num; + final FileInputStream fin2; try { // try to open the png image file - fin = new FileInputStream(faceObjects[i].getPath()); - } catch (ArrayIndexOutOfBoundsException e) { + fin2 = new FileInputStream(faceObjects[i].getPath()); + } catch (final ArrayIndexOutOfBoundsException e) { log.warn("You have to give me the name of a file to open."); return; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.warn("Could not open input file " + faceObjects[i].getPath()); return; } try { // read size and byte-data from png file - num_bytes = fin.read(b, 0, 50000); - } catch (IOException e) { + num_bytes = fin2.read(b, 0, 50000); + } catch (final IOException e) { log.error("Unexpected exception ", e); return; } @@ -1474,11 +1465,10 @@ } // close png file - fin.close(); - fin = null; + fin2.close(); // create path string - // pname = "./arch"+faceObjects[i].getPath().substring(m_control.getArchDefaultFolder().length()).replace('\\', '/'); + // final String pname = "./arch"+faceObjects[i].getPath().substring(m_control.getArchDefaultFolder().length()).replace('\\', '/'); // pname = pname.substring(0, pname.lastIndexOf("/")+1); // now write this png data into the big collected png file @@ -1496,10 +1486,8 @@ // close png file binFile.close(); - binFile = null; textFile.close(); - textFile = null; - } catch (IOException e) { + } catch (final IOException e) { log.error("Error: Exception collecting images", e); } @@ -1512,23 +1500,22 @@ */ private class CollectProgressBar extends JDialog { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; + final JProgressBar bar; // the progress bar - JProgressBar bar; // the progress bar + final JLabel label; - JLabel label; + private static final long serialVersionUID = -3633959822875652319L; /** * Constructor - builds the window layout and shows it * @param max initial maximum of progress points * @param text the initial label text */ - public CollectProgressBar(int max, String text) { + public CollectProgressBar(final int max, final String text) { super(m_control.getMainView(), "Collect CF Arches", false); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); // can't close - JPanel panel = new JPanel(new GridLayout(2, 1)); + final JPanel panel = new JPanel(new GridLayout(2, 1)); panel.setBorder(BorderFactory.createEmptyBorder(20, 15, 30, 15)); label = new JLabel(text); label.setForeground(Color.black); @@ -1564,7 +1551,7 @@ * Set the label text, a new value and new maximum * @param text new label text */ - public void setLabel(String text, int val, int max) { + public void setLabel(final String text, final int val, final int max) { label.setText(text); bar.setMaximum(max); bar.setValue(val); @@ -1577,7 +1564,7 @@ * @param arch number of loaded arches * @param image number of loaded images */ - public void finished(int arch, int image) { + public void finished(final int arch, final int image) { setVisible(false); removeAll(); @@ -1598,11 +1585,11 @@ public class ArchObjectNode { - ArchObject arch; + final ArchObject arch; - ArchObjectNode next; + final ArchObjectNode next; - public ArchObjectNode(ArchObject data) { + public ArchObjectNode(final ArchObject data) { this.arch = data; this.next = null; } Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-03 16:21:36 UTC (rev 116) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-03 16:58:35 UTC (rev 117) @@ -873,7 +873,7 @@ } // create path string - // pname = "./arch"+faceObjects[i].getPath().substring(mainControl.getArchDefaultFolder().length()).replace('\\', '/'); + // final String pname = "./arch"+faceObjects[i].getPath().substring(mainControl.getArchDefaultFolder().length()).replace('\\', '/'); // pname = pname.substring(0, pname.lastIndexOf("/")+1); // now write this png data into the big collected png file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 16:21:42
|
Revision: 116 Author: christianhujer Date: 2006-06-03 09:21:36 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=116&view=rev Log Message: ----------- Added heading to screenshots. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-03 16:19:59 UTC (rev 115) +++ trunk/src/doc/start.xhtml 2006-06-03 16:21:36 UTC (rev 116) @@ -16,6 +16,7 @@ </head> <body> <div style="float:right;text-align:center;font-size:75%;"> + <h2>Screenshots</h2> <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34850"><img src="http://sourceforge.net/dbimage.php?id=74447" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34851"><img src="http://sourceforge.net/dbimage.php?id=74449" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 16:20:06
|
Revision: 115 Author: christianhujer Date: 2006-06-03 09:19:59 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=115&view=rev Log Message: ----------- Added screenshot subtitles. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-03 15:42:46 UTC (rev 114) +++ trunk/src/doc/start.xhtml 2006-06-03 16:19:59 UTC (rev 115) @@ -15,9 +15,9 @@ <title>Gridarta - 2D MMORPG Map Editor</title> </head> <body> - <div style="float:right;"> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34850"><img src="http://sourceforge.net/dbimage.php?id=74447" alt="Gridarta for Daimonin" height="75" width="100"/></a></p> - <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34851"><img src="http://sourceforge.net/dbimage.php?id=74449" alt="Gridarta for Crossfire" height="75" width="100"/></a></p> + <div style="float:right;text-align:center;font-size:75%;"> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34850"><img src="http://sourceforge.net/dbimage.php?id=74447" alt="Gridarta for Daimonin" height="75" width="100"/><br/>Gridarta for Daimonin</a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34851"><img src="http://sourceforge.net/dbimage.php?id=74449" alt="Gridarta for Crossfire" height="75" width="100"/><br/>Gridarta for Crossfire</a></p> </div> <p> Latest release version: <strong>- (no release yet)</strong> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 15:42:56
|
Revision: 114 Author: christianhujer Date: 2006-06-03 08:42:46 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=114&view=rev Log Message: ----------- Added screenshots. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-03 15:06:15 UTC (rev 113) +++ trunk/src/doc/start.xhtml 2006-06-03 15:42:46 UTC (rev 114) @@ -15,6 +15,10 @@ <title>Gridarta - 2D MMORPG Map Editor</title> </head> <body> + <div style="float:right;"> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34850"><img src="http://sourceforge.net/dbimage.php?id=74447" alt="Gridarta for Daimonin" height="75" width="100"/></a></p> + <p><a href="http://sourceforge.net/project/screenshots.php?group_id=166996&ssid=34851"><img src="http://sourceforge.net/dbimage.php?id=74449" alt="Gridarta for Crossfire" height="75" width="100"/></a></p> + </div> <p> Latest release version: <strong>- (no release yet)</strong> </p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 15:06:27
|
Revision: 113 Author: christianhujer Date: 2006-06-03 08:06:15 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=113&view=rev Log Message: ----------- Updated some documentation. Modified Paths: -------------- trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/history.xhtml Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2006-06-03 14:37:30 UTC (rev 112) +++ trunk/src/doc/dev/codeStyle.xhtml 2006-06-03 15:06:15 UTC (rev 113) @@ -20,6 +20,11 @@ <li>Imports are sorted alphabetically by package, within a package alphabetically by class.</li> <li>The *-form of import is not allowed.</li> <li>Use inline comments rarely. If you have to use inline comments to explain what code does, something is wrong with the code.</li> + <li> + Field initialization with the automatic default value is only allowed if the automatic default value carries semantics that are used later. + In all other circumstances, which means in most cases, fields must not be initialized with the automatic default value. + (The automatic default value is <code>null</code>, zero (any mutations of <code>0</code> resp. <code>0.0</code>) or <code>false</code>.) + </li> </ul> </body> </html> Modified: trunk/src/doc/history.xhtml =================================================================== --- trunk/src/doc/history.xhtml 2006-06-03 14:37:30 UTC (rev 112) +++ trunk/src/doc/history.xhtml 2006-06-03 15:06:15 UTC (rev 113) @@ -35,7 +35,7 @@ <p> The name "Gridarta" was chosen as a combination of the words "grid" and "art". It's an imitation of the original "Gridder" name. - It's reminiscence of "Siddharta" is a coincidence. + It's reminiscence of "Siddharta" is a nice coincidence. </p> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 14:37:46
|
Revision: 112 Author: christianhujer Date: 2006-06-03 07:37:30 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=112&view=rev Log Message: ----------- Fixed problems with spaces in changelog and some other bugs. Modified Paths: -------------- trunk/build.xml trunk/src/doc/.htaccess trunk/src/doc/cleanupXhtml11.xslt trunk/src/doc/dev/changelog.xslt trunk/src/doc/transform.xslt trunk/src/doc/xhtml2html.xslt Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/build.xml 2006-06-03 14:37:30 UTC (rev 112) @@ -532,11 +532,19 @@ <exec executable="svn" output="src/doc/dev/changelog.xml"> <arg line="log -v --xml" /> </exec> - <style - in = "src/doc/dev/changelog.xml" - out = "src/doc/dev/changelog.xhtml" - style = "src/doc/dev/changelog.xslt" - /> + <megaxslt + srcdir="src/doc/dev" + destdir="src/doc/dev" + includes="changelog.xml" + validatesource="false" + validatedest="false" + ending="xhtml" + converttocanonical="true" + transformerFactoryImplementationClassName="net.sf.saxon.TransformerFactoryImpl" + > + <xmlcatalog refid="commonDTDs" /> + <transformation stylesheet="src/doc/dev/changelog.xslt" /> + </megaxslt> </target> </project> Modified: trunk/src/doc/.htaccess =================================================================== --- trunk/src/doc/.htaccess 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/src/doc/.htaccess 2006-06-03 14:37:30 UTC (rev 112) @@ -5,5 +5,5 @@ AddType text/html;charset=UTF-8 .html AddType application/xhtml+xml;charset=UTF-8;qs=0.999 .xhtml AddHandler server-parsed .html -AddHandler server-pasrsed .xhtml +AddHandler server-parsed .xhtml ErrorDocument 404 /status404 Modified: trunk/src/doc/cleanupXhtml11.xslt =================================================================== --- trunk/src/doc/cleanupXhtml11.xslt 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/src/doc/cleanupXhtml11.xslt 2006-06-03 14:37:30 UTC (rev 112) @@ -12,8 +12,9 @@ --> <xsl:transform - version="1.0" + version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:helper="java:com.hujer.xpath.Helper" > @@ -28,9 +29,9 @@ cdata-section-elements="html:script html:style" /> - <xsl:strip-space + <!--xsl:strip-space elements="html:body html:head html:html html:title html:h1 html:h2 html:h3 html:h4 html:h5 html:h6 html:address html:blockquote html:div html:p html:pre html:dl html:dt html:dd html:ol html:ul html:li html:applet html:form html:fieldset html:caption html:table html:td html:th html:tr html:col html:colgroup html:tbody html:thead html:tfoot html:object html:frameset html:param html:img html:frame html:noframes html:iframe html:meta html:link html:input html:select html:optgroup html:option html:button html:label html:legend" - /> + /--> <xsl:template match="html:head/@profile"/> <xsl:template match="html:html/@version"/> @@ -79,7 +80,7 @@ <!--<xsl:template match="@xmlns:*"/>--> <xsl:template match="text()"> - <xsl:value-of select="helper:normalize(., preceding::node()[1], following::node()[1], parent::node())"/> + <xsl:value-of select="helper:normalize(xs:string(.), preceding-sibling::node()[1], following-sibling::node()[1], parent::node())"/> <!--xsl:choose> <xsl:when test=". = ' '"><xsl:text> </xsl:text></xsl:when> <xsl:otherwise> Modified: trunk/src/doc/dev/changelog.xslt =================================================================== --- trunk/src/doc/dev/changelog.xslt 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/src/doc/dev/changelog.xslt 2006-06-03 14:37:30 UTC (rev 112) @@ -1,11 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> <xsl:transform - version="1.0" + version="2.0" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="http://www.w3.org/1999/xhtml" - exclude-result-prefixes="xi xsl" + xmlns:String="http://saxon.sf.net/java.lang.String" + xmlns:System="http://saxon.sf.net/java.lang.System" + xmlns:File="http://saxon.sf.net/java.io.File" + xmlns:URI="http://saxon.sf.net/java.net.URI" + exclude-result-prefixes="xi xs xsl String System File URI" > <xsl:output @@ -100,7 +105,7 @@ <xsl:template match="path"> <li> <xsl:value-of select="@action" /><xsl:text> </xsl:text> - <code><a href="http://svn.sourceforge.net/viewcvs.cgi/gridarta{.}"><xsl:value-of select="." /></a></code> + <code><a href="http://svn.sourceforge.net/viewcvs.cgi/gridarta/{URI:relativize(File:toURI(File:new(System:getProperty('user.dir'))),File:toURI(File:new(substring(., 2))))}"><xsl:value-of select="." /></a></code> </li> </xsl:template> </xsl:transform> Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/src/doc/transform.xslt 2006-06-03 14:37:30 UTC (rev 112) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <xsl:transform - version="1.0" + version="2.0" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" Modified: trunk/src/doc/xhtml2html.xslt =================================================================== --- trunk/src/doc/xhtml2html.xslt 2006-06-03 12:38:34 UTC (rev 111) +++ trunk/src/doc/xhtml2html.xslt 2006-06-03 14:37:30 UTC (rev 112) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Header: /cvsroot/japi/japi/src/doc/xhtml2html.xslt,v 1.3 2006/01/21 13:39:21 christianhujer Exp $ --> <xsl:transform - version="1.0" + version="2.0" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 12:38:40
|
Revision: 111 Author: christianhujer Date: 2006-06-03 05:38:34 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=111&view=rev Log Message: ----------- Fixed bug in changelog, it referenced japi instead of gridarta. Modified Paths: -------------- trunk/src/doc/dev/changelog.xslt Modified: trunk/src/doc/dev/changelog.xslt =================================================================== --- trunk/src/doc/dev/changelog.xslt 2006-06-03 12:14:31 UTC (rev 110) +++ trunk/src/doc/dev/changelog.xslt 2006-06-03 12:38:34 UTC (rev 111) @@ -100,7 +100,7 @@ <xsl:template match="path"> <li> <xsl:value-of select="@action" /><xsl:text> </xsl:text> - <code><a href="http://svn.sourceforge.net/viewcvs.cgi/japi{.}"><xsl:value-of select="." /></a></code> + <code><a href="http://svn.sourceforge.net/viewcvs.cgi/gridarta{.}"><xsl:value-of select="." /></a></code> </li> </xsl:template> </xsl:transform> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-03 12:14:42
|
Revision: 110 Author: christianhujer Date: 2006-06-03 05:14:31 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=110&view=rev Log Message: ----------- Minor improvements to website. Modified Paths: -------------- trunk/src/doc/.htaccess trunk/src/doc/cleanupXhtml11.xslt trunk/src/doc/dev/start.xhtml trunk/src/doc/start.xhtml Modified: trunk/src/doc/.htaccess =================================================================== --- trunk/src/doc/.htaccess 2006-06-02 20:34:17 UTC (rev 109) +++ trunk/src/doc/.htaccess 2006-06-03 12:14:31 UTC (rev 110) @@ -4,4 +4,6 @@ RemoveType .xhtml AddType text/html;charset=UTF-8 .html AddType application/xhtml+xml;charset=UTF-8;qs=0.999 .xhtml +AddHandler server-parsed .html +AddHandler server-pasrsed .xhtml ErrorDocument 404 /status404 Modified: trunk/src/doc/cleanupXhtml11.xslt =================================================================== --- trunk/src/doc/cleanupXhtml11.xslt 2006-06-02 20:34:17 UTC (rev 109) +++ trunk/src/doc/cleanupXhtml11.xslt 2006-06-03 12:14:31 UTC (rev 110) @@ -58,7 +58,11 @@ </xsl:element> </xsl:template> - <xsl:template match="comment()"/> + <xsl:template match="comment()"> + <xsl:if test="starts-with(., '#')"> + <xsl:copy/> + </xsl:if> + </xsl:template> <xsl:template match="/processing-instruction('doc')|/processing-instruction('IS10744')"/> <xsl:template match="processing-instruction()"> Modified: trunk/src/doc/dev/start.xhtml =================================================================== --- trunk/src/doc/dev/start.xhtml 2006-06-02 20:34:17 UTC (rev 109) +++ trunk/src/doc/dev/start.xhtml 2006-06-03 12:14:31 UTC (rev 110) @@ -9,7 +9,7 @@ <body> <h2>Contents</h2> <ul> - <li><a href="changelog">Changelog</a></li> + <li><a href="changelog">Changelog</a> (Warning: large HTML page: <!--#fsize file="changelog.xhtml"-->)</li> <li><a href="codeStyle">Gridarta Code Conventions</a></li> </ul> </body> Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-06-02 20:34:17 UTC (rev 109) +++ trunk/src/doc/start.xhtml 2006-06-03 12:14:31 UTC (rev 110) @@ -41,7 +41,7 @@ You may visit the <a href="http://sourceforge.net/projects/gridarta">Gridarta Project Page at SourceForge</a> or send mail to <a href="mailto:ch...@ri...">ch...@ri...</a>. </li> <li> - You may as well join <a href="irc://irc.freenode.net:6667/%23gridarta">IRC Channel <code>#gridarta</code> at <code>irc.freenode.net</code></a> and look for Cher(istheus), Ragnor, z0ra, Zergus. + You may as well join <a href="irc://irc.freenode.net:6667/%23gridarta">IRC Channel <code>#gridarta</code> at <code>irc.freenode.net</code></a> and look for Cher(istheus), Leaf, Ragnor, z0ra, Zergus. </li> </ul> <h2>Links</h2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |