r3491 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
Author: mallon Date: 2012-07-05 14:49:53 +0200 (Thu, 05 Jul 2012) New Revision: 3491 Url: http://chorem.org/repositories/revision/lima/3491 Log: Modification du mod?\195?\168le de l'interface de lettrage pour la s?\195?\169lection des entr?\195?\169es avec uniquement la souris. Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java 2012-07-05 11:56:32 UTC (rev 3490) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java 2012-07-05 12:49:53 UTC (rev 3491) @@ -36,6 +36,7 @@ protected boolean delettrer; protected String currentLettring; + protected Entry currentEntry; public LetteringModelUI(LetteringTableModel model) { this.model = model; @@ -130,21 +131,33 @@ public void setSelectionInterval(int row, int column) { Entry entryAt = model.getEntryAt(row); setSelectedEntry(entryAt); - //if no line selected or if line selected different of the current - if (isSelectionEmpty() || !currentLettring.equals(entryAt.getLettering())){ - this.currentLettring = entryAt.getLettering(); - super.setSelectionInterval(row, column); - //select entries with the same letter of the selected entry - List<Entry> modelEntries = model.getEntries(); - for(Entry entry : modelEntries){ - if (entry.getLettering() != null && !entry.getLettering().isEmpty()){ - if (entry.getLettering().equals(entryAt.getLettering())){ - int entryToSelect = model.getIndexOfEntry(entry); - super.addSelectionInterval(entryToSelect, entryToSelect); + + if (entryAt.getLettering() != null){ + // no line selected or line selected different of the current + if (isSelectionEmpty() || !currentLettring.equals(entryAt.getLettering())){ + currentLettring = entryAt.getLettering(); + super.setSelectionInterval(row, column); + //select entries with the same letter of the selected entry + List<Entry> modelEntries = model.getEntries(); + for(Entry entry : modelEntries){ + if (entry.getLettering() != null && !entry.getLettering().isEmpty()){ + if (entry.getLettering().equals(entryAt.getLettering())){ + int entryToSelect = model.getIndexOfEntry(entry); + super.addSelectionInterval(entryToSelect, entryToSelect); + } } } } - + }else{ + //no line selected or line selected different of the current + if (isSelectionEmpty() || !currentEntry.equals(entryAt)){ + currentEntry = entryAt; + super.addSelectionInterval(row, column); + //remove entry and get precedent entry for currentEntry + }else { + super.removeSelectionInterval(row, column); + currentEntry = model.getEntryAt(super.getMaxSelectionIndex()); + } } }
participants (1)
-
mallon@users.chorem.org