Changeset 211


Ignore:
Timestamp:
08/11/08 14:57:02 (16 years ago)
Author:
bjn8
Message:
 
Location:
trunk/src/org/expeditee/items/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/HeavyDutyInteractiveWidget.java

    r207 r211  
    374374       
    375375        @Override
    376         public void onParentStateChanged(int eventType) {
     376        protected void onParentStateChanged(int eventType) {
    377377
    378378                switch (eventType) {
  • trunk/src/org/expeditee/items/widgets/InteractiveWidget.java

    r210 r211  
    688688                _d4.setFloating(vfloating[3]);
    689689               
     690                onSizeChanged();
    690691        }
    691692
     
    12531254         */
    12541255        protected void onMoved() {
    1255                
     1256        }
     1257       
     1258        /**
     1259         * Invoked whenever the widget have moved.
     1260         * Can override.
     1261         *
     1262         */
     1263        protected void onSizeChanged() {
    12561264        }
    12571265       
     
    13691377         */
    13701378        protected Long getStrippedDataLong(String tag, Long defaultValue) {
    1371                
    1372                
     1379
    13731380                String strippedStr = getStrippedDataString(tag);
    13741381               
     
    13851392        }
    13861393       
    1387 
     1394        /**
     1395         * All data is removed that is prefixed with the given tag.
     1396         *
     1397         * @param tag
     1398         *              The prefix of the data lines to remove. Must be larger the zero and not null.
     1399         *
     1400         * @throws IllegalArgumentException
     1401         *              If tag is null.
     1402         *
     1403         * @throws NullPointerException
     1404         *              If tag is empty.       
     1405         *
     1406         */
     1407        protected void removeData(String tag) {
     1408                updateData(tag, null);
     1409        }
     1410       
     1411        /**
     1412         * Updates the data with a given tag.
     1413         * All data is removed that is prefixed with the given tag. Then
     1414         * a new line is added (if not null).
     1415         *
     1416         * Note that passing newData with null is the equivelant of removing
     1417         * tag lines.
     1418         *
     1419         * @param tag
     1420         *              The prefix of the data lines to remove. Must be larger the zero and not null.
     1421         *
     1422         * @param newData
     1423         *              The new line to add. Can be null - for not adding anything.
     1424         *
     1425         * @throws IllegalArgumentException
     1426         *              If tag is null.
     1427         *
     1428         * @throws NullPointerException
     1429         *              If tag is empty.       
     1430         *
     1431         * @see #removeData(String)
     1432         *
     1433         */
     1434        protected void updateData(String tag, String newData) {
     1435                if (tag == null) throw new NullPointerException("tag");
     1436                else if(tag.length() == 0) throw new IllegalArgumentException("tag is empty");
     1437
     1438                // Get current data
     1439                List<String> data = getCurrentRepresentation().getData();
     1440               
     1441                if (data != null) {
     1442                        for (int i = 0; i < data.size(); i++) {
     1443                                String str = data.get(i);
     1444                                if (str != null && str.startsWith(tag)) {
     1445                                        data.remove(i);
     1446                                }
     1447                        }
     1448                }
     1449               
     1450                if (newData != null) {
     1451                        data.add(newData);
     1452                }
     1453               
     1454        }
    13881455       
    13891456}
Note: See TracChangeset for help on using the changeset viewer.