Ignore:
Timestamp:
09/21/18 13:45:34 (6 years ago)
Author:
bln4
Message:
 
File:
1 edited

Legend:

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

    r1143 r1159  
    148148         * "org.expeditee.items."
    149149         */
    150         public static Widget createWidget(Text source) throws InteractiveWidgetNotAvailableException,
     150        public static Widget createWidget(final Text source) throws InteractiveWidgetNotAvailableException,
    151151                                                                                                                                        InteractiveWidgetInitialisationFailedException
    152152        {
    153153
    154                 if (source == null) throw new NullPointerException("source");
    155                
    156                 if (source.getParent() == null) throw new IllegalArgumentException("source's parent is null, InteractiveWidget's must be created from Text items with non-null parents");
    157 
    158                 String TAG = ItemUtils.GetTag(ItemUtils.TAG_IWIDGET);
     154                if (source == null) {
     155                        throw new NullPointerException("source");
     156                }
     157               
     158                if (source.getParent() == null) {
     159                        throw new IllegalArgumentException("source's parent is null, InteractiveWidget's must be created from Text items with non-null parents");
     160                }
     161
     162                final String TAG = ItemUtils.GetTag(ItemUtils.TAG_IWIDGET);
    159163
    160164                String text = source.getText();
     
    166170
    167171                // Check starts with the widget tag and separator
    168                 if (!text.startsWith(TAG + ":")) throw new IllegalArgumentException("Source text must begin with \"" + TAG + ":\"");
     172                if (!text.startsWith(TAG + ":")) {
     173                        throw new IllegalArgumentException("Source text must begin with \"" + TAG + ":\"");
     174                }
    169175
    170176                // skip over the '@iw:' preamble
     
    191197                //
    192198               
    193                 String tokens_str = (index == -1) ? text : text.substring(0, index);
     199                final String tokens_str = (index == -1) ? text : text.substring(0, index);
    194200
    195201                String[] tokens = Text.parseArgsApache(tokens_str);
     
    203209               
    204210                // create the command line parser
    205                 CommandLineParser parser = new GnuParser();
     211                final CommandLineParser parser = new GnuParser();
    206212
    207213                // create the Options
    208                 Options options = new Options();
     214                final Options options = new Options();
    209215                options.addOption( "al", "anchorleft",   true, "Anchor the vertical left-hand edge of the interactive widget to the value provided " );
    210216                options.addOption( "ar", "anchorright",  true, "Anchor the vertical right-hand edge of the interactive widget to the value provided " );
     
    259265                   
    260266                }
    261                 catch( ParseException exp ) {
     267                catch( final ParseException exp ) {
    262268                    System.err.println( "Unexpected exception:" + exp.getMessage() );
    263269                    core_line = null;
     
    265271                }
    266272               
    267                 HelpFormatter formatter = new HelpFormatter();
    268                 StringWriter usage_str_writer = new StringWriter();
    269             PrintWriter printWriter = new PrintWriter(usage_str_writer);
     273                final HelpFormatter formatter = new HelpFormatter();
     274                final StringWriter usage_str_writer = new StringWriter();
     275            final PrintWriter printWriter = new PrintWriter(usage_str_writer);
    270276           
    271277            String widget_name = tokens[0];
     
    296302                        }
    297303
    298                 } catch (NumberFormatException nfe) {
     304                } catch (final NumberFormatException nfe) {
    299305                        throw new IllegalArgumentException(
    300306                                        "Bad width or height given in source text", nfe);
    301307                }
    302308
    303                 if (tokens.length > 3)
     309                if (tokens.length > 3) {
    304310                        throw new IllegalArgumentException(
    305311                                        "to many arguments given before \":\" in source text");
     312                }
    306313
    307314                String classname = tokens[0];
     
    311318               
    312319                // Attempt to locate the class using reflection
    313                 Class<?> iwclass = findIWidgetClass(classname);
    314 
    315                 if (iwclass == null) // ensure it exists
     320                final Class<?> iwclass = findIWidgetClass(classname);
     321
     322                if (iwclass == null) {
    316323                        throw new InteractiveWidgetNotAvailableException(classname
    317324                                        + " does not exist or is not an InteractiveWidget");
     325                }
    318326
    319327               
     
    329337                if (index > 0) { // index of the first ":"
    330338                        if (text.length()>(index+1)) {
    331                                 String args_str = text.substring(index + 1);
     339                                final String args_str = text.substring(index + 1);
    332340                               
    333341                                 args = Text.parseArgsApache(args_str);
     
    339347                try {
    340348                        // Instantiate the widget - passing the params
    341                         Class parameterTypes[] = new Class[] { Text.class, String[].class };
    342                         Constructor ct = iwclass.getConstructor(parameterTypes);
    343 
    344                         Object arglist[] = new Object[] { source, args };
     349                        final Class parameterTypes[] = new Class[] { Text.class, String[].class };
     350                        final Constructor ct = iwclass.getConstructor(parameterTypes);
     351
     352                        final Object arglist[] = new Object[] { source, args };
    345353
    346354                        inst = (Widget) ct.newInstance(arglist);
    347                 } catch (Exception e) {
     355                } catch (final Exception e) {
    348356                        throw new InteractiveWidgetNotAvailableException(
    349357                                        "Failed to create instance via reflection: " + e.toString(),
     
    352360               
    353361                // Check that the widget is suitable for the current platform
    354                 Ecosystem systemType = EcosystemManager.getType();
     362                final Ecosystem systemType = EcosystemManager.getType();
    355363                if (!inst.isSupportedOnEcosystem(systemType)) {
    356364                        // Try create a JavaFXSwingWidget if creating a Swing widget in JavaFX
     
    383391               
    384392            if(core_line.hasOption( "anchorleft" ) ) {
    385                 String al_str = core_line.getOptionValue( "anchorleft" );
     393                final String al_str = core_line.getOptionValue( "anchorleft" );
    386394               
    387395                anchor_left = (int) Float.parseFloat(al_str);
     
    389397           
    390398            if(core_line.hasOption( "anchorright" ) ) {
    391                 String ar_str = core_line.getOptionValue( "anchorright" );
     399                final String ar_str = core_line.getOptionValue( "anchorright" );
    392400               
    393401                anchor_right = (int) Float.parseFloat(ar_str);
     
    395403           
    396404            if(core_line.hasOption( "anchortop" ) ) {
    397                 String at_str = core_line.getOptionValue( "anchortop" );
     405                final String at_str = core_line.getOptionValue( "anchortop" );
    398406               
    399407                anchor_top = (int) Float.parseFloat(at_str);
     
    401409           
    402410            if(core_line.hasOption( "anchorbottom" ) ) {
    403                 String ab_str = core_line.getOptionValue( "anchorbottom" );
     411                final String ab_str = core_line.getOptionValue( "anchorbottom" );
    404412               
    405413                anchor_bottom = (int) Float.parseFloat(ab_str);
     
    420428        private static Class findIWidgetClass(String classname)
    421429        {
    422                 if(classname == null)
     430                if(classname == null) {
    423431                        return null;
     432                }
    424433                // try just the classname
    425434                try {
    426                         Class c = Class.forName(classname); // attempt to find the class
     435                        final Class c = Class.forName(classname); // attempt to find the class
    427436
    428437                        // If one is found, ensure that it is a descendant of an
     
    431440                                        && superclass != Item.class; superclass = superclass
    432441                                        .getSuperclass()) {
    433                                 if (superclass == Widget.class)
     442                                if (superclass == Widget.class) {
    434443                                        return c;
    435                         }
    436 
    437                 } catch (ClassNotFoundException e) {
     444                                }
     445                        }
     446
     447                } catch (final ClassNotFoundException e) {
    438448                }
    439449                // see if the class is a widget with invalid capitalisation, or missing the widget package prefix
     
    442452                }
    443453                try {
    444                         Class c = Class.forName(Actions.getClassName(classname)); // attempt to find the class
     454                        final Class c = Class.forName(Actions.getClassName(classname)); // attempt to find the class
    445455
    446456                        // If one is found, ensure that it is a descendant of an
     
    449459                                        && superclass != Item.class; superclass = superclass
    450460                                        .getSuperclass()) {
    451                                 if (superclass == Widget.class)
     461                                if (superclass == Widget.class) {
    452462                                        return c;
    453                         }
    454 
    455                 } catch (ClassNotFoundException e) {
     463                                }
     464                        }
     465
     466                } catch (final ClassNotFoundException e) {
    456467                }
    457468
     
    522533         *
    523534         */
    524         protected Widget(Text source, int minWidth, int maxWidth, int minHeight, int maxHeight)
    525         {
    526                 if (source == null) throw new NullPointerException("source");
     535        protected Widget(final Text source, final int minWidth, final int maxWidth, final int minHeight, final int maxHeight)
     536        {
     537                if (source == null) {
     538                        throw new NullPointerException("source");
     539                }
    527540                if (source.getParent() == null) {
    528541                        throw new IllegalArgumentException("source's parent is null, InteractiveWidget's must be created from Text items with non-null parents");
     
    533546                setSizeRestrictions(minWidth, maxWidth, minHeight, maxHeight); // throws IllegalArgumentException's
    534547
    535                 int x = source.getX();
    536                 int y = source.getY();
    537                 int width = (int) ((_minWidth < 0) ? 10 : _minWidth);
    538                 int height = (int) ((_minHeight < 0) ? 10 : _minHeight);
    539 
    540                 Frame idAllocator = _textRepresentation.getParent();
     548                final int x = source.getX();
     549                final int y = source.getY();
     550                final int width = (_minWidth < 0) ? 10 : _minWidth;
     551                final int height = (_minHeight < 0) ? 10 : _minHeight;
     552
     553                final Frame idAllocator = _textRepresentation.getParent();
    541554
    542555                // create WidgetCorners
     
    552565                _l4 = new WidgetEdge(_d4, _d1, idAllocator.getNextItemID(), this);
    553566
    554                 Collection<Item> enclist = new ArrayList<Item>(4);
     567                final Collection<Item> enclist = new ArrayList<Item>(4);
    555568                enclist.add(_d1);
    556569                enclist.add(_d2);
     
    601614         *
    602615         */
    603         private void setSizeRestrictions(int minWidth, int maxWidth, int minHeight, int maxHeight)
     616        private void setSizeRestrictions(final int minWidth, final int maxWidth, final int minHeight, final int maxHeight)
    604617        {
    605618                _minWidth = minWidth;
     
    649662        public Widget copy() throws InteractiveWidgetNotAvailableException, InteractiveWidgetInitialisationFailedException
    650663        {
    651                 Text t = _textRepresentation.copy();
    652                 String clonedAnnotation = getAnnotationString();
     664                final Text t = _textRepresentation.copy();
     665                final String clonedAnnotation = getAnnotationString();
    653666                t.setText(clonedAnnotation);
    654667                t.setData(getData());
     
    664677                Frame parent = getParentFrame();
    665678               
    666                 if (parent == null) parent = DisplayController.getCurrentFrame();
     679                if (parent == null) {
     680                        parent = DisplayController.getCurrentFrame();
     681                }
    667682
    668683                if (parent != null) {
    669                         for (Item i : _expediteeItems) {
     684                        for (final Item i : _expediteeItems) {
    670685                                i.setID(parent.getNextItemID());
    671686                        }
     
    684699                // Build the annotation string such that it represents this widgets
    685700                // current state
    686                 String newAnnotation = getAnnotationString();
     701                final String newAnnotation = getAnnotationString();
    687702
    688703                // Set the new text
     
    712727
    713728                // Create tag and append classname
    714                 StringBuilder sb = new StringBuilder(ItemUtils.GetTag(ItemUtils.TAG_IWIDGET));
     729                final StringBuilder sb = new StringBuilder(ItemUtils.GetTag(ItemUtils.TAG_IWIDGET));
    715730                sb.append(':');
    716731                sb.append(' ');
     
    741756
    742757                // Append arguments if any
    743                 String stateArgs = Util.formatArgs(getArgs());
     758                final String stateArgs = Util.formatArgs(getArgs());
    744759                if (stateArgs != null) {
    745760                        sb.append(':');
     
    784799         *
    785800         */
    786         public void setSize(int minWidth, int maxWidth, int minHeight, int maxHeight, float newWidth, float newHeight)
     801        public void setSize(final int minWidth, final int maxWidth, final int minHeight, final int maxHeight, final float newWidth, final float newHeight)
    787802        {
    788803                setSizeRestrictions(minWidth, maxWidth, minHeight, maxHeight);
     
    817832               
    818833                // Remember current isFloating() values
    819                 boolean vfloating[] = new boolean[] { _d1.isFloating(), _d2.isFloating(), _d3.isFloating(), _d4.isFloating() };
     834                final boolean vfloating[] = new boolean[] { _d1.isFloating(), _d2.isFloating(), _d3.isFloating(), _d4.isFloating() };
    820835
    821836                _d1.setFloating(true);
     
    824839                _d4.setFloating(true);
    825840
    826                 float xr = _d1.getX() + width;
    827                 float yb = _d1.getY() + height;
     841                final float xr = _d1.getX() + width;
     842                final float yb = _d1.getY() + height;
    828843
    829844                _d2.setX(xr);
     
    841856        }
    842857
    843     public void setAnchorCorners(Integer left, Integer right, Integer top, Integer bottom)
     858    public void setAnchorCorners(final Integer left, final Integer right, final Integer top, final Integer bottom)
    844859    {
    845860        setAnchorLeft(left);
     
    850865   
    851866
    852         public void setPosition(int x, int y)
    853         {
    854                 if (x == getX() && y == getY()) return;
     867        public void setPosition(final int x, final int y)
     868        {
     869                if (x == getX() && y == getY()) {
     870                        return;
     871                }
    855872
    856873                // Remember current isFloating() values
    857                 boolean vfloating[] = new boolean[] { _d1.isFloating(), _d2.isFloating(), _d3.isFloating(), _d4.isFloating() };
    858 
    859                 int width = getWidth();
    860                 int height = getHeight();
     874                final boolean vfloating[] = new boolean[] { _d1.isFloating(), _d2.isFloating(), _d3.isFloating(), _d4.isFloating() };
     875
     876                final int width = getWidth();
     877                final int height = getHeight();
    861878
    862879                invalidateLink();
     
    895912         * @return False if need to call super.setPosition
    896913         */
    897         public boolean setPositions(WidgetCorner src, float x, float y)
    898         {
    899                 if (_settingPositionFlag) return false;
     914        public boolean setPositions(final WidgetCorner src, final float x, final float y)
     915        {
     916                if (_settingPositionFlag) {
     917                        return false;
     918                }
    900919               
    901920                _settingPositionFlag = true;
     
    904923
    905924                // Check to see if the widget is fully being picked up
    906                 boolean isAllPickedUp = (_d1.isFloating() && _d2.isFloating() && _d3.isFloating() && _d4.isFloating());
     925                final boolean isAllPickedUp = (_d1.isFloating() && _d2.isFloating() && _d3.isFloating() && _d4.isFloating());
    907926
    908927                // If so, then this will be called one by one ..
     
    942961                                }
    943962
    944                                 if (!(src == _d4 && _d1.isFloating() && _d4.isFloating()))
     963                                if (!(src == _d4 && _d1.isFloating() && _d4.isFloating())) {
    945964                                        _d1.setX(newX);
    946                                 if (!(src == _d1 && _d4.isFloating() && _d1.isFloating()))
     965                                }
     966                                if (!(src == _d1 && _d4.isFloating() && _d1.isFloating())) {
    947967                                        _d4.setX(newX);
     968                                }
    948969
    949970                        } else if (src == _d2 || src == _d3) {
     
    962983                                }
    963984
    964                                 if (!(src == _d3 && _d2.isFloating() && _d3.isFloating()))
     985                                if (!(src == _d3 && _d2.isFloating() && _d3.isFloating())) {
    965986                                        _d2.setX(newX);
    966                                 if (!(src == _d2 && _d3.isFloating() && _d2.isFloating()))
     987                                }
     988                                if (!(src == _d2 && _d3.isFloating() && _d2.isFloating())) {
    967989                                        _d3.setX(newX);
     990                                }
    968991                        }
    969992
     
    9861009                                }
    9871010
    988                                 if (!(src == _d2 && _d1.isFloating() && _d2.isFloating()))
     1011                                if (!(src == _d2 && _d1.isFloating() && _d2.isFloating())) {
    9891012                                        _d1.setY(newY);
    990                                 if (!(src == _d1 && _d2.isFloating() && _d1.isFloating()))
     1013                                }
     1014                                if (!(src == _d1 && _d2.isFloating() && _d1.isFloating())) {
    9911015                                        _d2.setY(newY);
     1016                                }
    9921017
    9931018                        } else if (src == _d3 || src == _d4) {
     
    10061031                                }
    10071032
    1008                                 if (!(src == _d4 && _d3.isFloating() && _d4.isFloating()))
     1033                                if (!(src == _d4 && _d3.isFloating() && _d4.isFloating())) {
    10091034                                        _d3.setY(newY);
    1010                                 if (!(src == _d3 && _d4.isFloating() && _d3.isFloating()))
     1035                                }
     1036                                if (!(src == _d3 && _d4.isFloating() && _d3.isFloating())) {
    10111037                                        _d4.setY(newY);
     1038                                }
    10121039                        }
    10131040                }
    10141041
    10151042                // Update source text position so position is remembered from loading
    1016                 float newTextX = getX();
    1017                 float newTextY = getY();
     1043                final float newTextX = getX();
     1044                final float newTextY = getY();
    10181045                if (_textRepresentation.getX() != newTextX || _textRepresentation.getY() != newTextY) {
    10191046                        _textRepresentation.setPosition(newTextX, newTextY);
     
    10721099        }
    10731100
    1074         public final void onParentStateChanged(ItemParentStateChangedEvent e)
     1101        public final void onParentStateChanged(final ItemParentStateChangedEvent e)
    10751102        {
    10761103                switch (e.getEventType()) {
     
    11041131         *
    11051132         */
    1106         protected void onParentStateChanged(int eventType)
     1133        protected void onParentStateChanged(final int eventType)
    11071134        {
    11081135        }
     
    11521179        protected void paintInFreeSpace()
    11531180        {
    1154                 GraphicsManager g = EcosystemManager.getGraphicsManager();
     1181                final GraphicsManager g = EcosystemManager.getGraphicsManager();
    11551182                g.drawRectangle(new Point(getX(), getY()), new Dimension(getWidth(), getHeight()), 0.0, new Fill(FREESPACE_BACKCOLOR), null, null, null);
    11561183        }
     
    12101237        protected boolean removeSelf()
    12111238        {
    1212                 Frame parent = getParentFrame();
     1239                final Frame parent = getParentFrame();
    12131240
    12141241                if (parent != null) {
     
    12431270        protected void invalidateSelf()
    12441271        {
    1245                 AxisAlignedBoxBounds dirty = new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
     1272                final AxisAlignedBoxBounds dirty = new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
    12461273                DisplayController.invalidateArea(dirty);
    12471274                invalidateLink();
     
    12541281        {
    12551282                if (_textRepresentation.getLink() != null || _textRepresentation.hasAction()) {
    1256                         AxisAlignedBoxBounds linkArea = _textRepresentation.getLinkDrawArea(getLinkX(), getLinkY());
     1283                        final AxisAlignedBoxBounds linkArea = _textRepresentation.getLinkDrawArea(getLinkX(), getLinkY());
    12571284                        DisplayController.invalidateArea(linkArea);
    12581285                }
     
    13161343         *             If tag is empty.
    13171344         */
    1318         protected String getStrippedDataString(String tag)
    1319         {
    1320                 if (tag == null) throw new NullPointerException("tag");
    1321                 if (tag.length() == 0) throw new IllegalArgumentException("tag is empty");
     1345        protected String getStrippedDataString(final String tag)
     1346        {
     1347                if (tag == null) {
     1348                        throw new NullPointerException("tag");
     1349                }
     1350                if (tag.length() == 0) {
     1351                        throw new IllegalArgumentException("tag is empty");
     1352                }
    13221353
    13231354                if (getCurrentRepresentation().getData() != null) {
    1324                         for (String str : getCurrentRepresentation().getData()) {
     1355                        for (final String str : getCurrentRepresentation().getData()) {
    13251356                                if (str != null && str.startsWith(tag) && str.length() > tag.length()) {
    13261357                                        return str.substring(tag.length());
     
    13571388         *
    13581389         */
    1359         protected Integer getStrippedDataInt(String tag, Integer defaultValue)
     1390        protected Integer getStrippedDataInt(final String tag, final Integer defaultValue)
    13601391        {
    13611392                String strippedStr = getStrippedDataString(tag);
     
    13661397                                try {
    13671398                                        return Integer.parseInt(strippedStr);
    1368                                 } catch (NumberFormatException e) { /* Consume */
     1399                                } catch (final NumberFormatException e) { /* Consume */
    13691400                                }
    13701401                        }
     
    14021433         *
    14031434         */
    1404         protected Long getStrippedDataLong(String tag, Long defaultValue)
     1435        protected Long getStrippedDataLong(final String tag, final Long defaultValue)
    14051436        {
    14061437                String strippedStr = getStrippedDataString(tag);
     
    14111442                                try {
    14121443                                        return Long.parseLong(strippedStr);
    1413                                 } catch (NumberFormatException e) { /* Consume */
     1444                                } catch (final NumberFormatException e) { /* Consume */
    14141445                                }
    14151446                        }
     
    14461477         *
    14471478         */
    1448         protected Boolean getStrippedDataBool(String tag, Boolean defaultValue) {
     1479        protected Boolean getStrippedDataBool(final String tag, final Boolean defaultValue) {
    14491480
    14501481                String strippedStr = getStrippedDataString(tag);
     
    14751506         *
    14761507         */
    1477         protected void removeData(String tag)
     1508        protected void removeData(final String tag)
    14781509        {
    14791510                updateData(tag, null);
     
    14831514        protected void addDataIfCaseInsensitiveNotExists(String tag)
    14841515        {
    1485                 if (tag == null) throw new NullPointerException("tag");
     1516                if (tag == null) {
     1517                        throw new NullPointerException("tag");
     1518                }
    14861519               
    14871520                List<String> data = getCurrentRepresentation().getData();
     
    14911524                }
    14921525               
    1493                 for (String s : data) {
     1526                for (final String s : data) {
    14941527                        if (s != null && s.equalsIgnoreCase(tag)) {
    14951528                                return;
     
    15251558         *
    15261559         */
    1527         protected void updateData(String tag, String newData)
    1528         {
    1529                 if (tag == null)
     1560        protected void updateData(final String tag, final String newData)
     1561        {
     1562                if (tag == null) {
    15301563                        throw new NullPointerException("tag");
    1531                 else if (tag.length() == 0)
     1564                } else if (tag.length() == 0) {
    15321565                        throw new IllegalArgumentException("tag is empty");
     1566                }
    15331567
    15341568                // Get current data
     
    15371571                if (data != null) {
    15381572                        for (int i = 0; i < data.size(); i++) {
    1539                                 String str = data.get(i);
     1573                                final String str = data.get(i);
    15401574                                if (str != null && str.startsWith(tag)) {
    15411575                                        data.remove(i);
     
    15451579
    15461580                if (newData != null) {
    1547                         if (data != null)
     1581                        if (data != null) {
    15481582                                data.add(newData);
    1549                         else {
     1583                        } else {
    15501584                                data = new LinkedList<String>();
    15511585                                data.add(newData);
     
    15561590        }
    15571591       
    1558         public boolean containsData(String str) {
    1559                 assert(str != null);
    1560                 if (getCurrentRepresentation().getData() != null)
    1561                         return getCurrentRepresentation().getData().contains(str);
    1562                 return false;
    1563         }
    1564        
    1565         public boolean containsDataTrimmedIgnoreCase(String str) {
     1592        public boolean containsData(final String str) {
    15661593                assert(str != null);
    15671594                if (getCurrentRepresentation().getData() != null) {
    1568                         for (String data : getCurrentRepresentation().getData()) {
     1595                        return getCurrentRepresentation().getData().contains(str);
     1596                }
     1597                return false;
     1598        }
     1599       
     1600        public boolean containsDataTrimmedIgnoreCase(final String str) {
     1601                assert(str != null);
     1602                if (getCurrentRepresentation().getData() != null) {
     1603                        for (final String data : getCurrentRepresentation().getData()) {
    15691604                                if (data != null && data.trim().equalsIgnoreCase(str)) {
    15701605                                        return true;
     
    15861621         *                      a text item.
    15871622         */
    1588         public void setLink(String link, Text linker)
     1623        public void setLink(final String link, final Text linker)
    15891624        {
    15901625                // Make sure the link is redrawn when a link is added
    1591                 if (link == null) invalidateLink();
     1626                if (link == null) {
     1627                        invalidateLink();
     1628                }
    15921629                getSource().setLink(link);
    1593                 if (link != null) invalidateLink();
    1594         }
    1595 
    1596         public void setBackgroundColor(Colour c)
     1630                if (link != null) {
     1631                        invalidateLink();
     1632                }
     1633        }
     1634
     1635        public void setBackgroundColor(final Colour c)
    15971636        {
    15981637                getSource().setBackgroundColor(c);
     
    16221661                // a parent ... thus must manually format link
    16231662
    1624                 String link = getLink();
    1625 
    1626                 if (link == null || link.length() == 0)
     1663                final String link = getLink();
     1664
     1665                if (link == null || link.length() == 0) {
    16271666                        return null;
     1667                }
    16281668
    16291669                if (FrameIO.isPositiveInteger(link)) { // relative - convert to
     
    16321672                        // Get the frameset of this item
    16331673                        Frame parent = getParentFrame();
    1634                         if (parent == null)
     1674                        if (parent == null) {
    16351675                                parent = DisplayController.getCurrentFrame();
    1636                         if (parent == null)
     1676                        }
     1677                        if (parent == null) {
    16371678                                return null;
    1638 
    1639                         String framesetName = parent.getFramesetName();
    1640 
    1641                         if (framesetName == null)
     1679                        }
     1680
     1681                        final String framesetName = parent.getFramesetName();
     1682
     1683                        if (framesetName == null) {
    16421684                                return null;
     1685                        }
    16431686
    16441687                        return framesetName + link;
     
    16591702         *              The color to set.
    16601703         */
    1661         public void setWidgetEdgeColor(Colour c)
     1704        public void setWidgetEdgeColor(final Colour c)
    16621705        {
    16631706                // Indirectly invokes setSourceBorderColor accordingly
    1664                 for (Item i : _expediteeItems) i.setColor(c);
     1707                for (final Item i : _expediteeItems) {
     1708                        i.setColor(c);
     1709                }
    16651710        }
    16661711       
     
    16731718         *              The new thickness to set.
    16741719         */
    1675         public void setWidgetEdgeThickness(float thickness) {
     1720        public void setWidgetEdgeThickness(final float thickness) {
    16761721                _l1.setThickness(thickness, true);
    16771722                //for (Item i : _expediteeItems) i.setThickness(thickness);
     
    16881733
    16891734        // TODO: Maybe rename setSource* ..  to update* ... These should actually be friendly!
    1690         public void setSourceColor(Colour c) {
     1735        public void setSourceColor(final Colour c) {
    16911736                _textRepresentation.setColor(c);
    16921737        }
    16931738
    1694         public void setSourceBorderColor(Colour c) {
     1739        public void setSourceBorderColor(final Colour c) {
    16951740                _textRepresentation.setBorderColor(c);
    16961741        }
    16971742
    1698         public void setSourceFillColor(Colour c) {
     1743        public void setSourceFillColor(final Colour c) {
    16991744                _textRepresentation.setFillColor(c);
    17001745        }
    17011746
    1702         public void setSourceThickness(float newThickness, boolean setConnected) {
     1747        public void setSourceThickness(final float newThickness, final boolean setConnected) {
    17031748                _textRepresentation.setThickness(newThickness, setConnected);
    17041749        }
    17051750
    1706         public void setSourceData(List<String> data) {
     1751        public void setSourceData(final List<String> data) {
    17071752                _textRepresentation.setData(data);
    17081753        }
     
    17161761        }
    17171762
    1718         public void setAnchorLeft(Integer anchor)
     1763        public void setAnchorLeft(final Integer anchor)
    17191764        {
    17201765                _anchoring.setLeftAnchor(anchor);
     
    17321777        }
    17331778
    1734         public void setAnchorRight(Integer anchor) {
     1779        public void setAnchorRight(final Integer anchor) {
    17351780                _anchoring.setRightAnchor(anchor);
    17361781                // Anchor right-edge corners (dots) as well
     
    17491794        }
    17501795       
    1751         public void setAnchorTop(Integer anchor) {
     1796        public void setAnchorTop(final Integer anchor) {
    17521797                _anchoring.setTopAnchor(anchor);
    17531798                // Anchor top-edge corners (dots) as well
     
    17641809        }
    17651810
    1766         public void setAnchorBottom(Integer anchor) {
     1811        public void setAnchorBottom(final Integer anchor) {
    17671812                _anchoring.setBottomAnchor(anchor);
    17681813                // Anchor bottom-edge corners (dots) as well
     
    18371882        public Clip getClip()
    18381883        {
    1839                 Clip clip = new Clip(getBounds());
     1884                final Clip clip = new Clip(getBounds());
    18401885                return clip;
    18411886        }
Note: See TracChangeset for help on using the changeset viewer.