JTable sorting - problem when adding elements (complete code inside)

I�m writing this email with reference to a recent posting here but this time with the code example. (I apologize for the duplicated posting � this time it will be with the code)
Problem: when adding more elements to the JTable (sorted) the exception: ArrayIndexOutOfBoundsException is thrown.
Example: If the elements in the table are 10 and then the user requests for 8 � the table will produce the correct result. However, if the user will ask for 11 items (>10) the exception will be thrown.
The program: The program below (compiles and running). A JTable is constructed with 3 items, when you click the button - the return result should be 4 items - this will generate the error, WHY?
I would highly appreciate your thoughts why this is happening and most importantly � how to fix it.
Thanks a lot
3 files:
(1) TableSorterDemo
(2) Traveler
(3)TableSorter
//TableSorterDemo:
package sorter;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
* TableSorterDemo is like TableDemo, except that it
* inserts a custom model -- a sorter -- between the table
* and its data model.  It also has column tool tips.
public class TableSorterDemo implements ActionListener
     private JPanel superPanel;
     private JButton clickMe = new JButton("click me to get diff data");
     private boolean DEBUG = false;
     private DefaultListModel defaultListModel;
     private JTable table;
    public TableSorterDemo()
         superPanel = new JPanel(new BorderLayout());
         defaultListModel = new DefaultListModel();
         init1();
        TableSorter sorter = new TableSorter(new MyTableModel(defaultListModel)); //ADDED THIS     
        table = new JTable(sorter);             //NEW
        sorter.setTableHeader(table.getTableHeader()); //ADDED THIS
        table.setPreferredScrollableViewportSize(new Dimension(500, 70));
        //Set up tool tips for column headers.
        table.getTableHeader().setToolTipText(
                "Click to specify sorting; Control-Click to specify secondary sorting");
        //Create the scroll pane and add the table to it.
        JScrollPane scrollPane = new JScrollPane(table);
        //Add the scroll pane to this panel.
        superPanel.add("Center", scrollPane);
        superPanel.add("South",clickMe);
        clickMe.addActionListener(this);              
    public JPanel getPanel()
         return superPanel;
    public void init1()
         //in real life this will be done from the db
         Traveler a = new Traveler();
         Traveler b = new Traveler();
         Traveler c = new Traveler();
         a.setFirstName("Elvis");
         a.setLastName("Presley");
         a.setSprot("Ping Pong");
         a.setNumYears(3);
         a.setVegetarian(true);
         b.setFirstName("Elton");
         b.setLastName("John");
         b.setSprot("Soccer");
         b.setNumYears(2);
         b.setVegetarian(true);
         c.setFirstName("shaquille");
         c.setLastName("oneil");
         c.setSprot("Golf");
         c.setNumYears(22);
         c.setVegetarian(true);
         defaultListModel.addElement(a);
         defaultListModel.addElement(b);
         defaultListModel.addElement(c);
    public void init2()
         //in real life this will be done from the db
         Traveler d = new Traveler();
         Traveler e = new Traveler();
         Traveler f = new Traveler();
         Traveler g = new Traveler();
         d.setFirstName("John");
         d.setLastName("Smith");
         d.setSprot("Tennis");
         d.setNumYears(32);
         d.setVegetarian(true);
         e.setFirstName("Ron");
         e.setLastName("Cohen");
         e.setSprot("Baseball");
         e.setNumYears(12);
         e.setVegetarian(true);
         f.setFirstName("Donald");
         f.setLastName("Mac Novice");
         f.setSprot("Vallyball");
         f.setNumYears(1);
         f.setVegetarian(true);
         g.setFirstName("Eithan");
         g.setLastName("Superstar");
         g.setSprot("Vallyball");
         g.setNumYears(21);
         g.setVegetarian(true);
         defaultListModel.addElement(d);
         defaultListModel.addElement(e);
         defaultListModel.addElement(f);
         defaultListModel.addElement(g);            
    class MyTableModel extends AbstractTableModel
         private DefaultListModel myModel;
         public MyTableModel(DefaultListModel m)
              myModel=m;
        private String[] columnNames = {"First Name",
                                        "Last Name",
                                        "Sport",
                                        "# of Years",
                                        "Vegetarian"};
        public int getColumnCount()
            return columnNames.length;
        public int getRowCount()
            return myModel.size();
        public String getColumnName(int column)
             return getNames()[column];             
         public String[] getNames()
              String[] names = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
              return names;
        public Object getValueAt(int row, int col)
             return distributeObjectsInTable(row, col, (Traveler) myModel.elementAt(row));
        public Object distributeObjectsInTable(int row, int col, Traveler tr)
           switch(col)
                     case 0:
                          return tr.getFirstName();
                     case 1:
                       return tr.getLastName();
                  case 2:
                       return tr.getSprot();
                  case 3:
                       return new Integer(tr.getNumYears());
                  case 4:
                       return new Boolean (tr.isVegetarian());
                 default:
                     return "Error";
        public Class getColumnClass(int c)
            return getValueAt(0, c).getClass();
    private static void createAndShowGUI()
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        //Create and set up the window.
        JFrame frame = new JFrame("TableSorterDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        TableSorterDemo newContentPane = new TableSorterDemo();
        newContentPane.getPanel().setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane.getPanel());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args)
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable()                   
            public void run()
                createAndShowGUI();
     public void actionPerformed(ActionEvent ae)
          if (ae.getSource()==clickMe)
               defaultListModel.removeAllElements();
               init2(); //if the size of the model was less than 2 items - the result will be ok.
                          //in other words, if you commens the last 2 rows of this method (addElement(f) & g)
                         // the result will be fine.
               table.updateUI();          
}//(2) Traveler
package sorter;
public class Traveler
     private String firstName;
     private String lastName;
     private String sprot;
     private int numYears;
     private boolean vegetarian;
     public String getFirstName()
          return firstName;
     public String getLastName()
          return lastName;
     public int getNumYears()
          return numYears;
     public String getSprot()
          return sprot;
     public boolean isVegetarian()
          return vegetarian;
     public void setFirstName(String firstName)
          this.firstName = firstName;
     public void setLastName(String lastName)
          this.lastName = lastName;
     public void setNumYears(int numYears)
          this.numYears = numYears;
     public void setSprot(String sprot)
          this.sprot = sprot;
     public void setVegetarian(boolean vegetarian)
          this.vegetarian = vegetarian;
}//(3)TableSorter
package sorter;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.*;
public class TableSorter extends AbstractTableModel {
    protected TableModel tableModel;
    public static final int DESCENDING = -1;
    public static final int NOT_SORTED = 0;
    public static final int ASCENDING = 1;
    private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
    public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
        public int compare(Object o1, Object o2) {
            return ((Comparable) o1).compareTo(o2);
    public static final Comparator LEXICAL_COMPARATOR = new Comparator() {
        public int compare(Object o1, Object o2) {
            return o1.toString().compareTo(o2.toString());
    private Row[] viewToModel;
    private int[] modelToView;
    private JTableHeader tableHeader;
    private MouseListener mouseListener;
    private TableModelListener tableModelListener;
    private Map columnComparators = new HashMap();
    private List sortingColumns = new ArrayList();
    public TableSorter() {
        this.mouseListener = new MouseHandler();
        this.tableModelListener = new TableModelHandler();
    public TableSorter(TableModel tableModel) {
        this();
        setTableModel(tableModel);
    public TableSorter(TableModel tableModel, JTableHeader tableHeader) {
        this();
        setTableHeader(tableHeader);
        setTableModel(tableModel);
    private void clearSortingState() {
        viewToModel = null;
        modelToView = null;
    public TableModel getTableModel() {
        return tableModel;
    public void setTableModel(TableModel tableModel) {
        if (this.tableModel != null) {
            this.tableModel.removeTableModelListener(tableModelListener);
        this.tableModel = tableModel;
        if (this.tableModel != null) {
            this.tableModel.addTableModelListener(tableModelListener);
        clearSortingState();
        fireTableStructureChanged();
    public JTableHeader getTableHeader() {
        return tableHeader;
    public void setTableHeader(JTableHeader tableHeader) {
        if (this.tableHeader != null) {
            this.tableHeader.removeMouseListener(mouseListener);
            TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
            if (defaultRenderer instanceof SortableHeaderRenderer) {
                this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
        this.tableHeader = tableHeader;
        if (this.tableHeader != null) {
            this.tableHeader.addMouseListener(mouseListener);
            this.tableHeader.setDefaultRenderer(
                    new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
    public boolean isSorting() {
        return sortingColumns.size() != 0;
    private Directive getDirective(int column) {
        for (int i = 0; i < sortingColumns.size(); i++) {
            Directive directive = (Directive)sortingColumns.get(i);
            if (directive.column == column) {
                return directive;
        return EMPTY_DIRECTIVE;
    public int getSortingStatus(int column) {
        return getDirective(column).direction;
    private void sortingStatusChanged() {
        clearSortingState();
        fireTableDataChanged();
        if (tableHeader != null) {
            tableHeader.repaint();
    public void setSortingStatus(int column, int status) {
        Directive directive = getDirective(column);
        if (directive != EMPTY_DIRECTIVE) {
            sortingColumns.remove(directive);
        if (status != NOT_SORTED) {
            sortingColumns.add(new Directive(column, status));
        sortingStatusChanged();
    protected Icon getHeaderRendererIcon(int column, int size) {
        Directive directive = getDirective(column);
        if (directive == EMPTY_DIRECTIVE) {
            return null;
        return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
    private void cancelSorting() {
        sortingColumns.clear();
        sortingStatusChanged();
    public void setColumnComparator(Class type, Comparator comparator) {
        if (comparator == null) {
            columnComparators.remove(type);
        } else {
            columnComparators.put(type, comparator);
    protected Comparator getComparator(int column) {
        Class columnType = tableModel.getColumnClass(column);
        Comparator comparator = (Comparator) columnComparators.get(columnType);
        if (comparator != null) {
            return comparator;
        if (Comparable.class.isAssignableFrom(columnType)) {
            return COMPARABLE_COMAPRATOR;
        return LEXICAL_COMPARATOR;
    private Row[] getViewToModel() {
        if (viewToModel == null) {
            int tableModelRowCount = tableModel.getRowCount();
            viewToModel = new Row[tableModelRowCount];
            for (int row = 0; row < tableModelRowCount; row++) {
                viewToModel[row] = new Row(row);
            if (isSorting()) {
                Arrays.sort(viewToModel);
        return viewToModel;
    public int modelIndex(int viewIndex)
        return getViewToModel()[viewIndex].modelIndex;
    private int[] getModelToView()
        if (modelToView == null) {
            int n = getViewToModel().length;
            modelToView = new int[n];
            for (int i = 0; i < n; i++) {
                modelToView[modelIndex(i)] = i;
        return modelToView;
    // TableModel interface methods
    public int getRowCount() {
        return (tableModel == null) ? 0 : tableModel.getRowCount();
    public int getColumnCount() {
        return (tableModel == null) ? 0 : tableModel.getColumnCount();
    public String getColumnName(int column) {
        return tableModel.getColumnName(column);
    public Class getColumnClass(int column) {
        return tableModel.getColumnClass(column);
    public boolean isCellEditable(int row, int column) {
        return tableModel.isCellEditable(modelIndex(row), column);
    public Object getValueAt(int row, int column) {
        return tableModel.getValueAt(modelIndex(row), column);
    public void setValueAt(Object aValue, int row, int column) {
        tableModel.setValueAt(aValue, modelIndex(row), column);
    // Helper classes
    private class Row implements Comparable {
        private int modelIndex;
        public Row(int index) {
            this.modelIndex = index;
        public int compareTo(Object o) {
            int row1 = modelIndex;
            int row2 = ((Row) o).modelIndex;
            for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
                Directive directive = (Directive) it.next();
                int column = directive.column;
                Object o1 = tableModel.getValueAt(row1, column);
                Object o2 = tableModel.getValueAt(row2, column);
                int comparison = 0;
                // Define null less than everything, except null.
                if (o1 == null && o2 == null) {
                    comparison = 0;
                } else if (o1 == null) {
                    comparison = -1;
                } else if (o2 == null) {
                    comparison = 1;
                } else {
                    comparison = getComparator(column).compare(o1, o2);
                if (comparison != 0) {
                    return directive.direction == DESCENDING ? -comparison : comparison;
            return 0;
    private class TableModelHandler implements TableModelListener {
        public void tableChanged(TableModelEvent e) {
            // If we're not sorting by anything, just pass the event along.            
            if (!isSorting()) {
                clearSortingState();
                fireTableChanged(e);
                return;
            // If the table structure has changed, cancel the sorting; the            
            // sorting columns may have been either moved or deleted from            
            // the model.
            if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
                cancelSorting();
                fireTableChanged(e);
                return;
            // We can map a cell event through to the view without widening            
            // when the following conditions apply:
            // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
            // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
            // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
            // d) a reverse lookup will not trigger a sort (modelToView != null)
            // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
            // The last check, for (modelToView != null) is to see if modelToView
            // is already allocated. If we don't do this check; sorting can become
            // a performance bottleneck for applications where cells 
            // change rapidly in different parts of the table. If cells
            // change alternately in the sorting column and then outside of            
            // it this class can end up re-sorting on alternate cell updates -
            // which can be a performance problem for large tables. The last
            // clause avoids this problem.
            int column = e.getColumn();
            if (e.getFirstRow() == e.getLastRow()
                    && column != TableModelEvent.ALL_COLUMNS
                    && getSortingStatus(column) == NOT_SORTED
                    && modelToView != null) {
                int viewIndex = getModelToView()[e.getFirstRow()];
                fireTableChanged(new TableModelEvent(TableSorter.this,
                                                     viewIndex, viewIndex,
                                                     column, e.getType()));
                return;
            // Something has happened to the data that may have invalidated the row order.
            clearSortingState();
            fireTableDataChanged();
            return;
    private class MouseHandler extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
            JTableHeader h = (JTableHeader) e.getSource();
            TableColumnModel columnModel = h.getColumnModel();
            int viewColumn = columnModel.getColumnIndexAtX(e.getX());
            int column = columnModel.getColumn(viewColumn).getModelIndex();
            if (column != -1) {
                int status = getSortingStatus(column);
                if (!e.isControlDown()) {
                    cancelSorting();
                // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
                // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
                status = status + (e.isShiftDown() ? -1 : 1);
                status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
                setSortingStatus(column, status);
    private static class Arrow implements Icon {
        private boolean descending;
        private int size;
        private int priority;
        public Arrow(boolean descending, int size, int priority) {
            this.descending = descending;
            this.size = size;
            this.priority = priority;
        public void paintIcon(Component c, Graphics g, int x, int y) {
            Color color = c == null ? Color.GRAY : c.getBackground();            
            // In a compound sort, make each succesive triangle 20%
            // smaller than the previous one.
            int dx = (int)(size/2*Math.pow(0.8, priority));
            int dy = descending ? dx : -dx;
            // Align icon (roughly) with font baseline.
            y = y + 5*size/6 + (descending ? -dy : 0);
            int shift = descending ? 1 : -1;
            g.translate(x, y);
            // Right diagonal.
            g.setColor(color.darker());
            g.drawLine(dx / 2, dy, 0, 0);
            g.drawLine(dx / 2, dy + shift, 0, shift);
            // Left diagonal.
            g.setColor(color.brighter());
            g.drawLine(dx / 2, dy, dx, 0);
            g.drawLine(dx / 2, dy + shift, dx, shift);
            // Horizontal line.
            if (descending) {
                g.setColor(color.darker().darker());
            } else {
                g.setColor(color.brighter().brighter());
            g.drawLine(dx, 0, 0, 0);
            g.setColor(color);
            g.translate(-x, -y);
        public int getIconWidth() {
            return size;
        public int getIconHeight() {
            return size;
    private class SortableHeaderRenderer implements TableCellRenderer {
        private TableCellRenderer tableCellRenderer;
        public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) {
            this.tableCellRenderer = tableCellRenderer;
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row,
                                                       int column) {
            Component c = tableCellRenderer.getTableCellRendererComponent(table,
                    value, isSelected, hasFocus, row, column);
            if (c instanceof JLabel) {
                JLabel l = (JLabel) c;
                l.setHorizontalTextPosition(JLabel.LEFT);
                int modelColumn = table.convertColumnIndexToModel(column);
                l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
            return c;
    private static class Directive {
        private int column;
        private int direction;
        public Directive(int column, int direction) {
            this.column = column;
            this.direction = direction;
}

The table listens to the TableModel for changes. Changing the table by adding/removing
rows or columns has no affect on its table model. If you make changes to the table model
the table will be notified by its TableModelListener and change its view. So tell
MyTableModel about the change of data:
public class TableSorterDemo implements ActionListener
    MyTableModel tableModel;
    public TableSorterDemo()
        defaultListModel = new DefaultListModel();
        init1();
        tableModel = new MyTableModel(defaultListModel);
        TableSorter sorter = new TableSorter(tableModel);
    public void actionPerformed(ActionEvent ae)
        if (ae.getSource()==clickMe)
            defaultListModel.removeAllElements();
            init2();
            tableModel.fireTableStructureChanged();
}

Similar Messages

  • Problem when adding ascx user control in the MasterPage: Parser Error Message: The referenced file ... is not allowed on this page.

    Hello,
    I have to maintain a SharePoint 2010 project, in which a TopNavigation User Control for SiteCollection is registered in the MasterPage in this way:
    <%@ Register TagPrefix="ABC" TagName="TopNavigation" src="~/_layouts/ABCApplication/MainSite/Navigation/TopNavigation.ascx" %>
    <asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
    <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
                                        <ABC:TopNavigation ID="TopNavi" XMLDataLocation="/_layouts/ABCApplicatopm/MainSite/TopNavigation.xml" IsRoot="true"
    runat="server" />
    </asp:ContentPlaceHolder>
    </asp:ContentPlaceHolder>
    When I deploy the SiteCollection, the TopNavigation user control is working correctly. Unfortunately when i modify the masterpage over SharePoint Designer, the following error message comes allways, regardless of the art of changes i did in the MAsterPage
    ( even if I open the MasterPage, add an space and do save/close the MasterPage).
    "Problem when adding user control in my custom master page, Parser Error Message: The referenced file '/_layouts/Navigation/TopNavigation.ascx' is not allowed on this page."
    Any ideas?

    Hi Simon,
     When we use UserControl in SharePoint Page or MasterPage, and the UserControl is kept in any folder other than ControlTemplates, we will got the error. Here is an article about this issue and provided the solution:
    http://sharepoint-tina.blogspot.com/2009/07/referenced-file-pathxyzascx-is-not.html 
    The solution can also be used in SharePoint 2010.
    Qiao Wei
    TechNet Community Support

  • Problem when removing elements from table after apply sort

    Hi,
    I have big problem with <af:table> and sorting.
    When I removed objects from a table without sorting, there is no problem but when I removed
    items from the table after sorting, the remain items are not correct.
    For example, i have in my table these items :
    Item AA
    Item CC
    Item ZZ
    Item BB
    Item AA
    Item BB
    Item CC
    Item ZZ
    I sort the table and i select the following Items : Item BB a Item CC
    The remains item is only Item AA, Item ZZ disappear.
    If i resort the table, the missing Item zz appear again in the table.
    Here is my jspx :
    <af:table var="row" rowBandingInterval="1" width="1050" rows="5"
    rowSelection="multiple"
    value="#{pageFlowScope.editNotificationBackingBean.ingredients}"
    binding="#{pageFlowScope.editNotificationBackingBean.ingredientsTable}"
    autoHeightRows="10" id="t2">
    <af:clientListener method="goEditRow" type="dblClick"/>
    <af:serverListener type="doubleClickOnRow" method="#{pageFlowScope.editNotificationBackingBean.handleRequestIngredientsSelectBtn_action}"/>
    <af:column headerText="#{bundle.col_fr_name}" width="240"
    sortable="true" sortProperty="name.FR_Description" id="c1">
    <af:outputText value="#{row.name.texts['fr'].value}" id="ot1"/>
    </af:column>
    In my backing bean i call this method to remove selected elements :
    public void unselectBtn_action(ActionEvent actionEvent) {
    RowKeySet rowKeySet = selectIngredientsTable.getSelectedRowKeys();
    int i = 0;
    Iterator it = rowKeySet.iterator();
    while (it.hasNext()) {
         Integer index = (Integer)it.next() - i;
    selectIngredientsTable.setRowKey(index);
    CompositionIngredient compositionIngredient =
    (CompositionIngredient)selectIngredientsTable.getRowData();
    notification.getProductDetail().getCompositionIngredients().remove(compositionIngredient);
    i++;
    selectIngredientsTable.getSelectedRowKeys().clear();
    AdfFacesContext.getCurrentInstance().addPartialTarget(selectIngredientsTable);
    Thanks in advance.

    I have made a mistake, i don't paste the right <af:table> from my jspx.
    Here is the correct one :
    <af:table var="row" rowBandingInterval="1" width="1050"
    rowSelection="multiple" id="tableSelectedIngredients"
    value="#{pageFlowScope.editNotificationBackingBean.notification.productDetail.compositionIngredients}"
    binding="#{pageFlowScope.editNotificationBackingBean.selectIngredientsTable}"
    partialTriggers="::tab_ingredients_list_expressed_per">
    <af:column sortable="true" headerText="#{bundle.col_name}" id="c5" width="180"
    sortProperty="ingredient.name.FR_Description">
    <af:outputText value="#{row.ingredient.name.texts['fr'].value}"
    id="ot18"/>
    </af:column>
    ...

  • N8 - Strange problem when adding an OVI email acco...

    Hi there.
    When adding my GFs OVI email account to her N8 I start the installer which directs me to a page where I can sign up or login.
    I choose login as she's already setup an account. The login succeeds and we get the "readying inbox" or a similar message. Then the browser seems to get stuck at reloading a link and finally gives me an error saying the login name or password was incorrect.
    Login in on a PC works great.
    I didn't have this problem on my N8 but then again I was using email.nokia.com since my previous E52.
    Any one have a clue?
    Thanks.
    Simon
    N8 User.

    Hi pradeepwitu,
    probably this is the result of your excellent
    code
    Instead of
    code
    you could try
    code
    Regards,
    Clemens

  • Problems when adding iTunes to iMovie project

    I recently recorded onto miniDV tape about 15 minutes of rare color film footage from 1938-40, courtesy of the University of Missouri archives. Using iMovie 6.0.1, I made about 15 clips, divided by subject and year and added some titles. I placed them into the clip viewer and previewed the movie. No problems when I previewed it. I also "unchecked" the ambient audio, because the film was silent and the only sound was the sound of the film projector picked up by the Sony TRV-30 digital camcorder. Via the Internet, I found the top songs of the those years and downloaded them from iTunes. I "clicked and dragged" the songs from iTunes into the sound track of the project. Here's where the problem arose. After I added the music, I previewed the movie. The music track played OK, but the video image was extremely "jerky;" in other words, it would appear to stop momentarily, then "jerk" to a start again. It appears that way through the entire project. Any ideas as to why it would be doing this?
    Also, I have another "mystery." The icon for the project is in the "movies" folder. The icon appears as a white "one-dimentional square" with "sideways Vs" a the top and a black star on a white field on the face of the icon. When I click on the icon, the project opens (clips etc.). In previous projects, there is a two-dimentional folder with a blue front and when you open it, there are other sub-folders in it (a "media" folder" and the .mov file etc). Why does my current movie only give me the option of opening the project, and does not show the media folder and .mov file? As always, your assistance is very much appreciated. This forum has been very helpful to me in the past. --Scooper

    Hi scooper,
    ... An answered the second part, I give a try to part one:
    * is the project located on your Mac's local drive or external?
    * is the iTunes library on the Mac's local drive or external?
    * is the "internet" (<<woohoo, bad kharma;-) ) music coded as aac, mp3 or aiff? or, something different, internet "standard", as ogg, wav, whatever?
    your Mac/iM tries to playback in realtime (sure, that makes sense with a movie...), but obviously has too much to do encoding the music...
    in case you own QTpro or a designated audio-app (Garageband, Audacity), try to convert the internet music (<<woohoo, bad kharma... ah, said that) BEFORE import to iM into aiff...
    in case of usage of external harddrives:
    make sure, the drive is "MacOsExtended" formatted, not FAT32... use Disk Utility to accomplish that (any reformatting erases all content!)
    pay the artists//respect local laws//get good kharma

  • HR Custom InfoTypes problem when added to custom Infoset Report for PA

    Hi, I am having an issue with the adhoc query /SAPQUERY/HR_ADM. I added the custom infotypes 9* I created to this standard infoset by using SQ02 and adding these by going into the menu path Edit--> Change InfoType selection. I regenerated this object and attached to a transport. The query runs fine in the DEV system where I made the change...I can choose fields for output or selection from the standard infotypes and custom infotypes as expected. I migrated this transport to the test system and now when I try to do the same thing I get an error when I try to click on any object in my custom infotype and some of the standard infotype. I tried regenerating and resending to the test system and still have the same issue. This is the error in the dump:
        79 * create work area                                                
        80   create data data_wa like line of data_table.                    
        81   assign data_wa->* to <data_wa>.                                 
        82   assign component fcat_wa-fieldname OF STRUCTURE <data_wa>       
        83     to <field>.                                                   
        84                                                                   
        85   loop at t_fcat into fcat_wa.                                    
        86     field_filled = 'X'.                                           
        87     assign component fcat_wa-fieldname OF STRUCTURE <data_wa>     
        88     to <field>.                                                   
        89     if sy-subrc <> 0.                                             
    >>>>>       raise internal_error.                                       
    It appears the TEXT488 is the value in the fcat_wa-fieldname and I do not see this in the data_wa.
    Does anyone know how to fix this problem or what I might try or look at to see what the difference is between the DEV system (where it works ok) the the Test system where it is giving me an error?
    Thanks in advance for any help you can provide.
    Laurie

    After further investigation I found the problem to this was in the generation of the objects. Even though I generated before attaching to a transport  and all looked ok, there is some sort of bug causing it to not generate properly so I had to sign on to each environment and generate the object in SQ02 including in Production. After I did this the custom infotypes were accessible in the Infoset.

  • TS4522 What is the problem when I get error code 0 when trying to burn a DVD.  It stops around 60-some %.

    I have tried twice to burn a DVD, and both times I get error code 0 at about 60-some % of the transcoding.  I haven't had any trouble burning DVDs before now.

    I had a friend with similar problem, not sure of cause. Happened when sharing to Apple device as well.
    Apple said to delete all files in Render folder. We did not try that as-
    Problem changed slightly for us, in that Share to 'Apple device 720' got to 50% and pretended to have completed its operation, but no file found in Project Share folder.
    We found then, if the timeline clips where highlighted it would share, where previously it had repeatedly failed.
    Hope that helps

  • Sorting Problem when using HtmlDataTable

    Hello,
    In my table, I am displaying a list of homegrown, POJOs that represent users. Each row displays some info about the user as well as several command links for performing certain actions (like showing details, for instance). The sorting criteria is based upon whichever column is selected (the column names are being displayed via command links).
    The sorting for my list of users is working fine with the exception of the command links per row. That is, if I have the following:
    Last Name     First Name
    Conners            John               Show Details
    Conners            Amy               Show DetailsSay I select the "Show Details" link for the first row. Details for John Conners are displayed. Good. Now I decide to sort the same list by First Name so I get the following:
    Last Name     First Name
    Conners            Amy                Show Details
    Conners            John               Show DetailsThe problem now is that when I select "Show Details" for the first row, information for John Conners appears. No matter what I do, it appears that the links in each row remain associated with whatever objects are displayed for that row the very first time the table is built.
    How can I get the command links to "know" that their associated objects have changed after performing a sort routine?
    Any ideas?
    Jeff

    Solution:
    The problem was related to my usage of the list in conjunction with the code in my backing bean. Initially I was storing my list in the request scope. Basically, what was happening was I'd sort the list based upon a column that was selected. However, before the response was committed, I was retrieving the same list again--only in its previous, unordered state.
    Now I have a less bulky (compared to what it could be) list that I store in the session. After I sort, I make sure to update the list in the session so each link in each row of the data table stay associated with the correct data.
    Here's the sort method:
    public void sort(ActionEvent actionEvent) {
            sortColumn = (ColumnType) ColumnType.getEnumManager().getInstance(
                actionEvent.getComponent().getId());
            logger.debug("Attempting to sort by " + sortColumn);
            Comparator c = null;
            // Sort method will depend upon the column type
            switch (sortColumn.getValue()) {
            case ApplicationConstants.USER_ID_COLUMN:
                c = new BeanPropertyComparator(ApplicationConstants.ID);
                Collections.sort((List) this.getSearchResults(), c);
                break;
            case ApplicationConstants.LAST_NAME_COLUMN:
                c = new BeanPropertyComparator(ApplicationConstants.LAST_NAME);
                Collections.sort((List) this.getSearchResults(), c);
                break;
            case ApplicationConstants.FIRST_NAME_COLUMN:
                c = new BeanPropertyComparator(ApplicationConstants.FIRST_NAME);
                Collections.sort((List) this.getSearchResults(), c);
                break;
            default:
                break;
             * Update the object stored in the session so the sort order will be
             * retained between requests.
            facesContext.getApplication().createValueBinding(
                "#{sessionScope.searchResults}").setValue(facesContext,
                this.getSearchResults());
        }The search results are initialized from a previous search page and its backing bean. The results are passed as a managed property to the bean containing the sort method.
    Some snippets of my edit page that calls the sorting method is below:
    <h:dataTable id="userTable" styleClass="table-background"
                        rowClasses="table-odd-row,table-even-row" cellpadding="5"
                        value="#{pc_Search_user_results.searchResults}" var="searchResult"
                        binding="#{pc_Search_user_results.userTable}">
                        <h:column>
                             <f:facet name="header">
                                  <h:commandLink styleClass="table-header" id="userId"
                                       actionListener="#{pc_Search_user_results.sort}">
                                       <h:outputText value="User ID" />
                                  </h:commandLink>
                             </f:facet>
                             <h:outputText value="#{searchResult.id}" />
                        </h:column>
    <h:column>
                             <h:commandLink id="editLink" action="#{pc_Search_user_results.editUser}">
                                  <h:outputText value="Edit" />
                             </h:commandLink>
                        </h:column>This is a long post, but I thought I'd try to explain for those who attempted to help as well as others.
    Jeff

  • Having problems when adding new Curency value field + currency field.

    I need to add a new Currency field (CURR, length 15, 2 decimal places) plus the Currency field itself to a view. 
    I'm really struggerling. I have looked at the existing SAP fields in the Component workbench and I have to admit I can not see how a field is linked/related to the currency itself. Is this link established purlely at the disctionary level?.
    Has anyone added their own Z field value  and Z currency field before. I can create both fields and display them, but what I can not work out is how I related them within the component workbench, or is this done from the dictionary?.
    Any help would be greatly appreciated.
    I should have been able to look at an existing SAP example and work out how it's done, but so far I can not see/determine how this is achieved, even though someone has mentioned that it's controlled via the GET_I_field method. Looking at this method I was expecting to see some mention of both the Currency value field and the Currency field. But as I don't see these confusion reigns.
    Jason

    That's correct, but am I right in thinking that you can't actually create the currency key field itself?.
    I am aware that currency value fields can be created which reference a currency key field, but can see nothing that allows me to create a currency key field to be referenced.
    I hope that makes sense.
    Also, I have amended the structure, changing my value fields from Decimal 15,2 to Currency 15,2  and have created a new currency key field in the structure and referenced this from the Currency value field.
    Witin the Component/view/context node I can see this new currency key field, but it appears as STRUCT.fieldlabel whereas my currency value field appears in the context node as EXT.fieldlabel, because it was created in the AET.
    My problem is that when attempting to add the currency key field onto the screen I don't have it to select from within the list of structures/attributes. All the others attributes in the context node seem to be there, except the new currency key field/attribute.
    The attribute has a SET_fieldlabel, GET_fieldlabel, GET_M_Fieldlabel and a GET_I_Fieldlabel, which I believe is all that should be required.
    Does anyone know what my problem could be?.
    Jason

  • Display problems when adding a document

    Hi,
    one of our customers is facing a strange problem. He runs SBO 8.8 PL18 on Windows Server 2008 R2, and the users work in SBO through Terminal Server. I will do my best to explain what happens.
    When one adds a manual journal entry, the screen flickers the same number of times there are rows. Let me explain the flickering. Suppose you have 10 rows. When you click Update, the table that displays the rows is kind of refresh or repainted 10 times, then fields are empty ready for a new journal entry. The best way I can describe what one can see is that the table is rolled down as many times as there are rows. Unfortunately I have not been able to record the flickering.
    This take some times, and users fell eyes fatigue because of the flickering. I have seen it on my own computer, so this problem does not relate to the computer used to work with SBO. I am told that it happens as well in A/P Invoices.
    The only hint I have is that display problem does not takes place with a TS established on Server 2003.
    Any hint at what this can be, has someone else seen this ?
    Thanks

    Hello,
    If you are using Add-on then it will happed because programmer set keyword last focus in which cell and i think your programmer have code for some arthritic operation on grid then it will happen.
    So discuss your programmer it will solve issue or give proper explanation for same.
    It will defiantly through add-on .
    for tesing pupose stop the add-on then try make new document.
    Thanks
    Manvendra Singh Niranjan
    Edited by: Manvendra Singh Niranjan on May 21, 2011 8:07 AM

  • TFS 2013: Access problem when adding a AD group to members

    Hi there!
    I have a big access problem. It seems I cant log into TFS if I add a AD group to a collection but I can log in if I add single users from the same group.
    EDIT: The group I want to add is from another domain. Maybe thats the reason for the problem?
    Any ideas? I dont want to add 150 users one by one ;)

    Hi John
    I will try to answer your questions :)
    There’s two domains, TFSdomain and Userdomain, right? - Yes
    The TFSdomain one way trust to Userdomain? - Yes
    If you add a single account(Userdomain) into your TFS Server, this single account(Userdomain) can connect to TFS Web Access or your account can connect to TFS Web Access? Your account and this single account(Userdomain) are not the same account? -
    I have two accounts, one User domain accout and one TFS domain account that is TFS administrator. If I use the TFS domain account to add the User domain account as a project group member this user domain account will be able to access the TFS web access
    from the user domain.
    If you add an AD group(Userdomain) into your TFS Server, the user in this AD group(Userdomain) will cannot access TFS Web Access or your account cannot access TFS Web Access? Your account and this user are the same account? Or your account included in this
    AD group(Userdomain) too? - The user domain:s "domain users" group includes my user domain account. If I add the user domain:s "domain users" group as a project group member in TFS (with my domain user) my user domain account will
    not be able to access the TFS web access from the user domain.
    When connect to TFS Web Access failed, what’s the error message you received? - There is no error message, I am only asked to log in again.
    If you cannot access TFS Web Access, how did you add AD group(Userdomain) into your TFS Server? Or once you added the AD group(Userdomain) into TFS Server, you will cannot access TFS Web Access immediately? Your account is a Userdomain user? -
    I added it with my TFS user domain administer account
    The scenario is as follows:
    I have a one way trust from tfs domain to user domain.
    I add a user domain account as a project group member in TFS. Now this account is granted access to the project using the TFS web access client.
    I remove the user again.
    I add the users domain:s "domain users" group (where my user domain account is included) as a project group member in TFS. Now my user account is
    not granted access to the project using the TFS web access client.
    Hope this will spread some light on the problem.
    Thanks Stefan

  • I am having problems when adding mp3

    So when I sync the whole ipod touch, it's fine, but when I try to sync music or manually add music, i get some error windows.
    When I first got the ipod in Jan2010, it was fine when I manually added mp3s, but recently I tried to add more music, it wouldn't allow me to.
    I tried restoring to factory settings and restore from my back up, it didn't help.
    I disabled my anti-virus (CA), still having trouble adding mp3s manually or syncing.
    Everything else related to syncing works.
    I tried my other ipods for this current PC and I was able to add music to those, but still not with the ipod touch.
    http://sehanafortress.com/help/ipoderrors_201005may0001.jpg
    http://sehanafortress.com/help/ipoderrors_201005may0002.jpg
    http://sehanafortress.com/help/ipoderrors_201005may0003.jpg
    http://sehanafortress.com/help/ipoderrors_201005may0004.jpg
    http://sehanafortress.com/help/ipoderrors_201005may0005.jpg
    Windows XP
    iTunes 9.1.1.12
    ipod touch 3.1.3
    Thank You
    Message was edited by: sehana

    Many thanks.
    Okay ... swinging into "basic principles" troubleshooting mode. I'm suspecting most strongly either a damaged pref file or library file here. If that's what is going on, then these errors should be specific to a single Windows user account on the PC (because there's a different set of iTunes preferences files and library files for each different Windows user account on the PC).
    So I'd like to do a little experiment to check to see if this is a user account specific or system-wide problem on the PC.
    Quit iTunes if you have it open. Head into your User accounts control panel. Create a new user account with full administrative rights.
    Now log out of your usual user account and log into the new account. (Don't use fast user switching to move between accounts.)
    Launch iTunes in the new user account. The iTunes set-up assistant will run. Don't add any files to iTunes when prompted to do so ... just let iTunes eventually launch to an empty library.
    Now in iTunes go "Edit > preferences". Click the Devices tab. Make sure the "Prevent iPods, iPhones and iPads from syncing automatically" checkbox is checked and then click OK.
    Now add a small number of mp3 to the new empty library. (Preferably, make them files that have transfered successfully to the ipod in the past.)
    Now try attaching the iPod. Do not associate the iPod with the empty library. Now try checking that "manually manage" setting.
    Attempt to do a manual transfer of the mp3s to the iPod from the new library. Do they transfer across without the error messages?
    Now add a small number of the files that haven't synced successfully to the iPod (in the usual user account) to the iTunes library in the new account. Again, try a manual transfer of some of those files to the iPod. Do those transfer without the error messages?
    (If both types of manual transfers take place without errors in the new account, that strongly suggests we should try to fix any library file or pref file issue in the usual account. If just the new mp3s refuse to transfer, then I'd be suspicious about a problem with the files themselves. If both types of files refuse to transfer, that would tend to rule out a library file or pref file issue, and we'll start checking on other possible causes of the issues.)

  • Problem when adding a web server in front of weblogic

    Hello all,
    I have the following problem. A Sun ONE WS (6.1) was added in front of the weblogic 70 that runs our application. The WS just forwards the requests from port 91 to the weblogic port, which is 8001. In my application, I have only one <welcome-file-list> that works fine if I access the AS directly. However, It doesn't work when I try to do it thru the WS. Is there anything I need to change in weblogic or my application to make this <welcome-file-list> functionality work ? Someone know if the HTTP request is received differently if it's sent internally ?
    Thanks a lot!
    Federico

    The AS wasn't the problem. Sun one was appending index.html in the request when it forward it to the AS...

  • Reports Developer V9.0.2.0.3, problem when adding sum field

    My report stops working as soon as I add a summary field to the first query. Not even using it yet, just adding it, and closing the report (.jsp) and then opening it again. I have been trying to debug this problem for a couple of days now. This is how I found out the problem occurs after adding the summary field.
    I get the message "REP-0002 Unable to retrieve a string from the Report Builder message file."
    Then, I look at the report. There is no layout, everything in the data model view is molded together. VERY STRANGE.

    Try using .rdf rather than .jsp to save the report. This may get around your problem unless you're using the websource. You could also try saving to XML and make sure that loads/saves correctly.

  • HTML tag problem when adding Google rich snippets in templates?

    The new Google plus Rich Snippets allow us to add a schema tag like this example:
    <html itemscope itemtype="http://schema.org/Article">
    I can do this on my .html pages but as soon as I make any changes to the .dwt template for the page it reverts all of the tags back to <html>
    How do I stop this happening?
    I have tried:
    Changing preferences in Dreamweaver's default code rewrite settings to "'Never Rewrite Code' for HTML document type " but this does not appear to fix things.
    Very frustrating as I have lost days of work.
    Any help would be appreciated
    many thanks
    Craig

    I've done what you have said (I think) however something is not quite right. I am asssuming that I need to add the schema below the <BODY> tag if I make the changes to the template as you have suggested.
    This is my practice page which is in a template:
    http://www.psychics.co.uk/lovepsychic/index.html
    Following the Adobe instruction on the forum: High at the top of the header section we get this code:
    <!-- InstanceParam name="GRS" type="text" value="itemscope itemtype=&quot;http://schema.org/Product"" -->
    For the customised body tag we get this:
    <body itemscope itemtype="http://schema.org/Product">
    Then on the left column of the page and below the navigation and below the <body> I have added this:
    <!-- Start Google snippet -->
    <h1 itemprop="name" content="Love Psychics Readings">Love Psychics - Psychic Love Predictions Online</h1> 
    <img itemprop="image" content="http://www.psychics.co.uk/images/schema/love.jpg" src="/images/stars.gif" width="160" height="76" alt="Psychics and Mediums Network"></img> 
    <p itemprop="description" content="Getting a reading with love psychics to find out about relationships, love, romance, marriage and family. Article about our Love psychics readings onlineservices.">Copyright Psychics &amp; Mediums Network - QKE Ltd.</p>
      <!-- End Google snippet -->
    I must be getting close but it just shows the normal Google plus stuff.
    I need to get your microdata markup into the body of the document somewhere - otherwise Google will use the something like <title> and <meta description>  tags and guess at an image.
    Any idea where I am going wrong or is it a quirk in Dreamweaver?

Maybe you are looking for

  • Time Capsule user account

    I use Lion OSX I have created 2 user accounts on my time capsule in order to backup 2 different macs in the respective user's directories. When i try to restore one of my mac from scratch using "Restore System from Backup", inserting user account and

  • Need help please?

    APPLICATIONNAME cloudos ERROR authDidNotConnect ORIGIN server TYPE error APPSTATECHART SC.Statechart:sc763 initialized: true name: cloudos-statechart current-states: [ active.authUI.fieldsEditable state-transition: active: false suspended: false hand

  • Driver disturbs lock-in amplifier?

    The LabVIEW driver for the Stanford Research Systems SR830 Lock-in Amplifier, downloaded from the NI web site, does not produce accurate readings of the measured voltages(Channel 1 or Channel 2). It appears the phase has been offset, but no offset wa

  • HT5706 My Itunes wont detect my APPLE TV, it shows up as an IPHONE

    I turned on my APPLE TV the other day and a picture of my APPLE TV with a MINI USB cord pointing to the ITUNES symbol appeared. A friend told me it meant i needed to UPDATE my Apple TV by hooking it up to Itunes on my computer. I then plugged my Appl

  • Hi everybody! I forgot my security questions to my Apple ID, now I can't buy anything! How do I get the answers to or change my security questions?

    Hi everybody! I forgot my security questions to my Apple ID, now I can't buy anything! How do I get the answers to or change my security questions?