summaryrefslogtreecommitdiffstats
path: root/drivers/ras
ModeNameSize
-rw-r--r--Kconfig1505logstatsplainblame
-rw-r--r--Makefile108logstatsplainblame
-rw-r--r--cec.c12357logstatsplainblame
-rw-r--r--debugfs.c1130logstatsplainblame
-rw-r--r--debugfs.h191logstatsplainblame
-rw-r--r--ras.c1170logstatsplainblame
dow.java?id=6c18e7ae59af9384a784cb86dffce447a403e453'>^
fbf9fd18 ^
6b6985ee ^

ad252a78 ^
4ace2b8f ^

4ace2b8f ^
6b6985ee ^


671c63c5 ^
cc2dcbfe ^
6b6985ee ^
5d94f0ba ^
6b6985ee ^



cc2dcbfe ^
6b6985ee ^


9693e1a8 ^

d7d94077 ^

9693e1a8 ^



d7d94077 ^

0f2b3dc1 ^
6b6985ee ^






fbf9fd18 ^


d7d94077 ^
fbf9fd18 ^
d7d94077 ^
fbf9fd18 ^

ad252a78 ^
6b6985ee ^



69047bc1 ^


5806e07c ^

69047bc1 ^
ad252a78 ^
6b6985ee ^



0f2b3dc1 ^
6b6985ee ^

0f2b3dc1 ^
4ace2b8f ^
671c63c5 ^
4ace2b8f ^
671c63c5 ^
4ace2b8f ^
0f2b3dc1 ^

4ace2b8f ^

4ace2b8f ^




9693e1a8 ^
6b6985ee ^

9693e1a8 ^










6b6985ee ^
9693e1a8 ^

0f2b3dc1 ^
6b6985ee ^
0f2b3dc1 ^
6b6985ee ^






ad252a78 ^
63e646fc ^

6b6985ee ^

d7d94077 ^





5806e07c ^

d7d94077 ^
5806e07c ^

d7d94077 ^


6b6985ee ^
cc2dcbfe ^









6b6985ee ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

                                      
                      
                       





                                     
                           

                      
                          

                             
 


                                              
                                                        
                                                
                                                                 
                                                 



                                        
                                                                                


                                                                                    

                                               

                                      



                                                                            

                                                                                                                 
 






                                                                    


                                                                                                                      
                                                                                                                
                                                                         
 

                                                                           
 



                                                                                                  


                                                                                                                    

                                                                                                                        
                                                                          
                                                                                                                            



                                                         
 

                         
 
                                                                                
                                                                                            
                                 
                                               
                                     

                                                                                                                   

                                                                                                                  




                                                                                 
                                                                  

                                                                    










                                                                                  
                         

                   
                                                          
 
                                                               






                                                                
 

                                                                                                          

         





                                    

                                                                                   
           

                                                                                                     


                                                                                              
         









                                          
 
package org.openslx.dozmod.gui.window;

import java.awt.Color;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.UIManager;

import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.UserListWindowLayout;
import org.openslx.dozmod.thrift.cache.UserCache;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;

@SuppressWarnings("serial")
public class UserListWindow extends UserListWindowLayout implements UiFeedback {

	private final static Logger LOGGER = Logger.getLogger(UserListWindow.class);

	private final UserListWindow me = this;

	private String ownerId = null;

	public interface UserAddedCallback {
		public void userAdded(UserInfo user, UserListWindow window);
	}

	public UserListWindow(final Window modalParent, final UserAddedCallback callback, String buttonCaption) {
		super(modalParent, buttonCaption);

		addWindowListener(new WindowAdapter() {
			@Override
			public void windowOpened(WindowEvent e) {
				// load the user cache async
				QuickTimer.scheduleOnce(new Task() {
					@Override
					public void fire() {
						final List<UserInfo> cacheList = UserCache.getAll();
						final List<UserInfo> userList = new ArrayList<>(cacheList.size() - 1);
						for (UserInfo user : cacheList) {
							if (ownerId != null && user.getUserId().equals(ownerId))
								continue;

							userList.add(user);
						}

						Gui.asyncExec(new Runnable() {
							@Override
							public void run() {
								userTable.setData(userList, true);
								// Scale the window after getting the list of users.
								int calcHeight = 150 + userList.size() * 20;
								calcHeight = calcHeight > 350 ? calcHeight : 350;
								me.setPreferredSize(Gui.getScaledDimension(450,
										(calcHeight < 600) ? calcHeight : 600));
								me.pack();
								userTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
							}
						});
					}
				});

			}
		});

		// filter the objects in the table depending on the search field
		searchUserField.getDocument().addDocumentListener(new TextChangeListener() {
			@Override
			public void changed() {
				try {
					userTable.getRowSorter().setRowFilter(
							RowFilter.regexFilter("(?i)" + searchUserField.getText()));
					searchUserField.setForeground(UIManager.getColor("TextField.foreground"));
				} catch (IllegalArgumentException ex) {
					searchUserField.setForeground(Color.RED);
				}
			}
		});

		setButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				final UserInfo user = userTable.getSelectedItem();
				if (user == null)
					return;
				callback.userAdded(user, me);
			}
		});

		cancelButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});

		getRootPane().setDefaultButton(setButton);

		userTable.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if (e.getClickCount() == 2) {
					setButton.doClick();
				}
			}
		});

		Gui.centerShellOverShell(modalParent, this);
		//		this.setLocationRelativeTo(SwingUtilities.getWindowAncestor(modalParent));
	}

	/**
	 * Open a new UserListWindow
	 * 
	 * @param modalParent
	 * @param callback
	 * @param buttonCaption
	 * @param ownerId The Id of the owner of an image or lecture. Should not be
	 *            shown in the list. Can be null
	 */
	public static void open(Window modalParent, UserAddedCallback callback, String buttonCaption,
			String ownerId) {
		UserListWindow win = new UserListWindow(modalParent, callback, buttonCaption);
		win.ownerId = ownerId;
		win.setVisible(true);
	}

	@Override
	public boolean wantConfirmQuit() {
		return false;
	}

	@Override
	public void escapePressed() {
		dispose();
	}
}