This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 60862
Collapse All | Expand All

(-)openide/io/api/doc/changes/changes.xml (+18 lines)
Lines 81-86 Link Here
81
    <!-- ACTUAL CHANGES BEGIN HERE: -->
81
    <!-- ACTUAL CHANGES BEGIN HERE: -->
82
82
83
<changes>
83
<changes>
84
    <change id="icon-in-tab">
85
      <api name="io"/>
86
      <summary>Add ability to set icon into the output's tab</summary>
87
      <version major="1" minor="12"/>
88
      <date day="22" month="8" year="2006"/>
89
      <author login="mkleint"/>
90
      <compatibility addition="yes" binary="compatible" semantic="compatible" />
91
      <description>
92
        <p> Adding a method to <code>InputOutput</code> that allows to set an icon to the output. 
93
Most obvious usecase would be icon to denote the state of the output processing.
94
 It's up to the implementation of output window to decide where to put the icon. The default implementation
95
 puts it into the output tab title.
96
        </p> 
97
      </description>
98
      <class package="org.openide.windows" name="InputOutput"/>
99
      <issue number="60862" />
100
    </change>
101
    
84
    <change id="automatic-request-of-io-impl">
102
    <change id="automatic-request-of-io-impl">
85
      <api name="io"/>
103
      <api name="io"/>
86
      <summary> No need to require IOProvider token anymore</summary>
104
      <summary> No need to require IOProvider token anymore</summary>
(-)openide/io/src/org/openide/windows/IOProvider.java (+3 lines)
Lines 26-31 Link Here
26
import java.io.Reader;
26
import java.io.Reader;
27
import java.io.StringWriter;
27
import java.io.StringWriter;
28
import javax.swing.Action;
28
import javax.swing.Action;
29
import javax.swing.Icon;
29
import org.openide.util.Lookup;
30
import org.openide.util.Lookup;
30
31
31
/** A factory for IO tabs shown in the output window.  To create a new tab to
32
/** A factory for IO tabs shown in the output window.  To create a new tab to
Lines 163-168 Link Here
163
            public void setInputVisible(boolean value) {}
164
            public void setInputVisible(boolean value) {}
164
165
165
            public void setOutputVisible(boolean value) {}
166
            public void setOutputVisible(boolean value) {}
167
168
            public void setIcon(Icon icn) {}
166
            
169
            
167
        }
170
        }
168
        
171
        
(-)openide/io/src/org/openide/windows/InputOutput.java (+10 lines)
Lines 22-27 Link Here
22
import java.io.InputStreamReader;
22
import java.io.InputStreamReader;
23
import java.io.OutputStreamWriter;
23
import java.io.OutputStreamWriter;
24
import java.io.Reader;
24
import java.io.Reader;
25
import javax.swing.Icon;
25
import org.openide.util.io.NullOutputStream;
26
import org.openide.util.io.NullOutputStream;
26
import org.openide.util.io.NullInputStream;
27
import org.openide.util.io.NullInputStream;
27
28
Lines 135-140 Link Here
135
    * @deprecated meaningless, does nothing
136
    * @deprecated meaningless, does nothing
136
    */
137
    */
137
    public Reader flushReader();
138
    public Reader flushReader();
139
    
140
    /**
141
     * Set the icon that represents the current state of the InputOutput.
142
     * @since org.openide.io 1.12
143
     */
144
    public void setIcon(Icon icn);
138
145
139
    /** @deprecated Use {@link #NULL} instead. */
146
    /** @deprecated Use {@link #NULL} instead. */
140
    /*public static final*/ Reader nullReader = new InputStreamReader(new NullInputStream());
147
    /*public static final*/ Reader nullReader = new InputStreamReader(new NullInputStream());
Lines 182-187 Link Here
182
    }
189
    }
183
    public Reader flushReader() {
190
    public Reader flushReader() {
184
        return nullReader;
191
        return nullReader;
192
    }
193
194
    public void setIcon(Icon icn) {
185
    }
195
    }
186
}
196
}
187
197
(-)core/output2/src/org/netbeans/core/output2/Controller.java (+3 lines)
Lines 1140-1145 Link Here
1140
                // Undesirable in practice: win.requestVisibleForNewTab();
1140
                // Undesirable in practice: win.requestVisibleForNewTab();
1141
                if (log) log ("Reset on " + tab + " tab displayable " + tab.isDisplayable() + " io " + io + " io.out " + io.out());
1141
                if (log) log ("Reset on " + tab + " tab displayable " + tab.isDisplayable() + " io " + io + " io.out " + io.out());
1142
                break;
1142
                break;
1143
            case IOEvent.CMD_ICON :
1144
                win.setTabIcon(tab, io.getIcon());
1145
                break;
1143
        }
1146
        }
1144
    }
1147
    }
1145
1148
(-)core/output2/src/org/netbeans/core/output2/IOEvent.java (+7 lines)
Lines 108-113 Link Here
108
    static final int CMD_DETACH = 11;
108
    static final int CMD_DETACH = 11;
109
    
109
    
110
    /**
110
    /**
111
     * change the icon on the tab..
112
     */
113
    static final int CMD_ICON = 12;
114
115
    
116
    /**
111
     * Array of IDs for checking legal values and generating a string representing the event.
117
     * Array of IDs for checking legal values and generating a string representing the event.
112
     */
118
     */
113
    private static final int[] IDS = new int[] {
119
    private static final int[] IDS = new int[] {
Lines 123-128 Link Here
123
        CMD_RESET,
129
        CMD_RESET,
124
        CMD_SET_TOOLBAR_ACTIONS,
130
        CMD_SET_TOOLBAR_ACTIONS,
125
        CMD_DETACH,
131
        CMD_DETACH,
132
        CMD_ICON
126
    };
133
    };
127
134
128
    /**
135
    /**
(-)core/output2/src/org/netbeans/core/output2/NbIO.java (+13 lines)
Lines 48-53 Link Here
48
    private Action[] actions;
48
    private Action[] actions;
49
49
50
    private NbWriter out = null;
50
    private NbWriter out = null;
51
52
    private Icon icon;
53
51
    /** Creates a new instance of NbIO 
54
    /** Creates a new instance of NbIO 
52
     * @param name The name of the IO
55
     * @param name The name of the IO
53
     * @param toolbarActions an optional set of toolbar actions
56
     * @param toolbarActions an optional set of toolbar actions
Lines 245-250 Link Here
245
    public Reader flushReader() {
248
    public Reader flushReader() {
246
        return getIn();
249
        return getIn();
247
    }    
250
    }    
251
252
    public void setIcon(Icon icn) {
253
        icon = icn;
254
        post (this, IOEvent.CMD_ICON, icn);
255
        
256
    }
257
    
258
    public Icon getIcon() {
259
        return icon;
260
    }
248
    
261
    
249
    class IOReader extends Reader {
262
    class IOReader extends Reader {
250
        private boolean pristine = true;
263
        private boolean pristine = true;
(-)core/output2/src/org/netbeans/core/output2/ui/AbstractOutputWindow.java (+15 lines)
Lines 81-98 Link Here
81
                    super.remove (aop);
81
                    super.remove (aop);
82
                    assert pane.getParent() != this;
82
                    assert pane.getParent() != this;
83
                    pane.add (aop);
83
                    pane.add (aop);
84
                    setTabIcon(aop, (Icon)aop.getClientProperty("ICON"));
84
                    pane.add (c);
85
                    pane.add (c);
86
                    setTabIcon((AbstractOutputTab)c, (Icon)((AbstractOutputTab)c).getClientProperty("ICON"));
85
                    
87
                    
86
                    super.addImpl (pane, constraints, idx);
88
                    super.addImpl (pane, constraints, idx);
87
                    updateSingletonName(null);
89
                    updateSingletonName(null);
88
                    revalidate();
90
                    revalidate();
89
                } else if (pane.getParent() == this) {
91
                } else if (pane.getParent() == this) {
90
                    pane.add (c);
92
                    pane.add (c);
93
                    setTabIcon((AbstractOutputTab) c, (Icon)((AbstractOutputTab)c).getClientProperty("ICON"));
91
                    revalidate();
94
                    revalidate();
92
                } else {
95
                } else {
93
                    super.addImpl (c, constraints, idx);
96
                    super.addImpl (c, constraints, idx);
97
                    setTabIcon((AbstractOutputTab) c, (Icon)((AbstractOutputTab)c).getClientProperty("ICON"));
94
                    //#48819 - a bit obscure usecase, but revalidate() is call in the if branches above as well..
98
                    //#48819 - a bit obscure usecase, but revalidate() is call in the if branches above as well..
95
                    revalidate();
99
                    revalidate();
100
                    
96
                }
101
                }
97
                if (hadFocus) {
102
                if (hadFocus) {
98
                    //Do not call c.requestFocus() directly, it can be 
103
                    //Do not call c.requestFocus() directly, it can be 
Lines 211-216 Link Here
211
            updateSingletonName(name);
216
            updateSingletonName(name);
212
        }
217
        }
213
        tab.setName(name);
218
        tab.setName(name);
219
    }
220
    
221
    public void setTabIcon(AbstractOutputTab tab, Icon icon) {
222
        if (icon != null) {
223
            tab.putClientProperty("ICON", icon);
224
            if (pane.indexOfComponent(tab) != -1) {
225
                pane.setIconAt(pane.indexOfComponent(tab), icon);
226
                pane.setDisabledIconAt(pane.indexOfComponent(tab), icon);
227
            }
228
        }
214
    }
229
    }
215
    
230
    
216
    public void requestFocus() {
231
    public void requestFocus() {

Return to bug 60862