Revision: cc1becc7bab9 Branch: new1738 Author: Rebecca Luttmer <rebecca.luttmer@xxxxxxxxx> Date: Wed Feb 11 17:55:48 2015 UTC Log: cells lines editing ready for testing https://code.google.com/p/brailleblaster/source/detail?r=cc1becc7bab9 Modified: /src/main/org/brailleblaster/settings/ui/PagePropertiesTab.java =======================================--- /src/main/org/brailleblaster/settings/ui/PagePropertiesTab.java Tue Feb 10 16:39:20 2015 UTC +++ /src/main/org/brailleblaster/settings/ui/PagePropertiesTab.java Wed Feb 11 17:55:48 2015 UTC
@@ -57,7 +57,7 @@ BBIni bbini; private static final String userSettings = BBIni.getUserSettings(); - Group sizeGroup, marginGroup, pageGroup, buttonGroup, unitsGroup;// + Group sizeGroup, marginGroup, pageGroup, buttonGroup, unitsGroup; Label pageSizeLabel, widthLabel, heightLabel, linesPerPageLabel, cellsPerLineLabel, marginTopLabel, marginBottomLabel, marginLeftLabel, marginRightLabel; @@ -65,11 +65,11 @@ Combo pageTypes; Text widthBox, heightBox, linesBox, cellsBox, marginTopBox, marginLeftBox, marginRightBox, marginBottomBox; - Button okButton, cancelButton, regionalButton, cellsLinesButton;// + Button okButton, cancelButton, regionalButton, cellsLinesButton; boolean listenerLocked; LocaleHandler lh; - public String currentUnits = "regional";// + public String currentUnits = "regional"; DecimalFormat df = new DecimalFormat("#.#"); boolean userModified; protected boolean heightWidthMod; @@ -230,10 +230,10 @@ if (!userModified) { if (listenerLocked) { if (cellsLinesButton.getSelection()) { - settingsMap.put( - type, - String.valueOf(df - .format(calcWidthFromCells(getDoubleValue((t)))))); +// settingsMap.put( +// type, +// String.valueOf(df +// .format(calcWidthFromCells(getDoubleValue((t)))))); }// if cellsLinesButton else { settingsMap.put(type, getStringValue(t)); @@ -271,10 +271,10 @@ if (!userModified) { if (listenerLocked) { if (cellsLinesButton.getSelection()) { - settingsMap.put( - type, - String.valueOf(df.format(sm - .calcHeightFromLines(getDoubleValue(t))))); +// settingsMap.put( +// type, +// String.valueOf(df.format(sm +// .calcHeightFromLines(getDoubleValue(t))))); }// if cellsLinesButton else { @@ -584,10 +584,20 @@ } private double getDoubleValue(Text t) { + try { if (t.getText().length() == 0) return 0.0; else return Double.valueOf(t.getText()); + } + catch (NumberFormatException e) { + if (t.getText().contains("-")) + t.setText(t.getText().replaceAll("-", "")); + if (t.getText().length() == 0) + return 0.0; + else + return Double.valueOf(t.getText()); + } } private String getStringValue(Text t) { @@ -596,20 +606,12 @@ else return t.getText(); } - - public Boolean getRadioSelection() { - Boolean isRegional = regionalButton.getSelection(); - return isRegional; - - } public void modifyMargins() { if (!userModified) { - Boolean isRegional = getRadioSelection(); - - if (isRegional) { + if (regionalButton.getSelection()) { String leftMargin = settingsMap.get("leftMargin"); marginLeftBox.setText(df.format(Double.valueOf(leftMargin))); @@ -813,11 +815,7 @@ settingsMap.put("linesPerPage", String.valueOf(linesBox.getText())); }// else regionalButton - - System.out.println(maxLines); - System.out.println(settingsMap); userModified = false; - }// is isn't focus control }// userModifiesLinesBox @@ -850,9 +848,6 @@ settingsMap.put("cellsPerLine", String.valueOf(cellsBox.getText())); }// else regional button - - System.out.println(maxCells); - System.out.println(settingsMap); userModified = false; }// if not directMarginEdit }// userModifiesCellsBox @@ -867,6 +862,15 @@ return false; }// else }// directMarginEdit + + private boolean directLinesCellsEdit() { + if (linesBox.isFocusControl()||cellsBox.isFocusControl()) { + return true; + }//if + else { + return false; + }//else + }//directLinesCellsEdit }// pagePropertiesTabClass