Ticket #2218: book.patch

File book.patch, 1.4 KB (added by diana, 15 years ago)
  • src/main/java/org/sophie2/main/app/layout/left/books/OpenBooksPalette.java

    ### Eclipse Workspace Patch 1.0
    #P org.sophie2.main.app.layout
     
    3535 */ 
    3636@SkinElementId("main.view.layout.books.open-books-palette") 
    3737public class OpenBooksPalette extends ListPalette<OpenBooksPalette.BookItem> { 
    38  
     38        private static final int MAX_LABLE_SIZE = 20; 
    3939        private Map<BookDocView, BookItem> itemsCache = new HashMap<BookDocView, BookItem>(); 
    4040 
    4141        @Override 
     
    168168 
    169169                        JPanel centerPanel = new JPanel(); 
    170170                        centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); 
    171  
    172                         JLabel bookTitle = new JLabel(documentWindow().get().title().get()); 
     171            String bookName = documentWindow().get().title().get(); 
     172            JLabel bookTitle = null; 
     173             
     174            if(bookName.length() >= MAX_LABLE_SIZE) { 
     175                         bookTitle = new JLabel(bookName.substring(0, MAX_LABLE_SIZE - 3)+"..."); 
     176            } else { 
     177                bookTitle =  new JLabel(bookName); 
     178            } 
    173179                        bookTitle.setAlignmentX(Component.CENTER_ALIGNMENT); 
    174180 
    175181                        this.thumbnail.setPreferredSize(new Dimension(82, 64));